Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31889
b: refs/heads/master
c: a7a167b
h: refs/heads/master
i:
  31887: e42f816
v: v3
  • Loading branch information
Andrew Vasquez authored and James Bottomley committed Jun 26, 2006
1 parent 669b17f commit adf3f25
Show file tree
Hide file tree
Showing 9 changed files with 402 additions and 812 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ea7290902abcf22f796e9aeae4dc2e71d3f7e67
refs/heads/master: a7a167bf7e2d196fc33f292e7b02e90fee03bc9a
53 changes: 17 additions & 36 deletions trunk/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 adf3f25

Please sign in to comment.