Skip to content

Commit

Permalink
[SCSI] qla2xxx: Rework firmware-trace facilities.
Browse files Browse the repository at this point in the history
- Defer firmware dump-data raw-to-textual conversion to
  user-space.
- Add module parameter (ql2xallocfwdump) to allow for per-HBA
  allocations of firmware dump memory.
- Dump request and response queue data as per firmware group
  request.
- Add extended firmware trace support for ISP24XX/ISP54XX chips.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Andrew Vasquez authored and James Bottomley committed Jun 26, 2006
1 parent 9ea7290 commit a7a167b
Show file tree
Hide file tree
Showing 8 changed files with 401 additions and 811 deletions.
53 changes: 17 additions & 36 deletions drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ qla2x00_sysfs_read_fw_dump(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)));
char *rbuf = (char *)ha->fw_dump;

if (ha->fw_dump_reading == 0)
return 0;
if (off > ha->fw_dump_buffer_len)
return 0;
if (off + count > ha->fw_dump_buffer_len)
count = ha->fw_dump_buffer_len - off;
if (off > ha->fw_dump_len)
return 0;
if (off + count > ha->fw_dump_len)
count = ha->fw_dump_len - off;

memcpy(buf, &ha->fw_dump_buffer[off], count);
memcpy(buf, &rbuf[off], count);

return (count);
}
Expand All @@ -36,54 +37,34 @@ qla2x00_sysfs_write_fw_dump(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)));
int reading;
uint32_t dump_size;

if (off != 0)
return (0);

reading = simple_strtol(buf, NULL, 10);
switch (reading) {
case 0:
if (ha->fw_dump_reading == 1) {
qla_printk(KERN_INFO, ha,
"Firmware dump cleared on (%ld).\n", ha->host_no);
if (!ha->fw_dump_reading)
break;

vfree(ha->fw_dump_buffer);
ha->fw_dump_buffer = NULL;
ha->fw_dump_reading = 0;
ha->fw_dumped = 0;
}
qla_printk(KERN_INFO, ha,
"Firmware dump cleared on (%ld).\n", ha->host_no);

ha->fw_dump_reading = 0;
ha->fw_dumped = 0;
break;
case 1:
if (ha->fw_dumped && !ha->fw_dump_reading) {
ha->fw_dump_reading = 1;

if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
dump_size = FW_DUMP_SIZE_24XX;
else {
dump_size = FW_DUMP_SIZE_1M;
if (ha->fw_memory_size < 0x20000)
dump_size = FW_DUMP_SIZE_128K;
else if (ha->fw_memory_size < 0x80000)
dump_size = FW_DUMP_SIZE_512K;
}
ha->fw_dump_buffer = (char *)vmalloc(dump_size);
if (ha->fw_dump_buffer == NULL) {
qla_printk(KERN_WARNING, ha,
"Unable to allocate memory for firmware "
"dump buffer (%d).\n", dump_size);

ha->fw_dump_reading = 0;
return (count);
}
qla_printk(KERN_INFO, ha,
"Firmware dump ready for read on (%ld).\n",
"Raw firmware dump ready for read on (%ld).\n",
ha->host_no);
memset(ha->fw_dump_buffer, 0, dump_size);
ha->isp_ops.ascii_fw_dump(ha);
ha->fw_dump_buffer_len = strlen(ha->fw_dump_buffer);
}
break;
case 2:
qla2x00_alloc_fw_dump(ha);
break;
}
return (count);
}
Expand Down
Loading

0 comments on commit a7a167b

Please sign in to comment.