linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] fdomain: Remove BIOS-related code from core
@ 2019-05-10 21:23 Ondrej Zary
  2019-05-10 21:23 ` [PATCH 2/2] fdomain: Add ISA bus support Ondrej Zary
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ondrej Zary @ 2019-05-10 21:23 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: Christoph Hellwig, linux-scsi, linux-kernel

Move all BIOS signature and base handling to (currently not merged) ISA bus
driver.

Signed-off-by: Ondrej Zary <linux@zary.sk>
---
 drivers/scsi/fdomain.c     | 18 ++----------------
 drivers/scsi/fdomain.h     | 10 ----------
 drivers/scsi/fdomain_pci.c |  2 +-
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index e43fdd1ab3a8..f0fda2ad1c7d 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -494,7 +494,6 @@ static struct scsi_host_template fdomain_template = {
 };
 
 struct Scsi_Host *fdomain_create(int base, int irq, int this_id,
-				 unsigned long bios_base, struct signature *sig,
 				 struct device *dev)
 {
 	struct Scsi_Host *sh;
@@ -524,9 +523,6 @@ struct Scsi_Host *fdomain_create(int base, int irq, int this_id,
 
 	if (this_id)
 		sh->this_id = this_id & 0x07;
-	else if (sig && sig->bios_major > 0 &&
-		(sig->bios_major < 3 || sig->bios_minor < 2))
-		sh->this_id = 6;
 
 	sh->irq = irq;
 	sh->io_port = base;
@@ -541,19 +537,9 @@ struct Scsi_Host *fdomain_create(int base, int irq, int this_id,
 			  "fdomain", fd))
 		goto fail_put;
 
-	if (!sig || (sig->bios_major < 0 && sig->bios_minor < 0))
-		shost_printk(KERN_INFO, sh, "No BIOS; using SCSI ID %d\n",
-			     sh->this_id);
-	else {
-		char v1 = (sig->bios_major >= 0) ? '0' + sig->bios_major : '?';
-		char v2 = (sig->bios_minor >= 0) ? '0' + sig->bios_minor : '?';
-
-		shost_printk(KERN_INFO, sh, "BIOS version %c.%c at 0x%lx using SCSI ID %d\n",
-			     v1, v2, bios_base, sh->this_id);
-	}
-	shost_printk(KERN_INFO, sh, "%s chip at 0x%x irq %d\n",
+	shost_printk(KERN_INFO, sh, "%s chip at 0x%x irq %d SCSI ID %d\n",
 		     dev_is_pci(dev) ? "TMC-36C70 (PCI bus)" : chip_names[chip],
-		     base, irq);
+		     base, irq, sh->this_id);
 
 	if (scsi_add_host(sh, dev))
 		goto fail_free_irq;
diff --git a/drivers/scsi/fdomain.h b/drivers/scsi/fdomain.h
index a124a95764d6..fabb2e49461f 100644
--- a/drivers/scsi/fdomain.h
+++ b/drivers/scsi/fdomain.h
@@ -41,15 +41,6 @@ enum out_port_type {
 	Write_FIFO	= 12
 };
 
-struct signature {
-	const char *signature;
-	int offset;
-	int length;
-	int bios_major;
-	int bios_minor;
-	int flag; /* 1 = PCI_bus, 2 = ISA_200S, 3 = ISA_250MG, 4 = ISA_200S */
-};
-
 #ifdef CONFIG_PM_SLEEP
 static const struct dev_pm_ops fdomain_pm_ops;
 #define FDOMAIN_PM_OPS	(&fdomain_pm_ops)
@@ -58,6 +49,5 @@ static const struct dev_pm_ops fdomain_pm_ops;
 #endif /* CONFIG_PM_SLEEP */
 
 struct Scsi_Host *fdomain_create(int base, int irq, int this_id,
-				 unsigned long bios_base, struct signature *sig,
 				 struct device *dev);
 int fdomain_destroy(struct Scsi_Host *sh);
diff --git a/drivers/scsi/fdomain_pci.c b/drivers/scsi/fdomain_pci.c
index 381a7157c078..3e05ce7b89e5 100644
--- a/drivers/scsi/fdomain_pci.c
+++ b/drivers/scsi/fdomain_pci.c
@@ -22,7 +22,7 @@ static int fdomain_pci_probe(struct pci_dev *pdev,
 	if (pci_resource_len(pdev, 0) == 0)
 		goto release_region;
 
-	sh = fdomain_create(pci_resource_start(pdev, 0), pdev->irq, 7, 0, NULL,
+	sh = fdomain_create(pci_resource_start(pdev, 0), pdev->irq, 7,
 			    &pdev->dev);
 	if (!sh)
 		goto release_region;
-- 
Ondrej Zary


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] fdomain: Add ISA bus support
  2019-05-10 21:23 [PATCH 1/2] fdomain: Remove BIOS-related code from core Ondrej Zary
@ 2019-05-10 21:23 ` Ondrej Zary
  2019-05-13  7:09   ` Christoph Hellwig
  2019-05-13  7:07 ` [PATCH 1/2] fdomain: Remove BIOS-related code from core Christoph Hellwig
  2019-05-13 22:45 ` Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: Ondrej Zary @ 2019-05-10 21:23 UTC (permalink / raw)
  To: Martin K . Petersen; +Cc: Christoph Hellwig, linux-scsi, linux-kernel

Add Future Domain 16xx ISA SCSI support card support.

Tested on IBM 92F0330 card (18C50 chip) with v1.00 BIOS.

Signed-off-by: Ondrej Zary <linux@zary.sk>
---
 drivers/scsi/Kconfig       |  14 +++
 drivers/scsi/Makefile      |   1 +
 drivers/scsi/fdomain_isa.c | 222 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 237 insertions(+)
 create mode 100644 drivers/scsi/fdomain_isa.c

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index f9d058a07e2a..2ea77dafbc00 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -684,6 +684,20 @@ config SCSI_FDOMAIN_PCI
 	  To compile this driver as a module, choose M here: the
 	  module will be called fdomain_pci.
 
+config SCSI_FDOMAIN_ISA
+	tristate "Future Domain 16xx ISA SCSI support"
+	depends on ISA && SCSI
+	select CHECK_SIGNATURE
+	select SCSI_FDOMAIN
+	help
+	  This is support for Future Domain's 16-bit SCSI host adapters
+	  (TMC-1660/1680, TMC-1650/1670, TMC-1610M/MER/MEX) and other adapters
+	  with ISA bus based on the Future Domain chipsets (Quantum ISA-200S,
+	  ISA-250MG; and at least one IBM board).
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called fdomain_isa.
+
 config SCSI_GDTH
 	tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support"
 	depends on PCI && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index f6cc4fbe6957..2e2cffff777d 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -78,6 +78,7 @@ obj-$(CONFIG_SCSI_ISCI)		+= isci/
 obj-$(CONFIG_SCSI_IPS)		+= ips.o
 obj-$(CONFIG_SCSI_FDOMAIN)	+= fdomain.o
 obj-$(CONFIG_SCSI_FDOMAIN_PCI)	+= fdomain_pci.o
+obj-$(CONFIG_SCSI_FDOMAIN_ISA)	+= fdomain_isa.o
 obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o
 obj-$(CONFIG_SCSI_QLOGIC_FAS)	+= qlogicfas408.o	qlogicfas.o
 obj-$(CONFIG_PCMCIA_QLOGIC)	+= qlogicfas408.o
diff --git a/drivers/scsi/fdomain_isa.c b/drivers/scsi/fdomain_isa.c
new file mode 100644
index 000000000000..bca5d56f12aa
--- /dev/null
+++ b/drivers/scsi/fdomain_isa.c
@@ -0,0 +1,222 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/isa.h>
+#include <scsi/scsi_host.h>
+#include "fdomain.h"
+
+#define MAXBOARDS_PARAM 4
+static int io[MAXBOARDS_PARAM] = { 0, 0, 0, 0 };
+module_param_hw_array(io, int, ioport, NULL, 0);
+MODULE_PARM_DESC(io, "base I/O address of controller (0x140, 0x150, 0x160, 0x170)");
+
+static int irq[MAXBOARDS_PARAM] = { 0, 0, 0, 0 };
+module_param_hw_array(irq, int, irq, NULL, 0);
+MODULE_PARM_DESC(irq, "IRQ of controller (0=auto [default])");
+
+static int scsi_id[MAXBOARDS_PARAM] = { 0, 0, 0, 0 };
+module_param_hw_array(scsi_id, int, other, NULL, 0);
+MODULE_PARM_DESC(scsi_id, "SCSI ID of controller (default = 7)");
+
+static unsigned long addresses[] = {
+	0xc8000,
+	0xca000,
+	0xce000,
+	0xde000,
+};
+#define ADDRESS_COUNT ARRAY_SIZE(addresses)
+
+static unsigned short ports[] = { 0x140, 0x150, 0x160, 0x170 };
+#define PORT_COUNT ARRAY_SIZE(ports)
+
+static unsigned short irqs[] = { 3, 5, 10, 11, 12, 14, 15, 0 };
+
+/* This driver works *ONLY* for Future Domain cards using the TMC-1800,
+ * TMC-18C50, or TMC-18C30 chip.  This includes models TMC-1650, 1660, 1670,
+ * and 1680. These are all 16-bit cards.
+ * BIOS versions prior to 3.2 assigned SCSI ID 6 to SCSI adapter.
+ *
+ * The following BIOS signature signatures are for boards which do *NOT*
+ * work with this driver (these TMC-8xx and TMC-9xx boards may work with the
+ * Seagate driver):
+ *
+ * FUTURE DOMAIN CORP. (C) 1986-1988 V4.0I 03/16/88
+ * FUTURE DOMAIN CORP. (C) 1986-1989 V5.0C2/14/89
+ * FUTURE DOMAIN CORP. (C) 1986-1989 V6.0A7/28/89
+ * FUTURE DOMAIN CORP. (C) 1986-1990 V6.0105/31/90
+ * FUTURE DOMAIN CORP. (C) 1986-1990 V6.0209/18/90
+ * FUTURE DOMAIN CORP. (C) 1986-1990 V7.009/18/90
+ * FUTURE DOMAIN CORP. (C) 1992 V8.00.004/02/92
+ *
+ * (The cards which do *NOT* work are all 8-bit cards -- although some of
+ * them have a 16-bit form-factor, the upper 8-bits are used only for IRQs
+ * and are *NOT* used for data. You can tell the difference by following
+ * the tracings on the circuit board -- if only the IRQ lines are involved,
+ * you have a "8-bit" card, and should *NOT* use this driver.)
+ */
+
+static struct signature {
+	const char *signature;
+	int offset;
+	int length;
+	int this_id;
+	int base_offset;
+} signatures[] = {
+/*          1         2         3         4         5         6 */
+/* 123456789012345678901234567890123456789012345678901234567890 */
+{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.07/28/89",	 5, 50,  6, 0x1fcc },
+{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V1.07/28/89",	 5, 50,  6, 0x1fcc },
+{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.07/28/89", 72, 50,  6, 0x1fa2 },
+{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.0",	73, 43,  6, 0x1fa2 },
+{ "FUTURE DOMAIN CORP. (C) 1991 1800-V2.0.",		72, 39,  6, 0x1fa3 },
+{ "FUTURE DOMAIN CORP. (C) 1992 V3.00.004/02/92",	 5, 44,  6, 0 },
+{ "FUTURE DOMAIN TMC-18XX (C) 1993 V3.203/12/93",	 5, 44,  7, 0 },
+{ "IBM F1 P2 BIOS v1.0011/09/92",			 5, 28,  7, 0x1ff3 },
+{ "IBM F1 P2 BIOS v1.0104/29/93",			 5, 28,  7, 0 },
+{ "Future Domain Corp. V1.0008/18/93",			 5, 33,  7, 0 },
+{ "Future Domain Corp. V2.0108/18/93",			 5, 33,  7, 0 },
+{ "FUTURE DOMAIN CORP.  V3.5008/18/93",			 5, 34,  7, 0 },
+{ "FUTURE DOMAIN 18c30/18c50/1800 (C) 1994 V3.5",	 5, 44,  7, 0 },
+{ "FUTURE DOMAIN CORP.  V3.6008/18/93",			 5, 34,  7, 0 },
+{ "FUTURE DOMAIN CORP.  V3.6108/18/93",			 5, 34,  7, 0 },
+};
+#define SIGNATURE_COUNT ARRAY_SIZE(signatures)
+
+static int fdomain_isa_match(struct device *dev, unsigned int ndev)
+{
+	struct Scsi_Host *sh;
+	int i, base = 0, irq = 0;
+	unsigned long bios_base = 0;
+	struct signature *sig = NULL;
+	void __iomem *p;
+	static struct signature *saved_sig;
+	int this_id = 7;
+
+	if (ndev < ADDRESS_COUNT) {	/* scan supported ISA BIOS addresses */
+		p = ioremap(addresses[ndev], FDOMAIN_BIOS_SIZE);
+		if (!p)
+			return 0;
+		for (i = 0; i < SIGNATURE_COUNT; i++)
+			if (check_signature(p + signatures[i].offset,
+					    signatures[i].signature,
+					    signatures[i].length))
+				break;
+		if (i == SIGNATURE_COUNT)	/* no signature found */
+			goto fail_unmap;
+		sig = &signatures[i];
+		bios_base = addresses[ndev];
+		/* read I/O base from BIOS area */
+		if (sig->base_offset)
+			base = readb(p + sig->base_offset) +
+			      (readb(p + sig->base_offset + 1) << 8);
+		iounmap(p);
+		if (base)
+			dev_info(dev, "BIOS at 0x%lx specifies I/O base 0x%x\n",
+				 bios_base, base);
+		else
+			dev_info(dev, "BIOS at 0x%lx\n", bios_base);
+		if (!base) {	/* no I/O base in BIOS area */
+			/* save BIOS signature for later use in port probing */
+			saved_sig = sig;
+			return 0;
+		}
+	} else	/* scan supported I/O ports */
+		base = ports[ndev - ADDRESS_COUNT];
+
+	/* use saved BIOS signature if present */
+	if (!sig && saved_sig)
+		sig = saved_sig;
+
+	if (!request_region(base, FDOMAIN_REGION_SIZE, "fdomain_isa"))
+		return 0;
+
+	irq = irqs[(inb(base + Configuration1) & 0x0e) >> 1];
+
+
+	if (sig)
+		this_id = sig->this_id;
+
+	sh = fdomain_create(base, irq, this_id, dev);
+	if (!sh) {
+		release_region(base, FDOMAIN_REGION_SIZE);
+		return 0;
+	}
+
+	dev_set_drvdata(dev, sh);
+	return 1;
+fail_unmap:
+	iounmap(p);
+	return 0;
+}
+
+static int fdomain_isa_param_match(struct device *dev, unsigned int ndev)
+{
+	struct Scsi_Host *sh;
+	int irq_ = irq[ndev];
+
+	if (!io[ndev])
+		return 0;
+
+	if (!request_region(io[ndev], FDOMAIN_REGION_SIZE, "fdomain_isa")) {
+		dev_err(dev, "base 0x%x already in use", io[ndev]);
+		return 0;
+	}
+
+	if (irq_ <= 0)
+		irq_ = irqs[(inb(io[ndev] + Configuration1) & 0x0e) >> 1];
+
+	sh = fdomain_create(io[ndev], irq_, scsi_id[ndev], dev);
+	if (!sh) {
+		dev_err(dev, "controller not found at base 0x%x", io[ndev]);
+		release_region(io[ndev], FDOMAIN_REGION_SIZE);
+		return 0;
+	}
+
+	dev_set_drvdata(dev, sh);
+	return 1;
+}
+
+static int fdomain_isa_remove(struct device *dev, unsigned int ndev)
+{
+	struct Scsi_Host *sh = dev_get_drvdata(dev);
+	int base = sh->io_port;
+
+	fdomain_destroy(sh);
+	release_region(base, FDOMAIN_REGION_SIZE);
+	dev_set_drvdata(dev, NULL);
+	return 0;
+}
+
+static struct isa_driver fdomain_isa_driver = {
+	.match		= fdomain_isa_match,
+	.remove		= fdomain_isa_remove,
+	.driver = {
+		.name	= "fdomain_isa",
+		.pm	= FDOMAIN_PM_OPS,
+	},
+};
+
+static int __init fdomain_isa_init(void)
+{
+	int isa_probe_count = ADDRESS_COUNT + PORT_COUNT;
+
+	if (io[0]) {	/* use module parameters if present */
+		fdomain_isa_driver.match = fdomain_isa_param_match;
+		isa_probe_count = MAXBOARDS_PARAM;
+	}
+
+	return isa_register_driver(&fdomain_isa_driver, isa_probe_count);
+}
+
+static void __exit fdomain_isa_exit(void)
+{
+	isa_unregister_driver(&fdomain_isa_driver);
+}
+
+module_init(fdomain_isa_init);
+module_exit(fdomain_isa_exit);
+
+MODULE_AUTHOR("Ondrej Zary, Rickard E. Faith");
+MODULE_DESCRIPTION("Future Domain TMC-16x0 ISA SCSI driver");
+MODULE_LICENSE("GPL");
-- 
Ondrej Zary


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] fdomain: Remove BIOS-related code from core
  2019-05-10 21:23 [PATCH 1/2] fdomain: Remove BIOS-related code from core Ondrej Zary
  2019-05-10 21:23 ` [PATCH 2/2] fdomain: Add ISA bus support Ondrej Zary
@ 2019-05-13  7:07 ` Christoph Hellwig
  2019-05-13 22:45 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2019-05-13  7:07 UTC (permalink / raw)
  To: Ondrej Zary
  Cc: Martin K . Petersen, Christoph Hellwig, linux-scsi, linux-kernel

On Fri, May 10, 2019 at 11:23:34PM +0200, Ondrej Zary wrote:
> Move all BIOS signature and base handling to (currently not merged) ISA bus
> driver.
> 
> Signed-off-by: Ondrej Zary <linux@zary.sk>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] fdomain: Add ISA bus support
  2019-05-10 21:23 ` [PATCH 2/2] fdomain: Add ISA bus support Ondrej Zary
@ 2019-05-13  7:09   ` Christoph Hellwig
  2019-05-13 15:54     ` Ondrej Zary
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-05-13  7:09 UTC (permalink / raw)
  To: Ondrej Zary
  Cc: Martin K . Petersen, Christoph Hellwig, linux-scsi, linux-kernel

On Fri, May 10, 2019 at 11:23:35PM +0200, Ondrej Zary wrote:
> Add Future Domain 16xx ISA SCSI support card support.
> 
> Tested on IBM 92F0330 card (18C50 chip) with v1.00 BIOS.

Where did you find that thing? :)

> 
> Signed-off-by: Ondrej Zary <linux@zary.sk>

The driver looks fine to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] fdomain: Add ISA bus support
  2019-05-13  7:09   ` Christoph Hellwig
@ 2019-05-13 15:54     ` Ondrej Zary
  0 siblings, 0 replies; 6+ messages in thread
From: Ondrej Zary @ 2019-05-13 15:54 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Martin K . Petersen, linux-scsi, linux-kernel

On Monday 13 May 2019 09:09:04 Christoph Hellwig wrote:
> On Fri, May 10, 2019 at 11:23:35PM +0200, Ondrej Zary wrote:
> > Add Future Domain 16xx ISA SCSI support card support.
> > 
> > Tested on IBM 92F0330 card (18C50 chip) with v1.00 BIOS.
> 
> Where did you find that thing? :)

eBay :) There are also some PCMCIA cards there.
 
> > 
> > Signed-off-by: Ondrej Zary <linux@zary.sk>
> 
> The driver looks fine to me:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 


-- 
Ondrej Zary

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] fdomain: Remove BIOS-related code from core
  2019-05-10 21:23 [PATCH 1/2] fdomain: Remove BIOS-related code from core Ondrej Zary
  2019-05-10 21:23 ` [PATCH 2/2] fdomain: Add ISA bus support Ondrej Zary
  2019-05-13  7:07 ` [PATCH 1/2] fdomain: Remove BIOS-related code from core Christoph Hellwig
@ 2019-05-13 22:45 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2019-05-13 22:45 UTC (permalink / raw)
  To: Ondrej Zary
  Cc: Martin K . Petersen, Christoph Hellwig, linux-scsi, linux-kernel


Hi Ondrej,

> Move all BIOS signature and base handling to (currently not merged)
> ISA bus driver.

Please submit a complete (core/PCI/ISA) series with the kbuild warnings
addressed and Christoph's tags added.

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-13 22:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 21:23 [PATCH 1/2] fdomain: Remove BIOS-related code from core Ondrej Zary
2019-05-10 21:23 ` [PATCH 2/2] fdomain: Add ISA bus support Ondrej Zary
2019-05-13  7:09   ` Christoph Hellwig
2019-05-13 15:54     ` Ondrej Zary
2019-05-13  7:07 ` [PATCH 1/2] fdomain: Remove BIOS-related code from core Christoph Hellwig
2019-05-13 22:45 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).