From abbd8870b9cb7754a4935826bc9f3c7b029f8b7c Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:30:05 -0700 Subject: [SCSI] qla2xxx: Factor-out ISP specific functions to method-based call tables. Factor-out ISP specific functions to method-based call tables. In anticipation of ISP24xx/ISP25xx support, factor-out ISP specific functions into a method-based call table. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_gbl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 164866b199e6..6bea7ac622c7 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -32,6 +32,17 @@ extern int qla2x00_probe_one(struct pci_dev *, struct qla_board_info *); * Global Function Prototypes in qla_init.c source file. */ extern int qla2x00_initialize_adapter(scsi_qla_host_t *); + +extern int qla2100_pci_config(struct scsi_qla_host *); +extern int qla2300_pci_config(struct scsi_qla_host *); +extern void qla2x00_reset_chip(struct scsi_qla_host *); +extern int qla2x00_chip_diag(struct scsi_qla_host *); +extern void qla2x00_config_rings(struct scsi_qla_host *); +extern void qla2x00_reset_adapter(struct scsi_qla_host *); +extern int qla2x00_nvram_config(struct scsi_qla_host *); +extern void qla2x00_update_fw_options(struct scsi_qla_host *); +extern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *); + extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, int); extern int qla2x00_loop_resync(scsi_qla_host_t *); @@ -205,6 +216,8 @@ extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *); /* * Global Function Prototypes in qla_gs.c source file. */ +extern ms_iocb_entry_t *qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, + uint32_t); extern int qla2x00_ga_nxt(scsi_qla_host_t *, fc_port_t *); extern int qla2x00_gid_pt(scsi_qla_host_t *, sw_info_t *); extern int qla2x00_gpn_id(scsi_qla_host_t *, sw_info_t *); -- cgit v1.2.3 From 6d9b61ed94fd9097f81adfa78d31c4613d9b3ae4 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:30:36 -0700 Subject: [SCSI] qla2xxx: Add ISP24xx diagnostic routines. Add ISP24xx diagnostic routines. Add function and structure definitions for the ISP24xx diagnostic firmware dump routines. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_dbg.c | 949 ++++++++++++++++++++++++++++++++++++++++- drivers/scsi/qla2xxx/qla_dbg.h | 32 ++ drivers/scsi/qla2xxx/qla_gbl.h | 3 + 3 files changed, 983 insertions(+), 1 deletion(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 8e93dd7065a1..80dcc2bac6d6 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -975,7 +975,939 @@ qla_uprintf(char **uiter, char *fmt, ...) return (len); } -//FIXME + +void +qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) +{ + int rval; + uint32_t cnt, timer; + uint32_t risc_address; + uint16_t mb[4]; + + uint32_t stat; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + uint32_t __iomem *dmp_reg; + uint32_t *iter_reg; + uint16_t __iomem *mbx_reg; + unsigned long flags; + struct qla24xx_fw_dump *fw; + uint32_t ext_mem_cnt; + + risc_address = ext_mem_cnt = 0; + memset(mb, 0, sizeof(mb)); + flags = 0; + + if (!hardware_locked) + spin_lock_irqsave(&ha->hardware_lock, flags); + + if (!ha->fw_dump24) { + qla_printk(KERN_WARNING, ha, + "No buffer available for dump!!!\n"); + goto qla24xx_fw_dump_failed; + } + + if (ha->fw_dumped) { + qla_printk(KERN_WARNING, ha, + "Firmware has been previously dumped (%p) -- ignoring " + "request...\n", ha->fw_dump24); + goto qla24xx_fw_dump_failed; + } + fw = (struct qla24xx_fw_dump *) ha->fw_dump24; + + rval = QLA_SUCCESS; + fw->hccr = RD_REG_DWORD(®->hccr); + + /* Pause RISC. */ + if ((fw->hccr & HCCRX_RISC_PAUSE) == 0) { + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_RESET | + HCCRX_CLR_HOST_INT); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE); + for (cnt = 30000; + (RD_REG_DWORD(®->hccr) & HCCRX_RISC_PAUSE) == 0 && + rval == QLA_SUCCESS; cnt--) { + if (cnt) + udelay(100); + else + rval = QLA_FUNCTION_TIMEOUT; + } + } + + /* Disable interrupts. */ + WRT_REG_DWORD(®->ictrl, 0); + RD_REG_DWORD(®->ictrl); + + if (rval == QLA_SUCCESS) { + /* Host interface registers. */ + dmp_reg = (uint32_t __iomem *)(reg + 0); + for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++) + fw->host_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + /* Mailbox registers. */ + mbx_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); + for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) + fw->mailbox_reg[cnt] = RD_REG_WORD(mbx_reg++); + + /* Transfer sequence registers. */ + iter_reg = fw->xseq_gp_reg; + WRT_REG_DWORD(®->iobase_addr, 0xBF00); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBF10); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBF20); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBF30); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBF40); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBF50); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBF60); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBF70); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBFE0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < sizeof(fw->xseq_0_reg) / 4; cnt++) + fw->xseq_0_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xBFF0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++) + fw->xseq_1_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + /* Receive sequence registers. */ + iter_reg = fw->rseq_gp_reg; + WRT_REG_DWORD(®->iobase_addr, 0xFF00); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFF10); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFF20); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFF30); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFF40); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFF50); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFF60); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFF70); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFFD0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < sizeof(fw->rseq_0_reg) / 4; cnt++) + fw->rseq_0_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFFE0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++) + fw->rseq_1_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0xFFF0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++) + fw->rseq_2_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + /* Command DMA registers. */ + WRT_REG_DWORD(®->iobase_addr, 0x7100); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++) + fw->cmd_dma_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + /* Queues. */ + iter_reg = fw->req0_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7200); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 8; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4); + for (cnt = 0; cnt < 7; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + iter_reg = fw->resp0_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7300); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 8; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4); + for (cnt = 0; cnt < 7; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + iter_reg = fw->req1_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7400); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 8; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4); + for (cnt = 0; cnt < 7; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + /* Transmit DMA registers. */ + iter_reg = fw->xmt0_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7600); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x7610); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + iter_reg = fw->xmt1_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7620); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x7630); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + iter_reg = fw->xmt2_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7640); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x7650); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + iter_reg = fw->xmt3_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7660); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x7670); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + iter_reg = fw->xmt4_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7680); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x7690); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x76A0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++) + fw->xmt_data_dma_reg[cnt] = RD_REG_DWORD(dmp_reg++); + + /* Receive DMA registers. */ + iter_reg = fw->rcvt0_data_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7700); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x7710); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + iter_reg = fw->rcvt1_data_dma_reg; + WRT_REG_DWORD(®->iobase_addr, 0x7720); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x7730); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + /* RISC registers. */ + iter_reg = fw->risc_gp_reg; + WRT_REG_DWORD(®->iobase_addr, 0x0F00); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F10); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F20); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F30); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F40); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F50); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F60); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F70); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x0F70); + RD_REG_DWORD(®->iobase_addr); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0); + WRT_REG_DWORD(dmp_reg, 0xB0000000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC); + fw->shadow_reg[0] = RD_REG_DWORD(dmp_reg); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0); + WRT_REG_DWORD(dmp_reg, 0xB0100000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC); + fw->shadow_reg[1] = RD_REG_DWORD(dmp_reg); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0); + WRT_REG_DWORD(dmp_reg, 0xB0200000); + dmp_reg = (uint32_t *)((uint8_t *)reg + 0xFC); + fw->shadow_reg[2] = RD_REG_DWORD(dmp_reg); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0); + WRT_REG_DWORD(dmp_reg, 0xB0300000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC); + fw->shadow_reg[3] = RD_REG_DWORD(dmp_reg); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0); + WRT_REG_DWORD(dmp_reg, 0xB0400000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC); + fw->shadow_reg[4] = RD_REG_DWORD(dmp_reg); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0); + WRT_REG_DWORD(dmp_reg, 0xB0500000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC); + fw->shadow_reg[5] = RD_REG_DWORD(dmp_reg); + + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0); + WRT_REG_DWORD(dmp_reg, 0xB0600000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC); + fw->shadow_reg[6] = RD_REG_DWORD(dmp_reg); + + /* Local memory controller registers. */ + iter_reg = fw->lmc_reg; + WRT_REG_DWORD(®->iobase_addr, 0x3000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x3010); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x3020); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x3030); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x3040); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x3050); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x3060); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + /* Fibre Protocol Module registers. */ + iter_reg = fw->fpm_hdw_reg; + WRT_REG_DWORD(®->iobase_addr, 0x4000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4010); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4020); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4030); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4040); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4050); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4060); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4070); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4080); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x4090); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x40A0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x40B0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + /* Frame Buffer registers. */ + iter_reg = fw->fb_hdw_reg; + WRT_REG_DWORD(®->iobase_addr, 0x6000); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6010); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6020); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6030); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6040); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6100); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6130); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6150); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6170); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x6190); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + WRT_REG_DWORD(®->iobase_addr, 0x61B0); + dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0); + for (cnt = 0; cnt < 16; cnt++) + *iter_reg++ = RD_REG_DWORD(dmp_reg++); + + /* Reset RISC. */ + WRT_REG_DWORD(®->ctrl_status, + CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); + for (cnt = 0; cnt < 30000; cnt++) { + if ((RD_REG_DWORD(®->ctrl_status) & + CSRX_DMA_ACTIVE) == 0) + break; + + udelay(10); + } + + WRT_REG_DWORD(®->ctrl_status, + CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); + udelay(20); + for (cnt = 0; cnt < 30000; cnt++) { + if ((RD_REG_DWORD(®->ctrl_status) & + CSRX_ISP_SOFT_RESET) == 0) + break; + + udelay(10); + } + WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_RESET); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + } + + for (cnt = 30000; RD_REG_WORD(®->mailbox0) != 0 && + rval == QLA_SUCCESS; cnt--) { + if (cnt) + udelay(100); + else + rval = QLA_FUNCTION_TIMEOUT; + } + + /* Memory. */ + if (rval == QLA_SUCCESS) { + /* Code RAM. */ + risc_address = 0x20000; + WRT_REG_WORD(®->mailbox0, MBC_READ_RAM_EXTENDED); + clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); + } + for (cnt = 0; cnt < sizeof(fw->code_ram) / 4 && rval == QLA_SUCCESS; + cnt++, risc_address++) { + WRT_REG_WORD(®->mailbox1, LSW(risc_address)); + WRT_REG_WORD(®->mailbox8, MSW(risc_address)); + RD_REG_WORD(®->mailbox8); + WRT_REG_DWORD(®->hccr, HCCRX_SET_HOST_INT); + + for (timer = 6000000; timer; timer--) { + /* Check for pending interrupts. */ + stat = RD_REG_DWORD(®->host_status); + if (stat & HSRX_RISC_INT) { + stat &= 0xff; + + if (stat == 0x1 || stat == 0x2 || + stat == 0x10 || stat == 0x11) { + set_bit(MBX_INTERRUPT, + &ha->mbx_cmd_flags); + + mb[0] = RD_REG_WORD(®->mailbox0); + mb[2] = RD_REG_WORD(®->mailbox2); + mb[3] = RD_REG_WORD(®->mailbox3); + + WRT_REG_DWORD(®->hccr, + HCCRX_CLR_RISC_INT); + RD_REG_DWORD(®->hccr); + break; + } + + /* Clear this intr; it wasn't a mailbox intr */ + WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT); + RD_REG_DWORD(®->hccr); + } + udelay(5); + } + + if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) { + rval = mb[0] & MBS_MASK; + fw->code_ram[cnt] = (mb[3] << 16) | mb[2]; + } else { + rval = QLA_FUNCTION_FAILED; + } + } + + if (rval == QLA_SUCCESS) { + /* External Memory. */ + risc_address = 0x100000; + ext_mem_cnt = ha->fw_memory_size - 0x100000 + 1; + WRT_REG_WORD(®->mailbox0, MBC_READ_RAM_EXTENDED); + clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); + } + for (cnt = 0; cnt < ext_mem_cnt && rval == QLA_SUCCESS; + cnt++, risc_address++) { + WRT_REG_WORD(®->mailbox1, LSW(risc_address)); + WRT_REG_WORD(®->mailbox8, MSW(risc_address)); + RD_REG_WORD(®->mailbox8); + WRT_REG_DWORD(®->hccr, HCCRX_SET_HOST_INT); + + for (timer = 6000000; timer; timer--) { + /* Check for pending interrupts. */ + stat = RD_REG_DWORD(®->host_status); + if (stat & HSRX_RISC_INT) { + stat &= 0xff; + + if (stat == 0x1 || stat == 0x2 || + stat == 0x10 || stat == 0x11) { + set_bit(MBX_INTERRUPT, + &ha->mbx_cmd_flags); + + mb[0] = RD_REG_WORD(®->mailbox0); + mb[2] = RD_REG_WORD(®->mailbox2); + mb[3] = RD_REG_WORD(®->mailbox3); + + WRT_REG_DWORD(®->hccr, + HCCRX_CLR_RISC_INT); + RD_REG_DWORD(®->hccr); + break; + } + + /* Clear this intr; it wasn't a mailbox intr */ + WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT); + RD_REG_DWORD(®->hccr); + } + udelay(5); + } + + if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) { + rval = mb[0] & MBS_MASK; + fw->ext_mem[cnt] = (mb[3] << 16) | mb[2]; + } else { + rval = QLA_FUNCTION_FAILED; + } + } + + if (rval != QLA_SUCCESS) { + qla_printk(KERN_WARNING, ha, + "Failed to dump firmware (%x)!!!\n", rval); + ha->fw_dumped = 0; + + } else { + qla_printk(KERN_INFO, ha, + "Firmware dump saved to temp buffer (%ld/%p).\n", + ha->host_no, ha->fw_dump24); + ha->fw_dumped = 1; + } + +qla24xx_fw_dump_failed: + if (!hardware_locked) + spin_unlock_irqrestore(&ha->hardware_lock, flags); +} + +void +qla24xx_ascii_fw_dump(scsi_qla_host_t *ha) +{ + uint32_t cnt; + char *uiter; + struct qla24xx_fw_dump *fw; + uint32_t ext_mem_cnt; + + uiter = ha->fw_dump_buffer; + fw = ha->fw_dump24; + + qla_uprintf(&uiter, "ISP FW Version %d.%02d.%02d Attributes %04x\n", + ha->fw_major_version, ha->fw_minor_version, + ha->fw_subminor_version, ha->fw_attributes); + + qla_uprintf(&uiter, "\nHCCR Register\n%04x\n", fw->hccr); + + qla_uprintf(&uiter, "\nHost Interface Registers"); + for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->host_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nMailbox Registers"); + for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->mailbox_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXSEQ GP Registers"); + for (cnt = 0; cnt < sizeof(fw->xseq_gp_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xseq_gp_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXSEQ-0 Registers"); + for (cnt = 0; cnt < sizeof(fw->xseq_0_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xseq_0_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXSEQ-1 Registers"); + for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xseq_1_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRSEQ GP Registers"); + for (cnt = 0; cnt < sizeof(fw->rseq_gp_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->rseq_gp_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRSEQ-0 Registers"); + for (cnt = 0; cnt < sizeof(fw->rseq_0_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->rseq_0_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRSEQ-1 Registers"); + for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->rseq_1_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRSEQ-2 Registers"); + for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->rseq_2_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nCommand DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->cmd_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRequest0 Queue DMA Channel Registers"); + for (cnt = 0; cnt < sizeof(fw->req0_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->req0_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nResponse0 Queue DMA Channel Registers"); + for (cnt = 0; cnt < sizeof(fw->resp0_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->resp0_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRequest1 Queue DMA Channel Registers"); + for (cnt = 0; cnt < sizeof(fw->req1_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->req1_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXMT0 Data DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->xmt0_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xmt0_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXMT1 Data DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->xmt1_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xmt1_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXMT2 Data DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->xmt2_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xmt2_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXMT3 Data DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->xmt3_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xmt3_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXMT4 Data DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->xmt4_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xmt4_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nXMT Data DMA Common Registers"); + for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->xmt_data_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRCV Thread 0 Data DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->rcvt0_data_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->rcvt0_data_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRCV Thread 1 Data DMA Registers"); + for (cnt = 0; cnt < sizeof(fw->rcvt1_data_dma_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->rcvt1_data_dma_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nRISC GP Registers"); + for (cnt = 0; cnt < sizeof(fw->risc_gp_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->risc_gp_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nShadow Registers"); + for (cnt = 0; cnt < sizeof(fw->shadow_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->shadow_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nLMC Registers"); + for (cnt = 0; cnt < sizeof(fw->lmc_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->lmc_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nFPM Hardware Registers"); + for (cnt = 0; cnt < sizeof(fw->fpm_hdw_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->fpm_hdw_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nFB Hardware Registers"); + for (cnt = 0; cnt < sizeof(fw->fb_hdw_reg) / 4; cnt++) { + if (cnt % 8 == 0) + qla_uprintf(&uiter, "\n"); + + qla_uprintf(&uiter, "%08x ", fw->fb_hdw_reg[cnt]); + } + + qla_uprintf(&uiter, "\n\nCode RAM"); + for (cnt = 0; cnt < sizeof (fw->code_ram) / 4; cnt++) { + if (cnt % 8 == 0) { + qla_uprintf(&uiter, "\n%08x: ", cnt + 0x20000); + } + qla_uprintf(&uiter, "%08x ", fw->code_ram[cnt]); + } + + qla_uprintf(&uiter, "\n\nExternal Memory"); + ext_mem_cnt = ha->fw_memory_size - 0x100000 + 1; + for (cnt = 0; cnt < ext_mem_cnt; cnt++) { + if (cnt % 8 == 0) { + qla_uprintf(&uiter, "\n%08x: ", cnt + 0x100000); + } + qla_uprintf(&uiter, "%08x ", fw->ext_mem[cnt]); + } + + qla_uprintf(&uiter, "\n[<==END] ISP Debug Dump"); +} + /****************************************************************************/ /* Driver Debug Functions. */ @@ -1066,6 +1998,21 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd) printk(" state=%d\n", sp->state); } +void +qla2x00_dump_pkt(void *pkt) +{ + uint32_t i; + uint8_t *data = (uint8_t *) pkt; + + for (i = 0; i < 64; i++) { + if (!(i % 4)) + printk("\n%02x: ", i); + + printk("%02x ", data[i]); + } + printk("\n"); +} + #if defined(QL_DEBUG_ROUTINES) /* * qla2x00_formatted_dump_buffer diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index d7f56c761418..eaa0f0f0851a 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -230,4 +230,36 @@ struct qla2100_fw_dump { uint16_t risc_ram[0xf000]; }; +#define FW_DUMP_SIZE_24XX 0x2B0000 +struct qla24xx_fw_dump { + uint32_t hccr; + uint32_t host_reg[32]; + uint16_t mailbox_reg[32]; + uint32_t xseq_gp_reg[128]; + uint32_t xseq_0_reg[16]; + uint32_t xseq_1_reg[16]; + uint32_t rseq_gp_reg[128]; + uint32_t rseq_0_reg[16]; + uint32_t rseq_1_reg[16]; + uint32_t rseq_2_reg[16]; + uint32_t cmd_dma_reg[16]; + uint32_t req0_dma_reg[15]; + uint32_t resp0_dma_reg[15]; + uint32_t req1_dma_reg[15]; + uint32_t xmt0_dma_reg[32]; + uint32_t xmt1_dma_reg[32]; + uint32_t xmt2_dma_reg[32]; + uint32_t xmt3_dma_reg[32]; + uint32_t xmt4_dma_reg[32]; + uint32_t xmt_data_dma_reg[16]; + uint32_t rcvt0_data_dma_reg[32]; + uint32_t rcvt1_data_dma_reg[32]; + uint32_t risc_gp_reg[128]; + uint32_t shadow_reg[7]; + uint32_t lmc_reg[112]; + uint32_t fpm_hdw_reg[192]; + uint32_t fb_hdw_reg[176]; + uint32_t code_ram[0x2000]; + uint32_t ext_mem[1]; +}; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 6bea7ac622c7..ba648f69f2f5 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -207,11 +207,14 @@ extern void qla2x00_write_nvram_word(scsi_qla_host_t *, uint32_t, uint16_t); */ extern void qla2100_fw_dump(scsi_qla_host_t *, int); extern void qla2300_fw_dump(scsi_qla_host_t *, int); +extern void qla24xx_fw_dump(scsi_qla_host_t *, int); extern void qla2100_ascii_fw_dump(scsi_qla_host_t *); extern void qla2300_ascii_fw_dump(scsi_qla_host_t *); +extern void qla24xx_ascii_fw_dump(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_print_scsi_cmd(struct scsi_cmnd *); +extern void qla2x00_dump_pkt(void *); /* * Global Function Prototypes in qla_gs.c source file. -- cgit v1.2.3 From 8c958a99d6a903ce4ffaa6780f3425a8567db9e6 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:30:47 -0700 Subject: [SCSI] qla2xxx: Generalize SNS generic-services routines. Generalize SNS generic-services routines. Consolidate completion-status checking while adding support for the ISP24xx. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_def.h | 3 +- drivers/scsi/qla2xxx/qla_gbl.h | 4 +- drivers/scsi/qla2xxx/qla_gs.c | 181 +++++++++++++++++++++++++---------------- drivers/scsi/qla2xxx/qla_mbx.c | 6 +- 4 files changed, 121 insertions(+), 73 deletions(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 03074e52160f..61c2d4fb91a9 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2032,8 +2032,7 @@ struct isp_operations { uint16_t (*calc_req_entries) (uint16_t); void (*build_iocbs) (srb_t *, cmd_entry_t *, uint16_t); - ms_iocb_entry_t * (*prep_ms_iocb) (struct scsi_qla_host *, uint32_t, - uint32_t); + void * (*prep_ms_iocb) (struct scsi_qla_host *, uint32_t, uint32_t); uint8_t * (*read_nvram) (struct scsi_qla_host *, uint8_t *, uint32_t, uint32_t); diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index ba648f69f2f5..eedb5bdec3b9 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -219,8 +219,8 @@ extern void qla2x00_dump_pkt(void *); /* * Global Function Prototypes in qla_gs.c source file. */ -extern ms_iocb_entry_t *qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, - uint32_t); +extern void *qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, uint32_t); +extern void *qla24xx_prep_ms_iocb(scsi_qla_host_t *, uint32_t, uint32_t); extern int qla2x00_ga_nxt(scsi_qla_host_t *, fc_port_t *); extern int qla2x00_gid_pt(scsi_qla_host_t *, sw_info_t *); extern int qla2x00_gpn_id(scsi_qla_host_t *, sw_info_t *); diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 644c56431366..ec5ecbfbc1f6 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -32,14 +32,14 @@ static int qla2x00_sns_rft_id(scsi_qla_host_t *); static int qla2x00_sns_rnn_id(scsi_qla_host_t *); /** - * qla2x00_prep_ms_iocb() - Prepare common MS IOCB fields for SNS CT query. + * qla2x00_prep_ms_iocb() - Prepare common MS/CT IOCB fields for SNS CT query. * @ha: HA context * @req_size: request size in bytes * @rsp_size: response size in bytes * * Returns a pointer to the @ha's ms_iocb. */ -ms_iocb_entry_t * +void * qla2x00_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size) { ms_iocb_entry_t *ms_pkt; @@ -68,6 +68,42 @@ qla2x00_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size) return (ms_pkt); } +/** + * qla24xx_prep_ms_iocb() - Prepare common CT IOCB fields for SNS CT query. + * @ha: HA context + * @req_size: request size in bytes + * @rsp_size: response size in bytes + * + * Returns a pointer to the @ha's ms_iocb. + */ +void * +qla24xx_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size) +{ + struct ct_entry_24xx *ct_pkt; + + ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb; + memset(ct_pkt, 0, sizeof(struct ct_entry_24xx)); + + ct_pkt->entry_type = CT_IOCB_TYPE; + ct_pkt->entry_count = 1; + ct_pkt->nport_handle = __constant_cpu_to_le16(NPH_SNS); + ct_pkt->timeout = __constant_cpu_to_le16(25); + ct_pkt->cmd_dsd_count = __constant_cpu_to_le16(1); + ct_pkt->rsp_dsd_count = __constant_cpu_to_le16(1); + ct_pkt->rsp_byte_count = cpu_to_le32(rsp_size); + ct_pkt->cmd_byte_count = cpu_to_le32(req_size); + + ct_pkt->dseg_0_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma)); + ct_pkt->dseg_0_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma)); + ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count; + + ct_pkt->dseg_1_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma)); + ct_pkt->dseg_1_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma)); + ct_pkt->dseg_1_len = ct_pkt->rsp_byte_count; + + return (ct_pkt); +} + /** * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query. * @ct_req: CT request buffer @@ -90,6 +126,47 @@ qla2x00_prep_ct_req(struct ct_sns_req *ct_req, uint16_t cmd, uint16_t rsp_size) return (ct_req); } +static int +qla2x00_chk_ms_status(scsi_qla_host_t *ha, ms_iocb_entry_t *ms_pkt, + struct ct_sns_rsp *ct_rsp, const char *routine) +{ + int rval; + uint16_t comp_status; + + rval = QLA_FUNCTION_FAILED; + if (ms_pkt->entry_status != 0) { + DEBUG2_3(printk("scsi(%ld): %s failed, error status (%x).\n", + ha->host_no, routine, ms_pkt->entry_status)); + } else { + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + comp_status = + ((struct ct_entry_24xx *)ms_pkt)->comp_status; + else + comp_status = le16_to_cpu(ms_pkt->status); + switch (comp_status) { + case CS_COMPLETE: + case CS_DATA_UNDERRUN: + case CS_DATA_OVERRUN: /* Overrun? */ + if (ct_rsp->header.response != + __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { + DEBUG2_3(printk("scsi(%ld): %s failed, " + "rejected request:\n", ha->host_no, + routine)); + DEBUG2_3(qla2x00_dump_buffer( + (uint8_t *)&ct_rsp->header, + sizeof(struct ct_rsp_hdr))); + } else + rval = QLA_SUCCESS; + break; + default: + DEBUG2_3(printk("scsi(%ld): %s failed, completion " + "status (%x).\n", ha->host_no, routine, + comp_status)); + break; + } + } + return rval; +} /** * qla2x00_ga_nxt() - SNS scan for fabric devices via GA_NXT command. @@ -113,7 +190,7 @@ qla2x00_ga_nxt(scsi_qla_host_t *ha, fc_port_t *fcport) /* Issue GA_NXT */ /* Prepare common MS IOCB */ - ms_pkt = qla2x00_prep_ms_iocb(ha, GA_NXT_REQ_SIZE, GA_NXT_RSP_SIZE); + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GA_NXT_REQ_SIZE, GA_NXT_RSP_SIZE); /* Prepare CT request */ ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GA_NXT_CMD, @@ -132,12 +209,8 @@ qla2x00_ga_nxt(scsi_qla_host_t *ha, fc_port_t *fcport) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): GA_NXT issue IOCB failed (%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): GA_NXT failed, rejected request, " - "ga_nxt_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "GA_NXT") != + QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { /* Populate fc_port_t entry. */ @@ -203,7 +276,7 @@ qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list) /* Issue GID_PT */ /* Prepare common MS IOCB */ - ms_pkt = qla2x00_prep_ms_iocb(ha, GID_PT_REQ_SIZE, GID_PT_RSP_SIZE); + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GID_PT_REQ_SIZE, GID_PT_RSP_SIZE); /* Prepare CT request */ ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GID_PT_CMD, @@ -220,12 +293,8 @@ qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): GID_PT issue IOCB failed (%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): GID_PT failed, rejected request, " - "gid_pt_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "GID_PT") != + QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { /* Set port IDs in switch info list. */ @@ -279,7 +348,7 @@ qla2x00_gpn_id(scsi_qla_host_t *ha, sw_info_t *list) for (i = 0; i < MAX_FIBRE_DEVICES; i++) { /* Issue GPN_ID */ /* Prepare common MS IOCB */ - ms_pkt = qla2x00_prep_ms_iocb(ha, GPN_ID_REQ_SIZE, + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GPN_ID_REQ_SIZE, GPN_ID_RSP_SIZE); /* Prepare CT request */ @@ -299,12 +368,8 @@ qla2x00_gpn_id(scsi_qla_host_t *ha, sw_info_t *list) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): GPN_ID issue IOCB failed " "(%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): GPN_ID failed, rejected " - "request, gpn_id_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, + "GPN_ID") != QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { /* Save portname */ @@ -344,7 +409,7 @@ qla2x00_gnn_id(scsi_qla_host_t *ha, sw_info_t *list) for (i = 0; i < MAX_FIBRE_DEVICES; i++) { /* Issue GNN_ID */ /* Prepare common MS IOCB */ - ms_pkt = qla2x00_prep_ms_iocb(ha, GNN_ID_REQ_SIZE, + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GNN_ID_REQ_SIZE, GNN_ID_RSP_SIZE); /* Prepare CT request */ @@ -364,12 +429,8 @@ qla2x00_gnn_id(scsi_qla_host_t *ha, sw_info_t *list) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): GNN_ID issue IOCB failed " "(%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): GNN_ID failed, rejected " - "request, gnn_id_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, + "GNN_ID") != QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { /* Save nodename */ @@ -422,7 +483,7 @@ qla2x00_rft_id(scsi_qla_host_t *ha) /* Issue RFT_ID */ /* Prepare common MS IOCB */ - ms_pkt = qla2x00_prep_ms_iocb(ha, RFT_ID_REQ_SIZE, RFT_ID_RSP_SIZE); + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RFT_ID_REQ_SIZE, RFT_ID_RSP_SIZE); /* Prepare CT request */ ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFT_ID_CMD, @@ -443,12 +504,8 @@ qla2x00_rft_id(scsi_qla_host_t *ha) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): RFT_ID issue IOCB failed (%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): RFT_ID failed, rejected " - "request, rft_id_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RFT_ID") != + QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n", @@ -481,7 +538,7 @@ qla2x00_rff_id(scsi_qla_host_t *ha) /* Issue RFF_ID */ /* Prepare common MS IOCB */ - ms_pkt = qla2x00_prep_ms_iocb(ha, RFF_ID_REQ_SIZE, RFF_ID_RSP_SIZE); + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RFF_ID_REQ_SIZE, RFF_ID_RSP_SIZE); /* Prepare CT request */ ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFF_ID_CMD, @@ -502,12 +559,8 @@ qla2x00_rff_id(scsi_qla_host_t *ha) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): RFF_ID issue IOCB failed (%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): RFF_ID failed, rejected " - "request, rff_id_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RFF_ID") != + QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { DEBUG2(printk("scsi(%ld): RFF_ID exiting normally.\n", @@ -538,7 +591,7 @@ qla2x00_rnn_id(scsi_qla_host_t *ha) /* Issue RNN_ID */ /* Prepare common MS IOCB */ - ms_pkt = qla2x00_prep_ms_iocb(ha, RNN_ID_REQ_SIZE, RNN_ID_RSP_SIZE); + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RNN_ID_REQ_SIZE, RNN_ID_RSP_SIZE); /* Prepare CT request */ ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RNN_ID_CMD, @@ -550,7 +603,7 @@ qla2x00_rnn_id(scsi_qla_host_t *ha) ct_req->req.rnn_id.port_id[1] = ha->d_id.b.area; ct_req->req.rnn_id.port_id[2] = ha->d_id.b.al_pa; - memcpy(ct_req->req.rnn_id.node_name, ha->init_cb->node_name, WWN_SIZE); + memcpy(ct_req->req.rnn_id.node_name, ha->node_name, WWN_SIZE); /* Execute MS IOCB */ rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma, @@ -559,12 +612,8 @@ qla2x00_rnn_id(scsi_qla_host_t *ha) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): RNN_ID issue IOCB failed (%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): RNN_ID failed, rejected " - "request, rnn_id_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RNN_ID") != + QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n", @@ -600,7 +649,7 @@ qla2x00_rsnn_nn(scsi_qla_host_t *ha) /* Issue RSNN_NN */ /* Prepare common MS IOCB */ /* Request size adjusted after CT preparation */ - ms_pkt = qla2x00_prep_ms_iocb(ha, 0, RSNN_NN_RSP_SIZE); + ms_pkt = ha->isp_ops.prep_ms_iocb(ha, 0, RSNN_NN_RSP_SIZE); /* Prepare CT request */ ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RSNN_NN_CMD, @@ -608,7 +657,7 @@ qla2x00_rsnn_nn(scsi_qla_host_t *ha) ct_rsp = &ha->ct_sns->p.rsp; /* Prepare CT arguments -- node_name, symbolic node_name, size */ - memcpy(ct_req->req.rsnn_nn.node_name, ha->init_cb->node_name, WWN_SIZE); + memcpy(ct_req->req.rsnn_nn.node_name, ha->node_name, WWN_SIZE); /* Prepare the Symbolic Node Name */ /* Board type */ @@ -638,12 +687,8 @@ qla2x00_rsnn_nn(scsi_qla_host_t *ha) /*EMPTY*/ DEBUG2_3(printk("scsi(%ld): RSNN_NN issue IOCB failed (%d).\n", ha->host_no, rval)); - } else if (ct_rsp->header.response != - __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { - DEBUG2_3(printk("scsi(%ld): RSNN_NN failed, rejected " - "request, rsnn_id_rsp:\n", ha->host_no)); - DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header, - sizeof(struct ct_rsp_hdr))); + } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RSNN_NN") != + QLA_SUCCESS) { rval = QLA_FUNCTION_FAILED; } else { DEBUG2(printk("scsi(%ld): RSNN_NN exiting normally.\n", @@ -1025,14 +1070,14 @@ qla2x00_sns_rnn_id(scsi_qla_host_t *ha) sns_cmd->p.cmd.param[1] = ha->d_id.b.area; sns_cmd->p.cmd.param[2] = ha->d_id.b.domain; - sns_cmd->p.cmd.param[4] = ha->init_cb->node_name[7]; - sns_cmd->p.cmd.param[5] = ha->init_cb->node_name[6]; - sns_cmd->p.cmd.param[6] = ha->init_cb->node_name[5]; - sns_cmd->p.cmd.param[7] = ha->init_cb->node_name[4]; - sns_cmd->p.cmd.param[8] = ha->init_cb->node_name[3]; - sns_cmd->p.cmd.param[9] = ha->init_cb->node_name[2]; - sns_cmd->p.cmd.param[10] = ha->init_cb->node_name[1]; - sns_cmd->p.cmd.param[11] = ha->init_cb->node_name[0]; + sns_cmd->p.cmd.param[4] = ha->node_name[7]; + sns_cmd->p.cmd.param[5] = ha->node_name[6]; + sns_cmd->p.cmd.param[6] = ha->node_name[5]; + sns_cmd->p.cmd.param[7] = ha->node_name[4]; + sns_cmd->p.cmd.param[8] = ha->node_name[3]; + sns_cmd->p.cmd.param[9] = ha->node_name[2]; + sns_cmd->p.cmd.param[10] = ha->node_name[1]; + sns_cmd->p.cmd.param[11] = ha->node_name[0]; /* Execute SNS command. */ rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, RNN_ID_SNS_CMD_SIZE / 2, diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index b201971ff28e..f3720fa0adbf 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -822,7 +822,11 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr, DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x", ha->host_no,rval);) } else { - /*EMPTY*/ + sts_entry_t *sts_entry = (sts_entry_t *) buffer; + + /* Mask reserved bits. */ + sts_entry->entry_status &= + IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RF_MASK_24XX :RF_MASK; } return rval; -- cgit v1.2.3 From 1c7c63574ff3e568ca374e9f05e30b8d7d64273e Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:30:57 -0700 Subject: [SCSI] qla2xxx: Add MBX command routines for ISP24xx support. Add MBX command routines for ISP24xx support. Generalize several routines [qla2x00_load_ram_ext(), qla2x00_execute_fw(), qla2x00_verify_checksum()] to handle larger addressing space. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_def.h | 3 +- drivers/scsi/qla2xxx/qla_gbl.h | 28 +- drivers/scsi/qla2xxx/qla_init.c | 33 +- drivers/scsi/qla2xxx/qla_mbx.c | 984 ++++++++++++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_os.c | 5 +- 5 files changed, 809 insertions(+), 244 deletions(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 61c2d4fb91a9..0f122845bfcf 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2028,7 +2028,8 @@ struct isp_operations { int (*abort_target) (struct fc_port *); int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t, uint8_t, uint8_t, uint16_t *, uint8_t); - int (*fabric_logout) (struct scsi_qla_host *, uint16_t); + int (*fabric_logout) (struct scsi_qla_host *, uint16_t, uint8_t, + uint8_t, uint8_t); uint16_t (*calc_req_entries) (uint16_t); void (*build_iocbs) (srb_t *, cmd_entry_t *, uint16_t); diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index eedb5bdec3b9..574446c0892a 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -104,10 +104,10 @@ extern int qla2x00_load_ram(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t); extern int -qla2x00_load_ram_ext(scsi_qla_host_t *, dma_addr_t, uint32_t, uint16_t); +qla2x00_load_ram_ext(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t); extern int -qla2x00_execute_fw(scsi_qla_host_t *); +qla2x00_execute_fw(scsi_qla_host_t *, uint32_t); extern void qla2x00_get_fw_version(scsi_qla_host_t *, uint16_t *, @@ -123,7 +123,7 @@ extern int qla2x00_mbx_reg_test(scsi_qla_host_t *); extern int -qla2x00_verify_checksum(scsi_qla_host_t *); +qla2x00_verify_checksum(scsi_qla_host_t *, uint32_t); extern int qla2x00_issue_iocb(scsi_qla_host_t *, void *, dma_addr_t, size_t); @@ -133,7 +133,7 @@ qla2x00_abort_command(scsi_qla_host_t *, srb_t *); #if USE_ABORT_TGT extern int -qla2x00_abort_target(fc_port_t *fcport); +qla2x00_abort_target(fc_port_t *); #endif extern int @@ -167,12 +167,18 @@ qla2x00_send_sns(scsi_qla_host_t *, dma_addr_t, uint16_t, size_t); extern int qla2x00_login_fabric(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t, uint16_t *, uint8_t); +extern int +qla24xx_login_fabric(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t, + uint16_t *, uint8_t); extern int qla2x00_login_local_device(scsi_qla_host_t *, uint16_t, uint16_t *, uint8_t); extern int -qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id); +qla2x00_fabric_logout(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t); + +extern int +qla24xx_fabric_logout(scsi_qla_host_t *, uint16_t, uint8_t, uint8_t, uint8_t); extern int qla2x00_full_login_lip(scsi_qla_host_t *ha); @@ -187,6 +193,18 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t *, extern int qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); +extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *); +extern int qla24xx_abort_target(fc_port_t *); + +extern int qla2x00_system_error(scsi_qla_host_t *); + +extern int +qla2x00_get_serdes_params(scsi_qla_host_t *, uint16_t *, uint16_t *, + uint16_t *); + +extern int +qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t); + /* * Global Function Prototypes in qla_isr.c source file. */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 226bec05d4d1..b0419661981e 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -331,7 +331,9 @@ qla2x00_isp_firmware(scsi_qla_host_t *ha) qla_printk(KERN_INFO, ha, "RISC CODE NOT loaded\n"); /* Verify checksum of loaded RISC code. */ - rval = qla2x00_verify_checksum(ha); + rval = qla2x00_verify_checksum(ha, + IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RISC_SADDRESS : + *ha->brd_info->fw_info[0].fwstart); } if (rval) { @@ -756,13 +758,17 @@ qla2x00_setup_chip(scsi_qla_host_t *ha) DEBUG(printk("scsi(%ld): Verifying Checksum of loaded RISC " "code.\n", ha->host_no)); - rval = qla2x00_verify_checksum(ha); + rval = qla2x00_verify_checksum(ha, + IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RISC_SADDRESS : + *ha->brd_info->fw_info[0].fwstart); if (rval == QLA_SUCCESS) { /* Start firmware execution. */ DEBUG(printk("scsi(%ld): Checksum OK, start " "firmware.\n", ha->host_no)); - rval = qla2x00_execute_fw(ha); + rval = qla2x00_execute_fw(ha, + IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RISC_SADDRESS : + *ha->brd_info->fw_info[0].fwstart); /* Retrieve firmware information. */ if (rval == QLA_SUCCESS && ha->fw_major_version == 0) { qla2x00_get_fw_version(ha, @@ -2011,7 +2017,10 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) fcport->port_type != FCT_BROADCAST) { ha->isp_ops.fabric_logout(ha, - fcport->loop_id); + fcport->loop_id, + fcport->d_id.b.domain, + fcport->d_id.b.area, + fcport->d_id.b.al_pa); fcport->loop_id = FC_NO_LOOP_ID; } } @@ -2256,7 +2265,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) (fcport->flags & FCF_TAPE_PRESENT) == 0 && fcport->port_type != FCT_INITIATOR && fcport->port_type != FCT_BROADCAST) { - ha->isp_ops.fabric_logout(ha, fcport->loop_id); + ha->isp_ops.fabric_logout(ha, fcport->loop_id, + fcport->d_id.b.domain, fcport->d_id.b.area, + fcport->d_id.b.al_pa); fcport->loop_id = FC_NO_LOOP_ID; } @@ -2515,7 +2526,9 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *ha, fc_port_t *fcport, if (rval == QLA_SUCCESS) { rval = qla2x00_get_port_database(ha, fcport, 0); if (rval != QLA_SUCCESS) { - ha->isp_ops.fabric_logout(ha, fcport->loop_id); + ha->isp_ops.fabric_logout(ha, fcport->loop_id, + fcport->d_id.b.domain, fcport->d_id.b.area, + fcport->d_id.b.al_pa); } else { qla2x00_update_fcport(ha, fcport); } @@ -2620,7 +2633,9 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport, * dead. */ *next_loopid = fcport->loop_id; - ha->isp_ops.fabric_logout(ha, fcport->loop_id); + ha->isp_ops.fabric_logout(ha, fcport->loop_id, + fcport->d_id.b.domain, fcport->d_id.b.area, + fcport->d_id.b.al_pa); qla2x00_mark_device_lost(ha, fcport, 1); rval = 1; @@ -2636,7 +2651,9 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport, fcport->d_id.b.al_pa, fcport->loop_id, jiffies)); *next_loopid = fcport->loop_id; - ha->isp_ops.fabric_logout(ha, fcport->loop_id); + ha->isp_ops.fabric_logout(ha, fcport->loop_id, + fcport->d_id.b.domain, fcport->d_id.b.area, + fcport->d_id.b.al_pa); fcport->loop_id = FC_NO_LOOP_ID; atomic_set(&fcport->state, FCS_DEVICE_DEAD); diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index f3720fa0adbf..ab361be003d3 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -58,9 +58,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) { int rval; unsigned long flags = 0; - struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; + device_reg_t __iomem *reg = ha->iobase; struct timer_list tmp_intr_timer; - uint8_t abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); + uint8_t abort_active; uint8_t io_lock_on = ha->flags.init_done; uint16_t command; uint16_t *iptr; @@ -71,19 +71,20 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) unsigned long wait_time; rval = QLA_SUCCESS; + abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) - DEBUG11(printk("qla2x00_mailbox_command(%ld): entered.\n", - ha->host_no);) /* - * Wait for active mailbox commands to finish by waiting at most - * tov seconds. This is to serialize actual issuing of mailbox cmds - * during non ISP abort time. + * Wait for active mailbox commands to finish by waiting at most tov + * seconds. This is to serialize actual issuing of mailbox cmds during + * non ISP abort time. */ if (!abort_active) { if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) { /* Timeout occurred. Return error. */ - DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): cmd " - "access timeout. Exiting.\n", ha->host_no);) + DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " + "Exiting.\n", __func__, ha->host_no);) return QLA_FUNCTION_TIMEOUT; } } @@ -96,13 +97,16 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) if (!abort_active) spin_lock_irqsave(&ha->mbx_reg_lock, mbx_flags); - DEBUG11(printk("scsi%d: prepare to issue mbox cmd=0x%x.\n", - (int)ha->host_no, mcp->mb[0]);) + DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n", + ha->host_no, mcp->mb[0]);) spin_lock_irqsave(&ha->hardware_lock, flags); /* Load mailbox registers. */ - optr = (uint16_t __iomem *)MAILBOX_REG(ha, reg, 0); + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + optr = (uint16_t __iomem *)®->isp24.mailbox0; + else + optr = (uint16_t __iomem *)MAILBOX_REG(ha, ®->isp, 0); iptr = mcp->mb; command = mcp->mb[0]; @@ -110,7 +114,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) for (cnt = 0; cnt < ha->mbx_count; cnt++) { if (IS_QLA2200(ha) && cnt == 8) - optr = (uint16_t __iomem *)MAILBOX_REG(ha, reg, 8); + optr = + (uint16_t __iomem *)MAILBOX_REG(ha, ®->isp, 8); if (mboxes & BIT_0) WRT_REG_WORD(optr, *iptr); @@ -120,16 +125,15 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) } #if defined(QL_DEBUG_LEVEL_1) - printk("qla2x00_mailbox_command: Loaded MBX registers " - "(displayed in bytes) = \n"); + printk("%s(%ld): Loaded MBX registers (displayed in bytes) = \n", + __func__, ha->host_no); qla2x00_dump_buffer((uint8_t *)mcp->mb, 16); printk("\n"); qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x10), 16); printk("\n"); qla2x00_dump_buffer(((uint8_t *)mcp->mb + 0x20), 8); printk("\n"); - printk("qla2x00_mailbox_command: I/O address = %lx.\n", - (u_long)optr); + printk("%s(%ld): I/O address = %p.\n", __func__, ha->host_no, optr); qla2x00_dump_regs(ha); #endif @@ -138,17 +142,15 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); /* Unlock mbx registers and wait for interrupt */ - - DEBUG11(printk("qla2x00_mailbox_command: going to unlock irq & " - "waiting for interrupt. jiffies=%lx.\n", jiffies);) + DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. " + "jiffies=%lx.\n", __func__, ha->host_no, jiffies);) /* Wait for mbx cmd completion until timeout */ if (!abort_active && io_lock_on) { /* sleep on completion semaphore */ - DEBUG11(printk("qla2x00_mailbox_command(%ld): " - "INTERRUPT MODE. Initializing timer.\n", - ha->host_no);) + DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n", + __func__, ha->host_no);) init_timer(&tmp_intr_timer); tmp_intr_timer.data = (unsigned long)&ha->mbx_intr_sem; @@ -156,16 +158,19 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) tmp_intr_timer.function = (void (*)(unsigned long))qla2x00_mbx_sem_timeout; - DEBUG11(printk("qla2x00_mailbox_command(%ld): " - "Adding timer.\n", ha->host_no);) + DEBUG11(printk("%s(%ld): Adding timer.\n", __func__, + ha->host_no);) add_timer(&tmp_intr_timer); - DEBUG11(printk("qla2x00_mailbox_command: going to " - "unlock & sleep. time=0x%lx.\n", jiffies);) + DEBUG11(printk("%s(%ld): going to unlock & sleep. " + "time=0x%lx.\n", __func__, ha->host_no, jiffies);) set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); - WRT_REG_WORD(®->hccr, HCCR_SET_HOST_INT); + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + WRT_REG_DWORD(®->isp24.hccr, HCCRX_SET_HOST_INT); + else + WRT_REG_WORD(®->isp.hccr, HCCR_SET_HOST_INT); spin_unlock_irqrestore(&ha->hardware_lock, flags); if (!abort_active) @@ -176,19 +181,20 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) */ down(&ha->mbx_intr_sem); - DEBUG11(printk("qla2x00_mailbox_command:" - "waking up." - "time=0x%lx\n", jiffies);) + DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__, + ha->host_no, jiffies);) clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); /* delete the timer */ del_timer(&tmp_intr_timer); } else { + DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, + ha->host_no, command);) - DEBUG3_11(printk("qla2x00_mailbox_command(%ld): cmd=%x " - "POLLING MODE.\n", ha->host_no, command);) - - WRT_REG_WORD(®->hccr, HCCR_SET_HOST_INT); + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + WRT_REG_DWORD(®->isp24.hccr, HCCRX_SET_HOST_INT); + else + WRT_REG_WORD(®->isp.hccr, HCCR_SET_HOST_INT); spin_unlock_irqrestore(&ha->hardware_lock, flags); if (!abort_active) spin_unlock_irqrestore(&ha->mbx_reg_lock, mbx_flags); @@ -212,8 +218,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) if (ha->flags.mbox_int) { uint16_t *iptr2; - DEBUG3_11(printk("qla2x00_mailbox_cmd: cmd %x completed.\n", - command);) + DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__, + ha->host_no, command);) /* Got interrupt. Clear the flag. */ ha->flags.mbox_int = 0; @@ -238,12 +244,22 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) #if defined(QL_DEBUG_LEVEL_2) || defined(QL_DEBUG_LEVEL_3) || \ defined(QL_DEBUG_LEVEL_11) - printk("qla2x00_mailbox_command(%ld): **** MB Command Timeout " - "for cmd %x ****\n", ha->host_no, command); - printk("qla2x00_mailbox_command: icontrol=%x jiffies=%lx\n", - RD_REG_WORD(®->ictrl), jiffies); - printk("qla2x00_mailbox_command: *** mailbox[0] = 0x%x ***\n", - RD_REG_WORD(optr)); + uint16_t mb0; + uint32_t ictrl; + + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mb0 = RD_REG_WORD(®->isp24.mailbox0); + ictrl = RD_REG_DWORD(®->isp24.ictrl); + } else { + mb0 = RD_MAILBOX_REG(ha, reg->isp, 0); + ictrl = RD_REG_WORD(®->isp.ictrl); + } + printk("%s(%ld): **** MB Command Timeout for cmd %x ****\n", + __func__, ha->host_no, command); + printk("%s(%ld): icontrol=%x jiffies=%lx\n", __func__, + ha->host_no, ictrl, jiffies); + printk("%s(%ld): *** mailbox[0] = 0x%x ***\n", __func__, + ha->host_no, mb0); qla2x00_dump_regs(ha); #endif @@ -259,22 +275,21 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) ha->mcp = NULL; if (!abort_active) { - DEBUG11(printk("qla2x00_mailbox_cmd: checking for additional " - "resp interrupt.\n");) + DEBUG11(printk("%s(%ld): checking for additional resp " + "interrupt.\n", __func__, ha->host_no);) /* polling mode for non isp_abort commands. */ qla2x00_poll(ha); } - if (rval == QLA_FUNCTION_TIMEOUT) { + if (rval == QLA_FUNCTION_TIMEOUT && + mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) { if (!io_lock_on || (mcp->flags & IOCTL_CMD)) { /* not in dpc. schedule it for dpc to take over. */ - DEBUG(printk("qla2x00_mailbox_command(%ld): timeout " - "schedule isp_abort_needed.\n", - ha->host_no);) - DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): " - "timeout schedule isp_abort_needed.\n", - ha->host_no);) + DEBUG(printk("%s(%ld): timeout schedule " + "isp_abort_needed.\n", __func__, ha->host_no);) + DEBUG2_3_11(printk("%s(%ld): timeout schedule " + "isp_abort_needed.\n", __func__, ha->host_no);) qla_printk(KERN_WARNING, ha, "Mailbox command timeout occured. Scheduling ISP " "abort.\n"); @@ -283,12 +298,11 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) up(ha->dpc_wait); } else if (!abort_active) { - /* call abort directly since we are in the DPC thread */ - DEBUG(printk("qla2x00_mailbox_command(%ld): timeout " - "calling abort_isp\n", ha->host_no);) - DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): " - "timeout calling abort_isp\n", ha->host_no);) + DEBUG(printk("%s(%ld): timeout calling abort_isp\n", + __func__, ha->host_no);) + DEBUG2_3_11(printk("%s(%ld): timeout calling " + "abort_isp\n", __func__, ha->host_no);) qla_printk(KERN_WARNING, ha, "Mailbox command timeout occured. Issuing ISP " "abort.\n"); @@ -296,15 +310,14 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) set_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); if (qla2x00_abort_isp(ha)) { - /* failed. retry later. */ + /* Failed. retry later. */ set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); } clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); - - DEBUG(printk("qla2x00_mailbox_command: finished " - "abort_isp\n");) - DEBUG2_3_11(printk("qla2x00_mailbox_command: finished " - "abort_isp\n");) + DEBUG(printk("%s(%ld): finished abort_isp\n", __func__, + ha->host_no);) + DEBUG2_3_11(printk("%s(%ld): finished abort_isp\n", + __func__, ha->host_no);) } } @@ -313,17 +326,13 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp) up(&ha->mbx_cmd_sem); if (rval) { - DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): **** FAILED. " - "mbx0=%x, mbx1=%x, mbx2=%x, cmd=%x ****\n", - ha->host_no, mcp->mb[0], mcp->mb[1], mcp->mb[2], command);) + DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " + "mbx2=%x, cmd=%x ****\n", __func__, ha->host_no, + mcp->mb[0], mcp->mb[1], mcp->mb[2], command);) } else { - DEBUG11(printk("qla2x00_mailbox_command(%ld): done.\n", - ha->host_no);) + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) } - DEBUG11(printk("qla2x00_mailbox_command(%ld): exiting.\n", - ha->host_no);) - return rval; } @@ -418,64 +427,40 @@ qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint16_t risc_addr, */ int qla2x00_load_ram_ext(scsi_qla_host_t *ha, dma_addr_t req_dma, - uint32_t risc_addr, uint16_t risc_code_size) + uint32_t risc_addr, uint32_t risc_code_size) { int rval; mbx_cmd_t mc; mbx_cmd_t *mcp = &mc; - uint32_t req_len; - dma_addr_t nml_dma; - uint32_t nml_len; - uint32_t normalized; DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); - req_len = risc_code_size; - nml_dma = 0; - nml_len = 0; - - normalized = qla2x00_normalize_dma_addr(&req_dma, &req_len, &nml_dma, - &nml_len); - - /* Load first segment */ mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED; mcp->mb[1] = LSW(risc_addr); mcp->mb[2] = MSW(req_dma); mcp->mb[3] = LSW(req_dma); - mcp->mb[4] = (uint16_t)req_len; mcp->mb[6] = MSW(MSD(req_dma)); mcp->mb[7] = LSW(MSD(req_dma)); mcp->mb[8] = MSW(risc_addr); - mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; + mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mcp->mb[4] = MSW(risc_code_size); + mcp->mb[5] = LSW(risc_code_size); + mcp->out_mb |= MBX_5|MBX_4; + } else { + mcp->mb[4] = LSW(risc_code_size); + mcp->out_mb |= MBX_4; + } + mcp->in_mb = MBX_0; mcp->tov = 30; mcp->flags = 0; rval = qla2x00_mailbox_command(ha, mcp); - /* Load second segment - if necessary */ - if (normalized && (rval == QLA_SUCCESS)) { - risc_addr += req_len; - mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED; - mcp->mb[1] = LSW(risc_addr); - mcp->mb[2] = MSW(nml_dma); - mcp->mb[3] = LSW(nml_dma); - mcp->mb[4] = (uint16_t)nml_len; - mcp->mb[6] = MSW(MSD(nml_dma)); - mcp->mb[7] = LSW(MSD(nml_dma)); - mcp->mb[8] = MSW(risc_addr); - mcp->out_mb = MBX_8|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); - } - if (rval != QLA_SUCCESS) { - /*EMPTY*/ - DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", - __func__, ha->host_no, rval, mcp->mb[0])); + DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, + ha->host_no, rval, mcp->mb[0])); } else { - /*EMPTY*/ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); } @@ -484,42 +469,62 @@ qla2x00_load_ram_ext(scsi_qla_host_t *ha, dma_addr_t req_dma, /* * qla2x00_execute_fw - * Start adapter firmware. + * Start adapter firmware. * * Input: - * ha = adapter block pointer. - * TARGET_QUEUE_LOCK must be released. - * ADAPTER_STATE_LOCK must be released. + * ha = adapter block pointer. + * TARGET_QUEUE_LOCK must be released. + * ADAPTER_STATE_LOCK must be released. * * Returns: - * qla2x00 local function return status code. + * qla2x00 local function return status code. * * Context: - * Kernel context. + * Kernel context. */ int -qla2x00_execute_fw(scsi_qla_host_t *ha) +qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr) { int rval; mbx_cmd_t mc; mbx_cmd_t *mcp = &mc; - DEBUG11(printk("qla2x00_execute_fw(%ld): entered.\n", ha->host_no);) + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) mcp->mb[0] = MBC_EXECUTE_FIRMWARE; - mcp->mb[1] = *ha->brd_info->fw_info[0].fwstart; - mcp->out_mb = MBX_1|MBX_0; - if (IS_QLA2322(ha) || IS_QLA6322(ha)) { - mcp->mb[2] = 0; - mcp->out_mb |= MBX_2; + mcp->out_mb = MBX_0; + mcp->in_mb = MBX_0; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mcp->mb[1] = MSW(risc_addr); + mcp->mb[2] = LSW(risc_addr); + mcp->mb[3] = 0; + mcp->out_mb |= MBX_3|MBX_2|MBX_1; + mcp->in_mb |= MBX_1; + } else { + mcp->mb[1] = LSW(risc_addr); + mcp->out_mb |= MBX_1; + if (IS_QLA2322(ha) || IS_QLA6322(ha)) { + mcp->mb[2] = 0; + mcp->out_mb |= MBX_2; + } } - mcp->in_mb = MBX_0; mcp->tov = 30; mcp->flags = 0; rval = qla2x00_mailbox_command(ha, mcp); - DEBUG11(printk("qla2x00_execute_fw(%ld): done.\n", ha->host_no);) + if (rval != QLA_SUCCESS) { + DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__, + ha->host_no, rval, mcp->mb[0])); + } else { + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + DEBUG11(printk("%s(%ld): done exchanges=%x.\n", + __func__, ha->host_no, mcp->mb[1]);) + } else { + DEBUG11(printk("%s(%ld): done.\n", __func__, + ha->host_no);) + } + } return rval; } @@ -612,6 +617,7 @@ qla2x00_get_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, ha->host_no, rval)); } else { + fwopts[0] = mcp->mb[0]; fwopts[1] = mcp->mb[1]; fwopts[2] = mcp->mb[2]; fwopts[3] = mcp->mb[3]; @@ -650,19 +656,26 @@ qla2x00_set_fw_options(scsi_qla_host_t *ha, uint16_t *fwopts) mcp->mb[1] = fwopts[1]; mcp->mb[2] = fwopts[2]; mcp->mb[3] = fwopts[3]; - mcp->mb[10] = fwopts[10]; - mcp->mb[11] = fwopts[11]; - mcp->mb[12] = 0; /* Undocumented, but used */ - mcp->out_mb = MBX_12|MBX_11|MBX_10|MBX_3|MBX_2|MBX_1|MBX_0; + mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; mcp->in_mb = MBX_0; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mcp->in_mb |= MBX_1; + } else { + mcp->mb[10] = fwopts[10]; + mcp->mb[11] = fwopts[11]; + mcp->mb[12] = 0; /* Undocumented, but used */ + mcp->out_mb |= MBX_12|MBX_11|MBX_10; + } mcp->tov = 30; mcp->flags = 0; rval = qla2x00_mailbox_command(ha, mcp); + fwopts[0] = mcp->mb[0]; + if (rval != QLA_SUCCESS) { /*EMPTY*/ - DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, - ha->host_no, rval)); + DEBUG2_3_11(printk("%s(%ld): failed=%x (%x/%x).\n", __func__, + ha->host_no, rval, mcp->mb[0], mcp->mb[1])); } else { /*EMPTY*/ DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); @@ -747,31 +760,38 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha) * Kernel context. */ int -qla2x00_verify_checksum(scsi_qla_host_t *ha) +qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr) { int rval; mbx_cmd_t mc; mbx_cmd_t *mcp = &mc; - DEBUG11(printk("qla2x00_verify_checksum(%ld): entered.\n", - ha->host_no);) + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) mcp->mb[0] = MBC_VERIFY_CHECKSUM; - mcp->mb[1] = *ha->brd_info->fw_info[0].fwstart; - mcp->out_mb = MBX_1|MBX_0; - mcp->in_mb = MBX_2|MBX_0; + mcp->out_mb = MBX_0; + mcp->in_mb = MBX_0; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mcp->mb[1] = MSW(risc_addr); + mcp->mb[2] = LSW(risc_addr); + mcp->out_mb |= MBX_2|MBX_1; + mcp->in_mb |= MBX_2|MBX_1; + } else { + mcp->mb[1] = LSW(risc_addr); + mcp->out_mb |= MBX_1; + mcp->in_mb |= MBX_1; + } + mcp->tov = 30; mcp->flags = 0; rval = qla2x00_mailbox_command(ha, mcp); if (rval != QLA_SUCCESS) { - /*EMPTY*/ - DEBUG2_3_11(printk("qla2x00_verify_checksum(%ld): failed=%x.\n", - ha->host_no, rval);) + DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__, + ha->host_no, rval, (IS_QLA24XX(ha) || IS_QLA25XX(ha) ? + (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1]));) } else { - /*EMPTY*/ - DEBUG11(printk("qla2x00_verify_checksum(%ld): done.\n", - ha->host_no);) + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) } return rval; @@ -817,10 +837,10 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr, if (rval != QLA_SUCCESS) { /*EMPTY*/ - DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x", - ha->host_no,rval);) - DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x", - ha->host_no,rval);) + DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", + ha->host_no, rval);) + DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", + ha->host_no, rval);) } else { sts_entry_t *sts_entry = (sts_entry_t *) buffer; @@ -922,41 +942,40 @@ qla2x00_abort_target(fc_port_t *fcport) int rval; mbx_cmd_t mc; mbx_cmd_t *mcp = &mc; + scsi_qla_host_t *ha; - DEBUG11(printk("qla2x00_abort_target(%ld): entered.\n", - fcport->ha->host_no);) - - if (fcport == NULL) { - /* no target to abort */ + if (fcport == NULL) return 0; - } + DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no);) + + ha = fcport->ha; mcp->mb[0] = MBC_ABORT_TARGET; mcp->out_mb = MBX_2|MBX_1|MBX_0; - if (HAS_EXTENDED_IDS(fcport->ha)) { + if (HAS_EXTENDED_IDS(ha)) { mcp->mb[1] = fcport->loop_id; mcp->mb[10] = 0; mcp->out_mb |= MBX_10; } else { mcp->mb[1] = fcport->loop_id << 8; } - mcp->mb[2] = fcport->ha->loop_reset_delay; + mcp->mb[2] = ha->loop_reset_delay; mcp->in_mb = MBX_0; mcp->tov = 30; mcp->flags = 0; - rval = qla2x00_mailbox_command(fcport->ha, mcp); + rval = qla2x00_mailbox_command(ha, mcp); /* Issue marker command. */ - fcport->ha->marker_needed = 1; + ha->marker_needed = 1; if (rval != QLA_SUCCESS) { DEBUG2_3_11(printk("qla2x00_abort_target(%ld): failed=%x.\n", - fcport->ha->host_no, rval);) + ha->host_no, rval);) } else { /*EMPTY*/ DEBUG11(printk("qla2x00_abort_target(%ld): done.\n", - fcport->ha->host_no);) + ha->host_no);) } return rval; @@ -1206,82 +1225,117 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt) mbx_cmd_t mc; mbx_cmd_t *mcp = &mc; port_database_t *pd; + struct port_database_24xx *pd24; dma_addr_t pd_dma; - DEBUG11(printk("qla2x00_get_port_database(%ld): entered.\n", - ha->host_no);) + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) - pd = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &pd_dma); + pd24 = NULL; + pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); if (pd == NULL) { - DEBUG2_3_11(printk("qla2x00_get_port_database(%ld): **** " - "Mem Alloc Failed ****", ha->host_no);) + DEBUG2_3(printk("%s(%ld): failed to allocate Port Database " + "structure.\n", __func__, ha->host_no)); return QLA_MEMORY_ALLOC_FAILED; } - memset(pd, 0, PORT_DATABASE_SIZE); + memset(pd, 0, max(PORT_DATABASE_SIZE, PORT_DATABASE_24XX_SIZE)); - if (opt != 0) + mcp->mb[0] = MBC_GET_PORT_DATABASE; + if (opt != 0 && !IS_QLA24XX(ha) && !IS_QLA25XX(ha)) mcp->mb[0] = MBC_ENHANCED_GET_PORT_DATABASE; - else - mcp->mb[0] = MBC_GET_PORT_DATABASE; - mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; - if (HAS_EXTENDED_IDS(ha)) { - mcp->mb[1] = fcport->loop_id; - mcp->mb[10] = opt; - mcp->out_mb |= MBX_10; - } else { - mcp->mb[1] = fcport->loop_id << 8 | opt; - } mcp->mb[2] = MSW(pd_dma); mcp->mb[3] = LSW(pd_dma); mcp->mb[6] = MSW(MSD(pd_dma)); mcp->mb[7] = LSW(MSD(pd_dma)); - + mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; mcp->in_mb = MBX_0; - mcp->buf_size = PORT_DATABASE_SIZE; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mcp->mb[1] = fcport->loop_id; + mcp->mb[10] = opt; + mcp->out_mb |= MBX_10|MBX_1; + mcp->in_mb |= MBX_1; + } else if (HAS_EXTENDED_IDS(ha)) { + mcp->mb[1] = fcport->loop_id; + mcp->mb[10] = opt; + mcp->out_mb |= MBX_10|MBX_1; + } else { + mcp->mb[1] = fcport->loop_id << 8 | opt; + mcp->out_mb |= MBX_1; + } + mcp->buf_size = (IS_QLA24XX(ha) || IS_QLA25XX(ha) ? + PORT_DATABASE_24XX_SIZE : PORT_DATABASE_SIZE); mcp->flags = MBX_DMA_IN; mcp->tov = (ha->login_timeout * 2) + (ha->login_timeout / 2); rval = qla2x00_mailbox_command(ha, mcp); if (rval != QLA_SUCCESS) goto gpd_error_out; - /* Check for logged in state. */ - if (pd->master_state != PD_STATE_PORT_LOGGED_IN && - pd->slave_state != PD_STATE_PORT_LOGGED_IN) { - rval = QLA_FUNCTION_FAILED; - goto gpd_error_out; - } - - /* Names are little-endian. */ - memcpy(fcport->node_name, pd->node_name, WWN_SIZE); - memcpy(fcport->port_name, pd->port_name, WWN_SIZE); - - /* Get port_id of device. */ - fcport->d_id.b.al_pa = pd->port_id[2]; - fcport->d_id.b.area = pd->port_id[3]; - fcport->d_id.b.domain = pd->port_id[0]; - fcport->d_id.b.rsvd_1 = 0; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + pd24 = (struct port_database_24xx *) pd; + + /* Check for logged in state. */ + if (pd24->current_login_state != PDS_PRLI_COMPLETE && + pd24->last_login_state != PDS_PRLI_COMPLETE) { + DEBUG2(printk("%s(%ld): Unable to verify " + "login-state (%x/%x) for loop_id %x\n", + __func__, ha->host_no, + pd24->current_login_state, + pd24->last_login_state, fcport->loop_id)); + rval = QLA_FUNCTION_FAILED; + goto gpd_error_out; + } - /* Check for device require authentication. */ - pd->common_features & BIT_5 ? (fcport->flags |= FCF_AUTH_REQ) : - (fcport->flags &= ~FCF_AUTH_REQ); + /* Names are little-endian. */ + memcpy(fcport->node_name, pd24->node_name, WWN_SIZE); + memcpy(fcport->port_name, pd24->port_name, WWN_SIZE); + + /* Get port_id of device. */ + fcport->d_id.b.domain = pd24->port_id[0]; + fcport->d_id.b.area = pd24->port_id[1]; + fcport->d_id.b.al_pa = pd24->port_id[2]; + fcport->d_id.b.rsvd_1 = 0; + + /* If not target must be initiator or unknown type. */ + if ((pd24->prli_svc_param_word_3[0] & BIT_4) == 0) + fcport->port_type = FCT_INITIATOR; + else + fcport->port_type = FCT_TARGET; + } else { + /* Check for logged in state. */ + if (pd->master_state != PD_STATE_PORT_LOGGED_IN && + pd->slave_state != PD_STATE_PORT_LOGGED_IN) { + rval = QLA_FUNCTION_FAILED; + goto gpd_error_out; + } - /* If not target must be initiator or unknown type. */ - if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) - fcport->port_type = FCT_INITIATOR; - else - fcport->port_type = FCT_TARGET; + /* Names are little-endian. */ + memcpy(fcport->node_name, pd->node_name, WWN_SIZE); + memcpy(fcport->port_name, pd->port_name, WWN_SIZE); + + /* Get port_id of device. */ + fcport->d_id.b.domain = pd->port_id[0]; + fcport->d_id.b.area = pd->port_id[3]; + fcport->d_id.b.al_pa = pd->port_id[2]; + fcport->d_id.b.rsvd_1 = 0; + + /* Check for device require authentication. */ + pd->common_features & BIT_5 ? (fcport->flags |= FCF_AUTH_REQ) : + (fcport->flags &= ~FCF_AUTH_REQ); + + /* If not target must be initiator or unknown type. */ + if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) + fcport->port_type = FCT_INITIATOR; + else + fcport->port_type = FCT_TARGET; + } gpd_error_out: dma_pool_free(ha->s_dma_pool, pd, pd_dma); if (rval != QLA_SUCCESS) { - /*EMPTY*/ - DEBUG2_3_11(printk("qla2x00_get_port_database(%ld): " - "failed=%x.\n", ha->host_no, rval);) + DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n", + __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1])); } else { - /*EMPTY*/ - DEBUG11(printk("qla2x00_get_port_database(%ld): done.\n", - ha->host_no);) + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); } return rval; @@ -1426,21 +1480,27 @@ qla2x00_lip_reset(scsi_qla_host_t *ha) mbx_cmd_t mc; mbx_cmd_t *mcp = &mc; - DEBUG11(printk("qla2x00_lip_reset(%ld): entered.\n", - ha->host_no);) + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) - mcp->mb[0] = MBC_LIP_RESET; - mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; - if (HAS_EXTENDED_IDS(ha)) { - mcp->mb[1] = 0x00ff; - mcp->mb[10] = 0; - mcp->out_mb |= MBX_10; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mcp->mb[0] = MBC_LIP_FULL_LOGIN; + mcp->mb[1] = BIT_0; + mcp->mb[2] = 0xff; + mcp->mb[3] = 0; + mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; } else { - mcp->mb[1] = 0xff00; + mcp->mb[0] = MBC_LIP_RESET; + mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; + if (HAS_EXTENDED_IDS(ha)) { + mcp->mb[1] = 0x00ff; + mcp->mb[10] = 0; + mcp->out_mb |= MBX_10; + } else { + mcp->mb[1] = 0xff00; + } + mcp->mb[2] = ha->loop_reset_delay; + mcp->mb[3] = 0; } - mcp->mb[2] = ha->loop_reset_delay; - mcp->mb[3] = 0; - mcp->in_mb = MBX_0; mcp->tov = 30; mcp->flags = 0; @@ -1448,11 +1508,11 @@ qla2x00_lip_reset(scsi_qla_host_t *ha) if (rval != QLA_SUCCESS) { /*EMPTY*/ - DEBUG2_3_11(printk("qla2x00_lip_reset(%ld): failed=%x.\n", - ha->host_no, rval);) + DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", + __func__, ha->host_no, rval);) } else { /*EMPTY*/ - DEBUG11(printk("qla2x00_lip_reset(%ld): done.\n", ha->host_no);) + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) } return rval; @@ -1517,6 +1577,97 @@ qla2x00_send_sns(scsi_qla_host_t *ha, dma_addr_t sns_phys_address, return rval; } +int +qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, + uint8_t area, uint8_t al_pa, uint16_t *mb, uint8_t opt) +{ + int rval; + + struct logio_entry_24xx *lg; + dma_addr_t lg_dma; + uint32_t iop[2]; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) + + lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); + if (lg == NULL) { + DEBUG2_3(printk("%s(%ld): failed to allocate Login IOCB.\n", + __func__, ha->host_no)); + return QLA_MEMORY_ALLOC_FAILED; + } + memset(lg, 0, sizeof(struct logio_entry_24xx)); + + lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; + lg->entry_count = 1; + lg->nport_handle = cpu_to_le16(loop_id); + lg->control_flags = __constant_cpu_to_le16(LCF_COMMAND_PLOGI); + if (opt & BIT_0) + lg->control_flags |= __constant_cpu_to_le16(LCF_COND_PLOGI); + lg->port_id[0] = al_pa; + lg->port_id[1] = area; + lg->port_id[2] = domain; + rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); + if (rval != QLA_SUCCESS) { + DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB " + "(%x).\n", __func__, ha->host_no, rval);) + } else if (lg->entry_status != 0) { + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- error status (%x).\n", __func__, ha->host_no, + lg->entry_status)); + rval = QLA_FUNCTION_FAILED; + } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { + iop[0] = le32_to_cpu(lg->io_parameter[0]); + iop[1] = le32_to_cpu(lg->io_parameter[1]); + + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- completion status (%x) ioparam=%x/%x.\n", __func__, + ha->host_no, le16_to_cpu(lg->comp_status), iop[0], + iop[1])); + + switch (iop[0]) { + case LSC_SCODE_PORTID_USED: + mb[0] = MBS_PORT_ID_USED; + mb[1] = LSW(iop[1]); + break; + case LSC_SCODE_NPORT_USED: + mb[0] = MBS_LOOP_ID_USED; + break; + case LSC_SCODE_NOLINK: + case LSC_SCODE_NOIOCB: + case LSC_SCODE_NOXCB: + case LSC_SCODE_CMD_FAILED: + case LSC_SCODE_NOFABRIC: + case LSC_SCODE_FW_NOT_READY: + case LSC_SCODE_NOT_LOGGED_IN: + case LSC_SCODE_NOPCB: + case LSC_SCODE_ELS_REJECT: + case LSC_SCODE_CMD_PARAM_ERR: + case LSC_SCODE_NONPORT: + case LSC_SCODE_LOGGED_IN: + case LSC_SCODE_NOFLOGI_ACC: + default: + mb[0] = MBS_COMMAND_ERROR; + break; + } + } else { + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) + + iop[0] = le32_to_cpu(lg->io_parameter[0]); + + mb[0] = MBS_COMMAND_COMPLETE; + mb[1] = 0; + if (iop[0] & BIT_4) { + if (iop[0] & BIT_8) + mb[1] |= BIT_1; + } else + mb[1] = BIT_0; + } + + dma_pool_free(ha->s_dma_pool, lg, lg_dma); + + return rval; +} + /* * qla2x00_login_fabric * Issue login fabric port mailbox command. @@ -1669,6 +1820,57 @@ qla2x00_login_local_device(scsi_qla_host_t *ha, uint16_t loop_id, return (rval); } +int +qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, + uint8_t area, uint8_t al_pa) +{ + int rval; + struct logio_entry_24xx *lg; + dma_addr_t lg_dma; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) + + lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); + if (lg == NULL) { + DEBUG2_3(printk("%s(%ld): failed to allocate Logout IOCB.\n", + __func__, ha->host_no)); + return QLA_MEMORY_ALLOC_FAILED; + } + memset(lg, 0, sizeof(struct logio_entry_24xx)); + + lg->entry_type = LOGINOUT_PORT_IOCB_TYPE; + lg->entry_count = 1; + lg->nport_handle = cpu_to_le16(loop_id); + lg->control_flags = + __constant_cpu_to_le16(LCF_COMMAND_LOGO|LCF_EXPL_LOGO); + lg->port_id[0] = al_pa; + lg->port_id[1] = area; + lg->port_id[2] = domain; + rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); + if (rval != QLA_SUCCESS) { + DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB " + "(%x).\n", __func__, ha->host_no, rval);) + } else if (lg->entry_status != 0) { + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- error status (%x).\n", __func__, ha->host_no, + lg->entry_status)); + rval = QLA_FUNCTION_FAILED; + } else if (lg->comp_status != __constant_cpu_to_le16(CS_COMPLETE)) { + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- completion status (%x) ioparam=%x/%x.\n", __func__, + ha->host_no, le16_to_cpu(lg->comp_status), + le32_to_cpu(lg->io_parameter[0]), + le32_to_cpu(lg->io_parameter[1]));) + } else { + /*EMPTY*/ + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) + } + + dma_pool_free(ha->s_dma_pool, lg, lg_dma); + + return rval; +} + /* * qla2x00_fabric_logout * Issue logout fabric port mailbox command. @@ -1686,7 +1888,8 @@ qla2x00_login_local_device(scsi_qla_host_t *ha, uint16_t loop_id, * Kernel context. */ int -qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id) +qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain, + uint8_t area, uint8_t al_pa) { int rval; mbx_cmd_t mc; @@ -1750,7 +1953,7 @@ qla2x00_full_login_lip(scsi_qla_host_t *ha) mcp->mb[0] = MBC_LIP_FULL_LOGIN; mcp->mb[1] = 0; - mcp->mb[2] = 0; + mcp->mb[2] = 0xff; mcp->mb[3] = 0; mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; mcp->in_mb = MBX_0; @@ -1761,7 +1964,7 @@ qla2x00_full_login_lip(scsi_qla_host_t *ha) if (rval != QLA_SUCCESS) { /*EMPTY*/ DEBUG2_3_11(printk("qla2x00_full_login_lip(%ld): failed=%x.\n", - ha->instance, rval);) + ha->host_no, rval);) } else { /*EMPTY*/ DEBUG11(printk("qla2x00_full_login_lip(%ld): done.\n", @@ -1798,11 +2001,20 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma, return QLA_FUNCTION_FAILED; mcp->mb[0] = MBC_GET_ID_LIST; - mcp->mb[1] = MSW(id_list_dma); - mcp->mb[2] = LSW(id_list_dma); - mcp->mb[3] = MSW(MSD(id_list_dma)); - mcp->mb[6] = LSW(MSD(id_list_dma)); - mcp->out_mb = MBX_6|MBX_3|MBX_2|MBX_1|MBX_0; + mcp->out_mb = MBX_0; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mcp->mb[2] = MSW(id_list_dma); + mcp->mb[3] = LSW(id_list_dma); + mcp->mb[6] = MSW(MSD(id_list_dma)); + mcp->mb[7] = LSW(MSD(id_list_dma)); + mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2; + } else { + mcp->mb[1] = MSW(id_list_dma); + mcp->mb[2] = LSW(id_list_dma); + mcp->mb[3] = MSW(MSD(id_list_dma)); + mcp->mb[6] = LSW(MSD(id_list_dma)); + mcp->out_mb |= MBX_6|MBX_3|MBX_2|MBX_1; + } mcp->in_mb = MBX_1|MBX_0; mcp->tov = 30; mcp->flags = 0; @@ -1938,4 +2150,318 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map) return rval; } + +uint8_t +qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, + uint16_t *status) +{ + int rval; + mbx_cmd_t mc; + mbx_cmd_t *mcp = &mc; + uint32_t *sbuf, *siter; + dma_addr_t sbuf_dma; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) + + if (dwords > (DMA_POOL_SIZE / 4)) { + DEBUG2_3_11(printk("%s(%ld): Unabled to retrieve %d DWORDs " + "(max %d).\n", __func__, ha->host_no, dwords, + DMA_POOL_SIZE / 4)); + return BIT_0; + } + sbuf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &sbuf_dma); + if (sbuf == NULL) { + DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", + __func__, ha->host_no)); + return BIT_0; + } + memset(sbuf, 0, DMA_POOL_SIZE); + + mcp->mb[0] = MBC_GET_LINK_PRIV_STATS; + mcp->mb[2] = MSW(sbuf_dma); + mcp->mb[3] = LSW(sbuf_dma); + mcp->mb[6] = MSW(MSD(sbuf_dma)); + mcp->mb[7] = LSW(MSD(sbuf_dma)); + mcp->mb[8] = dwords; + mcp->mb[10] = 0; + mcp->out_mb = MBX_10|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; + mcp->in_mb = MBX_2|MBX_1|MBX_0; + mcp->tov = 30; + mcp->flags = IOCTL_CMD; + rval = qla2x00_mailbox_command(ha, mcp); + + if (rval == QLA_SUCCESS) { + if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { + DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", + __func__, ha->host_no, mcp->mb[0])); + status[0] = mcp->mb[0]; + rval = BIT_1; + } else { + /* Copy over data -- firmware data is LE. */ + siter = sbuf; + while (dwords--) + *dwbuf++ = le32_to_cpu(*siter++); + } + } else { + /* Failed. */ + DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, + ha->host_no, rval)); + rval = BIT_1; + } + + dma_pool_free(ha->s_dma_pool, sbuf, sbuf_dma); + + return rval; +} #endif + +int +qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) +{ + int rval; + fc_port_t *fcport; + unsigned long flags = 0; + + struct abort_entry_24xx *abt; + dma_addr_t abt_dma; + uint32_t handle; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) + + fcport = sp->fcport; + if (atomic_read(&ha->loop_state) == LOOP_DOWN || + atomic_read(&fcport->state) == FCS_DEVICE_LOST) { + return QLA_FUNCTION_FAILED; + } + + spin_lock_irqsave(&ha->hardware_lock, flags); + for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { + if (ha->outstanding_cmds[handle] == sp) + break; + } + spin_unlock_irqrestore(&ha->hardware_lock, flags); + if (handle == MAX_OUTSTANDING_COMMANDS) { + /* Command not found. */ + return QLA_FUNCTION_FAILED; + } + + abt = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &abt_dma); + if (abt == NULL) { + DEBUG2_3(printk("%s(%ld): failed to allocate Abort IOCB.\n", + __func__, ha->host_no)); + return QLA_MEMORY_ALLOC_FAILED; + } + memset(abt, 0, sizeof(struct abort_entry_24xx)); + + abt->entry_type = ABORT_IOCB_TYPE; + abt->entry_count = 1; + abt->nport_handle = cpu_to_le16(fcport->loop_id); + abt->handle_to_abort = handle; + abt->port_id[0] = fcport->d_id.b.al_pa; + abt->port_id[1] = fcport->d_id.b.area; + abt->port_id[2] = fcport->d_id.b.domain; + rval = qla2x00_issue_iocb(ha, abt, abt_dma, 0); + if (rval != QLA_SUCCESS) { + DEBUG2_3_11(printk("%s(%ld): failed to issue IOCB (%x).\n", + __func__, ha->host_no, rval);) + } else if (abt->entry_status != 0) { + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- error status (%x).\n", __func__, ha->host_no, + abt->entry_status)); + rval = QLA_FUNCTION_FAILED; + } else if (abt->nport_handle != __constant_cpu_to_le16(0)) { + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- completion status (%x).\n", __func__, ha->host_no, + le16_to_cpu(abt->nport_handle));) + rval = QLA_FUNCTION_FAILED; + } else { + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) + sp->flags |= SRB_ABORT_PENDING; + } + + dma_pool_free(ha->s_dma_pool, abt, abt_dma); + + return rval; +} + +struct tsk_mgmt_cmd { + union { + struct tsk_mgmt_entry tsk; + struct sts_entry_24xx sts; + } p; +}; + +int +qla24xx_abort_target(fc_port_t *fcport) +{ + int rval; + struct tsk_mgmt_cmd *tsk; + dma_addr_t tsk_dma; + scsi_qla_host_t *ha; + + if (fcport == NULL) + return 0; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no);) + + ha = fcport->ha; + tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma); + if (tsk == NULL) { + DEBUG2_3(printk("%s(%ld): failed to allocate Task Management " + "IOCB.\n", __func__, ha->host_no)); + return QLA_MEMORY_ALLOC_FAILED; + } + memset(tsk, 0, sizeof(struct tsk_mgmt_cmd)); + + tsk->p.tsk.entry_type = TSK_MGMT_IOCB_TYPE; + tsk->p.tsk.entry_count = 1; + tsk->p.tsk.nport_handle = cpu_to_le16(fcport->loop_id); + tsk->p.tsk.timeout = __constant_cpu_to_le16(25); + tsk->p.tsk.control_flags = __constant_cpu_to_le32(TCF_TARGET_RESET); + tsk->p.tsk.port_id[0] = fcport->d_id.b.al_pa; + tsk->p.tsk.port_id[1] = fcport->d_id.b.area; + tsk->p.tsk.port_id[2] = fcport->d_id.b.domain; + rval = qla2x00_issue_iocb(ha, tsk, tsk_dma, 0); + if (rval != QLA_SUCCESS) { + DEBUG2_3_11(printk("%s(%ld): failed to issue Target Reset IOCB " + "(%x).\n", __func__, ha->host_no, rval);) + goto atarget_done; + } else if (tsk->p.sts.entry_status != 0) { + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- error status (%x).\n", __func__, ha->host_no, + tsk->p.sts.entry_status)); + rval = QLA_FUNCTION_FAILED; + goto atarget_done; + } else if (tsk->p.sts.comp_status != + __constant_cpu_to_le16(CS_COMPLETE)) { + DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " + "-- completion status (%x).\n", __func__, + ha->host_no, le16_to_cpu(tsk->p.sts.comp_status));) + rval = QLA_FUNCTION_FAILED; + goto atarget_done; + } + + /* Issue marker IOCB. */ + rval = qla2x00_marker(ha, fcport->loop_id, 0, MK_SYNC_ID); + if (rval != QLA_SUCCESS) { + DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " + "(%x).\n", __func__, ha->host_no, rval);) + } else { + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) + } + +atarget_done: + dma_pool_free(ha->s_dma_pool, tsk, tsk_dma); + + return rval; +} + +int +qla2x00_system_error(scsi_qla_host_t *ha) +{ + int rval; + mbx_cmd_t mc; + mbx_cmd_t *mcp = &mc; + + if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha)) + return QLA_FUNCTION_FAILED; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); + + mcp->mb[0] = MBC_GEN_SYSTEM_ERROR; + mcp->out_mb = MBX_0; + mcp->in_mb = MBX_0; + mcp->tov = 5; + mcp->flags = 0; + rval = qla2x00_mailbox_command(ha, mcp); + + if (rval != QLA_SUCCESS) { + DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, + ha->host_no, rval)); + } else { + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); + } + + return rval; +} + +/** + * qla2x00_get_serdes_params() - + * @ha: HA context + * + * Returns + */ +int +qla2x00_get_serdes_params(scsi_qla_host_t *ha, uint16_t *sw_em_1g, + uint16_t *sw_em_2g, uint16_t *sw_em_4g) +{ + int rval; + mbx_cmd_t mc; + mbx_cmd_t *mcp = &mc; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); + + mcp->mb[0] = MBC_SERDES_PARAMS; + mcp->mb[1] = 0; + mcp->out_mb = MBX_1|MBX_0; + mcp->in_mb = MBX_4|MBX_3|MBX_2|MBX_0; + mcp->tov = 30; + mcp->flags = 0; + rval = qla2x00_mailbox_command(ha, mcp); + + if (rval != QLA_SUCCESS) { + /*EMPTY*/ + DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, + ha->host_no, rval, mcp->mb[0])); + } else { + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); + + if (sw_em_1g) + *sw_em_1g = mcp->mb[2]; + if (sw_em_2g) + *sw_em_2g = mcp->mb[3]; + if (sw_em_4g) + *sw_em_4g = mcp->mb[4]; + } + + return rval; +} + +/** + * qla2x00_set_serdes_params() - + * @ha: HA context + * + * Returns + */ +int +qla2x00_set_serdes_params(scsi_qla_host_t *ha, uint16_t sw_em_1g, + uint16_t sw_em_2g, uint16_t sw_em_4g) +{ + int rval; + mbx_cmd_t mc; + mbx_cmd_t *mcp = &mc; + + DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); + + mcp->mb[0] = MBC_SERDES_PARAMS; + mcp->mb[1] = BIT_0; + mcp->mb[2] = sw_em_1g; + mcp->mb[3] = sw_em_2g; + mcp->mb[4] = sw_em_4g; + mcp->out_mb = 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); + + if (rval != QLA_SUCCESS) { + /*EMPTY*/ + DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, + ha->host_no, rval, mcp->mb[0])); + } else { + /*EMPTY*/ + DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no)); + } + + return rval; +} diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 328cd26e33b9..a325b66ea41c 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2002,7 +2002,10 @@ qla2x00_do_dpc(void *data) if (fcport->flags & FCF_TAPE_PRESENT) ha->isp_ops.fabric_logout( - ha, fcport->loop_id); + ha, fcport->loop_id, + fcport->d_id.b.domain, + fcport->d_id.b.area, + fcport->d_id.b.al_pa); status = qla2x00_fabric_login( ha, fcport, &next_loopid); } else -- cgit v1.2.3 From 459c537807bd72cce7b007fb218bb5a658a6c3c1 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:31:07 -0700 Subject: [SCSI] qla2xxx: Add ISP24xx flash-manipulation routines. Add ISP24xx flash-manipulation routines. Add read/write flash manipulation routines for the ISP24xx. Update sysfs NVRAM objects to use generalized accessor functions. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_attr.c | 59 +++-- drivers/scsi/qla2xxx/qla_gbl.h | 11 + drivers/scsi/qla2xxx/qla_os.c | 2 + drivers/scsi/qla2xxx/qla_sup.c | 538 ++++++++++++++++++++++++++++++++++++---- 4 files changed, 531 insertions(+), 79 deletions(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 30c381c3abcc..9361f4255e62 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -118,23 +118,15 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, { struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct device, kobj))); - uint16_t *witer; unsigned long flags; - uint16_t cnt; - if (!capable(CAP_SYS_ADMIN) || off != 0 || count != sizeof(nvram_t)) + if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size) return 0; /* Read NVRAM. */ spin_lock_irqsave(&ha->hardware_lock, flags); - qla2x00_lock_nvram_access(ha); - witer = (uint16_t *)buf; - for (cnt = 0; cnt < count / 2; cnt++) { - *witer = cpu_to_le16(qla2x00_get_nvram_word(ha, - cnt+ha->nvram_base)); - witer++; - } - qla2x00_unlock_nvram_access(ha); + ha->isp_ops.read_nvram(ha, (uint8_t *)buf, ha->nvram_base, + ha->nvram_size); spin_unlock_irqrestore(&ha->hardware_lock, flags); return (count); @@ -146,34 +138,38 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off, { struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct device, kobj))); - uint8_t *iter; - uint16_t *witer; unsigned long flags; uint16_t cnt; - uint8_t chksum; - if (!capable(CAP_SYS_ADMIN) || off != 0 || count != sizeof(nvram_t)) + if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size) return 0; /* Checksum NVRAM. */ - iter = (uint8_t *)buf; - chksum = 0; - for (cnt = 0; cnt < count - 1; cnt++) - chksum += *iter++; - chksum = ~chksum + 1; - *iter = chksum; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + uint32_t *iter; + uint32_t chksum; + + iter = (uint32_t *)buf; + chksum = 0; + for (cnt = 0; cnt < ((count >> 2) - 1); cnt++) + chksum += le32_to_cpu(*iter++); + chksum = ~chksum + 1; + *iter = cpu_to_le32(chksum); + } else { + uint8_t *iter; + uint8_t chksum; + + iter = (uint8_t *)buf; + chksum = 0; + for (cnt = 0; cnt < count - 1; cnt++) + chksum += *iter++; + chksum = ~chksum + 1; + *iter = chksum; + } /* Write NVRAM. */ spin_lock_irqsave(&ha->hardware_lock, flags); - qla2x00_lock_nvram_access(ha); - qla2x00_release_nvram_protection(ha); - witer = (uint16_t *)buf; - for (cnt = 0; cnt < count / 2; cnt++) { - qla2x00_write_nvram_word(ha, cnt+ha->nvram_base, - cpu_to_le16(*witer)); - witer++; - } - qla2x00_unlock_nvram_access(ha); + ha->isp_ops.write_nvram(ha, (uint8_t *)buf, ha->nvram_base, count); spin_unlock_irqrestore(&ha->hardware_lock, flags); return (count); @@ -185,7 +181,7 @@ static struct bin_attribute sysfs_nvram_attr = { .mode = S_IRUSR | S_IWUSR, .owner = THIS_MODULE, }, - .size = sizeof(nvram_t), + .size = 0, .read = qla2x00_sysfs_read_nvram, .write = qla2x00_sysfs_write_nvram, }; @@ -196,6 +192,7 @@ qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) struct Scsi_Host *host = ha->host; sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); + sysfs_nvram_attr.size = ha->nvram_size; sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); } diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 574446c0892a..0dd732486e24 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -220,6 +220,17 @@ extern void qla2x00_unlock_nvram_access(scsi_qla_host_t *); extern void qla2x00_release_nvram_protection(scsi_qla_host_t *); extern uint16_t qla2x00_get_nvram_word(scsi_qla_host_t *, uint32_t); extern void qla2x00_write_nvram_word(scsi_qla_host_t *, uint32_t, uint16_t); +extern uint32_t *qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *, + uint32_t, uint32_t); +extern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, + uint32_t); +extern uint8_t *qla24xx_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, + uint32_t); +extern int qla2x00_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, + uint32_t); +extern int qla24xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, + uint32_t); + /* * Global Function Prototypes in qla_dbg.c source file. */ diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a325b66ea41c..9e6d05119253 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1187,6 +1187,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_32; ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_32; ha->isp_ops.prep_ms_iocb = qla2x00_prep_ms_iocb; + ha->isp_ops.read_nvram = qla2x00_read_nvram_data; + ha->isp_ops.write_nvram = qla2x00_write_nvram_data; ha->isp_ops.fw_dump = qla2100_fw_dump; ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump; if (IS_QLA2100(ha)) { diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index cf2a6bc444d2..c95ef2bb089a 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c @@ -78,54 +78,6 @@ qla2x00_unlock_nvram_access(scsi_qla_host_t *ha) } } -/** - * qla2x00_release_nvram_protection() - - * @ha: HA context - */ -void -qla2x00_release_nvram_protection(scsi_qla_host_t *ha) -{ - struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; - uint32_t word; - - /* Release NVRAM write protection. */ - if (IS_QLA2322(ha) || IS_QLA6322(ha)) { - /* Write enable. */ - qla2x00_nv_write(ha, NVR_DATA_OUT); - qla2x00_nv_write(ha, 0); - qla2x00_nv_write(ha, 0); - for (word = 0; word < 8; word++) - qla2x00_nv_write(ha, NVR_DATA_OUT); - - qla2x00_nv_deselect(ha); - - /* Enable protection register. */ - qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); - qla2x00_nv_write(ha, NVR_PR_ENABLE); - qla2x00_nv_write(ha, NVR_PR_ENABLE); - for (word = 0; word < 8; word++) - qla2x00_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE); - - qla2x00_nv_deselect(ha); - - /* Clear protection register (ffff is cleared). */ - qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); - qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); - qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); - for (word = 0; word < 8; word++) - qla2x00_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE); - - qla2x00_nv_deselect(ha); - - /* Wait for NVRAM to become ready. */ - WRT_REG_WORD(®->nvram, NVR_SELECT); - do { - NVRAM_DELAY(); - word = RD_REG_WORD(®->nvram); - } while ((word & NVR_DATA_IN) == 0); - } -} - /** * qla2x00_get_nvram_word() - Calculates word position in NVRAM and calls the * request routine to get the word from NVRAM. @@ -202,6 +154,64 @@ qla2x00_write_nvram_word(scsi_qla_host_t *ha, uint32_t addr, uint16_t data) qla2x00_nv_deselect(ha); } +static int +qla2x00_write_nvram_word_tmo(scsi_qla_host_t *ha, uint32_t addr, uint16_t data, + uint32_t tmo) +{ + int ret, count; + uint16_t word; + uint32_t nv_cmd; + struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; + + ret = QLA_SUCCESS; + + qla2x00_nv_write(ha, NVR_DATA_OUT); + qla2x00_nv_write(ha, 0); + qla2x00_nv_write(ha, 0); + + for (word = 0; word < 8; word++) + qla2x00_nv_write(ha, NVR_DATA_OUT); + + qla2x00_nv_deselect(ha); + + /* Write data */ + nv_cmd = (addr << 16) | NV_WRITE_OP; + nv_cmd |= data; + nv_cmd <<= 5; + for (count = 0; count < 27; count++) { + if (nv_cmd & BIT_31) + qla2x00_nv_write(ha, NVR_DATA_OUT); + else + qla2x00_nv_write(ha, 0); + + nv_cmd <<= 1; + } + + qla2x00_nv_deselect(ha); + + /* Wait for NVRAM to become ready */ + WRT_REG_WORD(®->nvram, NVR_SELECT); + do { + NVRAM_DELAY(); + word = RD_REG_WORD(®->nvram); + if (!--tmo) { + ret = QLA_FUNCTION_FAILED; + break; + } + } while ((word & NVR_DATA_IN) == 0); + + qla2x00_nv_deselect(ha); + + /* Disable writes */ + qla2x00_nv_write(ha, NVR_DATA_OUT); + for (count = 0; count < 10; count++) + qla2x00_nv_write(ha, 0); + + qla2x00_nv_deselect(ha); + + return ret; +} + /** * qla2x00_nvram_request() - Sends read command to NVRAM and gets data from * NVRAM. @@ -292,3 +302,435 @@ qla2x00_nv_write(scsi_qla_host_t *ha, uint16_t data) NVRAM_DELAY(); } +/** + * qla2x00_clear_nvram_protection() - + * @ha: HA context + */ +static int +qla2x00_clear_nvram_protection(scsi_qla_host_t *ha) +{ + int ret, stat; + struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; + uint32_t word; + uint16_t wprot, wprot_old; + + /* Clear NVRAM write protection. */ + ret = QLA_FUNCTION_FAILED; + wprot_old = cpu_to_le16(qla2x00_get_nvram_word(ha, 0)); + stat = qla2x00_write_nvram_word_tmo(ha, 0, + __constant_cpu_to_le16(0x1234), 100000); + wprot = cpu_to_le16(qla2x00_get_nvram_word(ha, 0)); + if (stat != QLA_SUCCESS || wprot != __constant_cpu_to_le16(0x1234)) { + /* Write enable. */ + qla2x00_nv_write(ha, NVR_DATA_OUT); + qla2x00_nv_write(ha, 0); + qla2x00_nv_write(ha, 0); + for (word = 0; word < 8; word++) + qla2x00_nv_write(ha, NVR_DATA_OUT); + + qla2x00_nv_deselect(ha); + + /* Enable protection register. */ + qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); + qla2x00_nv_write(ha, NVR_PR_ENABLE); + qla2x00_nv_write(ha, NVR_PR_ENABLE); + for (word = 0; word < 8; word++) + qla2x00_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE); + + qla2x00_nv_deselect(ha); + + /* Clear protection register (ffff is cleared). */ + qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); + qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); + qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); + for (word = 0; word < 8; word++) + qla2x00_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE); + + qla2x00_nv_deselect(ha); + + /* Wait for NVRAM to become ready. */ + WRT_REG_WORD(®->nvram, NVR_SELECT); + do { + NVRAM_DELAY(); + word = RD_REG_WORD(®->nvram); + } while ((word & NVR_DATA_IN) == 0); + + ret = QLA_SUCCESS; + } else + qla2x00_write_nvram_word(ha, 0, wprot_old); + + return ret; +} + +static void +qla2x00_set_nvram_protection(scsi_qla_host_t *ha, int stat) +{ + struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; + uint32_t word; + + if (stat != QLA_SUCCESS) + return; + + /* Set NVRAM write protection. */ + /* Write enable. */ + qla2x00_nv_write(ha, NVR_DATA_OUT); + qla2x00_nv_write(ha, 0); + qla2x00_nv_write(ha, 0); + for (word = 0; word < 8; word++) + qla2x00_nv_write(ha, NVR_DATA_OUT); + + qla2x00_nv_deselect(ha); + + /* Enable protection register. */ + qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); + qla2x00_nv_write(ha, NVR_PR_ENABLE); + qla2x00_nv_write(ha, NVR_PR_ENABLE); + for (word = 0; word < 8; word++) + qla2x00_nv_write(ha, NVR_DATA_OUT | NVR_PR_ENABLE); + + qla2x00_nv_deselect(ha); + + /* Enable protection register. */ + qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); + qla2x00_nv_write(ha, NVR_PR_ENABLE); + qla2x00_nv_write(ha, NVR_PR_ENABLE | NVR_DATA_OUT); + for (word = 0; word < 8; word++) + qla2x00_nv_write(ha, NVR_PR_ENABLE); + + qla2x00_nv_deselect(ha); + + /* Wait for NVRAM to become ready. */ + WRT_REG_WORD(®->nvram, NVR_SELECT); + do { + NVRAM_DELAY(); + word = RD_REG_WORD(®->nvram); + } while ((word & NVR_DATA_IN) == 0); +} + + +/*****************************************************************************/ +/* Flash Manipulation Routines */ +/*****************************************************************************/ + +static inline uint32_t +flash_conf_to_access_addr(uint32_t faddr) +{ + return FARX_ACCESS_FLASH_CONF | faddr; +} + +static inline uint32_t +flash_data_to_access_addr(uint32_t faddr) +{ + return FARX_ACCESS_FLASH_DATA | faddr; +} + +static inline uint32_t +nvram_conf_to_access_addr(uint32_t naddr) +{ + return FARX_ACCESS_NVRAM_CONF | naddr; +} + +static inline uint32_t +nvram_data_to_access_addr(uint32_t naddr) +{ + return FARX_ACCESS_NVRAM_DATA | naddr; +} + +uint32_t +qla24xx_read_flash_dword(scsi_qla_host_t *ha, uint32_t addr) +{ + int rval; + uint32_t cnt, data; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + WRT_REG_DWORD(®->flash_addr, addr & ~FARX_DATA_FLAG); + /* Wait for READ cycle to complete. */ + rval = QLA_SUCCESS; + for (cnt = 3000; + (RD_REG_DWORD(®->flash_addr) & FARX_DATA_FLAG) == 0 && + rval == QLA_SUCCESS; cnt--) { + if (cnt) + udelay(10); + else + rval = QLA_FUNCTION_TIMEOUT; + } + + /* TODO: What happens if we time out? */ + data = 0xDEADDEAD; + if (rval == QLA_SUCCESS) + data = RD_REG_DWORD(®->flash_data); + + return data; +} + +uint32_t * +qla24xx_read_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr, + uint32_t dwords) +{ + uint32_t i; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + /* Pause RISC. */ + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + /* Dword reads to flash. */ + for (i = 0; i < dwords; i++, faddr++) + dwptr[i] = cpu_to_le32(qla24xx_read_flash_dword(ha, + flash_data_to_access_addr(faddr))); + + /* Release RISC pause. */ + WRT_REG_DWORD(®->hccr, HCCRX_REL_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + return dwptr; +} + +int +qla24xx_write_flash_dword(scsi_qla_host_t *ha, uint32_t addr, uint32_t data) +{ + int rval; + uint32_t cnt; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + WRT_REG_DWORD(®->flash_data, data); + RD_REG_DWORD(®->flash_data); /* PCI Posting. */ + WRT_REG_DWORD(®->flash_addr, addr | FARX_DATA_FLAG); + /* Wait for Write cycle to complete. */ + rval = QLA_SUCCESS; + for (cnt = 500000; (RD_REG_DWORD(®->flash_addr) & FARX_DATA_FLAG) && + rval == QLA_SUCCESS; cnt--) { + if (cnt) + udelay(10); + else + rval = QLA_FUNCTION_TIMEOUT; + } + return rval; +} + +void +qla24xx_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id, + uint8_t *flash_id) +{ + uint32_t ids; + + ids = qla24xx_read_flash_dword(ha, flash_data_to_access_addr(0xd03ab)); + *man_id = LSB(ids); + *flash_id = MSB(ids); +} + +int +qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr, + uint32_t dwords) +{ + int ret; + uint32_t liter; + uint32_t sec_mask, rest_addr, conf_addr; + uint32_t fdata; + uint8_t man_id, flash_id; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + ret = QLA_SUCCESS; + + /* Pause RISC. */ + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + qla24xx_get_flash_manufacturer(ha, &man_id, &flash_id); + DEBUG9(printk("%s(%ld): Flash man_id=%d flash_id=%d\n", __func__, + ha->host_no, man_id, flash_id)); + + conf_addr = flash_conf_to_access_addr(0x03d8); + switch (man_id) { + case 0xbf: // STT flash + rest_addr = 0x1fff; + sec_mask = 0x3e000; + if (flash_id == 0x80) + conf_addr = flash_conf_to_access_addr(0x0352); + break; + case 0x13: // ST M25P80 + rest_addr = 0x3fff; + sec_mask = 0x3c000; + break; + default: + // Default to 64 kb sector size + rest_addr = 0x3fff; + sec_mask = 0x3c000; + break; + } + + /* Enable flash write. */ + WRT_REG_DWORD(®->ctrl_status, + RD_REG_DWORD(®->ctrl_status) | CSRX_FLASH_ENABLE); + RD_REG_DWORD(®->ctrl_status); /* PCI Posting. */ + + /* Disable flash write-protection. */ + qla24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0); + + do { /* Loop once to provide quick error exit. */ + for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) { + /* Are we at the beginning of a sector? */ + if ((faddr & rest_addr) == 0) { + fdata = (faddr & sec_mask) << 2; + ret = qla24xx_write_flash_dword(ha, conf_addr, + (fdata & 0xff00) |((fdata << 16) & + 0xff0000) | ((fdata >> 16) & 0xff)); + if (ret != QLA_SUCCESS) { + DEBUG9(printk("%s(%ld) Unable to flash " + "sector: address=%x.\n", __func__, + ha->host_no, faddr)); + break; + } + } + ret = qla24xx_write_flash_dword(ha, + flash_data_to_access_addr(faddr), + cpu_to_le32(*dwptr)); + if (ret != QLA_SUCCESS) { + DEBUG9(printk("%s(%ld) Unable to program flash " + "address=%x data=%x.\n", __func__, + ha->host_no, faddr, *dwptr)); + break; + } + } + } while (0); + + /* Disable flash write. */ + WRT_REG_DWORD(®->ctrl_status, + RD_REG_DWORD(®->ctrl_status) & ~CSRX_FLASH_ENABLE); + RD_REG_DWORD(®->ctrl_status); /* PCI Posting. */ + + /* Release RISC pause. */ + WRT_REG_DWORD(®->hccr, HCCRX_REL_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + return ret; +} + +uint8_t * +qla2x00_read_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr, + uint32_t bytes) +{ + uint32_t i; + uint16_t *wptr; + + /* Word reads to NVRAM via registers. */ + wptr = (uint16_t *)buf; + qla2x00_lock_nvram_access(ha); + for (i = 0; i < bytes >> 1; i++, naddr++) + wptr[i] = cpu_to_le16(qla2x00_get_nvram_word(ha, + naddr)); + qla2x00_unlock_nvram_access(ha); + + return buf; +} + +uint8_t * +qla24xx_read_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr, + uint32_t bytes) +{ + uint32_t i; + uint32_t *dwptr; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + /* Pause RISC. */ + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + /* Dword reads to flash. */ + dwptr = (uint32_t *)buf; + for (i = 0; i < bytes >> 2; i++, naddr++) + dwptr[i] = cpu_to_le32(qla24xx_read_flash_dword(ha, + nvram_data_to_access_addr(naddr))); + + /* Release RISC pause. */ + WRT_REG_DWORD(®->hccr, HCCRX_REL_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + return buf; +} + +int +qla2x00_write_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr, + uint32_t bytes) +{ + int ret, stat; + uint32_t i; + uint16_t *wptr; + + ret = QLA_SUCCESS; + + qla2x00_lock_nvram_access(ha); + + /* Disable NVRAM write-protection. */ + stat = qla2x00_clear_nvram_protection(ha); + + wptr = (uint16_t *)buf; + for (i = 0; i < bytes >> 1; i++, naddr++) { + qla2x00_write_nvram_word(ha, naddr, + cpu_to_le16(*wptr)); + wptr++; + } + + /* Enable NVRAM write-protection. */ + qla2x00_set_nvram_protection(ha, stat); + + qla2x00_unlock_nvram_access(ha); + + return ret; +} + +int +qla24xx_write_nvram_data(scsi_qla_host_t *ha, uint8_t *buf, uint32_t naddr, + uint32_t bytes) +{ + int ret; + uint32_t i; + uint32_t *dwptr; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + ret = QLA_SUCCESS; + + /* Pause RISC. */ + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + /* Enable flash write. */ + WRT_REG_DWORD(®->ctrl_status, + RD_REG_DWORD(®->ctrl_status) | CSRX_FLASH_ENABLE); + RD_REG_DWORD(®->ctrl_status); /* PCI Posting. */ + + /* Disable NVRAM write-protection. */ + qla24xx_write_flash_dword(ha, nvram_conf_to_access_addr(0x101), + 0); + qla24xx_write_flash_dword(ha, nvram_conf_to_access_addr(0x101), + 0); + + /* Dword writes to flash. */ + dwptr = (uint32_t *)buf; + for (i = 0; i < bytes >> 2; i++, naddr++, dwptr++) { + ret = qla24xx_write_flash_dword(ha, + nvram_data_to_access_addr(naddr), + cpu_to_le32(*dwptr)); + if (ret != QLA_SUCCESS) { + DEBUG9(printk("%s(%ld) Unable to program " + "nvram address=%x data=%x.\n", __func__, + ha->host_no, naddr, *dwptr)); + break; + } + } + + /* Enable NVRAM write-protection. */ + qla24xx_write_flash_dword(ha, nvram_conf_to_access_addr(0x101), + 0x8c); + + /* Disable flash write. */ + WRT_REG_DWORD(®->ctrl_status, + RD_REG_DWORD(®->ctrl_status) & ~CSRX_FLASH_ENABLE); + RD_REG_DWORD(®->ctrl_status); /* PCI Posting. */ + + /* Release RISC pause. */ + WRT_REG_DWORD(®->hccr, HCCRX_REL_RISC_PAUSE); + RD_REG_DWORD(®->hccr); /* PCI Posting. */ + + return ret; +} -- cgit v1.2.3 From 2b6c0cee90cecbce35fb6d65fed94f22e5063be0 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:31:17 -0700 Subject: [SCSI] qla2xxx: Add ISP24xx IOCB manipulation routines. Add ISP24xx IOCB manipulation routines. Add appropriate glue-code for ISP24xx support while manipulting IOCB packets. Add an ISP24xx specific 'start_scsi' routine due to command-type-7 layout changes. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_inline.h | 13 ++ drivers/scsi/qla2xxx/qla_iocb.c | 325 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 323 insertions(+), 16 deletions(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 0dd732486e24..15a05682f012 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -94,6 +94,7 @@ extern uint16_t qla2x00_calc_iocbs_64(uint16_t); extern void qla2x00_build_scsi_iocbs_32(srb_t *, cmd_entry_t *, uint16_t); extern void qla2x00_build_scsi_iocbs_64(srb_t *, cmd_entry_t *, uint16_t); extern int qla2x00_start_scsi(srb_t *sp); +extern int qla24xx_start_scsi(srb_t *sp); int qla2x00_marker(scsi_qla_host_t *, uint16_t, uint16_t, uint8_t); int __qla2x00_marker(scsi_qla_host_t *, uint16_t, uint16_t, uint8_t); diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 6cf7036ccf4c..a4357f0aeea3 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -236,6 +236,19 @@ qla2x00_delete_timer_from_cmd(srb_t *sp) } } +static inline uint8_t *host_to_fcp_swap(uint8_t *, uint32_t); +static inline uint8_t * +host_to_fcp_swap(uint8_t *fcp, uint32_t bsize) +{ + uint32_t *ifcp = (uint32_t *) fcp; + uint32_t *ofcp = (uint32_t *) fcp; + uint32_t iter = bsize >> 2; + + for (; iter ; iter--) + *ofcp++ = swab32(*ifcp++); + + return fcp; +} static inline int qla2x00_is_reserved_id(scsi_qla_host_t *, uint16_t); static inline int diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 846dbfe26be3..4343c65523a5 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -468,29 +468,37 @@ queuing_error: * * Returns non-zero if a failure occured, else zero. */ -int +int __qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, uint8_t type) { - mrk_entry_t *pkt; + mrk_entry_t *mrk; + struct mrk_entry_24xx *mrk24; - pkt = (mrk_entry_t *)qla2x00_req_pkt(ha); - if (pkt == NULL) { - DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__)); + mrk24 = NULL; + mrk = (mrk_entry_t *)qla2x00_req_pkt(ha); + if (mrk == NULL) { + DEBUG2_3(printk("%s(%ld): failed to allocate Marker IOCB.\n", + __func__, ha->host_no)); return (QLA_FUNCTION_FAILED); } - pkt->entry_type = MARKER_TYPE; - pkt->modifier = type; - + mrk->entry_type = MARKER_TYPE; + mrk->modifier = type; if (type != MK_SYNC_ALL) { - pkt->lun = cpu_to_le16(lun); - SET_TARGET_ID(ha, pkt->target, loop_id); + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + mrk24 = (struct mrk_entry_24xx *) mrk; + mrk24->nport_handle = cpu_to_le16(loop_id); + mrk24->lun[1] = LSB(lun); + mrk24->lun[2] = MSB(lun); + } else { + SET_TARGET_ID(ha, mrk->target, loop_id); + mrk->lun = cpu_to_le16(lun); + } } wmb(); - /* Issue command to ISP */ qla2x00_isp_cmd(ha); return (QLA_SUCCESS); @@ -521,7 +529,7 @@ qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun, static request_t * qla2x00_req_pkt(scsi_qla_host_t *ha) { - struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; + device_reg_t __iomem *reg = ha->iobase; request_t *pkt = NULL; uint16_t cnt; uint32_t *dword_ptr; @@ -532,7 +540,12 @@ qla2x00_req_pkt(scsi_qla_host_t *ha) for (timer = HZ; timer; timer--) { if ((req_cnt + 2) >= ha->req_q_cnt) { /* Calculate number of free request entries. */ - cnt = qla2x00_debounce_register(ISP_REQ_Q_OUT(ha, reg)); + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + cnt = (uint16_t)RD_REG_DWORD( + ®->isp24.req_q_out); + else + cnt = qla2x00_debounce_register( + ISP_REQ_Q_OUT(ha, ®->isp)); if (ha->req_ring_index < cnt) ha->req_q_cnt = cnt - ha->req_ring_index; else @@ -586,7 +599,7 @@ qla2x00_req_pkt(scsi_qla_host_t *ha) void qla2x00_isp_cmd(scsi_qla_host_t *ha) { - struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; + device_reg_t __iomem *reg = ha->iobase; DEBUG5(printk("%s(): IOCB data:\n", __func__)); DEBUG5(qla2x00_dump_buffer( @@ -601,6 +614,286 @@ qla2x00_isp_cmd(scsi_qla_host_t *ha) ha->request_ring_ptr++; /* Set chip new ring index. */ - WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index); - RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg)); /* PCI Posting. */ + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + WRT_REG_DWORD(®->isp24.req_q_in, ha->req_ring_index); + RD_REG_DWORD_RELAXED(®->isp24.req_q_in); + } else { + WRT_REG_WORD(ISP_REQ_Q_IN(ha, ®->isp), ha->req_ring_index); + RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, ®->isp)); + } + +} + +/** + * qla24xx_calc_iocbs() - Determine number of Command Type 3 and + * Continuation Type 1 IOCBs to allocate. + * + * @dsds: number of data segment decriptors needed + * + * Returns the number of IOCB entries needed to store @dsds. + */ +static inline uint16_t +qla24xx_calc_iocbs(uint16_t dsds) +{ + uint16_t iocbs; + + iocbs = 1; + if (dsds > 1) { + iocbs += (dsds - 1) / 5; + if ((dsds - 1) % 5) + iocbs++; + } + return iocbs; +} + +/** + * qla24xx_build_scsi_iocbs() - Build IOCB command utilizing Command Type 7 + * IOCB types. + * + * @sp: SRB command to process + * @cmd_pkt: Command type 3 IOCB + * @tot_dsds: Total number of segments to transfer + */ +static inline void +qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, + uint16_t tot_dsds) +{ + uint16_t avail_dsds; + uint32_t *cur_dsd; + scsi_qla_host_t *ha; + struct scsi_cmnd *cmd; + + cmd = sp->cmd; + + /* Update entry type to indicate Command Type 3 IOCB */ + *((uint32_t *)(&cmd_pkt->entry_type)) = + __constant_cpu_to_le32(COMMAND_TYPE_7); + + /* No data transfer */ + if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) { + cmd_pkt->byte_count = __constant_cpu_to_le32(0); + return; + } + + ha = sp->ha; + + /* Set transfer direction */ + if (cmd->sc_data_direction == DMA_TO_DEVICE) + cmd_pkt->task_mgmt_flags = + __constant_cpu_to_le16(TMF_WRITE_DATA); + else if (cmd->sc_data_direction == DMA_FROM_DEVICE) + cmd_pkt->task_mgmt_flags = + __constant_cpu_to_le16(TMF_READ_DATA); + + /* One DSD is available in the Command Type 3 IOCB */ + avail_dsds = 1; + cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; + + /* Load data segments */ + if (cmd->use_sg != 0) { + struct scatterlist *cur_seg; + struct scatterlist *end_seg; + + cur_seg = (struct scatterlist *)cmd->request_buffer; + end_seg = cur_seg + tot_dsds; + while (cur_seg < end_seg) { + dma_addr_t sle_dma; + cont_a64_entry_t *cont_pkt; + + /* Allocate additional continuation packets? */ + if (avail_dsds == 0) { + /* + * Five DSDs are available in the Continuation + * Type 1 IOCB. + */ + cont_pkt = qla2x00_prep_cont_type1_iocb(ha); + cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; + avail_dsds = 5; + } + + sle_dma = sg_dma_address(cur_seg); + *cur_dsd++ = cpu_to_le32(LSD(sle_dma)); + *cur_dsd++ = cpu_to_le32(MSD(sle_dma)); + *cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg)); + avail_dsds--; + + cur_seg++; + } + } else { + *cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle)); + *cur_dsd++ = cpu_to_le32(MSD(sp->dma_handle)); + *cur_dsd++ = cpu_to_le32(cmd->request_bufflen); + } +} + + +/** + * qla24xx_start_scsi() - Send a SCSI command to the ISP + * @sp: command to send to the ISP + * + * Returns non-zero if a failure occured, else zero. + */ +int +qla24xx_start_scsi(srb_t *sp) +{ + int ret; + unsigned long flags; + scsi_qla_host_t *ha; + struct scsi_cmnd *cmd; + uint32_t *clr_ptr; + uint32_t index; + uint32_t handle; + struct cmd_type_7 *cmd_pkt; + struct scatterlist *sg; + uint16_t cnt; + uint16_t req_cnt; + uint16_t tot_dsds; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + char tag[2]; + + /* Setup device pointers. */ + ret = 0; + ha = sp->ha; + reg = &ha->iobase->isp24; + cmd = sp->cmd; + /* So we know we haven't pci_map'ed anything yet */ + tot_dsds = 0; + + /* Send marker if required */ + if (ha->marker_needed != 0) { + if (qla2x00_marker(ha, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) { + return QLA_FUNCTION_FAILED; + } + ha->marker_needed = 0; + } + + /* Acquire ring specific lock */ + spin_lock_irqsave(&ha->hardware_lock, flags); + + /* Check for room in outstanding command list. */ + handle = ha->current_outstanding_cmd; + for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) { + handle++; + if (handle == MAX_OUTSTANDING_COMMANDS) + handle = 1; + if (ha->outstanding_cmds[handle] == 0) + break; + } + if (index == MAX_OUTSTANDING_COMMANDS) + goto queuing_error; + + /* Map the sg table so we have an accurate count of sg entries needed */ + if (cmd->use_sg) { + sg = (struct scatterlist *) cmd->request_buffer; + tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg, + cmd->sc_data_direction); + if (tot_dsds == 0) + goto queuing_error; + } else if (cmd->request_bufflen) { + dma_addr_t req_dma; + + req_dma = pci_map_single(ha->pdev, cmd->request_buffer, + cmd->request_bufflen, cmd->sc_data_direction); + if (dma_mapping_error(req_dma)) + goto queuing_error; + + sp->dma_handle = req_dma; + tot_dsds = 1; + } + + req_cnt = qla24xx_calc_iocbs(tot_dsds); + if (ha->req_q_cnt < (req_cnt + 2)) { + cnt = (uint16_t)RD_REG_DWORD_RELAXED(®->req_q_out); + if (ha->req_ring_index < cnt) + ha->req_q_cnt = cnt - ha->req_ring_index; + else + ha->req_q_cnt = ha->request_q_length - + (ha->req_ring_index - cnt); + } + if (ha->req_q_cnt < (req_cnt + 2)) { + if (cmd->use_sg) + pci_unmap_sg(ha->pdev, sg, cmd->use_sg, + cmd->sc_data_direction); + goto queuing_error; + } + + /* Build command packet. */ + ha->current_outstanding_cmd = handle; + ha->outstanding_cmds[handle] = sp; + sp->ha = ha; + sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; + ha->req_q_cnt -= req_cnt; + + cmd_pkt = (struct cmd_type_7 *)ha->request_ring_ptr; + cmd_pkt->handle = handle; + + /* Zero out remaining portion of packet. */ + clr_ptr = (uint32_t *)cmd_pkt + 2; + memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8); + cmd_pkt->dseg_count = cpu_to_le16(tot_dsds); + + /* Set NPORT-ID and LUN number*/ + cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id); + cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa; + cmd_pkt->port_id[1] = sp->fcport->d_id.b.area; + cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain; + + cmd_pkt->lun[1] = LSB(sp->cmd->device->lun); + cmd_pkt->lun[2] = MSB(sp->cmd->device->lun); + + /* Update tagged queuing modifier -- default is TSK_SIMPLE (0). */ + if (scsi_populate_tag_msg(cmd, tag)) { + switch (tag[0]) { + case MSG_HEAD_TAG: + cmd_pkt->task = TSK_HEAD_OF_QUEUE; + break; + case MSG_ORDERED_TAG: + cmd_pkt->task = TSK_ORDERED; + break; + } + } + + /* Load SCSI command packet. */ + memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len); + host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb)); + + cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen); + + /* Build IOCB segments */ + qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds); + + /* Set total data segment count. */ + cmd_pkt->entry_count = (uint8_t)req_cnt; + wmb(); + + /* Adjust ring index. */ + ha->req_ring_index++; + if (ha->req_ring_index == ha->request_q_length) { + ha->req_ring_index = 0; + ha->request_ring_ptr = ha->request_ring; + } else + ha->request_ring_ptr++; + + sp->flags |= SRB_DMA_VALID; + sp->state = SRB_ACTIVE_STATE; + + /* Set chip new ring index. */ + WRT_REG_DWORD(®->req_q_in, ha->req_ring_index); + RD_REG_DWORD_RELAXED(®->req_q_in); /* PCI Posting. */ + + spin_unlock_irqrestore(&ha->hardware_lock, flags); + return QLA_SUCCESS; + +queuing_error: + if (cmd->use_sg && tot_dsds) { + sg = (struct scatterlist *) cmd->request_buffer; + pci_unmap_sg(ha->pdev, sg, cmd->use_sg, + cmd->sc_data_direction); + } else if (tot_dsds) { + pci_unmap_single(ha->pdev, sp->dma_handle, + cmd->request_bufflen, cmd->sc_data_direction); + } + spin_unlock_irqrestore(&ha->hardware_lock, flags); + + return QLA_FUNCTION_FAILED; } -- cgit v1.2.3 From 9a853f71804d80e862362f6d0743d06955305752 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:31:27 -0700 Subject: [SCSI] qla2xxx: Add ISP24xx ISR routines. Add ISP24xx ISR routines. Add appropriate glue-code for ISP24xx support -- this included generalizing some of the core handling routines (qla2x00_async_event() [pull-up retrieval of mailbox values] and qla2x00_status_entry()]. Fixup 2100/2300 ISRs to handle the new conventions. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_isr.c | 582 +++++++++++++++++++++++++++++------------ 2 files changed, 419 insertions(+), 164 deletions(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 15a05682f012..d153d543a672 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -211,6 +211,7 @@ qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t); */ extern irqreturn_t qla2100_intr_handler(int, void *, struct pt_regs *); extern irqreturn_t qla2300_intr_handler(int, void *, struct pt_regs *); +extern irqreturn_t qla24xx_intr_handler(int, void *, struct pt_regs *); extern void qla2x00_process_response_queue(struct scsi_qla_host *); /* diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index f38d13628f43..b960bdfe91e9 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -19,14 +19,17 @@ #include "qla_def.h" 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 *, uint16_t *); static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t); void qla2x00_process_response_queue(struct scsi_qla_host *); -static void qla2x00_status_entry(scsi_qla_host_t *, sts_entry_t *); +static void qla2x00_status_entry(scsi_qla_host_t *, void *); static void qla2x00_status_cont_entry(scsi_qla_host_t *, sts_cont_entry_t *); static void qla2x00_error_entry(scsi_qla_host_t *, sts_entry_t *); static void qla2x00_ms_entry(scsi_qla_host_t *, ms_iocb_entry_t *); +void qla24xx_process_response_queue(scsi_qla_host_t *); +static void qla24xx_ms_entry(scsi_qla_host_t *, struct ct_entry_24xx *); + /** * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200. * @irq: @@ -45,7 +48,7 @@ qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs) int status; unsigned long flags; unsigned long iter; - uint32_t mbx; + uint16_t mb[4]; ha = (scsi_qla_host_t *) dev_id; if (!ha) { @@ -67,17 +70,20 @@ qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs) RD_REG_WORD(®->hccr); /* Get mailbox data. */ - mbx = RD_MAILBOX_REG(ha, reg, 0); - if (mbx > 0x3fff && mbx < 0x8000) { - qla2x00_mbx_completion(ha, (uint16_t)mbx); + mb[0] = RD_MAILBOX_REG(ha, reg, 0); + if (mb[0] > 0x3fff && mb[0] < 0x8000) { + qla2x00_mbx_completion(ha, mb[0]); status |= MBX_INTERRUPT; - } else if (mbx > 0x7fff && mbx < 0xc000) { - qla2x00_async_event(ha, mbx); + } else if (mb[0] > 0x7fff && mb[0] < 0xc000) { + mb[1] = RD_MAILBOX_REG(ha, reg, 1); + mb[2] = RD_MAILBOX_REG(ha, reg, 2); + mb[3] = RD_MAILBOX_REG(ha, reg, 3); + qla2x00_async_event(ha, mb); } else { /*EMPTY*/ DEBUG2(printk("scsi(%ld): Unrecognized " - "interrupt type (%d)\n", - ha->host_no, mbx)); + "interrupt type (%d).\n", + ha->host_no, mb[0])); } /* Release mailbox registers. */ WRT_REG_WORD(®->semaphore, 0); @@ -123,8 +129,8 @@ qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs) unsigned long flags; unsigned long iter; uint32_t stat; - uint32_t mbx; uint16_t hccr; + uint16_t mb[4]; ha = (scsi_qla_host_t *) dev_id; if (!ha) { @@ -146,7 +152,7 @@ qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs) "Parity error -- HCCR=%x.\n", hccr); else qla_printk(KERN_INFO, ha, - "RISC paused -- HCCR=%x\n", hccr); + "RISC paused -- HCCR=%x.\n", hccr); /* * Issue a "HARD" reset in order for the RISC @@ -160,35 +166,41 @@ qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs) } else if ((stat & HSR_RISC_INT) == 0) break; - mbx = MSW(stat); switch (stat & 0xff) { - case 0x13: - qla2x00_process_response_queue(ha); - break; case 0x1: case 0x2: case 0x10: case 0x11: - qla2x00_mbx_completion(ha, (uint16_t)mbx); + qla2x00_mbx_completion(ha, MSW(stat)); status |= MBX_INTERRUPT; /* Release mailbox registers. */ WRT_REG_WORD(®->semaphore, 0); break; case 0x12: - qla2x00_async_event(ha, mbx); + mb[0] = MSW(stat); + mb[1] = RD_MAILBOX_REG(ha, reg, 1); + mb[2] = RD_MAILBOX_REG(ha, reg, 2); + mb[3] = RD_MAILBOX_REG(ha, reg, 3); + qla2x00_async_event(ha, mb); + break; + case 0x13: + qla2x00_process_response_queue(ha); break; case 0x15: - mbx = mbx << 16 | MBA_CMPLT_1_16BIT; - qla2x00_async_event(ha, mbx); + mb[0] = MBA_CMPLT_1_16BIT; + mb[1] = MSW(stat); + qla2x00_async_event(ha, mb); break; case 0x16: - mbx = mbx << 16 | MBA_SCSI_COMPLETION; - qla2x00_async_event(ha, mbx); + mb[0] = MBA_SCSI_COMPLETION; + mb[1] = MSW(stat); + mb[2] = RD_MAILBOX_REG(ha, reg, 2); + qla2x00_async_event(ha, mb); break; default: DEBUG2(printk("scsi(%ld): Unrecognized interrupt type " - "(%d)\n", + "(%d).\n", ha->host_no, stat & 0xff)); break; } @@ -250,14 +262,14 @@ qla2x00_mbx_completion(scsi_qla_host_t *ha, uint16_t mb0) /** * qla2x00_async_event() - Process aynchronous events. * @ha: SCSI driver HA context - * @mb0: Mailbox0 register + * @mb: Mailbox registers (0 - 3) */ static void -qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) +qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) { - static char *link_speeds[5] = { "1", "2", "4", "?", "10" }; +#define LS_UNKNOWN 2 + static char *link_speeds[5] = { "1", "2", "?", "4", "10" }; char *link_speed; - uint16_t mb[4]; uint16_t handle_cnt; uint16_t cnt; uint32_t handles[5]; @@ -267,61 +279,48 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) /* Setup to process RIO completion. */ handle_cnt = 0; - mb[0] = LSW(mbx); switch (mb[0]) { case MBA_SCSI_COMPLETION: - if (IS_QLA2100(ha) || IS_QLA2200(ha)) - handles[0] = le32_to_cpu( - ((uint32_t)(RD_MAILBOX_REG(ha, reg, 2) << 16)) | - RD_MAILBOX_REG(ha, reg, 1)); - else - handles[0] = le32_to_cpu( - ((uint32_t)(RD_MAILBOX_REG(ha, reg, 2) << 16)) | - MSW(mbx)); + handles[0] = le32_to_cpu((uint32_t)((mb[2] << 16) | mb[1])); handle_cnt = 1; break; case MBA_CMPLT_1_16BIT: - if (IS_QLA2100(ha) || IS_QLA2200(ha)) - handles[0] = (uint32_t)RD_MAILBOX_REG(ha, reg, 1); - else - handles[0] = MSW(mbx); + handles[0] = mb[1]; handle_cnt = 1; mb[0] = MBA_SCSI_COMPLETION; break; case MBA_CMPLT_2_16BIT: - handles[0] = (uint32_t)RD_MAILBOX_REG(ha, reg, 1); - handles[1] = (uint32_t)RD_MAILBOX_REG(ha, reg, 2); + handles[0] = mb[1]; + handles[1] = mb[2]; handle_cnt = 2; mb[0] = MBA_SCSI_COMPLETION; break; case MBA_CMPLT_3_16BIT: - handles[0] = (uint32_t)RD_MAILBOX_REG(ha, reg, 1); - handles[1] = (uint32_t)RD_MAILBOX_REG(ha, reg, 2); - handles[2] = (uint32_t)RD_MAILBOX_REG(ha, reg, 3); + handles[0] = mb[1]; + handles[1] = mb[2]; + handles[2] = mb[3]; handle_cnt = 3; mb[0] = MBA_SCSI_COMPLETION; break; case MBA_CMPLT_4_16BIT: - handles[0] = (uint32_t)RD_MAILBOX_REG(ha, reg, 1); - handles[1] = (uint32_t)RD_MAILBOX_REG(ha, reg, 2); - handles[2] = (uint32_t)RD_MAILBOX_REG(ha, reg, 3); + handles[0] = mb[1]; + handles[1] = mb[2]; + handles[2] = mb[3]; handles[3] = (uint32_t)RD_MAILBOX_REG(ha, reg, 6); handle_cnt = 4; mb[0] = MBA_SCSI_COMPLETION; break; case MBA_CMPLT_5_16BIT: - handles[0] = (uint32_t)RD_MAILBOX_REG(ha, reg, 1); - handles[1] = (uint32_t)RD_MAILBOX_REG(ha, reg, 2); - handles[2] = (uint32_t)RD_MAILBOX_REG(ha, reg, 3); + handles[0] = mb[1]; + handles[1] = mb[2]; + handles[2] = mb[3]; handles[3] = (uint32_t)RD_MAILBOX_REG(ha, reg, 6); handles[4] = (uint32_t)RD_MAILBOX_REG(ha, reg, 7); handle_cnt = 5; mb[0] = MBA_SCSI_COMPLETION; break; case MBA_CMPLT_2_32BIT: - handles[0] = le32_to_cpu( - ((uint32_t)(RD_MAILBOX_REG(ha, reg, 2) << 16)) | - RD_MAILBOX_REG(ha, reg, 1)); + handles[0] = le32_to_cpu((uint32_t)((mb[2] << 16) | mb[1])); handles[1] = le32_to_cpu( ((uint32_t)(RD_MAILBOX_REG(ha, reg, 7) << 16)) | RD_MAILBOX_REG(ha, reg, 6)); @@ -358,7 +357,15 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) ha->isp_ops.fw_dump(ha, 1); - if (mb[1] == 0) { + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + if (mb[1] == 0 && mb[2] == 0) { + qla_printk(KERN_ERR, ha, + "Unrecoverable Hardware Error: adapter " + "marked OFFLINE!\n"); + ha->flags.online = 0; + } else + set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); + } else if (mb[1] == 0) { qla_printk(KERN_INFO, ha, "Unrecoverable Hardware Error: adapter marked " "OFFLINE!\n"); @@ -389,8 +396,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) break; case MBA_LIP_OCCURRED: /* Loop Initialization Procedure */ - mb[1] = RD_MAILBOX_REG(ha, reg, 1); - DEBUG2(printk("scsi(%ld): LIP occured (%x).\n", ha->host_no, mb[1])); qla_printk(KERN_INFO, ha, "LIP occured (%x).\n", mb[1]); @@ -411,13 +416,11 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) break; case MBA_LOOP_UP: /* Loop Up Event */ - mb[1] = RD_MAILBOX_REG(ha, reg, 1); - ha->link_data_rate = 0; if (IS_QLA2100(ha) || IS_QLA2200(ha)) { link_speed = link_speeds[0]; } else { - link_speed = link_speeds[3]; + link_speed = link_speeds[LS_UNKNOWN]; if (mb[1] < 5) link_speed = link_speeds[mb[1]]; ha->link_data_rate = mb[1]; @@ -435,9 +438,9 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) break; case MBA_LOOP_DOWN: /* Loop Down Event */ - DEBUG2(printk("scsi(%ld): Asynchronous LOOP DOWN.\n", - ha->host_no)); - qla_printk(KERN_INFO, ha, "LOOP DOWN detected.\n"); + DEBUG2(printk("scsi(%ld): Asynchronous LOOP DOWN (%x).\n", + ha->host_no, mb[1])); + qla_printk(KERN_INFO, ha, "LOOP DOWN detected (%x).\n", mb[1]); if (atomic_read(&ha->loop_state) != LOOP_DOWN) { atomic_set(&ha->loop_state, LOOP_DOWN); @@ -454,8 +457,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) break; case MBA_LIP_RESET: /* LIP reset occurred */ - mb[1] = RD_MAILBOX_REG(ha, reg, 1); - DEBUG2(printk("scsi(%ld): Asynchronous LIP RESET (%x).\n", ha->host_no, mb[1])); qla_printk(KERN_INFO, ha, @@ -506,8 +507,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) if (IS_QLA2100(ha)) break; - mb[1] = RD_MAILBOX_REG(ha, reg, 1); - DEBUG2(printk("scsi(%ld): Asynchronous Change In Connection " "received.\n", ha->host_no)); @@ -527,16 +526,14 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) break; case MBA_PORT_UPDATE: /* Port database update */ - mb[1] = RD_MAILBOX_REG(ha, reg, 1); - mb[2] = RD_MAILBOX_REG(ha, reg, 2); - /* * If a single remote port just logged into (or logged out of) * us, create a new entry in our rscn fcports list and handle * the event like an RSCN. */ if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA6312(ha) && - !IS_QLA6322(ha) && ha->flags.init_done && mb[1] != 0xffff && + !IS_QLA6322(ha) && !IS_QLA24XX(ha) && !IS_QLA25XX(ha) && + ha->flags.init_done && mb[1] != 0xffff && ((ha->operating_mode == P2P && mb[1] != 0) || (ha->operating_mode != P2P && mb[1] != SNS_FIRST_LOOP_ID)) && (mb[2] == 6 || mb[2] == 7)) { @@ -547,8 +544,9 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) rscn_fcport = qla2x00_alloc_rscn_fcport(ha, GFP_ATOMIC); if (rscn_fcport) { DEBUG14(printk("scsi(%ld): Port Update -- " - "creating RSCN fcport %p for %x/%x.\n", - ha->host_no, rscn_fcport, mb[1], mb[2])); + "creating RSCN fcport %p for %x/%x/%x.\n", + ha->host_no, rscn_fcport, mb[1], mb[2], + mb[3])); rscn_fcport->loop_id = mb[1]; rscn_fcport->d_id.b24 = INVALID_PORT_ID; @@ -577,15 +575,16 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) if (atomic_read(&ha->loop_state) != LOOP_DOWN && atomic_read(&ha->loop_state) != LOOP_DEAD) { DEBUG2(printk("scsi(%ld): Asynchronous PORT UPDATE " - "ignored.\n", ha->host_no)); + "ignored %04x/%04x/%04x.\n", ha->host_no, mb[1], + mb[2], mb[3])); break; } DEBUG2(printk("scsi(%ld): Asynchronous PORT UPDATE.\n", ha->host_no)); DEBUG(printk(KERN_INFO - "scsi(%ld): Port database changed %04x %04x.\n", - ha->host_no, mb[1], mb[2])); + "scsi(%ld): Port database changed %04x %04x %04x.\n", + ha->host_no, mb[1], mb[2], mb[3])); /* * Mark all devices as missing so we will login again. @@ -604,9 +603,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) break; case MBA_RSCN_UPDATE: /* State Change Registration */ - mb[1] = RD_MAILBOX_REG(ha, reg, 1); - mb[2] = RD_MAILBOX_REG(ha, reg, 2); - DEBUG2(printk("scsi(%ld): Asynchronous RSCR UPDATE.\n", ha->host_no)); DEBUG(printk(KERN_INFO @@ -655,6 +651,11 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx) qla2x00_process_response_queue(ha); break; + + case MBA_DISCARD_RND_FRAME: + DEBUG2(printk("scsi(%ld): Discard RND Frame -- %04x %04x " + "%04x.\n", ha->host_no, mb[1], mb[2], mb[3])); + break; } } @@ -801,31 +802,41 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha) * @pkt: Entry pointer */ static void -qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) +qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) { - unsigned b, t, l; srb_t *sp; fc_port_t *fcport; struct scsi_cmnd *cp; + sts_entry_t *sts; + struct sts_entry_24xx *sts24; uint16_t comp_status; uint16_t scsi_status; uint8_t lscsi_status; int32_t resid; - uint8_t sense_sz = 0; - uint16_t rsp_info_len; + uint32_t sense_len, rsp_info_len, resid_len; + uint8_t *rsp_info, *sense_data; + + sts = (sts_entry_t *) pkt; + sts24 = (struct sts_entry_24xx *) pkt; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + comp_status = le16_to_cpu(sts24->comp_status); + scsi_status = le16_to_cpu(sts24->scsi_status) & SS_MASK; + } else { + comp_status = le16_to_cpu(sts->comp_status); + scsi_status = le16_to_cpu(sts->scsi_status) & SS_MASK; + } /* Fast path completion. */ - if (le16_to_cpu(pkt->comp_status) == CS_COMPLETE && - (le16_to_cpu(pkt->scsi_status) & SS_MASK) == 0) { - qla2x00_process_completed_request(ha, pkt->handle); + if (comp_status == CS_COMPLETE && scsi_status == 0) { + qla2x00_process_completed_request(ha, sts->handle); return; } /* Validate handle. */ - if (pkt->handle < MAX_OUTSTANDING_COMMANDS) { - sp = ha->outstanding_cmds[pkt->handle]; - ha->outstanding_cmds[pkt->handle] = NULL; + if (sts->handle < MAX_OUTSTANDING_COMMANDS) { + sp = ha->outstanding_cmds[sts->handle]; + ha->outstanding_cmds[sts->handle] = NULL; } else sp = NULL; @@ -844,40 +855,49 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) if (cp == NULL) { DEBUG2(printk("scsi(%ld): Command already returned back to OS " "pkt->handle=%d sp=%p sp->state:%d\n", - ha->host_no, pkt->handle, sp, sp->state)); + ha->host_no, sts->handle, sp, sp->state)); qla_printk(KERN_WARNING, ha, "Command is NULL: already returned to OS (sp=%p)\n", sp); return; } - comp_status = le16_to_cpu(pkt->comp_status); - /* Mask of reserved bits 12-15, before we examine the scsi status */ - scsi_status = le16_to_cpu(pkt->scsi_status) & SS_MASK; - lscsi_status = scsi_status & STATUS_MASK; - - CMD_ENTRY_STATUS(cp) = pkt->entry_status; + lscsi_status = scsi_status & STATUS_MASK; + CMD_ENTRY_STATUS(cp) = sts->entry_status; CMD_COMPL_STATUS(cp) = comp_status; CMD_SCSI_STATUS(cp) = scsi_status; - /* Generate LU queue on cntrl, target, LUN */ - b = cp->device->channel; - t = cp->device->id; - l = cp->device->lun, - fcport = sp->fcport; + sense_len = rsp_info_len = resid_len = 0; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + sense_len = le32_to_cpu(sts24->sense_len); + rsp_info_len = le32_to_cpu(sts24->rsp_data_len); + resid_len = le32_to_cpu(sts24->rsp_residual_count); + rsp_info = sts24->data; + sense_data = sts24->data; + host_to_fcp_swap(sts24->data, sizeof(sts24->data)); + } else { + sense_len = le16_to_cpu(sts->req_sense_length); + rsp_info_len = le16_to_cpu(sts->rsp_info_len); + resid_len = le32_to_cpu(sts->residual_length); + rsp_info = sts->rsp_info; + sense_data = sts->req_sense_data; + } + /* Check for any FCP transport errors. */ if (scsi_status & SS_RESPONSE_INFO_LEN_VALID) { - rsp_info_len = le16_to_cpu(pkt->rsp_info_len); - if (rsp_info_len > 3 && pkt->rsp_info[3]) { + /* Sense data lies beyond any FCP RESPONSE data. */ + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + sense_data += rsp_info_len; + if (rsp_info_len > 3 && rsp_info[3]) { DEBUG2(printk("scsi(%ld:%d:%d:%d) FCP I/O protocol " "failure (%x/%02x%02x%02x%02x%02x%02x%02x%02x)..." - "retrying command\n", ha->host_no, b, t, l, - rsp_info_len, pkt->rsp_info[0], pkt->rsp_info[1], - pkt->rsp_info[2], pkt->rsp_info[3], - pkt->rsp_info[4], pkt->rsp_info[5], - pkt->rsp_info[6], pkt->rsp_info[7])); + "retrying command\n", ha->host_no, + cp->device->channel, cp->device->id, + cp->device->lun, rsp_info_len, rsp_info[0], + rsp_info[1], rsp_info[2], rsp_info[3], rsp_info[4], + rsp_info[5], rsp_info[6], rsp_info[7])); cp->result = DID_BUS_BUSY << 16; qla2x00_sp_compl(ha, sp); @@ -895,7 +915,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) break; } if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) { - resid = le32_to_cpu(pkt->residual_length); + resid = resid_len; cp->resid = resid; CMD_RESID_LEN(cp) = resid; } @@ -904,39 +924,34 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) if (lscsi_status != SS_CHECK_CONDITION) break; - /* - * Copy Sense Data into sense buffer - */ + /* Copy Sense Data into sense buffer. */ memset(cp->sense_buffer, 0, sizeof(cp->sense_buffer)); if (!(scsi_status & SS_SENSE_LEN_VALID)) break; - if (le16_to_cpu(pkt->req_sense_length) < - sizeof(cp->sense_buffer)) - sense_sz = le16_to_cpu(pkt->req_sense_length); - else - sense_sz = sizeof(cp->sense_buffer); + if (sense_len >= sizeof(cp->sense_buffer)) + sense_len = sizeof(cp->sense_buffer); - CMD_ACTUAL_SNSLEN(cp) = sense_sz; - sp->request_sense_length = sense_sz; + CMD_ACTUAL_SNSLEN(cp) = sense_len; + sp->request_sense_length = sense_len; sp->request_sense_ptr = cp->sense_buffer; if (sp->request_sense_length > 32) - sense_sz = 32; + sense_len = 32; - memcpy(cp->sense_buffer, pkt->req_sense_data, sense_sz); + memcpy(cp->sense_buffer, sense_data, sense_len); - sp->request_sense_ptr += sense_sz; - sp->request_sense_length -= sense_sz; + sp->request_sense_ptr += sense_len; + sp->request_sense_length -= sense_len; if (sp->request_sense_length != 0) ha->status_srb = sp; DEBUG5(printk("%s(): Check condition Sense data, " - "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", - __func__, ha->host_no, b, t, l, cp, - cp->serial_number)); - if (sense_sz) + "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", __func__, + ha->host_no, cp->device->channel, cp->device->id, + cp->device->lun, cp, cp->serial_number)); + if (sense_len) DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, CMD_ACTUAL_SNSLEN(cp))); break; @@ -944,9 +959,10 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) case CS_DATA_UNDERRUN: DEBUG2(printk(KERN_INFO "scsi(%ld:%d:%d) UNDERRUN status detected 0x%x-0x%x.\n", - ha->host_no, t, l, comp_status, scsi_status)); + ha->host_no, cp->device->id, cp->device->lun, comp_status, + scsi_status)); - resid = le32_to_cpu(pkt->residual_length); + resid = resid_len; if (scsi_status & SS_RESIDUAL_UNDER) { cp->resid = resid; CMD_RESID_LEN(cp) = resid; @@ -968,31 +984,30 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) if (!(scsi_status & SS_SENSE_LEN_VALID)) break; - if (le16_to_cpu(pkt->req_sense_length) < - sizeof(cp->sense_buffer)) - sense_sz = le16_to_cpu(pkt->req_sense_length); - else - sense_sz = sizeof(cp->sense_buffer); + if (sense_len >= sizeof(cp->sense_buffer)) + sense_len = sizeof(cp->sense_buffer); - CMD_ACTUAL_SNSLEN(cp) = sense_sz; - sp->request_sense_length = sense_sz; + CMD_ACTUAL_SNSLEN(cp) = sense_len; + sp->request_sense_length = sense_len; sp->request_sense_ptr = cp->sense_buffer; if (sp->request_sense_length > 32) - sense_sz = 32; + sense_len = 32; - memcpy(cp->sense_buffer, pkt->req_sense_data, sense_sz); + memcpy(cp->sense_buffer, sense_data, sense_len); - sp->request_sense_ptr += sense_sz; - sp->request_sense_length -= sense_sz; + sp->request_sense_ptr += sense_len; + sp->request_sense_length -= sense_len; if (sp->request_sense_length != 0) ha->status_srb = sp; DEBUG5(printk("%s(): Check condition Sense data, " "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", - __func__, ha->host_no, b, t, l, cp, + __func__, ha->host_no, cp->device->channel, + cp->device->id, cp->device->lun, cp, cp->serial_number)); - if (sense_sz) + + if (sense_len) DEBUG5(qla2x00_dump_buffer(cp->sense_buffer, CMD_ACTUAL_SNSLEN(cp))); } else { @@ -1004,8 +1019,9 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) if (!(scsi_status & SS_RESIDUAL_UNDER)) { DEBUG2(printk("scsi(%ld:%d:%d:%d) Dropped " "frame(s) detected (%x of %x bytes)..." - "retrying command.\n", - ha->host_no, b, t, l, resid, + "retrying command.\n", ha->host_no, + cp->device->channel, cp->device->id, + cp->device->lun, resid, cp->request_bufflen)); cp->result = DID_BUS_BUSY << 16; @@ -1018,8 +1034,9 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) qla_printk(KERN_INFO, ha, "scsi(%ld:%d:%d:%d): Mid-layer underflow " "detected (%x of %x bytes)...returning " - "error status.\n", - ha->host_no, b, t, l, resid, + "error status.\n", ha->host_no, + cp->device->channel, cp->device->id, + cp->device->lun, resid, cp->request_bufflen); cp->result = DID_ERROR << 16; @@ -1034,7 +1051,8 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) case CS_DATA_OVERRUN: DEBUG2(printk(KERN_INFO "scsi(%ld:%d:%d): OVERRUN status detected 0x%x-0x%x\n", - ha->host_no, t, l, comp_status, scsi_status)); + ha->host_no, cp->device->id, cp->device->lun, comp_status, + scsi_status)); DEBUG2(printk(KERN_INFO "CDB: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", cp->cmnd[0], cp->cmnd[1], cp->cmnd[2], cp->cmnd[3], @@ -1042,8 +1060,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) DEBUG2(printk(KERN_INFO "PID=0x%lx req=0x%x xtra=0x%x -- returning DID_ERROR " "status!\n", - cp->serial_number, cp->request_bufflen, - le32_to_cpu(pkt->residual_length))); + cp->serial_number, cp->request_bufflen, resid_len)); cp->result = DID_ERROR << 16; break; @@ -1060,7 +1077,8 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) */ DEBUG2(printk("scsi(%ld:%d:%d): status_entry: Port Down " "pid=%ld, compl status=0x%x, port state=0x%x\n", - ha->host_no, t, l, cp->serial_number, comp_status, + ha->host_no, cp->device->id, cp->device->lun, + cp->serial_number, comp_status, atomic_read(&fcport->state))); cp->result = DID_BUS_BUSY << 16; @@ -1091,17 +1109,25 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) break; case CS_TIMEOUT: + cp->result = DID_BUS_BUSY << 16; + + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { + DEBUG2(printk(KERN_INFO + "scsi(%ld:%d:%d:%d): TIMEOUT status detected " + "0x%x-0x%x\n", ha->host_no, cp->device->channel, + cp->device->id, cp->device->lun, comp_status, + scsi_status)); + break; + } DEBUG2(printk(KERN_INFO "scsi(%ld:%d:%d:%d): TIMEOUT status detected 0x%x-0x%x " - "sflags=%x.\n", ha->host_no, b, t, l, comp_status, - scsi_status, le16_to_cpu(pkt->status_flags))); - - cp->result = DID_BUS_BUSY << 16; + "sflags=%x.\n", ha->host_no, cp->device->channel, + cp->device->id, cp->device->lun, comp_status, scsi_status, + le16_to_cpu(sts->status_flags))); - /* Check to see if logout occurred */ - if ((le16_to_cpu(pkt->status_flags) & SF_LOGOUT_SENT)) { + /* Check to see if logout occurred. */ + if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) qla2x00_mark_device_lost(ha, fcport, 1); - } break; case CS_QUEUE_FULL: @@ -1117,8 +1143,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) default: DEBUG3(printk("scsi(%ld): Error detected (unknown status) " - "0x%x-0x%x.\n", - ha->host_no, comp_status, scsi_status)); + "0x%x-0x%x.\n", ha->host_no, comp_status, scsi_status)); qla_printk(KERN_INFO, ha, "Unknown status detected 0x%x-0x%x.\n", comp_status, scsi_status); @@ -1166,6 +1191,8 @@ qla2x00_status_cont_entry(scsi_qla_host_t *ha, sts_cont_entry_t *pkt) } /* Move sense data. */ + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + host_to_fcp_swap(pkt->data, sizeof(pkt->data)); memcpy(sp->request_sense_ptr, pkt->data, sense_sz); DEBUG5(qla2x00_dump_buffer(sp->request_sense_ptr, sense_sz)); @@ -1186,7 +1213,7 @@ qla2x00_status_cont_entry(scsi_qla_host_t *ha, sts_cont_entry_t *pkt) * @pkt: Entry pointer */ static void -qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) +qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) { srb_t *sp; @@ -1228,15 +1255,15 @@ qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) } qla2x00_sp_compl(ha, sp); - } else if (pkt->entry_type == COMMAND_A64_TYPE || - pkt->entry_type == COMMAND_TYPE) { + } else if (pkt->entry_type == COMMAND_A64_TYPE || pkt->entry_type == + COMMAND_TYPE || pkt->entry_type == COMMAND_TYPE_7) { DEBUG2(printk("scsi(%ld): Error entry - invalid handle\n", ha->host_no)); qla_printk(KERN_WARNING, ha, "Error entry - invalid handle\n"); set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); - if (ha->dpc_wait && !ha->dpc_active) + if (ha->dpc_wait && !ha->dpc_active) up(ha->dpc_wait); } } @@ -1247,7 +1274,7 @@ qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt) * @index: Response queue out pointer */ static void -qla2x00_ms_entry(scsi_qla_host_t *ha, ms_iocb_entry_t *pkt) +qla2x00_ms_entry(scsi_qla_host_t *ha, ms_iocb_entry_t *pkt) { srb_t *sp; @@ -1277,3 +1304,230 @@ qla2x00_ms_entry(scsi_qla_host_t *ha, ms_iocb_entry_t *pkt) qla2x00_sp_compl(ha, sp); } + + +/** + * qla24xx_mbx_completion() - Process mailbox command completions. + * @ha: SCSI driver HA context + * @mb0: Mailbox0 register + */ +static void +qla24xx_mbx_completion(scsi_qla_host_t *ha, uint16_t mb0) +{ + uint16_t cnt; + uint16_t __iomem *wptr; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + /* Load return mailbox registers. */ + ha->flags.mbox_int = 1; + ha->mailbox_out[0] = mb0; + wptr = (uint16_t __iomem *)®->mailbox1; + + for (cnt = 1; cnt < ha->mbx_count; cnt++) { + ha->mailbox_out[cnt] = RD_REG_WORD(wptr); + wptr++; + } + + if (ha->mcp) { + DEBUG3(printk("%s(%ld): Got mailbox completion. cmd=%x.\n", + __func__, ha->host_no, ha->mcp->mb[0])); + } else { + DEBUG2_3(printk("%s(%ld): MBX pointer ERROR!\n", + __func__, ha->host_no)); + } +} + +/** + * qla24xx_process_response_queue() - Process response queue entries. + * @ha: SCSI driver HA context + */ +void +qla24xx_process_response_queue(struct scsi_qla_host *ha) +{ + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + struct sts_entry_24xx *pkt; + + if (!ha->flags.online) + return; + + while (ha->response_ring_ptr->signature != RESPONSE_PROCESSED) { + pkt = (struct sts_entry_24xx *)ha->response_ring_ptr; + + ha->rsp_ring_index++; + if (ha->rsp_ring_index == ha->response_q_length) { + ha->rsp_ring_index = 0; + ha->response_ring_ptr = ha->response_ring; + } else { + ha->response_ring_ptr++; + } + + if (pkt->entry_status != 0) { + DEBUG3(printk(KERN_INFO + "scsi(%ld): Process error entry.\n", ha->host_no)); + + //FIXME + qla2x00_error_entry(ha, (sts_entry_t *) pkt); + ((response_t *)pkt)->signature = RESPONSE_PROCESSED; + wmb(); + continue; + } + + switch (pkt->entry_type) { + case STATUS_TYPE: + qla2x00_status_entry(ha, pkt); + break; + case STATUS_CONT_TYPE: + qla2x00_status_cont_entry(ha, (sts_cont_entry_t *)pkt); + break; + case MS_IOCB_TYPE: + qla24xx_ms_entry(ha, (struct ct_entry_24xx *)pkt); + break; + default: + /* Type Not Supported. */ + DEBUG4(printk(KERN_WARNING + "scsi(%ld): Received unknown response pkt type %x " + "entry status=%x.\n", + ha->host_no, pkt->entry_type, pkt->entry_status)); + break; + } + ((response_t *)pkt)->signature = RESPONSE_PROCESSED; + wmb(); + } + + /* Adjust ring index */ + WRT_REG_DWORD(®->rsp_q_out, ha->rsp_ring_index); +} + +/** + * qla24xx_intr_handler() - Process interrupts for the ISP23xx and ISP63xx. + * @irq: + * @dev_id: SCSI driver HA context + * @regs: + * + * Called by system whenever the host adapter generates an interrupt. + * + * Returns handled flag. + */ +irqreturn_t +qla24xx_intr_handler(int irq, void *dev_id, struct pt_regs *regs) +{ + scsi_qla_host_t *ha; + struct device_reg_24xx __iomem *reg; + int status; + unsigned long flags; + unsigned long iter; + uint32_t stat; + uint32_t hccr; + uint16_t mb[4]; + + ha = (scsi_qla_host_t *) dev_id; + if (!ha) { + printk(KERN_INFO + "%s(): NULL host pointer\n", __func__); + return IRQ_NONE; + } + + reg = &ha->iobase->isp24; + status = 0; + + spin_lock_irqsave(&ha->hardware_lock, flags); + for (iter = 50; iter--; ) { + stat = RD_REG_DWORD(®->host_status); + if (stat & HSRX_RISC_PAUSED) { + hccr = RD_REG_DWORD(®->hccr); + + qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, " + "Dumping firmware!\n", hccr); + qla24xx_fw_dump(ha, 1); + + set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); + break; + } else if ((stat & HSRX_RISC_INT) == 0) + break; + + switch (stat & 0xff) { + case 0x1: + case 0x2: + case 0x10: + case 0x11: + qla24xx_mbx_completion(ha, MSW(stat)); + status |= MBX_INTERRUPT; + + break; + case 0x12: + mb[0] = MSW(stat); + mb[1] = RD_REG_WORD(®->mailbox1); + mb[2] = RD_REG_WORD(®->mailbox2); + mb[3] = RD_REG_WORD(®->mailbox3); + qla2x00_async_event(ha, mb); + break; + case 0x13: + qla24xx_process_response_queue(ha); + break; + default: + DEBUG2(printk("scsi(%ld): Unrecognized interrupt type " + "(%d).\n", + ha->host_no, stat & 0xff)); + break; + } + WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT); + RD_REG_DWORD_RELAXED(®->hccr); + } + spin_unlock_irqrestore(&ha->hardware_lock, flags); + + if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && + (status & MBX_INTERRUPT) && ha->flags.mbox_int) { + spin_lock_irqsave(&ha->mbx_reg_lock, flags); + + set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); + up(&ha->mbx_intr_sem); + + spin_unlock_irqrestore(&ha->mbx_reg_lock, flags); + } + + return IRQ_HANDLED; +} + +/** + * qla24xx_ms_entry() - Process a Management Server entry. + * @ha: SCSI driver HA context + * @index: Response queue out pointer + */ +static void +qla24xx_ms_entry(scsi_qla_host_t *ha, struct ct_entry_24xx *pkt) +{ + srb_t *sp; + + DEBUG3(printk("%s(%ld): pkt=%p pkthandle=%d.\n", + __func__, ha->host_no, pkt, pkt->handle)); + + DEBUG9(printk("%s: ct pkt dump:\n", __func__);) + DEBUG9(qla2x00_dump_buffer((void *)pkt, sizeof(struct ct_entry_24xx));) + + /* Validate handle. */ + if (pkt->handle < MAX_OUTSTANDING_COMMANDS) + sp = ha->outstanding_cmds[pkt->handle]; + else + sp = NULL; + + if (sp == NULL) { + DEBUG2(printk("scsi(%ld): MS entry - invalid handle\n", + ha->host_no)); + DEBUG10(printk("scsi(%ld): MS entry - invalid handle\n", + ha->host_no)); + qla_printk(KERN_WARNING, ha, "MS entry - invalid handle %d\n", + pkt->handle); + + set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); + return; + } + + CMD_COMPL_STATUS(sp->cmd) = le16_to_cpu(pkt->comp_status); + CMD_ENTRY_STATUS(sp->cmd) = pkt->entry_status; + + /* Free outstanding command slot. */ + ha->outstanding_cmds[pkt->handle] = NULL; + + qla2x00_sp_compl(ha, sp); +} + -- cgit v1.2.3 From 0107109ed69c9e04b6fa35ac41d870c74dcce3fc Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:31:37 -0700 Subject: [SCSI] qla2xxx: Add ISP24xx initialization routines. Add ISP24xx initialization routines. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_gbl.h | 9 + drivers/scsi/qla2xxx/qla_init.c | 973 ++++++++++++++++++++++++++++++++++------ drivers/scsi/qla2xxx/qla_os.c | 1 + 3 files changed, 848 insertions(+), 135 deletions(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index d153d543a672..fcb42f56b5e2 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -35,13 +35,22 @@ extern int qla2x00_initialize_adapter(scsi_qla_host_t *); extern int qla2100_pci_config(struct scsi_qla_host *); extern int qla2300_pci_config(struct scsi_qla_host *); +extern int qla24xx_pci_config(scsi_qla_host_t *); extern void qla2x00_reset_chip(struct scsi_qla_host *); +extern void qla24xx_reset_chip(struct scsi_qla_host *); extern int qla2x00_chip_diag(struct scsi_qla_host *); +extern int qla24xx_chip_diag(struct scsi_qla_host *); extern void qla2x00_config_rings(struct scsi_qla_host *); +extern void qla24xx_config_rings(struct scsi_qla_host *); extern void qla2x00_reset_adapter(struct scsi_qla_host *); +extern void qla24xx_reset_adapter(struct scsi_qla_host *); extern int qla2x00_nvram_config(struct scsi_qla_host *); +extern int qla24xx_nvram_config(struct scsi_qla_host *); extern void qla2x00_update_fw_options(struct scsi_qla_host *); +extern void qla24xx_update_fw_options(scsi_qla_host_t *); extern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *); +extern int qla24xx_load_risc_flash(scsi_qla_host_t *, uint32_t *); +extern int qla24xx_load_risc_hotplug(scsi_qla_host_t *, uint32_t *); extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, int); diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index b0419661981e..786f2648114d 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -19,6 +19,8 @@ #include "qla_def.h" #include +#include +#include #include #include "qla_devtbl.h" @@ -87,6 +89,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha) ha->isp_abort_cnt = 0; ha->beacon_blink_led = 0; + qla_printk(KERN_INFO, ha, "Configuring PCI space...\n"); rval = ha->isp_ops.pci_config(ha); if (rval) { DEBUG2(printk("scsi(%ld): Unable to configure PCI space=n", @@ -97,6 +100,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha) ha->isp_ops.reset_chip(ha); qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n"); + ha->isp_ops.nvram_config(ha); qla_printk(KERN_INFO, ha, "Verifying loaded RISC code...\n"); @@ -129,6 +133,9 @@ check_fw_ready_again: if (rval == QLA_SUCCESS) { clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); + /* Issue a marker after FW becomes ready. */ + qla2x00_marker(ha, 0, 0, MK_SYNC_ALL); + /* * Wait at most MAX_TARGET RSCNs for a stable * link. @@ -172,7 +179,6 @@ check_fw_ready_again: if (rval == QLA_SUCCESS) { clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); - ha->marker_needed = 1; qla2x00_marker(ha, 0, 0, MK_SYNC_ALL); ha->marker_needed = 0; @@ -197,8 +203,6 @@ qla2100_pci_config(scsi_qla_host_t *ha) unsigned long flags; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; - qla_printk(KERN_INFO, ha, "Configuring PCI space...\n"); - pci_set_master(ha->pdev); mwi = 0; if (pci_set_mwi(ha->pdev)) @@ -236,8 +240,6 @@ qla2300_pci_config(scsi_qla_host_t *ha) uint32_t cnt; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; - qla_printk(KERN_INFO, ha, "Configuring PCI space...\n"); - pci_set_master(ha->pdev); mwi = 0; if (pci_set_mwi(ha->pdev)) @@ -311,6 +313,70 @@ qla2300_pci_config(scsi_qla_host_t *ha) return QLA_SUCCESS; } +/** + * qla24xx_pci_config() - Setup ISP24xx PCI configuration registers. + * @ha: HA context + * + * Returns 0 on success. + */ +int +qla24xx_pci_config(scsi_qla_host_t *ha) +{ + uint16_t w, mwi; + unsigned long flags = 0; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + int pcix_cmd_reg, pcie_dctl_reg; + + pci_set_master(ha->pdev); + mwi = 0; + if (pci_set_mwi(ha->pdev)) + mwi = PCI_COMMAND_INVALIDATE; + pci_read_config_word(ha->pdev, PCI_REVISION_ID, &ha->revision); + + pci_read_config_word(ha->pdev, PCI_COMMAND, &w); + w |= mwi | (PCI_COMMAND_PARITY | PCI_COMMAND_SERR); + w &= ~PCI_COMMAND_INTX_DISABLE; + pci_write_config_word(ha->pdev, PCI_COMMAND, w); + + pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80); + + /* PCI-X -- adjust Maximum Memory Read Byte Count (2048). */ + pcix_cmd_reg = pci_find_capability(ha->pdev, PCI_CAP_ID_PCIX); + if (pcix_cmd_reg) { + uint16_t pcix_cmd; + + pcix_cmd_reg += PCI_X_CMD; + pci_read_config_word(ha->pdev, pcix_cmd_reg, &pcix_cmd); + pcix_cmd &= ~PCI_X_CMD_MAX_READ; + pcix_cmd |= 0x0008; + pci_write_config_word(ha->pdev, pcix_cmd_reg, pcix_cmd); + } + + /* PCIe -- adjust Maximum Read Request Size (2048). */ + pcie_dctl_reg = pci_find_capability(ha->pdev, PCI_CAP_ID_EXP); + if (pcie_dctl_reg) { + uint16_t pcie_dctl; + + pcie_dctl_reg += PCI_EXP_DEVCTL; + pci_read_config_word(ha->pdev, pcie_dctl_reg, &pcie_dctl); + pcie_dctl &= ~PCI_EXP_DEVCTL_READRQ; + pcie_dctl |= 0x4000; + pci_write_config_word(ha->pdev, pcie_dctl_reg, pcie_dctl); + } + + /* Reset expansion ROM address decode enable */ + pci_read_config_word(ha->pdev, PCI_ROM_ADDRESS, &w); + w &= ~PCI_ROM_ADDRESS_ENABLE; + pci_write_config_word(ha->pdev, PCI_ROM_ADDRESS, w); + + /* Get PCI bus information. */ + spin_lock_irqsave(&ha->hardware_lock, flags); + ha->pci_attr = RD_REG_DWORD(®->ctrl_status); + spin_unlock_irqrestore(&ha->hardware_lock, flags); + + return QLA_SUCCESS; +} + /** * qla2x00_isp_firmware() - Choose firmware image. * @ha: HA context @@ -497,6 +563,61 @@ qla2x00_reset_chip(scsi_qla_host_t *ha) spin_unlock_irqrestore(&ha->hardware_lock, flags); } +/** + * qla24xx_reset_chip() - Reset ISP24xx chip. + * @ha: HA context + * + * Returns 0 on success. + */ +void +qla24xx_reset_chip(scsi_qla_host_t *ha) +{ + unsigned long flags = 0; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + uint32_t cnt, d2; + + ha->isp_ops.disable_intrs(ha); + + spin_lock_irqsave(&ha->hardware_lock, flags); + + /* Reset RISC. */ + WRT_REG_DWORD(®->ctrl_status, CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); + for (cnt = 0; cnt < 30000; cnt++) { + if ((RD_REG_DWORD(®->ctrl_status) & CSRX_DMA_ACTIVE) == 0) + break; + + udelay(10); + } + + WRT_REG_DWORD(®->ctrl_status, + CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); + udelay(20); + d2 = RD_REG_DWORD(®->ctrl_status); + for (cnt = 6000000 ; cnt && (d2 & CSRX_ISP_SOFT_RESET); cnt--) { + udelay(5); + d2 = RD_REG_DWORD(®->ctrl_status); + barrier(); + } + + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_RESET); + RD_REG_DWORD(®->hccr); + + WRT_REG_DWORD(®->hccr, HCCRX_REL_RISC_PAUSE); + RD_REG_DWORD(®->hccr); + + WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_RESET); + RD_REG_DWORD(®->hccr); + + d2 = (uint32_t) RD_REG_WORD(®->mailbox0); + for (cnt = 6000000 ; cnt && d2; cnt--) { + udelay(5); + d2 = (uint32_t) RD_REG_WORD(®->mailbox0); + barrier(); + } + + spin_unlock_irqrestore(&ha->hardware_lock, flags); +} + /** * qla2x00_chip_diag() - Test chip for proper operation. * @ha: HA context @@ -622,6 +743,91 @@ chip_diag_failed: return (rval); } +/** + * qla24xx_chip_diag() - Test ISP24xx for proper operation. + * @ha: HA context + * + * Returns 0 on success. + */ +int +qla24xx_chip_diag(scsi_qla_host_t *ha) +{ + int rval; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + unsigned long flags = 0; + uint32_t cnt, d2; + + spin_lock_irqsave(&ha->hardware_lock, flags); + + /* Reset RISC. */ + WRT_REG_DWORD(®->ctrl_status, CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); + for (cnt = 0; cnt < 30000; cnt++) { + if ((RD_REG_DWORD(®->ctrl_status) & + CSRX_DMA_ACTIVE) == 0) + break; + + udelay(10); + } + + WRT_REG_DWORD(®->ctrl_status, + CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES); + udelay(20); + d2 = RD_REG_DWORD(®->ctrl_status); + for (cnt = 6000000 ; cnt && (d2 & CSRX_ISP_SOFT_RESET); cnt--) { + udelay(5); + d2 = RD_REG_DWORD(®->ctrl_status); + barrier(); + } + + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_RESET); + RD_REG_DWORD(®->hccr); + + WRT_REG_DWORD(®->hccr, HCCRX_REL_RISC_PAUSE); + RD_REG_DWORD(®->hccr); + + WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_RESET); + RD_REG_DWORD(®->hccr); + + d2 = (uint32_t) RD_REG_WORD(®->mailbox0); + for (cnt = 6000000 ; cnt && d2; cnt--) { + udelay(5); + d2 = (uint32_t) RD_REG_WORD(®->mailbox0); + barrier(); + } + + spin_unlock_irqrestore(&ha->hardware_lock, flags); + + ha->fw_transfer_size = REQUEST_ENTRY_SIZE * 1024; + + rval = qla2x00_mbx_reg_test(ha); + if (rval) { + DEBUG(printk("scsi(%ld): Failed mailbox send register test\n", + ha->host_no)); + qla_printk(KERN_WARNING, ha, + "Failed mailbox send register test\n"); + } else { + /* Flag a successful rval */ + rval = QLA_SUCCESS; + } + + return rval; +} + +static void +qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) +{ + ha->fw_dumped = 0; + ha->fw_dump24_len = sizeof(struct qla24xx_fw_dump); + ha->fw_dump24_len += (ha->fw_memory_size - 0x100000) * sizeof(uint32_t); + ha->fw_dump24 = vmalloc(ha->fw_dump24_len); + if (ha->fw_dump24) + qla_printk(KERN_INFO, ha, "Allocated (%d KB) for firmware " + "dump...\n", ha->fw_dump24_len / 1024); + else + qla_printk(KERN_WARNING, ha, "Unable to allocate (%d KB) for " + "firmware dump!!!\n", ha->fw_dump24_len / 1024); +} + /** * qla2x00_resize_request_q() - Resize request queue given available ISP memory. * @ha: HA context @@ -641,6 +847,9 @@ qla2x00_resize_request_q(scsi_qla_host_t *ha) if (IS_QLA2100(ha) || IS_QLA2200(ha)) return; + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + qla2x00_alloc_fw_dump(ha); + /* Retrieve IOCB counts available to the firmware. */ rval = qla2x00_get_resource_cnts(ha, NULL, NULL, NULL, &fw_iocb_cnt); if (rval) @@ -684,91 +893,22 @@ qla2x00_resize_request_q(scsi_qla_host_t *ha) static int qla2x00_setup_chip(scsi_qla_host_t *ha) { - int rval; - uint16_t cnt; - uint16_t *risc_code; - unsigned long risc_address; - unsigned long risc_code_size; - int num; - int i; - uint16_t *req_ring; - struct qla_fw_info *fw_iter; - - rval = QLA_SUCCESS; + int rval; + uint32_t srisc_address = 0; /* Load firmware sequences */ - fw_iter = ha->brd_info->fw_info; - while (fw_iter->addressing != FW_INFO_ADDR_NOMORE) { - risc_code = fw_iter->fwcode; - risc_code_size = *fw_iter->fwlen; - - if (fw_iter->addressing == FW_INFO_ADDR_NORMAL) { - risc_address = *fw_iter->fwstart; - } else { - /* Extended address */ - risc_address = *fw_iter->lfwstart; - } - - num = 0; - rval = 0; - while (risc_code_size > 0 && !rval) { - cnt = (uint16_t)(ha->fw_transfer_size >> 1); - if (cnt > risc_code_size) - cnt = risc_code_size; - - DEBUG7(printk("scsi(%ld): Loading risc segment@ " - "addr %p, number of bytes 0x%x, offset 0x%lx.\n", - ha->host_no, risc_code, cnt, risc_address)); - - req_ring = (uint16_t *)ha->request_ring; - for (i = 0; i < cnt; i++) - req_ring[i] = cpu_to_le16(risc_code[i]); - - if (fw_iter->addressing == FW_INFO_ADDR_NORMAL) { - rval = qla2x00_load_ram(ha, - ha->request_dma, risc_address, cnt); - } else { - rval = qla2x00_load_ram_ext(ha, - ha->request_dma, risc_address, cnt); - } - if (rval) { - DEBUG(printk("scsi(%ld): [ERROR] Failed to " - "load segment %d of firmware\n", - ha->host_no, num)); - qla_printk(KERN_WARNING, ha, - "[ERROR] Failed to load " - "segment %d of firmware\n", num); - - qla2x00_dump_regs(ha); - break; - } - - risc_code += cnt; - risc_address += cnt; - risc_code_size -= cnt; - num++; - } - - /* Next firmware sequence */ - fw_iter++; - } - - /* Verify checksum of loaded RISC code. */ - if (!rval) { + rval = ha->isp_ops.load_risc(ha, &srisc_address); + if (rval == QLA_SUCCESS) { DEBUG(printk("scsi(%ld): Verifying Checksum of loaded RISC " "code.\n", ha->host_no)); - rval = qla2x00_verify_checksum(ha, - IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RISC_SADDRESS : - *ha->brd_info->fw_info[0].fwstart); + rval = qla2x00_verify_checksum(ha, srisc_address); if (rval == QLA_SUCCESS) { /* Start firmware execution. */ DEBUG(printk("scsi(%ld): Checksum OK, start " "firmware.\n", ha->host_no)); - rval = qla2x00_execute_fw(ha, - IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RISC_SADDRESS : - *ha->brd_info->fw_info[0].fwstart); + rval = qla2x00_execute_fw(ha, srisc_address); /* Retrieve firmware information. */ if (rval == QLA_SUCCESS && ha->fw_major_version == 0) { qla2x00_get_fw_version(ha, @@ -892,6 +1032,23 @@ qla2x00_update_fw_options(scsi_qla_host_t *ha) qla2x00_set_fw_options(ha, ha->fw_options); } +void +qla24xx_update_fw_options(scsi_qla_host_t *ha) +{ + int rval; + + /* Update Serial Link options. */ + if ((ha->fw_seriallink_options24[0] & BIT_0) == 0) + return; + + rval = qla2x00_set_serdes_params(ha, ha->fw_seriallink_options24[1], + ha->fw_seriallink_options24[2], ha->fw_seriallink_options24[3]); + if (rval != QLA_SUCCESS) { + qla_printk(KERN_WARNING, ha, + "Unable to update Serial Link options (%x).\n", rval); + } +} + void qla2x00_config_rings(struct scsi_qla_host *ha) { @@ -914,6 +1071,30 @@ qla2x00_config_rings(struct scsi_qla_host *ha) RD_REG_WORD(ISP_RSP_Q_OUT(ha, reg)); /* PCI Posting. */ } +void +qla24xx_config_rings(struct scsi_qla_host *ha) +{ + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + struct init_cb_24xx *icb; + + /* Setup ring parameters in initialization control block. */ + icb = (struct init_cb_24xx *)ha->init_cb; + icb->request_q_outpointer = __constant_cpu_to_le16(0); + icb->response_q_inpointer = __constant_cpu_to_le16(0); + icb->request_q_length = cpu_to_le16(ha->request_q_length); + icb->response_q_length = cpu_to_le16(ha->response_q_length); + icb->request_q_address[0] = cpu_to_le32(LSD(ha->request_dma)); + icb->request_q_address[1] = cpu_to_le32(MSD(ha->request_dma)); + icb->response_q_address[0] = cpu_to_le32(LSD(ha->response_dma)); + icb->response_q_address[1] = cpu_to_le32(MSD(ha->response_dma)); + + WRT_REG_DWORD(®->req_q_in, 0); + WRT_REG_DWORD(®->req_q_out, 0); + WRT_REG_DWORD(®->rsp_q_in, 0); + WRT_REG_DWORD(®->rsp_q_out, 0); + RD_REG_DWORD(®->rsp_q_out); +} + /** * qla2x00_init_rings() - Initializes firmware. * @ha: HA context @@ -960,7 +1141,7 @@ qla2x00_init_rings(scsi_qla_host_t *ha) ha->isp_ops.update_fw_options(ha); DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no)); - rval = qla2x00_init_firmware(ha, sizeof(init_cb_t)); + rval = qla2x00_init_firmware(ha, ha->init_cb_size); if (rval) { DEBUG2_3(printk("scsi(%ld): Init firmware **** FAILED ****.\n", ha->host_no)); @@ -1195,38 +1376,33 @@ qla2x00_configure_hba(scsi_qla_host_t *ha) int qla2x00_nvram_config(scsi_qla_host_t *ha) { - int rval; - uint8_t chksum = 0; - uint16_t cnt; - uint8_t *dptr1, *dptr2; - init_cb_t *icb = ha->init_cb; - nvram_t *nv = (nvram_t *)ha->request_ring; - uint16_t *wptr = (uint16_t *)ha->request_ring; + int rval; + uint8_t chksum = 0; + uint16_t cnt; + uint8_t *dptr1, *dptr2; + init_cb_t *icb = ha->init_cb; + nvram_t *nv = (nvram_t *)ha->request_ring; + uint8_t *ptr = (uint8_t *)ha->request_ring; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; - uint8_t timer_mode; + uint8_t timer_mode; rval = QLA_SUCCESS; /* Determine NVRAM starting address. */ + ha->nvram_size = sizeof(nvram_t); ha->nvram_base = 0; if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA2300(ha)) if ((RD_REG_WORD(®->ctrl_status) >> 14) == 1) ha->nvram_base = 0x80; /* Get NVRAM data and calculate checksum. */ - qla2x00_lock_nvram_access(ha); - for (cnt = 0; cnt < sizeof(nvram_t)/2; cnt++) { - *wptr = cpu_to_le16(qla2x00_get_nvram_word(ha, - (cnt+ha->nvram_base))); - chksum += (uint8_t)*wptr; - chksum += (uint8_t)(*wptr >> 8); - wptr++; - } - qla2x00_unlock_nvram_access(ha); + ha->isp_ops.read_nvram(ha, ptr, ha->nvram_base, ha->nvram_size); + for (cnt = 0, chksum = 0; cnt < ha->nvram_size; cnt++) + chksum += *ptr++; DEBUG5(printk("scsi(%ld): Contents of NVRAM\n", ha->host_no)); DEBUG5(qla2x00_dump_buffer((uint8_t *)ha->request_ring, - sizeof(nvram_t))); + ha->nvram_size)); /* Bad NVRAM data, set defaults parameters. */ if (chksum || nv->id[0] != 'I' || nv->id[1] != 'S' || @@ -1241,7 +1417,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) /* * Set default initialization control block. */ - memset(nv, 0, sizeof(nvram_t)); + memset(nv, 0, ha->nvram_size); nv->parameter_block_version = ICB_VERSION; if (IS_QLA23XX(ha)) { @@ -1301,7 +1477,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) #endif /* Reset Initialization control block */ - memset(icb, 0, sizeof(init_cb_t)); + memset(icb, 0, ha->init_cb_size); /* * Setup driver NVRAM options. @@ -1314,6 +1490,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) if (IS_QLA23XX(ha)) { nv->firmware_options[0] |= BIT_2; nv->firmware_options[0] &= ~BIT_3; + nv->add_firmware_options[1] |= BIT_5 | BIT_4; if (IS_QLA2300(ha)) { if (ha->fb_rev == FPM_2310) { @@ -1941,10 +2118,15 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) fc_port_t *fcport, *fcptemp; uint16_t next_loopid; uint16_t mb[MAILBOX_REGISTER_COUNT]; + uint16_t loop_id; LIST_HEAD(new_fcports); /* If FL port exists, then SNS is present */ - rval = qla2x00_get_port_name(ha, SNS_FL_PORT, NULL, 0); + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + loop_id = NPH_F_PORT; + else + loop_id = SNS_FL_PORT; + rval = qla2x00_get_port_name(ha, loop_id, NULL, 0); if (rval != QLA_SUCCESS) { DEBUG2(printk("scsi(%ld): MBC_GET_PORT_NAME Failed, No FL " "Port\n", ha->host_no)); @@ -1961,12 +2143,16 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) } do { /* Ensure we are logged into the SNS. */ - ha->isp_ops.fabric_login(ha, SIMPLE_NAME_SERVER, 0xff, 0xff, + if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) + loop_id = NPH_SNS; + else + loop_id = SIMPLE_NAME_SERVER; + ha->isp_ops.fabric_login(ha, loop_id, 0xff, 0xff, 0xfc, mb, BIT_1 | BIT_0); if (mb[0] != MBS_COMMAND_COMPLETE) { DEBUG2(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[2]=%x mb[6]=%x mb[7]=%x\n", loop_id, mb[0], mb[1], mb[2], mb[6], mb[7])); return (QLA_SUCCESS); } @@ -2050,7 +2236,6 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) break; } } - /* Login and update database */ qla2x00_fabric_dev_login(ha, fcport, &next_loopid); } @@ -2164,7 +2349,6 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) /* Starting free loop ID. */ loop_id = ha->min_external_loopid; - for (; loop_id <= ha->last_loop_id; loop_id++) { if (qla2x00_is_reserved_id(ha, loop_id)) continue; @@ -2450,6 +2634,7 @@ qla2x00_device_resync(scsi_qla_host_t *ha) case 0: if (!IS_QLA2100(ha) && !IS_QLA2200(ha) && !IS_QLA6312(ha) && !IS_QLA6322(ha) && + !IS_QLA24XX(ha) && !IS_QLA25XX(ha) && ha->flags.init_done) { /* Handle port RSCN via asyncronous IOCBs */ rval2 = qla2x00_handle_port_rscn(ha, rscn_entry, @@ -2518,17 +2703,24 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *ha, fc_port_t *fcport, { int rval; int retry; + uint8_t opts; rval = QLA_SUCCESS; retry = 0; rval = qla2x00_fabric_login(ha, fcport, next_loopid); if (rval == QLA_SUCCESS) { - rval = qla2x00_get_port_database(ha, fcport, 0); + /* Send an ADISC to tape devices.*/ + opts = 0; + if (fcport->flags & FCF_TAPE_PRESENT) + opts |= BIT_1; + rval = qla2x00_get_port_database(ha, fcport, opts); if (rval != QLA_SUCCESS) { ha->isp_ops.fabric_logout(ha, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); + qla2x00_mark_device_lost(ha, fcport, 1); + } else { qla2x00_update_fcport(ha, fcport); } @@ -2576,10 +2768,10 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport, if (mb[0] == MBS_PORT_ID_USED) { /* * Device has another loop ID. The firmware team - * recommends us to perform an implicit login with the - * specified ID again. The ID we just used is save here - * so we return with an ID that can be tried by the - * next login. + * recommends the driver perform an implicit login with + * the specified ID again. The ID we just used is save + * here so we return with an ID that can be tried by + * the next login. */ retry++; tmp_loopid = fcport->loop_id; @@ -2723,14 +2915,11 @@ qla2x00_loop_resync(scsi_qla_host_t *ha) /* Wait at most MAX_TARGET RSCNs for a stable link. */ wait_time = 256; do { - /* v2.19.05b6 */ atomic_set(&ha->loop_state, LOOP_UPDATE); - /* - * Issue marker command only when we are going - * to start the I/O . - */ - ha->marker_needed = 1; + /* Issue a marker after FW becomes ready. */ + qla2x00_marker(ha, 0, 0, MK_SYNC_ALL); + ha->marker_needed = 0; /* Remap devices on Loop. */ clear_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); @@ -2862,7 +3051,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) } else { /* schedule another ISP abort */ ha->isp_abort_cnt--; DEBUG(printk("qla%ld: ISP abort - " - "retry remainning %d\n", + "retry remaining %d\n", ha->host_no, ha->isp_abort_cnt);) status = 1; } @@ -2919,9 +3108,15 @@ qla2x00_restart_isp(scsi_qla_host_t *ha) spin_lock_irqsave(&ha->hardware_lock, flags); - /* Disable SRAM, Instruction RAM and GP RAM parity. */ - WRT_REG_WORD(®->hccr, (HCCR_ENABLE_PARITY + 0x0)); - RD_REG_WORD(®->hccr); /* PCI Posting. */ + if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha)) { + /* + * Disable SRAM, Instruction RAM and GP RAM + * parity. + */ + WRT_REG_WORD(®->hccr, + (HCCR_ENABLE_PARITY + 0x0)); + RD_REG_WORD(®->hccr); + } spin_unlock_irqrestore(&ha->hardware_lock, flags); @@ -2929,16 +3124,21 @@ qla2x00_restart_isp(scsi_qla_host_t *ha) spin_lock_irqsave(&ha->hardware_lock, flags); - /* Enable proper parity */ - if (IS_QLA2300(ha)) - /* SRAM parity */ - WRT_REG_WORD(®->hccr, - (HCCR_ENABLE_PARITY + 0x1)); - else - /* SRAM, Instruction RAM and GP RAM parity */ - WRT_REG_WORD(®->hccr, - (HCCR_ENABLE_PARITY + 0x7)); - RD_REG_WORD(®->hccr); /* PCI Posting. */ + if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha)) { + /* Enable proper parity */ + if (IS_QLA2300(ha)) + /* SRAM parity */ + WRT_REG_WORD(®->hccr, + (HCCR_ENABLE_PARITY + 0x1)); + else + /* + * SRAM, Instruction RAM and GP RAM + * parity. + */ + WRT_REG_WORD(®->hccr, + (HCCR_ENABLE_PARITY + 0x7)); + RD_REG_WORD(®->hccr); + } spin_unlock_irqrestore(&ha->hardware_lock, flags); } @@ -2949,9 +3149,11 @@ qla2x00_restart_isp(scsi_qla_host_t *ha) clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); if (!(status = qla2x00_fw_ready(ha))) { DEBUG(printk("%s(): Start configure loop, " - "status = %d\n", - __func__, - status);) + "status = %d\n", __func__, status);) + + /* Issue a marker after FW becomes ready. */ + qla2x00_marker(ha, 0, 0, MK_SYNC_ALL); + ha->flags.online = 1; /* Wait at most MAX_TARGET RSCNs for a stable link. */ wait_time = 256; @@ -2992,7 +3194,6 @@ qla2x00_reset_adapter(scsi_qla_host_t *ha) ha->flags.online = 0; ha->isp_ops.disable_intrs(ha); - /* Reset RISC processor. */ spin_lock_irqsave(&ha->hardware_lock, flags); WRT_REG_WORD(®->hccr, HCCR_RESET_RISC); RD_REG_WORD(®->hccr); /* PCI Posting. */ @@ -3000,3 +3201,505 @@ qla2x00_reset_adapter(scsi_qla_host_t *ha) RD_REG_WORD(®->hccr); /* PCI Posting. */ spin_unlock_irqrestore(&ha->hardware_lock, flags); } + +void +qla24xx_reset_adapter(scsi_qla_host_t *ha) +{ + unsigned long flags = 0; + struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; + + ha->flags.online = 0; + ha->isp_ops.disable_intrs(ha); + + spin_lock_irqsave(&ha->hardware_lock, flags); + WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_RESET); + RD_REG_DWORD(®->hccr); + WRT_REG_DWORD(®->hccr, HCCRX_REL_RISC_PAUSE); + RD_REG_DWORD(®->hccr); + spin_unlock_irqrestore(&ha->hardware_lock, flags); +} + +int +qla24xx_nvram_config(scsi_qla_host_t *ha) +{ + int rval; + struct init_cb_24xx *icb; + struct nvram_24xx *nv; + uint32_t *dptr; + uint8_t *dptr1, *dptr2; + uint32_t chksum; + uint16_t cnt; + + rval = QLA_SUCCESS; + icb = (struct init_cb_24xx *)ha->init_cb; + nv = (struct nvram_24xx *)ha->request_ring; + + /* Determine NVRAM starting address. */ + ha->nvram_size = sizeof(struct nvram_24xx); + ha->nvram_base = FA_NVRAM_FUNC0_ADDR; + if (PCI_FUNC(ha->pdev->devfn)) + ha->nvram_base = FA_NVRAM_FUNC1_ADDR; + + /* Get NVRAM data and calculate checksum. */ + dptr = (uint32_t *)nv; + ha->isp_ops.read_nvram(ha, (uint8_t *)dptr, ha->nvram_base, + ha->nvram_size); + for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++) + chksum += le32_to_cpu(*dptr++); + + DEBUG5(printk("scsi(%ld): Contents of NVRAM\n", ha->host_no)); + DEBUG5(qla2x00_dump_buffer((uint8_t *)ha->request_ring, + ha->nvram_size)); + + /* Bad NVRAM data, set defaults parameters. */ + if (chksum || nv->id[0] != 'I' || nv->id[1] != 'S' || nv->id[2] != 'P' + || nv->id[3] != ' ' || + nv->nvram_version < __constant_cpu_to_le16(ICB_VERSION)) { + /* Reset NVRAM data. */ + qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: " + "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0], + le16_to_cpu(nv->nvram_version)); + qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet " + "invalid -- WWPN) defaults.\n"); + + /* + * Set default initialization control block. + */ + memset(nv, 0, ha->nvram_size); + nv->nvram_version = __constant_cpu_to_le16(ICB_VERSION); + nv->version = __constant_cpu_to_le16(ICB_VERSION); + nv->frame_payload_size = __constant_cpu_to_le16(2048); + nv->execution_throttle = __constant_cpu_to_le16(0xFFFF); + nv->exchange_count = __constant_cpu_to_le16(0); + nv->hard_address = __constant_cpu_to_le16(124); + nv->port_name[0] = 0x21; + nv->port_name[1] = 0x00 + PCI_FUNC(ha->pdev->devfn); + nv->port_name[2] = 0x00; + nv->port_name[3] = 0xe0; + nv->port_name[4] = 0x8b; + nv->port_name[5] = 0x1c; + nv->port_name[6] = 0x55; + nv->port_name[7] = 0x86; + nv->node_name[0] = 0x20; + nv->node_name[1] = 0x00; + nv->node_name[2] = 0x00; + nv->node_name[3] = 0xe0; + nv->node_name[4] = 0x8b; + nv->node_name[5] = 0x1c; + nv->node_name[6] = 0x55; + nv->node_name[7] = 0x86; + nv->login_retry_count = __constant_cpu_to_le16(8); + nv->link_down_timeout = __constant_cpu_to_le16(200); + nv->interrupt_delay_timer = __constant_cpu_to_le16(0); + nv->login_timeout = __constant_cpu_to_le16(0); + nv->firmware_options_1 = + __constant_cpu_to_le32(BIT_14|BIT_13|BIT_2|BIT_1); + nv->firmware_options_2 = __constant_cpu_to_le32(2 << 4); + nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_12); + nv->firmware_options_3 = __constant_cpu_to_le32(2 << 13); + nv->host_p = __constant_cpu_to_le32(BIT_11|BIT_10); + nv->efi_parameters = __constant_cpu_to_le32(0); + nv->reset_delay = 5; + nv->max_luns_per_target = __constant_cpu_to_le16(128); + nv->port_down_retry_count = __constant_cpu_to_le16(30); + nv->link_down_timeout = __constant_cpu_to_le16(30); + + rval = 1; + } + + /* Reset Initialization control block */ + memset(icb, 0, sizeof(struct init_cb_24xx)); + + /* Copy 1st segment. */ + dptr1 = (uint8_t *)icb; + dptr2 = (uint8_t *)&nv->version; + cnt = (uint8_t *)&icb->response_q_inpointer - (uint8_t *)&icb->version; + while (cnt--) + *dptr1++ = *dptr2++; + + icb->login_retry_count = nv->login_retry_count; + icb->link_down_timeout = nv->link_down_timeout; + + /* Copy 2nd segment. */ + dptr1 = (uint8_t *)&icb->interrupt_delay_timer; + dptr2 = (uint8_t *)&nv->interrupt_delay_timer; + cnt = (uint8_t *)&icb->reserved_3 - + (uint8_t *)&icb->interrupt_delay_timer; + while (cnt--) + *dptr1++ = *dptr2++; + + /* + * Setup driver NVRAM options. + */ + if (memcmp(nv->model_name, BINZERO, sizeof(nv->model_name)) != 0) { + char *st, *en; + uint16_t index; + + strncpy(ha->model_number, nv->model_name, + sizeof(nv->model_name)); + st = en = ha->model_number; + en += sizeof(nv->model_name) - 1; + while (en > st) { + if (*en != 0x20 && *en != 0x00) + break; + *en-- = '\0'; + } + + index = (ha->pdev->subsystem_device & 0xff); + if (index < QLA_MODEL_NAMES) + ha->model_desc = qla2x00_model_desc[index]; + } else + strcpy(ha->model_number, "QLA2462"); + + /* Prepare nodename */ + if ((icb->firmware_options_1 & BIT_14) == 0) { + /* + * Firmware will apply the following mask if the nodename was + * not provided. + */ + memcpy(icb->node_name, icb->port_name, WWN_SIZE); + icb->node_name[0] &= 0xF0; + } + + /* Set host adapter parameters. */ + ha->flags.disable_risc_code_load = 0; + ha->flags.enable_lip_reset = 1; + ha->flags.enable_lip_full_login = 1; + ha->flags.enable_target_reset = 1; + ha->flags.enable_led_scheme = 0; + + ha->operating_mode = + (icb->firmware_options_2 & (BIT_6 | BIT_5 | BIT_4)) >> 4; + + memcpy(ha->fw_seriallink_options24, nv->seriallink_options, + sizeof(ha->fw_seriallink_options24)); + + /* save HBA serial number */ + ha->serial0 = icb->port_name[5]; + ha->serial1 = icb->port_name[6]; + ha->serial2 = icb->port_name[7]; + ha->node_name = icb->node_name; + ha->port_name = icb->port_name; + + ha->retry_count = le16_to_cpu(nv->login_retry_count); + + /* Set minimum login_timeout to 4 seconds. */ + if (le16_to_cpu(nv->login_timeout) < ql2xlogintimeout) + nv->login_timeout = cpu_to_le16(ql2xlogintimeout); + if (le16_to_cpu(nv->login_timeout) < 4) + nv->login_timeout = __constant_cpu_to_le16(4); + ha->login_timeout = le16_to_cpu(nv->login_timeout); + icb->login_timeout = cpu_to_le16(nv->login_timeout); + + /* Set minimum RATOV to 200 tenths of a second. */ + ha->r_a_tov = 200; + + ha->loop_reset_delay = nv->reset_delay; + + /* Link Down Timeout = 0: + * + * When Port Down timer expires we will start returning + * I/O's to OS with "DID_NO_CONNECT". + * + * Link Down Timeout != 0: + * + * The driver waits for the link to come up after link down + * before returning I/Os to OS with "DID_NO_CONNECT". + */ + if (le16_to_cpu(nv->link_down_timeout) == 0) { + ha->loop_down_abort_time = + (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT); + } else { + ha->link_down_timeout = le16_to_cpu(nv->link_down_timeout); + ha->loop_down_abort_time = + (LOOP_DOWN_TIME - ha->link_down_timeout); + } + + /* Need enough time to try and get the port back. */ + ha->port_down_retry_count = le16_to_cpu(nv->port_down_retry_count); + if (qlport_down_retry) + ha->port_down_retry_count = qlport_down_retry; + + /* Set login_retry_count */ + ha->login_retry_count = le16_to_cpu(nv->login_retry_count); + if (ha->port_down_retry_count == + le16_to_cpu(nv->port_down_retry_count) && + ha->port_down_retry_count > 3) + ha->login_retry_count = ha->port_down_retry_count; + else if (ha->port_down_retry_count > (int)ha->login_retry_count) + ha->login_retry_count = ha->port_down_retry_count; + if (ql2xloginretrycount) + ha->login_retry_count = ql2xloginretrycount; + + if (rval) { + DEBUG2_3(printk(KERN_WARNING + "scsi(%ld): NVRAM configuration failed!\n", ha->host_no)); + } + return (rval); +} + +int +qla2x00_load_risc(scsi_qla_host_t *ha, uint32_t *srisc_addr) +{ + int rval; + uint16_t cnt; + uint16_t *risc_code; + unsigned long risc_address; + unsigned long risc_code_size; + int num; + int i; + uint16_t *req_ring; + struct qla_fw_info *fw_iter; + + rval = QLA_SUCCESS; + + /* Load firmware sequences */ + fw_iter = ha->brd_info->fw_info; + *srisc_addr = *ha->brd_info->fw_info->fwstart; + while (fw_iter->addressing != FW_INFO_ADDR_NOMORE) { + risc_code = fw_iter->fwcode; + risc_code_size = *fw_iter->fwlen; + + if (fw_iter->addressing == FW_INFO_ADDR_NORMAL) { + risc_address = *fw_iter->fwstart; + } else { + /* Extended address */ + risc_address = *fw_iter->lfwstart; + } + + num = 0; + rval = 0; + while (risc_code_size > 0 && !rval) { + cnt = (uint16_t)(ha->fw_transfer_size >> 1); + if (cnt > risc_code_size) + cnt = risc_code_size; + + DEBUG7(printk("scsi(%ld): Loading risc segment@ " + "addr %p, number of bytes 0x%x, offset 0x%lx.\n", + ha->host_no, risc_code, cnt, risc_address)); + + req_ring = (uint16_t *)ha->request_ring; + for (i = 0; i < cnt; i++) + req_ring[i] = cpu_to_le16(risc_code[i]); + + if (fw_iter->addressing == FW_INFO_ADDR_NORMAL) { + rval = qla2x00_load_ram(ha, ha->request_dma, + risc_address, cnt); + } else { + rval = qla2x00_load_ram_ext(ha, + ha->request_dma, risc_address, cnt); + } + if (rval) { + DEBUG(printk("scsi(%ld): [ERROR] Failed to " + "load segment %d of firmware\n", + ha->host_no, num)); + qla_printk(KERN_WARNING, ha, + "[ERROR] Failed to load segment %d of " + "firmware\n", num); + + qla2x00_dump_regs(ha); + break; + } + + risc_code += cnt; + risc_address += cnt; + risc_code_size -= cnt; + num++; + } + + /* Next firmware sequence */ + fw_iter++; + } + + return (rval); +} + +int +qla24xx_load_risc_flash(scsi_qla_host_t *ha, uint32_t *srisc_addr) +{ + int rval; + int segments, fragment; + uint32_t faddr; + uint32_t *dcode, dlen; + uint32_t risc_addr; + uint32_t risc_size; + uint32_t i; + + rval = QLA_SUCCESS; + + segments = FA_RISC_CODE_SEGMENTS; + faddr = FA_RISC_CODE_ADDR; + dcode = (uint32_t *)ha->request_ring; + *srisc_addr = 0; + + /* Validate firmware image by checking version. */ + qla24xx_read_flash_data(ha, dcode, faddr + 4, 4); + for (i = 0; i < 4; i++) + dcode[i] = be32_to_cpu(dcode[i]); + if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff && + dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) || + (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 && + dcode[3] == 0)) { + qla_printk(KERN_WARNING, ha, + "Unable to verify integrity of flash firmware image!\n"); + qla_printk(KERN_WARNING, ha, + "Firmware data: %08x %08x %08x %08x!\n", dcode[0], + dcode[1], dcode[2], dcode[3]); + + return QLA_FUNCTION_FAILED; + } + + while (segments && rval == QLA_SUCCESS) { + /* Read segment's load information. */ + qla24xx_read_flash_data(ha, dcode, faddr, 4); + + risc_addr = be32_to_cpu(dcode[2]); + *srisc_addr = *srisc_addr == 0 ? risc_addr : *srisc_addr; + risc_size = be32_to_cpu(dcode[3]); + + fragment = 0; + while (risc_size > 0 && rval == QLA_SUCCESS) { + dlen = (uint32_t)(ha->fw_transfer_size >> 2); + if (dlen > risc_size) + dlen = risc_size; + + DEBUG7(printk("scsi(%ld): Loading risc segment@ risc " + "addr %x, number of dwords 0x%x, offset 0x%x.\n", + ha->host_no, risc_addr, dlen, faddr)); + + qla24xx_read_flash_data(ha, dcode, faddr, dlen); + for (i = 0; i < dlen; i++) + dcode[i] = swab32(dcode[i]); + + rval = qla2x00_load_ram_ext(ha, ha->request_dma, + risc_addr, dlen); + if (rval) { + DEBUG(printk("scsi(%ld):[ERROR] Failed to load " + "segment %d of firmware\n", ha->host_no, + fragment)); + qla_printk(KERN_WARNING, ha, + "[ERROR] Failed to load segment %d of " + "firmware\n", fragment); + break; + } + + faddr += dlen; + risc_addr += dlen; + risc_size -= dlen; + fragment++; + } + + /* Next segment. */ + segments--; + } + + return rval; +} + +int +qla24xx_load_risc_hotplug(scsi_qla_host_t *ha, uint32_t *srisc_addr) +{ + int rval; + int segments, fragment; + uint32_t *dcode, dlen; + uint32_t risc_addr; + uint32_t risc_size; + uint32_t i; + const struct firmware *fw_entry; + uint32_t *fwcode, fwclen; + + if (request_firmware(&fw_entry, ha->brd_info->fw_fname, + &ha->pdev->dev)) { + qla_printk(KERN_ERR, ha, + "Firmware image file not available: '%s'\n", + ha->brd_info->fw_fname); + return QLA_FUNCTION_FAILED; + } + + rval = QLA_SUCCESS; + + segments = FA_RISC_CODE_SEGMENTS; + dcode = (uint32_t *)ha->request_ring; + *srisc_addr = 0; + fwcode = (uint32_t *)fw_entry->data; + fwclen = 0; + + /* Validate firmware image by checking version. */ + if (fw_entry->size < 8 * sizeof(uint32_t)) { + qla_printk(KERN_WARNING, ha, + "Unable to verify integrity of flash firmware image " + "(%Zd)!\n", fw_entry->size); + goto fail_fw_integrity; + } + for (i = 0; i < 4; i++) + dcode[i] = be32_to_cpu(fwcode[i + 4]); + if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff && + dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) || + (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 && + dcode[3] == 0)) { + qla_printk(KERN_WARNING, ha, + "Unable to verify integrity of flash firmware image!\n"); + qla_printk(KERN_WARNING, ha, + "Firmware data: %08x %08x %08x %08x!\n", dcode[0], + dcode[1], dcode[2], dcode[3]); + goto fail_fw_integrity; + } + + while (segments && rval == QLA_SUCCESS) { + risc_addr = be32_to_cpu(fwcode[2]); + *srisc_addr = *srisc_addr == 0 ? risc_addr : *srisc_addr; + risc_size = be32_to_cpu(fwcode[3]); + + /* Validate firmware image size. */ + fwclen += risc_size * sizeof(uint32_t); + if (fw_entry->size < fwclen) { + qla_printk(KERN_WARNING, ha, + "Unable to verify integrity of flash firmware " + "image (%Zd)!\n", fw_entry->size); + goto fail_fw_integrity; + } + + fragment = 0; + while (risc_size > 0 && rval == QLA_SUCCESS) { + dlen = (uint32_t)(ha->fw_transfer_size >> 2); + if (dlen > risc_size) + dlen = risc_size; + + DEBUG7(printk("scsi(%ld): Loading risc segment@ risc " + "addr %x, number of dwords 0x%x.\n", ha->host_no, + risc_addr, dlen)); + + for (i = 0; i < dlen; i++) + dcode[i] = swab32(fwcode[i]); + + rval = qla2x00_load_ram_ext(ha, ha->request_dma, + risc_addr, dlen); + if (rval) { + DEBUG(printk("scsi(%ld):[ERROR] Failed to load " + "segment %d of firmware\n", ha->host_no, + fragment)); + qla_printk(KERN_WARNING, ha, + "[ERROR] Failed to load segment %d of " + "firmware\n", fragment); + break; + } + + fwcode += dlen; + risc_addr += dlen; + risc_size -= dlen; + fragment++; + } + + /* Next segment. */ + segments--; + } + + release_firmware(fw_entry); + return rval; + +fail_fw_integrity: + + release_firmware(fw_entry); + return QLA_FUNCTION_FAILED; + +} diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 9e6d05119253..973871833e32 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1175,6 +1175,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) ha->isp_ops.reset_adapter = qla2x00_reset_adapter; ha->isp_ops.nvram_config = qla2x00_nvram_config; ha->isp_ops.update_fw_options = qla2x00_update_fw_options; + ha->isp_ops.load_risc = qla2x00_load_risc; ha->isp_ops.pci_info_str = qla2x00_pci_info_str; ha->isp_ops.fw_version_str = qla2x00_fw_version_str; ha->isp_ops.intr_handler = qla2100_intr_handler; -- cgit v1.2.3 From ae91193cd5bc80b4d62b1d4f0e7f3fea48f41ccd Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Wed, 6 Jul 2005 10:32:27 -0700 Subject: [SCSI] qla2xxx: Update copyright banner. Update copyright banner. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/ql2100.c | 2 +- drivers/scsi/qla2xxx/ql2200.c | 2 +- drivers/scsi/qla2xxx/ql2300.c | 2 +- drivers/scsi/qla2xxx/ql2322.c | 2 +- drivers/scsi/qla2xxx/ql6312.c | 2 +- drivers/scsi/qla2xxx/qla_dbg.c | 2 +- drivers/scsi/qla2xxx/qla_dbg.h | 2 +- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_fw.h | 2 +- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_gs.c | 2 +- drivers/scsi/qla2xxx/qla_init.c | 2 +- drivers/scsi/qla2xxx/qla_inline.h | 2 +- drivers/scsi/qla2xxx/qla_iocb.c | 2 +- drivers/scsi/qla2xxx/qla_isr.c | 2 +- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- drivers/scsi/qla2xxx/qla_os.c | 2 +- drivers/scsi/qla2xxx/qla_rscn.c | 2 +- drivers/scsi/qla2xxx/qla_settings.h | 2 +- drivers/scsi/qla2xxx/qla_sup.c | 2 +- drivers/scsi/qla2xxx/qla_version.h | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) (limited to 'drivers/scsi/qla2xxx/qla_gbl.h') diff --git a/drivers/scsi/qla2xxx/ql2100.c b/drivers/scsi/qla2xxx/ql2100.c index ea136a61af40..058733d98d6b 100644 --- a/drivers/scsi/qla2xxx/ql2100.c +++ b/drivers/scsi/qla2xxx/ql2100.c @@ -1,7 +1,7 @@ /* * QLogic ISP2100 device driver for Linux 2.6.x * Copyright (C) 2003 Christoph Hellwig. - * Copyright (C) 2003-2004 QLogic Corporation (www.qlogic.com) + * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com) * * Released under GPL v2. */ diff --git a/drivers/scsi/qla2xxx/ql2200.c b/drivers/scsi/qla2xxx/ql2200.c index 2f5698d52722..5b5ee73744b2 100644 --- a/drivers/scsi/qla2xxx/ql2200.c +++ b/drivers/scsi/qla2xxx/ql2200.c @@ -1,7 +1,7 @@ /* * QLogic ISP2200 device driver for Linux 2.6.x * Copyright (C) 2003 Christoph Hellwig. - * Copyright (C) 2003-2004 QLogic Corporation (www.qlogic.com) + * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com) * * Released under GPL v2. */ diff --git a/drivers/scsi/qla2xxx/ql2300.c b/drivers/scsi/qla2xxx/ql2300.c index a4988cf99304..22371c864f0c 100644 --- a/drivers/scsi/qla2xxx/ql2300.c +++ b/drivers/scsi/qla2xxx/ql2300.c @@ -1,7 +1,7 @@ /* * QLogic ISP2300 device driver for Linux 2.6.x * Copyright (C) 2003 Christoph Hellwig. - * Copyright (C) 2003-2004 QLogic Corporation (www.qlogic.com) + * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com) * * Released under GPL v2. */ diff --git a/drivers/scsi/qla2xxx/ql2322.c b/drivers/scsi/qla2xxx/ql2322.c index 70b6d75ed634..bfe918a4a2cf 100644 --- a/drivers/scsi/qla2xxx/ql2322.c +++ b/drivers/scsi/qla2xxx/ql2322.c @@ -1,6 +1,6 @@ /* * QLogic ISP2322 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation (www.qlogic.com) + * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com) * * Released under GPL v2. */ diff --git a/drivers/scsi/qla2xxx/ql6312.c b/drivers/scsi/qla2xxx/ql6312.c index 59268eb80acd..e75882dd4cf6 100644 --- a/drivers/scsi/qla2xxx/ql6312.c +++ b/drivers/scsi/qla2xxx/ql6312.c @@ -1,6 +1,6 @@ /* * QLogic ISP6312 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation (www.qlogic.com) + * Copyright (C) 2003-2005 QLogic Corporation (www.qlogic.com) * * Released under GPL v2. */ diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index d5107aa15c1e..a20450e9a479 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index eaa0f0f0851a..b8d90e97e017 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index bd87d5f1ffbb..7a76e2aa6385 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x -* Copyright (C) 2003-2004 QLogic Corporation +* Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index bebc32eb5869..fd9df163410c 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -3,7 +3,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x -* Copyright (C) 2003-2004 QLogic Corporation +* Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index fcb42f56b5e2..665c203e0675 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x -* Copyright (C) 2003-2004 QLogic Corporation +* Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index bfebfc356975..31ce4f62da13 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index d2a367882e8b..ffe2ac66e69d 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 98f60bde2d4f..b9ff85b03a5f 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index c43ca670748a..5f3450429cd0 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index f6d94bea37f2..f910de6dd437 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 2731457911bf..409ea0ac4032 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index fd7e730bb3ba..cf104abfd047 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c index af68590c3d11..bdc3bc74bbe1 100644 --- a/drivers/scsi/qla2xxx/qla_rscn.c +++ b/drivers/scsi/qla2xxx/qla_rscn.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_settings.h b/drivers/scsi/qla2xxx/qla_settings.h index a7d8ed08e06b..d85fbbed79cc 100644 --- a/drivers/scsi/qla2xxx/qla_settings.h +++ b/drivers/scsi/qla2xxx/qla_settings.h @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index 9cfac8c184de..d7f5c608009c 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 232369d156c9..4d02d747fe98 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h @@ -2,7 +2,7 @@ * QLOGIC LINUX SOFTWARE * * QLogic ISP2x00 device driver for Linux 2.6.x - * Copyright (C) 2003-2004 QLogic Corporation + * Copyright (C) 2003-2005 QLogic Corporation * (www.qlogic.com) * * This program is free software; you can redistribute it and/or modify it -- cgit v1.2.3