Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106558
b: refs/heads/master
c: 1ee2714
h: refs/heads/master
v: v3
  • Loading branch information
Joe Carnuccio authored and James Bottomley committed Jul 26, 2008
1 parent 4f6c143 commit 808c607
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 6 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: e5896bd5dcf71fa43ddcc545340b847c13d29c44
refs/heads/master: 1ee2714632ce3f7e6477069b41cb685112f5f217
6 changes: 4 additions & 2 deletions trunk/drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,10 @@ qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr,
scsi_qla_host_t *ha = shost_priv(class_to_shost(dev));
uint32_t sn;

if (IS_FWI2_CAPABLE(ha))
return snprintf(buf, PAGE_SIZE, "\n");
if (IS_FWI2_CAPABLE(ha)) {
qla2xxx_get_vpd_field(ha, "SN", buf, PAGE_SIZE);
return snprintf(buf, PAGE_SIZE, "%s\n", buf);
}

sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1;
return snprintf(buf, PAGE_SIZE, "%c%05d\n", 'A' + sn / 100000,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/qla2xxx/qla_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -2518,7 +2518,7 @@ typedef struct scsi_qla_host {

uint8_t model_number[16+1];
#define BINZERO "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
char *model_desc;
char model_desc[80];
uint8_t adapter_id[16+1];

uint8_t *node_name;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/scsi/qla2xxx/qla_gbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ extern int qla2xxx_hw_event_log(scsi_qla_host_t *, uint16_t , uint16_t,
uint16_t, uint16_t);

extern void qla2xxx_get_flash_info(scsi_qla_host_t *);
extern int qla2xxx_get_vpd_field(scsi_qla_host_t *, char *, char *, size_t);

/*
* Global Function Prototypes in qla_dbg.c source file.
Expand Down
11 changes: 9 additions & 2 deletions trunk/drivers/scsi/qla2xxx/qla_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1501,18 +1501,25 @@ qla2x00_set_model_info(scsi_qla_host_t *ha, uint8_t *model, size_t len, char *de
index = (ha->pdev->subsystem_device & 0xff);
if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
index < QLA_MODEL_NAMES)
ha->model_desc = qla2x00_model_name[index * 2 + 1];
strncpy(ha->model_desc,
qla2x00_model_name[index * 2 + 1],
sizeof(ha->model_desc) - 1);
} else {
index = (ha->pdev->subsystem_device & 0xff);
if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
index < QLA_MODEL_NAMES) {
strcpy(ha->model_number,
qla2x00_model_name[index * 2]);
ha->model_desc = qla2x00_model_name[index * 2 + 1];
strncpy(ha->model_desc,
qla2x00_model_name[index * 2 + 1],
sizeof(ha->model_desc) - 1);
} else {
strcpy(ha->model_number, def);
}
}
if (IS_FWI2_CAPABLE(ha))
qla2xxx_get_vpd_field(ha, "\x82", ha->model_desc,
sizeof(ha->model_desc));
}

/* On sparc systems, obtain port and node WWN from firmware
Expand Down
45 changes: 45 additions & 0 deletions trunk/drivers/scsi/qla2xxx/qla_sup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2302,6 +2302,51 @@ qla24xx_get_flash_version(scsi_qla_host_t *ha, void *mbuf)
return ret;
}

static int
qla2xxx_is_vpd_valid(uint8_t *pos, uint8_t *end)
{
if (pos >= end || *pos != 0x82)
return 0;

pos += 3 + pos[1];
if (pos >= end || *pos != 0x90)
return 0;

pos += 3 + pos[1];
if (pos >= end || *pos != 0x78)
return 0;

return 1;
}

int
qla2xxx_get_vpd_field(scsi_qla_host_t *ha, char *key, char *str, size_t size)
{
uint8_t *pos = ha->vpd;
uint8_t *end = pos + ha->vpd_size;
int len = 0;

if (!IS_FWI2_CAPABLE(ha) || !qla2xxx_is_vpd_valid(pos, end))
return 0;

while (pos < end && *pos != 0x78) {
len = (*pos == 0x82) ? pos[1] : pos[2];

if (!strncmp(pos, key, strlen(key)))
break;

if (*pos != 0x90 && *pos != 0x91)
pos += len;

pos += 3;
}

if (pos < end - len && *pos != 0x78)
return snprintf(str, size, "%.*s", len, pos + 3);

return 0;
}

static int
qla2xxx_hw_event_store(scsi_qla_host_t *ha, uint32_t *fdata)
{
Expand Down

0 comments on commit 808c607

Please sign in to comment.