Commit 36ce46ce authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

Update qla2xxx to 8.00.00b9

From:         Andrew Vasquez <praka@users.sourceforge.net>
http://sourceforge.net/projects/linux-qla2xxx/
parent e5c7546b
...@@ -3,27 +3,21 @@ config SCSI_QLA2XXX_CONFIG ...@@ -3,27 +3,21 @@ config SCSI_QLA2XXX_CONFIG
default (SCSI && PCI) default (SCSI && PCI)
depends on SCSI && PCI depends on SCSI && PCI
config SCSI_QLA2XXX
tristate
config SCSI_QLA21XX config SCSI_QLA21XX
tristate "Qlogic ISP2100 host adapter family support" tristate "QLogic ISP2100 host adapter family support"
select SCSI_QLA2XXX
depends on SCSI_QLA2XXX_CONFIG depends on SCSI_QLA2XXX_CONFIG
---help--- ---help---
This driver supports the QLogic 21xx (ISP2100) host adapter family. This driver supports the QLogic 21xx (ISP2100) host adapter family.
config SCSI_QLA22XX config SCSI_QLA22XX
tristate "Qlogic ISP2200 host adapter family support" tristate "QLogic ISP2200 host adapter family support"
select SCSI_QLA2XXX
depends on SCSI_QLA2XXX_CONFIG depends on SCSI_QLA2XXX_CONFIG
---help--- ---help---
This driver supports the QLogic 22xx (ISP2200) host adapter family. This driver supports the QLogic 22xx (ISP2200) host adapter family.
config SCSI_QLA23XX config SCSI_QLA23XX
tristate "Qlogic ISP23xx host adapter family support" tristate "QLogic ISP23xx host adapter family support"
select SCSI_QLA2XXX
depends on SCSI_QLA2XXX_CONFIG depends on SCSI_QLA2XXX_CONFIG
---help--- ---help---
This driver supports the QLogic 23xx (ISP2300, ISP2312, and ISP2322) This driver supports the QLogic 23xx (ISP2300, ISP2312, ISP2322,
host adapter family. ISP6312 and ISP6322) host adapter family.
EXTRA_CFLAGS += -g -Idrivers/scsi -DUNIQUE_FW_NAME EXTRA_CFLAGS += -Idrivers/scsi -DUNIQUE_FW_NAME
qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
qla_dbg.o qla_sup.o qla_rscn.o qla_dbg.o qla_sup.o qla_rscn.o
qla2100-y := ql2100.o ql2100_fw.o qla2100-y := ql2100.o ql2100_fw.o
qla2200-y := ql2200.o ql2200_fw.o qla2200-y := ql2200.o ql2200_fw.o
qla2300-y := ql2300.o ql2300_fw.o #ql2322_fw.o qla2300-y := ql2300.o ql2300_fw.o ql2322_fw.o ql6312_fw.o ql6322_fw.o
obj-$(CONFIG_SCSI_QLA21XX) += qla2xxx.o qla2100.o obj-$(CONFIG_SCSI_QLA21XX) += qla2xxx.o qla2100.o
obj-$(CONFIG_SCSI_QLA22XX) += qla2xxx.o qla2200.o obj-$(CONFIG_SCSI_QLA22XX) += qla2xxx.o qla2200.o
......
...@@ -15,80 +15,131 @@ ...@@ -15,80 +15,131 @@
static char qla_driver_name[] = "qla2300"; static char qla_driver_name[] = "qla2300";
extern unsigned char fw2300tpx_version[]; /* 2300/2310/2312 Firmware. */
extern unsigned char fw2300tpx_version_str[]; extern unsigned char fw2300ipx_version[];
extern unsigned short fw2300tpx_addr01; extern unsigned char fw2300ipx_version_str[];
extern unsigned short fw2300tpx_code01[]; extern unsigned short fw2300ipx_addr01;
extern unsigned short fw2300tpx_length01; extern unsigned short fw2300ipx_code01[];
extern unsigned short fw2300ipx_length01;
extern unsigned char fw2322tpx_version[]; /* 2322 Firmware. */
extern unsigned char fw2322tpx_version_str[]; extern unsigned char fw2322ipx_version[];
extern unsigned short fw2322tpx_addr01; extern unsigned char fw2322ipx_version_str[];
extern unsigned short fw2322tpx_code01[]; extern unsigned short fw2322ipx_addr01;
extern unsigned short fw2322tpx_length01; extern unsigned short fw2322ipx_code01[];
extern unsigned long rseqtpx_code_addr01; extern unsigned short fw2322ipx_length01;
extern unsigned short rseqtpx_code01[]; extern unsigned long rseqipx_code_addr01;
extern unsigned short rseqtpx_code_length01; extern unsigned short rseqipx_code01[];
extern unsigned long xseqtpx_code_addr01; extern unsigned short rseqipx_code_length01;
extern unsigned short xseqtpx_code01[]; extern unsigned long xseqipx_code_addr01;
extern unsigned short xseqtpx_code_length01; extern unsigned short xseqipx_code01[];
extern unsigned short xseqipx_code_length01;
/* 6312 Firmware. */
extern unsigned char fw2300flx_version[];
extern unsigned char fw2300flx_version_str[];
extern unsigned short fw2300flx_addr01;
extern unsigned short fw2300flx_code01[];
extern unsigned short fw2300flx_length01;
/* 6322 Firmware. */
extern unsigned char fw2322flx_version[];
extern unsigned char fw2322flx_version_str[];
extern unsigned short fw2322flx_addr01;
extern unsigned short fw2322flx_code01[];
extern unsigned short fw2322flx_length01;
extern unsigned long rseqflx_code_addr01;
extern unsigned short rseqflx_code01[];
extern unsigned short rseqflx_code_length01;
extern unsigned long xseqflx_code_addr01;
extern unsigned short xseqflx_code01[];
extern unsigned short xseqflx_code_length01;
static struct qla_fw_info qla_fw_tbl[] = { static struct qla_fw_info qla_fw_tbl[] = {
/* Start of 23xx firmware list */
{ {
.addressing = FW_INFO_ADDR_NORMAL, .addressing = FW_INFO_ADDR_NORMAL,
.fwcode = &fw2300tpx_code01[0], .fwcode = &fw2300ipx_code01[0],
.fwlen = &fw2300tpx_length01, .fwlen = &fw2300ipx_length01,
.fwstart = &fw2300tpx_addr01, .fwstart = &fw2300ipx_addr01,
}, },
#if defined(ISP2322)
/* End of 23xx firmware list */
{ FW_INFO_ADDR_NOMORE, }, { FW_INFO_ADDR_NOMORE, },
/* Start of 232x firmware list */ /* Start of 232x firmware list */
{ {
.addressing = FW_INFO_ADDR_NORMAL, .addressing = FW_INFO_ADDR_NORMAL,
.fwcode = &fw2322tpx_code01[0], .fwcode = &fw2322ipx_code01[0],
.fwlen = &fw2322tpx_length01, .fwlen = &fw2322ipx_length01,
.fwstart = &fw2322tpx_addr01, .fwstart = &fw2322ipx_addr01,
}, },
{ {
.addressing = FW_INFO_ADDR_EXTENDED, .addressing = FW_INFO_ADDR_EXTENDED,
.fwcode = &rseqtpx_code01[0], .fwcode = &rseqipx_code01[0],
.fwlen = &rseqtpx_code_length01, .fwlen = &rseqipx_code_length01,
.lfwstart = &rseqtpx_code_addr01, .lfwstart = &rseqipx_code_addr01,
}, },
{ {
.addressing = FW_INFO_ADDR_EXTENDED, .addressing = FW_INFO_ADDR_EXTENDED,
.fwcode = &xseqtpx_code01[0], .fwcode = &xseqipx_code01[0],
.fwlen = &xseqtpx_code_length01, .fwlen = &xseqipx_code_length01,
.lfwstart = &xseqtpx_code_addr01, .lfwstart = &xseqipx_code_addr01,
},
{ FW_INFO_ADDR_NOMORE, },
/* Start of 631x firmware list */
{
.addressing = FW_INFO_ADDR_NORMAL,
.fwcode = &fw2300flx_code01[0],
.fwlen = &fw2300flx_length01,
.fwstart = &fw2300flx_addr01,
},
{ FW_INFO_ADDR_NOMORE, },
/* Start of 632x firmware list */
{
.addressing = FW_INFO_ADDR_NORMAL,
.fwcode = &fw2322flx_code01[0],
.fwlen = &fw2322flx_length01,
.fwstart = &fw2322flx_addr01,
},
{
.addressing = FW_INFO_ADDR_EXTENDED,
.fwcode = &rseqflx_code01[0],
.fwlen = &rseqflx_code_length01,
.lfwstart = &rseqflx_code_addr01,
},
{
.addressing = FW_INFO_ADDR_EXTENDED,
.fwcode = &xseqflx_code01[0],
.fwlen = &xseqflx_code_length01,
.lfwstart = &xseqflx_code_addr01,
}, },
#endif
{ FW_INFO_ADDR_NOMORE, }, { FW_INFO_ADDR_NOMORE, },
}; };
static struct qla_board_info qla_board_tbl[] = { static struct qla_board_info qla_board_tbl[] = {
{ {
.drv_name = qla_driver_name, .drv_name = qla_driver_name,
.isp_name = "ISP2300", .isp_name = "ISP2300",
.fw_info = qla_fw_tbl, .fw_info = qla_fw_tbl,
}, },
{ {
.drv_name = qla_driver_name, .drv_name = qla_driver_name,
.isp_name = "ISP2312", .isp_name = "ISP2312",
.fw_info = qla_fw_tbl, .fw_info = qla_fw_tbl,
}, },
#if defined(ISP2322)
{ {
.drv_name = qla_driver_name, .drv_name = qla_driver_name,
.isp_name = "ISP2322", .isp_name = "ISP2322",
.fw_info = &qla_fw_tbl[2], .fw_info = &qla_fw_tbl[2],
}, },
#endif {
.drv_name = qla_driver_name,
.isp_name = "ISP6312",
.fw_info = &qla_fw_tbl[6],
},
{
.drv_name = qla_driver_name,
.isp_name = "ISP6322",
.fw_info = &qla_fw_tbl[8],
},
}; };
static struct pci_device_id qla2300_pci_tbl[] = { static struct pci_device_id qla2300_pci_tbl[] = {
...@@ -99,7 +150,6 @@ static struct pci_device_id qla2300_pci_tbl[] = { ...@@ -99,7 +150,6 @@ static struct pci_device_id qla2300_pci_tbl[] = {
.subdevice = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[0], .driver_data = (unsigned long)&qla_board_tbl[0],
}, },
{ {
.vendor = PCI_VENDOR_ID_QLOGIC, .vendor = PCI_VENDOR_ID_QLOGIC,
.device = PCI_DEVICE_ID_QLOGIC_ISP2312, .device = PCI_DEVICE_ID_QLOGIC_ISP2312,
...@@ -107,8 +157,6 @@ static struct pci_device_id qla2300_pci_tbl[] = { ...@@ -107,8 +157,6 @@ static struct pci_device_id qla2300_pci_tbl[] = {
.subdevice = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[1], .driver_data = (unsigned long)&qla_board_tbl[1],
}, },
#if defined(ISP2322)
{ {
.vendor = PCI_VENDOR_ID_QLOGIC, .vendor = PCI_VENDOR_ID_QLOGIC,
.device = PCI_DEVICE_ID_QLOGIC_ISP2322, .device = PCI_DEVICE_ID_QLOGIC_ISP2322,
...@@ -116,7 +164,20 @@ static struct pci_device_id qla2300_pci_tbl[] = { ...@@ -116,7 +164,20 @@ static struct pci_device_id qla2300_pci_tbl[] = {
.subdevice = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[2], .driver_data = (unsigned long)&qla_board_tbl[2],
}, },
#endif {
.vendor = PCI_VENDOR_ID_QLOGIC,
.device = PCI_DEVICE_ID_QLOGIC_ISP6312,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[3],
},
{
.vendor = PCI_VENDOR_ID_QLOGIC,
.device = PCI_DEVICE_ID_QLOGIC_ISP6322,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
.driver_data = (unsigned long)&qla_board_tbl[4],
},
{0, 0}, {0, 0},
}; };
MODULE_DEVICE_TABLE(pci, qla2300_pci_tbl); MODULE_DEVICE_TABLE(pci, qla2300_pci_tbl);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -73,7 +73,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) ...@@ -73,7 +73,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
/* Pause RISC. */ /* Pause RISC. */
WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC); WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
if (!IS_QLA2312(ha) && !IS_QLA2322(ha)) { if (IS_QLA2300(ha)) {
for (cnt = 30000; for (cnt = 30000;
(RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) == 0 && (RD_REG_WORD(&reg->hccr) & HCCR_RISC_PAUSE) == 0 &&
rval == QLA_SUCCESS; cnt--) { rval == QLA_SUCCESS; cnt--) {
...@@ -180,7 +180,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) ...@@ -180,7 +180,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
} }
} }
if (IS_QLA2312(ha) || IS_QLA2322(ha)) { if (!IS_QLA2300(ha)) {
for (cnt = 30000; RD_MAILBOX_REG(ha, reg, 0) != 0 && for (cnt = 30000; RD_MAILBOX_REG(ha, reg, 0) != 0 &&
rval == QLA_SUCCESS; cnt--) { rval == QLA_SUCCESS; cnt--) {
if (cnt) if (cnt)
...@@ -1070,18 +1070,6 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd) ...@@ -1070,18 +1070,6 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
sp->lun_queue->fclun->fcport->cur_path); sp->lun_queue->fclun->fcport->cur_path);
} }
/*
* qla2x00_print_q_info
* Prints queue info
* Input
* q: lun queue
*/
void
qla2x00_print_q_info(struct os_lun *q)
{
printk("Queue info: flags=0x%lx\n", q->q_flag);
}
#if defined(QL_DEBUG_ROUTINES) #if defined(QL_DEBUG_ROUTINES)
/* /*
* qla2x00_formatted_dump_buffer * qla2x00_formatted_dump_buffer
...@@ -1163,67 +1151,4 @@ qla2x00_formatted_dump_buffer(char *string, uint8_t * buffer, ...@@ -1163,67 +1151,4 @@ qla2x00_formatted_dump_buffer(char *string, uint8_t * buffer,
break; break;
} }
} }
#endif
#if STOP_ON_ERROR
/**************************************************************************
* qla2x00_panic
*
**************************************************************************/
static void
qla2x00_panic(char *cp, struct Scsi_Host *host)
{
struct scsi_qla_host *ha;
long *fp;
ha = (struct scsi_qla_host *) host->hostdata;
DEBUG2(ql2x_debug_print = 1;);
printk("qla2100 - PANIC: %s\n", cp);
printk("Current time=0x%lx\n", jiffies);
printk("Number of pending commands =0x%lx\n", ha->actthreads);
printk("Number of queued commands =0x%lx\n", ha->qthreads);
printk("Number of free entries = (%d)\n", ha->req_q_cnt);
printk("Request Queue @ 0x%lx, Response Queue @ 0x%lx\n",
ha->request_dma, ha->response_dma);
printk("Request In Ptr %d\n", ha->req_ring_index);
fp = (long *) &ha->flags;
printk("HA flags =0x%lx\n", *fp);
qla2x00_dump_requests(ha);
qla2x00_dump_regs(ha);
cli();
for (;;) {
udelay(2);
barrier();
/* cpu_relax();*/
}
sti();
}
#endif #endif
/**************************************************************************
* qla2x00_dump_requests
*
**************************************************************************/
void
qla2x00_dump_requests(scsi_qla_host_t *ha)
{
struct scsi_cmnd *cp;
srb_t *sp;
int i;
printk("Outstanding Commands on controller:\n");
for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) {
if ((sp = ha->outstanding_cmds[i]) == NULL)
continue;
if ((cp = sp->cmd) == NULL)
continue;
printk("(%d): Pid=%ld, sp flags=0x%x, cmd=0x%p\n",
i, sp->cmd->serial_number, sp->flags, CMD_SP(sp->cmd));
}
}
...@@ -17,55 +17,6 @@ ...@@ -17,55 +17,6 @@
* *
******************************************************************************/ ******************************************************************************/
/*
* Firmware Dump structure definition
*/
#define FW_DUMP_SIZE 0xBC000 /* bytes */
struct qla2300_fw_dump {
uint16_t hccr;
uint16_t pbiu_reg[8];
uint16_t risc_host_reg[8];
uint16_t mailbox_reg[32];
uint16_t resp_dma_reg[32];
uint16_t dma_reg[48];
uint16_t risc_hdw_reg[16];
uint16_t risc_gp0_reg[16];
uint16_t risc_gp1_reg[16];
uint16_t risc_gp2_reg[16];
uint16_t risc_gp3_reg[16];
uint16_t risc_gp4_reg[16];
uint16_t risc_gp5_reg[16];
uint16_t risc_gp6_reg[16];
uint16_t risc_gp7_reg[16];
uint16_t frame_buf_hdw_reg[64];
uint16_t fpm_b0_reg[64];
uint16_t fpm_b1_reg[64];
uint16_t risc_ram[0xf800];
uint16_t stack_ram[0x1000];
uint16_t data_ram[0xF000];
};
struct qla2100_fw_dump {
uint16_t hccr;
uint16_t pbiu_reg[8];
uint16_t mailbox_reg[32];
uint16_t dma_reg[48];
uint16_t risc_hdw_reg[16];
uint16_t risc_gp0_reg[16];
uint16_t risc_gp1_reg[16];
uint16_t risc_gp2_reg[16];
uint16_t risc_gp3_reg[16];
uint16_t risc_gp4_reg[16];
uint16_t risc_gp5_reg[16];
uint16_t risc_gp6_reg[16];
uint16_t risc_gp7_reg[16];
uint16_t frame_buf_hdw_reg[16];
uint16_t fpm_b0_reg[64];
uint16_t fpm_b1_reg[64];
uint16_t risc_ram[0xf000];
};
/* /*
* Driver debug definitions. * Driver debug definitions.
*/ */
...@@ -227,3 +178,54 @@ struct qla2100_fw_dump { ...@@ -227,3 +178,54 @@ struct qla2100_fw_dump {
#else #else
#define DEBUG14(x) do {} while (0) #define DEBUG14(x) do {} while (0)
#endif #endif
/*
* Firmware Dump structure definition
*/
#define FW_DUMP_SIZE 0xBC000 /* bytes */
struct qla2300_fw_dump {
uint16_t hccr;
uint16_t pbiu_reg[8];
uint16_t risc_host_reg[8];
uint16_t mailbox_reg[32];
uint16_t resp_dma_reg[32];
uint16_t dma_reg[48];
uint16_t risc_hdw_reg[16];
uint16_t risc_gp0_reg[16];
uint16_t risc_gp1_reg[16];
uint16_t risc_gp2_reg[16];
uint16_t risc_gp3_reg[16];
uint16_t risc_gp4_reg[16];
uint16_t risc_gp5_reg[16];
uint16_t risc_gp6_reg[16];
uint16_t risc_gp7_reg[16];
uint16_t frame_buf_hdw_reg[64];
uint16_t fpm_b0_reg[64];
uint16_t fpm_b1_reg[64];
uint16_t risc_ram[0xf800];
uint16_t stack_ram[0x1000];
uint16_t data_ram[0xF000];
};
struct qla2100_fw_dump {
uint16_t hccr;
uint16_t pbiu_reg[8];
uint16_t mailbox_reg[32];
uint16_t dma_reg[48];
uint16_t risc_hdw_reg[16];
uint16_t risc_gp0_reg[16];
uint16_t risc_gp1_reg[16];
uint16_t risc_gp2_reg[16];
uint16_t risc_gp3_reg[16];
uint16_t risc_gp4_reg[16];
uint16_t risc_gp5_reg[16];
uint16_t risc_gp6_reg[16];
uint16_t risc_gp7_reg[16];
uint16_t frame_buf_hdw_reg[16];
uint16_t fpm_b0_reg[64];
uint16_t fpm_b1_reg[64];
uint16_t risc_ram[0xf000];
};
...@@ -33,6 +33,14 @@ ...@@ -33,6 +33,14 @@
#define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322 #define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322
#endif #endif
#ifndef PCI_DEVICE_ID_QLOGIC_ISP6312
#define PCI_DEVICE_ID_QLOGIC_ISP6312 0x6312
#endif
#ifndef PCI_DEVICE_ID_QLOGIC_ISP6322
#define PCI_DEVICE_ID_QLOGIC_ISP6322 0x6322
#endif
#if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE) #if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE)
#define IS_QLA2100(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100) #define IS_QLA2100(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100)
#else #else
...@@ -49,18 +57,23 @@ ...@@ -49,18 +57,23 @@
#define IS_QLA2300(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2300) #define IS_QLA2300(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2300)
#define IS_QLA2312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2312) #define IS_QLA2312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2312)
#define IS_QLA2322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322) #define IS_QLA2322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322)
#define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha)) #define IS_QLA6312(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6312)
#define IS_QLA6322(ha) ((ha)->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6322)
#define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
IS_QLA6312(ha) || IS_QLA6322(ha))
#else #else
#define IS_QLA2300(ha) 0 #define IS_QLA2300(ha) 0
#define IS_QLA2312(ha) 0 #define IS_QLA2312(ha) 0
#define IS_QLA2322(ha) 0 #define IS_QLA2322(ha) 0
#define IS_QLA6312(ha) 0
#define IS_QLA6322(ha) 0
#define IS_QLA23XX(ha) 0 #define IS_QLA23XX(ha) 0
#endif #endif
/* /*
* Only ISP23XX has extended addressing support in the firmware. * Only non-ISP2[12]00 have extended addressing support in the firmware.
*/ */
#define HAS_EXTENDED_IDS(ha) IS_QLA23XX(ha) #define HAS_EXTENDED_IDS(ha) (!IS_QLA2100(ha) && !IS_QLA2200(ha))
/* /*
* We have MAILBOX_REGISTER_COUNT sized arrays in a few places, * We have MAILBOX_REGISTER_COUNT sized arrays in a few places,
...@@ -126,21 +139,12 @@ ...@@ -126,21 +139,12 @@
* I/O register * I/O register
*/ */
#if MEMORY_MAPPED_IO
#define RD_REG_BYTE(addr) readb(addr) #define RD_REG_BYTE(addr) readb(addr)
#define RD_REG_WORD(addr) readw(addr) #define RD_REG_WORD(addr) readw(addr)
#define RD_REG_DWORD(addr) readl(addr) #define RD_REG_DWORD(addr) readl(addr)
#define WRT_REG_BYTE(addr, data) writeb(data,addr) #define WRT_REG_BYTE(addr, data) writeb(data,addr)
#define WRT_REG_WORD(addr, data) writew(data,addr) #define WRT_REG_WORD(addr, data) writew(data,addr)
#define WRT_REG_DWORD(addr, data) writel(data,addr) #define WRT_REG_DWORD(addr, data) writel(data,addr)
#else /* MEMORY_MAPPED_IO */
#define RD_REG_BYTE(addr) (inb((unsigned long)addr))
#define RD_REG_WORD(addr) (inw((unsigned long)addr))
#define RD_REG_DWORD(addr) (inl((unsigned long)addr))
#define WRT_REG_BYTE(addr, data) (outb(data,(unsigned long)addr))
#define WRT_REG_WORD(addr, data) (outw(data,(unsigned long)addr))
#define WRT_REG_DWORD(addr, data) (outl(data,(unsigned long)addr))
#endif /* MEMORY_MAPPED_IO */
/* /*
* Fibre Channel device definitions. * Fibre Channel device definitions.
...@@ -434,41 +438,42 @@ typedef volatile struct { ...@@ -434,41 +438,42 @@ typedef volatile struct {
} device_reg_t; } device_reg_t;
#define ISP_REQ_Q_IN(ha, reg) \ #define ISP_REQ_Q_IN(ha, reg) \
(IS_QLA23XX(ha) ? \ (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
&(reg)->u.isp2300.req_q_in : \ &(reg)->u.isp2100.mailbox4 : \
&(reg)->u.isp2100.mailbox4) &(reg)->u.isp2300.req_q_in)
#define ISP_REQ_Q_OUT(ha, reg) \ #define ISP_REQ_Q_OUT(ha, reg) \
(IS_QLA23XX(ha) ? \ (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
&(reg)->u.isp2300.req_q_out : \ &(reg)->u.isp2100.mailbox4 : \
&(reg)->u.isp2100.mailbox4) &(reg)->u.isp2300.req_q_out)
#define ISP_RSP_Q_IN(ha, reg) \ #define ISP_RSP_Q_IN(ha, reg) \
(IS_QLA23XX(ha) ? \ (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
&(reg)->u.isp2300.rsp_q_in : \ &(reg)->u.isp2100.mailbox5 : \
&(reg)->u.isp2100.mailbox5) &(reg)->u.isp2300.rsp_q_in)
#define ISP_RSP_Q_OUT(ha, reg) \ #define ISP_RSP_Q_OUT(ha, reg) \
(IS_QLA23XX(ha) ? \ (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
&(reg)->u.isp2300.rsp_q_out : \ &(reg)->u.isp2100.mailbox5 : \
&(reg)->u.isp2100.mailbox5) &(reg)->u.isp2300.rsp_q_out)
#define MAILBOX_REG(ha, reg, num) \ #define MAILBOX_REG(ha, reg, num) \
(IS_QLA23XX(ha) ? \ (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
&(reg)->u.isp2300.mailbox0 + (num) : \ (num < 8 ? \
((num < 8) ? \
&(reg)->u.isp2100.mailbox0 + (num) : \ &(reg)->u.isp2100.mailbox0 + (num) : \
&(reg)->u_end.isp2200.mailbox8 + (num) - 8)) /* only for isp2200 */ &(reg)->u_end.isp2200.mailbox8 + (num) - 8) : \
&(reg)->u.isp2300.mailbox0 + (num))
#define RD_MAILBOX_REG(ha, reg, num) \ #define RD_MAILBOX_REG(ha, reg, num) \
RD_REG_WORD(MAILBOX_REG(ha, reg, num)) RD_REG_WORD(MAILBOX_REG(ha, reg, num))
#define WRT_MAILBOX_REG(ha, reg, num, data) \ #define WRT_MAILBOX_REG(ha, reg, num, data) \
WRT_REG_WORD(MAILBOX_REG(ha, reg, num), data) WRT_REG_WORD(MAILBOX_REG(ha, reg, num), data)
#define FB_CMD_REG(ha, reg) \ #define FB_CMD_REG(ha, reg) \
(IS_QLA23XX(ha) ? &(reg)->u.isp2300.fb_cmd : &(reg)->fb_cmd_2100) (IS_QLA2100(ha) || IS_QLA2200(ha) ? \
&(reg)->fb_cmd_2100 : \
&(reg)->u.isp2300.fb_cmd)
#define RD_FB_CMD_REG(ha, reg) \ #define RD_FB_CMD_REG(ha, reg) \
RD_REG_WORD(FB_CMD_REG(ha, reg)) RD_REG_WORD(FB_CMD_REG(ha, reg))
#define WRT_FB_CMD_REG(ha, reg, data) \ #define WRT_FB_CMD_REG(ha, reg, data) \
WRT_REG_WORD(FB_CMD_REG(ha, reg), data) WRT_REG_WORD(FB_CMD_REG(ha, reg), data)
typedef struct { typedef struct {
uint32_t out_mb; /* outbound from driver */ uint32_t out_mb; /* outbound from driver */
uint32_t in_mb; /* Incoming from RISC */ uint32_t in_mb; /* Incoming from RISC */
...@@ -716,8 +721,8 @@ typedef struct { ...@@ -716,8 +721,8 @@ typedef struct {
uint8_t hard_address; uint8_t hard_address;
uint8_t reserved_1; uint8_t reserved_1;
uint8_t port_id[4]; uint8_t port_id[4];
uint8_t node_name[WWN_SIZE]; /* Big endian. */ uint8_t node_name[WWN_SIZE];
uint8_t port_name[WWN_SIZE]; /* Big endian. */ uint8_t port_name[WWN_SIZE];
uint16_t execution_throttle; uint16_t execution_throttle;
uint16_t execution_count; uint16_t execution_count;
uint8_t reset_count; uint8_t reset_count;
...@@ -1919,12 +1924,6 @@ struct io_descriptor { ...@@ -1919,12 +1924,6 @@ struct io_descriptor {
uint32_t signature; uint32_t signature;
}; };
/* Mailbox command semaphore queue for command serialization */
typedef struct _mbx_cmdq_t {
struct semaphore cmd_sem;
struct _mbx_cmdq_t *pnext;
} mbx_cmdq_t;
struct qla_fw_info { struct qla_fw_info {
unsigned short addressing; /* addressing method used to load fw */ unsigned short addressing; /* addressing method used to load fw */
#define FW_INFO_ADDR_NORMAL 0 #define FW_INFO_ADDR_NORMAL 0
...@@ -2102,6 +2101,8 @@ typedef struct scsi_qla_host { ...@@ -2102,6 +2101,8 @@ typedef struct scsi_qla_host {
uint16_t max_public_loop_ids; uint16_t max_public_loop_ids;
uint16_t min_external_loopid; /* First external loop Id */ uint16_t min_external_loopid; /* First external loop Id */
uint16_t link_data_rate; /* F/W operating speed */
uint8_t current_topology; uint8_t current_topology;
uint8_t prev_topology; uint8_t prev_topology;
#define ISP_CFG_NL 1 #define ISP_CFG_NL 1
...@@ -2115,9 +2116,6 @@ typedef struct scsi_qla_host { ...@@ -2115,9 +2116,6 @@ typedef struct scsi_qla_host {
#define LOOP_P2P 2 #define LOOP_P2P 2
#define P2P_LOOP 3 #define P2P_LOOP 3
uint8_t active_fc4_types; /* Active fc4 types */
uint8_t current_speed; /* F/W operating speed */
uint8_t marker_needed; uint8_t marker_needed;
uint8_t sns_retry_cnt; uint8_t sns_retry_cnt;
uint8_t mem_err; uint8_t mem_err;
...@@ -2194,27 +2192,14 @@ typedef struct scsi_qla_host { ...@@ -2194,27 +2192,14 @@ typedef struct scsi_qla_host {
mbx_cmd_t *mcp; mbx_cmd_t *mcp;
unsigned long mbx_cmd_flags; unsigned long mbx_cmd_flags;
#define MBX_CMD_ACTIVE 1 #define MBX_INTERRUPT 1
#define MBX_CMD_WANT 2 #define MBX_INTR_WAIT 2
#define MBX_INTERRUPT 3
#define MBX_INTR_WAIT 4
spinlock_t mbx_reg_lock; /* Mbx Cmd Register Lock */ spinlock_t mbx_reg_lock; /* Mbx Cmd Register Lock */
spinlock_t mbx_q_lock; /* Mbx Active Cmd Queue Lock */
spinlock_t mbx_bits_lock; /* Mailbox access bits Lock */
struct semaphore mbx_cmd_sem; /* Serialialize mbx access */
struct semaphore mbx_intr_sem; /* Used for completion notification */ struct semaphore mbx_intr_sem; /* Used for completion notification */
mbx_cmdq_t *mbx_sem_pool_head; /* Head Pointer to a list of
* recyclable mbx semaphore pool
* to be used during run time.
*/
mbx_cmdq_t *mbx_sem_pool_tail; /* Tail Pointer to semaphore pool*/
#define MBQ_INIT_LEN 16 /* initial mbx sem pool q len. actual len may vary */
mbx_cmdq_t *mbx_q_head; /* Head Pointer to sem q for active cmds */
mbx_cmdq_t *mbx_q_tail; /* Tail Pointer to sem q for active cmds */
uint32_t mbx_flags; uint32_t mbx_flags;
#define MBX_IN_PROGRESS BIT_0 #define MBX_IN_PROGRESS BIT_0
#define MBX_BUSY BIT_1 /* Got the Access */ #define MBX_BUSY BIT_1 /* Got the Access */
...@@ -2257,21 +2242,14 @@ typedef struct scsi_qla_host { ...@@ -2257,21 +2242,14 @@ typedef struct scsi_qla_host {
uint8_t host_str[16]; uint8_t host_str[16];
uint16_t pci_attr; uint16_t pci_attr;
uint16_t xchg_buf_cnt;
uint16_t iocb_buf_cnt; uint16_t product_id[4];
uint8_t model_number[16+1]; uint8_t model_number[16+1];
#define BINZERO "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" #define BINZERO "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
char *model_desc; char *model_desc;
/* following are new and needed for IOCTL support */ /* following are new and needed for IOCTL support */
#ifdef CONFIG_SCSI_QLA2XXX_IOCTL
struct hba_ioctl *ioctl;
void *ioctl_mem;
dma_addr_t ioctl_mem_phys;
uint32_t ioctl_mem_size;
#endif
uint8_t node_name[WWN_SIZE]; uint8_t node_name[WWN_SIZE];
uint8_t nvram_version; uint8_t nvram_version;
uint8_t optrom_major; uint8_t optrom_major;
......
...@@ -103,6 +103,8 @@ extern void qla2x00_abort_queues(scsi_qla_host_t *, uint8_t); ...@@ -103,6 +103,8 @@ extern void qla2x00_abort_queues(scsi_qla_host_t *, uint8_t);
extern void qla2x00_blink_led(scsi_qla_host_t *); extern void qla2x00_blink_led(scsi_qla_host_t *);
extern int qla2x00_down_timeout(struct semaphore *, unsigned long);
/* /*
* Global Function Prototypes in qla_iocb.c source file. * Global Function Prototypes in qla_iocb.c source file.
*/ */
...@@ -217,11 +219,6 @@ qla2x00_full_login_lip(scsi_qla_host_t *ha); ...@@ -217,11 +219,6 @@ qla2x00_full_login_lip(scsi_qla_host_t *ha);
extern int extern int
qla2x00_get_id_list(scsi_qla_host_t *, void *, dma_addr_t, uint16_t *); qla2x00_get_id_list(scsi_qla_host_t *, void *, dma_addr_t, uint16_t *);
#if 0 /* not yet needed */
extern int
qla2x00_dump_ram(scsi_qla_host_t *, uint32_t, dma_addr_t, uint32_t);
#endif
extern int extern int
qla2x00_lun_reset(scsi_qla_host_t *, uint16_t, uint16_t); qla2x00_lun_reset(scsi_qla_host_t *, uint16_t, uint16_t);
...@@ -239,10 +236,8 @@ extern int ...@@ -239,10 +236,8 @@ extern int
qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t *, qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t *,
uint16_t *); uint16_t *);
#if defined(QL_DEBUG_LEVEL_3)
extern int extern int
qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map);
#endif
/* /*
* Global Function Prototypes in qla_isr.c source file. * Global Function Prototypes in qla_isr.c source file.
...@@ -275,17 +270,6 @@ extern void qla2300_ascii_fw_dump(scsi_qla_host_t *); ...@@ -275,17 +270,6 @@ extern void qla2300_ascii_fw_dump(scsi_qla_host_t *);
extern void qla2x00_dump_regs(scsi_qla_host_t *); extern void qla2x00_dump_regs(scsi_qla_host_t *);
extern void qla2x00_dump_buffer(uint8_t *, uint32_t); extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *); extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *);
extern void qla2x00_print_q_info(struct os_lun *);
/*
* Global Function Prototypes in qla_ip.c source file.
*/
extern int qla2x00_ip_initialize(scsi_qla_host_t *);
extern int qla2x00_update_ip_device_data(scsi_qla_host_t *, fc_port_t *);
extern void qla2x00_ip_send_complete(scsi_qla_host_t *, uint32_t, uint16_t);
extern void qla2x00_ip_receive(scsi_qla_host_t *, sts_entry_t *);
extern void qla2x00_ip_receive_fastpost(scsi_qla_host_t *, uint16_t);
extern void qla2x00_ip_mailbox_iocb_done(scsi_qla_host_t *, struct mbx_entry *);
/* /*
* Global Function Prototypes in qla_gs.c source file. * Global Function Prototypes in qla_gs.c source file.
......
...@@ -20,11 +20,6 @@ ...@@ -20,11 +20,6 @@
#include "qla_def.h" #include "qla_def.h"
/* XXX(hch): this is ugly, but we don't want to pull in exioctl.h */
#ifndef EXT_DEF_FC4_TYPE_SCSI
#define EXT_DEF_FC4_TYPE_SCSI 0x1
#endif
static inline ms_iocb_entry_t * static inline ms_iocb_entry_t *
qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, uint32_t); qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, uint32_t);
...@@ -235,7 +230,7 @@ qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list) ...@@ -235,7 +230,7 @@ qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list)
/* /*
* If we've used all available slots, then the switch is * If we've used all available slots, then the switch is
* reporting back more devices that we can handle with this * reporting back more devices than we can handle with this
* single call. Return a failed status, and let GA_NXT handle * single call. Return a failed status, and let GA_NXT handle
* the overload. * the overload.
*/ */
...@@ -477,7 +472,6 @@ qla2x00_rft_id(scsi_qla_host_t *ha) ...@@ -477,7 +472,6 @@ qla2x00_rft_id(scsi_qla_host_t *ha)
ct_req->req.rft_id.port_id[2] = ha->d_id.b.al_pa; ct_req->req.rft_id.port_id[2] = ha->d_id.b.al_pa;
ct_req->req.rft_id.fc4_types[2] = 0x01; /* FCP-3 */ ct_req->req.rft_id.fc4_types[2] = 0x01; /* FCP-3 */
ha->active_fc4_types = EXT_DEF_FC4_TYPE_SCSI;
/* Execute MS IOCB */ /* Execute MS IOCB */
rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma, rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
......
...@@ -65,10 +65,13 @@ static uint16_t qla2x00_fcport_bind(scsi_qla_host_t *ha, fc_port_t *fcport); ...@@ -65,10 +65,13 @@ static uint16_t qla2x00_fcport_bind(scsi_qla_host_t *ha, fc_port_t *fcport);
static os_lun_t * qla2x00_fclun_bind(scsi_qla_host_t *, fc_port_t *, static os_lun_t * qla2x00_fclun_bind(scsi_qla_host_t *, fc_port_t *,
fc_lun_t *); fc_lun_t *);
static void qla2x00_lun_free(scsi_qla_host_t *, uint16_t, uint16_t); static void qla2x00_lun_free(scsi_qla_host_t *, uint16_t, uint16_t);
static int qla2x00_bstr_to_hex(char *, uint8_t *, int); static int qla2x00_bstr_to_hex(char *, uint8_t *, int);
static int qla2x00_find_propname(scsi_qla_host_t *, static int qla2x00_find_propname(scsi_qla_host_t *,
char *, char *, char *, int); char *, char *, char *, int);
#if 0 #if 0
static void qla2x00_get_lun_mask_from_config(scsi_qla_host_t *, fc_port_t *,
uint16_t, uint16_t);
static int qla2x00_get_prop_16chars(scsi_qla_host_t *, static int qla2x00_get_prop_16chars(scsi_qla_host_t *,
char *, char *, char *); char *, char *, char *);
static void qla2x00_get_properties(scsi_qla_host_t *, char *); static void qla2x00_get_properties(scsi_qla_host_t *, char *);
...@@ -148,6 +151,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha) ...@@ -148,6 +151,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
*/ */
if (ql2xdevconf) { if (ql2xdevconf) {
ha->cmdline = ql2xdevconf; ha->cmdline = ql2xdevconf;
qla2x00_get_properties(ha, ql2xdevconf);
} }
#endif #endif
...@@ -166,13 +170,6 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha) ...@@ -166,13 +170,6 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
} }
} }
/* Retrieve firmware information */
qla2x00_get_fw_version(ha, &ha->fw_major_version,
&ha->fw_minor_version, &ha->fw_subminor_version,
&ha->fw_attributes);
qla2x00_get_resource_cnts(ha, NULL, &ha->xchg_buf_cnt,
&ha->iocb_buf_cnt, NULL);
if (rval == QLA_SUCCESS && if (rval == QLA_SUCCESS &&
(rval = qla2x00_init_rings(ha)) == QLA_SUCCESS) { (rval = qla2x00_init_rings(ha)) == QLA_SUCCESS) {
check_fw_ready_again: check_fw_ready_again:
...@@ -226,6 +223,11 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha) ...@@ -226,6 +223,11 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
} while (restart_risc && retry--); } while (restart_risc && retry--);
if (isp_init) { if (isp_init) {
/* Retrieve firmware information */
qla2x00_get_fw_version(ha, &ha->fw_major_version,
&ha->fw_minor_version, &ha->fw_subminor_version,
&ha->fw_attributes);
clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
ha->marker_needed = 1; ha->marker_needed = 1;
qla2x00_marker(ha, 0, 0, MK_SYNC_ALL); qla2x00_marker(ha, 0, 0, MK_SYNC_ALL);
...@@ -282,11 +284,11 @@ qla2x00_pci_config(scsi_qla_host_t *ha) ...@@ -282,11 +284,11 @@ qla2x00_pci_config(scsi_qla_host_t *ha)
ha->pci_attr = RD_REG_WORD(&ha->iobase->ctrl_status); ha->pci_attr = RD_REG_WORD(&ha->iobase->ctrl_status);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (IS_QLA23XX(ha)) { if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80); pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80);
/* PCI Specification Revision 2.3 changes */ /* PCI Specification Revision 2.3 changes */
if (IS_QLA2322(ha)) if (IS_QLA2322(ha) || IS_QLA6322(ha))
/* Command Register - Reset Interrupt Disable. */ /* Command Register - Reset Interrupt Disable. */
w &= ~BIT_10; w &= ~BIT_10;
...@@ -406,7 +408,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha) ...@@ -406,7 +408,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
if (!IS_QLA2100(ha)) { if (!IS_QLA2100(ha)) {
/* Pause RISC. */ /* Pause RISC. */
WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC); WRT_REG_WORD(&reg->hccr, HCCR_PAUSE_RISC);
if (!IS_QLA2312(ha) && !IS_QLA2322(ha)) { if (IS_QLA2200(ha) || IS_QLA2300(ha)) {
for (cnt = 0; cnt < 30000; cnt++) { for (cnt = 0; cnt < 30000; cnt++) {
if ((RD_REG_WORD(&reg->hccr) & if ((RD_REG_WORD(&reg->hccr) &
HCCR_RISC_PAUSE) != 0) HCCR_RISC_PAUSE) != 0)
...@@ -424,7 +426,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha) ...@@ -424,7 +426,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
WRT_REG_WORD(&reg->fpm_diag_config, 0x100); WRT_REG_WORD(&reg->fpm_diag_config, 0x100);
/* Toggle Fpm Reset. */ /* Toggle Fpm Reset. */
if (IS_QLA23XX(ha)) if (!IS_QLA2200(ha))
WRT_REG_WORD(&reg->fpm_diag_config, 0x0); WRT_REG_WORD(&reg->fpm_diag_config, 0x0);
/* Select frame buffer registers. */ /* Select frame buffer registers. */
...@@ -461,9 +463,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha) ...@@ -461,9 +463,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET); WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
/* Wait for RISC to recover from reset. */ /* Wait for RISC to recover from reset. */
if (IS_QLA2312(ha) || IS_QLA2322(ha)) { if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
udelay(10);
} else {
/* /*
* It is necessary to for a delay here since the card doesn't * It is necessary to for a delay here since the card doesn't
* respond to PCI reads during a reset. On some architectures * respond to PCI reads during a reset. On some architectures
...@@ -476,7 +476,8 @@ qla2x00_reset_chip(scsi_qla_host_t *ha) ...@@ -476,7 +476,8 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
break; break;
udelay(100); udelay(100);
} }
} } else
udelay(10);
/* Reset RISC processor. */ /* Reset RISC processor. */
WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC); WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC);
...@@ -487,9 +488,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha) ...@@ -487,9 +488,7 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC); WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC);
RD_REG_WORD(&reg->hccr); /* PCI Posting. */ RD_REG_WORD(&reg->hccr); /* PCI Posting. */
if (IS_QLA2312(ha) || IS_QLA2322(ha)) if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
udelay(100);
else {
for (cnt = 0; cnt < 30000; cnt++) { for (cnt = 0; cnt < 30000; cnt++) {
if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)))
spin_lock_irqsave(&ha->mbx_reg_lock, mbx_flags); spin_lock_irqsave(&ha->mbx_reg_lock, mbx_flags);
...@@ -508,7 +507,8 @@ qla2x00_reset_chip(scsi_qla_host_t *ha) ...@@ -508,7 +507,8 @@ qla2x00_reset_chip(scsi_qla_host_t *ha)
udelay(100); udelay(100);
} }
} } else
udelay(100);
/* Turn on master enable */ /* Turn on master enable */
cmd |= PCI_COMMAND_MASTER; cmd |= PCI_COMMAND_MASTER;
...@@ -570,16 +570,15 @@ qla2x00_chip_diag(scsi_qla_host_t *ha) ...@@ -570,16 +570,15 @@ qla2x00_chip_diag(scsi_qla_host_t *ha)
WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC); WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC);
/* Workaround for QLA2312 PCI parity error */ /* Workaround for QLA2312 PCI parity error */
if (IS_QLA2312(ha) || IS_QLA2322(ha)) if (IS_QLA2100(ha) || IS_QLA2200(ha) || IS_QLA2300(ha)) {
udelay(10);
else {
data = qla2x00_debounce_register(MAILBOX_REG(ha, reg, 0)); data = qla2x00_debounce_register(MAILBOX_REG(ha, reg, 0));
for (cnt = 6000000; cnt && (data == MBS_BUSY); cnt--) { for (cnt = 6000000; cnt && (data == MBS_BUSY); cnt--) {
udelay(5); udelay(5);
data = RD_MAILBOX_REG(ha, reg, 0); data = RD_MAILBOX_REG(ha, reg, 0);
barrier(); barrier();
} }
} } else
udelay(10);
if (!cnt) if (!cnt)
goto chip_diag_failed; goto chip_diag_failed;
...@@ -590,7 +589,7 @@ qla2x00_chip_diag(scsi_qla_host_t *ha) ...@@ -590,7 +589,7 @@ qla2x00_chip_diag(scsi_qla_host_t *ha)
mb[1] = RD_MAILBOX_REG(ha, reg, 1); mb[1] = RD_MAILBOX_REG(ha, reg, 1);
mb[2] = RD_MAILBOX_REG(ha, reg, 2); mb[2] = RD_MAILBOX_REG(ha, reg, 2);
mb[3] = RD_MAILBOX_REG(ha, reg, 3); mb[3] = RD_MAILBOX_REG(ha, reg, 3);
mb[4] = qla2x00_debounce_register(MAILBOX_REG(ha, reg, 4));
if (mb[1] != PROD_ID_1 || (mb[2] != PROD_ID_2 && mb[2] != PROD_ID_2a) || if (mb[1] != PROD_ID_1 || (mb[2] != PROD_ID_2 && mb[2] != PROD_ID_2a) ||
mb[3] != PROD_ID_3) { mb[3] != PROD_ID_3) {
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
...@@ -598,6 +597,10 @@ qla2x00_chip_diag(scsi_qla_host_t *ha) ...@@ -598,6 +597,10 @@ qla2x00_chip_diag(scsi_qla_host_t *ha)
goto chip_diag_failed; goto chip_diag_failed;
} }
ha->product_id[0] = mb[1];
ha->product_id[1] = mb[2];
ha->product_id[2] = mb[3];
ha->product_id[3] = mb[4];
/* Adjust fw RISC transfer size */ /* Adjust fw RISC transfer size */
ha->fw_transfer_size = REQUEST_ENTRY_SIZE * REQUEST_ENTRY_CNT; ha->fw_transfer_size = REQUEST_ENTRY_SIZE * REQUEST_ENTRY_CNT;
...@@ -1106,7 +1109,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1106,7 +1109,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
/* Determine NVRAM starting address. */ /* Determine NVRAM starting address. */
ha->nvram_base = 0; ha->nvram_base = 0;
if (IS_QLA2312(ha) || IS_QLA2322(ha)) if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha))
if ((RD_REG_WORD(&reg->ctrl_status) >> 14) == 1) if ((RD_REG_WORD(&reg->ctrl_status) >> 14) == 1)
ha->nvram_base = 0x80; ha->nvram_base = 0x80;
...@@ -1218,7 +1221,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1218,7 +1221,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
} else { } else {
strcpy(ha->model_number, "QLA2300"); strcpy(ha->model_number, "QLA2300");
} }
} else if (IS_QLA2312(ha) || IS_QLA2322(ha)) { } else {
if (rval == 0 && if (rval == 0 &&
memcmp(nv->model_number, BINZERO, memcmp(nv->model_number, BINZERO,
sizeof(nv->model_number)) != 0) { sizeof(nv->model_number)) != 0) {
...@@ -1229,7 +1232,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1229,7 +1232,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
st = en = ha->model_number; st = en = ha->model_number;
en += sizeof(nv->model_number) - 1; en += sizeof(nv->model_number) - 1;
while (en > st) { while (en > st) {
if (*en != 0x20) if (*en != 0x20 && *en != 0x00)
break; break;
*en-- = '\0'; *en-- = '\0';
} }
...@@ -1246,8 +1249,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1246,8 +1249,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
strcpy(ha->model_number, "QLA23xx"); strcpy(ha->model_number, "QLA23xx");
} }
} }
} else {
strcpy(ha->model_number, "QLA23xx");
} }
} else if (IS_QLA2200(ha)) { } else if (IS_QLA2200(ha)) {
nv->firmware_options[0] |= BIT_2; nv->firmware_options[0] |= BIT_2;
...@@ -1287,6 +1288,9 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1287,6 +1288,9 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
ha->nvram_version = nv->nvram_version; ha->nvram_version = nv->nvram_version;
ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0); ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0);
/* Always load RISC code on non ISP2[12]00 chips. */
if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
ha->flags.disable_risc_code_load = 0;
ha->flags.enable_lip_reset = ((nv->host_p[1] & BIT_1) ? 1 : 0); ha->flags.enable_lip_reset = ((nv->host_p[1] & BIT_1) ? 1 : 0);
ha->flags.enable_lip_full_login = ((nv->host_p[1] & BIT_2) ? 1 : 0); ha->flags.enable_lip_full_login = ((nv->host_p[1] & BIT_2) ? 1 : 0);
ha->flags.enable_target_reset = ((nv->host_p[1] & BIT_3) ? 1 : 0); ha->flags.enable_target_reset = ((nv->host_p[1] & BIT_3) ? 1 : 0);
...@@ -1318,14 +1322,8 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1318,14 +1322,8 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
/* Set minimum RATOV to 200 tenths of a second. */ /* Set minimum RATOV to 200 tenths of a second. */
ha->r_a_tov = 200; ha->r_a_tov = 200;
/* FIXME
*
* port_down_retry_count updated twice
*
*/
ha->port_down_retry_count = nv->port_down_retry_count;
ha->minimum_timeout = ha->minimum_timeout =
(ha->login_timeout * ha->retry_count) + ha->port_down_retry_count; (ha->login_timeout * ha->retry_count) + nv->port_down_retry_count;
ha->loop_reset_delay = nv->reset_delay; ha->loop_reset_delay = nv->reset_delay;
/* Will get the value from NVRAM. */ /* Will get the value from NVRAM. */
...@@ -1350,28 +1348,15 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1350,28 +1348,15 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
(LOOP_DOWN_TIME - ha->link_down_timeout); (LOOP_DOWN_TIME - ha->link_down_timeout);
} }
ha->max_luns = MAX_LUNS;
ha->max_probe_luns = le16_to_cpu(nv->max_luns_per_target); ha->max_probe_luns = le16_to_cpu(nv->max_luns_per_target);
if (ha->max_probe_luns == 0) if (ha->max_probe_luns == 0)
ha->max_probe_luns = MIN_LUNS; ha->max_probe_luns = MIN_LUNS;
#if USE_BIOS_MAX_LUNS
ha->max_luns = le16_to_cpu(nv->max_luns_per_target);
if (ha->max_luns == 0)
ha->max_luns = MAX_LUNS;
else if (ha->max_luns > MAX_LUNS)
ha->max_luns = MAX_LUNS;
#else
ha->max_luns = MAX_LUNS;
#endif
/* FIXME
*
* port_down_retry_count updated twice
*
*/
/* /*
* Need enough time to try and get the port back. * Need enough time to try and get the port back.
*/ */
ha->port_down_retry_count = nv->port_down_retry_count;
if (qlport_down_retry) if (qlport_down_retry)
ha->port_down_retry_count = qlport_down_retry; ha->port_down_retry_count = qlport_down_retry;
/* Set login_retry_count */ /* Set login_retry_count */
...@@ -1445,9 +1430,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) ...@@ -1445,9 +1430,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
DEBUG2_3(printk(KERN_WARNING DEBUG2_3(printk(KERN_WARNING
"scsi(%ld): NVRAM configuration failed!\n", ha->host_no)); "scsi(%ld): NVRAM configuration failed!\n", ha->host_no));
} }
LEAVE(__func__);
return (rval); return (rval);
} }
...@@ -1466,12 +1448,8 @@ qla2x00_init_tgt_map(scsi_qla_host_t *ha) ...@@ -1466,12 +1448,8 @@ qla2x00_init_tgt_map(scsi_qla_host_t *ha)
{ {
uint32_t t; uint32_t t;
ENTER(__func__);
for (t = 0; t < MAX_TARGETS; t++) for (t = 0; t < MAX_TARGETS; t++)
TGT_Q(ha, t) = (os_tgt_t *)NULL; TGT_Q(ha, t) = (os_tgt_t *)NULL;
LEAVE(__func__);
} }
/** /**
...@@ -1594,6 +1572,8 @@ qla2x00_configure_loop(scsi_qla_host_t *ha) ...@@ -1594,6 +1572,8 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
qla2x00_config_os(ha); qla2x00_config_os(ha);
qla2x00_config_os(ha);
/* If we found all devices then go ready */ /* If we found all devices then go ready */
if (!(test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags))) { if (!(test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags))) {
atomic_set(&ha->loop_state, LOOP_READY); atomic_set(&ha->loop_state, LOOP_READY);
...@@ -1652,6 +1632,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha) ...@@ -1652,6 +1632,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
uint8_t domain; uint8_t domain;
uint8_t loop_id_2100; /* ISP2100/ISP2200 -- 4 bytes. */ uint8_t loop_id_2100; /* ISP2100/ISP2200 -- 4 bytes. */
uint16_t loop_id; /* ISP23XX -- 6 bytes. */ uint16_t loop_id; /* ISP23XX -- 6 bytes. */
uint16_t rsvd; /* ISP2XXX -- 8 bytes. */
} *id_list; } *id_list;
#define MAX_ID_LIST_SIZE (sizeof(struct dev_id) * MAX_FIBRE_DEVICES) #define MAX_ID_LIST_SIZE (sizeof(struct dev_id) * MAX_FIBRE_DEVICES)
dma_addr_t id_list_dma; dma_addr_t id_list_dma;
...@@ -1856,7 +1837,7 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) ...@@ -1856,7 +1837,7 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
PORT_RETRY_TIME; PORT_RETRY_TIME;
atomic_set(&fcport->port_down_timer, ha->port_down_retry_count * atomic_set(&fcport->port_down_timer, ha->port_down_retry_count *
PORT_RETRY_TIME); PORT_RETRY_TIME);
fcport->flags &= ~(FCF_LOGIN_NEEDED); fcport->flags &= ~FCF_LOGIN_NEEDED;
/* /*
* Check for outstanding cmd on tape Bypass LUN discovery if active * Check for outstanding cmd on tape Bypass LUN discovery if active
...@@ -2323,6 +2304,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) ...@@ -2323,6 +2304,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
int rval, rval2; int rval, rval2;
fc_port_t *fcport, *fcptemp; fc_port_t *fcport, *fcptemp;
uint16_t next_loopid; uint16_t next_loopid;
uint16_t mb[MAILBOX_REGISTER_COUNT];
LIST_HEAD(new_fcports); LIST_HEAD(new_fcports);
/* If FL port exists, then SNS is present */ /* If FL port exists, then SNS is present */
...@@ -2342,6 +2324,17 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) ...@@ -2342,6 +2324,17 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
return (QLA_SUCCESS); return (QLA_SUCCESS);
} }
do { do {
/* Ensure we are logged into the SNS. */
qla2x00_login_fabric(ha, SIMPLE_NAME_SERVER, 0xff, 0xff, 0xfc,
mb, BIT_0);
if (mb[0] != MBS_COMMAND_COMPLETE) {
qla_printk(KERN_INFO, ha,
"Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
"mb[2]=%x mb[6]=%x mb[7]=%x\n", SIMPLE_NAME_SERVER,
mb[0], mb[1], mb[2], mb[6], mb[7]);
return (QLA_FUNCTION_FAILED);
}
if (test_and_clear_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags)) { if (test_and_clear_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags)) {
if (qla2x00_rft_id(ha)) { if (qla2x00_rft_id(ha)) {
/* EMPTY */ /* EMPTY */
...@@ -2811,7 +2804,8 @@ qla2x00_device_resync(scsi_qla_host_t *ha) ...@@ -2811,7 +2804,8 @@ qla2x00_device_resync(scsi_qla_host_t *ha)
switch (format) { switch (format) {
case 0: case 0:
if (IS_QLA23XX(ha) && ha->flags.init_done) { if (!IS_QLA2100(ha) && !IS_QLA2200(ha) &&
ha->flags.init_done) {
/* Handle port RSCN via asyncronous IOCBs */ /* Handle port RSCN via asyncronous IOCBs */
rval2 = qla2x00_handle_port_rscn(ha, rscn_entry, rval2 = qla2x00_handle_port_rscn(ha, rscn_entry,
NULL, 0); NULL, 0);
...@@ -2836,7 +2830,7 @@ qla2x00_device_resync(scsi_qla_host_t *ha) ...@@ -2836,7 +2830,7 @@ qla2x00_device_resync(scsi_qla_host_t *ha)
rval = QLA_SUCCESS; rval = QLA_SUCCESS;
/* Abort any outstanding IO descriptors. */ /* Abort any outstanding IO descriptors. */
if (IS_QLA23XX(ha)) if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
qla2x00_cancel_io_descriptors(ha); qla2x00_cancel_io_descriptors(ha);
list_for_each_entry(fcport, &ha->fcports, list) { list_for_each_entry(fcport, &ha->fcports, list) {
...@@ -3128,13 +3122,9 @@ qla2x00_restart_queues(scsi_qla_host_t *ha, uint8_t flush) ...@@ -3128,13 +3122,9 @@ qla2x00_restart_queues(scsi_qla_host_t *ha, uint8_t flush)
struct list_head *list, *temp; struct list_head *list, *temp;
unsigned long flags = 0; unsigned long flags = 0;
ENTER(__func__);
clear_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags); clear_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags);
/* /* start pending queue */
* start pending queue
*/
pending_q_cnt = ha->qthreads; pending_q_cnt = ha->qthreads;
if (flush) { if (flush) {
spin_lock_irqsave(&ha->list_lock,flags); spin_lock_irqsave(&ha->list_lock,flags);
...@@ -3188,8 +3178,6 @@ qla2x00_restart_queues(scsi_qla_host_t *ha, uint8_t flush) ...@@ -3188,8 +3178,6 @@ qla2x00_restart_queues(scsi_qla_host_t *ha, uint8_t flush)
if (!list_empty(&ha->done_queue)) if (!list_empty(&ha->done_queue))
qla2x00_done(ha); qla2x00_done(ha);
LEAVE(__func__);
} }
//FIXME - Document //FIXME - Document
...@@ -3344,6 +3332,9 @@ qla2x00_fcport_bind(scsi_qla_host_t *ha, fc_port_t *fcport) ...@@ -3344,6 +3332,9 @@ qla2x00_fcport_bind(scsi_qla_host_t *ha, fc_port_t *fcport)
tq->flags |= TQF_ONLINE; tq->flags |= TQF_ONLINE;
tq->port_down_retry_count = ha->port_down_retry_count; tq->port_down_retry_count = ha->port_down_retry_count;
#if 0
qla2x00_get_lun_mask_from_config(ha, fcport, tgt, 0);
#endif
} }
if (tgt == MAX_TARGETS) { if (tgt == MAX_TARGETS) {
...@@ -3587,6 +3578,52 @@ qla2x00_lun_free(scsi_qla_host_t *ha, uint16_t tgt, uint16_t lun) ...@@ -3587,6 +3578,52 @@ qla2x00_lun_free(scsi_qla_host_t *ha, uint16_t tgt, uint16_t lun)
} }
#if 0
/*
* qla2x00_get_lun_mask_from_config
* Get lun mask from the configuration parameters.
* Bit order is little endian.
*
* Input:
* ha -- Host adapter
* tgt -- target/device number
* port -- pointer to port
*/
static void
qla2x00_get_lun_mask_from_config(scsi_qla_host_t *ha,
fc_port_t *fcport, uint16_t tgt, uint16_t dev_no)
{
char propbuf[60]; /* size of search string */
int rval, lun, bit;
lun_bit_mask_t lun_mask, *mask_ptr = &lun_mask;
/* Get "target-N-device-N-lun-mask" as a 256 bit lun_mask*/
sprintf(propbuf, "scsi-qla%ld-tgt-%d-di-%d-lun-disabled",
ha->instance, tgt, dev_no);
rval = qla2x00_get_prop_xstr(ha, propbuf,
(uint8_t *)&lun_mask, sizeof(lun_bit_mask_t));
if (rval == sizeof(lun_bit_mask_t)) {
memset(&fcport->lun_mask, 0, sizeof(lun_bit_mask_t));
for (lun = 8 * sizeof(lun_bit_mask_t) - 1, bit = 0;
lun >= 0; lun--, bit++) {
if (EXT_IS_LUN_BIT_SET(mask_ptr, lun))
EXT_SET_LUN_BIT((&fcport->lun_mask), bit);
}
DEBUG3(printk("scsi(%ld): returning lun mask for fcport "
"%02x%02x%02x%02x%02x%02x%02x%02x:\n",
ha->host_no,
fcport->port_name[0], fcport->port_name[1],
fcport->port_name[2], fcport->port_name[3],
fcport->port_name[4], fcport->port_name[5],
fcport->port_name[6], fcport->port_name[7]));
DEBUG3(qla2x00_dump_buffer((uint8_t *)&fcport->lun_mask,
sizeof(lun_bit_mask_t));)
}
}
#endif
/* /*
* qla2x00_bstr_to_hex * qla2x00_bstr_to_hex
* Convert hex byte string to number. * Convert hex byte string to number.
...@@ -3670,7 +3707,6 @@ qla2x00_get_prop_xstr(scsi_qla_host_t *ha, ...@@ -3670,7 +3707,6 @@ qla2x00_get_prop_xstr(scsi_qla_host_t *ha,
propstr++; /* ignore equal sign */ propstr++; /* ignore equal sign */
if (rval == 0) { /* not found */ if (rval == 0) { /* not found */
LEAVE(__func__);
return (-1); return (-1);
} }
...@@ -4035,8 +4071,6 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) ...@@ -4035,8 +4071,6 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
srb_t *sp; srb_t *sp;
uint8_t status = 0; uint8_t status = 0;
ENTER("qla2x00_abort_isp");
if (ha->flags.online) { if (ha->flags.online) {
ha->flags.online = FALSE; ha->flags.online = FALSE;
clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
...@@ -4176,7 +4210,7 @@ qla2x00_restart_isp(scsi_qla_host_t *ha) ...@@ -4176,7 +4210,7 @@ qla2x00_restart_isp(scsi_qla_host_t *ha)
if (qla2x00_isp_firmware(ha)) { if (qla2x00_isp_firmware(ha)) {
ha->flags.online = FALSE; ha->flags.online = FALSE;
if (!(status = qla2x00_chip_diag(ha))) { if (!(status = qla2x00_chip_diag(ha))) {
if (!IS_QLA23XX(ha)) { if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
status = qla2x00_setup_chip(ha); status = qla2x00_setup_chip(ha);
goto done; goto done;
} }
...@@ -4192,14 +4226,14 @@ qla2x00_restart_isp(scsi_qla_host_t *ha) ...@@ -4192,14 +4226,14 @@ qla2x00_restart_isp(scsi_qla_host_t *ha)
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
/* Enable proper parity */ /* Enable proper parity */
if (IS_QLA2312(ha) || IS_QLA2322(ha)) if (IS_QLA2300(ha))
/* SRAM, Instruction RAM and GP RAM parity */
WRT_REG_WORD(&reg->hccr,
(HCCR_ENABLE_PARITY + 0x7));
else
/* SRAM parity */ /* SRAM parity */
WRT_REG_WORD(&reg->hccr, WRT_REG_WORD(&reg->hccr,
(HCCR_ENABLE_PARITY + 0x1)); (HCCR_ENABLE_PARITY + 0x1));
else
/* SRAM, Instruction RAM and GP RAM parity */
WRT_REG_WORD(&reg->hccr,
(HCCR_ENABLE_PARITY + 0x7));
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
} }
...@@ -4246,8 +4280,6 @@ qla2x00_reset_adapter(scsi_qla_host_t *ha) ...@@ -4246,8 +4280,6 @@ qla2x00_reset_adapter(scsi_qla_host_t *ha)
unsigned long flags = 0; unsigned long flags = 0;
device_reg_t *reg = ha->iobase; device_reg_t *reg = ha->iobase;
ENTER(__func__);
ha->flags.online = FALSE; ha->flags.online = FALSE;
qla2x00_disable_intrs(ha); qla2x00_disable_intrs(ha);
/* Reset RISC processor. */ /* Reset RISC processor. */
...@@ -4255,6 +4287,4 @@ qla2x00_reset_adapter(scsi_qla_host_t *ha) ...@@ -4255,6 +4287,4 @@ qla2x00_reset_adapter(scsi_qla_host_t *ha)
WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC); WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC);
WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC); WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
LEAVE(__func__);
} }
...@@ -527,8 +527,6 @@ __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, ...@@ -527,8 +527,6 @@ __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
{ {
mrk_entry_t *pkt; mrk_entry_t *pkt;
ENTER(__func__);
pkt = (mrk_entry_t *)qla2x00_req_pkt(ha); pkt = (mrk_entry_t *)qla2x00_req_pkt(ha);
if (pkt == NULL) { if (pkt == NULL) {
DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__)); DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
...@@ -547,8 +545,6 @@ __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, ...@@ -547,8 +545,6 @@ __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
/* Issue command to ISP */ /* Issue command to ISP */
qla2x00_isp_cmd(ha); qla2x00_isp_cmd(ha);
LEAVE(__func__);
return (QLA_SUCCESS); return (QLA_SUCCESS);
} }
...@@ -584,8 +580,6 @@ qla2x00_req_pkt(scsi_qla_host_t *ha) ...@@ -584,8 +580,6 @@ qla2x00_req_pkt(scsi_qla_host_t *ha)
uint32_t timer; uint32_t timer;
uint16_t req_cnt = 1; uint16_t req_cnt = 1;
ENTER(__func__);
/* Wait 1 second for slot. */ /* Wait 1 second for slot. */
for (timer = HZ; timer; timer--) { for (timer = HZ; timer; timer--) {
if ((req_cnt + 2) >= ha->req_q_cnt) { if ((req_cnt + 2) >= ha->req_q_cnt) {
...@@ -632,8 +626,6 @@ qla2x00_req_pkt(scsi_qla_host_t *ha) ...@@ -632,8 +626,6 @@ qla2x00_req_pkt(scsi_qla_host_t *ha)
DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__)); DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
} }
LEAVE(__func__);
return (pkt); return (pkt);
} }
...@@ -658,8 +650,6 @@ qla2x00_ms_req_pkt(scsi_qla_host_t *ha, srb_t *sp) ...@@ -658,8 +650,6 @@ qla2x00_ms_req_pkt(scsi_qla_host_t *ha, srb_t *sp)
uint8_t found = 0; uint8_t found = 0;
uint16_t req_cnt = 1; uint16_t req_cnt = 1;
ENTER(__func__);
/* Wait 1 second for slot. */ /* Wait 1 second for slot. */
for (timer = HZ; timer; timer--) { for (timer = HZ; timer; timer--) {
if ((req_cnt + 2) >= ha->req_q_cnt) { if ((req_cnt + 2) >= ha->req_q_cnt) {
...@@ -730,8 +720,6 @@ qla2x00_ms_req_pkt(scsi_qla_host_t *ha, srb_t *sp) ...@@ -730,8 +720,6 @@ qla2x00_ms_req_pkt(scsi_qla_host_t *ha, srb_t *sp)
DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__)); DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
} }
LEAVE(__func__);
return (pkt); return (pkt);
} }
......
...@@ -21,12 +21,6 @@ ...@@ -21,12 +21,6 @@
#include "qla_def.h" #include "qla_def.h"
/* XXX(hch): this is ugly, but we don't want to pull in exioctl.h */
#ifndef EXT_DEF_PORTSPEED_1GBIT
#define EXT_DEF_PORTSPEED_1GBIT 1
#define EXT_DEF_PORTSPEED_2GBIT 2
#endif
static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t); static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
static void qla2x00_async_event(scsi_qla_host_t *, uint32_t); static void qla2x00_async_event(scsi_qla_host_t *, uint32_t);
static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t); static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t);
...@@ -424,15 +418,14 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) ...@@ -424,15 +418,14 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx)
case MBA_LOOP_UP: /* Loop Up Event */ case MBA_LOOP_UP: /* Loop Up Event */
mb[1] = RD_MAILBOX_REG(ha, reg, 1); mb[1] = RD_MAILBOX_REG(ha, reg, 1);
ha->current_speed = EXT_DEF_PORTSPEED_1GBIT; ha->link_data_rate = 0;
if (IS_QLA2100(ha) || IS_QLA2200(ha)) { if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
link_speed = link_speeds[0]; link_speed = link_speeds[0];
} else { } else {
link_speed = link_speeds[3]; link_speed = link_speeds[3];
if (mb[1] < 5) if (mb[1] < 5)
link_speed = link_speeds[mb[1]]; link_speed = link_speeds[mb[1]];
if (mb[1] == 1) ha->link_data_rate = mb[1];
ha->current_speed = EXT_DEF_PORTSPEED_2GBIT;
} }
DEBUG2(printk("scsi(%ld): Asynchronous LOOP UP (%s Gbps).\n", DEBUG2(printk("scsi(%ld): Asynchronous LOOP UP (%s Gbps).\n",
...@@ -458,7 +451,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) ...@@ -458,7 +451,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx)
} }
ha->flags.management_server_logged_in = 0; ha->flags.management_server_logged_in = 0;
ha->current_speed = 0; /* reset value */ ha->link_data_rate = 0;
/* Update AEN queue. */ /* Update AEN queue. */
qla2x00_enqueue_aen(ha, MBA_LOOP_DOWN, NULL); qla2x00_enqueue_aen(ha, MBA_LOOP_DOWN, NULL);
...@@ -547,7 +540,8 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) ...@@ -547,7 +540,8 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx)
* us, create a new entry in our rscn fcports list and handle * us, create a new entry in our rscn fcports list and handle
* the event like an RSCN. * the event like an RSCN.
*/ */
if (IS_QLA23XX(ha) && ha->flags.init_done && mb[1] != 0xffff && if (!IS_QLA2100(ha) && !IS_QLA2200(ha) &&
ha->flags.init_done && mb[1] != 0xffff &&
((ha->operating_mode == P2P && mb[1] != 0) || ((ha->operating_mode == P2P && mb[1] != 0) ||
(ha->operating_mode != P2P && mb[1] != (ha->operating_mode != P2P && mb[1] !=
SNS_FIRST_LOOP_ID)) && (mb[2] == 6 || mb[2] == 7)) { SNS_FIRST_LOOP_ID)) && (mb[2] == 6 || mb[2] == 7)) {
...@@ -775,7 +769,7 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha) ...@@ -775,7 +769,7 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha)
qla2x00_ms_entry(ha, (ms_iocb_entry_t *)pkt); qla2x00_ms_entry(ha, (ms_iocb_entry_t *)pkt);
break; break;
case MBX_IOCB_TYPE: case MBX_IOCB_TYPE:
if (IS_QLA23XX(ha)) { if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
if (pkt->sys_define == SOURCE_ASYNC_IOCB) { if (pkt->sys_define == SOURCE_ASYNC_IOCB) {
qla2x00_process_iodesc(ha, qla2x00_process_iodesc(ha,
(struct mbx_entry *)pkt); (struct mbx_entry *)pkt);
......
...@@ -21,33 +21,6 @@ ...@@ -21,33 +21,6 @@
#include "qla_def.h" #include "qla_def.h"
/*
* Local Function Prototypes.
*/
static void
qla2x00_mbx_sem_timeout(unsigned long);
static int
qla2x00_get_mbx_access(scsi_qla_host_t *, uint32_t);
static int
qla2x00_release_mbx_access(scsi_qla_host_t *, uint32_t);
static int
qla2x00_mbx_q_add(scsi_qla_host_t *, mbx_cmdq_t **);
static void
qla2x00_mbx_q_get(scsi_qla_host_t *, mbx_cmdq_t **);
static void
qla2x00_mbx_q_memb_alloc(scsi_qla_host_t *, mbx_cmdq_t **);
static void
qla2x00_mbx_q_memb_free(scsi_qla_host_t *, mbx_cmdq_t *);
/***************************/
/* Function implementation */
/***************************/
static void static void
qla2x00_mbx_sem_timeout(unsigned long data) qla2x00_mbx_sem_timeout(unsigned long data)
...@@ -63,281 +36,6 @@ qla2x00_mbx_sem_timeout(unsigned long data) ...@@ -63,281 +36,6 @@ qla2x00_mbx_sem_timeout(unsigned long data)
DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n");) DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n");)
} }
/*
* tov = timeout value in seconds
*/
static int
qla2x00_get_mbx_access(scsi_qla_host_t *ha, uint32_t tov)
{
int ret;
int prev_val = 1; /* assume no access yet */
mbx_cmdq_t *ptmp_mbq;
struct timer_list tmp_cmd_timer;
unsigned long cpu_flags;
DEBUG11(printk("qla2x00_get_mbx_access(%ld): entered.\n",
ha->host_no);)
while (1) {
if (test_bit(MBX_CMD_WANT, &ha->mbx_cmd_flags) == 0) {
DEBUG11(printk("qla2x00_get_mbx_access(%ld): going "
" to test access flags.\n", ha->host_no);)
/* No one else is waiting. Go ahead and try to
* get access.
*/
if ((prev_val = test_and_set_bit(MBX_CMD_ACTIVE,
&ha->mbx_cmd_flags)) == 0) {
break;
}
}
/* wait for previous command to finish */
DEBUG(printk("qla2x00_get_mbx_access(%ld): access "
"flags=%lx. busy. Waiting for access. curr time=0x%lx.\n",
ha->host_no, ha->mbx_cmd_flags, jiffies);)
DEBUG11(printk("qla2x00_get_mbx_access(%ld): access "
"flags=%lx. busy. Waiting for access. curr time=0x%lx.\n",
ha->host_no, ha->mbx_cmd_flags, jiffies);)
/*
* Init timer and get semaphore from mbx q. After we got valid
* semaphore pointer the MBX_CMD_WANT flag would also had
* been set.
*/
qla2x00_mbx_q_add(ha, &ptmp_mbq);
if (ptmp_mbq == NULL) {
/* queue full? problem? can't proceed. */
DEBUG2_3_11(printk("qla2x00_get_mbx_access(%ld): ERROR "
"no more mbx_q allowed. exiting.\n", ha->host_no);)
break;
}
/* init timer and semaphore */
init_timer(&tmp_cmd_timer);
tmp_cmd_timer.data = (unsigned long)&ptmp_mbq->cmd_sem;
tmp_cmd_timer.function =
(void (*)(unsigned long))qla2x00_mbx_sem_timeout;
tmp_cmd_timer.expires = jiffies + tov * HZ;
DEBUG11(printk("get_mbx_access(%ld): adding timer. "
"curr time=0x%lx timeoutval=0x%lx.\n",
ha->host_no, jiffies, tmp_cmd_timer.expires);)
/* wait. */
/* add_timer(&tmp_cmd_timer);*/
DEBUG11(printk("get_mbx_access(%ld): going to sleep. "
"current time=0x%lx.\n", ha->host_no, jiffies);)
down_interruptible(&ptmp_mbq->cmd_sem);
DEBUG11(printk("get_mbx_access(%ld): woke up. current "
"time=0x%lx.\n",
ha->host_no, jiffies);)
/* del_timer(&tmp_cmd_timer);*/
/* try to get lock again. we'll test later to see
* if we actually got the lock.
*/
prev_val = test_and_set_bit(MBX_CMD_ACTIVE,
&ha->mbx_cmd_flags);
/*
* After we tried to get access then we check to see
* if we need to clear the MBX_CMD_WANT flag. Don't clear
* this flag before trying to get access or else another
* new thread might grab it before we did.
*/
spin_lock_irqsave(&ha->mbx_q_lock, cpu_flags);
if (ha->mbx_q_head == NULL) {
/* We're the last thread in queue. */
clear_bit(MBX_CMD_WANT, &ha->mbx_cmd_flags);
}
qla2x00_mbx_q_memb_free(ha, ptmp_mbq);
spin_unlock_irqrestore(&ha->mbx_q_lock, cpu_flags);
break;
}
if (prev_val == 0) {
/* We got the lock */
DEBUG11(printk("qla2x00_get_mbx_access(%ld): success.\n",
ha->host_no);)
ret = QLA_SUCCESS;
} else {
/* Timeout or resource error. */
DEBUG2_3_11(printk("qla2x00_get_mbx_access(%ld): timed out.\n",
ha->host_no);)
ret = QLA_FUNCTION_TIMEOUT;
}
return ret;
}
static int
qla2x00_release_mbx_access(scsi_qla_host_t *ha, uint32_t tov)
{
mbx_cmdq_t *next_thread;
DEBUG11(printk("qla2x00_release_mbx_access:(%ld): entered.\n",
ha->host_no);)
clear_bit(MBX_CMD_ACTIVE, &ha->mbx_cmd_flags);
/* Wake up one pending mailbox cmd thread in queue. */
qla2x00_mbx_q_get(ha, &next_thread);
if (next_thread) {
DEBUG11(printk("qla2x00_release_mbx_access: found pending "
"mbx cmd. Waking up sem in %p.\n", &next_thread);)
up(&next_thread->cmd_sem);
}
DEBUG11(printk("qla2x00_release_mbx_access:(%ld): exiting.\n",
ha->host_no);)
return QLA_SUCCESS;
}
/* Allocates a mbx_cmdq_t struct and add to the mbx_q list. */
static int
qla2x00_mbx_q_add(scsi_qla_host_t *ha, mbx_cmdq_t **ret_mbq)
{
int ret;
unsigned long cpu_flags;
mbx_cmdq_t *ptmp = NULL;
spin_lock_irqsave(&ha->mbx_q_lock, cpu_flags);
DEBUG11(printk("qla2x00_mbx_q_add: got mbx_q spinlock. "
"Inst=%d.\n", apiHBAInstance);)
qla2x00_mbx_q_memb_alloc(ha, &ptmp);
if (ptmp == NULL) {
/* can't add any more threads */
DEBUG2_3_11(printk("qla2x00_mbx_q_add: ERROR no more "
"ioctl threads allowed. Inst=%d.\n", apiHBAInstance);)
ret = QLA_MEMORY_ALLOC_FAILED;
} else {
if (ha->mbx_q_tail == NULL) {
/* First thread to queue. */
set_bit(MBX_CMD_WANT, &ha->mbx_cmd_flags);
ha->mbx_q_head = ptmp;
} else {
ha->mbx_q_tail->pnext = ptmp;
}
ha->mbx_q_tail = ptmp;
/* Now init the semaphore */
init_MUTEX_LOCKED(&ptmp->cmd_sem);
ret = QLA_SUCCESS;
}
*ret_mbq = ptmp;
DEBUG11(printk("qla2x00_mbx_q_add: going to release spinlock. "
"ret_mbq=%p, ret=%d. Inst=%d.\n", *ret_mbq, ret, apiHBAInstance);)
spin_unlock_irqrestore(&ha->mbx_q_lock, cpu_flags);
return ret;
}
/* Just remove and return first member from mbx_cmdq. Don't free anything. */
static void
qla2x00_mbx_q_get(scsi_qla_host_t *ha, mbx_cmdq_t **ret_mbq)
{
unsigned long cpu_flags;
spin_lock_irqsave(&ha->mbx_q_lock, cpu_flags);
DEBUG11(printk("qla2x00_mbx_q_get: got mbx_q spinlock. "
"Inst=%d.\n", apiHBAInstance);)
/* Remove from head */
*ret_mbq = ha->mbx_q_head;
if (ha->mbx_q_head != NULL) {
ha->mbx_q_head = ha->mbx_q_head->pnext;
if (ha->mbx_q_head == NULL) {
/* That's the last one in queue. */
ha->mbx_q_tail = NULL;
}
(*ret_mbq)->pnext = NULL;
}
DEBUG11(printk("qla2x00_mbx_q_remove: return ret_mbq=%p. Going to "
"release spinlock. Inst=%d.\n", *ret_mbq, apiHBAInstance);)
spin_unlock_irqrestore(&ha->mbx_q_lock, cpu_flags);
}
/* Find a free mbx_q member from the array. Must already got the
* mbx_q_lock spinlock.
*/
static void
qla2x00_mbx_q_memb_alloc(scsi_qla_host_t *ha, mbx_cmdq_t **ret_mbx_q_memb)
{
mbx_cmdq_t *ptmp = NULL;
DEBUG11(printk("qla2x00_mbx_q_memb_alloc: entered. "
"Inst=%d.\n", apiHBAInstance);)
ptmp = ha->mbx_sem_pool_head;
if (ptmp != NULL) {
ha->mbx_sem_pool_head = ptmp->pnext;
ptmp->pnext = NULL;
if (ha->mbx_sem_pool_head == NULL) {
ha->mbx_sem_pool_tail = NULL;
}
} else {
/* We ran out of pre-allocated semaphores. Try to allocate
* a new one.
*/
ptmp = kmalloc(sizeof(mbx_cmdq_t), GFP_ATOMIC);
if(ptmp)
memset(ptmp, 0, sizeof(mbx_cmdq_t));
}
*ret_mbx_q_memb = ptmp;
DEBUG11(printk("qla2x00_mbx_q_memb_alloc: return waitq_memb=%p. "
"Inst=%d.\n", *ret_mbx_q_memb, apiHBAInstance);)
}
/* Add the specified mbx_q member back to the free semaphore pool. Must
* already got the mbx_q_lock spinlock.
*/
static void
qla2x00_mbx_q_memb_free(scsi_qla_host_t *ha, mbx_cmdq_t *pfree_mbx_q_memb)
{
DEBUG11(printk("qla2x00_mbx_q_memb_free: entered. Inst=%d.\n",
apiHBAInstance);)
if (pfree_mbx_q_memb != NULL) {
if (ha->mbx_sem_pool_tail != NULL) {
/* Add to tail */
ha->mbx_sem_pool_tail->pnext = pfree_mbx_q_memb;
} else {
ha->mbx_sem_pool_head = pfree_mbx_q_memb;
}
ha->mbx_sem_pool_tail = pfree_mbx_q_memb;
}
/* put it back to the free pool. */
DEBUG11(printk("qla2x00_mbx_q_memb_free: exiting. "
"Inst=%d.\n", apiHBAInstance);)
}
/* /*
* qla2x00_mailbox_command * qla2x00_mailbox_command
* Issue mailbox command and waits for completion. * Issue mailbox command and waits for completion.
...@@ -366,7 +64,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) ...@@ -366,7 +64,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
struct timer_list tmp_intr_timer; struct timer_list tmp_intr_timer;
uint8_t abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); uint8_t abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
uint8_t io_lock_on = ha->flags.init_done; uint8_t io_lock_on = ha->flags.init_done;
uint8_t tmp_stat = 0;
uint16_t command; uint16_t command;
uint16_t *iptr, *optr; uint16_t *iptr, *optr;
uint32_t cnt; uint32_t cnt;
...@@ -384,8 +81,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) ...@@ -384,8 +81,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
* during non ISP abort time. * during non ISP abort time.
*/ */
if (!abort_active) { if (!abort_active) {
tmp_stat = qla2x00_get_mbx_access(ha, mcp->tov); if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) {
if (tmp_stat != QLA_SUCCESS) {
/* Timeout occurred. Return error. */ /* Timeout occurred. Return error. */
DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): cmd " DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): cmd "
"access timeout. Exiting.\n", ha->host_no);) "access timeout. Exiting.\n", ha->host_no);)
...@@ -479,7 +175,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) ...@@ -479,7 +175,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
/* Wait for either the timer to expire /* Wait for either the timer to expire
* or the mbox completion interrupt * or the mbox completion interrupt
*/ */
down(&ha->mbx_intr_sem); down_interruptible(&ha->mbx_intr_sem);
DEBUG11(printk("qla2x00_mailbox_command:" DEBUG11(printk("qla2x00_mailbox_command:"
"waking up." "waking up."
...@@ -611,12 +307,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) ...@@ -611,12 +307,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
} }
/* Allow next mbx cmd to come in. */ /* Allow next mbx cmd to come in. */
if (!abort_active) { if (!abort_active)
tmp_stat = qla2x00_release_mbx_access(ha, mcp->tov); up(&ha->mbx_cmd_sem);
if (rval == 0)
rval = tmp_stat;
}
if (rval) { if (rval) {
DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): **** FAILED. " DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): **** FAILED. "
...@@ -815,7 +507,7 @@ qla2x00_execute_fw(scsi_qla_host_t *ha) ...@@ -815,7 +507,7 @@ qla2x00_execute_fw(scsi_qla_host_t *ha)
mcp->mb[0] = MBC_EXECUTE_FIRMWARE; mcp->mb[0] = MBC_EXECUTE_FIRMWARE;
mcp->mb[1] = *ha->brd_info->fw_info[0].fwstart; mcp->mb[1] = *ha->brd_info->fw_info[0].fwstart;
mcp->out_mb = MBX_1|MBX_0; mcp->out_mb = MBX_1|MBX_0;
if (IS_QLA2322(ha)) { if (IS_QLA2322(ha) || IS_QLA6322(ha)) {
mcp->mb[2] = 0; mcp->mb[2] = 0;
mcp->out_mb |= MBX_2; mcp->out_mb |= MBX_2;
} }
...@@ -1234,8 +926,6 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr, ...@@ -1234,8 +926,6 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr,
mbx_cmd_t mc; mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc; mbx_cmd_t *mcp = &mc;
ENTER("qla2x00_issue_iocb: started");
mcp->mb[0] = MBC_IOCB_COMMAND_A64; mcp->mb[0] = MBC_IOCB_COMMAND_A64;
mcp->mb[1] = 0; mcp->mb[1] = 0;
mcp->mb[2] = MSW(phys_addr); mcp->mb[2] = MSW(phys_addr);
...@@ -1256,7 +946,6 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr, ...@@ -1256,7 +946,6 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr,
ha->host_no,rval);) ha->host_no,rval);)
} else { } else {
/*EMPTY*/ /*EMPTY*/
LEAVE("qla2x00_issue_iocb: exiting normally");
} }
return rval; return rval;
...@@ -2408,32 +2097,6 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma, ...@@ -2408,32 +2097,6 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma,
return rval; return rval;
} }
#if 0 /* not yet needed */
int
qla2x00_dump_ram(scsi_qla_host_t *ha, uint32_t risc_address,
dma_addr_t ispdump_dma, uint32_t size)
{
int rval;
mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc;
mcp->mb[0] = MBC_DUMP_RAM;
mcp->mb[1] = risc_address & 0xffff;
mcp->mb[2] = MSW(ispdump_dma);
mcp->mb[3] = LSW(ispdump_dma);
mcp->mb[4] = 0;
mcp->mb[6] = MSW(MSD(ispdump_dma));
mcp->mb[7] = LSW(MSD(ispdump_dma));
mcp->out_mb = MBX_7|MBX_6|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
mcp->in_mb = MBX_0;
mcp->tov = 30;
mcp->flags = 0;
rval = qla2x00_mailbox_command(ha, mcp);
return rval;
}
#endif
/* /*
* qla2x00_lun_reset * qla2x00_lun_reset
* Issue lun reset mailbox command. * Issue lun reset mailbox command.
...@@ -2458,8 +2121,6 @@ qla2x00_lun_reset(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun) ...@@ -2458,8 +2121,6 @@ qla2x00_lun_reset(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun)
mbx_cmd_t mc; mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc; mbx_cmd_t *mcp = &mc;
ENTER("qla2x00_lun_reset");
mcp->mb[0] = MBC_LUN_RESET; mcp->mb[0] = MBC_LUN_RESET;
if (HAS_EXTENDED_IDS(ha)) if (HAS_EXTENDED_IDS(ha))
mcp->mb[1] = loop_id; mcp->mb[1] = loop_id;
...@@ -2478,7 +2139,6 @@ qla2x00_lun_reset(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun) ...@@ -2478,7 +2139,6 @@ qla2x00_lun_reset(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun)
(int)ha->instance, rval); (int)ha->instance, rval);
} else { } else {
/*EMPTY*/ /*EMPTY*/
LEAVE("qla2x00_lun_reset: exiting normally");
} }
return rval; return rval;
......
...@@ -138,7 +138,6 @@ static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); ...@@ -138,7 +138,6 @@ static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha);
* SCSI host template entry points * SCSI host template entry points
*/ */
static int qla2xxx_slave_configure(struct scsi_device * device); static int qla2xxx_slave_configure(struct scsi_device * device);
extern int qla2x00_ioctl(struct scsi_device *, int , void *);
static int qla2xxx_eh_abort(struct scsi_cmnd *); static int qla2xxx_eh_abort(struct scsi_cmnd *);
static int qla2xxx_eh_device_reset(struct scsi_cmnd *); static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
...@@ -357,8 +356,6 @@ qla2x00_callback(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) ...@@ -357,8 +356,6 @@ qla2x00_callback(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
int got_sense; int got_sense;
unsigned long cpu_flags = 0; unsigned long cpu_flags = 0;
ENTER(__func__);
cmd->host_scribble = (unsigned char *) NULL; cmd->host_scribble = (unsigned char *) NULL;
vis_ha = (scsi_qla_host_t *) cmd->device->host->hostdata; vis_ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
...@@ -404,8 +401,6 @@ qla2x00_callback(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) ...@@ -404,8 +401,6 @@ qla2x00_callback(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
/* Call the mid-level driver interrupt handler */ /* Call the mid-level driver interrupt handler */
(*(cmd)->scsi_done)(cmd); (*(cmd)->scsi_done)(cmd);
LEAVE(__func__);
} }
static inline void static inline void
...@@ -648,6 +643,12 @@ qla2x00_get_fw_version_str(struct scsi_qla_host *ha, char *str) ...@@ -648,6 +643,12 @@ qla2x00_get_fw_version_str(struct scsi_qla_host *ha, char *str)
ha->fw_minor_version, ha->fw_minor_version,
ha->fw_subminor_version); ha->fw_subminor_version);
/* Workaround till firmware fix. */
if (IS_QLA6312(ha) || IS_QLA6322(ha)) {
strcat(str, "FLX");
return (str);
}
switch (ha->fw_attributes & 0xFF) { switch (ha->fw_attributes & 0xFF) {
case 0x7: case 0x7:
strcat(str, "EF"); strcat(str, "EF");
...@@ -910,8 +911,6 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) ...@@ -910,8 +911,6 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
u_long cpu_flags = 0; u_long cpu_flags = 0;
u_long max_wait_time = ABORT_WAIT_TIME; u_long max_wait_time = ABORT_WAIT_TIME;
ENTER(__func__);
do { do {
/* Check on done queue */ /* Check on done queue */
if (!found) { if (!found) {
...@@ -958,8 +957,6 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) ...@@ -958,8 +957,6 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
done++; done++;
} }
LEAVE(__func__);
return (done); return (done);
} }
...@@ -983,14 +980,17 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) ...@@ -983,14 +980,17 @@ qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
static inline int static inline int
qla2x00_wait_for_hba_online(scsi_qla_host_t *ha) qla2x00_wait_for_hba_online(scsi_qla_host_t *ha)
{ {
int return_status ; int return_status;
unsigned long wait_online;
while ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) || wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ);
while (((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) ||
test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) &&
time_before(jiffies, wait_online)) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(3 * HZ); schedule_timeout(HZ);
} }
if (ha->flags.online == TRUE) if (ha->flags.online == TRUE)
return_status = QLA_SUCCESS; return_status = QLA_SUCCESS;
...@@ -1033,7 +1033,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha) ...@@ -1033,7 +1033,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha)
test_bit(CFG_ACTIVE, &ha->cfg_flags) || test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
atomic_read(&ha->loop_state) != LOOP_READY) { atomic_read(&ha->loop_state) != LOOP_READY) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(3 * HZ); schedule_timeout(HZ);
if (time_after_eq(jiffies, loop_timeout)) { if (time_after_eq(jiffies, loop_timeout)) {
return_status = QLA_FUNCTION_FAILED; return_status = QLA_FUNCTION_FAILED;
break; break;
...@@ -1072,9 +1072,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -1072,9 +1072,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
unsigned int b, t, l; unsigned int b, t, l;
unsigned long flags; unsigned long flags;
ENTER(__func__);
/* Get the SCSI request ptr */ /* Get the SCSI request ptr */
sp = (srb_t *) CMD_SP(cmd); sp = (srb_t *) CMD_SP(cmd);
...@@ -1123,11 +1120,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -1123,11 +1120,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
} }
DEBUG2(printk("scsi(%ld): ABORTing cmd=%p sp=%p jiffies = 0x%lx, " DEBUG2(printk("scsi(%ld): ABORTing cmd=%p sp=%p jiffies = 0x%lx, "
"timeout=%x, dpc_flags=%lx, vis_ha->dpc_flags=%lx\n", "timeout=%x, dpc_flags=%lx, vis_ha->dpc_flags=%lx q->flag=%lx\n",
ha->host_no, cmd, sp, jiffies, cmd->timeout_per_command / HZ, ha->host_no, cmd, sp, jiffies, cmd->timeout_per_command / HZ,
ha->dpc_flags, vis_ha->dpc_flags)); ha->dpc_flags, vis_ha->dpc_flags, q->q_flag));
DEBUG2(qla2x00_print_scsi_cmd(cmd)); DEBUG2(qla2x00_print_scsi_cmd(cmd));
DEBUG2(qla2x00_print_q_info(q);)
spin_unlock_irq(ha->host->host_lock); spin_unlock_irq(ha->host->host_lock);
/* Blocking call-Does context switching if abort isp is active etc */ /* Blocking call-Does context switching if abort isp is active etc */
...@@ -1200,6 +1196,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -1200,6 +1196,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
} }
spin_unlock_irqrestore(&ha->list_lock, flags); spin_unlock_irqrestore(&ha->list_lock, flags);
/* /*
* Our SP pointer points at the command we want to remove from the * Our SP pointer points at the command we want to remove from the
* pending queue providing we haven't already sent it to the adapter. * pending queue providing we haven't already sent it to the adapter.
...@@ -1250,11 +1247,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -1250,11 +1247,10 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
continue; continue;
DEBUG2(printk("qla2xxx_eh_abort(%ld): aborting sp %p " DEBUG2(printk("qla2xxx_eh_abort(%ld): aborting sp %p "
"from RISC. pid=%ld sp->state=%x\n", "from RISC. pid=%ld sp->state=%x q->q_flag=%lx\n",
ha->host_no, sp, sp->cmd->serial_number, ha->host_no, sp, sp->cmd->serial_number,
sp->state);) sp->state, q->q_flag);)
DEBUG(qla2x00_print_scsi_cmd(cmd);) DEBUG(qla2x00_print_scsi_cmd(cmd);)
DEBUG(qla2x00_print_q_info(q);)
/* Get a reference to the sp and drop the lock.*/ /* Get a reference to the sp and drop the lock.*/
sp_get(ha, sp); sp_get(ha, sp);
...@@ -1303,8 +1299,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -1303,8 +1299,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
DEBUG2(printk("qla2xxx_eh_abort: Exiting. return_status=0x%x.\n", DEBUG2(printk("qla2xxx_eh_abort: Exiting. return_status=0x%x.\n",
return_status)); return_status));
LEAVE("qla2xxx_eh_abort");
return(return_status); return(return_status);
} }
...@@ -1417,10 +1411,6 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) ...@@ -1417,10 +1411,6 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
} }
fcport_to_reset = lq->fclun->fcport; fcport_to_reset = lq->fclun->fcport;
#if STOP_ON_RESET
qla2x00_panic(__func__, ha->host);
#endif
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, b, t, l); "scsi(%ld:%d:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, b, t, l);
...@@ -1570,18 +1560,9 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) ...@@ -1570,18 +1560,9 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
srb_t *sp; srb_t *sp;
int rval = FAILED; int rval = FAILED;
ENTER("qla2xxx_eh_bus_reset");
ha = (scsi_qla_host_t *) cmd->device->host->hostdata; ha = (scsi_qla_host_t *) cmd->device->host->hostdata;
sp = (srb_t *) CMD_SP(cmd); sp = (srb_t *) CMD_SP(cmd);
#if STOP_ON_RESET
printk("Resetting the Bus= 0x%x\n", (int)cmd);
qla2x00_print_scsi_cmd(cmd);
qla2x00_panic("qla2100_reset", ha->host);
#endif
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, "scsi(%ld:%d:%d:%d): LOOP RESET ISSUED.\n", ha->host_no,
cmd->device->channel, cmd->device->id, cmd->device->lun); cmd->device->channel, cmd->device->id, cmd->device->lun);
...@@ -1618,7 +1599,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) ...@@ -1618,7 +1599,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
(rval == FAILED) ? "failed" : "succeded"); (rval == FAILED) ? "failed" : "succeded");
LEAVE("qla2xxx_eh_bus_reset");
return rval; return rval;
} }
...@@ -1643,18 +1623,10 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) ...@@ -1643,18 +1623,10 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
scsi_qla_host_t *ha = (scsi_qla_host_t *)cmd->device->host->hostdata; scsi_qla_host_t *ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
int rval = SUCCESS; int rval = SUCCESS;
ENTER("qla2xxx_eh_host_reset");
/* Display which one we're actually resetting for debug. */ /* Display which one we're actually resetting for debug. */
DEBUG(printk("qla2xxx_eh_host_reset:Resetting scsi(%ld).\n", DEBUG(printk("qla2xxx_eh_host_reset:Resetting scsi(%ld).\n",
ha->host_no)); ha->host_no));
#if STOP_ON_RESET
qla_printk(KERN_INFO, ha, "Host Reset... Command=\n");
qla2x00_print_scsi_cmd(cmd);
qla2x00_panic("qla2xxx_eh_host_reset", ha->host);
#endif
/* /*
* Now issue reset. * Now issue reset.
*/ */
...@@ -1702,7 +1674,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) ...@@ -1702,7 +1674,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
(rval == FAILED) ? "failed" : "succeded"); (rval == FAILED) ? "failed" : "succeded");
LEAVE("qla2xxx_eh_host_reset");
return rval; return rval;
board_disabled: board_disabled:
...@@ -1730,8 +1701,6 @@ qla2x00_loop_reset(scsi_qla_host_t *ha) ...@@ -1730,8 +1701,6 @@ qla2x00_loop_reset(scsi_qla_host_t *ha)
uint16_t t; uint16_t t;
os_tgt_t *tq; os_tgt_t *tq;
ENTER(__func__);
if (ha->flags.enable_lip_reset) { if (ha->flags.enable_lip_reset) {
status = qla2x00_lip_reset(ha); status = qla2x00_lip_reset(ha);
} }
...@@ -1774,8 +1743,6 @@ qla2x00_loop_reset(scsi_qla_host_t *ha) ...@@ -1774,8 +1743,6 @@ qla2x00_loop_reset(scsi_qla_host_t *ha)
ha->host_no);) ha->host_no);)
} }
LEAVE(__func__);
return(status); return(status);
} }
...@@ -1888,15 +1855,29 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) ...@@ -1888,15 +1855,29 @@ qla2x00_iospace_config(scsi_qla_host_t *ha)
unsigned long pio, pio_len, pio_flags; unsigned long pio, pio_len, pio_flags;
unsigned long mmio, mmio_len, mmio_flags; unsigned long mmio, mmio_len, mmio_flags;
/* We only need PIO for Flash operations on ISP2312 v2 chips. */
pio = pci_resource_start(ha->pdev, 0); pio = pci_resource_start(ha->pdev, 0);
pio_len = pci_resource_len(ha->pdev, 0); pio_len = pci_resource_len(ha->pdev, 0);
pio_flags = pci_resource_flags(ha->pdev, 0); pio_flags = pci_resource_flags(ha->pdev, 0);
if (pio_flags & IORESOURCE_IO) {
if (pio_len < MIN_IOBASE_LEN) {
qla_printk(KERN_WARNING, ha,
"Invalid PCI I/O region size (%s)...\n",
ha->pdev->slot_name);
pio = 0;
}
} else {
qla_printk(KERN_WARNING, ha,
"region #0 not a PIO resource (%s)...\n",
ha->pdev->slot_name);
pio = 0;
}
/* Use MMIO operations for all accesses. */
mmio = pci_resource_start(ha->pdev, 1); mmio = pci_resource_start(ha->pdev, 1);
mmio_len = pci_resource_len(ha->pdev, 1); mmio_len = pci_resource_len(ha->pdev, 1);
mmio_flags = pci_resource_flags(ha->pdev, 1); mmio_flags = pci_resource_flags(ha->pdev, 1);
#if MEMORY_MAPPED_IO
if (!(mmio_flags & IORESOURCE_MEM)) { if (!(mmio_flags & IORESOURCE_MEM)) {
qla_printk(KERN_ERR, ha, qla_printk(KERN_ERR, ha,
"region #0 not an MMIO resource (%s), aborting\n", "region #0 not an MMIO resource (%s), aborting\n",
...@@ -1909,20 +1890,6 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) ...@@ -1909,20 +1890,6 @@ qla2x00_iospace_config(scsi_qla_host_t *ha)
ha->pdev->slot_name); ha->pdev->slot_name);
goto iospace_error_exit; goto iospace_error_exit;
} }
#else
if (!(pio_flags & IORESOURCE_IO)) {
qla_printk(KERN_ERR, ha,
"region #0 not a PIO resource (%s), aborting\n",
ha->pdev->slot_name);
goto iospace_error_exit;
}
if (pio_len < MIN_IOBASE_LEN) {
qla_printk(KERN_ERR, ha,
"Invalid PCI I/O region size (%s), aborting\n",
ha->pdev->slot_name);
goto iospace_error_exit;
}
#endif
if (pci_request_regions(ha->pdev, ha->brd_info->drv_name)) { if (pci_request_regions(ha->pdev, ha->brd_info->drv_name)) {
qla_printk(KERN_WARNING, ha, qla_printk(KERN_WARNING, ha,
...@@ -1932,12 +1899,8 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) ...@@ -1932,12 +1899,8 @@ qla2x00_iospace_config(scsi_qla_host_t *ha)
goto iospace_error_exit; goto iospace_error_exit;
} }
/* Assume PIO */
ha->iobase = (device_reg_t *) pio;
ha->pio_address = pio; ha->pio_address = pio;
ha->pio_length = pio_len; ha->pio_length = pio_len;
ha->mmio_address = NULL;
#if MEMORY_MAPPED_IO
ha->mmio_address = ioremap(mmio, MIN_IOBASE_LEN); ha->mmio_address = ioremap(mmio, MIN_IOBASE_LEN);
if (!ha->mmio_address) { if (!ha->mmio_address) {
qla_printk(KERN_ERR, ha, qla_printk(KERN_ERR, ha,
...@@ -1945,9 +1908,8 @@ qla2x00_iospace_config(scsi_qla_host_t *ha) ...@@ -1945,9 +1908,8 @@ qla2x00_iospace_config(scsi_qla_host_t *ha)
goto iospace_error_exit; goto iospace_error_exit;
} }
ha->iobase = (device_reg_t *) ha->mmio_address;
ha->mmio_length = mmio_len; ha->mmio_length = mmio_len;
#endif ha->iobase = (device_reg_t *) ha->mmio_address;
return (0); return (0);
...@@ -2038,6 +2000,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ...@@ -2038,6 +2000,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
/* load the F/W, read paramaters, and init the H/W */ /* load the F/W, read paramaters, and init the H/W */
ha->instance = num_hosts; ha->instance = num_hosts;
init_MUTEX(&ha->mbx_cmd_sem);
init_MUTEX_LOCKED(&ha->mbx_intr_sem); init_MUTEX_LOCKED(&ha->mbx_intr_sem);
INIT_LIST_HEAD(&ha->list); INIT_LIST_HEAD(&ha->list);
...@@ -2054,9 +2017,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ...@@ -2054,9 +2017,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
* higher level "host_lock" will reduce most * higher level "host_lock" will reduce most
* contention for these locks. * contention for these locks.
*/ */
spin_lock_init(&ha->mbx_bits_lock);
spin_lock_init(&ha->mbx_reg_lock); spin_lock_init(&ha->mbx_reg_lock);
spin_lock_init(&ha->mbx_q_lock);
spin_lock_init(&ha->list_lock); spin_lock_init(&ha->list_lock);
init_completion(&ha->dpc_inited); init_completion(&ha->dpc_inited);
...@@ -2130,16 +2091,17 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ...@@ -2130,16 +2091,17 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
WRT_REG_WORD(&reg->hccr, HCCR_CLR_HOST_INT); WRT_REG_WORD(&reg->hccr, HCCR_CLR_HOST_INT);
/* Enable proper parity */ /* Enable proper parity */
if (IS_QLA23XX(ha)) { if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {
if (IS_QLA2312(ha) || IS_QLA2322(ha)) if (IS_QLA2300(ha))
/* SRAM, Instruction RAM and GP RAM parity */
WRT_REG_WORD(&reg->hccr, (HCCR_ENABLE_PARITY + 0x7));
else
/* SRAM parity */ /* SRAM parity */
WRT_REG_WORD(&reg->hccr, (HCCR_ENABLE_PARITY + 0x1)); WRT_REG_WORD(&reg->hccr, (HCCR_ENABLE_PARITY + 0x1));
else
/* SRAM, Instruction RAM and GP RAM parity */
WRT_REG_WORD(&reg->hccr, (HCCR_ENABLE_PARITY + 0x7));
} }
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
/* Enable chip interrupts. */ /* Enable chip interrupts. */
qla2x00_enable_intrs(ha); qla2x00_enable_intrs(ha);
...@@ -2181,7 +2143,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ...@@ -2181,7 +2143,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
qla_printk(KERN_INFO, ha, "\n" qla_printk(KERN_INFO, ha, "\n"
" QLogic ISP2xxx PCI/PCI-X Fibre Channel HBA Driver: %s\n" " QLogic Fibre Channel HBA Driver: %s\n"
" QLogic %s - %s\n" " QLogic %s - %s\n"
" %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str, " %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str,
ha->model_number, ha->model_desc ? ha->model_desc: "", ha->model_number, ha->model_desc ? ha->model_desc: "",
...@@ -2233,7 +2195,7 @@ qla2x00_free_device(scsi_qla_host_t *ha) ...@@ -2233,7 +2195,7 @@ qla2x00_free_device(scsi_qla_host_t *ha)
int ret; int ret;
/* Abort any outstanding IO descriptors. */ /* Abort any outstanding IO descriptors. */
if (IS_QLA23XX(ha)) if (!IS_QLA2100(ha) && !IS_QLA2200(ha))
qla2x00_cancel_io_descriptors(ha); qla2x00_cancel_io_descriptors(ha);
/* turn-off interrupts on the card */ /* turn-off interrupts on the card */
...@@ -2261,6 +2223,7 @@ qla2x00_free_device(scsi_qla_host_t *ha) ...@@ -2261,6 +2223,7 @@ qla2x00_free_device(scsi_qla_host_t *ha)
qla2x00_mem_free(ha); qla2x00_mem_free(ha);
ha->flags.online = FALSE; ha->flags.online = FALSE;
/* Detach interrupts */ /* Detach interrupts */
...@@ -2461,6 +2424,7 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer, ...@@ -2461,6 +2424,7 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,
ha->qthreads, ha->retry_q_cnt, ha->qthreads, ha->retry_q_cnt,
ha->done_q_cnt, ha->scsi_retry_q_cnt); ha->done_q_cnt, ha->scsi_retry_q_cnt);
flags = (unsigned long *) &ha->flags; flags = (unsigned long *) &ha->flags;
if (atomic_read(&ha->loop_state) == LOOP_DOWN) { if (atomic_read(&ha->loop_state) == LOOP_DOWN) {
...@@ -2499,8 +2463,8 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer, ...@@ -2499,8 +2463,8 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,
ha->dropped_frame_error_cnt); ha->dropped_frame_error_cnt);
copy_info(&info, copy_info(&info,
"Info -- pci=%x xchgs=0x%x iocbs=0x%x\n", ha->pci_attr, "Product ID = %04x %04x %04x %04x\n", ha->product_id[0],
ha->xchg_buf_cnt, ha->iocb_buf_cnt); ha->product_id[1], ha->product_id[2], ha->product_id[3]);
copy_info(&info, "\n"); copy_info(&info, "\n");
...@@ -2547,6 +2511,7 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer, ...@@ -2547,6 +2511,7 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,
tq->port_name[2], tq->port_name[3], tq->port_name[2], tq->port_name[3],
tq->port_name[4], tq->port_name[5], tq->port_name[4], tq->port_name[5],
tq->port_name[6], tq->port_name[7]); tq->port_name[6], tq->port_name[7]);
} /* 2.25 node/port display to proc */ } /* 2.25 node/port display to proc */
copy_info(&info, "\nSCSI LUN Information:\n"); copy_info(&info, "\nSCSI LUN Information:\n");
...@@ -2880,13 +2845,7 @@ static uint8_t ...@@ -2880,13 +2845,7 @@ static uint8_t
qla2x00_mem_alloc(scsi_qla_host_t *ha) qla2x00_mem_alloc(scsi_qla_host_t *ha)
{ {
uint8_t status = 1; uint8_t status = 1;
uint8_t i;
int retry= 10; int retry= 10;
mbx_cmdq_t *ptmp;
mbx_cmdq_t *tmp_q_head;
mbx_cmdq_t *tmp_q_tail;
ENTER(__func__);
do { do {
/* /*
...@@ -2962,42 +2921,6 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) ...@@ -2962,42 +2921,6 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
continue; continue;
} }
/*
* Allocate an initial list of mailbox semaphore queue to be
* used for serialization of the mailbox commands.
*/
tmp_q_head = kmalloc(sizeof(mbx_cmdq_t), GFP_KERNEL);
if (tmp_q_head == NULL) {
/* error */
qla_printk(KERN_WARNING, ha,
"Memory Allocation failed - mbx_cmd_q");
qla2x00_mem_free(ha);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10);
continue;
}
memset(tmp_q_head, 0, sizeof(mbx_cmdq_t));
ha->mbx_sem_pool_head = tmp_q_head;
tmp_q_tail = tmp_q_head;
/* Now try to allocate more */
for (i = 1; i < MBQ_INIT_LEN; i++) {
ptmp = kmalloc(sizeof(mbx_cmdq_t), GFP_KERNEL);
if (ptmp == NULL) {
/*
* Error. Just exit. If more is needed later
* they will be allocated at that time.
*/
break;
}
memset(ptmp, 0, sizeof(mbx_cmdq_t));
tmp_q_tail->pnext = ptmp;
tmp_q_tail = ptmp;
}
ha->mbx_sem_pool_tail = tmp_q_tail;
/* Get consistent memory allocated for MS IOCB */ /* Get consistent memory allocated for MS IOCB */
ha->ms_iocb = pci_alloc_consistent(ha->pdev, ha->ms_iocb = pci_alloc_consistent(ha->pdev,
sizeof(ms_iocb_entry_t), &ha->ms_iocb_dma); sizeof(ms_iocb_entry_t), &ha->ms_iocb_dma);
...@@ -3056,8 +2979,6 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) ...@@ -3056,8 +2979,6 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
"%s(): **** FAILED ****\n", __func__); "%s(): **** FAILED ****\n", __func__);
} }
LEAVE(__func__);
return(status); return(status);
} }
...@@ -3076,12 +2997,8 @@ qla2x00_mem_free(scsi_qla_host_t *ha) ...@@ -3076,12 +2997,8 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
fc_port_t *fcport; fc_port_t *fcport;
struct list_head *fcll, *fcltemp; struct list_head *fcll, *fcltemp;
fc_lun_t *fclun; fc_lun_t *fclun;
mbx_cmdq_t *ptmp;
mbx_cmdq_t *tmp_q_head;
unsigned long wtime;/* max wait time if mbx cmd is busy. */ unsigned long wtime;/* max wait time if mbx cmd is busy. */
ENTER(__func__);
if (ha == NULL) { if (ha == NULL) {
/* error */ /* error */
DEBUG2(printk("%s(): ERROR invalid ha pointer.\n", __func__)); DEBUG2(printk("%s(): ERROR invalid ha pointer.\n", __func__));
...@@ -3095,20 +3012,11 @@ qla2x00_mem_free(scsi_qla_host_t *ha) ...@@ -3095,20 +3012,11 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
/* Make sure all other threads are stopped. */ /* Make sure all other threads are stopped. */
wtime = 60 * HZ; wtime = 60 * HZ;
while ((ha->dpc_wait != NULL || ha->mbx_q_head != NULL) && wtime) { while (ha->dpc_wait && wtime) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
wtime = schedule_timeout(wtime); wtime = schedule_timeout(wtime);
} }
/* Now free the mbx sem pool */
tmp_q_head = ha->mbx_sem_pool_head;
while (tmp_q_head != NULL) {
ptmp = tmp_q_head->pnext;
kfree(tmp_q_head);
tmp_q_head = ptmp;
}
ha->mbx_sem_pool_head = NULL;
/* free ioctl memory */ /* free ioctl memory */
qla2x00_free_ioctl_mem(ha); qla2x00_free_ioctl_mem(ha);
...@@ -3183,8 +3091,6 @@ qla2x00_mem_free(scsi_qla_host_t *ha) ...@@ -3183,8 +3091,6 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
ha->fw_dump_reading = 0; ha->fw_dump_reading = 0;
ha->fw_dump_buffer = NULL; ha->fw_dump_buffer = NULL;
} }
LEAVE(__func__);
} }
/* /*
...@@ -3519,6 +3425,7 @@ qla2x00_do_dpc(void *data) ...@@ -3519,6 +3425,7 @@ qla2x00_do_dpc(void *data)
ha->host_no)); ha->host_no));
} }
if (test_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags)) { if (test_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags)) {
DEBUG(printk("scsi(%ld): qla2x00_restart_queues()\n", DEBUG(printk("scsi(%ld): qla2x00_restart_queues()\n",
ha->host_no)); ha->host_no));
...@@ -3591,8 +3498,6 @@ qla2x00_abort_queues(scsi_qla_host_t *ha, uint8_t doneqflg) ...@@ -3591,8 +3498,6 @@ qla2x00_abort_queues(scsi_qla_host_t *ha, uint8_t doneqflg)
struct list_head *list, *temp; struct list_head *list, *temp;
unsigned long flags; unsigned long flags;
ENTER(__func__);
clear_bit(ABORT_QUEUES_NEEDED, &ha->dpc_flags); clear_bit(ABORT_QUEUES_NEEDED, &ha->dpc_flags);
/* Return all commands device queues. */ /* Return all commands device queues. */
...@@ -3612,8 +3517,6 @@ qla2x00_abort_queues(scsi_qla_host_t *ha, uint8_t doneqflg) ...@@ -3612,8 +3517,6 @@ qla2x00_abort_queues(scsi_qla_host_t *ha, uint8_t doneqflg)
__add_to_done_queue(ha, sp); __add_to_done_queue(ha, sp);
} }
spin_unlock_irqrestore(&ha->list_lock, flags); spin_unlock_irqrestore(&ha->list_lock, flags);
LEAVE(__func__);
} }
/* /*
...@@ -3626,8 +3529,6 @@ qla2x00_abort_queues(scsi_qla_host_t *ha, uint8_t doneqflg) ...@@ -3626,8 +3529,6 @@ qla2x00_abort_queues(scsi_qla_host_t *ha, uint8_t doneqflg)
static void static void
qla2x00_rst_aen(scsi_qla_host_t *ha) qla2x00_rst_aen(scsi_qla_host_t *ha)
{ {
ENTER(__func__);
if (ha->flags.online && !ha->flags.reset_active && if (ha->flags.online && !ha->flags.reset_active &&
!atomic_read(&ha->loop_down_timer) && !atomic_read(&ha->loop_down_timer) &&
!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) { !(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) {
...@@ -3646,8 +3547,6 @@ qla2x00_rst_aen(scsi_qla_host_t *ha) ...@@ -3646,8 +3547,6 @@ qla2x00_rst_aen(scsi_qla_host_t *ha)
/* 10/15 ha->flags.reset_active = FALSE; */ /* 10/15 ha->flags.reset_active = FALSE; */
} }
LEAVE(__func__);
} }
...@@ -3692,8 +3591,6 @@ qla2x00_blink_led(scsi_qla_host_t *ha) ...@@ -3692,8 +3591,6 @@ qla2x00_blink_led(scsi_qla_host_t *ha)
unsigned long cpu_flags = 0; unsigned long cpu_flags = 0;
device_reg_t *reg = ha->iobase; device_reg_t *reg = ha->iobase;
ENTER(__func__);
/* Save the Original GPIOE */ /* Save the Original GPIOE */
spin_lock_irqsave(&ha->hardware_lock, cpu_flags); spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
gpio_enable = RD_REG_WORD(&reg->gpioe); gpio_enable = RD_REG_WORD(&reg->gpioe);
...@@ -3737,8 +3634,6 @@ qla2x00_blink_led(scsi_qla_host_t *ha) ...@@ -3737,8 +3634,6 @@ qla2x00_blink_led(scsi_qla_host_t *ha)
spin_lock_irqsave(&ha->hardware_lock, cpu_flags); spin_lock_irqsave(&ha->hardware_lock, cpu_flags);
WRT_REG_WORD(&reg->gpiod,gpio_data); WRT_REG_WORD(&reg->gpiod,gpio_data);
spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags); spin_unlock_irqrestore(&ha->hardware_lock, cpu_flags);
LEAVE(__func__);
} }
/************************************************************************** /**************************************************************************
...@@ -3777,9 +3672,10 @@ qla2x00_timer(scsi_qla_host_t *ha) ...@@ -3777,9 +3672,10 @@ qla2x00_timer(scsi_qla_host_t *ha)
} }
/* Check if beacon LED needs to be blinked */ /* Check if beacon LED needs to be blinked */
if (IS_QLA23XX(ha) && ha->beacon_blink_led) if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && ha->beacon_blink_led)
qla2x00_blink_led(ha); qla2x00_blink_led(ha);
/* /*
* Ports - Port down timer. * Ports - Port down timer.
* *
...@@ -3889,6 +3785,13 @@ qla2x00_timer(scsi_qla_host_t *ha) ...@@ -3889,6 +3785,13 @@ qla2x00_timer(scsi_qla_host_t *ha)
set_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags); set_bit(RESTART_QUEUES_NEEDED, &ha->dpc_flags);
start_dpc++; start_dpc++;
if (!(ha->device_flags & DFLG_NO_CABLE)) {
DEBUG(printk("scsi(%ld): Loop down - "
"aborting ISP.\n",
ha->host_no));
set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
}
} }
DEBUG3(printk("scsi(%ld): Loop Down - seconds remainning %d\n", DEBUG3(printk("scsi(%ld): Loop Down - seconds remainning %d\n",
ha->host_no, ha->host_no,
...@@ -3902,6 +3805,7 @@ qla2x00_timer(scsi_qla_host_t *ha) ...@@ -3902,6 +3805,7 @@ qla2x00_timer(scsi_qla_host_t *ha)
if (!list_empty(&ha->done_queue)) if (!list_empty(&ha->done_queue))
qla2x00_done(ha); qla2x00_done(ha);
/* Schedule the DPC routine if needed */ /* Schedule the DPC routine if needed */
if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) ||
...@@ -4041,7 +3945,6 @@ qla2x00_cmd_timeout(srb_t *sp) ...@@ -4041,7 +3945,6 @@ qla2x00_cmd_timeout(srb_t *sp)
* DID_NO_CONNECT status. Otherwise set the host_byte to * DID_NO_CONNECT status. Otherwise set the host_byte to
* DID_BUS_BUSY to let the OS retry this cmd. * DID_BUS_BUSY to let the OS retry this cmd.
*/ */
if ((atomic_read(&fcport->state) == FCS_DEVICE_DEAD) || if ((atomic_read(&fcport->state) == FCS_DEVICE_DEAD) ||
atomic_read(&dest_ha->loop_state) == LOOP_DEAD) { atomic_read(&dest_ha->loop_state) == LOOP_DEAD) {
qla2x00_extend_timeout(cmd, EXTEND_CMD_TIMEOUT); qla2x00_extend_timeout(cmd, EXTEND_CMD_TIMEOUT);
...@@ -4172,6 +4075,7 @@ qla2x00_done(scsi_qla_host_t *old_ha) ...@@ -4172,6 +4075,7 @@ qla2x00_done(scsi_qla_host_t *old_ha)
} }
} }
switch (host_byte(cmd->result)) { switch (host_byte(cmd->result)) {
case DID_OK: case DID_OK:
case DID_ERROR: case DID_ERROR:
...@@ -4393,7 +4297,7 @@ qla2x00_next(scsi_qla_host_t *vis_ha) ...@@ -4393,7 +4297,7 @@ qla2x00_next(scsi_qla_host_t *vis_ha)
} }
} }
if (IS_QLA23XX(vis_ha)) { if (!IS_QLA2100(vis_ha) && !IS_QLA2200(vis_ha)) {
/* Process response_queue if ZIO support is enabled*/ /* Process response_queue if ZIO support is enabled*/
qla2x00_process_response_queue_in_zio_mode(vis_ha); qla2x00_process_response_queue_in_zio_mode(vis_ha);
...@@ -4401,56 +4305,6 @@ qla2x00_next(scsi_qla_host_t *vis_ha) ...@@ -4401,56 +4305,6 @@ qla2x00_next(scsi_qla_host_t *vis_ha)
} }
/*
* qla2x00_reset_lun_fo_counts
* Reset failover retry counts
*
* Input:
* ha = adapter block pointer.
*
* Context:
* Interrupt context.
*/
void
qla2x00_reset_lun_fo_counts(scsi_qla_host_t *ha, os_lun_t *lq)
{
srb_t *tsp;
os_lun_t *orig_lq;
struct list_head *list;
unsigned long flags ;
spin_lock_irqsave(&ha->list_lock, flags);
/*
* the pending queue.
*/
list_for_each(list,&ha->pending_queue) {
tsp = list_entry(list, srb_t, list);
orig_lq = tsp->lun_queue;
if (orig_lq == lq)
tsp->fo_retry_cnt = 0;
}
/*
* the retry queue.
*/
list_for_each(list,&ha->retry_queue) {
tsp = list_entry(list, srb_t, list);
orig_lq = tsp->lun_queue;
if (orig_lq == lq)
tsp->fo_retry_cnt = 0;
}
/*
* the done queue.
*/
list_for_each(list, &ha->done_queue) {
tsp = list_entry(list, srb_t, list);
orig_lq = tsp->lun_queue;
if (orig_lq == lq)
tsp->fo_retry_cnt = 0;
}
spin_unlock_irqrestore(&ha->list_lock, flags);
}
/************************************************************************** /**************************************************************************
* qla2x00_check_tgt_status * qla2x00_check_tgt_status
* *
...@@ -4549,6 +4403,23 @@ qla2x00_check_port_status(scsi_qla_host_t *ha, fc_port_t *fcport) ...@@ -4549,6 +4403,23 @@ qla2x00_check_port_status(scsi_qla_host_t *ha, fc_port_t *fcport)
return (QLA_SUCCESS); return (QLA_SUCCESS);
} }
/* XXX(hch): crude hack to emulate a down_timeout() */
int
qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
{
const unsigned int step = HZ/10;
do {
if (!down_trylock(sema))
return 0;
set_current_state(TASK_INTERRUPTIBLE);
if (schedule_timeout(step))
break;
} while ((timeout -= step) > 0);
return -ETIMEDOUT;
}
/** /**
* qla2x00_module_init - Module initialization. * qla2x00_module_init - Module initialization.
**/ **/
...@@ -4560,6 +4431,7 @@ qla2x00_module_init(void) ...@@ -4560,6 +4431,7 @@ qla2x00_module_init(void)
#if DEBUG_QLA2100 #if DEBUG_QLA2100
strcat(qla2x00_version_str, "-debug"); strcat(qla2x00_version_str, "-debug");
#endif #endif
/* Allocate cache for SRBs. */ /* Allocate cache for SRBs. */
sprintf(srb_cachep_name, "qla2xxx_srbs"); sprintf(srb_cachep_name, "qla2xxx_srbs");
srb_cachep = kmem_cache_create(srb_cachep_name, sizeof(srb_t), 0, srb_cachep = kmem_cache_create(srb_cachep_name, sizeof(srb_t), 0,
...@@ -4571,8 +4443,7 @@ qla2x00_module_init(void) ...@@ -4571,8 +4443,7 @@ qla2x00_module_init(void)
} }
printk(KERN_INFO printk(KERN_INFO
"QLogic ISP2xxx PCI/PCI-X Fibre Channel HBA Driver (%p)\n", "QLogic Fibre Channel HBA Driver (%p)\n", qla2x00_set_info);
qla2x00_set_info);
return 0; return 0;
} }
...@@ -4598,5 +4469,5 @@ module_init(qla2x00_module_init); ...@@ -4598,5 +4469,5 @@ module_init(qla2x00_module_init);
module_exit(qla2x00_module_exit); module_exit(qla2x00_module_exit);
MODULE_AUTHOR("QLogic Corporation"); MODULE_AUTHOR("QLogic Corporation");
MODULE_DESCRIPTION("QLogic ISP2xxx FC-SCSI Host Bus Adapter driver"); MODULE_DESCRIPTION("QLogic Fibre Channel HBA Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
*/ */
#define DEBUG_QLA2100 0 /* For Debug of qla2x00 */ #define DEBUG_QLA2100 0 /* For Debug of qla2x00 */
#define MEMORY_MAPPED_IO 1
#define STOP_ON_ERROR 0 /* Stop on aborts and resets */
#define STOP_ON_RESET 0 #define STOP_ON_RESET 0
#define USE_ABORT_TGT 1 /* Use Abort Target mbx cmd */ #define USE_ABORT_TGT 1 /* Use Abort Target mbx cmd */
......
...@@ -55,7 +55,7 @@ qla2x00_lock_nvram_access(scsi_qla_host_t *ha) ...@@ -55,7 +55,7 @@ qla2x00_lock_nvram_access(scsi_qla_host_t *ha)
reg = ha->iobase; reg = ha->iobase;
if (IS_QLA2312(ha) || IS_QLA2322(ha)) { if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) {
data = RD_REG_WORD(&reg->nvram); data = RD_REG_WORD(&reg->nvram);
while (data & NVR_BUSY) { while (data & NVR_BUSY) {
udelay(100); udelay(100);
...@@ -87,7 +87,7 @@ qla2x00_unlock_nvram_access(scsi_qla_host_t *ha) ...@@ -87,7 +87,7 @@ qla2x00_unlock_nvram_access(scsi_qla_host_t *ha)
reg = ha->iobase; reg = ha->iobase;
if (IS_QLA2312(ha) || IS_QLA2322(ha)) if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha))
WRT_REG_WORD(&reg->u.isp2300.host_semaphore, 0); WRT_REG_WORD(&reg->u.isp2300.host_semaphore, 0);
} }
...@@ -296,6 +296,7 @@ qla2x00_flash_enable(scsi_qla_host_t *ha) ...@@ -296,6 +296,7 @@ qla2x00_flash_enable(scsi_qla_host_t *ha)
data = RD_REG_WORD(&reg->ctrl_status); data = RD_REG_WORD(&reg->ctrl_status);
data |= CSR_FLASH_ENABLE; data |= CSR_FLASH_ENABLE;
WRT_REG_WORD(&reg->ctrl_status, data); WRT_REG_WORD(&reg->ctrl_status, data);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
} }
/** /**
...@@ -311,6 +312,7 @@ qla2x00_flash_disable(scsi_qla_host_t *ha) ...@@ -311,6 +312,7 @@ qla2x00_flash_disable(scsi_qla_host_t *ha)
data = RD_REG_WORD(&reg->ctrl_status); data = RD_REG_WORD(&reg->ctrl_status);
data &= ~(CSR_FLASH_ENABLE); data &= ~(CSR_FLASH_ENABLE);
WRT_REG_WORD(&reg->ctrl_status, data); WRT_REG_WORD(&reg->ctrl_status, data);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
} }
/** /**
...@@ -334,13 +336,30 @@ qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr) ...@@ -334,13 +336,30 @@ qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr)
if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) { if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
bank_select |= CSR_FLASH_64K_BANK; bank_select |= CSR_FLASH_64K_BANK;
WRT_REG_WORD(&reg->ctrl_status, bank_select); WRT_REG_WORD(&reg->ctrl_status, bank_select);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
} else if (((addr & BIT_16) == 0) && } else if (((addr & BIT_16) == 0) &&
(bank_select & CSR_FLASH_64K_BANK)) { (bank_select & CSR_FLASH_64K_BANK)) {
bank_select &= ~(CSR_FLASH_64K_BANK); bank_select &= ~(CSR_FLASH_64K_BANK);
WRT_REG_WORD(&reg->ctrl_status, bank_select); WRT_REG_WORD(&reg->ctrl_status, bank_select);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
} }
/* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && ha->pio_address) {
uint16_t data2;
reg = (device_reg_t *)ha->pio_address;
outw((uint16_t)addr, (unsigned long)(&reg->flash_address));
do {
data = inw((unsigned long)(&reg->flash_data));
barrier();
cpu_relax();
data2 = inw((unsigned long)(&reg->flash_data));
} while (data != data2);
} else {
WRT_REG_WORD(&reg->flash_address, (uint16_t)addr); WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
data = qla2x00_debounce_register(&reg->flash_data); data = qla2x00_debounce_register(&reg->flash_data);
}
return ((uint8_t)data); return ((uint8_t)data);
} }
...@@ -362,13 +381,25 @@ qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data) ...@@ -362,13 +381,25 @@ qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data)
if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) { if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
bank_select |= CSR_FLASH_64K_BANK; bank_select |= CSR_FLASH_64K_BANK;
WRT_REG_WORD(&reg->ctrl_status, bank_select); WRT_REG_WORD(&reg->ctrl_status, bank_select);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
} else if (((addr & BIT_16) == 0) && } else if (((addr & BIT_16) == 0) &&
(bank_select & CSR_FLASH_64K_BANK)) { (bank_select & CSR_FLASH_64K_BANK)) {
bank_select &= ~(CSR_FLASH_64K_BANK); bank_select &= ~(CSR_FLASH_64K_BANK);
WRT_REG_WORD(&reg->ctrl_status, bank_select); WRT_REG_WORD(&reg->ctrl_status, bank_select);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
} }
/* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && ha->pio_address) {
reg = (device_reg_t *)ha->pio_address;
outw((uint16_t)addr, (unsigned long)(&reg->flash_address));
outw((uint16_t)data, (unsigned long)(&reg->flash_data));
} else {
WRT_REG_WORD(&reg->flash_address, (uint16_t)addr); WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
WRT_REG_WORD(&reg->flash_data, (uint16_t)data); WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
}
} }
/** /**
...@@ -504,7 +535,9 @@ qla2x00_get_flash_version(scsi_qla_host_t *ha) ...@@ -504,7 +535,9 @@ qla2x00_get_flash_version(scsi_qla_host_t *ha)
uint32_t loop_cnt = 1; /* this is for error exit only */ uint32_t loop_cnt = 1; /* this is for error exit only */
uint32_t pcir_adr; uint32_t pcir_adr;
ENTER(__func__); /* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && !ha->pio_address)
ret = QLA_FUNCTION_FAILED;
qla2x00_flash_enable(ha); qla2x00_flash_enable(ha);
do { /* Loop once to provide quick error exit */ do { /* Loop once to provide quick error exit */
...@@ -545,8 +578,6 @@ qla2x00_get_flash_version(scsi_qla_host_t *ha) ...@@ -545,8 +578,6 @@ qla2x00_get_flash_version(scsi_qla_host_t *ha)
} while (--loop_cnt); } while (--loop_cnt);
qla2x00_flash_disable(ha); qla2x00_flash_disable(ha);
LEAVE(__func__);
return (ret); return (ret);
} }
...@@ -569,6 +600,7 @@ qla2x00_get_flash_image(scsi_qla_host_t *ha, uint8_t *image) ...@@ -569,6 +600,7 @@ qla2x00_get_flash_image(scsi_qla_host_t *ha, uint8_t *image)
qla2x00_flash_enable(ha); qla2x00_flash_enable(ha);
WRT_REG_WORD(&reg->nvram, 0); WRT_REG_WORD(&reg->nvram, 0);
RD_REG_WORD(&reg->nvram); /* PCI Posting. */
for (addr = 0, data = image; addr < FLASH_IMAGE_SIZE; addr++, data++) { for (addr = 0, data = image; addr < FLASH_IMAGE_SIZE; addr++, data++) {
if (addr == midpoint) if (addr == midpoint)
WRT_REG_WORD(&reg->nvram, NVR_SELECT); WRT_REG_WORD(&reg->nvram, NVR_SELECT);
...@@ -605,6 +637,7 @@ qla2x00_set_flash_image(scsi_qla_host_t *ha, uint8_t *image) ...@@ -605,6 +637,7 @@ qla2x00_set_flash_image(scsi_qla_host_t *ha, uint8_t *image)
/* Reset ISP chip. */ /* Reset ISP chip. */
WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET); WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
RD_REG_WORD(&reg->ctrl_status); /* PCI Posting. */
qla2x00_flash_enable(ha); qla2x00_flash_enable(ha);
do { /* Loop once to provide quick error exit */ do { /* Loop once to provide quick error exit */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment