diff options
author | Ondrej Zary <linux@zary.sk> | 2019-05-14 13:23:09 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-06-18 19:46:18 -0400 |
commit | e5207cf021df382fe1936f2314ab19e390026a06 (patch) | |
tree | 4bd4b69138d6734c533517949664b6ee7e3ff180 | |
parent | 68046d5003e7b7b4083cdf5dfc2823b7bb0e40ea (diff) |
scsi: fdomain: Resurrect driver - ISA support
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/Kconfig | 14 | ||||
-rw-r--r-- | drivers/scsi/Makefile | 1 | ||||
-rw-r--r-- | drivers/scsi/fdomain_isa.c | 222 |
3 files changed, 237 insertions, 0 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index b66c624affb0..e365787bf698 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -662,6 +662,20 @@ config SCSI_FDOMAIN_PCI | |||
662 | To compile this driver as a module, choose M here: the | 662 | To compile this driver as a module, choose M here: the |
663 | module will be called fdomain_pci. | 663 | module will be called fdomain_pci. |
664 | 664 | ||
665 | config SCSI_FDOMAIN_ISA | ||
666 | tristate "Future Domain 16xx ISA SCSI support" | ||
667 | depends on ISA && SCSI | ||
668 | select CHECK_SIGNATURE | ||
669 | select SCSI_FDOMAIN | ||
670 | help | ||
671 | This is support for Future Domain's 16-bit SCSI host adapters | ||
672 | (TMC-1660/1680, TMC-1650/1670, TMC-1610M/MER/MEX) and other adapters | ||
673 | with ISA bus based on the Future Domain chipsets (Quantum ISA-200S, | ||
674 | ISA-250MG; and at least one IBM board). | ||
675 | |||
676 | To compile this driver as a module, choose M here: the | ||
677 | module will be called fdomain_isa. | ||
678 | |||
665 | config SCSI_GDTH | 679 | config SCSI_GDTH |
666 | tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" | 680 | tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" |
667 | depends on PCI && SCSI | 681 | depends on PCI && SCSI |
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index f2cea7032419..aeda53901064 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -78,6 +78,7 @@ obj-$(CONFIG_SCSI_ISCI) += isci/ | |||
78 | obj-$(CONFIG_SCSI_IPS) += ips.o | 78 | obj-$(CONFIG_SCSI_IPS) += ips.o |
79 | obj-$(CONFIG_SCSI_FDOMAIN) += fdomain.o | 79 | obj-$(CONFIG_SCSI_FDOMAIN) += fdomain.o |
80 | obj-$(CONFIG_SCSI_FDOMAIN_PCI) += fdomain_pci.o | 80 | obj-$(CONFIG_SCSI_FDOMAIN_PCI) += fdomain_pci.o |
81 | obj-$(CONFIG_SCSI_FDOMAIN_ISA) += fdomain_isa.o | ||
81 | obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o | 82 | obj-$(CONFIG_SCSI_GENERIC_NCR5380) += g_NCR5380.o |
82 | obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o | 83 | obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o |
83 | obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o | 84 | 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 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | #include <linux/module.h> | ||
4 | #include <linux/io.h> | ||
5 | #include <linux/isa.h> | ||
6 | #include <scsi/scsi_host.h> | ||
7 | #include "fdomain.h" | ||
8 | |||
9 | #define MAXBOARDS_PARAM 4 | ||
10 | static int io[MAXBOARDS_PARAM] = { 0, 0, 0, 0 }; | ||
11 | module_param_hw_array(io, int, ioport, NULL, 0); | ||
12 | MODULE_PARM_DESC(io, "base I/O address of controller (0x140, 0x150, 0x160, 0x170)"); | ||
13 | |||
14 | static int irq[MAXBOARDS_PARAM] = { 0, 0, 0, 0 }; | ||
15 | module_param_hw_array(irq, int, irq, NULL, 0); | ||
16 | MODULE_PARM_DESC(irq, "IRQ of controller (0=auto [default])"); | ||
17 | |||
18 | static int scsi_id[MAXBOARDS_PARAM] = { 0, 0, 0, 0 }; | ||
19 | module_param_hw_array(scsi_id, int, other, NULL, 0); | ||
20 | MODULE_PARM_DESC(scsi_id, "SCSI ID of controller (default = 7)"); | ||
21 | |||
22 | static unsigned long addresses[] = { | ||
23 | 0xc8000, | ||
24 | 0xca000, | ||
25 | 0xce000, | ||
26 | 0xde000, | ||
27 | }; | ||
28 | #define ADDRESS_COUNT ARRAY_SIZE(addresses) | ||
29 | |||
30 | static unsigned short ports[] = { 0x140, 0x150, 0x160, 0x170 }; | ||
31 | #define PORT_COUNT ARRAY_SIZE(ports) | ||
32 | |||
33 | static unsigned short irqs[] = { 3, 5, 10, 11, 12, 14, 15, 0 }; | ||
34 | |||
35 | /* This driver works *ONLY* for Future Domain cards using the TMC-1800, | ||
36 | * TMC-18C50, or TMC-18C30 chip. This includes models TMC-1650, 1660, 1670, | ||
37 | * and 1680. These are all 16-bit cards. | ||
38 | * BIOS versions prior to 3.2 assigned SCSI ID 6 to SCSI adapter. | ||
39 | * | ||
40 | * The following BIOS signature signatures are for boards which do *NOT* | ||
41 | * work with this driver (these TMC-8xx and TMC-9xx boards may work with the | ||
42 | * Seagate driver): | ||
43 | * | ||
44 | * FUTURE DOMAIN CORP. (C) 1986-1988 V4.0I 03/16/88 | ||
45 | * FUTURE DOMAIN CORP. (C) 1986-1989 V5.0C2/14/89 | ||
46 | * FUTURE DOMAIN CORP. (C) 1986-1989 V6.0A7/28/89 | ||
47 | * FUTURE DOMAIN CORP. (C) 1986-1990 V6.0105/31/90 | ||
48 | * FUTURE DOMAIN CORP. (C) 1986-1990 V6.0209/18/90 | ||
49 | * FUTURE DOMAIN CORP. (C) 1986-1990 V7.009/18/90 | ||
50 | * FUTURE DOMAIN CORP. (C) 1992 V8.00.004/02/92 | ||
51 | * | ||
52 | * (The cards which do *NOT* work are all 8-bit cards -- although some of | ||
53 | * them have a 16-bit form-factor, the upper 8-bits are used only for IRQs | ||
54 | * and are *NOT* used for data. You can tell the difference by following | ||
55 | * the tracings on the circuit board -- if only the IRQ lines are involved, | ||
56 | * you have a "8-bit" card, and should *NOT* use this driver.) | ||
57 | */ | ||
58 | |||
59 | static struct signature { | ||
60 | const char *signature; | ||
61 | int offset; | ||
62 | int length; | ||
63 | int this_id; | ||
64 | int base_offset; | ||
65 | } signatures[] = { | ||
66 | /* 1 2 3 4 5 6 */ | ||
67 | /* 123456789012345678901234567890123456789012345678901234567890 */ | ||
68 | { "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.07/28/89", 5, 50, 6, 0x1fcc }, | ||
69 | { "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V1.07/28/89", 5, 50, 6, 0x1fcc }, | ||
70 | { "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.07/28/89", 72, 50, 6, 0x1fa2 }, | ||
71 | { "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.0", 73, 43, 6, 0x1fa2 }, | ||
72 | { "FUTURE DOMAIN CORP. (C) 1991 1800-V2.0.", 72, 39, 6, 0x1fa3 }, | ||
73 | { "FUTURE DOMAIN CORP. (C) 1992 V3.00.004/02/92", 5, 44, 6, 0 }, | ||
74 | { "FUTURE DOMAIN TMC-18XX (C) 1993 V3.203/12/93", 5, 44, 7, 0 }, | ||
75 | { "IBM F1 P2 BIOS v1.0011/09/92", 5, 28, 7, 0x1ff3 }, | ||
76 | { "IBM F1 P2 BIOS v1.0104/29/93", 5, 28, 7, 0 }, | ||
77 | { "Future Domain Corp. V1.0008/18/93", 5, 33, 7, 0 }, | ||
78 | { "Future Domain Corp. V2.0108/18/93", 5, 33, 7, 0 }, | ||
79 | { "FUTURE DOMAIN CORP. V3.5008/18/93", 5, 34, 7, 0 }, | ||
80 | { "FUTURE DOMAIN 18c30/18c50/1800 (C) 1994 V3.5", 5, 44, 7, 0 }, | ||
81 | { "FUTURE DOMAIN CORP. V3.6008/18/93", 5, 34, 7, 0 }, | ||
82 | { "FUTURE DOMAIN CORP. V3.6108/18/93", 5, 34, 7, 0 }, | ||
83 | }; | ||
84 | #define SIGNATURE_COUNT ARRAY_SIZE(signatures) | ||
85 | |||
86 | static int fdomain_isa_match(struct device *dev, unsigned int ndev) | ||
87 | { | ||
88 | struct Scsi_Host *sh; | ||
89 | int i, base = 0, irq = 0; | ||
90 | unsigned long bios_base = 0; | ||
91 | struct signature *sig = NULL; | ||
92 | void __iomem *p; | ||
93 | static struct signature *saved_sig; | ||
94 | int this_id = 7; | ||
95 | |||
96 | if (ndev < ADDRESS_COUNT) { /* scan supported ISA BIOS addresses */ | ||
97 | p = ioremap(addresses[ndev], FDOMAIN_BIOS_SIZE); | ||
98 | if (!p) | ||
99 | return 0; | ||
100 | for (i = 0; i < SIGNATURE_COUNT; i++) | ||
101 | if (check_signature(p + signatures[i].offset, | ||
102 | signatures[i].signature, | ||
103 | signatures[i].length)) | ||
104 | break; | ||
105 | if (i == SIGNATURE_COUNT) /* no signature found */ | ||
106 | goto fail_unmap; | ||
107 | sig = &signatures[i]; | ||
108 | bios_base = addresses[ndev]; | ||
109 | /* read I/O base from BIOS area */ | ||
110 | if (sig->base_offset) | ||
111 | base = readb(p + sig->base_offset) + | ||
112 | (readb(p + sig->base_offset + 1) << 8); | ||
113 | iounmap(p); | ||
114 | if (base) | ||
115 | dev_info(dev, "BIOS at 0x%lx specifies I/O base 0x%x\n", | ||
116 | bios_base, base); | ||
117 | else | ||
118 | dev_info(dev, "BIOS at 0x%lx\n", bios_base); | ||
119 | if (!base) { /* no I/O base in BIOS area */ | ||
120 | /* save BIOS signature for later use in port probing */ | ||
121 | saved_sig = sig; | ||
122 | return 0; | ||
123 | } | ||
124 | } else /* scan supported I/O ports */ | ||
125 | base = ports[ndev - ADDRESS_COUNT]; | ||
126 | |||
127 | /* use saved BIOS signature if present */ | ||
128 | if (!sig && saved_sig) | ||
129 | sig = saved_sig; | ||
130 | |||
131 | if (!request_region(base, FDOMAIN_REGION_SIZE, "fdomain_isa")) | ||
132 | return 0; | ||
133 | |||
134 | irq = irqs[(inb(base + Configuration1) & 0x0e) >> 1]; | ||
135 | |||
136 | |||
137 | if (sig) | ||
138 | this_id = sig->this_id; | ||
139 | |||
140 | sh = fdomain_create(base, irq, this_id, dev); | ||
141 | if (!sh) { | ||
142 | release_region(base, FDOMAIN_REGION_SIZE); | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | dev_set_drvdata(dev, sh); | ||
147 | return 1; | ||
148 | fail_unmap: | ||
149 | iounmap(p); | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int fdomain_isa_param_match(struct device *dev, unsigned int ndev) | ||
154 | { | ||
155 | struct Scsi_Host *sh; | ||
156 | int irq_ = irq[ndev]; | ||
157 | |||
158 | if (!io[ndev]) | ||
159 | return 0; | ||
160 | |||
161 | if (!request_region(io[ndev], FDOMAIN_REGION_SIZE, "fdomain_isa")) { | ||
162 | dev_err(dev, "base 0x%x already in use", io[ndev]); | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | if (irq_ <= 0) | ||
167 | irq_ = irqs[(inb(io[ndev] + Configuration1) & 0x0e) >> 1]; | ||
168 | |||
169 | sh = fdomain_create(io[ndev], irq_, scsi_id[ndev], dev); | ||
170 | if (!sh) { | ||
171 | dev_err(dev, "controller not found at base 0x%x", io[ndev]); | ||
172 | release_region(io[ndev], FDOMAIN_REGION_SIZE); | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | dev_set_drvdata(dev, sh); | ||
177 | return 1; | ||
178 | } | ||
179 | |||
180 | static int fdomain_isa_remove(struct device *dev, unsigned int ndev) | ||
181 | { | ||
182 | struct Scsi_Host *sh = dev_get_drvdata(dev); | ||
183 | int base = sh->io_port; | ||
184 | |||
185 | fdomain_destroy(sh); | ||
186 | release_region(base, FDOMAIN_REGION_SIZE); | ||
187 | dev_set_drvdata(dev, NULL); | ||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | static struct isa_driver fdomain_isa_driver = { | ||
192 | .match = fdomain_isa_match, | ||
193 | .remove = fdomain_isa_remove, | ||
194 | .driver = { | ||
195 | .name = "fdomain_isa", | ||
196 | .pm = FDOMAIN_PM_OPS, | ||
197 | }, | ||
198 | }; | ||
199 | |||
200 | static int __init fdomain_isa_init(void) | ||
201 | { | ||
202 | int isa_probe_count = ADDRESS_COUNT + PORT_COUNT; | ||
203 | |||
204 | if (io[0]) { /* use module parameters if present */ | ||
205 | fdomain_isa_driver.match = fdomain_isa_param_match; | ||
206 | isa_probe_count = MAXBOARDS_PARAM; | ||
207 | } | ||
208 | |||
209 | return isa_register_driver(&fdomain_isa_driver, isa_probe_count); | ||
210 | } | ||
211 | |||
212 | static void __exit fdomain_isa_exit(void) | ||
213 | { | ||
214 | isa_unregister_driver(&fdomain_isa_driver); | ||
215 | } | ||
216 | |||
217 | module_init(fdomain_isa_init); | ||
218 | module_exit(fdomain_isa_exit); | ||
219 | |||
220 | MODULE_AUTHOR("Ondrej Zary, Rickard E. Faith"); | ||
221 | MODULE_DESCRIPTION("Future Domain TMC-16x0 ISA SCSI driver"); | ||
222 | MODULE_LICENSE("GPL"); | ||