aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2007-01-29 13:22:26 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-01-31 12:13:24 -0500
commit7aef45ac92f49e76d990b51b7ecd714b9a608be1 (patch)
treed7e3b32ccd85f0f9c77b7c690251fef8dfdc1211
parent178779a6ca7c23b52d5537b972f2b54c830b4480 (diff)
[SCSI] qla2xxx: Fail initialization when inconsistent NVRAM detected.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c125
1 files changed, 14 insertions, 111 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index ee4b79eb59ce..b247bc22704e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -88,7 +88,12 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
88 88
89 qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n"); 89 qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n");
90 90
91 ha->isp_ops.nvram_config(ha); 91 rval = ha->isp_ops.nvram_config(ha);
92 if (rval) {
93 DEBUG2(printk("scsi(%ld): Unable to verify NVRAM data.\n",
94 ha->host_no));
95 return rval;
96 }
92 97
93 if (ha->flags.disable_serdes) { 98 if (ha->flags.disable_serdes) {
94 /* Mask HBA via NVRAM settings? */ 99 /* Mask HBA via NVRAM settings? */
@@ -1404,7 +1409,6 @@ qla2x00_set_model_info(scsi_qla_host_t *ha, uint8_t *model, size_t len, char *de
1404int 1409int
1405qla2x00_nvram_config(scsi_qla_host_t *ha) 1410qla2x00_nvram_config(scsi_qla_host_t *ha)
1406{ 1411{
1407 int rval;
1408 uint8_t chksum = 0; 1412 uint8_t chksum = 0;
1409 uint16_t cnt; 1413 uint16_t cnt;
1410 uint8_t *dptr1, *dptr2; 1414 uint8_t *dptr1, *dptr2;
@@ -1413,8 +1417,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1413 uint8_t *ptr = (uint8_t *)ha->request_ring; 1417 uint8_t *ptr = (uint8_t *)ha->request_ring;
1414 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 1418 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1415 1419
1416 rval = QLA_SUCCESS;
1417
1418 /* Determine NVRAM starting address. */ 1420 /* Determine NVRAM starting address. */
1419 ha->nvram_size = sizeof(nvram_t); 1421 ha->nvram_size = sizeof(nvram_t);
1420 ha->nvram_base = 0; 1422 ha->nvram_base = 0;
@@ -1438,55 +1440,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1438 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: " 1440 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: "
1439 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0], 1441 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0],
1440 nv->nvram_version); 1442 nv->nvram_version);
1441 qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet " 1443 return QLA_FUNCTION_FAILED;
1442 "invalid -- WWPN) defaults.\n");
1443
1444 /*
1445 * Set default initialization control block.
1446 */
1447 memset(nv, 0, ha->nvram_size);
1448 nv->parameter_block_version = ICB_VERSION;
1449
1450 if (IS_QLA23XX(ha)) {
1451 nv->firmware_options[0] = BIT_2 | BIT_1;
1452 nv->firmware_options[1] = BIT_7 | BIT_5;
1453 nv->add_firmware_options[0] = BIT_5;
1454 nv->add_firmware_options[1] = BIT_5 | BIT_4;
1455 nv->frame_payload_size = __constant_cpu_to_le16(2048);
1456 nv->special_options[1] = BIT_7;
1457 } else if (IS_QLA2200(ha)) {
1458 nv->firmware_options[0] = BIT_2 | BIT_1;
1459 nv->firmware_options[1] = BIT_7 | BIT_5;
1460 nv->add_firmware_options[0] = BIT_5;
1461 nv->add_firmware_options[1] = BIT_5 | BIT_4;
1462 nv->frame_payload_size = __constant_cpu_to_le16(1024);
1463 } else if (IS_QLA2100(ha)) {
1464 nv->firmware_options[0] = BIT_3 | BIT_1;
1465 nv->firmware_options[1] = BIT_5;
1466 nv->frame_payload_size = __constant_cpu_to_le16(1024);
1467 }
1468
1469 nv->max_iocb_allocation = __constant_cpu_to_le16(256);
1470 nv->execution_throttle = __constant_cpu_to_le16(16);
1471 nv->retry_count = 8;
1472 nv->retry_delay = 1;
1473
1474 nv->port_name[0] = 33;
1475 nv->port_name[3] = 224;
1476 nv->port_name[4] = 139;
1477
1478 nv->login_timeout = 4;
1479
1480 /*
1481 * Set default host adapter parameters
1482 */
1483 nv->host_p[1] = BIT_2;
1484 nv->reset_delay = 5;
1485 nv->port_down_retry_count = 8;
1486 nv->max_luns_per_target = __constant_cpu_to_le16(8);
1487 nv->link_down_timeout = 60;
1488
1489 rval = 1;
1490 } 1444 }
1491 1445
1492#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 1446#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2)
@@ -1699,11 +1653,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1699 } 1653 }
1700 } 1654 }
1701 1655
1702 if (rval) { 1656 return QLA_SUCCESS;
1703 DEBUG2_3(printk(KERN_WARNING
1704 "scsi(%ld): NVRAM configuration failed!\n", ha->host_no));
1705 }
1706 return (rval);
1707} 1657}
1708 1658
1709static void 1659static void
@@ -3121,7 +3071,9 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3121 3071
3122 ha->isp_ops.get_flash_version(ha, ha->request_ring); 3072 ha->isp_ops.get_flash_version(ha, ha->request_ring);
3123 3073
3124 ha->isp_ops.nvram_config(ha); 3074 rval = ha->isp_ops.nvram_config(ha);
3075 if (rval)
3076 goto isp_abort_retry;
3125 3077
3126 if (!qla2x00_restart_isp(ha)) { 3078 if (!qla2x00_restart_isp(ha)) {
3127 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 3079 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
@@ -3151,6 +3103,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3151 } 3103 }
3152 } 3104 }
3153 } else { /* failed the ISP abort */ 3105 } else { /* failed the ISP abort */
3106isp_abort_retry:
3154 ha->flags.online = 1; 3107 ha->flags.online = 1;
3155 if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { 3108 if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) {
3156 if (ha->isp_abort_cnt == 0) { 3109 if (ha->isp_abort_cnt == 0) {
@@ -3340,7 +3293,6 @@ qla24xx_reset_adapter(scsi_qla_host_t *ha)
3340int 3293int
3341qla24xx_nvram_config(scsi_qla_host_t *ha) 3294qla24xx_nvram_config(scsi_qla_host_t *ha)
3342{ 3295{
3343 int rval;
3344 struct init_cb_24xx *icb; 3296 struct init_cb_24xx *icb;
3345 struct nvram_24xx *nv; 3297 struct nvram_24xx *nv;
3346 uint32_t *dptr; 3298 uint32_t *dptr;
@@ -3348,7 +3300,6 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3348 uint32_t chksum; 3300 uint32_t chksum;
3349 uint16_t cnt; 3301 uint16_t cnt;
3350 3302
3351 rval = QLA_SUCCESS;
3352 icb = (struct init_cb_24xx *)ha->init_cb; 3303 icb = (struct init_cb_24xx *)ha->init_cb;
3353 nv = (struct nvram_24xx *)ha->request_ring; 3304 nv = (struct nvram_24xx *)ha->request_ring;
3354 3305
@@ -3381,51 +3332,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3381 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: " 3332 qla_printk(KERN_WARNING, ha, "Inconsistent NVRAM detected: "
3382 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0], 3333 "checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id[0],
3383 le16_to_cpu(nv->nvram_version)); 3334 le16_to_cpu(nv->nvram_version));
3384 qla_printk(KERN_WARNING, ha, "Falling back to functioning (yet " 3335 return QLA_FUNCTION_FAILED;
3385 "invalid -- WWPN) defaults.\n");
3386
3387 /*
3388 * Set default initialization control block.
3389 */
3390 memset(nv, 0, ha->nvram_size);
3391 nv->nvram_version = __constant_cpu_to_le16(ICB_VERSION);
3392 nv->version = __constant_cpu_to_le16(ICB_VERSION);
3393 nv->frame_payload_size = __constant_cpu_to_le16(2048);
3394 nv->execution_throttle = __constant_cpu_to_le16(0xFFFF);
3395 nv->exchange_count = __constant_cpu_to_le16(0);
3396 nv->hard_address = __constant_cpu_to_le16(124);
3397 nv->port_name[0] = 0x21;
3398 nv->port_name[1] = 0x00 + PCI_FUNC(ha->pdev->devfn);
3399 nv->port_name[2] = 0x00;
3400 nv->port_name[3] = 0xe0;
3401 nv->port_name[4] = 0x8b;
3402 nv->port_name[5] = 0x1c;
3403 nv->port_name[6] = 0x55;
3404 nv->port_name[7] = 0x86;
3405 nv->node_name[0] = 0x20;
3406 nv->node_name[1] = 0x00;
3407 nv->node_name[2] = 0x00;
3408 nv->node_name[3] = 0xe0;
3409 nv->node_name[4] = 0x8b;
3410 nv->node_name[5] = 0x1c;
3411 nv->node_name[6] = 0x55;
3412 nv->node_name[7] = 0x86;
3413 nv->login_retry_count = __constant_cpu_to_le16(8);
3414 nv->interrupt_delay_timer = __constant_cpu_to_le16(0);
3415 nv->login_timeout = __constant_cpu_to_le16(0);
3416 nv->firmware_options_1 =
3417 __constant_cpu_to_le32(BIT_14|BIT_13|BIT_2|BIT_1);
3418 nv->firmware_options_2 = __constant_cpu_to_le32(2 << 4);
3419 nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_12);
3420 nv->firmware_options_3 = __constant_cpu_to_le32(2 << 13);
3421 nv->host_p = __constant_cpu_to_le32(BIT_11|BIT_10);
3422 nv->efi_parameters = __constant_cpu_to_le32(0);
3423 nv->reset_delay = 5;
3424 nv->max_luns_per_target = __constant_cpu_to_le16(128);
3425 nv->port_down_retry_count = __constant_cpu_to_le16(30);
3426 nv->link_down_timeout = __constant_cpu_to_le16(30);
3427
3428 rval = 1;
3429 } 3336 }
3430 3337
3431 /* Reset Initialization control block */ 3338 /* Reset Initialization control block */
@@ -3570,11 +3477,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3570 ha->flags.process_response_queue = 1; 3477 ha->flags.process_response_queue = 1;
3571 } 3478 }
3572 3479
3573 if (rval) { 3480 return QLA_SUCCESS;
3574 DEBUG2_3(printk(KERN_WARNING
3575 "scsi(%ld): NVRAM configuration failed!\n", ha->host_no));
3576 }
3577 return (rval);
3578} 3481}
3579 3482
3580static int 3483static int