patch-2.3.15 linux/drivers/scsi/qlogicfc.c
Next file: linux/drivers/scsi/qlogicfc.h
Previous file: linux/drivers/scsi/megaraid.h
Back to the patch index
Back to the overall index
- Lines: 1228
- Date:
Mon Aug 23 10:14:44 1999
- Orig file:
v2.3.14/linux/drivers/scsi/qlogicfc.c
- Orig date:
Thu Aug 5 15:11:52 1999
diff -u --recursive --new-file v2.3.14/linux/drivers/scsi/qlogicfc.c linux/drivers/scsi/qlogicfc.c
@@ -1,5 +1,5 @@
/*
- * QLogic ISP2100 SCSI-FCP
+ * QLogic ISP2x00 SCSI-FCP
* Written by Erik H. Moe, ehm@cris.com
* Copyright 1995, Erik H. Moe
*
@@ -17,7 +17,7 @@
/* Renamed and updated to 1.3.x by Michael Griffith <grif@cs.ucr.edu> */
/* This is a version of the isp1020 driver which was modified by
- * Chris Loveland <cwl@iol.unh.edu> to support the isp2100
+ * Chris Loveland <cwl@iol.unh.edu> to support the isp2100 and isp2200
*/
/*
@@ -63,28 +63,30 @@
/* Configuration section **************************************************** */
-/* Set the following macro to 1 to reload the ISP2100's firmware. This is
- version 1.15.19 of the firmware. */
+/* Set the following macro to 1 to reload the ISP2x00's firmware. This is
+ version 1.15.37 of the isp2100's firmware and version 2.00.16 of the
+ isp2200's firmware.
+*/
#define RELOAD_FIRMWARE 1
#define USE_NVRAM_DEFAULTS 1
-#define ISP2100_PORTDB 1
+#define ISP2x00_PORTDB 1
/* Set the following to 1 to include fabric support, fabric support is
* currently not as well tested as the other aspects of the driver */
-#define ISP2100_FABRIC 0
+#define ISP2x00_FABRIC 0
/* Macros used for debugging */
/*
-#define DEBUG_ISP2100 1
-#define DEBUG_ISP2100_INT 1
-#define DEBUG_ISP2100_INTR 1
-#define DEBUG_ISP2100_SETUP 1
+#define DEBUG_ISP2x00 1
+#define DEBUG_ISP2x00_INT 1
+#define DEBUG_ISP2x00_INTR 1
+#define DEBUG_ISP2x00_SETUP 1
-#define DEBUG_ISP2100_FABRIC 1
+#define DEBUG_ISP2x00_FABRIC 1
*/
/* #define TRACE_ISP 1 */
@@ -127,32 +129,32 @@
#define TRACE(w, i, a)
#endif
-#if DEBUG_ISP2100_FABRIC
+#if DEBUG_ISP2x00_FABRIC
#define DEBUG_FABRIC(x) x
#else
#define DEBUG_FABRIC(x)
-#endif /* DEBUG_ISP2100_FABRIC */
+#endif /* DEBUG_ISP2x00_FABRIC */
-#if DEBUG_ISP2100
-#define ENTER(x) printk("isp2100 : entering %s()\n", x);
-#define LEAVE(x) printk("isp2100 : leaving %s()\n", x);
+#if DEBUG_ISP2x00
+#define ENTER(x) printk("isp2x00 : entering %s()\n", x);
+#define LEAVE(x) printk("isp2x00 : leaving %s()\n", x);
#define DEBUG(x) x
#else
#define ENTER(x)
#define LEAVE(x)
#define DEBUG(x)
-#endif /* DEBUG_ISP2100 */
+#endif /* DEBUG_ISP2x00 */
-#if DEBUG_ISP2100_INTR
-#define ENTER_INTR(x) printk("isp2100 : entering %s()\n", x);
-#define LEAVE_INTR(x) printk("isp2100 : leaving %s()\n", x);
+#if DEBUG_ISP2x00_INTR
+#define ENTER_INTR(x) printk("isp2x00 : entering %s()\n", x);
+#define LEAVE_INTR(x) printk("isp2x00 : leaving %s()\n", x);
#define DEBUG_INTR(x) x
#else
#define ENTER_INTR(x)
#define LEAVE_INTR(x)
#define DEBUG_INTR(x)
-#endif /* DEBUG ISP2100_INTR */
+#endif /* DEBUG ISP2x00_INTR */
#if BITS_PER_LONG > 32
@@ -167,11 +169,9 @@
#define bus_to_virt_high32(x) 0x0
#endif
-#define ISP2100_REV_ID 1
+#define ISP2100_REV_ID1 1
#define ISP2100_REV_ID3 3
-
-#define MAX_TARGETS 16
-#define MAX_LUNS 8
+#define ISP2200_REV_ID5 5
/* host configuration and control registers */
#define HOST_HCCR 0xc0 /* host command and control */
@@ -219,6 +219,8 @@
#define PORT_DB_CHANGED 0x8014
#define CHANGE_NOTIFICATION 0x8015
#define SCSI_COMMAND_COMPLETE 0x8020
+#define POINT_TO_POINT_UP 0x8030
+#define CONNECTION_MODE 0x8036
struct Entry_header {
u_char entry_type;
@@ -235,6 +237,7 @@
#define ENTRY_COMMAND 0x11
#define ENTRY_CONTINUATION 0x02
#endif
+
#define ENTRY_STATUS 0x03
#define ENTRY_MARKER 0x04
@@ -256,7 +259,7 @@
u_int handle;
u_char target_lun;
u_char target_id;
- u_short rsvd1;
+ u_short expanded_lun;
u_short control_flags;
u_short rsvd2;
u_short time_out;
@@ -277,7 +280,7 @@
u_int handle;
u_char target_lun;
u_char target_id;
- u_short rsvd1;
+ u_short expanded_lun;
u_short control_flags;
u_short rsvd2;
u_short time_out;
@@ -299,19 +302,6 @@
#define CFLAG_READ 0x20
#define CFLAG_WRITE 0x40
-struct Ext_Command_Entry {
- struct Entry_header hdr;
- u_int handle;
- u_char target_lun;
- u_char target_id;
- u_short cdb_length;
- u_short control_flags;
- u_short rsvd;
- u_short time_out;
- u_short segment_cnt;
- u_char cdb[44];
-};
-
#if BITS_PER_LONG > 32
struct Continuation_Entry {
struct Entry_header hdr;
@@ -331,7 +321,7 @@
u_char target_lun;
u_char target_id;
u_char modifier;
- u_char rsvd;
+ u_char expanded_lun;
u_char rsvds[52];
};
@@ -613,6 +603,17 @@
u_int req_queue_addr_high;
u_int res_queue_addr_lo;
u_int res_queue_addr_high;
+ /* the rest of this structure only applies to the isp2200 */
+ u_short lun_enables;
+ u_char cmd_resource_cnt;
+ u_char notify_resource_cnt;
+ u_short timeout;
+ u_short reserved3;
+ u_short add_firm_opts;
+ u_char res_accum_timer;
+ u_char irq_delay_timer;
+ u_short special_options;
+ u_short reserved4[13];
};
/*
@@ -622,7 +623,7 @@
#define RES_QUEUE_LEN ((QLOGICFC_REQ_QUEUE_LEN + 1) / 8 - 1)
#define QUEUE_ENTRY_LEN 64
-#if ISP2100_FABRIC
+#if ISP2x00_FABRIC
#define QLOGICFC_MAX_ID 0xff
#else
#define QLOGICFC_MAX_ID 0x7d
@@ -636,10 +637,10 @@
#define AS_LOOP_GOOD 1
#define AS_REDO_PORTDB 2
-struct isp2100_hostdata {
+struct isp2x00_hostdata {
u_char revision;
struct pci_dev *pci_dev;
- /* result and request queues (shared with isp2100): */
+ /* result and request queues (shared with isp2x00): */
u_int req_in_ptr; /* index of next request slot */
u_int res_out_ptr; /* index of next result slot */
@@ -668,176 +669,187 @@
QLOGICFC_REQ_QUEUE_LEN)
#define RES_QUEUE_DEPTH(in, out) QUEUE_DEPTH(in, out, RES_QUEUE_LEN)
-static void isp2100_enable_irqs(struct Scsi_Host *);
-static void isp2100_disable_irqs(struct Scsi_Host *);
-static int isp2100_init(struct Scsi_Host *);
-static int isp2100_reset_hardware(struct Scsi_Host *);
-static int isp2100_mbox_command(struct Scsi_Host *, u_short[]);
-static int isp2100_return_status(struct Status_Entry *);
-static void isp2100_intr_handler(int, void *, struct pt_regs *);
-static void do_isp2100_intr_handler(int, void *, struct pt_regs *);
-static int isp2100_make_portdb(struct Scsi_Host *);
+static void isp2x00_enable_irqs(struct Scsi_Host *);
+static void isp2x00_disable_irqs(struct Scsi_Host *);
+static int isp2x00_init(struct Scsi_Host *);
+static int isp2x00_reset_hardware(struct Scsi_Host *);
+static int isp2x00_mbox_command(struct Scsi_Host *, u_short[]);
+static int isp2x00_return_status(struct Status_Entry *);
+static void isp2x00_intr_handler(int, void *, struct pt_regs *);
+static void do_isp2x00_intr_handler(int, void *, struct pt_regs *);
+static int isp2x00_make_portdb(struct Scsi_Host *);
-#if ISP2100_FABRIC
-static int isp2100_init_fabric(struct Scsi_Host *, struct id_name_map *, int);
+#if ISP2x00_FABRIC
+static int isp2x00_init_fabric(struct Scsi_Host *, struct id_name_map *, int);
#endif
#if USE_NVRAM_DEFAULTS
-static int isp2100_get_nvram_defaults(struct Scsi_Host *, struct init_cb *);
-static u_short isp2100_read_nvram_word(struct Scsi_Host *, u_short);
+static int isp2x00_get_nvram_defaults(struct Scsi_Host *, struct init_cb *);
+static u_short isp2x00_read_nvram_word(struct Scsi_Host *, u_short);
#endif
-#if DEBUG_ISP2100
-static void isp2100_print_scsi_cmd(Scsi_Cmnd *);
+#if DEBUG_ISP2x00
+static void isp2x00_print_scsi_cmd(Scsi_Cmnd *);
#endif
-#if DEBUG_ISP2100_INTR
-static void isp2100_print_status_entry(struct Status_Entry *);
+#if DEBUG_ISP2x00_INTR
+static void isp2x00_print_status_entry(struct Status_Entry *);
#endif
-static struct proc_dir_entry proc_scsi_isp2100 =
+static struct proc_dir_entry proc_scsi_isp2x00 =
{
- PROC_SCSI_QLOGICFC, 7, "isp2100",
+ PROC_SCSI_QLOGICFC, 7, "isp2x00",
S_IFDIR | S_IRUGO | S_IXUGO, 2
};
-static inline void isp2100_enable_irqs(struct Scsi_Host *host)
+static inline void isp2x00_enable_irqs(struct Scsi_Host *host)
{
outw(ISP_EN_INT | ISP_EN_RISC, host->io_port + PCI_INTER_CTL);
}
-static inline void isp2100_disable_irqs(struct Scsi_Host *host)
+static inline void isp2x00_disable_irqs(struct Scsi_Host *host)
{
outw(0x0, host->io_port + PCI_INTER_CTL);
}
-int isp2100_detect(Scsi_Host_Template * tmpt)
+int isp2x00_detect(Scsi_Host_Template * tmpt)
{
int hosts = 0;
int wait_time;
struct Scsi_Host *host = NULL;
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
struct pci_dev *pdev = NULL;
+ unsigned short device_ids[2];
+ int i;
+
+
+ ENTER("isp2x00_detect");
- ENTER("isp2100_detect");
+ device_ids[0] = PCI_DEVICE_ID_QLOGIC_ISP2100;
+ device_ids[1] = PCI_DEVICE_ID_QLOGIC_ISP2200;
- tmpt->proc_dir = &proc_scsi_isp2100;
+ tmpt->proc_dir = &proc_scsi_isp2x00;
if (pci_present() == 0) {
printk("qlogicfc : PCI not present\n");
return 0;
}
- while ((pdev = pci_find_device(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2100, pdev))) {
- host = scsi_register(tmpt, sizeof(struct isp2100_hostdata));
- host->max_id = QLOGICFC_MAX_ID + 1;
- host->hostt->use_new_eh_code = 1;
- hostdata = (struct isp2100_hostdata *) host->hostdata;
-
- memset(hostdata, 0, sizeof(struct isp2100_hostdata));
- hostdata->pci_dev = pdev;
-
- hostdata->queued = 0;
- /* set up the control block */
- hostdata->control_block.version = 0x0f;
- hostdata->control_block.firm_opts = 0x0108;
- hostdata->control_block.max_frame_len = 2048;
- hostdata->control_block.max_iocb = 256;
- hostdata->control_block.exec_throttle = 8;
- hostdata->control_block.retry_delay = 5;
- hostdata->control_block.retry_cnt = 0;
- hostdata->control_block.node_name[0] = 0x0020;
- hostdata->control_block.node_name[1] = 0xE000;
- hostdata->control_block.node_name[2] = 0x008B;
- hostdata->control_block.node_name[3] = 0x0000;
- hostdata->control_block.hard_addr = 0x0003;
- hostdata->control_block.req_queue_len = QLOGICFC_REQ_QUEUE_LEN + 1;
- hostdata->control_block.res_queue_len = RES_QUEUE_LEN + 1;
- hostdata->control_block.res_queue_addr_lo = virt_to_bus_low32(&hostdata->res);
- hostdata->control_block.res_queue_addr_high = virt_to_bus_high32(&hostdata->res);
- hostdata->control_block.req_queue_addr_lo = virt_to_bus_low32(&hostdata->req);
- hostdata->control_block.req_queue_addr_high = virt_to_bus_high32(&hostdata->req);
+ for (i=0; i<2; i++){
+ while ((pdev = pci_find_device(PCI_VENDOR_ID_QLOGIC, device_ids[i], pdev))) {
- hostdata->adapter_state = AS_LOOP_DOWN;
- hostdata->host_id = hosts;
+ host = scsi_register(tmpt, sizeof(struct isp2x00_hostdata));
+ host->max_id = QLOGICFC_MAX_ID + 1;
+ host->hostt->use_new_eh_code = 1;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
+
+ memset(hostdata, 0, sizeof(struct isp2x00_hostdata));
+ hostdata->pci_dev = pdev;
+
+ hostdata->queued = 0;
+ /* set up the control block */
+ hostdata->control_block.version = 0x1;
+ hostdata->control_block.firm_opts = 0x0108;
+ hostdata->control_block.max_frame_len = 2048;
+ hostdata->control_block.max_iocb = 256;
+ hostdata->control_block.exec_throttle = 8;
+ hostdata->control_block.retry_delay = 5;
+ hostdata->control_block.retry_cnt = 1;
+ hostdata->control_block.node_name[0] = 0x0020;
+ hostdata->control_block.node_name[1] = 0xE000;
+ hostdata->control_block.node_name[2] = 0x008B;
+ hostdata->control_block.node_name[3] = 0x0000;
+ hostdata->control_block.hard_addr = 0x0003;
+ hostdata->control_block.req_queue_len = QLOGICFC_REQ_QUEUE_LEN + 1;
+ hostdata->control_block.res_queue_len = RES_QUEUE_LEN + 1;
+ hostdata->control_block.res_queue_addr_lo = virt_to_bus_low32(&hostdata->res);
+ hostdata->control_block.res_queue_addr_high = virt_to_bus_high32(&hostdata->res);
+ hostdata->control_block.req_queue_addr_lo = virt_to_bus_low32(&hostdata->req);
+ hostdata->control_block.req_queue_addr_high = virt_to_bus_high32(&hostdata->req);
+
+
+ hostdata->adapter_state = AS_LOOP_DOWN;
+ hostdata->host_id = hosts;
- if (isp2100_init(host) || isp2100_reset_hardware(host)) {
- scsi_unregister(host);
- continue;
- }
- host->this_id = 0;
+ if (isp2x00_init(host) || isp2x00_reset_hardware(host)) {
+ scsi_unregister(host);
+ continue;
+ }
+ host->this_id = 0;
- if (request_irq(host->irq, do_isp2100_intr_handler, SA_INTERRUPT | SA_SHIRQ, "qlogicfc", host)) {
- printk("qlogicfc%d : interrupt %d already in use\n",
- hostdata->host_id, host->irq);
- scsi_unregister(host);
- continue;
- }
- if (check_region(host->io_port, 0xff)) {
- printk("qlogicfc%d : i/o region 0x%lx-0x%lx already "
- "in use\n",
- hostdata->host_id, host->io_port, host->io_port + 0xff);
- free_irq(host->irq, host);
- scsi_unregister(host);
- continue;
- }
- request_region(host->io_port, 0xff, "qlogicfc");
+ if (request_irq(host->irq, do_isp2x00_intr_handler, SA_INTERRUPT | SA_SHIRQ, "qlogicfc", host)) {
+ printk("qlogicfc%d : interrupt %d already in use\n",
+ hostdata->host_id, host->irq);
+ scsi_unregister(host);
+ continue;
+ }
+ if (check_region(host->io_port, 0xff)) {
+ printk("qlogicfc%d : i/o region 0x%lx-0x%lx already "
+ "in use\n",
+ hostdata->host_id, host->io_port, host->io_port + 0xff);
+ free_irq(host->irq, host);
+ scsi_unregister(host);
+ continue;
+ }
+ request_region(host->io_port, 0xff, "qlogicfc");
- outw(0x0, host->io_port + PCI_SEMAPHORE);
- outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
- isp2100_enable_irqs(host);
- /* wait for the loop to come up */
- for (wait_time = jiffies + 10 * HZ; wait_time > jiffies && hostdata->adapter_state == AS_LOOP_DOWN;)
- barrier();
+ outw(0x0, host->io_port + PCI_SEMAPHORE);
+ outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
+ isp2x00_enable_irqs(host);
+ /* wait for the loop to come up */
+ for (wait_time = jiffies + 10 * HZ; wait_time > jiffies && hostdata->adapter_state == AS_LOOP_DOWN;)
+ barrier();
- if (hostdata->adapter_state == AS_LOOP_DOWN) {
- printk("qlogicfc%d : loop is not up\n", hostdata->host_id);
+ if (hostdata->adapter_state == AS_LOOP_DOWN) {
+ printk("qlogicfc%d : link is not up\n", hostdata->host_id);
+ }
+ hosts++;
}
- hosts++;
}
- /* this busy loop should not be needed but the isp2100 seems to need
+ /* this busy loop should not be needed but the isp2x00 seems to need
some time before recognizing it is attached to a fabric */
-#if ISP2100_FABRIC
+#if ISP2x00_FABRIC
for (wait_time = jiffies + 5 * HZ; wait_time > jiffies;)
barrier();
#endif
- LEAVE("isp2100_detect");
+ LEAVE("isp2x00_detect");
return hosts;
}
-static int isp2100_make_portdb(struct Scsi_Host *host)
+static int isp2x00_make_portdb(struct Scsi_Host *host)
{
short param[8];
int i, j;
struct id_name_map temp[QLOGICFC_MAX_ID + 1];
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
- isp2100_disable_irqs(host);
+ isp2x00_disable_irqs(host);
memset(temp, 0, sizeof(temp));
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
-#if ISP2100_FABRIC
+#if ISP2x00_FABRIC
for (i = 0x81; i < QLOGICFC_MAX_ID; i++) {
param[0] = MBOX_PORT_LOGOUT;
param[1] = i << 8;
param[2] = 0;
param[3] = 0;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
- printk("qlogicfc%d : logout failed %x %x\n", hostdata->host_id, i, param[0]);
+
+ DEBUG_FABRIC(printk("qlogicfc%d : logout failed %x %x\n", hostdata->host_id, i, param[0]));
}
}
#endif
@@ -845,7 +857,7 @@
param[0] = MBOX_GET_INIT_SCSI_ID;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] == MBOX_COMMAND_COMPLETE) {
hostdata->port_id = ((u_int) param[3]) << 16;
@@ -864,7 +876,7 @@
param[0] = MBOX_GET_PORT_NAME;
param[1] = (i << 8) & 0xff00;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] == MBOX_COMMAND_COMPLETE) {
temp[j].loop_id = i;
@@ -883,8 +895,8 @@
}
-#if ISP2100_FABRIC
- isp2100_init_fabric(host, temp, j);
+#if ISP2x00_FABRIC
+ isp2x00_init_fabric(host, temp, j);
#endif
for (i = 0; i <= QLOGICFC_MAX_ID; i++) {
@@ -914,19 +926,19 @@
}
- isp2100_enable_irqs(host);
+ isp2x00_enable_irqs(host);
return 0;
}
-#if ISP2100_FABRIC
+#if ISP2x00_FABRIC
#define FABRIC_PORT 0x7e
#define FABRIC_CONTROLLER 0x7f
#define FABRIC_SNS 0x80
-int isp2100_init_fabric(struct Scsi_Host *host, struct id_name_map *port_db, int cur_scsi_id)
+int isp2x00_init_fabric(struct Scsi_Host *host, struct id_name_map *port_db, int cur_scsi_id)
{
u_short param[8];
@@ -937,15 +949,15 @@
u_int port_id;
struct sns_cb req;
u_char sns_response[608];
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
DEBUG_FABRIC(printk("qlogicfc%d : Checking for a fabric.\n", hostdata->host_id));
param[0] = MBOX_GET_PORT_NAME;
param[1] = (u16)FABRIC_PORT << 8;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
DEBUG_FABRIC(printk("qlogicfc%d : fabric check result %x\n", hostdata->host_id, param[0]));
@@ -973,7 +985,7 @@
param[6] = virt_to_bus_high32(&req) >> 16;
param[7] = virt_to_bus_high32(&req);
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE)
printk("qlogicfc%d : error sending RFC-4\n", hostdata->host_id);
@@ -999,7 +1011,7 @@
param[6] = virt_to_bus_high32(&req) >> 16;
param[7] = virt_to_bus_high32(&req);
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] == MBOX_COMMAND_COMPLETE) {
DEBUG_FABRIC(printk("qlogicfc%d : found node %02x%02x%02x%02x%02x%02x%02x%02x ", hostdata->host_id, sns_response[20], sns_response[21], sns_response[22], sns_response[23], sns_response[24], sns_response[25], sns_response[26], sns_response[27]));
@@ -1022,7 +1034,7 @@
param[2] = (u_short) (port_id >> 16);
param[3] = (u_short) (port_id);
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] == MBOX_COMMAND_COMPLETE) {
port_db[scsi_id].wwn = wwn;
@@ -1032,6 +1044,13 @@
} else {
printk("qlogicfc%d : Error performing port login %x\n", hostdata->host_id, param[0]);
DEBUG_FABRIC(printk("qlogicfc%d : loop_id: %x\n", hostdata->host_id, loop_id));
+ param[0] = MBOX_PORT_LOGOUT;
+ param[1] = loop_id << 8;
+ param[2] = 0;
+ param[3] = 0;
+
+ isp2x00_mbox_command(host, param);
+
}
}
@@ -1046,42 +1065,42 @@
return 1;
}
-#endif /* ISP2100_FABRIC */
+#endif /* ISP2x00_FABRIC */
-int isp2100_release(struct Scsi_Host *host)
+int isp2x00_release(struct Scsi_Host *host)
{
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
- ENTER("isp2100_release");
+ ENTER("isp2x00_release");
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
outw(0x0, host->io_port + PCI_INTER_CTL);
free_irq(host->irq, host);
release_region(host->io_port, 0xff);
- LEAVE("isp2100_release");
+ LEAVE("isp2x00_release");
return 0;
}
-const char *isp2100_info(struct Scsi_Host *host)
+const char *isp2x00_info(struct Scsi_Host *host)
{
static char buf[80];
- struct isp2100_hostdata *hostdata;
- ENTER("isp2100_info");
+ struct isp2x00_hostdata *hostdata;
+ ENTER("isp2x00_info");
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
sprintf(buf,
- "QLogic ISP2100 SCSI on PCI bus %02x device %02x irq %d base 0x%lx",
- hostdata->pci_dev->bus->number, hostdata->pci_dev->devfn, host->irq,
+ "QLogic ISP%04x SCSI on PCI bus %02x device %02x irq %d base 0x%lx",
+ hostdata->pci_dev->device, hostdata->pci_dev->bus->number, hostdata->pci_dev->devfn, host->irq,
host->io_port);
- LEAVE("isp2100_info");
+ LEAVE("isp2x00_info");
return buf;
}
@@ -1093,7 +1112,7 @@
* interrupt handler may call this routine as part of
* request-completion handling).
*/
-int isp2100_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
+int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
{
int i, sg_count, n, num_free;
u_int in_ptr, out_ptr;
@@ -1102,19 +1121,19 @@
struct Command_Entry *cmd;
struct Continuation_Entry *cont;
struct Scsi_Host *host;
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
- ENTER("isp2100_queuecommand");
+ ENTER("isp2x00_queuecommand");
host = Cmnd->host;
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
Cmnd->scsi_done = done;
- DEBUG(isp2100_print_scsi_cmd(Cmnd));
+ DEBUG(isp2x00_print_scsi_cmd(Cmnd));
if (hostdata->adapter_state == AS_REDO_PORTDB) {
hostdata->adapter_state = AS_LOOP_GOOD;
- isp2100_make_portdb(host);
+ isp2x00_make_portdb(host);
printk("qlogicfc%d : Port Database\n", hostdata->host_id);
for (i = 0; hostdata->port_db[i].wwn != 0; i++) {
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);
@@ -1186,7 +1205,8 @@
cmd->hdr.entry_type = ENTRY_COMMAND;
cmd->hdr.entry_cnt = 1;
cmd->target_lun = Cmnd->lun;
-#if ISP2100_PORTDB
+ cmd->expanded_lun = Cmnd->lun;
+#if ISP2x00_PORTDB
cmd->target_id = hostdata->port_db[Cmnd->target].loop_id;
#else
cmd->target_id = Cmnd->target;
@@ -1307,7 +1327,7 @@
host->can_queue = host->host_busy + 1;
}
- LEAVE("isp2100_queuecommand");
+ LEAVE("isp2x00_queuecommand");
return 0;
}
@@ -1316,27 +1336,27 @@
#define ASYNC_EVENT_INTERRUPT 0x01
-void do_isp2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
+void do_isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned long flags;
spin_lock_irqsave(&io_request_lock, flags);
- isp2100_intr_handler(irq, dev_id, regs);
+ isp2x00_intr_handler(irq, dev_id, regs);
spin_unlock_irqrestore(&io_request_lock, flags);
}
-void isp2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
+void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
{
Scsi_Cmnd *Cmnd;
struct Status_Entry *sts;
struct Scsi_Host *host = dev_id;
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
u_int in_ptr, out_ptr, handle, num_free;
u_short status;
- ENTER_INTR("isp2100_intr_handler");
+ ENTER_INTR("isp2x00_intr_handler");
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
DEBUG_INTR(printk("qlogicfc%d : interrupt on line %d\n", hostdata->host_id, irq));
@@ -1356,13 +1376,17 @@
switch (status) {
case LOOP_UP:
- printk("qlogicfc%d : loop is up\n", hostdata->host_id);
+ case POINT_TO_POINT_UP:
+ printk("qlogicfc%d : link is up\n", hostdata->host_id);
hostdata->adapter_state = AS_REDO_PORTDB;
break;
case LOOP_DOWN:
- printk("qlogicfc%d : loop is down\n", hostdata->host_id);
+ printk("qlogicfc%d : link is down\n", hostdata->host_id);
hostdata->adapter_state = AS_LOOP_DOWN;
break;
+ case CONNECTION_MODE:
+ printk("received CONNECTION_MODE irq %x\n", inw(host->io_port + MBOX1));
+ break;
case LIP_OCCURED:
case CHANGE_NOTIFICATION:
case PORT_DB_CHANGED:
@@ -1411,9 +1435,9 @@
out_ptr = (out_ptr + 1) & RES_QUEUE_LEN;
TRACE("done", out_ptr, Cmnd);
- DEBUG_INTR(isp2100_print_status_entry(sts));
+ DEBUG_INTR(isp2x00_print_status_entry(sts));
if (sts->hdr.entry_type == ENTRY_STATUS && (Cmnd = hostdata->handle_ptrs[sts->handle])) {
- Cmnd->result = isp2100_return_status(sts);
+ Cmnd->result = isp2x00_return_status(sts);
hostdata->handle_ptrs[sts->handle] = NULL;
hostdata->queued--;
@@ -1431,7 +1455,7 @@
}
/*
* if we get back an error indicating the port
- * is not there or if the loop is down and
+ * is not there or if the link is down and
* this is a device that used to be there
* allow the command to timeout.
* the device may well be back in a couple of
@@ -1483,14 +1507,14 @@
}
outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
- LEAVE_INTR("isp2100_intr_handler");
+ LEAVE_INTR("isp2x00_intr_handler");
}
-static int isp2100_return_status(struct Status_Entry *sts)
+static int isp2x00_return_status(struct Status_Entry *sts)
{
int host_status = DID_ERROR;
-#if DEBUG_ISP2100_INTR
+#if DEBUG_ISP2x00_INTR
static char *reason[] =
{
"DID_OK",
@@ -1504,9 +1528,9 @@
"DID_RESET",
"DID_BAD_INTR"
};
-#endif /* DEBUG_ISP2100_INTR */
+#endif /* DEBUG_ISP2x00_INTR */
- ENTER("isp2100_return_status");
+ ENTER("isp2x00_return_status");
DEBUG(printk("qlogicfc : completion status = 0x%04x\n",
sts->completion_status));
@@ -1551,24 +1575,24 @@
DEBUG_INTR(printk("qlogicfc : host status (%s) scsi status %x\n",
reason[host_status], sts->scsi_status));
- LEAVE("isp2100_return_status");
+ LEAVE("isp2x00_return_status");
return (sts->scsi_status & STATUS_MASK) | (host_status << 16);
}
-int isp2100_abort(Scsi_Cmnd * Cmnd)
+int isp2x00_abort(Scsi_Cmnd * Cmnd)
{
u_short param[8];
int i;
struct Scsi_Host *host;
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
int return_status = SUCCESS;
- ENTER("isp2100_abort");
+ ENTER("isp2x00_abort");
host = Cmnd->host;
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
for (i = 0; i < QLOGICFC_REQ_QUEUE_LEN; i++)
if (hostdata->handle_ptrs[i] == Cmnd)
@@ -1578,10 +1602,10 @@
return SUCCESS;
}
- isp2100_disable_irqs(host);
+ isp2x00_disable_irqs(host);
param[0] = MBOX_ABORT_IOCB;
-#if ISP2100_PORTDB
+#if ISP2x00_PORTDB
param[1] = (((u_short) hostdata->port_db[Cmnd->target].loop_id) << 8) | Cmnd->lun;
#else
param[1] = (((u_short) Cmnd->target) << 8) | Cmnd->lun;
@@ -1589,7 +1613,7 @@
param[2] = i & 0xffff;
param[3] = i >> 16;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
printk("qlogicfc%d : scsi abort failure: %x\n", hostdata->host_id, param[0]);
@@ -1602,54 +1626,54 @@
if (return_status != SUCCESS){
param[0] = MBOX_GET_FIRMWARE_STATE;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
printk("qlogicfc%d : abort failed\n", hostdata->host_id);
printk("qlogicfc%d : firmware status is %x %x\n", hostdata->host_id, param[0], param[1]);
}
- isp2100_enable_irqs(host);
+ isp2x00_enable_irqs(host);
- LEAVE("isp2100_abort");
+ LEAVE("isp2x00_abort");
return return_status;
}
-int isp2100_reset(Scsi_Cmnd * Cmnd, unsigned int reset_flags)
+int isp2x00_reset(Scsi_Cmnd * Cmnd, unsigned int reset_flags)
{
u_short param[8];
struct Scsi_Host *host;
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
int return_status = SCSI_RESET_SUCCESS;
- ENTER("isp2100_reset");
+ ENTER("isp2x00_reset");
host = Cmnd->host;
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
param[0] = MBOX_BUS_RESET;
param[1] = 3;
- isp2100_disable_irqs(host);
+ isp2x00_disable_irqs(host);
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
printk("qlogicfc%d : scsi bus reset failure: %x\n", hostdata->host_id, param[0]);
return_status = SCSI_RESET_ERROR;
}
- isp2100_enable_irqs(host);
+ isp2x00_enable_irqs(host);
- LEAVE("isp2100_reset");
+ LEAVE("isp2x00_reset");
return return_status;;
}
-int isp2100_biosparam(Disk * disk, kdev_t n, int ip[])
+int isp2x00_biosparam(Disk * disk, kdev_t n, int ip[])
{
int size = disk->capacity;
- ENTER("isp2100_biosparam");
+ ENTER("isp2x00_biosparam");
ip[0] = 64;
ip[1] = 32;
@@ -1659,21 +1683,21 @@
ip[1] = 63;
ip[2] = size / (ip[0] * ip[1]);
}
- LEAVE("isp2100_biosparam");
+ LEAVE("isp2x00_biosparam");
return 0;
}
-static int isp2100_reset_hardware(struct Scsi_Host *host)
+static int isp2x00_reset_hardware(struct Scsi_Host *host)
{
u_short param[8];
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
int loop_count;
- ENTER("isp2100_reset_hardware");
+ ENTER("isp2x00_reset_hardware");
- hostdata = (struct isp2100_hostdata *) host->hostdata;
+ hostdata = (struct isp2x00_hostdata *) host->hostdata;
outw(0x01, host->io_port + ISP_CTRL_STATUS);
outw(HCCR_RESET, host->io_port + HOST_HCCR);
@@ -1688,7 +1712,7 @@
-#if DEBUG_ISP2100
+#if DEBUG_ISP2x00
printk("qlogicfc%d : mbox 0 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX0));
printk("qlogicfc%d : mbox 1 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX1));
printk("qlogicfc%d : mbox 2 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX2));
@@ -1697,19 +1721,30 @@
printk("qlogicfc%d : mbox 5 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX5));
printk("qlogicfc%d : mbox 6 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX6));
printk("qlogicfc%d : mbox 7 0x%04x \n", hostdata->host_id, inw(host->io_port + MBOX7));
-#endif /* DEBUG_ISP2100 */
+#endif /* DEBUG_ISP2x00 */
DEBUG(printk("qlogicfc%d : verifying checksum\n", hostdata->host_id));
#if RELOAD_FIRMWARE
{
int i;
- for (i = 0; i < risc_code_length01; i++) {
+ unsigned short * risc_code = NULL;
+ unsigned short risc_code_len = 0;
+ if (hostdata->pci_dev->device == PCI_DEVICE_ID_QLOGIC_ISP2100){
+ risc_code = risc_code2100;
+ risc_code_len = risc_code_length2100;
+ }
+ else if (hostdata->pci_dev->device == PCI_DEVICE_ID_QLOGIC_ISP2200){
+ risc_code = risc_code2200;
+ risc_code_len = risc_code_length2200;
+ }
+
+ for (i = 0; i < risc_code_len; i++) {
param[0] = MBOX_WRITE_RAM_WORD;
param[1] = risc_code_addr01 + i;
- param[2] = risc_code01[i];
+ param[2] = risc_code[i];
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
printk("qlogicfc%d : firmware load failure\n", hostdata->host_id);
@@ -1722,7 +1757,7 @@
param[0] = MBOX_VERIFY_CHECKSUM;
param[1] = risc_code_addr01;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
printk("qlogicfc%d : ram checksum failure\n", hostdata->host_id);
@@ -1733,11 +1768,11 @@
param[0] = MBOX_EXEC_FIRMWARE;
param[1] = risc_code_addr01;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
param[0] = MBOX_ABOUT_FIRMWARE;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
printk("qlogicfc%d : about firmware failure\n", hostdata->host_id);
@@ -1748,7 +1783,7 @@
#ifdef USE_NVRAM_DEFAULTS
- if (isp2100_get_nvram_defaults(host, &hostdata->control_block) != 0) {
+ if (isp2x00_get_nvram_defaults(host, &hostdata->control_block) != 0) {
printk("qlogicfc%d : Could not read from NVRAM\n", hostdata->host_id);
}
#endif
@@ -1769,38 +1804,38 @@
param[5] = 0;
param[6] = (u_short) (virt_to_bus_high32(&hostdata->control_block) >> 16);
param[7] = (u_short) (virt_to_bus_high32(&hostdata->control_block) & 0xffff);
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
printk("qlogicfc%d.c: Ouch 0x%04x\n", hostdata->host_id, param[0]);
return 1;
}
param[0] = MBOX_GET_FIRMWARE_STATE;
- isp2100_mbox_command(host, param);
+ isp2x00_mbox_command(host, param);
if (param[0] != MBOX_COMMAND_COMPLETE) {
printk("qlogicfc%d.c: 0x%04x\n", hostdata->host_id, param[0]);
return 1;
}
- LEAVE("isp2100_reset_hardware");
+ LEAVE("isp2x00_reset_hardware");
return 0;
}
#ifdef USE_NVRAM_DEFAULTS
-static int isp2100_get_nvram_defaults(struct Scsi_Host *host, struct init_cb *control_block)
+static int isp2x00_get_nvram_defaults(struct Scsi_Host *host, struct init_cb *control_block)
{
u_short value;
- if (isp2100_read_nvram_word(host, 0) != 0x5349)
+ if (isp2x00_read_nvram_word(host, 0) != 0x5349)
return 1;
- value = isp2100_read_nvram_word(host, 8);
- control_block->node_name[0] = isp2100_read_nvram_word(host, 9);
- control_block->node_name[1] = isp2100_read_nvram_word(host, 10);
- control_block->node_name[2] = isp2100_read_nvram_word(host, 11);
- control_block->node_name[3] = isp2100_read_nvram_word(host, 12);
- control_block->hard_addr = isp2100_read_nvram_word(host, 13);
+ value = isp2x00_read_nvram_word(host, 8);
+ control_block->node_name[0] = isp2x00_read_nvram_word(host, 9);
+ control_block->node_name[1] = isp2x00_read_nvram_word(host, 10);
+ control_block->node_name[2] = isp2x00_read_nvram_word(host, 11);
+ control_block->node_name[3] = isp2x00_read_nvram_word(host, 12);
+ control_block->hard_addr = isp2x00_read_nvram_word(host, 13);
return 0;
@@ -1808,19 +1843,19 @@
#endif
-static int isp2100_init(struct Scsi_Host *sh)
+static int isp2x00_init(struct Scsi_Host *sh)
{
u_int io_base;
- struct isp2100_hostdata *hostdata;
+ struct isp2x00_hostdata *hostdata;
u_char revision;
u_int irq;
u_short command;
struct pci_dev *pdev;
- ENTER("isp2100_init");
+ ENTER("isp2x00_init");
- hostdata = (struct isp2100_hostdata *) sh->hostdata;
+ hostdata = (struct isp2x00_hostdata *) sh->hostdata;
pdev = hostdata->pci_dev;
if (pci_read_config_word(pdev, PCI_COMMAND, &command)
@@ -1832,14 +1867,13 @@
irq = pdev->irq;
-
if (pdev->vendor != PCI_VENDOR_ID_QLOGIC) {
printk("qlogicfc%d : 0x%04x is not QLogic vendor ID\n", hostdata->host_id,
pdev->vendor);
return 1;
}
- if (pdev->device != PCI_DEVICE_ID_QLOGIC_ISP2100) {
- printk("qlogicfc%d : 0x%04x does not match ISP2100 device id\n", hostdata->host_id,
+ if (pdev->device != PCI_DEVICE_ID_QLOGIC_ISP2100 && pdev->device != PCI_DEVICE_ID_QLOGIC_ISP2200) {
+ printk("qlogicfc%d : 0x%04x does not match ISP2100 or ISP2200 device id\n", hostdata->host_id,
pdev->device);
return 1;
}
@@ -1854,8 +1888,8 @@
printk("qlogicfc%d : bus mastering is disabled\n", hostdata->host_id);
return 1;
}
- if (revision != ISP2100_REV_ID && revision != ISP2100_REV_ID3)
- printk("qlogicfc%d : new isp2100 revision ID (%d)\n", hostdata->host_id, revision);
+ if (revision != ISP2100_REV_ID1 && revision != ISP2100_REV_ID3 && revision != ISP2200_REV_ID5)
+ printk("qlogicfc%d : new isp2x00 revision ID (%d)\n", hostdata->host_id, revision);
hostdata->revision = revision;
@@ -1863,7 +1897,7 @@
sh->irq = irq;
sh->io_port = io_base;
- LEAVE("isp2100_init");
+ LEAVE("isp2x00_init");
return 0;
}
@@ -1873,7 +1907,7 @@
#define NVRAM_DELAY() udelay(10) /* 10 microsecond delay */
-u_short isp2100_read_nvram_word(struct Scsi_Host * host, u_short byte)
+u_short isp2x00_read_nvram_word(struct Scsi_Host * host, u_short byte)
{
int i;
u_short value, output, input;
@@ -1922,10 +1956,10 @@
* currently, this is only called during initialization or abort/reset,
* at which times interrupts are disabled, so polling is OK, I guess...
*/
-static int isp2100_mbox_command(struct Scsi_Host *host, u_short param[])
+static int isp2x00_mbox_command(struct Scsi_Host *host, u_short param[])
{
int loop_count;
- struct isp2100_hostdata *hostdata = (struct isp2100_hostdata *) host->hostdata;
+ struct isp2x00_hostdata *hostdata = (struct isp2x00_hostdata *) host->hostdata;
if (mbox_param[param[0]] == 0 || hostdata->adapter_state == AS_FIRMWARE_DEAD)
return 1;
@@ -1975,7 +2009,7 @@
printk("qlogicfc%d : mbox_command loop timeout #2\n", hostdata->host_id);
break;
}
- isp2100_intr_handler(host->irq, host, NULL);
+ isp2x00_intr_handler(host->irq, host, NULL);
if (hostdata->mbox_done == 1)
break;
@@ -2008,9 +2042,9 @@
return 0;
}
-#if DEBUG_ISP2100_INTR
+#if DEBUG_ISP2x00_INTR
-void isp2100_print_status_entry(struct Status_Entry *status)
+void isp2x00_print_status_entry(struct Status_Entry *status)
{
printk("qlogicfc : entry count = 0x%02x, type = 0x%02x, flags = 0x%02x\n",
status->hdr.entry_cnt, status->hdr.entry_type, status->hdr.flags);
@@ -2024,12 +2058,12 @@
}
-#endif /* DEBUG_ISP2100_INTR */
+#endif /* DEBUG_ISP2x00_INTR */
-#if DEBUG_ISP2100
+#if DEBUG_ISP2x00
-void isp2100_print_scsi_cmd(Scsi_Cmnd * cmd)
+void isp2x00_print_scsi_cmd(Scsi_Cmnd * cmd)
{
int i;
@@ -2041,7 +2075,7 @@
printk("\n");
}
-#endif /* DEBUG_ISP2100 */
+#endif /* DEBUG_ISP2x00 */
#ifdef MODULE
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)