diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-10-16 01:05:07 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-17 21:53:55 -0400 |
commit | 1ecd3902c6e16c2445165b872c49e73770b72da7 (patch) | |
tree | cbfa9132a033801872003523e0d8e1be9dc23f77 /drivers/scsi | |
parent | d85714d81cc0408daddb68c10f7fd69eafe7c213 (diff) |
[SCSI] fc4: remove this and all associated drivers
This code has been slowly rotting for about eight years. It's currently
impeding a few SCSI cleanups, and nobody seems to have hardware to test
it any more. I talked to Dave Miller about it, and he agrees we can
delete it. If anyone wants a software FC stack in future, they can
retrieve this driver from git.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/Makefile | 2 | ||||
-rw-r--r-- | drivers/scsi/fcal.c | 317 | ||||
-rw-r--r-- | drivers/scsi/fcal.h | 27 | ||||
-rw-r--r-- | drivers/scsi/pluto.c | 349 | ||||
-rw-r--r-- | drivers/scsi/pluto.h | 47 |
5 files changed, 0 insertions, 742 deletions
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 6141389dcdb2..2e6129f13d38 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -115,7 +115,6 @@ obj-$(CONFIG_SCSI_QLOGICPTI) += qlogicpti.o | |||
115 | obj-$(CONFIG_BLK_DEV_IDESCSI) += ide-scsi.o | 115 | obj-$(CONFIG_BLK_DEV_IDESCSI) += ide-scsi.o |
116 | obj-$(CONFIG_SCSI_MESH) += mesh.o | 116 | obj-$(CONFIG_SCSI_MESH) += mesh.o |
117 | obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o | 117 | obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o |
118 | obj-$(CONFIG_SCSI_PLUTO) += pluto.o | ||
119 | obj-$(CONFIG_SCSI_DECNCR) += NCR53C9x.o dec_esp.o | 118 | obj-$(CONFIG_SCSI_DECNCR) += NCR53C9x.o dec_esp.o |
120 | obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o | 119 | obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o |
121 | obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o | 120 | obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o |
@@ -123,7 +122,6 @@ obj-$(CONFIG_SCSI_PPA) += ppa.o | |||
123 | obj-$(CONFIG_SCSI_IMM) += imm.o | 122 | obj-$(CONFIG_SCSI_IMM) += imm.o |
124 | obj-$(CONFIG_JAZZ_ESP) += esp_scsi.o jazz_esp.o | 123 | obj-$(CONFIG_JAZZ_ESP) += esp_scsi.o jazz_esp.o |
125 | obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o | 124 | obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o |
126 | obj-$(CONFIG_SCSI_FCAL) += fcal.o | ||
127 | obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o | 125 | obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o |
128 | obj-$(CONFIG_SCSI_SNI_53C710) += 53c700.o sni_53c710.o | 126 | obj-$(CONFIG_SCSI_SNI_53C710) += 53c700.o sni_53c710.o |
129 | obj-$(CONFIG_SCSI_NSP32) += nsp32.o | 127 | obj-$(CONFIG_SCSI_NSP32) += nsp32.o |
diff --git a/drivers/scsi/fcal.c b/drivers/scsi/fcal.c deleted file mode 100644 index c4e16c0775de..000000000000 --- a/drivers/scsi/fcal.c +++ /dev/null | |||
@@ -1,317 +0,0 @@ | |||
1 | /* fcal.c: Fibre Channel Arbitrated Loop SCSI host adapter driver. | ||
2 | * | ||
3 | * Copyright (C) 1998,1999 Jakub Jelinek (jj@ultra.linux.cz) | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/delay.h> | ||
9 | #include <linux/types.h> | ||
10 | #include <linux/string.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/blkdev.h> | ||
13 | #include <linux/proc_fs.h> | ||
14 | #include <linux/stat.h> | ||
15 | #include <linux/init.h> | ||
16 | #ifdef CONFIG_KMOD | ||
17 | #include <linux/kmod.h> | ||
18 | #endif | ||
19 | |||
20 | #include <asm/irq.h> | ||
21 | |||
22 | #include "scsi.h" | ||
23 | #include <scsi/scsi_host.h> | ||
24 | #include "../fc4/fcp_impl.h" | ||
25 | #include "fcal.h" | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | |||
29 | /* #define FCAL_DEBUG */ | ||
30 | |||
31 | #define fcal_printk printk ("FCAL %s: ", fc->name); printk | ||
32 | |||
33 | #ifdef FCAL_DEBUG | ||
34 | #define FCALD(x) fcal_printk x; | ||
35 | #define FCALND(x) printk ("FCAL: "); printk x; | ||
36 | #else | ||
37 | #define FCALD(x) | ||
38 | #define FCALND(x) | ||
39 | #endif | ||
40 | |||
41 | static unsigned char alpa2target[] = { | ||
42 | 0x7e, 0x7d, 0x7c, 0xff, 0x7b, 0xff, 0xff, 0xff, 0x7a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x79, | ||
43 | 0x78, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x76, 0xff, 0xff, 0x75, 0xff, 0x74, 0x73, 0x72, | ||
44 | 0xff, 0xff, 0xff, 0x71, 0xff, 0x70, 0x6f, 0x6e, 0xff, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x68, 0xff, | ||
45 | 0xff, 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0xff, 0xff, 0x61, 0x60, 0xff, 0x5f, 0xff, 0xff, 0xff, | ||
46 | 0xff, 0xff, 0xff, 0x5e, 0xff, 0x5d, 0x5c, 0x5b, 0xff, 0x5a, 0x59, 0x58, 0x57, 0x56, 0x55, 0xff, | ||
47 | 0xff, 0x54, 0x53, 0x52, 0x51, 0x50, 0x4f, 0xff, 0xff, 0x4e, 0x4d, 0xff, 0x4c, 0xff, 0xff, 0xff, | ||
48 | 0xff, 0xff, 0xff, 0x4b, 0xff, 0x4a, 0x49, 0x48, 0xff, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0xff, | ||
49 | 0xff, 0x41, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0xff, 0xff, 0x3b, 0x3a, 0xff, 0x39, 0xff, 0xff, 0xff, | ||
50 | 0x38, 0x37, 0x36, 0xff, 0x35, 0xff, 0xff, 0xff, 0x34, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33, | ||
51 | 0x32, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x30, 0xff, 0xff, 0x2f, 0xff, 0x2e, 0x2d, 0x2c, | ||
52 | 0xff, 0xff, 0xff, 0x2b, 0xff, 0x2a, 0x29, 0x28, 0xff, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0xff, | ||
53 | 0xff, 0x21, 0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0xff, 0xff, 0x1b, 0x1a, 0xff, 0x19, 0xff, 0xff, 0xff, | ||
54 | 0xff, 0xff, 0xff, 0x18, 0xff, 0x17, 0x16, 0x15, 0xff, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0xff, | ||
55 | 0xff, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0xff, 0xff, 0x08, 0x07, 0xff, 0x06, 0xff, 0xff, 0xff, | ||
56 | 0x05, 0x04, 0x03, 0xff, 0x02, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 | ||
57 | }; | ||
58 | |||
59 | static unsigned char target2alpa[] = { | ||
60 | 0xef, 0xe8, 0xe4, 0xe2, 0xe1, 0xe0, 0xdc, 0xda, 0xd9, 0xd6, 0xd5, 0xd4, 0xd3, 0xd2, 0xd1, 0xce, | ||
61 | 0xcd, 0xcc, 0xcb, 0xca, 0xc9, 0xc7, 0xc6, 0xc5, 0xc3, 0xbc, 0xba, 0xb9, 0xb6, 0xb5, 0xb4, 0xb3, | ||
62 | 0xb2, 0xb1, 0xae, 0xad, 0xac, 0xab, 0xaa, 0xa9, 0xa7, 0xa6, 0xa5, 0xa3, 0x9f, 0x9e, 0x9d, 0x9b, | ||
63 | 0x98, 0x97, 0x90, 0x8f, 0x88, 0x84, 0x82, 0x81, 0x80, 0x7c, 0x7a, 0x79, 0x76, 0x75, 0x74, 0x73, | ||
64 | 0x72, 0x71, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x67, 0x66, 0x65, 0x63, 0x5c, 0x5a, 0x59, 0x56, | ||
65 | 0x55, 0x54, 0x53, 0x52, 0x51, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x47, 0x46, 0x45, 0x43, 0x3c, | ||
66 | 0x3a, 0x39, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x27, 0x26, | ||
67 | 0x25, 0x23, 0x1f, 0x1e, 0x1d, 0x1b, 0x18, 0x17, 0x10, 0x0f, 0x08, 0x04, 0x02, 0x01, 0x00 | ||
68 | }; | ||
69 | |||
70 | static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); | ||
71 | |||
72 | int fcal_slave_configure(struct scsi_device *device) | ||
73 | { | ||
74 | int depth_to_use; | ||
75 | |||
76 | if (device->tagged_supported) | ||
77 | depth_to_use = /* 254 */ 8; | ||
78 | else | ||
79 | depth_to_use = 2; | ||
80 | |||
81 | scsi_adjust_queue_depth(device, | ||
82 | (device->tagged_supported ? | ||
83 | MSG_SIMPLE_TAG : 0), | ||
84 | depth_to_use); | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | /* Detect all FC Arbitrated Loops attached to the machine. | ||
90 | fc4 module has done all the work for us... */ | ||
91 | int __init fcal_detect(struct scsi_host_template *tpnt) | ||
92 | { | ||
93 | int nfcals = 0; | ||
94 | fc_channel *fc; | ||
95 | int fcalcount; | ||
96 | int i; | ||
97 | |||
98 | tpnt->proc_name = "fcal"; | ||
99 | fcalcount = 0; | ||
100 | for_each_online_fc_channel(fc) | ||
101 | if (fc->posmap) | ||
102 | fcalcount++; | ||
103 | FCALND(("%d channels online\n", fcalcount)) | ||
104 | if (!fcalcount) { | ||
105 | #if defined(MODULE) && defined(CONFIG_FC4_SOCAL_MODULE) && defined(CONFIG_KMOD) | ||
106 | request_module("socal"); | ||
107 | |||
108 | for_each_online_fc_channel(fc) | ||
109 | if (fc->posmap) | ||
110 | fcalcount++; | ||
111 | if (!fcalcount) | ||
112 | #endif | ||
113 | return 0; | ||
114 | } | ||
115 | for_each_online_fc_channel(fc) { | ||
116 | struct Scsi_Host *host; | ||
117 | long *ages; | ||
118 | struct fcal *fcal; | ||
119 | |||
120 | if (!fc->posmap) continue; | ||
121 | |||
122 | /* Strange, this is already registered to some other SCSI host, then it cannot be fcal */ | ||
123 | if (fc->scsi_name[0]) continue; | ||
124 | memcpy (fc->scsi_name, "FCAL", 4); | ||
125 | |||
126 | fc->can_queue = FCAL_CAN_QUEUE; | ||
127 | fc->rsp_size = 64; | ||
128 | fc->encode_addr = fcal_encode_addr; | ||
129 | |||
130 | ages = kmalloc (128 * sizeof(long), GFP_KERNEL); | ||
131 | if (!ages) continue; | ||
132 | |||
133 | host = scsi_register (tpnt, sizeof (struct fcal)); | ||
134 | if (!host) | ||
135 | { | ||
136 | kfree(ages); | ||
137 | continue; | ||
138 | } | ||
139 | |||
140 | if (!try_module_get(fc->module)) { | ||
141 | kfree(ages); | ||
142 | scsi_unregister(host); | ||
143 | continue; | ||
144 | } | ||
145 | |||
146 | nfcals++; | ||
147 | |||
148 | fcal = (struct fcal *)host->hostdata; | ||
149 | |||
150 | fc->fcp_register(fc, TYPE_SCSI_FCP, 0); | ||
151 | |||
152 | for (i = 0; i < fc->posmap->len; i++) { | ||
153 | int status, target, alpa; | ||
154 | |||
155 | alpa = fc->posmap->list[i]; | ||
156 | FCALD(("Sending PLOGI to %02x\n", alpa)) | ||
157 | target = alpa2target[alpa]; | ||
158 | status = fc_do_plogi(fc, alpa, fcal->node_wwn + target, | ||
159 | fcal->nport_wwn + target); | ||
160 | FCALD(("PLOGI returned with status %d\n", status)) | ||
161 | if (status != FC_STATUS_OK) | ||
162 | continue; | ||
163 | FCALD(("Sending PRLI to %02x\n", alpa)) | ||
164 | status = fc_do_prli(fc, alpa); | ||
165 | FCALD(("PRLI returned with status %d\n", status)) | ||
166 | if (status == FC_STATUS_OK) | ||
167 | fcal->map[target] = 1; | ||
168 | } | ||
169 | |||
170 | host->max_id = 127; | ||
171 | host->irq = fc->irq; | ||
172 | #ifdef __sparc_v9__ | ||
173 | host->unchecked_isa_dma = 1; | ||
174 | #endif | ||
175 | |||
176 | fc->channels = 1; | ||
177 | fc->targets = 127; | ||
178 | fc->ages = ages; | ||
179 | memset (ages, 0, 128 * sizeof(long)); | ||
180 | |||
181 | fcal->fc = fc; | ||
182 | |||
183 | FCALD(("Found FCAL\n")) | ||
184 | } | ||
185 | if (nfcals) | ||
186 | #ifdef __sparc__ | ||
187 | printk ("FCAL: Total of %d Sun Enterprise Network Array (A5000 or EX500) channels found\n", nfcals); | ||
188 | #else | ||
189 | printk ("FCAL: Total of %d Fibre Channel Arbitrated Loops found\n", nfcals); | ||
190 | #endif | ||
191 | return nfcals; | ||
192 | } | ||
193 | |||
194 | int fcal_release(struct Scsi_Host *host) | ||
195 | { | ||
196 | struct fcal *fcal = (struct fcal *)host->hostdata; | ||
197 | fc_channel *fc = fcal->fc; | ||
198 | |||
199 | module_put(fc->module); | ||
200 | |||
201 | fc->fcp_register(fc, TYPE_SCSI_FCP, 1); | ||
202 | FCALND((" releasing fcal.\n")); | ||
203 | kfree (fc->ages); | ||
204 | FCALND(("released fcal!\n")); | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | #undef SPRINTF | ||
209 | #define SPRINTF(args...) { if (pos < (buffer + length)) pos += sprintf (pos, ## args); } | ||
210 | |||
211 | int fcal_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) | ||
212 | { | ||
213 | struct fcal *fcal; | ||
214 | fc_channel *fc; | ||
215 | char *pos = buffer; | ||
216 | int i, j; | ||
217 | |||
218 | if (inout) return length; | ||
219 | |||
220 | fcal = (struct fcal *)host->hostdata; | ||
221 | fc = fcal->fc; | ||
222 | |||
223 | #ifdef __sparc__ | ||
224 | SPRINTF ("Sun Enterprise Network Array (A5000 or E?500) on %s PROM node %x\n", fc->name, fc->dev->prom_node); | ||
225 | #else | ||
226 | SPRINTF ("Fibre Channel Arbitrated Loop on %s\n", fc->name); | ||
227 | #endif | ||
228 | SPRINTF ("Initiator AL-PA: %02x\n", fc->sid); | ||
229 | |||
230 | SPRINTF ("\nAttached devices:\n"); | ||
231 | |||
232 | for (i = 0; i < fc->posmap->len; i++) { | ||
233 | unsigned char alpa = fc->posmap->list[i]; | ||
234 | unsigned char target; | ||
235 | u32 *u1, *u2; | ||
236 | |||
237 | target = alpa2target[alpa]; | ||
238 | u1 = (u32 *)&fcal->nport_wwn[target]; | ||
239 | u2 = (u32 *)&fcal->node_wwn[target]; | ||
240 | if (!u1[0] && !u1[1]) { | ||
241 | SPRINTF (" [AL-PA: %02x] Not responded to PLOGI\n", alpa); | ||
242 | } else if (!fcal->map[target]) { | ||
243 | SPRINTF (" [AL-PA: %02x, Port WWN: %08x%08x, Node WWN: %08x%08x] Not responded to PRLI\n", | ||
244 | alpa, u1[0], u1[1], u2[0], u2[1]); | ||
245 | } else { | ||
246 | struct scsi_device *scd; | ||
247 | shost_for_each_device(scd, host) | ||
248 | if (scd->id == target) { | ||
249 | SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ", | ||
250 | alpa, target, u1[0], u1[1], u2[0], u2[1]); | ||
251 | SPRINTF ("%s ", scsi_device_type(scd->type)); | ||
252 | |||
253 | for (j = 0; (j < 8) && (scd->vendor[j] >= 0x20); j++) | ||
254 | SPRINTF ("%c", scd->vendor[j]); | ||
255 | SPRINTF (" "); | ||
256 | |||
257 | for (j = 0; (j < 16) && (scd->model[j] >= 0x20); j++) | ||
258 | SPRINTF ("%c", scd->model[j]); | ||
259 | |||
260 | SPRINTF ("\n"); | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | SPRINTF ("\n"); | ||
265 | |||
266 | *start = buffer + offset; | ||
267 | |||
268 | if ((pos - buffer) < offset) | ||
269 | return 0; | ||
270 | else if (pos - buffer - offset < length) | ||
271 | return pos - buffer - offset; | ||
272 | else | ||
273 | return length; | ||
274 | } | ||
275 | |||
276 | /* | ||
277 | For FC-AL, we use a simple addressing: we have just one channel 0, | ||
278 | and all AL-PAs are mapped to targets 0..0x7e | ||
279 | */ | ||
280 | static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd) | ||
281 | { | ||
282 | struct fcal *f; | ||
283 | |||
284 | /* We don't support LUNs yet - I'm not sure if LUN should be in SCSI fcp_cdb, or in second byte of addr[0] */ | ||
285 | if (SCpnt->cmnd[1] & 0xe0) return -EINVAL; | ||
286 | /* FC-PLDA tells us... */ | ||
287 | memset(addr, 0, 8); | ||
288 | f = (struct fcal *)SCpnt->device->host->hostdata; | ||
289 | if (!f->map[SCpnt->device->id]) | ||
290 | return -EINVAL; | ||
291 | /* Now, determine DID: It will be Native Identifier, so we zero upper | ||
292 | 2 bytes of the 3 byte DID, lowest byte will be AL-PA */ | ||
293 | fcmd->did = target2alpa[SCpnt->device->id]; | ||
294 | FCALD(("trying DID %06x\n", fcmd->did)) | ||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static struct scsi_host_template driver_template = { | ||
299 | .name = "Fibre Channel Arbitrated Loop", | ||
300 | .detect = fcal_detect, | ||
301 | .release = fcal_release, | ||
302 | .proc_info = fcal_proc_info, | ||
303 | .queuecommand = fcp_scsi_queuecommand, | ||
304 | .slave_configure = fcal_slave_configure, | ||
305 | .can_queue = FCAL_CAN_QUEUE, | ||
306 | .this_id = -1, | ||
307 | .sg_tablesize = 1, | ||
308 | .cmd_per_lun = 1, | ||
309 | .use_clustering = ENABLE_CLUSTERING, | ||
310 | .eh_abort_handler = fcp_scsi_abort, | ||
311 | .eh_device_reset_handler = fcp_scsi_dev_reset, | ||
312 | .eh_host_reset_handler = fcp_scsi_host_reset, | ||
313 | }; | ||
314 | #include "scsi_module.c" | ||
315 | |||
316 | MODULE_LICENSE("GPL"); | ||
317 | |||
diff --git a/drivers/scsi/fcal.h b/drivers/scsi/fcal.h deleted file mode 100644 index 7ff2c3494f9e..000000000000 --- a/drivers/scsi/fcal.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* fcal.h: Generic Fibre Channel Arbitrated Loop SCSI host adapter driver definitions. | ||
2 | * | ||
3 | * Copyright (C) 1998,1999 Jakub Jelinek (jj@ultra.linux.cz) | ||
4 | */ | ||
5 | |||
6 | #ifndef _FCAL_H | ||
7 | #define _FCAL_H | ||
8 | |||
9 | #include "../fc4/fcp_impl.h" | ||
10 | |||
11 | struct fcal { | ||
12 | /* fc must be first */ | ||
13 | fc_channel *fc; | ||
14 | unsigned char map[128]; | ||
15 | fc_wwn nport_wwn[128]; | ||
16 | fc_wwn node_wwn[128]; | ||
17 | }; | ||
18 | |||
19 | /* Arbitrary constant. Cannot be too large, as fc4 layer has limitations | ||
20 | for a particular channel */ | ||
21 | #define FCAL_CAN_QUEUE 512 | ||
22 | |||
23 | int fcal_detect(struct scsi_host_template *); | ||
24 | int fcal_release(struct Scsi_Host *); | ||
25 | int fcal_slave_configure(struct scsi_device *); | ||
26 | |||
27 | #endif /* !(_FCAL_H) */ | ||
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c deleted file mode 100644 index 0363c1cd68c1..000000000000 --- a/drivers/scsi/pluto.c +++ /dev/null | |||
@@ -1,349 +0,0 @@ | |||
1 | /* pluto.c: SparcSTORAGE Array SCSI host adapter driver. | ||
2 | * | ||
3 | * Copyright (C) 1997,1998,1999 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | #include <linux/completion.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/delay.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/string.h> | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/blkdev.h> | ||
14 | #include <linux/proc_fs.h> | ||
15 | #include <linux/stat.h> | ||
16 | #include <linux/init.h> | ||
17 | #ifdef CONFIG_KMOD | ||
18 | #include <linux/kmod.h> | ||
19 | #endif | ||
20 | |||
21 | #include <asm/irq.h> | ||
22 | |||
23 | #include "scsi.h" | ||
24 | #include <scsi/scsi_host.h> | ||
25 | #include "../fc4/fcp_impl.h" | ||
26 | #include "pluto.h" | ||
27 | |||
28 | #include <linux/module.h> | ||
29 | |||
30 | #define RQ_SCSI_BUSY 0xffff | ||
31 | #define RQ_SCSI_DONE 0xfffe | ||
32 | |||
33 | /* #define PLUTO_DEBUG */ | ||
34 | |||
35 | #define pluto_printk printk ("PLUTO %s: ", fc->name); printk | ||
36 | |||
37 | #ifdef PLUTO_DEBUG | ||
38 | #define PLD(x) pluto_printk x; | ||
39 | #define PLND(x) printk ("PLUTO: "); printk x; | ||
40 | #else | ||
41 | #define PLD(x) | ||
42 | #define PLND(x) | ||
43 | #endif | ||
44 | |||
45 | static struct ctrl_inquiry { | ||
46 | struct Scsi_Host host; | ||
47 | struct pluto pluto; | ||
48 | Scsi_Cmnd cmd; | ||
49 | char inquiry[256]; | ||
50 | fc_channel *fc; | ||
51 | } *fcs __initdata; | ||
52 | static int fcscount __initdata = 0; | ||
53 | static atomic_t fcss __initdata = ATOMIC_INIT(0); | ||
54 | static DECLARE_COMPLETION(fc_detect_complete); | ||
55 | |||
56 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); | ||
57 | |||
58 | static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) | ||
59 | { | ||
60 | /* Do nothing */ | ||
61 | } | ||
62 | |||
63 | static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt) | ||
64 | { | ||
65 | PLND(("Detect done %08lx\n", (long)SCpnt)) | ||
66 | if (atomic_dec_and_test (&fcss)) | ||
67 | complete(&fc_detect_complete); | ||
68 | } | ||
69 | |||
70 | int pluto_slave_configure(struct scsi_device *device) | ||
71 | { | ||
72 | int depth_to_use; | ||
73 | |||
74 | if (device->tagged_supported) | ||
75 | depth_to_use = /* 254 */ 8; | ||
76 | else | ||
77 | depth_to_use = 2; | ||
78 | |||
79 | scsi_adjust_queue_depth(device, | ||
80 | (device->tagged_supported ? | ||
81 | MSG_SIMPLE_TAG : 0), | ||
82 | depth_to_use); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | /* Detect all SSAs attached to the machine. | ||
88 | To be fast, do it on all online FC channels at the same time. */ | ||
89 | int __init pluto_detect(struct scsi_host_template *tpnt) | ||
90 | { | ||
91 | int i, retry, nplutos; | ||
92 | fc_channel *fc; | ||
93 | struct scsi_device dev; | ||
94 | |||
95 | tpnt->proc_name = "pluto"; | ||
96 | fcscount = 0; | ||
97 | for_each_online_fc_channel(fc) { | ||
98 | if (!fc->posmap) | ||
99 | fcscount++; | ||
100 | } | ||
101 | PLND(("%d channels online\n", fcscount)) | ||
102 | if (!fcscount) { | ||
103 | #if defined(MODULE) && defined(CONFIG_FC4_SOC_MODULE) && defined(CONFIG_KMOD) | ||
104 | request_module("soc"); | ||
105 | |||
106 | for_each_online_fc_channel(fc) { | ||
107 | if (!fc->posmap) | ||
108 | fcscount++; | ||
109 | } | ||
110 | if (!fcscount) | ||
111 | #endif | ||
112 | return 0; | ||
113 | } | ||
114 | fcs = kcalloc(fcscount, sizeof (struct ctrl_inquiry), GFP_DMA); | ||
115 | if (!fcs) { | ||
116 | printk ("PLUTO: Not enough memory to probe\n"); | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | memset (&dev, 0, sizeof(dev)); | ||
121 | atomic_set (&fcss, fcscount); | ||
122 | |||
123 | i = 0; | ||
124 | for_each_online_fc_channel(fc) { | ||
125 | Scsi_Cmnd *SCpnt; | ||
126 | struct Scsi_Host *host; | ||
127 | struct pluto *pluto; | ||
128 | |||
129 | if (i == fcscount) break; | ||
130 | if (fc->posmap) continue; | ||
131 | |||
132 | PLD(("trying to find SSA\n")) | ||
133 | |||
134 | /* If this is already registered to some other SCSI host, then it cannot be pluto */ | ||
135 | if (fc->scsi_name[0]) continue; | ||
136 | memcpy (fc->scsi_name, "SSA", 4); | ||
137 | |||
138 | fcs[i].fc = fc; | ||
139 | |||
140 | fc->can_queue = PLUTO_CAN_QUEUE; | ||
141 | fc->rsp_size = 64; | ||
142 | fc->encode_addr = pluto_encode_addr; | ||
143 | |||
144 | fc->fcp_register(fc, TYPE_SCSI_FCP, 0); | ||
145 | |||
146 | SCpnt = &(fcs[i].cmd); | ||
147 | host = &(fcs[i].host); | ||
148 | pluto = (struct pluto *)host->hostdata; | ||
149 | |||
150 | pluto->fc = fc; | ||
151 | |||
152 | SCpnt->cmnd[0] = INQUIRY; | ||
153 | SCpnt->cmnd[4] = 255; | ||
154 | |||
155 | /* FC layer requires this, so that SCpnt->device->tagged_supported is initially 0 */ | ||
156 | SCpnt->device = &dev; | ||
157 | dev.host = host; | ||
158 | |||
159 | SCpnt->cmd_len = COMMAND_SIZE(INQUIRY); | ||
160 | |||
161 | SCpnt->request->cmd_flags &= ~REQ_STARTED; | ||
162 | |||
163 | SCpnt->request_bufflen = 256; | ||
164 | SCpnt->request_buffer = fcs[i].inquiry; | ||
165 | PLD(("set up %d %08lx\n", i, (long)SCpnt)) | ||
166 | i++; | ||
167 | } | ||
168 | |||
169 | for (retry = 0; retry < 5; retry++) { | ||
170 | for (i = 0; i < fcscount; i++) { | ||
171 | if (!fcs[i].fc) break; | ||
172 | if (!(fcs[i].cmd.request->cmd_flags & REQ_STARTED)) { | ||
173 | fcs[i].cmd.request->cmd_flags |= REQ_STARTED; | ||
174 | disable_irq(fcs[i].fc->irq); | ||
175 | PLND(("queuecommand %d %d\n", retry, i)) | ||
176 | fcp_scsi_queuecommand (&(fcs[i].cmd), | ||
177 | pluto_detect_scsi_done); | ||
178 | enable_irq(fcs[i].fc->irq); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | wait_for_completion_timeout(&fc_detect_complete, 10 * HZ); | ||
183 | PLND(("Woken up\n")) | ||
184 | if (!atomic_read(&fcss)) | ||
185 | break; /* All fc channels have answered us */ | ||
186 | } | ||
187 | |||
188 | PLND(("Finished search\n")) | ||
189 | for (i = 0, nplutos = 0; i < fcscount; i++) { | ||
190 | Scsi_Cmnd *SCpnt; | ||
191 | |||
192 | if (!(fc = fcs[i].fc)) break; | ||
193 | |||
194 | SCpnt = &(fcs[i].cmd); | ||
195 | |||
196 | /* Let FC mid-level free allocated resources */ | ||
197 | pluto_detect_scsi_done(SCpnt); | ||
198 | |||
199 | if (!SCpnt->result) { | ||
200 | struct pluto_inquiry *inq; | ||
201 | struct pluto *pluto; | ||
202 | struct Scsi_Host *host; | ||
203 | |||
204 | inq = (struct pluto_inquiry *)fcs[i].inquiry; | ||
205 | |||
206 | if ((inq->dtype & 0x1f) == TYPE_PROCESSOR && | ||
207 | !strncmp (inq->vendor_id, "SUN", 3) && | ||
208 | !strncmp (inq->product_id, "SSA", 3)) { | ||
209 | char *p; | ||
210 | long *ages; | ||
211 | |||
212 | ages = kcalloc((inq->channels + 1) * inq->targets, sizeof(long), GFP_KERNEL); | ||
213 | if (!ages) continue; | ||
214 | |||
215 | host = scsi_register (tpnt, sizeof (struct pluto)); | ||
216 | if(!host) | ||
217 | { | ||
218 | kfree(ages); | ||
219 | continue; | ||
220 | } | ||
221 | |||
222 | if (!try_module_get(fc->module)) { | ||
223 | kfree(ages); | ||
224 | scsi_unregister(host); | ||
225 | continue; | ||
226 | } | ||
227 | |||
228 | nplutos++; | ||
229 | |||
230 | pluto = (struct pluto *)host->hostdata; | ||
231 | |||
232 | host->max_id = inq->targets; | ||
233 | host->max_channel = inq->channels; | ||
234 | host->irq = fc->irq; | ||
235 | |||
236 | fc->channels = inq->channels + 1; | ||
237 | fc->targets = inq->targets; | ||
238 | fc->ages = ages; | ||
239 | |||
240 | pluto->fc = fc; | ||
241 | memcpy (pluto->rev_str, inq->revision, 4); | ||
242 | pluto->rev_str[4] = 0; | ||
243 | p = strchr (pluto->rev_str, ' '); | ||
244 | if (p) *p = 0; | ||
245 | memcpy (pluto->fw_rev_str, inq->fw_revision, 4); | ||
246 | pluto->fw_rev_str[4] = 0; | ||
247 | p = strchr (pluto->fw_rev_str, ' '); | ||
248 | if (p) *p = 0; | ||
249 | memcpy (pluto->serial_str, inq->serial, 12); | ||
250 | pluto->serial_str[12] = 0; | ||
251 | p = strchr (pluto->serial_str, ' '); | ||
252 | if (p) *p = 0; | ||
253 | |||
254 | PLD(("Found SSA rev %s fw rev %s serial %s %dx%d\n", pluto->rev_str, pluto->fw_rev_str, pluto->serial_str, host->max_channel, host->max_id)) | ||
255 | } else | ||
256 | fc->fcp_register(fc, TYPE_SCSI_FCP, 1); | ||
257 | } else | ||
258 | fc->fcp_register(fc, TYPE_SCSI_FCP, 1); | ||
259 | } | ||
260 | kfree(fcs); | ||
261 | if (nplutos) | ||
262 | printk ("PLUTO: Total of %d SparcSTORAGE Arrays found\n", nplutos); | ||
263 | return nplutos; | ||
264 | } | ||
265 | |||
266 | int pluto_release(struct Scsi_Host *host) | ||
267 | { | ||
268 | struct pluto *pluto = (struct pluto *)host->hostdata; | ||
269 | fc_channel *fc = pluto->fc; | ||
270 | |||
271 | module_put(fc->module); | ||
272 | |||
273 | fc->fcp_register(fc, TYPE_SCSI_FCP, 1); | ||
274 | PLND((" releasing pluto.\n")); | ||
275 | kfree (fc->ages); | ||
276 | PLND(("released pluto!\n")); | ||
277 | return 0; | ||
278 | } | ||
279 | |||
280 | const char *pluto_info(struct Scsi_Host *host) | ||
281 | { | ||
282 | static char buf[128], *p; | ||
283 | struct pluto *pluto = (struct pluto *) host->hostdata; | ||
284 | |||
285 | sprintf(buf, "SUN SparcSTORAGE Array %s fw %s serial %s %dx%d on %s", | ||
286 | pluto->rev_str, pluto->fw_rev_str, pluto->serial_str, | ||
287 | host->max_channel, host->max_id, pluto->fc->name); | ||
288 | #ifdef __sparc__ | ||
289 | p = strchr(buf, 0); | ||
290 | sprintf(p, " PROM node %x", pluto->fc->dev->prom_node); | ||
291 | #endif | ||
292 | return buf; | ||
293 | } | ||
294 | |||
295 | /* SSA uses this FC4S addressing: | ||
296 | switch (addr[0]) | ||
297 | { | ||
298 | case 0: CONTROLLER - All of addr[1]..addr[3] has to be 0 | ||
299 | case 1: SINGLE DISK - addr[1] channel, addr[2] id, addr[3] 0 | ||
300 | case 2: DISK GROUP - ??? | ||
301 | } | ||
302 | |||
303 | So that SCSI mid-layer can access to these, we reserve | ||
304 | channel 0 id 0 lun 0 for CONTROLLER | ||
305 | and channels 1 .. max_channel are normal single disks. | ||
306 | */ | ||
307 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd) | ||
308 | { | ||
309 | PLND(("encode addr %d %d %d\n", SCpnt->device->channel, SCpnt->device->id, SCpnt->cmnd[1] & 0xe0)) | ||
310 | /* We don't support LUNs - neither does SSA :) */ | ||
311 | if (SCpnt->cmnd[1] & 0xe0) | ||
312 | return -EINVAL; | ||
313 | if (!SCpnt->device->channel) { | ||
314 | if (SCpnt->device->id) | ||
315 | return -EINVAL; | ||
316 | memset (addr, 0, 4 * sizeof(u16)); | ||
317 | } else { | ||
318 | addr[0] = 1; | ||
319 | addr[1] = SCpnt->device->channel - 1; | ||
320 | addr[2] = SCpnt->device->id; | ||
321 | addr[3] = 0; | ||
322 | } | ||
323 | /* We're Point-to-Point, so target it to the default DID */ | ||
324 | fcmd->did = fc->did; | ||
325 | PLND(("trying %04x%04x%04x%04x\n", addr[0], addr[1], addr[2], addr[3])) | ||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | static struct scsi_host_template driver_template = { | ||
330 | .name = "Sparc Storage Array 100/200", | ||
331 | .detect = pluto_detect, | ||
332 | .release = pluto_release, | ||
333 | .info = pluto_info, | ||
334 | .queuecommand = fcp_scsi_queuecommand, | ||
335 | .slave_configure = pluto_slave_configure, | ||
336 | .can_queue = PLUTO_CAN_QUEUE, | ||
337 | .this_id = -1, | ||
338 | .sg_tablesize = 1, | ||
339 | .cmd_per_lun = 1, | ||
340 | .use_clustering = ENABLE_CLUSTERING, | ||
341 | .eh_abort_handler = fcp_scsi_abort, | ||
342 | .eh_device_reset_handler = fcp_scsi_dev_reset, | ||
343 | .eh_host_reset_handler = fcp_scsi_host_reset, | ||
344 | }; | ||
345 | |||
346 | #include "scsi_module.c" | ||
347 | |||
348 | MODULE_LICENSE("GPL"); | ||
349 | |||
diff --git a/drivers/scsi/pluto.h b/drivers/scsi/pluto.h deleted file mode 100644 index 5da20616ac36..000000000000 --- a/drivers/scsi/pluto.h +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | /* pluto.h: SparcSTORAGE Array SCSI host adapter driver definitions. | ||
2 | * | ||
3 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
4 | */ | ||
5 | |||
6 | #ifndef _PLUTO_H | ||
7 | #define _PLUTO_H | ||
8 | |||
9 | #include "../fc4/fcp_impl.h" | ||
10 | |||
11 | struct pluto { | ||
12 | /* This must be first */ | ||
13 | fc_channel *fc; | ||
14 | char rev_str[5]; | ||
15 | char fw_rev_str[5]; | ||
16 | char serial_str[13]; | ||
17 | }; | ||
18 | |||
19 | struct pluto_inquiry { | ||
20 | u8 dtype; | ||
21 | u8 removable:1, qualifier:7; | ||
22 | u8 iso:2, ecma:3, ansi:3; | ||
23 | u8 aenc:1, trmiop:1, :2, rdf:4; | ||
24 | u8 len; | ||
25 | u8 xxx1; | ||
26 | u8 xxx2; | ||
27 | u8 reladdr:1, wbus32:1, wbus16:1, sync:1, linked:1, :1, cmdque:1, softreset:1; | ||
28 | u8 vendor_id[8]; | ||
29 | u8 product_id[16]; | ||
30 | u8 revision[4]; | ||
31 | u8 fw_revision[4]; | ||
32 | u8 serial[12]; | ||
33 | u8 xxx3[2]; | ||
34 | u8 channels; | ||
35 | u8 targets; | ||
36 | }; | ||
37 | |||
38 | /* This is the max number of outstanding SCSI commands per pluto */ | ||
39 | #define PLUTO_CAN_QUEUE 254 | ||
40 | |||
41 | int pluto_detect(struct scsi_host_template *); | ||
42 | int pluto_release(struct Scsi_Host *); | ||
43 | const char * pluto_info(struct Scsi_Host *); | ||
44 | int pluto_slave_configure(struct scsi_device *); | ||
45 | |||
46 | #endif /* !(_PLUTO_H) */ | ||
47 | |||