uint16_t __iomem *dmp_reg;
unsigned long flags;
struct qla2300_fw_dump *fw;
- uint32_t dump_size, data_ram_cnt;
+ uint32_t data_ram_cnt;
risc_address = data_ram_cnt = 0;
mb0 = mb2 = 0;
if (!hardware_locked)
spin_lock_irqsave(&ha->hardware_lock, flags);
- if (ha->fw_dump != NULL) {
+ if (!ha->fw_dump) {
qla_printk(KERN_WARNING, ha,
- "Firmware has been previously dumped (%p) -- ignoring "
- "request...\n", ha->fw_dump);
+ "No buffer available for dump!!!\n");
goto qla2300_fw_dump_failed;
}
- /* Allocate (large) dump buffer. */
- dump_size = sizeof(struct qla2300_fw_dump);
- dump_size += (ha->fw_memory_size - 0x11000) * sizeof(uint16_t);
- ha->fw_dump_order = get_order(dump_size);
- ha->fw_dump = (struct qla2300_fw_dump *) __get_free_pages(GFP_ATOMIC,
- ha->fw_dump_order);
- if (ha->fw_dump == NULL) {
+ if (ha->fw_dumped) {
qla_printk(KERN_WARNING, ha,
- "Unable to allocated memory for firmware dump (%d/%d).\n",
- ha->fw_dump_order, dump_size);
+ "Firmware has been previously dumped (%p) -- ignoring "
+ "request...\n", ha->fw_dump);
goto qla2300_fw_dump_failed;
}
fw = ha->fw_dump;
}
}
-
if (rval != QLA_SUCCESS) {
qla_printk(KERN_WARNING, ha,
"Failed to dump firmware (%x)!!!\n", rval);
+ ha->fw_dumped = 0;
- free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
- ha->fw_dump = NULL;
} else {
qla_printk(KERN_INFO, ha,
"Firmware dump saved to temp buffer (%ld/%p).\n",
ha->host_no, ha->fw_dump);
+ ha->fw_dumped = 1;
}
qla2300_fw_dump_failed:
if (!hardware_locked)
spin_lock_irqsave(&ha->hardware_lock, flags);
- if (ha->fw_dump != NULL) {
+ if (!ha->fw_dump) {
qla_printk(KERN_WARNING, ha,
- "Firmware has been previously dumped (%p) -- ignoring "
- "request...\n", ha->fw_dump);
+ "No buffer available for dump!!!\n");
goto qla2100_fw_dump_failed;
}
- /* Allocate (large) dump buffer. */
- ha->fw_dump_order = get_order(sizeof(struct qla2100_fw_dump));
- ha->fw_dump = (struct qla2100_fw_dump *) __get_free_pages(GFP_ATOMIC,
- ha->fw_dump_order);
- if (ha->fw_dump == NULL) {
+ if (ha->fw_dumped) {
qla_printk(KERN_WARNING, ha,
- "Unable to allocated memory for firmware dump (%d/%Zd).\n",
- ha->fw_dump_order, sizeof(struct qla2100_fw_dump));
+ "Firmware has been previously dumped (%p) -- ignoring "
+ "request...\n", ha->fw_dump);
goto qla2100_fw_dump_failed;
}
fw = ha->fw_dump;
if (rval != QLA_SUCCESS) {
qla_printk(KERN_WARNING, ha,
"Failed to dump firmware (%x)!!!\n", rval);
+ ha->fw_dumped = 0;
- free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
- ha->fw_dump = NULL;
} else {
qla_printk(KERN_INFO, ha,
"Firmware dump saved to temp buffer (%ld/%p).\n",
ha->host_no, ha->fw_dump);
+ ha->fw_dumped = 1;
}
qla2100_fw_dump_failed:
if (!hardware_locked)
spin_lock_irqsave(&ha->hardware_lock, flags);
- if (!ha->fw_dump24) {
+ if (!ha->fw_dump) {
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);
+ "request...\n", ha->fw_dump);
goto qla24xx_fw_dump_failed;
}
- fw = (struct qla24xx_fw_dump *) ha->fw_dump24;
+ fw = ha->fw_dump;
rval = QLA_SUCCESS;
fw->host_status = RD_REG_DWORD(®->host_status);
} else {
qla_printk(KERN_INFO, ha,
"Firmware dump saved to temp buffer (%ld/%p).\n",
- ha->host_no, ha->fw_dump24);
+ ha->host_no, ha->fw_dump);
ha->fw_dumped = 1;
}
uint32_t ext_mem_cnt;
uiter = ha->fw_dump_buffer;
- fw = ha->fw_dump24;
+ fw = ha->fw_dump;
qla_uprintf(&uiter, "ISP FW Version %d.%02d.%02d Attributes %04x\n",
ha->fw_major_version, ha->fw_minor_version,
static void
qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
{
+ uint32_t dump_size = 0;
+
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)
+ if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
+ dump_size = sizeof(struct qla2100_fw_dump);
+ } else if (IS_QLA23XX(ha)) {
+ dump_size = sizeof(struct qla2300_fw_dump);
+ dump_size += (ha->fw_memory_size - 0x11000) * sizeof(uint16_t);
+ } else if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
+ dump_size = sizeof(struct qla24xx_fw_dump);
+ dump_size += (ha->fw_memory_size - 0x100000) * sizeof(uint32_t);
+ }
+
+ ha->fw_dump = vmalloc(dump_size);
+ if (ha->fw_dump)
qla_printk(KERN_INFO, ha, "Allocated (%d KB) for firmware "
- "dump...\n", ha->fw_dump24_len / 1024);
+ "dump...\n", dump_size / 1024);
else
qla_printk(KERN_WARNING, ha, "Unable to allocate (%d KB) for "
- "firmware dump!!!\n", ha->fw_dump24_len / 1024);
+ "firmware dump!!!\n", dump_size / 1024);
}
/**
dma_addr_t request_dma;
request_t *request_ring;
+ qla2x00_alloc_fw_dump(ha);
+
/* Valid only on recent ISPs. */
if (IS_QLA2100(ha) || IS_QLA2200(ha))
return;
- if (IS_QLA24XX(ha) || IS_QLA54XX(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)