2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2005-10-28 02:10:08 +08:00
|
|
|
* QLogic Fibre Channel HBA Driver
|
|
|
|
* Copyright (c) 2003-2005 QLogic Corporation
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2005-10-28 02:10:08 +08:00
|
|
|
* See LICENSE.qla2xxx for copyright and licensing details.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
#include "qla_def.h"
|
|
|
|
|
|
|
|
#include <linux/delay.h>
|
|
|
|
|
2006-06-24 07:10:29 +08:00
|
|
|
static inline void
|
|
|
|
qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump)
|
|
|
|
{
|
|
|
|
fw_dump->fw_major_version = htonl(ha->fw_major_version);
|
|
|
|
fw_dump->fw_minor_version = htonl(ha->fw_minor_version);
|
|
|
|
fw_dump->fw_subminor_version = htonl(ha->fw_subminor_version);
|
|
|
|
fw_dump->fw_attributes = htonl(ha->fw_attributes);
|
|
|
|
|
|
|
|
fw_dump->vendor = htonl(ha->pdev->vendor);
|
|
|
|
fw_dump->device = htonl(ha->pdev->device);
|
|
|
|
fw_dump->subsystem_vendor = htonl(ha->pdev->subsystem_vendor);
|
|
|
|
fw_dump->subsystem_device = htonl(ha->pdev->subsystem_device);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *
|
|
|
|
qla2xxx_copy_queues(scsi_qla_host_t *ha, void *ptr)
|
|
|
|
{
|
|
|
|
/* Request queue. */
|
|
|
|
memcpy(ptr, ha->request_ring, ha->request_q_length *
|
|
|
|
sizeof(request_t));
|
|
|
|
|
|
|
|
/* Response queue. */
|
|
|
|
ptr += ha->request_q_length * sizeof(request_t);
|
|
|
|
memcpy(ptr, ha->response_ring, ha->response_q_length *
|
|
|
|
sizeof(response_t));
|
|
|
|
|
|
|
|
return ptr + (ha->response_q_length * sizeof(response_t));
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2300_fw_dump() - Dumps binary data from the 2300 firmware.
|
|
|
|
* @ha: HA context
|
|
|
|
* @hardware_locked: Called with the hardware_lock
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
|
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
uint32_t cnt, timer;
|
|
|
|
uint32_t risc_address;
|
|
|
|
uint16_t mb0, mb2;
|
|
|
|
|
|
|
|
uint32_t stat;
|
2005-07-07 01:30:26 +08:00
|
|
|
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
|
2005-04-17 06:20:36 +08:00
|
|
|
uint16_t __iomem *dmp_reg;
|
|
|
|
unsigned long flags;
|
|
|
|
struct qla2300_fw_dump *fw;
|
2006-05-18 06:09:50 +08:00
|
|
|
uint32_t data_ram_cnt;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
risc_address = data_ram_cnt = 0;
|
|
|
|
mb0 = mb2 = 0;
|
|
|
|
flags = 0;
|
|
|
|
|
|
|
|
if (!hardware_locked)
|
|
|
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
|
|
|
|
2006-05-18 06:09:50 +08:00
|
|
|
if (!ha->fw_dump) {
|
2005-04-17 06:20:36 +08:00
|
|
|
qla_printk(KERN_WARNING, ha,
|
2006-05-18 06:09:50 +08:00
|
|
|
"No buffer available for dump!!!\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
goto qla2300_fw_dump_failed;
|
|
|
|
}
|
|
|
|
|
2006-05-18 06:09:50 +08:00
|
|
|
if (ha->fw_dumped) {
|
2005-04-17 06:20:36 +08:00
|
|
|
qla_printk(KERN_WARNING, ha,
|
2006-05-18 06:09:50 +08:00
|
|
|
"Firmware has been previously dumped (%p) -- ignoring "
|
|
|
|
"request...\n", ha->fw_dump);
|
2005-04-17 06:20:36 +08:00
|
|
|
goto qla2300_fw_dump_failed;
|
|
|
|
}
|
2006-06-24 07:10:29 +08:00
|
|
|
fw = &ha->fw_dump->isp.isp23;
|
|
|
|
qla2xxx_prep_dump(ha, ha->fw_dump);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
rval = QLA_SUCCESS;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->hccr = htons(RD_REG_WORD(®->hccr));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Pause RISC. */
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->hccr, HCCR_PAUSE_RISC);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (IS_QLA2300(ha)) {
|
|
|
|
for (cnt = 30000;
|
|
|
|
(RD_REG_WORD(®->hccr) & HCCR_RISC_PAUSE) == 0 &&
|
|
|
|
rval == QLA_SUCCESS; cnt--) {
|
|
|
|
if (cnt)
|
|
|
|
udelay(100);
|
|
|
|
else
|
|
|
|
rval = QLA_FUNCTION_TIMEOUT;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
RD_REG_WORD(®->hccr); /* PCI Posting. */
|
|
|
|
udelay(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
dmp_reg = (uint16_t __iomem *)(reg + 0);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x10);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x40);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x40);
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->resp_dma_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->resp_dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x50);
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x00);
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0xA0);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2000);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2200);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2400);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp2_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2600);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp3_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2800);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp4_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2A00);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp5_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2C00);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp6_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2E00);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp7_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x10);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->frame_buf_hdw_reg[cnt] =
|
|
|
|
htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x20);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->fpm_b0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x30);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->fpm_b1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Reset RISC. */
|
|
|
|
WRT_REG_WORD(®->ctrl_status, CSR_ISP_SOFT_RESET);
|
|
|
|
for (cnt = 0; cnt < 30000; cnt++) {
|
|
|
|
if ((RD_REG_WORD(®->ctrl_status) &
|
|
|
|
CSR_ISP_SOFT_RESET) == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
udelay(10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!IS_QLA2300(ha)) {
|
|
|
|
for (cnt = 30000; RD_MAILBOX_REG(ha, reg, 0) != 0 &&
|
|
|
|
rval == QLA_SUCCESS; cnt--) {
|
|
|
|
if (cnt)
|
|
|
|
udelay(100);
|
|
|
|
else
|
|
|
|
rval = QLA_FUNCTION_TIMEOUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
/* Get RISC SRAM. */
|
|
|
|
risc_address = 0x800;
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 0, MBC_READ_RAM_WORD);
|
|
|
|
clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
|
|
|
|
}
|
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_ram) / 2 && rval == QLA_SUCCESS;
|
|
|
|
cnt++, risc_address++) {
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 1, (uint16_t)risc_address);
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_SET_HOST_INT);
|
|
|
|
|
|
|
|
for (timer = 6000000; timer; timer--) {
|
|
|
|
/* Check for pending interrupts. */
|
|
|
|
stat = RD_REG_DWORD(®->u.isp2300.host_status);
|
|
|
|
if (stat & HSR_RISC_INT) {
|
|
|
|
stat &= 0xff;
|
|
|
|
|
|
|
|
if (stat == 0x1 || stat == 0x2) {
|
|
|
|
set_bit(MBX_INTERRUPT,
|
|
|
|
&ha->mbx_cmd_flags);
|
|
|
|
|
|
|
|
mb0 = RD_MAILBOX_REG(ha, reg, 0);
|
|
|
|
mb2 = RD_MAILBOX_REG(ha, reg, 2);
|
|
|
|
|
|
|
|
/* Release mailbox registers. */
|
|
|
|
WRT_REG_WORD(®->semaphore, 0);
|
|
|
|
WRT_REG_WORD(®->hccr,
|
|
|
|
HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
break;
|
|
|
|
} else if (stat == 0x10 || stat == 0x11) {
|
|
|
|
set_bit(MBX_INTERRUPT,
|
|
|
|
&ha->mbx_cmd_flags);
|
|
|
|
|
|
|
|
mb0 = RD_MAILBOX_REG(ha, reg, 0);
|
|
|
|
mb2 = RD_MAILBOX_REG(ha, reg, 2);
|
|
|
|
|
|
|
|
WRT_REG_WORD(®->hccr,
|
|
|
|
HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear this intr; it wasn't a mailbox intr */
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
}
|
|
|
|
udelay(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
|
|
|
|
rval = mb0 & MBS_MASK;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_ram[cnt] = htons(mb2);
|
2005-04-17 06:20:36 +08:00
|
|
|
} else {
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
/* Get stack SRAM. */
|
|
|
|
risc_address = 0x10000;
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 0, MBC_READ_RAM_EXTENDED);
|
|
|
|
clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
|
|
|
|
}
|
|
|
|
for (cnt = 0; cnt < sizeof(fw->stack_ram) / 2 && rval == QLA_SUCCESS;
|
|
|
|
cnt++, risc_address++) {
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 1, LSW(risc_address));
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 8, MSW(risc_address));
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_SET_HOST_INT);
|
|
|
|
|
|
|
|
for (timer = 6000000; timer; timer--) {
|
|
|
|
/* Check for pending interrupts. */
|
|
|
|
stat = RD_REG_DWORD(®->u.isp2300.host_status);
|
|
|
|
if (stat & HSR_RISC_INT) {
|
|
|
|
stat &= 0xff;
|
|
|
|
|
|
|
|
if (stat == 0x1 || stat == 0x2) {
|
|
|
|
set_bit(MBX_INTERRUPT,
|
|
|
|
&ha->mbx_cmd_flags);
|
|
|
|
|
|
|
|
mb0 = RD_MAILBOX_REG(ha, reg, 0);
|
|
|
|
mb2 = RD_MAILBOX_REG(ha, reg, 2);
|
|
|
|
|
|
|
|
/* Release mailbox registers. */
|
|
|
|
WRT_REG_WORD(®->semaphore, 0);
|
|
|
|
WRT_REG_WORD(®->hccr,
|
|
|
|
HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
break;
|
|
|
|
} else if (stat == 0x10 || stat == 0x11) {
|
|
|
|
set_bit(MBX_INTERRUPT,
|
|
|
|
&ha->mbx_cmd_flags);
|
|
|
|
|
|
|
|
mb0 = RD_MAILBOX_REG(ha, reg, 0);
|
|
|
|
mb2 = RD_MAILBOX_REG(ha, reg, 2);
|
|
|
|
|
|
|
|
WRT_REG_WORD(®->hccr,
|
|
|
|
HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear this intr; it wasn't a mailbox intr */
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
}
|
|
|
|
udelay(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
|
|
|
|
rval = mb0 & MBS_MASK;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->stack_ram[cnt] = htons(mb2);
|
2005-04-17 06:20:36 +08:00
|
|
|
} else {
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
/* Get data SRAM. */
|
|
|
|
risc_address = 0x11000;
|
|
|
|
data_ram_cnt = ha->fw_memory_size - risc_address + 1;
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 0, MBC_READ_RAM_EXTENDED);
|
|
|
|
clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
|
|
|
|
}
|
|
|
|
for (cnt = 0; cnt < data_ram_cnt && rval == QLA_SUCCESS;
|
|
|
|
cnt++, risc_address++) {
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 1, LSW(risc_address));
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 8, MSW(risc_address));
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_SET_HOST_INT);
|
|
|
|
|
|
|
|
for (timer = 6000000; timer; timer--) {
|
|
|
|
/* Check for pending interrupts. */
|
|
|
|
stat = RD_REG_DWORD(®->u.isp2300.host_status);
|
|
|
|
if (stat & HSR_RISC_INT) {
|
|
|
|
stat &= 0xff;
|
|
|
|
|
|
|
|
if (stat == 0x1 || stat == 0x2) {
|
|
|
|
set_bit(MBX_INTERRUPT,
|
|
|
|
&ha->mbx_cmd_flags);
|
|
|
|
|
|
|
|
mb0 = RD_MAILBOX_REG(ha, reg, 0);
|
|
|
|
mb2 = RD_MAILBOX_REG(ha, reg, 2);
|
|
|
|
|
|
|
|
/* Release mailbox registers. */
|
|
|
|
WRT_REG_WORD(®->semaphore, 0);
|
|
|
|
WRT_REG_WORD(®->hccr,
|
|
|
|
HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
break;
|
|
|
|
} else if (stat == 0x10 || stat == 0x11) {
|
|
|
|
set_bit(MBX_INTERRUPT,
|
|
|
|
&ha->mbx_cmd_flags);
|
|
|
|
|
|
|
|
mb0 = RD_MAILBOX_REG(ha, reg, 0);
|
|
|
|
mb2 = RD_MAILBOX_REG(ha, reg, 2);
|
|
|
|
|
|
|
|
WRT_REG_WORD(®->hccr,
|
|
|
|
HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear this intr; it wasn't a mailbox intr */
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
}
|
|
|
|
udelay(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
|
|
|
|
rval = mb0 & MBS_MASK;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->data_ram[cnt] = htons(mb2);
|
2005-04-17 06:20:36 +08:00
|
|
|
} else {
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-24 07:10:29 +08:00
|
|
|
if (rval == QLA_SUCCESS)
|
|
|
|
qla2xxx_copy_queues(ha, &fw->data_ram[cnt]);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
qla_printk(KERN_WARNING, ha,
|
|
|
|
"Failed to dump firmware (%x)!!!\n", rval);
|
2006-05-18 06:09:50 +08:00
|
|
|
ha->fw_dumped = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
} else {
|
|
|
|
qla_printk(KERN_INFO, ha,
|
|
|
|
"Firmware dump saved to temp buffer (%ld/%p).\n",
|
|
|
|
ha->host_no, ha->fw_dump);
|
2006-05-18 06:09:50 +08:00
|
|
|
ha->fw_dumped = 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
qla2300_fw_dump_failed:
|
|
|
|
if (!hardware_locked)
|
|
|
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qla2100_fw_dump() - Dumps binary data from the 2100/2200 firmware.
|
|
|
|
* @ha: HA context
|
|
|
|
* @hardware_locked: Called with the hardware_lock
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
|
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
uint32_t cnt, timer;
|
|
|
|
uint16_t risc_address;
|
|
|
|
uint16_t mb0, mb2;
|
2005-07-07 01:30:26 +08:00
|
|
|
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
|
2005-04-17 06:20:36 +08:00
|
|
|
uint16_t __iomem *dmp_reg;
|
|
|
|
unsigned long flags;
|
|
|
|
struct qla2100_fw_dump *fw;
|
|
|
|
|
|
|
|
risc_address = 0;
|
|
|
|
mb0 = mb2 = 0;
|
|
|
|
flags = 0;
|
|
|
|
|
|
|
|
if (!hardware_locked)
|
|
|
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
|
|
|
|
2006-05-18 06:09:50 +08:00
|
|
|
if (!ha->fw_dump) {
|
2005-04-17 06:20:36 +08:00
|
|
|
qla_printk(KERN_WARNING, ha,
|
2006-05-18 06:09:50 +08:00
|
|
|
"No buffer available for dump!!!\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
goto qla2100_fw_dump_failed;
|
|
|
|
}
|
|
|
|
|
2006-05-18 06:09:50 +08:00
|
|
|
if (ha->fw_dumped) {
|
2005-04-17 06:20:36 +08:00
|
|
|
qla_printk(KERN_WARNING, ha,
|
2006-05-18 06:09:50 +08:00
|
|
|
"Firmware has been previously dumped (%p) -- ignoring "
|
|
|
|
"request...\n", ha->fw_dump);
|
2005-04-17 06:20:36 +08:00
|
|
|
goto qla2100_fw_dump_failed;
|
|
|
|
}
|
2006-06-24 07:10:29 +08:00
|
|
|
fw = &ha->fw_dump->isp.isp21;
|
|
|
|
qla2xxx_prep_dump(ha, ha->fw_dump);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
rval = QLA_SUCCESS;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->hccr = htons(RD_REG_WORD(®->hccr));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Pause RISC. */
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->hccr, HCCR_PAUSE_RISC);
|
2005-04-17 06:20:36 +08:00
|
|
|
for (cnt = 30000; (RD_REG_WORD(®->hccr) & HCCR_RISC_PAUSE) == 0 &&
|
|
|
|
rval == QLA_SUCCESS; cnt--) {
|
|
|
|
if (cnt)
|
|
|
|
udelay(100);
|
|
|
|
else
|
|
|
|
rval = QLA_FUNCTION_TIMEOUT;
|
|
|
|
}
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
dmp_reg = (uint16_t __iomem *)(reg + 0);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x10);
|
|
|
|
for (cnt = 0; cnt < ha->mbx_count; cnt++) {
|
|
|
|
if (cnt == 8) {
|
2006-06-24 07:10:29 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)
|
|
|
|
((uint8_t __iomem *)reg + 0xe0);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x20);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x00);
|
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0xA0);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2000);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2100);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2200);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp2_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2300);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp3_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2400);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp4_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2500);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp5_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2600);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp6_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->pcr, 0x2700);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_gp7_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x10);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->frame_buf_hdw_reg[cnt] =
|
|
|
|
htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x20);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->fpm_b0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->ctrl_status, 0x30);
|
2005-04-17 06:20:36 +08:00
|
|
|
dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
2005-07-07 01:32:07 +08:00
|
|
|
for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->fpm_b1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Reset the ISP. */
|
|
|
|
WRT_REG_WORD(®->ctrl_status, CSR_ISP_SOFT_RESET);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (cnt = 30000; RD_MAILBOX_REG(ha, reg, 0) != 0 &&
|
|
|
|
rval == QLA_SUCCESS; cnt--) {
|
|
|
|
if (cnt)
|
|
|
|
udelay(100);
|
|
|
|
else
|
|
|
|
rval = QLA_FUNCTION_TIMEOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Pause RISC. */
|
|
|
|
if (rval == QLA_SUCCESS && (IS_QLA2200(ha) || (IS_QLA2100(ha) &&
|
|
|
|
(RD_REG_WORD(®->mctr) & (BIT_1 | BIT_0)) != 0))) {
|
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
WRT_REG_WORD(®->hccr, HCCR_PAUSE_RISC);
|
2005-04-17 06:20:36 +08:00
|
|
|
for (cnt = 30000;
|
|
|
|
(RD_REG_WORD(®->hccr) & HCCR_RISC_PAUSE) == 0 &&
|
|
|
|
rval == QLA_SUCCESS; cnt--) {
|
|
|
|
if (cnt)
|
|
|
|
udelay(100);
|
|
|
|
else
|
|
|
|
rval = QLA_FUNCTION_TIMEOUT;
|
|
|
|
}
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
/* Set memory configuration and timing. */
|
|
|
|
if (IS_QLA2100(ha))
|
|
|
|
WRT_REG_WORD(®->mctr, 0xf1);
|
|
|
|
else
|
|
|
|
WRT_REG_WORD(®->mctr, 0xf2);
|
|
|
|
RD_REG_WORD(®->mctr); /* PCI Posting. */
|
|
|
|
|
|
|
|
/* Release RISC. */
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_RELEASE_RISC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
/* Get RISC SRAM. */
|
|
|
|
risc_address = 0x1000;
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 0, MBC_READ_RAM_WORD);
|
|
|
|
clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
|
|
|
|
}
|
|
|
|
for (cnt = 0; cnt < sizeof(fw->risc_ram) / 2 && rval == QLA_SUCCESS;
|
|
|
|
cnt++, risc_address++) {
|
|
|
|
WRT_MAILBOX_REG(ha, reg, 1, risc_address);
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_SET_HOST_INT);
|
|
|
|
|
|
|
|
for (timer = 6000000; timer != 0; timer--) {
|
|
|
|
/* Check for pending interrupts. */
|
|
|
|
if (RD_REG_WORD(®->istatus) & ISR_RISC_INT) {
|
|
|
|
if (RD_REG_WORD(®->semaphore) & BIT_0) {
|
|
|
|
set_bit(MBX_INTERRUPT,
|
|
|
|
&ha->mbx_cmd_flags);
|
|
|
|
|
|
|
|
mb0 = RD_MAILBOX_REG(ha, reg, 0);
|
|
|
|
mb2 = RD_MAILBOX_REG(ha, reg, 2);
|
|
|
|
|
|
|
|
WRT_REG_WORD(®->semaphore, 0);
|
|
|
|
WRT_REG_WORD(®->hccr,
|
|
|
|
HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
WRT_REG_WORD(®->hccr, HCCR_CLR_RISC_INT);
|
|
|
|
RD_REG_WORD(®->hccr);
|
|
|
|
}
|
|
|
|
udelay(5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test_and_clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags)) {
|
|
|
|
rval = mb0 & MBS_MASK;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->risc_ram[cnt] = htons(mb2);
|
2005-04-17 06:20:36 +08:00
|
|
|
} else {
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-24 07:10:29 +08:00
|
|
|
if (rval == QLA_SUCCESS)
|
|
|
|
qla2xxx_copy_queues(ha, &fw->risc_ram[cnt]);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (rval != QLA_SUCCESS) {
|
|
|
|
qla_printk(KERN_WARNING, ha,
|
|
|
|
"Failed to dump firmware (%x)!!!\n", rval);
|
2006-05-18 06:09:50 +08:00
|
|
|
ha->fw_dumped = 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
} else {
|
|
|
|
qla_printk(KERN_INFO, ha,
|
|
|
|
"Firmware dump saved to temp buffer (%ld/%p).\n",
|
|
|
|
ha->host_no, ha->fw_dump);
|
2006-05-18 06:09:50 +08:00
|
|
|
ha->fw_dumped = 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
qla2100_fw_dump_failed:
|
|
|
|
if (!hardware_locked)
|
|
|
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
|
|
|
}
|
|
|
|
|
2005-07-07 01:30:36 +08:00
|
|
|
void
|
|
|
|
qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
|
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
uint32_t cnt, timer;
|
|
|
|
uint32_t risc_address;
|
2005-11-09 06:37:48 +08:00
|
|
|
uint16_t mb[4], wd;
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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;
|
2006-06-24 07:10:29 +08:00
|
|
|
void *eft;
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
risc_address = ext_mem_cnt = 0;
|
|
|
|
memset(mb, 0, sizeof(mb));
|
|
|
|
flags = 0;
|
|
|
|
|
|
|
|
if (!hardware_locked)
|
|
|
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
|
|
|
|
2006-05-18 06:09:50 +08:00
|
|
|
if (!ha->fw_dump) {
|
2005-07-07 01:30:36 +08:00
|
|
|
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 "
|
2006-05-18 06:09:50 +08:00
|
|
|
"request...\n", ha->fw_dump);
|
2005-07-07 01:30:36 +08:00
|
|
|
goto qla24xx_fw_dump_failed;
|
|
|
|
}
|
2006-06-24 07:10:29 +08:00
|
|
|
fw = &ha->fw_dump->isp.isp24;
|
|
|
|
qla2xxx_prep_dump(ha, ha->fw_dump);
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
rval = QLA_SUCCESS;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->host_status = htonl(RD_REG_DWORD(®->host_status));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* Pause RISC. */
|
2006-01-14 09:05:21 +08:00
|
|
|
if ((RD_REG_DWORD(®->hccr) & HCCRX_RISC_PAUSE) == 0) {
|
2005-07-07 01:30:36 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
/* Host interface registers. */
|
|
|
|
dmp_reg = (uint32_t __iomem *)(reg + 0);
|
|
|
|
for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->host_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
2006-01-14 09:05:21 +08:00
|
|
|
/* Disable interrupts. */
|
|
|
|
WRT_REG_DWORD(®->ictrl, 0);
|
|
|
|
RD_REG_DWORD(®->ictrl);
|
|
|
|
|
|
|
|
/* Shadow registers. */
|
|
|
|
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);
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->shadow_reg[0] = htonl(RD_REG_DWORD(dmp_reg));
|
2006-01-14 09:05:21 +08:00
|
|
|
|
|
|
|
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);
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->shadow_reg[1] = htonl(RD_REG_DWORD(dmp_reg));
|
2006-01-14 09:05:21 +08:00
|
|
|
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xF0);
|
|
|
|
WRT_REG_DWORD(dmp_reg, 0xB0200000);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xFC);
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->shadow_reg[2] = htonl(RD_REG_DWORD(dmp_reg));
|
2006-01-14 09:05:21 +08:00
|
|
|
|
|
|
|
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);
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->shadow_reg[3] = htonl(RD_REG_DWORD(dmp_reg));
|
2006-01-14 09:05:21 +08:00
|
|
|
|
|
|
|
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);
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->shadow_reg[4] = htonl(RD_REG_DWORD(dmp_reg));
|
2006-01-14 09:05:21 +08:00
|
|
|
|
|
|
|
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);
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->shadow_reg[5] = htonl(RD_REG_DWORD(dmp_reg));
|
2006-01-14 09:05:21 +08:00
|
|
|
|
|
|
|
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);
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->shadow_reg[6] = htonl(RD_REG_DWORD(dmp_reg));
|
2006-01-14 09:05:21 +08:00
|
|
|
|
2005-07-07 01:30:36 +08:00
|
|
|
/* Mailbox registers. */
|
|
|
|
mbx_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80);
|
|
|
|
for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xBF10);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xBF20);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xBF30);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xBF40);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xBF50);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xBF60);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xBF70);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->xseq_0_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->xseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xFF10);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xFF20);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xFF30);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xFF40);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xFF50);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xFF60);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0xFF70);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->rseq_0_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->rseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->rseq_2_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->cmd_dma_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4);
|
|
|
|
for (cnt = 0; cnt < 7; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4);
|
|
|
|
for (cnt = 0; cnt < 7; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xE4);
|
|
|
|
for (cnt = 0; cnt < 7; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x7610);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x7630);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x7650);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x7670);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x7690);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->xmt_data_dma_reg[cnt] =
|
|
|
|
htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x7710);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x7730);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x0F10);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x0F20);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x0F30);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x0F40);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x0F50);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x0F60);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x0F70);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x3010);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x3020);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x3030);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x3040);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x3050);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x3060);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4010);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4020);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4030);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4040);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4050);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4060);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4070);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4080);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x4090);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x40A0);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x40B0);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6010);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6020);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6030);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6040);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6100);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6130);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6150);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6170);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x6190);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
WRT_REG_DWORD(®->iobase_addr, 0x61B0);
|
|
|
|
dmp_reg = (uint32_t __iomem *)((uint8_t __iomem *)reg + 0xC0);
|
|
|
|
for (cnt = 0; cnt < 16; cnt++)
|
2006-06-24 07:10:29 +08:00
|
|
|
*iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
|
2005-07-07 01:30:36 +08:00
|
|
|
|
|
|
|
/* 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);
|
2005-11-09 06:37:48 +08:00
|
|
|
pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
|
2005-07-09 08:59:26 +08:00
|
|
|
|
2005-11-09 06:37:48 +08:00
|
|
|
udelay(100);
|
2005-07-09 08:59:26 +08:00
|
|
|
/* Wait for firmware to complete NVRAM accesses. */
|
|
|
|
mb[0] = (uint32_t) RD_REG_WORD(®->mailbox0);
|
|
|
|
for (cnt = 10000 ; cnt && mb[0]; cnt--) {
|
|
|
|
udelay(5);
|
|
|
|
mb[0] = (uint32_t) RD_REG_WORD(®->mailbox0);
|
|
|
|
barrier();
|
|
|
|
}
|
|
|
|
|
2005-11-09 06:37:48 +08:00
|
|
|
/* Wait for soft-reset to complete. */
|
2005-07-07 01:30:36 +08:00
|
|
|
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;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->code_ram[cnt] = htonl((mb[3] << 16) | mb[2]);
|
2005-07-07 01:30:36 +08:00
|
|
|
} 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;
|
2006-06-24 07:10:29 +08:00
|
|
|
fw->ext_mem[cnt] = htonl((mb[3] << 16) | mb[2]);
|
2005-07-07 01:30:36 +08:00
|
|
|
} else {
|
|
|
|
rval = QLA_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-24 07:10:29 +08:00
|
|
|
if (rval == QLA_SUCCESS) {
|
|
|
|
eft = qla2xxx_copy_queues(ha, &fw->ext_mem[cnt]);
|
|
|
|
if (ha->eft)
|
|
|
|
memcpy(eft, ha->eft, ntohl(ha->fw_dump->eft_size));
|
|
|
|
}
|
|
|
|
|
2005-07-07 01:30:36 +08:00
|
|
|
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",
|
2006-05-18 06:09:50 +08:00
|
|
|
ha->host_no, ha->fw_dump);
|
2005-07-07 01:30:36 +08:00
|
|
|
ha->fw_dumped = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
qla24xx_fw_dump_failed:
|
|
|
|
if (!hardware_locked)
|
|
|
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Driver Debug Functions. */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
2005-07-07 01:32:07 +08:00
|
|
|
void
|
|
|
|
qla2x00_dump_regs(scsi_qla_host_t *ha)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-07 01:30:26 +08:00
|
|
|
struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
printk("Mailbox registers:\n");
|
|
|
|
printk("scsi(%ld): mbox 0 0x%04x \n",
|
|
|
|
ha->host_no, RD_MAILBOX_REG(ha, reg, 0));
|
|
|
|
printk("scsi(%ld): mbox 1 0x%04x \n",
|
|
|
|
ha->host_no, RD_MAILBOX_REG(ha, reg, 1));
|
|
|
|
printk("scsi(%ld): mbox 2 0x%04x \n",
|
|
|
|
ha->host_no, RD_MAILBOX_REG(ha, reg, 2));
|
|
|
|
printk("scsi(%ld): mbox 3 0x%04x \n",
|
|
|
|
ha->host_no, RD_MAILBOX_REG(ha, reg, 3));
|
|
|
|
printk("scsi(%ld): mbox 4 0x%04x \n",
|
|
|
|
ha->host_no, RD_MAILBOX_REG(ha, reg, 4));
|
|
|
|
printk("scsi(%ld): mbox 5 0x%04x \n",
|
|
|
|
ha->host_no, RD_MAILBOX_REG(ha, reg, 5));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-07-07 01:32:07 +08:00
|
|
|
qla2x00_dump_buffer(uint8_t * b, uint32_t size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
uint32_t cnt;
|
|
|
|
uint8_t c;
|
|
|
|
|
|
|
|
printk(" 0 1 2 3 4 5 6 7 8 9 "
|
|
|
|
"Ah Bh Ch Dh Eh Fh\n");
|
|
|
|
printk("----------------------------------------"
|
|
|
|
"----------------------\n");
|
|
|
|
|
|
|
|
for (cnt = 0; cnt < size;) {
|
|
|
|
c = *b++;
|
|
|
|
printk("%02x",(uint32_t) c);
|
|
|
|
cnt++;
|
|
|
|
if (!(cnt % 16))
|
|
|
|
printk("\n");
|
|
|
|
else
|
|
|
|
printk(" ");
|
|
|
|
}
|
|
|
|
if (cnt % 16)
|
|
|
|
printk("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* qla2x00_print_scsi_cmd
|
|
|
|
* Dumps out info about the scsi cmd and srb.
|
2005-07-07 01:32:07 +08:00
|
|
|
* Input
|
2005-04-17 06:20:36 +08:00
|
|
|
* cmd : struct scsi_cmnd
|
|
|
|
**************************************************************************/
|
|
|
|
void
|
2005-07-07 01:32:07 +08:00
|
|
|
qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct scsi_qla_host *ha;
|
|
|
|
srb_t *sp;
|
|
|
|
|
|
|
|
ha = (struct scsi_qla_host *)cmd->device->host->hostdata;
|
|
|
|
|
|
|
|
sp = (srb_t *) cmd->SCp.ptr;
|
|
|
|
printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
|
|
|
|
printk(" chan=0x%02x, target=0x%02x, lun=0x%02x, cmd_len=0x%02x\n",
|
|
|
|
cmd->device->channel, cmd->device->id, cmd->device->lun,
|
|
|
|
cmd->cmd_len);
|
|
|
|
printk(" CDB: ");
|
|
|
|
for (i = 0; i < cmd->cmd_len; i++) {
|
|
|
|
printk("0x%02x ", cmd->cmnd[i]);
|
|
|
|
}
|
2005-04-04 03:59:11 +08:00
|
|
|
printk("\n seg_cnt=%d, allowed=%d, retries=%d\n",
|
2007-05-26 00:55:38 +08:00
|
|
|
scsi_sg_count(cmd), cmd->allowed, cmd->retries);
|
2005-04-17 06:20:36 +08:00
|
|
|
printk(" request buffer=0x%p, request buffer len=0x%x\n",
|
2007-05-26 00:55:38 +08:00
|
|
|
scsi_sglist(cmd), scsi_bufflen(cmd));
|
2005-04-17 06:20:36 +08:00
|
|
|
printk(" tag=%d, transfersize=0x%x\n",
|
|
|
|
cmd->tag, cmd->transfersize);
|
2005-07-07 01:32:07 +08:00
|
|
|
printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp);
|
2005-04-17 06:20:36 +08:00
|
|
|
printk(" data direction=%d\n", cmd->sc_data_direction);
|
|
|
|
|
|
|
|
if (!sp)
|
|
|
|
return;
|
|
|
|
|
|
|
|
printk(" sp flags=0x%x\n", sp->flags);
|
|
|
|
}
|
|
|
|
|
2005-07-07 01:30:36 +08:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#if defined(QL_DEBUG_ROUTINES)
|
|
|
|
/*
|
|
|
|
* qla2x00_formatted_dump_buffer
|
|
|
|
* Prints string plus buffer.
|
|
|
|
*
|
|
|
|
* Input:
|
|
|
|
* string = Null terminated string (no newline at end).
|
|
|
|
* buffer = buffer address.
|
|
|
|
* wd_size = word size 8, 16, 32 or 64 bits
|
|
|
|
* count = number of words.
|
|
|
|
*/
|
|
|
|
void
|
2005-07-07 01:32:07 +08:00
|
|
|
qla2x00_formatted_dump_buffer(char *string, uint8_t * buffer,
|
|
|
|
uint8_t wd_size, uint32_t count)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
uint32_t cnt;
|
|
|
|
uint16_t *buf16;
|
|
|
|
uint32_t *buf32;
|
|
|
|
|
|
|
|
if (strcmp(string, "") != 0)
|
|
|
|
printk("%s\n",string);
|
|
|
|
|
|
|
|
switch (wd_size) {
|
|
|
|
case 8:
|
|
|
|
printk(" 0 1 2 3 4 5 6 7 "
|
|
|
|
"8 9 Ah Bh Ch Dh Eh Fh\n");
|
|
|
|
printk("-----------------------------------------"
|
|
|
|
"-------------------------------------\n");
|
|
|
|
|
|
|
|
for (cnt = 1; cnt <= count; cnt++, buffer++) {
|
|
|
|
printk("%02x",*buffer);
|
|
|
|
if (cnt % 16 == 0)
|
|
|
|
printk("\n");
|
|
|
|
else
|
|
|
|
printk(" ");
|
|
|
|
}
|
|
|
|
if (cnt % 16 != 0)
|
|
|
|
printk("\n");
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
printk(" 0 2 4 6 8 Ah "
|
|
|
|
" Ch Eh\n");
|
|
|
|
printk("-----------------------------------------"
|
|
|
|
"-------------\n");
|
|
|
|
|
|
|
|
buf16 = (uint16_t *) buffer;
|
|
|
|
for (cnt = 1; cnt <= count; cnt++, buf16++) {
|
|
|
|
printk("%4x",*buf16);
|
|
|
|
|
|
|
|
if (cnt % 8 == 0)
|
|
|
|
printk("\n");
|
|
|
|
else if (*buf16 < 10)
|
|
|
|
printk(" ");
|
|
|
|
else
|
|
|
|
printk(" ");
|
|
|
|
}
|
|
|
|
if (cnt % 8 != 0)
|
|
|
|
printk("\n");
|
|
|
|
break;
|
|
|
|
case 32:
|
|
|
|
printk(" 0 4 8 Ch\n");
|
|
|
|
printk("------------------------------------------\n");
|
|
|
|
|
|
|
|
buf32 = (uint32_t *) buffer;
|
|
|
|
for (cnt = 1; cnt <= count; cnt++, buf32++) {
|
|
|
|
printk("%8x", *buf32);
|
|
|
|
|
|
|
|
if (cnt % 4 == 0)
|
|
|
|
printk("\n");
|
|
|
|
else if (*buf32 < 10)
|
|
|
|
printk(" ");
|
|
|
|
else
|
|
|
|
printk(" ");
|
|
|
|
}
|
|
|
|
if (cnt % 4 != 0)
|
|
|
|
printk("\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|