aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2007-01-29 13:22:24 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-01-31 12:12:30 -0500
commit9bb9fcf2f2b4deeb3ae8a44ed4b8686302297030 (patch)
tree6785c12903859023830c9c1a9c6eccedb88fa801 /drivers/scsi/qla2xxx
parent2603221a285e32a1033dcefa8de38a989a7633e0 (diff)
[SCSI] qla2xxx: Refactor set-HBA-model/description code.
Limit assignments via qla2x00_model_name[] array to HBA subsystem vendor IDs equal to QLogic. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c83
1 files changed, 37 insertions, 46 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3757d7479586..ee4b79eb59ce 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1355,6 +1355,39 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1355 return(rval); 1355 return(rval);
1356} 1356}
1357 1357
1358static inline void
1359qla2x00_set_model_info(scsi_qla_host_t *ha, uint8_t *model, size_t len, char *def)
1360{
1361 char *st, *en;
1362 uint16_t index;
1363
1364 if (memcmp(model, BINZERO, len) != 0) {
1365 strncpy(ha->model_number, model, len);
1366 st = en = ha->model_number;
1367 en += len - 1;
1368 while (en > st) {
1369 if (*en != 0x20 && *en != 0x00)
1370 break;
1371 *en-- = '\0';
1372 }
1373
1374 index = (ha->pdev->subsystem_device & 0xff);
1375 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
1376 index < QLA_MODEL_NAMES)
1377 ha->model_desc = qla2x00_model_name[index * 2 + 1];
1378 } else {
1379 index = (ha->pdev->subsystem_device & 0xff);
1380 if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC &&
1381 index < QLA_MODEL_NAMES) {
1382 strcpy(ha->model_number,
1383 qla2x00_model_name[index * 2]);
1384 ha->model_desc = qla2x00_model_name[index * 2 + 1];
1385 } else {
1386 strcpy(ha->model_number, def);
1387 }
1388 }
1389}
1390
1358/* 1391/*
1359* NVRAM configuration for ISP 2xxx 1392* NVRAM configuration for ISP 2xxx
1360* 1393*
@@ -1493,33 +1526,8 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1493 strcpy(ha->model_number, "QLA2300"); 1526 strcpy(ha->model_number, "QLA2300");
1494 } 1527 }
1495 } else { 1528 } else {
1496 if (rval == 0 && 1529 qla2x00_set_model_info(ha, nv->model_number,
1497 memcmp(nv->model_number, BINZERO, 1530 sizeof(nv->model_number), "QLA23xx");
1498 sizeof(nv->model_number)) != 0) {
1499 char *st, *en;
1500
1501 strncpy(ha->model_number, nv->model_number,
1502 sizeof(nv->model_number));
1503 st = en = ha->model_number;
1504 en += sizeof(nv->model_number) - 1;
1505 while (en > st) {
1506 if (*en != 0x20 && *en != 0x00)
1507 break;
1508 *en-- = '\0';
1509 }
1510 } else {
1511 uint16_t index;
1512
1513 index = (ha->pdev->subsystem_device & 0xff);
1514 if (index < QLA_MODEL_NAMES) {
1515 strcpy(ha->model_number,
1516 qla2x00_model_name[index * 2]);
1517 ha->model_desc =
1518 qla2x00_model_name[index * 2 + 1];
1519 } else {
1520 strcpy(ha->model_number, "QLA23xx");
1521 }
1522 }
1523 } 1531 }
1524 } else if (IS_QLA2200(ha)) { 1532 } else if (IS_QLA2200(ha)) {
1525 nv->firmware_options[0] |= BIT_2; 1533 nv->firmware_options[0] |= BIT_2;
@@ -3444,25 +3452,8 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3444 /* 3452 /*
3445 * Setup driver NVRAM options. 3453 * Setup driver NVRAM options.
3446 */ 3454 */
3447 if (memcmp(nv->model_name, BINZERO, sizeof(nv->model_name)) != 0) { 3455 qla2x00_set_model_info(ha, nv->model_name, sizeof(nv->model_name),
3448 char *st, *en; 3456 "QLA2462");
3449 uint16_t index;
3450
3451 strncpy(ha->model_number, nv->model_name,
3452 sizeof(nv->model_name));
3453 st = en = ha->model_number;
3454 en += sizeof(nv->model_name) - 1;
3455 while (en > st) {
3456 if (*en != 0x20 && *en != 0x00)
3457 break;
3458 *en-- = '\0';
3459 }
3460
3461 index = (ha->pdev->subsystem_device & 0xff);
3462 if (index < QLA_MODEL_NAMES)
3463 ha->model_desc = qla2x00_model_name[index * 2 + 1];
3464 } else
3465 strcpy(ha->model_number, "QLA2462");
3466 3457
3467 /* Use alternate WWN? */ 3458 /* Use alternate WWN? */
3468 if (nv->host_p & __constant_cpu_to_le32(BIT_15)) { 3459 if (nv->host_p & __constant_cpu_to_le32(BIT_15)) {