diff options
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_nx.c')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_nx.c | 89 |
1 files changed, 50 insertions, 39 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c index 449256f2c5f8..474b10d71364 100644 --- a/drivers/scsi/qla4xxx/ql4_nx.c +++ b/drivers/scsi/qla4xxx/ql4_nx.c | |||
@@ -839,8 +839,11 @@ qla4_8xxx_rom_lock(struct scsi_qla_host *ha) | |||
839 | done = qla4_8xxx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_LOCK)); | 839 | done = qla4_8xxx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_LOCK)); |
840 | if (done == 1) | 840 | if (done == 1) |
841 | break; | 841 | break; |
842 | if (timeout >= qla4_8xxx_rom_lock_timeout) | 842 | if (timeout >= qla4_8xxx_rom_lock_timeout) { |
843 | ql4_printk(KERN_WARNING, ha, | ||
844 | "%s: Failed to acquire rom lock", __func__); | ||
843 | return -1; | 845 | return -1; |
846 | } | ||
844 | 847 | ||
845 | timeout++; | 848 | timeout++; |
846 | 849 | ||
@@ -1078,21 +1081,6 @@ qla4_8xxx_pinit_from_rom(struct scsi_qla_host *ha, int verbose) | |||
1078 | return 0; | 1081 | return 0; |
1079 | } | 1082 | } |
1080 | 1083 | ||
1081 | static int qla4_8xxx_check_for_bad_spd(struct scsi_qla_host *ha) | ||
1082 | { | ||
1083 | u32 val = 0; | ||
1084 | val = qla4_8xxx_rd_32(ha, BOOT_LOADER_DIMM_STATUS) ; | ||
1085 | val &= QLA82XX_BOOT_LOADER_MN_ISSUE; | ||
1086 | if (val & QLA82XX_PEG_TUNE_MN_SPD_ZEROED) { | ||
1087 | printk("Memory DIMM SPD not programmed. Assumed valid.\n"); | ||
1088 | return 1; | ||
1089 | } else if (val) { | ||
1090 | printk("Memory DIMM type incorrect. Info:%08X.\n", val); | ||
1091 | return 2; | ||
1092 | } | ||
1093 | return 0; | ||
1094 | } | ||
1095 | |||
1096 | static int | 1084 | static int |
1097 | qla4_8xxx_load_from_flash(struct scsi_qla_host *ha, uint32_t image_start) | 1085 | qla4_8xxx_load_from_flash(struct scsi_qla_host *ha, uint32_t image_start) |
1098 | { | 1086 | { |
@@ -1377,8 +1365,6 @@ static int qla4_8xxx_cmdpeg_ready(struct scsi_qla_host *ha, int pegtune_val) | |||
1377 | 1365 | ||
1378 | } while (--retries); | 1366 | } while (--retries); |
1379 | 1367 | ||
1380 | qla4_8xxx_check_for_bad_spd(ha); | ||
1381 | |||
1382 | if (!retries) { | 1368 | if (!retries) { |
1383 | pegtune_val = qla4_8xxx_rd_32(ha, | 1369 | pegtune_val = qla4_8xxx_rd_32(ha, |
1384 | QLA82XX_ROMUSB_GLB_PEGTUNE_DONE); | 1370 | QLA82XX_ROMUSB_GLB_PEGTUNE_DONE); |
@@ -1540,14 +1526,31 @@ qla4_8xxx_try_start_fw(struct scsi_qla_host *ha) | |||
1540 | ql4_printk(KERN_INFO, ha, | 1526 | ql4_printk(KERN_INFO, ha, |
1541 | "FW: Attempting to load firmware from flash...\n"); | 1527 | "FW: Attempting to load firmware from flash...\n"); |
1542 | rval = qla4_8xxx_start_firmware(ha, ha->hw.flt_region_fw); | 1528 | rval = qla4_8xxx_start_firmware(ha, ha->hw.flt_region_fw); |
1543 | if (rval == QLA_SUCCESS) | ||
1544 | return rval; | ||
1545 | 1529 | ||
1546 | ql4_printk(KERN_ERR, ha, "FW: Load firmware from flash FAILED...\n"); | 1530 | if (rval != QLA_SUCCESS) { |
1531 | ql4_printk(KERN_ERR, ha, "FW: Load firmware from flash" | ||
1532 | " FAILED...\n"); | ||
1533 | return rval; | ||
1534 | } | ||
1547 | 1535 | ||
1548 | return rval; | 1536 | return rval; |
1549 | } | 1537 | } |
1550 | 1538 | ||
1539 | static void qla4_8xxx_rom_lock_recovery(struct scsi_qla_host *ha) | ||
1540 | { | ||
1541 | if (qla4_8xxx_rom_lock(ha)) { | ||
1542 | /* Someone else is holding the lock. */ | ||
1543 | dev_info(&ha->pdev->dev, "Resetting rom_lock\n"); | ||
1544 | } | ||
1545 | |||
1546 | /* | ||
1547 | * Either we got the lock, or someone | ||
1548 | * else died while holding it. | ||
1549 | * In either case, unlock. | ||
1550 | */ | ||
1551 | qla4_8xxx_rom_unlock(ha); | ||
1552 | } | ||
1553 | |||
1551 | /** | 1554 | /** |
1552 | * qla4_8xxx_device_bootstrap - Initialize device, set DEV_READY, start fw | 1555 | * qla4_8xxx_device_bootstrap - Initialize device, set DEV_READY, start fw |
1553 | * @ha: pointer to adapter structure | 1556 | * @ha: pointer to adapter structure |
@@ -1557,11 +1560,12 @@ qla4_8xxx_try_start_fw(struct scsi_qla_host *ha) | |||
1557 | static int | 1560 | static int |
1558 | qla4_8xxx_device_bootstrap(struct scsi_qla_host *ha) | 1561 | qla4_8xxx_device_bootstrap(struct scsi_qla_host *ha) |
1559 | { | 1562 | { |
1560 | int rval, i, timeout; | 1563 | int rval = QLA_ERROR; |
1564 | int i, timeout; | ||
1561 | uint32_t old_count, count; | 1565 | uint32_t old_count, count; |
1566 | int need_reset = 0, peg_stuck = 1; | ||
1562 | 1567 | ||
1563 | if (qla4_8xxx_need_reset(ha)) | 1568 | need_reset = qla4_8xxx_need_reset(ha); |
1564 | goto dev_initialize; | ||
1565 | 1569 | ||
1566 | old_count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); | 1570 | old_count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); |
1567 | 1571 | ||
@@ -1570,12 +1574,30 @@ qla4_8xxx_device_bootstrap(struct scsi_qla_host *ha) | |||
1570 | if (timeout) { | 1574 | if (timeout) { |
1571 | qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 1575 | qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
1572 | QLA82XX_DEV_FAILED); | 1576 | QLA82XX_DEV_FAILED); |
1573 | return QLA_ERROR; | 1577 | return rval; |
1574 | } | 1578 | } |
1575 | 1579 | ||
1576 | count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); | 1580 | count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); |
1577 | if (count != old_count) | 1581 | if (count != old_count) |
1582 | peg_stuck = 0; | ||
1583 | } | ||
1584 | |||
1585 | if (need_reset) { | ||
1586 | /* We are trying to perform a recovery here. */ | ||
1587 | if (peg_stuck) | ||
1588 | qla4_8xxx_rom_lock_recovery(ha); | ||
1589 | goto dev_initialize; | ||
1590 | } else { | ||
1591 | /* Start of day for this ha context. */ | ||
1592 | if (peg_stuck) { | ||
1593 | /* Either we are the first or recovery in progress. */ | ||
1594 | qla4_8xxx_rom_lock_recovery(ha); | ||
1595 | goto dev_initialize; | ||
1596 | } else { | ||
1597 | /* Firmware already running. */ | ||
1598 | rval = QLA_SUCCESS; | ||
1578 | goto dev_ready; | 1599 | goto dev_ready; |
1600 | } | ||
1579 | } | 1601 | } |
1580 | 1602 | ||
1581 | dev_initialize: | 1603 | dev_initialize: |
@@ -1601,7 +1623,7 @@ dev_ready: | |||
1601 | ql4_printk(KERN_INFO, ha, "HW State: READY\n"); | 1623 | ql4_printk(KERN_INFO, ha, "HW State: READY\n"); |
1602 | qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_READY); | 1624 | qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_READY); |
1603 | 1625 | ||
1604 | return QLA_SUCCESS; | 1626 | return rval; |
1605 | } | 1627 | } |
1606 | 1628 | ||
1607 | /** | 1629 | /** |
@@ -1764,20 +1786,9 @@ int qla4_8xxx_load_risc(struct scsi_qla_host *ha) | |||
1764 | int retval; | 1786 | int retval; |
1765 | retval = qla4_8xxx_device_state_handler(ha); | 1787 | retval = qla4_8xxx_device_state_handler(ha); |
1766 | 1788 | ||
1767 | if (retval == QLA_SUCCESS && | 1789 | if (retval == QLA_SUCCESS && !test_bit(AF_INIT_DONE, &ha->flags)) |
1768 | !test_bit(AF_INIT_DONE, &ha->flags)) { | ||
1769 | retval = qla4xxx_request_irqs(ha); | 1790 | retval = qla4xxx_request_irqs(ha); |
1770 | if (retval != QLA_SUCCESS) { | 1791 | |
1771 | ql4_printk(KERN_WARNING, ha, | ||
1772 | "Failed to reserve interrupt %d already in use.\n", | ||
1773 | ha->pdev->irq); | ||
1774 | } else { | ||
1775 | set_bit(AF_IRQ_ATTACHED, &ha->flags); | ||
1776 | ha->host->irq = ha->pdev->irq; | ||
1777 | ql4_printk(KERN_INFO, ha, "%s: irq %d attached\n", | ||
1778 | __func__, ha->pdev->irq); | ||
1779 | } | ||
1780 | } | ||
1781 | return retval; | 1792 | return retval; |
1782 | } | 1793 | } |
1783 | 1794 | ||