aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_sup.c
diff options
context:
space:
mode:
authorJoe Carnuccio <joe.carnuccio@qlogic.com>2008-07-10 19:55:53 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-26 15:14:39 -0400
commit1ee2714632ce3f7e6477069b41cb685112f5f217 (patch)
tree330ceb3edcce6f7506d6c6f2d7b7df3adf8e79c4 /drivers/scsi/qla2xxx/qla_sup.c
parente5896bd5dcf71fa43ddcc545340b847c13d29c44 (diff)
[SCSI] qla2xxx: Retrieve board serial-number and description from VPD.
Recent ISPs have this information written at manufacturing time, so use the information. This also reduces future churn of the qla_devtbl.h file contents, as the driver can now depend on the information to be present in VPD. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_sup.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index ebea62246c80..1bca74474935 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -2303,6 +2303,51 @@ qla24xx_get_flash_version(scsi_qla_host_t *ha, void *mbuf)
2303} 2303}
2304 2304
2305static int 2305static int
2306qla2xxx_is_vpd_valid(uint8_t *pos, uint8_t *end)
2307{
2308 if (pos >= end || *pos != 0x82)
2309 return 0;
2310
2311 pos += 3 + pos[1];
2312 if (pos >= end || *pos != 0x90)
2313 return 0;
2314
2315 pos += 3 + pos[1];
2316 if (pos >= end || *pos != 0x78)
2317 return 0;
2318
2319 return 1;
2320}
2321
2322int
2323qla2xxx_get_vpd_field(scsi_qla_host_t *ha, char *key, char *str, size_t size)
2324{
2325 uint8_t *pos = ha->vpd;
2326 uint8_t *end = pos + ha->vpd_size;
2327 int len = 0;
2328
2329 if (!IS_FWI2_CAPABLE(ha) || !qla2xxx_is_vpd_valid(pos, end))
2330 return 0;
2331
2332 while (pos < end && *pos != 0x78) {
2333 len = (*pos == 0x82) ? pos[1] : pos[2];
2334
2335 if (!strncmp(pos, key, strlen(key)))
2336 break;
2337
2338 if (*pos != 0x90 && *pos != 0x91)
2339 pos += len;
2340
2341 pos += 3;
2342 }
2343
2344 if (pos < end - len && *pos != 0x78)
2345 return snprintf(str, size, "%.*s", len, pos + 3);
2346
2347 return 0;
2348}
2349
2350static int
2306qla2xxx_hw_event_store(scsi_qla_host_t *ha, uint32_t *fdata) 2351qla2xxx_hw_event_store(scsi_qla_host_t *ha, uint32_t *fdata)
2307{ 2352{
2308 uint32_t d[2], faddr; 2353 uint32_t d[2], faddr;