scsi: qla2xxx: Correction and improvement to fwdt processing
This patch cleans up and fixes firmware dump template processing. These changes are added to support newer features for ISP27XX/ISP28XX. Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Родитель
3695310e37
Коммит
2ff0167151
|
@ -99,9 +99,9 @@ static inline void
|
||||||
qla27xx_write_reg(__iomem struct device_reg_24xx *reg,
|
qla27xx_write_reg(__iomem struct device_reg_24xx *reg,
|
||||||
uint offset, uint32_t data, void *buf)
|
uint offset, uint32_t data, void *buf)
|
||||||
{
|
{
|
||||||
__iomem void *window = (void __iomem *)reg + offset;
|
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
void __iomem *window = (void __iomem *)reg + offset;
|
||||||
|
|
||||||
WRT_REG_DWORD(window, data);
|
WRT_REG_DWORD(window, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,10 +709,10 @@ qla27xx_fwdt_entry_t275(struct scsi_qla_host *vha,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (offset + length > size) {
|
if (offset + length > size) {
|
||||||
|
length = size - offset;
|
||||||
ql_dbg(ql_dbg_misc, vha, 0xd030,
|
ql_dbg(ql_dbg_misc, vha, 0xd030,
|
||||||
"%s: buffer overflow\n", __func__);
|
"%s: buffer overflow, truncate [%lx]\n", __func__, length);
|
||||||
qla27xx_skip_entry(ent, buf);
|
ent->t275.length = cpu_to_le32(length);
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qla27xx_insertbuf(buffer, length, buf, len);
|
qla27xx_insertbuf(buffer, length, buf, len);
|
||||||
|
@ -724,17 +724,22 @@ static struct qla27xx_fwdt_entry *
|
||||||
qla27xx_fwdt_entry_t276(struct scsi_qla_host *vha,
|
qla27xx_fwdt_entry_t276(struct scsi_qla_host *vha,
|
||||||
struct qla27xx_fwdt_entry *ent, void *buf, ulong *len)
|
struct qla27xx_fwdt_entry *ent, void *buf, ulong *len)
|
||||||
{
|
{
|
||||||
ulong cond1 = le32_to_cpu(ent->t276.cond1);
|
|
||||||
ulong cond2 = le32_to_cpu(ent->t276.cond2);
|
|
||||||
uint type = vha->hw->pdev->device >> 4 & 0xf;
|
|
||||||
uint func = vha->hw->port_no & 0x3;
|
|
||||||
|
|
||||||
ql_dbg(ql_dbg_misc + ql_dbg_verbose, vha, 0xd214,
|
ql_dbg(ql_dbg_misc + ql_dbg_verbose, vha, 0xd214,
|
||||||
"%s: cond [%lx]\n", __func__, *len);
|
"%s: cond [%lx]\n", __func__, *len);
|
||||||
|
|
||||||
if (type != cond1 || func != cond2) {
|
if (buf) {
|
||||||
ent = qla27xx_next_entry(ent);
|
ulong cond1 = le32_to_cpu(ent->t276.cond1);
|
||||||
qla27xx_skip_entry(ent, buf);
|
ulong cond2 = le32_to_cpu(ent->t276.cond2);
|
||||||
|
uint type = vha->hw->pdev->device >> 4 & 0xf;
|
||||||
|
uint func = vha->hw->port_no & 0x3;
|
||||||
|
|
||||||
|
if (type != cond1 || func != cond2) {
|
||||||
|
struct qla27xx_fwdt_template *tmp = buf;
|
||||||
|
|
||||||
|
tmp->count--;
|
||||||
|
ent = qla27xx_next_entry(ent);
|
||||||
|
qla27xx_skip_entry(ent, buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return qla27xx_next_entry(ent);
|
return qla27xx_next_entry(ent);
|
||||||
|
@ -840,21 +845,21 @@ qla27xx_walk_template(struct scsi_qla_host *vha,
|
||||||
{
|
{
|
||||||
struct qla27xx_fwdt_entry *ent = (void *)tmp +
|
struct qla27xx_fwdt_entry *ent = (void *)tmp +
|
||||||
le32_to_cpu(tmp->entry_offset);
|
le32_to_cpu(tmp->entry_offset);
|
||||||
ulong count = le32_to_cpu(tmp->entry_count);
|
ulong type;
|
||||||
ulong type = 0;
|
|
||||||
|
|
||||||
|
tmp->count = le32_to_cpu(tmp->entry_count);
|
||||||
ql_dbg(ql_dbg_misc, vha, 0xd01a,
|
ql_dbg(ql_dbg_misc, vha, 0xd01a,
|
||||||
"%s: entry count %lx\n", __func__, count);
|
"%s: entry count %u\n", __func__, tmp->count);
|
||||||
while (count--) {
|
while (ent && tmp->count--) {
|
||||||
type = le32_to_cpu(ent->hdr.type);
|
type = le32_to_cpu(ent->hdr.type);
|
||||||
ent = qla27xx_find_entry(type)(vha, ent, buf, len);
|
ent = qla27xx_find_entry(type)(vha, ent, buf, len);
|
||||||
if (!ent)
|
if (!ent)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count)
|
if (tmp->count)
|
||||||
ql_dbg(ql_dbg_misc, vha, 0xd018,
|
ql_dbg(ql_dbg_misc, vha, 0xd018,
|
||||||
"%s: entry count residual=+%lu\n", __func__, count);
|
"%s: entry count residual=+%u\n", __func__, tmp->count);
|
||||||
|
|
||||||
if (ent)
|
if (ent)
|
||||||
ql_dbg(ql_dbg_misc, vha, 0xd019,
|
ql_dbg(ql_dbg_misc, vha, 0xd019,
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct __packed qla27xx_fwdt_template {
|
||||||
__le32 template_type;
|
__le32 template_type;
|
||||||
__le32 entry_offset;
|
__le32 entry_offset;
|
||||||
uint32_t template_size;
|
uint32_t template_size;
|
||||||
uint32_t reserved_1;
|
uint32_t count; /* borrow field for running/residual count */
|
||||||
|
|
||||||
__le32 entry_count;
|
__le32 entry_count;
|
||||||
uint32_t template_version;
|
uint32_t template_version;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче