Import 2.2.6pre3
[davej-history.git] / drivers / scsi / qlogicfc.c
blobe82d8f4fffc6c4bbb2f28a730a7ee902eaa543f9
1 /*
2 * QLogic ISP2100 SCSI-FCP
3 * Written by Erik H. Moe, ehm@cris.com
4 * Copyright 1995, Erik H. Moe
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
17 /* Renamed and updated to 1.3.x by Michael Griffith <grif@cs.ucr.edu> */
19 /* This is a version of the isp1020 driver which was modified by
20 * Chris Loveland <cwl@iol.unh.edu> to support the isp2100
24 * $Date: 1995/09/22 02:23:15 $
25 * $Revision: 0.5 $
27 * $Log: isp1020.c,v $
28 * Revision 0.5 1995/09/22 02:23:15 root
29 * do auto request sense
31 * Revision 0.4 1995/08/07 04:44:33 root
32 * supply firmware with driver.
33 * numerous bug fixes/general cleanup of code.
35 * Revision 0.3 1995/07/16 16:15:39 root
36 * added reset/abort code.
38 * Revision 0.2 1995/06/29 03:14:19 root
39 * fixed biosparam.
40 * added queue protocol.
42 * Revision 0.1 1995/06/25 01:55:45 root
43 * Initial release.
47 #include <linux/blk.h>
48 #include <linux/kernel.h>
49 #include <linux/string.h>
50 #include <linux/ioport.h>
51 #include <linux/sched.h>
52 #include <linux/types.h>
53 #include <linux/pci.h>
54 #include <linux/delay.h>
55 #include <linux/unistd.h>
56 #include <asm/io.h>
57 #include <asm/irq.h>
58 #include <asm/spinlock.h>
60 #include "sd.h"
61 #include "hosts.h"
62 #include "qlogicfc.h"
64 /* Configuration section **************************************************** */
66 /* Set the following macro to 1 to reload the ISP2100's firmware. This is
67 version 1.15.19 of the firmware. */
69 #define RELOAD_FIRMWARE 1
71 #define USE_NVRAM_DEFAULTS 1
73 #define ISP2100_PORTDB 1
75 /* Set the following to 1 to include fabric support, fabric support is
76 * currently not as well tested as the other aspects of the driver */
78 #define ISP2100_FABRIC 0
80 /* Macros used for debugging */
82 #define DEBUG_ISP2100 1
83 #define DEBUG_ISP2100_INT 1
84 #define DEBUG_ISP2100_INTR 1
85 #define DEBUG_ISP2100_SETUP 1
87 #define DEBUG_ISP2100_FABRIC 1
89 /* #define TRACE_ISP 1 */
92 #define DEFAULT_LOOP_COUNT 10000000
94 /* End Configuration section ************************************************ */
96 #include <linux/module.h>
98 #if TRACE_ISP
100 #define TRACE_BUF_LEN (32*1024)
102 struct {
103 u_long next;
104 struct {
105 u_long time;
106 u_int index;
107 u_int addr;
108 u_char *name;
109 } buf[TRACE_BUF_LEN];
110 } trace;
112 #define TRACE(w, i, a) \
114 unsigned long flags; \
116 save_flags(flags); \
117 cli(); \
118 trace.buf[trace.next].name = (w); \
119 trace.buf[trace.next].time = jiffies; \
120 trace.buf[trace.next].index = (i); \
121 trace.buf[trace.next].addr = (long) (a); \
122 trace.next = (trace.next + 1) & (TRACE_BUF_LEN - 1); \
123 restore_flags(flags); \
126 #else
127 #define TRACE(w, i, a)
128 #endif
130 #if DEBUG_ISP2100_FABRIC
131 #define DEBUG_FABRIC(x) x
132 #else
133 #define DEBUG_FABRIC(x)
134 #endif /* DEBUG_ISP2100_FABRIC */
137 #if DEBUG_ISP2100
138 #define ENTER(x) printk("isp2100 : entering %s()\n", x);
139 #define LEAVE(x) printk("isp2100 : leaving %s()\n", x);
140 #define DEBUG(x) x
141 #else
142 #define ENTER(x)
143 #define LEAVE(x)
144 #define DEBUG(x)
145 #endif /* DEBUG_ISP2100 */
147 #if DEBUG_ISP2100_INTR
148 #define ENTER_INTR(x) printk("isp2100 : entering %s()\n", x);
149 #define LEAVE_INTR(x) printk("isp2100 : leaving %s()\n", x);
150 #define DEBUG_INTR(x) x
151 #else
152 #define ENTER_INTR(x)
153 #define LEAVE_INTR(x)
154 #define DEBUG_INTR(x)
155 #endif /* DEBUG ISP2100_INTR */
158 #if defined(__i386__)
159 #define virt_to_bus_low32(x) virt_to_bus(x)
160 #define virt_to_bus_high32(x) 0x0
161 #define bus_to_virt_low32(x) bus_to_virt(x)
162 #define bus_to_virt_high32(x) 0x0
163 #elif defined(__alpha__)
164 #define virt_to_bus_low32(x) ((u32) (0xffffffff & virt_to_bus(x)))
165 #define virt_to_bus_high32(x) ((u32) (0xffffffff & (virt_to_bus(x)>>32)))
166 #define bus_to_virt_low32(x) ((u32) (0xffffffff & bus_to_virt(x)))
167 #define bus_to_virt_high32(x) ((u32) (0xffffffff & (bus_to_virt(x)>>32)))
168 #endif
170 #define ISP2100_REV_ID 1
171 #define ISP2100_REV_ID3 3
173 #define MAX_TARGETS 16
174 #define MAX_LUNS 8
176 /* host configuration and control registers */
177 #define HOST_HCCR 0xc0 /* host command and control */
179 /* pci bus interface registers */
180 #define FLASH_BIOS_ADDR 0x00
181 #define FLASH_BIOS_DATA 0x02
182 #define ISP_CTRL_STATUS 0x06 /* configuration register #1 */
183 #define PCI_INTER_CTL 0x08 /* pci interupt control */
184 #define PCI_INTER_STS 0x0a /* pci interupt status */
185 #define PCI_SEMAPHORE 0x0c /* pci semaphore */
186 #define PCI_NVRAM 0x0e /* pci nvram interface */
188 /* mailbox registers */
189 #define MBOX0 0x10 /* mailbox 0 */
190 #define MBOX1 0x12 /* mailbox 1 */
191 #define MBOX2 0x14 /* mailbox 2 */
192 #define MBOX3 0x16 /* mailbox 3 */
193 #define MBOX4 0x18 /* mailbox 4 */
194 #define MBOX5 0x1a /* mailbox 5 */
195 #define MBOX6 0x1c /* mailbox 6 */
196 #define MBOX7 0x1e /* mailbox 7 */
198 /* mailbox command complete status codes */
199 #define MBOX_COMMAND_COMPLETE 0x4000
200 #define INVALID_COMMAND 0x4001
201 #define HOST_INTERFACE_ERROR 0x4002
202 #define TEST_FAILED 0x4003
203 #define COMMAND_ERROR 0x4005
204 #define COMMAND_PARAM_ERROR 0x4006
205 #define PORT_ID_USED 0x4007
206 #define LOOP_ID_USED 0x4008
207 #define ALL_IDS_USED 0x4009
209 /* async event status codes */
210 #define RESET_DETECTED 0x8001
211 #define SYSTEM_ERROR 0x8002
212 #define REQUEST_TRANSFER_ERROR 0x8003
213 #define RESPONSE_TRANSFER_ERROR 0x8004
214 #define REQUEST_QUEUE_WAKEUP 0x8005
215 #define LIP_OCCURED 0x8010
216 #define LOOP_UP 0x8011
217 #define LOOP_DOWN 0x8012
218 #define LIP_RECEIVED 0x8013
219 #define PORT_DB_CHANGED 0x8014
220 #define CHANGE_NOTIFICATION 0x8015
221 #define SCSI_COMMAND_COMPLETE 0x8020
223 struct Entry_header {
224 u_char entry_type;
225 u_char entry_cnt;
226 u_char sys_def_1;
227 u_char flags;
230 /* entry header type commands */
231 #define ENTRY_COMMAND 0x19
232 #define ENTRY_CONTINUATION 0x0a
233 #define ENTRY_STATUS 0x03
234 #define ENTRY_MARKER 0x04
236 /* entry header flag definitions */
237 #define EFLAG_BUSY 2
238 #define EFLAG_BAD_HEADER 4
239 #define EFLAG_BAD_PAYLOAD 8
241 struct dataseg {
242 u_int d_base_lo;
243 u_int d_base_high;
244 u_int d_count;
247 struct Command_Entry {
248 struct Entry_header hdr;
249 u_int handle;
250 u_char target_lun;
251 u_char target_id;
252 u_short rsvd1;
253 u_short control_flags;
254 u_short rsvd2;
255 u_short time_out;
256 u_short segment_cnt;
257 u_char cdb[16];
258 u_int total_byte_cnt;
259 struct dataseg dataseg[2];
262 /* command entry control flag definitions */
263 #define CFLAG_NODISC 0x01
264 #define CFLAG_HEAD_TAG 0x02
265 #define CFLAG_ORDERED_TAG 0x04
266 #define CFLAG_SIMPLE_TAG 0x08
267 #define CFLAG_TAR_RTN 0x10
268 #define CFLAG_READ 0x20
269 #define CFLAG_WRITE 0x40
271 struct Ext_Command_Entry {
272 struct Entry_header hdr;
273 u_int handle;
274 u_char target_lun;
275 u_char target_id;
276 u_short cdb_length;
277 u_short control_flags;
278 u_short rsvd;
279 u_short time_out;
280 u_short segment_cnt;
281 u_char cdb[44];
284 struct Continuation_Entry {
285 struct Entry_header hdr;
286 struct dataseg dataseg[5];
289 struct Marker_Entry {
290 struct Entry_header hdr;
291 u_int reserved;
292 u_char target_lun;
293 u_char target_id;
294 u_char modifier;
295 u_char rsvd;
296 u_char rsvds[52];
299 /* marker entry modifier definitions */
300 #define SYNC_DEVICE 0
301 #define SYNC_TARGET 1
302 #define SYNC_ALL 2
304 struct Status_Entry {
305 struct Entry_header hdr;
306 u_int handle;
307 u_short scsi_status;
308 u_short completion_status;
309 u_short state_flags;
310 u_short status_flags;
311 u_short res_info_len;
312 u_short req_sense_len;
313 u_int residual;
314 u_char res_info[8];
315 u_char req_sense_data[32];
318 /* status entry completion status definitions */
319 #define CS_COMPLETE 0x0000
320 #define CS_DMA_ERROR 0x0002
321 #define CS_RESET_OCCURRED 0x0004
322 #define CS_ABORTED 0x0005
323 #define CS_TIMEOUT 0x0006
324 #define CS_DATA_OVERRUN 0x0007
325 #define CS_DATA_UNDERRUN 0x0015
326 #define CS_QUEUE_FULL 0x001c
327 #define CS_PORT_UNAVAILABLE 0x0028
328 #define CS_PORT_LOGGED_OUT 0x0029
329 #define CS_PORT_CONFIG_CHANGED 0x002a
331 /* status entry state flag definitions */
332 #define SF_SENT_CDB 0x0400
333 #define SF_TRANSFERRED_DATA 0x0800
334 #define SF_GOT_STATUS 0x1000
336 /* status entry status flag definitions */
337 #define STF_BUS_RESET 0x0008
338 #define STF_DEVICE_RESET 0x0010
339 #define STF_ABORTED 0x0020
340 #define STF_TIMEOUT 0x0040
342 /* interupt control commands */
343 #define ISP_EN_INT 0x8000
344 #define ISP_EN_RISC 0x0008
346 /* host control commands */
347 #define HCCR_NOP 0x0000
348 #define HCCR_RESET 0x1000
349 #define HCCR_PAUSE 0x2000
350 #define HCCR_RELEASE 0x3000
351 #define HCCR_SINGLE_STEP 0x4000
352 #define HCCR_SET_HOST_INTR 0x5000
353 #define HCCR_CLEAR_HOST_INTR 0x6000
354 #define HCCR_CLEAR_RISC_INTR 0x7000
355 #define HCCR_BP_ENABLE 0x8000
356 #define HCCR_BIOS_DISABLE 0x9000
357 #define HCCR_TEST_MODE 0xf000
359 #define RISC_BUSY 0x0004
361 /* mailbox commands */
362 #define MBOX_NO_OP 0x0000
363 #define MBOX_LOAD_RAM 0x0001
364 #define MBOX_EXEC_FIRMWARE 0x0002
365 #define MBOX_DUMP_RAM 0x0003
366 #define MBOX_WRITE_RAM_WORD 0x0004
367 #define MBOX_READ_RAM_WORD 0x0005
368 #define MBOX_MAILBOX_REG_TEST 0x0006
369 #define MBOX_VERIFY_CHECKSUM 0x0007
370 #define MBOX_ABOUT_FIRMWARE 0x0008
371 #define MBOX_LOAD_RISC_RAM 0x0009
372 #define MBOX_DUMP_RISC_RAM 0x000a
373 #define MBOX_CHECK_FIRMWARE 0x000e
374 #define MBOX_INIT_REQ_QUEUE 0x0010
375 #define MBOX_INIT_RES_QUEUE 0x0011
376 #define MBOX_EXECUTE_IOCB 0x0012
377 #define MBOX_WAKE_UP 0x0013
378 #define MBOX_STOP_FIRMWARE 0x0014
379 #define MBOX_ABORT_IOCB 0x0015
380 #define MBOX_ABORT_DEVICE 0x0016
381 #define MBOX_ABORT_TARGET 0x0017
382 #define MBOX_BUS_RESET 0x0018
383 #define MBOX_STOP_QUEUE 0x0019
384 #define MBOX_START_QUEUE 0x001a
385 #define MBOX_SINGLE_STEP_QUEUE 0x001b
386 #define MBOX_ABORT_QUEUE 0x001c
387 #define MBOX_GET_DEV_QUEUE_STATUS 0x001d
388 #define MBOX_GET_FIRMWARE_STATUS 0x001f
389 #define MBOX_GET_INIT_SCSI_ID 0x0020
390 #define MBOX_GET_RETRY_COUNT 0x0022
391 #define MBOX_GET_TARGET_PARAMS 0x0028
392 #define MBOX_GET_DEV_QUEUE_PARAMS 0x0029
393 #define MBOX_SET_RETRY_COUNT 0x0032
394 #define MBOX_SET_TARGET_PARAMS 0x0038
395 #define MBOX_SET_DEV_QUEUE_PARAMS 0x0039
396 #define MBOX_EXECUTE_IOCB64 0x0054
397 #define MBOX_INIT_FIRMWARE 0x0060
398 #define MBOX_GET_INIT_CB 0x0061
399 #define MBOX_INIT_LIP 0x0062
400 #define MBOX_GET_POS_MAP 0x0063
401 #define MBOX_GET_PORT_DB 0x0064
402 #define MBOX_CLEAR_ACA 0x0065
403 #define MBOX_TARGET_RESET 0x0066
404 #define MBOX_CLEAR_TASK_SET 0x0067
405 #define MBOX_ABORT_TASK_SET 0x0068
406 #define MBOX_GET_FIRMWARE_STATE 0x0069
407 #define MBOX_GET_PORT_NAME 0x006a
408 #define MBOX_SEND_SNS 0x006e
409 #define MBOX_PORT_LOGIN 0x006f
410 #define MBOX_SEND_CHANGE_REQUEST 0x0070
411 #define MBOX_PORT_LOGOUT 0x0071
413 #include "qlogicfc_asm.c"
415 /* Each element in mbox_param is an 8 bit bitmap where each bit indicates
416 if that mbox should be copied as input. For example 0x2 would mean
417 only copy mbox1. */
419 const u_char mbox_param[] =
421 0x01, /* MBOX_NO_OP */
422 0x1f, /* MBOX_LOAD_RAM */
423 0x03, /* MBOX_EXEC_FIRMWARE */
424 0x1f, /* MBOX_DUMP_RAM */
425 0x07, /* MBOX_WRITE_RAM_WORD */
426 0x03, /* MBOX_READ_RAM_WORD */
427 0xff, /* MBOX_MAILBOX_REG_TEST */
428 0x03, /* MBOX_VERIFY_CHECKSUM */
429 0x01, /* MBOX_ABOUT_FIRMWARE */
430 0xff, /* MBOX_LOAD_RISC_RAM */
431 0xff, /* MBOX_DUMP_RISC_RAM */
432 0x00, /* 0x000b */
433 0x00, /* 0x000c */
434 0x00, /* 0x000d */
435 0x01, /* MBOX_CHECK_FIRMWARE */
436 0x00, /* 0x000f */
437 0x1f, /* MBOX_INIT_REQ_QUEUE */
438 0x2f, /* MBOX_INIT_RES_QUEUE */
439 0x0f, /* MBOX_EXECUTE_IOCB */
440 0x03, /* MBOX_WAKE_UP */
441 0x01, /* MBOX_STOP_FIRMWARE */
442 0x0f, /* MBOX_ABORT_IOCB */
443 0x03, /* MBOX_ABORT_DEVICE */
444 0x07, /* MBOX_ABORT_TARGET */
445 0x03, /* MBOX_BUS_RESET */
446 0x03, /* MBOX_STOP_QUEUE */
447 0x03, /* MBOX_START_QUEUE */
448 0x03, /* MBOX_SINGLE_STEP_QUEUE */
449 0x03, /* MBOX_ABORT_QUEUE */
450 0x03, /* MBOX_GET_DEV_QUEUE_STATUS */
451 0x00, /* 0x001e */
452 0x01, /* MBOX_GET_FIRMWARE_STATUS */
453 0x01, /* MBOX_GET_INIT_SCSI_ID */
454 0x00, /* 0x0021 */
455 0x01, /* MBOX_GET_RETRY_COUNT */
456 0x00, /* 0x0023 */
457 0x00, /* 0x0024 */
458 0x00, /* 0x0025 */
459 0x00, /* 0x0026 */
460 0x00, /* 0x0027 */
461 0x03, /* MBOX_GET_TARGET_PARAMS */
462 0x03, /* MBOX_GET_DEV_QUEUE_PARAMS */
463 0x00, /* 0x002a */
464 0x00, /* 0x002b */
465 0x00, /* 0x002c */
466 0x00, /* 0x002d */
467 0x00, /* 0x002e */
468 0x00, /* 0x002f */
469 0x00, /* 0x0030 */
470 0x00, /* 0x0031 */
471 0x07, /* MBOX_SET_RETRY_COUNT */
472 0x00, /* 0x0033 */
473 0x00, /* 0x0034 */
474 0x00, /* 0x0035 */
475 0x00, /* 0x0036 */
476 0x00, /* 0x0037 */
477 0x0f, /* MBOX_SET_TARGET_PARAMS */
478 0x0f, /* MBOX_SET_DEV_QUEUE_PARAMS */
479 0x00, /* 0x003a */
480 0x00, /* 0x003b */
481 0x00, /* 0x003c */
482 0x00, /* 0x003d */
483 0x00, /* 0x003e */
484 0x00, /* 0x003f */
485 0x00, /* 0x0040 */
486 0x00, /* 0x0041 */
487 0x00, /* 0x0042 */
488 0x00, /* 0x0043 */
489 0x00, /* 0x0044 */
490 0x00, /* 0x0045 */
491 0x00, /* 0x0046 */
492 0x00, /* 0x0047 */
493 0x00, /* 0x0048 */
494 0x00, /* 0x0049 */
495 0x00, /* 0x004a */
496 0x00, /* 0x004b */
497 0x00, /* 0x004c */
498 0x00, /* 0x004d */
499 0x00, /* 0x004e */
500 0x00, /* 0x004f */
501 0x00, /* 0x0050 */
502 0x00, /* 0x0051 */
503 0x00, /* 0x0052 */
504 0x00, /* 0x0053 */
505 0xcf, /* MBOX_EXECUTE_IOCB64 */
506 0x00, /* 0x0055 */
507 0x00, /* 0x0056 */
508 0x00, /* 0x0057 */
509 0x00, /* 0x0058 */
510 0x00, /* 0x0059 */
511 0x00, /* 0x005a */
512 0x00, /* 0x005b */
513 0x00, /* 0x005c */
514 0x00, /* 0x005d */
515 0x00, /* 0x005e */
516 0x00, /* 0x005f */
517 0xff, /* MBOX_INIT_FIRMWARE */
518 0xcd, /* MBOX_GET_INIT_CB */
519 0x01, /* MBOX_INIT_LIP */
520 0xcd, /* MBOX_GET_POS_MAP */
521 0xcf, /* MBOX_GET_PORT_DB */
522 0x03, /* MBOX_CLEAR_ACA */
523 0x03, /* MBOX_TARGET_RESET */
524 0x03, /* MBOX_CLEAR_TASK_SET */
525 0x03, /* MBOX_ABORT_TASK_SET */
526 0x01, /* MBOX_GET_FIRMWARE_STATE */
527 0x03, /* MBOX_GET_PORT_NAME */
528 0x00, /* 0x006b */
529 0x00, /* 0x006c */
530 0x00, /* 0x006d */
531 0xcf, /* MBOX_SEND_SNS */
532 0x0f, /* MBOX_PORT_LOGIN */
533 0x03, /* MBOX_SEND_CHANGE_REQUEST */
534 0x03, /* MBOX_PORT_LOGOUT */
537 #define MAX_MBOX_COMMAND (sizeof(mbox_param)/sizeof(u_short))
540 struct id_name_map {
541 u64 wwn;
542 u_char loop_id;
545 struct sns_cb {
546 u_short len;
547 u_short res1;
548 u_int response_low;
549 u_int response_high;
550 u_short sub_len;
551 u_short res2;
552 u_short data[22];
555 /* address of instance of this struct is passed to adapter to initialize things
557 struct init_cb {
558 u_char version;
559 u_char reseverd1[1];
560 u_short firm_opts;
561 u_short max_frame_len;
562 u_short max_iocb;
563 u_short exec_throttle;
564 u_char retry_cnt;
565 u_char retry_delay;
566 u_short node_name[4];
567 u_short hard_addr;
568 u_char reserved2[10];
569 u_short req_queue_out;
570 u_short res_queue_in;
571 u_short req_queue_len;
572 u_short res_queue_len;
573 u_int req_queue_addr_lo;
574 u_int req_queue_addr_high;
575 u_int res_queue_addr_lo;
576 u_int res_queue_addr_high;
580 * The result queue can be quite a bit smaller since continuation entries
581 * do not show up there:
583 #define RES_QUEUE_LEN ((QLOGICFC_REQ_QUEUE_LEN + 1) / 8 - 1)
584 #define QUEUE_ENTRY_LEN 64
586 #if ISP2100_FABRIC
587 #define QLOGICFC_MAX_ID 0xff
588 #else
589 #define QLOGICFC_MAX_ID 0x80
590 #endif
592 struct isp2100_hostdata {
593 u_char revision;
594 struct pci_dev *pci_dev;
595 /* result and request queues (shared with isp2100): */
596 u_int req_in_ptr; /* index of next request slot */
597 u_int res_out_ptr; /* index of next result slot */
599 /* this is here so the queues are nicely aligned */
600 long send_marker; /* do we need to send a marker? */
602 char res[RES_QUEUE_LEN + 1][QUEUE_ENTRY_LEN];
603 char req[QLOGICFC_REQ_QUEUE_LEN + 1][QUEUE_ENTRY_LEN];
604 struct init_cb control_block;
605 int loop_up;
606 unsigned long int tag_ages[126];
607 Scsi_Cmnd *handle_ptrs[QLOGICFC_REQ_QUEUE_LEN + 1];
608 unsigned long handle_serials[QLOGICFC_REQ_QUEUE_LEN + 1];
609 struct id_name_map port_db[QLOGICFC_MAX_ID + 1];
610 u_char mbox_done;
611 u64 wwn;
612 u_int port_id;
613 u_char queued;
617 /* queue length's _must_ be power of two: */
618 #define QUEUE_DEPTH(in, out, ql) ((in - out) & (ql))
619 #define REQ_QUEUE_DEPTH(in, out) QUEUE_DEPTH(in, out, \
620 QLOGICFC_REQ_QUEUE_LEN)
621 #define RES_QUEUE_DEPTH(in, out) QUEUE_DEPTH(in, out, RES_QUEUE_LEN)
623 static void isp2100_enable_irqs(struct Scsi_Host *);
624 static void isp2100_disable_irqs(struct Scsi_Host *);
625 static int isp2100_init(struct Scsi_Host *);
626 static int isp2100_reset_hardware(struct Scsi_Host *);
627 static int isp2100_mbox_command(struct Scsi_Host *, u_short[]);
628 static int isp2100_return_status(struct Status_Entry *);
629 static void isp2100_intr_handler(int, void *, struct pt_regs *);
630 static void do_isp2100_intr_handler(int, void *, struct pt_regs *);
631 static int isp2100_make_portdb(struct Scsi_Host *);
633 #if ISP2100_FABRIC
634 static int isp2100_init_fabric(struct Scsi_Host *, struct id_name_map *, int);
635 #endif
637 #if USE_NVRAM_DEFAULTS
638 static int isp2100_get_nvram_defaults(struct Scsi_Host *, struct init_cb *);
639 static u_short isp2100_read_nvram_word(struct Scsi_Host *, u_short);
640 #endif
642 #if DEBUG_ISP2100
643 static void isp2100_print_scsi_cmd(Scsi_Cmnd *);
644 #endif
646 static void isp2100_print_status_entry(struct Status_Entry *);
648 static struct proc_dir_entry proc_scsi_isp2100 =
650 PROC_SCSI_QLOGICFC, 7, "isp2100",
651 S_IFDIR | S_IRUGO | S_IXUGO, 2
655 static inline void isp2100_enable_irqs(struct Scsi_Host *host)
657 outw(ISP_EN_INT | ISP_EN_RISC, host->io_port + PCI_INTER_CTL);
661 static inline void isp2100_disable_irqs(struct Scsi_Host *host)
663 outw(0x0, host->io_port + PCI_INTER_CTL);
667 int isp2100_detect(Scsi_Host_Template * tmpt)
669 int hosts = 0;
670 int wait_time;
671 struct Scsi_Host *host = NULL;
672 struct isp2100_hostdata *hostdata;
673 struct pci_dev *pdev = NULL;
675 ENTER("isp2100_detect");
677 tmpt->proc_dir = &proc_scsi_isp2100;
679 if (pci_present() == 0) {
680 printk("qlogicfc : PCI not present\n");
681 return 0;
683 while ((pdev = pci_find_device(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2100, pdev))) {
685 host = scsi_register(tmpt, sizeof(struct isp2100_hostdata));
686 host->max_id = QLOGICFC_MAX_ID + 1;
687 host->hostt->use_new_eh_code = 1;
688 hostdata = (struct isp2100_hostdata *) host->hostdata;
690 memset(hostdata, 0, sizeof(struct isp2100_hostdata));
691 hostdata->pci_dev = pdev;
693 hostdata->queued = 0;
694 /* set up the control block */
695 hostdata->control_block.version = 0x0f;
696 hostdata->control_block.firm_opts = 0x010c;
697 hostdata->control_block.max_frame_len = 2048;
698 hostdata->control_block.max_iocb = 256;
699 hostdata->control_block.exec_throttle = 8;
700 hostdata->control_block.retry_delay = 5;
701 hostdata->control_block.retry_cnt = 0;
702 hostdata->control_block.node_name[0] = 0x0020;
703 hostdata->control_block.node_name[1] = 0xE000;
704 hostdata->control_block.node_name[2] = 0x008B;
705 hostdata->control_block.node_name[3] = 0x0000;
706 hostdata->control_block.hard_addr = 0x0003;
707 hostdata->control_block.req_queue_len = QLOGICFC_REQ_QUEUE_LEN + 1;
708 hostdata->control_block.res_queue_len = RES_QUEUE_LEN + 1;
709 hostdata->control_block.res_queue_addr_lo = virt_to_bus_low32(&hostdata->res);
710 hostdata->control_block.res_queue_addr_high = virt_to_bus_high32(&hostdata->res);
711 hostdata->control_block.req_queue_addr_lo = virt_to_bus_low32(&hostdata->req);
712 hostdata->control_block.req_queue_addr_high = virt_to_bus_high32(&hostdata->req);
714 hostdata->loop_up = 0;
716 if (isp2100_init(host) || isp2100_reset_hardware(host)) {
717 scsi_unregister(host);
718 continue;
720 host->this_id = 0;
722 if (request_irq(host->irq, do_isp2100_intr_handler, SA_INTERRUPT | SA_SHIRQ, "qlogicfc", host)) {
723 printk("qlogicfc : interrupt %d already in use\n",
724 host->irq);
725 scsi_unregister(host);
726 continue;
728 if (check_region(host->io_port, 0xff)) {
729 printk("qlogicfc : i/o region 0x%lx-0x%lx already "
730 "in use\n",
731 host->io_port, host->io_port + 0xff);
732 free_irq(host->irq, host);
733 scsi_unregister(host);
734 continue;
736 request_region(host->io_port, 0xff, "qlogicfc");
738 outw(0x0, host->io_port + PCI_SEMAPHORE);
739 outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
740 isp2100_enable_irqs(host);
741 /* wait for the loop to come up */
742 for (wait_time = jiffies + 10 * HZ; wait_time > jiffies && hostdata->loop_up == 0;)
743 barrier();
745 if (hostdata->loop_up == 0) {
746 printk("qlogicfc: loop is not up\n");
747 release_region(host->io_port, 0xff);
748 free_irq(host->irq, host);
749 scsi_unregister(host);
750 continue;
752 hosts++;
756 /* this busy loop should not be needed but the isp2100 seems to need
757 some time before recognizing it is attached to a fabric */
759 #if ISP2100_FABRIC
760 for (wait_time = jiffies + 5 * HZ; wait_time > jiffies;)
761 barrier();
762 #endif
764 LEAVE("isp2100_detect");
766 return hosts;
770 static int isp2100_make_portdb(struct Scsi_Host *host)
773 short param[8];
774 int i, j;
775 struct id_name_map temp[QLOGICFC_MAX_ID + 1];
776 struct isp2100_hostdata *hostdata;
778 isp2100_disable_irqs(host);
780 memset(temp, 0, sizeof(temp));
781 hostdata = (struct isp2100_hostdata *) host->hostdata;
783 #if ISP2100_FABRIC
784 for (i = 0x81; i < QLOGICFC_MAX_ID; i++) {
785 param[0] = MBOX_PORT_LOGOUT;
786 param[1] = i << 8;
787 param[2] = 0;
788 param[3] = 0;
790 isp2100_mbox_command(host, param);
792 if (param[0] != MBOX_COMMAND_COMPLETE) {
793 printk("logout failed %x %x\n", i, param[0]);
796 #endif
799 param[0] = MBOX_GET_INIT_SCSI_ID;
801 isp2100_mbox_command(host, param);
803 if (param[0] == MBOX_COMMAND_COMPLETE) {
804 hostdata->port_id = ((u_int) param[3]) << 16;
805 hostdata->port_id |= param[2];
806 temp[0].loop_id = param[1];
807 temp[0].wwn = hostdata->wwn;
809 else {
810 printk("qlogicfc: error getting scsi id.\n");
813 for (i = 1, j = 1; i <= QLOGICFC_MAX_ID; i++) {
814 temp[i].loop_id = temp[0].loop_id;
816 param[0] = MBOX_GET_PORT_NAME;
817 param[1] = (i << 8) & 0xff00;
819 isp2100_mbox_command(host, param);
821 if (param[0] == MBOX_COMMAND_COMPLETE) {
822 temp[j].loop_id = i;
823 temp[j].wwn = ((u64) (param[2] & 0xff)) << 56;
824 temp[j].wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48;
825 temp[j].wwn |= ((u64) (param[3] & 0xff)) << 40;
826 temp[j].wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32;
827 temp[j].wwn |= ((u64) (param[6] & 0xff)) << 24;
828 temp[j].wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16;
829 temp[j].wwn |= ((u64) (param[7] & 0xff)) << 8;
830 temp[j].wwn |= ((u64) ((param[7] >> 8) & 0xff));
832 j++;
838 #if ISP2100_FABRIC
839 isp2100_init_fabric(host, temp, j);
840 #endif
842 for (i = 0; i <= QLOGICFC_MAX_ID; i++) {
843 if (temp[i].wwn != hostdata->port_db[i].wwn) {
844 for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
845 if (temp[j].wwn == hostdata->port_db[i].wwn) {
846 hostdata->port_db[i].loop_id = temp[j].loop_id;
847 break;
850 if (j == QLOGICFC_MAX_ID + 1)
851 hostdata->port_db[i].loop_id = temp[0].loop_id;
853 for (j = 0; j <= QLOGICFC_MAX_ID; j++) {
854 if (hostdata->port_db[j].wwn == temp[i].wwn || !hostdata->port_db[j].wwn) {
855 break;
858 if (j == QLOGICFC_MAX_ID + 1)
859 printk("qlogicfc.c: Too many scsi devices, no more room in port map.\n");
860 if (!hostdata->port_db[j].wwn) {
861 hostdata->port_db[j].loop_id = temp[i].loop_id;
862 hostdata->port_db[j].wwn = temp[i].wwn;
864 } else
865 hostdata->port_db[i].loop_id = temp[i].loop_id;
869 isp2100_enable_irqs(host);
871 return 0;
875 #if ISP2100_FABRIC
877 int isp2100_init_fabric(struct Scsi_Host *host, struct id_name_map *port_db, int j)
880 u_short param[8];
881 u64 wwn;
882 int done = 0;
883 u_short loop_id = 0x81;
884 u_short scsi_id = j;
885 u_int port_id;
886 struct sns_cb req;
887 u_char sns_response[608];
888 struct isp2100_hostdata *hostdata;
890 hostdata = (struct isp2100_hostdata *) host->hostdata;
892 DEBUG_FABRIC(printk("qlogicfc.c: Checking for a fabric.\n"));
893 param[0] = MBOX_GET_PORT_NAME;
894 param[1] = 0x7E00;
896 isp2100_mbox_command(host, param);
898 if (param[0] != MBOX_COMMAND_COMPLETE) {
899 DEBUG_FABRIC(printk("fabric check result %x\n", param[0]));
900 return 0;
902 printk("qlogicfc.c: Fabric found.\n");
905 port_id = hostdata->port_id;
906 while (!done) {
907 memset(&req, 0, sizeof(req));
909 req.len = 304;
910 req.response_low = virt_to_bus_low32(sns_response);
911 req.response_high = virt_to_bus_high32(sns_response);
912 req.sub_len = 6;
913 req.data[0] = 0x0100;
914 req.data[4] = (u_short) (port_id & 0xffff);
915 req.data[5] = (u_short) (port_id >> 16 & 0xffff);
917 param[0] = MBOX_SEND_SNS;
918 param[1] = 14;
919 param[2] = virt_to_bus_low32(&req) >> 16;
920 param[3] = virt_to_bus_low32(&req);
921 param[6] = virt_to_bus_high32(&req) >> 16;
922 param[7] = virt_to_bus_high32(&req);
924 isp2100_mbox_command(host, param);
926 if (param[0] == MBOX_COMMAND_COMPLETE) {
927 DEBUG_FABRIC(printk("found node %02x%02x%02x%02x%02x%02x%02x%02x ", sns_response[20], sns_response[21], sns_response[22], sns_response[23], sns_response[24], sns_response[25], sns_response[26], sns_response[27]));
928 DEBUG_FABRIC(printk(" port id: %02x%02x%02x\n", sns_response[17], sns_response[18], sns_response[19]));
929 port_id = ((u_int) sns_response[17]) << 16;
930 port_id |= ((u_int) sns_response[18]) << 8;
931 port_id |= ((u_int) sns_response[19]);
932 wwn = ((u64) sns_response[20]) << 56;
933 wwn |= ((u64) sns_response[21]) << 48;
934 wwn |= ((u64) sns_response[22]) << 40;
935 wwn |= ((u64) sns_response[23]) << 32;
936 wwn |= ((u64) sns_response[24]) << 24;
937 wwn |= ((u64) sns_response[25]) << 16;
938 wwn |= ((u64) sns_response[26]) << 8;
939 wwn |= ((u64) sns_response[27]);
940 if (hostdata->port_id >> 8 != port_id >> 8) {
941 DEBUG_FABRIC(printk("adding a fabric port: %x\n", port_id));
942 param[0] = MBOX_PORT_LOGIN;
943 param[1] = loop_id << 8;
944 param[2] = (u_short) (port_id >> 16);
945 param[3] = (u_short) (port_id);
947 isp2100_mbox_command(host, param);
949 if (param[0] == MBOX_COMMAND_COMPLETE) {
950 port_db[scsi_id].wwn = wwn;
951 port_db[scsi_id].loop_id = loop_id;
952 loop_id++;
953 scsi_id++;
954 } else {
955 printk("qlogicfc.c: Error performing port login %x\n", param[0]);
956 DEBUG_FABRIC(printk("loop_id: %x\n", loop_id));
960 if (hostdata->port_id == port_id)
961 done = 1;
962 } else {
963 printk("qlogicfc.c: Get All Next failed %x.\n", param[0]);
964 return 0;
968 return 1;
971 #endif /* ISP2100_FABRIC */
974 int isp2100_release(struct Scsi_Host *host)
976 struct isp2100_hostdata *hostdata;
978 ENTER("isp2100_release");
980 hostdata = (struct isp2100_hostdata *) host->hostdata;
982 outw(0x0, host->io_port + PCI_INTER_CTL);
983 free_irq(host->irq, host);
985 release_region(host->io_port, 0xff);
987 LEAVE("isp2100_release");
989 return 0;
993 const char *isp2100_info(struct Scsi_Host *host)
995 static char buf[80];
996 struct isp2100_hostdata *hostdata;
997 ENTER("isp2100_info");
999 hostdata = (struct isp2100_hostdata *) host->hostdata;
1000 sprintf(buf,
1001 "QLogic ISP2100 SCSI on PCI bus %02x device %02x irq %d base 0x%lx",
1002 hostdata->pci_dev->bus->number, hostdata->pci_dev->devfn, host->irq,
1003 host->io_port);
1006 LEAVE("isp2100_info");
1008 return buf;
1013 * The middle SCSI layer ensures that queuecommand never gets invoked
1014 * concurrently with itself or the interrupt handler (though the
1015 * interrupt handler may call this routine as part of
1016 * request-completion handling).
1018 int isp2100_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
1020 int i, sg_count, n, num_free;
1021 u_int in_ptr, out_ptr;
1022 struct dataseg *ds;
1023 struct scatterlist *sg;
1024 struct Command_Entry *cmd;
1025 struct Continuation_Entry *cont;
1026 struct Scsi_Host *host;
1027 struct isp2100_hostdata *hostdata;
1029 ENTER("isp2100_queuecommand");
1031 host = Cmnd->host;
1032 hostdata = (struct isp2100_hostdata *) host->hostdata;
1033 Cmnd->scsi_done = done;
1035 DEBUG(isp2100_print_scsi_cmd(Cmnd));
1037 if (hostdata->loop_up == 2) {
1038 hostdata->loop_up = 1;
1039 isp2100_make_portdb(host);
1040 for (i = 0; hostdata->port_db[i].wwn != 0; i++) {
1041 DEBUG(printk("wwn: %08x%08x scsi_id: %x loop_id: %x\n", (u_int) (hostdata->port_db[i].wwn >> 32), (u_int) hostdata->port_db[i].wwn, i, hostdata->port_db[i].loop_id));
1044 if (hostdata->loop_up == -1) {
1045 printk("qlogicfc.c: The firmware is dead, just return.\n");
1046 host->max_id = 0;
1047 return 0;
1050 out_ptr = inw(host->io_port + MBOX4);
1051 in_ptr = hostdata->req_in_ptr;
1053 DEBUG(printk("qlogicfc : request queue depth %d\n",
1054 REQ_QUEUE_DEPTH(in_ptr, out_ptr)));
1056 cmd = (struct Command_Entry *) &hostdata->req[in_ptr][0];
1057 in_ptr = (in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN;
1058 if (in_ptr == out_ptr) {
1059 DEBUG(printk("qlogicfc : request queue overflow\n"));
1060 return 1;
1062 if (hostdata->send_marker) {
1063 struct Marker_Entry *marker;
1065 TRACE("queue marker", in_ptr, 0);
1067 DEBUG(printk("qlogicfc : adding marker entry\n"));
1068 marker = (struct Marker_Entry *) cmd;
1069 memset(marker, 0, sizeof(struct Marker_Entry));
1071 marker->hdr.entry_type = ENTRY_MARKER;
1072 marker->hdr.entry_cnt = 1;
1073 marker->modifier = SYNC_ALL;
1075 hostdata->send_marker = 0;
1077 if (((in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN) == out_ptr) {
1078 outw(in_ptr, host->io_port + MBOX4);
1079 hostdata->req_in_ptr = in_ptr;
1080 DEBUG(printk("qlogicfc : request queue overflow\n"));
1081 return 1;
1083 cmd = (struct Command_Entry *) &hostdata->req[in_ptr][0];
1084 in_ptr = (in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN;
1086 TRACE("queue command", in_ptr, Cmnd);
1088 memset(cmd, 0, sizeof(struct Command_Entry));
1090 /* find a free handle mapping slot */
1091 for (i = in_ptr; i != (in_ptr - 1) && hostdata->handle_ptrs[i]; i = ((i + 1) % (QLOGICFC_REQ_QUEUE_LEN + 1)));
1093 if (!hostdata->handle_ptrs[i]) {
1094 cmd->handle = i;
1095 hostdata->handle_ptrs[i] = Cmnd;
1096 hostdata->handle_serials[i] = Cmnd->serial_number;
1097 } else
1098 printk("qlogicfc: no handle slots, this should not happen.\n");
1100 cmd->hdr.entry_type = ENTRY_COMMAND;
1101 cmd->hdr.entry_cnt = 1;
1102 cmd->target_lun = Cmnd->lun;
1103 #if ISP2100_PORTDB
1104 cmd->target_id = hostdata->port_db[Cmnd->target].loop_id;
1105 #else
1106 cmd->target_id = Cmnd->target;
1107 #endif
1108 cmd->total_byte_cnt = (u_int) Cmnd->request_bufflen;
1109 cmd->time_out = (SCSI_TIMEOUT / HZ) * 5;
1110 memcpy(cmd->cdb, Cmnd->cmnd, Cmnd->cmd_len);
1112 if (Cmnd->use_sg) {
1113 cmd->segment_cnt = sg_count = Cmnd->use_sg;
1114 sg = (struct scatterlist *) Cmnd->request_buffer;
1115 ds = cmd->dataseg;
1116 /* fill in first two sg entries: */
1117 n = sg_count;
1118 if (n > 2)
1119 n = 2;
1120 for (i = 0; i < n; i++) {
1121 ds[i].d_base_lo = virt_to_bus_low32(sg->address);
1122 ds[i].d_base_high = virt_to_bus_high32(sg->address);
1123 ds[i].d_count = sg->length;
1124 ++sg;
1126 sg_count -= 2;
1128 while (sg_count > 0) {
1129 ++cmd->hdr.entry_cnt;
1130 cont = (struct Continuation_Entry *)
1131 &hostdata->req[in_ptr][0];
1132 memset(cont, 0, sizeof(struct Continuation_Entry));
1133 in_ptr = (in_ptr + 1) & QLOGICFC_REQ_QUEUE_LEN;
1134 if (in_ptr == out_ptr) {
1135 DEBUG(printk("isp2100: unexpected request queue overflow\n"));
1136 return 1;
1138 TRACE("queue continuation", in_ptr, 0);
1139 cont->hdr.entry_type = ENTRY_CONTINUATION;
1140 ds = cont->dataseg;
1141 n = sg_count;
1142 if (n > 5)
1143 n = 5;
1144 for (i = 0; i < n; ++i) {
1145 ds[i].d_base_lo = virt_to_bus_low32(sg->address);
1146 ds[i].d_base_high = virt_to_bus_high32(sg->address);
1147 ds[i].d_count = sg->length;
1148 ++sg;
1150 sg_count -= n;
1152 } else {
1153 cmd->dataseg[0].d_base_lo = virt_to_bus_low32(Cmnd->request_buffer);
1154 cmd->dataseg[0].d_base_high = virt_to_bus_high32(Cmnd->request_buffer);
1155 cmd->dataseg[0].d_count =
1156 (u_int) Cmnd->request_bufflen;
1157 cmd->segment_cnt = 1;
1160 switch (Cmnd->cmnd[0]) {
1161 case WRITE_10:
1162 case WRITE_6:
1163 case WRITE_BUFFER:
1164 cmd->control_flags = CFLAG_WRITE;
1165 break;
1166 case REQUEST_SENSE:
1167 /* scsi.c expects sense info in a different buffer */
1168 cmd->dataseg[0].d_base_lo = virt_to_bus_low32(Cmnd->sense_buffer);
1169 cmd->dataseg[0].d_base_high = virt_to_bus_high32(Cmnd->sense_buffer);
1170 cmd->segment_cnt = 1;
1171 cmd->control_flags = CFLAG_READ;
1172 break;
1173 default:
1174 cmd->control_flags = CFLAG_READ;
1175 break;
1179 if (Cmnd->device->tagged_supported) {
1180 if ((jiffies - hostdata->tag_ages[Cmnd->target]) > (2 * SCSI_TIMEOUT)) {
1181 cmd->control_flags |= CFLAG_ORDERED_TAG;
1182 hostdata->tag_ages[Cmnd->target] = jiffies;
1183 } else
1184 switch (Cmnd->tag) {
1185 case HEAD_OF_QUEUE_TAG:
1186 cmd->control_flags |= CFLAG_HEAD_TAG;
1187 break;
1188 case ORDERED_QUEUE_TAG:
1189 cmd->control_flags |= CFLAG_ORDERED_TAG;
1190 break;
1191 default:
1192 cmd->control_flags |= CFLAG_SIMPLE_TAG;
1193 break;
1196 outw(in_ptr, host->io_port + MBOX4);
1197 hostdata->req_in_ptr = in_ptr;
1199 hostdata->queued++;
1200 num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
1201 num_free = (num_free > 2) ? num_free - 2 : 0;
1202 host->can_queue = hostdata->queued + num_free;
1203 if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
1204 host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
1205 host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
1207 /* this is really gross */
1208 if (host->can_queue <= host->host_busy){
1209 if (host->can_queue+2 < host->host_busy)
1210 DEBUG(printk("qlogicfc.c crosses its fingers.\n"));
1211 host->can_queue = host->host_busy + 1;
1214 LEAVE("isp2100_queuecommand");
1216 return 0;
1220 #define ASYNC_EVENT_INTERRUPT 0x01
1223 void do_isp2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1225 unsigned long flags;
1227 spin_lock_irqsave(&io_request_lock, flags);
1228 isp2100_intr_handler(irq, dev_id, regs);
1229 spin_unlock_irqrestore(&io_request_lock, flags);
1232 void isp2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1234 Scsi_Cmnd *Cmnd;
1235 struct Status_Entry *sts;
1236 struct Scsi_Host *host = dev_id;
1237 struct isp2100_hostdata *hostdata;
1238 u_int in_ptr, out_ptr, handle, num_free;
1239 u_short status;
1241 ENTER_INTR("isp2100_intr_handler");
1243 hostdata = (struct isp2100_hostdata *) host->hostdata;
1245 DEBUG_INTR(printk("qlogicfc : interrupt on line %d\n", irq));
1247 if (!(inw(host->io_port + PCI_INTER_STS) & 0x08)) {
1248 /* spurious interrupts can happen legally */
1249 DEBUG_INTR(printk("qlogicfc: got spurious interrupt\n"));
1250 return;
1252 in_ptr = inw(host->io_port + MBOX5);
1253 out_ptr = hostdata->res_out_ptr;
1255 if ((inw(host->io_port + PCI_SEMAPHORE) & ASYNC_EVENT_INTERRUPT)) {
1256 status = inw(host->io_port + MBOX0);
1258 DEBUG_INTR(printk("qlogicfc : mbox completion status: %x\n",
1259 status));
1261 switch (status) {
1262 case LOOP_UP:
1263 hostdata->loop_up = 2;
1264 break;
1265 case LOOP_DOWN:
1266 hostdata->loop_up = 0;
1267 break;
1268 case LIP_OCCURED:
1269 case CHANGE_NOTIFICATION:
1270 case PORT_DB_CHANGED:
1271 case LIP_RECEIVED:
1272 if (hostdata->loop_up == 1)
1273 hostdata->loop_up = 2;
1274 break;
1275 case SYSTEM_ERROR:
1276 printk("The firmware just choked.\n");
1277 hostdata->loop_up = -1;
1278 break;
1279 case SCSI_COMMAND_COMPLETE:
1280 handle = inw(host->io_port + MBOX1) | (inw(host->io_port + MBOX2) << 16);
1281 Cmnd = hostdata->handle_ptrs[handle];
1282 hostdata->handle_ptrs[handle] = NULL;
1283 hostdata->handle_serials[handle] = 0;
1284 hostdata->queued--;
1285 if (Cmnd != NULL) {
1286 Cmnd->result = 0x0;
1287 (*Cmnd->scsi_done) (Cmnd);
1288 } else
1289 printk("qlogicfc.c: got a null value out of handle_ptrs, this sucks\n");
1290 break;
1291 case MBOX_COMMAND_COMPLETE:
1292 case INVALID_COMMAND:
1293 case HOST_INTERFACE_ERROR:
1294 case TEST_FAILED:
1295 case COMMAND_ERROR:
1296 case COMMAND_PARAM_ERROR:
1297 case PORT_ID_USED:
1298 case LOOP_ID_USED:
1299 case ALL_IDS_USED:
1300 hostdata->mbox_done = 1;
1301 outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
1302 return;
1303 default:
1304 printk("qlogicfc: got an unknown status? %x\n", status);
1306 outw(0x0, host->io_port + PCI_SEMAPHORE);
1307 } else {
1308 DEBUG_INTR(printk("qlogicfc : response queue update\n"));
1309 DEBUG_INTR(printk("qlogicfc : response queue depth %d\n", RES_QUEUE_DEPTH(in_ptr, out_ptr)));
1311 while (out_ptr != in_ptr) {
1312 sts = (struct Status_Entry *) &hostdata->res[out_ptr][0];
1313 out_ptr = (out_ptr + 1) & RES_QUEUE_LEN;
1315 TRACE("done", out_ptr, Cmnd);
1316 DEBUG_INTR(isp2100_print_status_entry(sts));
1317 if (sts->hdr.entry_type == ENTRY_STATUS) {
1318 Cmnd = hostdata->handle_ptrs[sts->handle];
1319 Cmnd->result = isp2100_return_status(sts);
1320 hostdata->handle_ptrs[sts->handle] = NULL;
1321 hostdata->queued--;
1322 if (hostdata->handle_serials[sts->handle] != Cmnd->serial_number) {
1323 hostdata->handle_serials[sts->handle] = 0;
1324 outw(out_ptr, host->io_port + MBOX5);
1325 continue;
1327 hostdata->handle_serials[sts->handle] = 0;
1328 } else {
1329 outw(out_ptr, host->io_port + MBOX5);
1330 continue;
1333 if (sts->completion_status == CS_RESET_OCCURRED
1334 || sts->completion_status == CS_ABORTED
1335 || (sts->status_flags & STF_BUS_RESET))
1336 hostdata->send_marker = 1;
1338 memset(Cmnd->sense_buffer, 0, sizeof(Cmnd->sense_buffer));
1339 if (sts->scsi_status & 0x0200)
1340 memcpy(Cmnd->sense_buffer, sts->req_sense_data,
1341 sizeof(Cmnd->sense_buffer));
1343 outw(out_ptr, host->io_port + MBOX5);
1345 if (Cmnd->scsi_done != NULL) {
1346 (*Cmnd->scsi_done) (Cmnd);
1347 } else
1348 printk("Ouch, scsi done is NULL\n");
1350 hostdata->res_out_ptr = out_ptr;
1354 out_ptr = inw(host->io_port + MBOX4);
1355 in_ptr = hostdata->req_in_ptr;
1357 num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr);
1358 num_free = (num_free > 2) ? num_free - 2 : 0;
1359 host->can_queue = hostdata->queued + num_free;
1360 if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN)
1361 host->can_queue = QLOGICFC_REQ_QUEUE_LEN;
1362 host->sg_tablesize = QLOGICFC_MAX_SG(num_free);
1364 if (host->can_queue <= host->host_busy){
1365 if (host->can_queue+2 < host->host_busy)
1366 DEBUG(printk("qlogicfc crosses its fingers.\n"));
1367 host->can_queue = host->host_busy + 1;
1370 outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
1371 LEAVE_INTR("isp2100_intr_handler");
1375 static int isp2100_return_status(struct Status_Entry *sts)
1377 int host_status = DID_ERROR;
1378 #if DEBUG_ISP2100_INTR
1379 static char *reason[] =
1381 "DID_OK",
1382 "DID_NO_CONNECT",
1383 "DID_BUS_BUSY",
1384 "DID_TIME_OUT",
1385 "DID_BAD_TARGET",
1386 "DID_ABORT",
1387 "DID_PARITY",
1388 "DID_ERROR",
1389 "DID_RESET",
1390 "DID_BAD_INTR"
1392 #endif /* DEBUG_ISP2100_INTR */
1394 ENTER("isp2100_return_status");
1396 DEBUG(printk("qlogicfc : completion status = 0x%04x\n",
1397 sts->completion_status));
1399 switch (sts->completion_status) {
1400 case CS_COMPLETE:
1401 host_status = DID_OK;
1402 break;
1403 case CS_DMA_ERROR:
1404 host_status = DID_ERROR;
1405 break;
1406 case CS_RESET_OCCURRED:
1407 host_status = DID_RESET;
1408 break;
1409 case CS_ABORTED:
1410 host_status = DID_ABORT;
1411 break;
1412 case CS_TIMEOUT:
1413 host_status = DID_TIME_OUT;
1414 break;
1415 case CS_DATA_OVERRUN:
1416 host_status = DID_ERROR;
1417 break;
1418 case CS_DATA_UNDERRUN:
1419 host_status = DID_OK;
1420 break;
1421 case CS_PORT_UNAVAILABLE:
1422 case CS_PORT_LOGGED_OUT:
1423 case CS_PORT_CONFIG_CHANGED:
1424 host_status = DID_BAD_TARGET;
1425 break;
1426 case CS_QUEUE_FULL:
1427 host_status = DID_ERROR;
1428 break;
1429 default:
1430 printk("qlogicfc : unknown completion status 0x%04x\n",
1431 sts->completion_status);
1432 host_status = DID_ERROR;
1433 break;
1436 DEBUG_INTR(printk("qlogicfc : host status (%s) scsi status %x\n",
1437 reason[host_status], sts->scsi_status));
1439 LEAVE("isp2100_return_status");
1441 return (sts->scsi_status & STATUS_MASK) | (host_status << 16);
1445 int isp2100_abort(Scsi_Cmnd * Cmnd)
1447 u_short param[8];
1448 int i;
1449 struct Scsi_Host *host;
1450 struct isp2100_hostdata *hostdata;
1451 int return_status = SCSI_ABORT_SUCCESS;
1453 ENTER("isp2100_abort");
1455 host = Cmnd->host;
1456 hostdata = (struct isp2100_hostdata *) host->hostdata;
1458 for (i = 0; i < QLOGICFC_REQ_QUEUE_LEN; i++)
1459 if (hostdata->handle_ptrs[i] == Cmnd)
1460 break;
1462 if (i == QLOGICFC_REQ_QUEUE_LEN)
1463 return SCSI_ABORT_ERROR;
1465 isp2100_disable_irqs(host);
1467 param[0] = MBOX_ABORT_IOCB;
1468 param[1] = (((u_short) Cmnd->target) << 8) | Cmnd->lun;
1469 param[2] = i >> 16;
1470 param[3] = i & 0xffff;
1472 isp2100_mbox_command(host, param);
1474 if (param[0] != MBOX_COMMAND_COMPLETE) {
1475 printk("qlogicfc : scsi abort failure: %x\n", param[0]);
1476 if (param[0] == 0x4005)
1477 Cmnd->result = DID_ERROR << 16;
1478 if (param[0] == 0x4006)
1479 Cmnd->result = DID_BAD_TARGET << 16;
1480 (*Cmnd->scsi_done) (Cmnd);
1481 return_status = SCSI_ABORT_ERROR;
1483 isp2100_enable_irqs(host);
1485 LEAVE("isp2100_abort");
1487 return return_status;
1491 int isp2100_reset(Scsi_Cmnd * Cmnd, unsigned int reset_flags)
1493 u_short param[8];
1494 struct Scsi_Host *host;
1495 struct isp2100_hostdata *hostdata;
1496 int return_status = SCSI_RESET_SUCCESS;
1498 ENTER("isp2100_reset");
1500 host = Cmnd->host;
1501 hostdata = (struct isp2100_hostdata *) host->hostdata;
1502 param[0] = MBOX_BUS_RESET;
1503 param[1] = 3;
1505 isp2100_disable_irqs(host);
1507 isp2100_mbox_command(host, param);
1509 if (param[0] != MBOX_COMMAND_COMPLETE) {
1510 printk("qlogicfc : scsi bus reset failure: %x\n", param[0]);
1511 return_status = SCSI_RESET_ERROR;
1513 isp2100_enable_irqs(host);
1515 LEAVE("isp2100_reset");
1517 return return_status;;
1521 int isp2100_biosparam(Disk * disk, kdev_t n, int ip[])
1523 int size = disk->capacity;
1525 ENTER("isp2100_biosparam");
1527 ip[0] = 64;
1528 ip[1] = 32;
1529 ip[2] = size >> 11;
1530 if (ip[2] > 1024) {
1531 ip[0] = 255;
1532 ip[1] = 63;
1533 ip[2] = size / (ip[0] * ip[1]);
1535 LEAVE("isp2100_biosparam");
1537 return 0;
1541 static int isp2100_reset_hardware(struct Scsi_Host *host)
1543 u_short param[8];
1544 struct isp2100_hostdata *hostdata;
1545 int loop_count;
1547 ENTER("isp2100_reset_hardware");
1549 outw(0x01, host->io_port + ISP_CTRL_STATUS);
1550 outw(HCCR_RESET, host->io_port + HOST_HCCR);
1551 outw(HCCR_RELEASE, host->io_port + HOST_HCCR);
1552 outw(HCCR_BIOS_DISABLE, host->io_port + HOST_HCCR);
1554 loop_count = DEFAULT_LOOP_COUNT;
1555 while (--loop_count && inw(host->io_port + HOST_HCCR) == RISC_BUSY)
1556 barrier();
1557 if (!loop_count)
1558 printk("qlogicfc: reset_hardware loop timeout\n");
1562 #if DEBUG_ISP2100
1563 printk("qlogicfc : mbox 0 0x%04x \n", inw(host->io_port + MBOX0));
1564 printk("qlogicfc : mbox 1 0x%04x \n", inw(host->io_port + MBOX1));
1565 printk("qlogicfc : mbox 2 0x%04x \n", inw(host->io_port + MBOX2));
1566 printk("qlogicfc : mbox 3 0x%04x \n", inw(host->io_port + MBOX3));
1567 printk("qlogicfc : mbox 4 0x%04x \n", inw(host->io_port + MBOX4));
1568 printk("qlogicfc : mbox 5 0x%04x \n", inw(host->io_port + MBOX5));
1569 printk("qlogicfc : mbox 6 0x%04x \n", inw(host->io_port + MBOX6));
1570 printk("qlogicfc : mbox 7 0x%04x \n", inw(host->io_port + MBOX7));
1571 #endif /* DEBUG_ISP2100 */
1573 DEBUG(printk("qlogicfc : verifying checksum\n"));
1575 #if RELOAD_FIRMWARE
1577 int i;
1578 for (i = 0; i < risc_code_length01; i++) {
1579 param[0] = MBOX_WRITE_RAM_WORD;
1580 param[1] = risc_code_addr01 + i;
1581 param[2] = risc_code01[i];
1583 isp2100_mbox_command(host, param);
1585 if (param[0] != MBOX_COMMAND_COMPLETE) {
1586 printk("qlogicfc : firmware load failure\n");
1587 return 1;
1591 #endif /* RELOAD_FIRMWARE */
1593 param[0] = MBOX_VERIFY_CHECKSUM;
1594 param[1] = risc_code_addr01;
1596 isp2100_mbox_command(host, param);
1598 if (param[0] != MBOX_COMMAND_COMPLETE) {
1599 printk("qlogicfc : ram checksum failure\n");
1600 return 1;
1602 DEBUG(printk("qlogicfc : executing firmware\n"));
1604 param[0] = MBOX_EXEC_FIRMWARE;
1605 param[1] = risc_code_addr01;
1607 isp2100_mbox_command(host, param);
1609 param[0] = MBOX_ABOUT_FIRMWARE;
1611 isp2100_mbox_command(host, param);
1613 if (param[0] != MBOX_COMMAND_COMPLETE) {
1614 printk("qlogicfc : about firmware failure\n");
1615 return 1;
1617 DEBUG(printk("qlogicfc : firmware major revision %d\n", param[1]));
1618 DEBUG(printk("qlogicfc : firmware minor revision %d\n", param[2]));
1620 hostdata = (struct isp2100_hostdata *) host->hostdata;
1622 #ifdef USE_NVRAM_DEFAULTS
1624 if (isp2100_get_nvram_defaults(host, &hostdata->control_block) != 0) {
1625 printk("qlogicfc: Could not read from NVRAM\n");
1627 #endif
1629 hostdata->wwn = (u64) (hostdata->control_block.node_name[0]) << 56;
1630 hostdata->wwn |= (u64) (hostdata->control_block.node_name[0] & 0xff00) << 48;
1631 hostdata->wwn |= (u64) (hostdata->control_block.node_name[1] & 0xff00) << 24;
1632 hostdata->wwn |= (u64) (hostdata->control_block.node_name[1] & 0x00ff) << 48;
1633 hostdata->wwn |= (u64) (hostdata->control_block.node_name[2] & 0x00ff) << 24;
1634 hostdata->wwn |= (u64) (hostdata->control_block.node_name[2] & 0xff00) << 8;
1635 hostdata->wwn |= (u64) (hostdata->control_block.node_name[3] & 0x00ff) << 8;
1636 hostdata->wwn |= (u64) (hostdata->control_block.node_name[3] & 0xff00) >> 8;
1638 param[0] = MBOX_INIT_FIRMWARE;
1639 param[2] = (u_short) (virt_to_bus_low32(&hostdata->control_block) >> 16);
1640 param[3] = (u_short) (virt_to_bus_low32(&hostdata->control_block) & 0xffff);
1641 param[4] = 0;
1642 param[5] = 0;
1643 param[6] = (u_short) (virt_to_bus_high32(&hostdata->control_block) >> 16);
1644 param[7] = (u_short) (virt_to_bus_high32(&hostdata->control_block) & 0xffff);
1645 isp2100_mbox_command(host, param);
1646 if (param[0] != MBOX_COMMAND_COMPLETE) {
1647 printk("qlogicfc.c: Ouch 0x%04x\n", param[0]);
1648 return 1;
1650 param[0] = MBOX_GET_FIRMWARE_STATE;
1651 isp2100_mbox_command(host, param);
1652 if (param[0] != MBOX_COMMAND_COMPLETE) {
1653 printk("qlogicfc.c: 0x%04x\n", param[0]);
1654 return 1;
1657 LEAVE("isp2100_reset_hardware");
1659 return 0;
1662 #ifdef USE_NVRAM_DEFAULTS
1664 static int isp2100_get_nvram_defaults(struct Scsi_Host *host, struct init_cb *control_block)
1667 u_short value;
1668 if (isp2100_read_nvram_word(host, 0) != 0x5349)
1669 return 1;
1671 value = isp2100_read_nvram_word(host, 8);
1672 control_block->node_name[0] = isp2100_read_nvram_word(host, 9);
1673 control_block->node_name[1] = isp2100_read_nvram_word(host, 10);
1674 control_block->node_name[2] = isp2100_read_nvram_word(host, 11);
1675 control_block->node_name[3] = isp2100_read_nvram_word(host, 12);
1676 control_block->hard_addr = isp2100_read_nvram_word(host, 13);
1678 return 0;
1682 #endif
1684 static int isp2100_init(struct Scsi_Host *sh)
1686 u_int io_base;
1687 struct isp2100_hostdata *hostdata;
1688 u_char revision;
1689 u_int irq;
1690 u_short command;
1691 struct pci_dev *pdev;
1694 ENTER("isp2100_init");
1696 hostdata = (struct isp2100_hostdata *) sh->hostdata;
1697 pdev = hostdata->pci_dev;
1699 if (pci_read_config_word(pdev, PCI_COMMAND, &command)
1700 || pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision)) {
1701 printk("qlogicfc : error reading PCI configuration\n");
1702 return 1;
1704 io_base = pdev->base_address[0];
1705 irq = pdev->irq;
1709 if (pdev->vendor != PCI_VENDOR_ID_QLOGIC) {
1710 printk("qlogicfc : 0x%04x is not QLogic vendor ID\n",
1711 pdev->vendor);
1712 return 1;
1714 if (pdev->device != PCI_DEVICE_ID_QLOGIC_ISP2100) {
1715 printk("qlogicfc : 0x%04x does not match ISP2100 device id\n",
1716 pdev->device);
1717 return 1;
1719 if (command & PCI_COMMAND_IO && (io_base & 3) == 1)
1720 io_base &= PCI_BASE_ADDRESS_IO_MASK;
1721 else {
1722 printk("qlogicfc : i/o mapping is disabled\n");
1723 return 1;
1726 if (!(command & PCI_COMMAND_MASTER)) {
1727 printk("qlogicfc : bus mastering is disabled\n");
1728 return 1;
1730 if (revision != ISP2100_REV_ID && revision != ISP2100_REV_ID3)
1731 printk("qlogicfc : new isp2100 revision ID (%d)\n", revision);
1734 hostdata->revision = revision;
1736 sh->irq = irq;
1737 sh->io_port = io_base;
1739 LEAVE("isp2100_init");
1741 return 0;
1744 #if USE_NVRAM_DEFAULTS
1746 #define NVRAM_DELAY() udelay(10) /* 10 microsecond delay */
1749 u_short isp2100_read_nvram_word(struct Scsi_Host * host, u_short byte)
1751 int i;
1752 u_short value, output, input;
1754 outw(0x2, host->io_port + PCI_NVRAM);
1755 NVRAM_DELAY();
1756 outw(0x3, host->io_port + PCI_NVRAM);
1757 NVRAM_DELAY();
1759 byte &= 0xff;
1760 byte |= 0x0600;
1761 for (i = 10; i >= 0; i--) {
1762 output = ((byte >> i) & 0x1) ? 0x4 : 0x0;
1763 outw(output | 0x2, host->io_port + PCI_NVRAM);
1764 NVRAM_DELAY();
1765 outw(output | 0x3, host->io_port + PCI_NVRAM);
1766 NVRAM_DELAY();
1767 outw(output | 0x2, host->io_port + PCI_NVRAM);
1768 NVRAM_DELAY();
1771 for (i = 0xf, value = 0; i >= 0; i--) {
1772 value <<= 1;
1773 outw(0x3, host->io_port + PCI_NVRAM);
1774 NVRAM_DELAY();
1775 input = inw(host->io_port + PCI_NVRAM);
1776 NVRAM_DELAY();
1777 outw(0x2, host->io_port + PCI_NVRAM);
1778 NVRAM_DELAY();
1779 if (input & 0x8)
1780 value |= 1;
1783 outw(0x0, host->io_port + PCI_NVRAM);
1784 NVRAM_DELAY();
1786 return value;
1790 #endif /* USE_NVRAM_DEFAULTS */
1795 * currently, this is only called during initialization or abort/reset,
1796 * at which times interrupts are disabled, so polling is OK, I guess...
1798 static int isp2100_mbox_command(struct Scsi_Host *host, u_short param[])
1800 int loop_count;
1801 struct isp2100_hostdata *hostdata = (struct isp2100_hostdata *) host->hostdata;
1803 if (mbox_param[param[0]] == 0)
1804 return 1;
1806 loop_count = DEFAULT_LOOP_COUNT;
1807 while (--loop_count && inw(host->io_port + HOST_HCCR) & 0x0080)
1808 barrier();
1809 if (!loop_count) {
1810 printk("qlogicfc: mbox_command loop timeout #1\n");
1811 param[0] = 0x4006;
1812 return 1;
1814 hostdata->mbox_done = 0;
1816 if (mbox_param[param[0]] == 0)
1817 printk("qlogicfc: invalid mbox command\n");
1819 if (mbox_param[param[0]] & 0x80)
1820 outw(param[7], host->io_port + MBOX7);
1821 if (mbox_param[param[0]] & 0x40)
1822 outw(param[6], host->io_port + MBOX6);
1823 if (mbox_param[param[0]] & 0x20)
1824 outw(param[5], host->io_port + MBOX5);
1825 if (mbox_param[param[0]] & 0x10)
1826 outw(param[4], host->io_port + MBOX4);
1827 if (mbox_param[param[0]] & 0x08)
1828 outw(param[3], host->io_port + MBOX3);
1829 if (mbox_param[param[0]] & 0x04)
1830 outw(param[2], host->io_port + MBOX2);
1831 if (mbox_param[param[0]] & 0x02)
1832 outw(param[1], host->io_port + MBOX1);
1833 if (mbox_param[param[0]] & 0x01)
1834 outw(param[0], host->io_port + MBOX0);
1837 outw(HCCR_SET_HOST_INTR, host->io_port + HOST_HCCR);
1839 while (1) {
1840 loop_count = DEFAULT_LOOP_COUNT;
1841 while (--loop_count && !(inw(host->io_port + PCI_INTER_STS) & 0x08)) {
1842 barrier();
1845 if (!loop_count) {
1846 printk("qlogicfc: mbox_command loop timeout #2\n");
1847 break;
1849 isp2100_intr_handler(host->irq, host, NULL);
1851 if (hostdata->mbox_done == 1)
1852 break;
1856 loop_count = DEFAULT_LOOP_COUNT;
1857 while (--loop_count && inw(host->io_port + MBOX0) == 0x04) {
1858 barrier();
1860 if (!loop_count)
1861 printk("qlogicfc: mbox_command loop timeout #3\n");
1863 param[7] = inw(host->io_port + MBOX7);
1864 param[6] = inw(host->io_port + MBOX6);
1865 param[5] = inw(host->io_port + MBOX5);
1866 param[4] = inw(host->io_port + MBOX4);
1867 param[3] = inw(host->io_port + MBOX3);
1868 param[2] = inw(host->io_port + MBOX2);
1869 param[1] = inw(host->io_port + MBOX1);
1870 param[0] = inw(host->io_port + MBOX0);
1873 outw(0x0, host->io_port + PCI_SEMAPHORE);
1875 if (inw(host->io_port + HOST_HCCR) & 0x0080) {
1876 printk("mbox op is still pending\n");
1878 return 0;
1882 void isp2100_print_status_entry(struct Status_Entry *status)
1884 printk("qlogicfc : entry count = 0x%02x, type = 0x%02x, flags = 0x%02x\n",
1885 status->hdr.entry_cnt, status->hdr.entry_type, status->hdr.flags);
1886 printk("qlogicfc : scsi status = 0x%04x, completion status = 0x%04x\n",
1887 status->scsi_status, status->completion_status);
1888 printk("qlogicfc : state flags = 0x%04x, status flags = 0x%04x\n",
1889 status->state_flags, status->status_flags);
1890 printk("qlogicfc : response info length = 0x%04x, request sense length = 0x%04x\n",
1891 status->res_info_len, status->req_sense_len);
1892 printk("qlogicfc : residual transfer length = 0x%08x, response = 0x%02x\n", status->residual, status->res_info[3]);
1898 #if DEBUG_ISP2100
1900 void isp2100_print_scsi_cmd(Scsi_Cmnd * cmd)
1902 int i;
1904 printk("qlogicfc : target = 0x%02x, lun = 0x%02x, cmd_len = 0x%02x\n",
1905 cmd->target, cmd->lun, cmd->cmd_len);
1906 printk("qlogicfc : command = ");
1907 for (i = 0; i < cmd->cmd_len; i++)
1908 printk("0x%02x ", cmd->cmnd[i]);
1909 printk("\n");
1912 #endif /* DEBUG_ISP2100 */
1915 #ifdef MODULE
1917 Scsi_Host_Template driver_template = QLOGICFC;
1919 #include "scsi_module.c"
1921 #endif