[SCSI] qla2xxx: Detect PEG errors.
authorGiridhar Malavali <giridhar.malavali@qlogic.com>
Tue, 15 May 2012 18:34:12 +0000 (14:34 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 22 May 2012 10:17:28 +0000 (11:17 +0100)
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_nx.c
drivers/scsi/qla2xxx/qla_nx.h

index 62324a1..ec1b925 100644 (file)
@@ -20,7 +20,7 @@
  * | DPC Thread                   |       0x401c       |               |
  * | Async Events                 |       0x505d       | 0x502b-0x502f  |
  * |                              |                    | 0x5047,0x5052  |
- * | Timer Routines               |       0x6011       | 0x600e-0x600f  |
+ * | Timer Routines               |       0x6011       |                |
  * | User Space Interactions      |       0x709f       | 0x7018,0x702e, |
  * |                              |                    | 0x7039,0x7045, |
  * |                              |                    | 0x7073-0x7075, |
index 6f8850c..954e2c2 100644 (file)
@@ -3325,6 +3325,30 @@ exit:
        return rval;
 }
 
+static int qla82xx_check_temp(scsi_qla_host_t *vha)
+{
+       uint32_t temp, temp_state, temp_val;
+       struct qla_hw_data *ha = vha->hw;
+
+       temp = qla82xx_rd_32(ha, CRB_TEMP_STATE);
+       temp_state = qla82xx_get_temp_state(temp);
+       temp_val = qla82xx_get_temp_val(temp);
+
+       if (temp_state == QLA82XX_TEMP_PANIC) {
+               ql_log(ql_log_warn, vha, 0x600e,
+                   "Device temperature %d degrees C exceeds "
+                   " maximum allowed. Hardware has been shut down.\n",
+                   temp_val);
+               return 1;
+       } else if (temp_state == QLA82XX_TEMP_WARN) {
+               ql_log(ql_log_warn, vha, 0x600f,
+                   "Device temperature %d degrees C exceeds "
+                   "operating range. Immediate action needed.\n",
+                   temp_val);
+       }
+       return 0;
+}
+
 void qla82xx_clear_pending_mbx(scsi_qla_host_t *vha)
 {
        struct qla_hw_data *ha = vha->hw;
@@ -3347,7 +3371,11 @@ void qla82xx_watchdog(scsi_qla_host_t *vha)
        /* don't poll if reset is going on */
        if (!ha->flags.isp82xx_reset_hdlr_active) {
                dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
-               if (dev_state == QLA82XX_DEV_NEED_RESET &&
+               if (qla82xx_check_temp(vha)) {
+                       set_bit(ISP_UNRECOVERABLE, &vha->dpc_flags);
+                       ha->flags.isp82xx_fw_hung = 1;
+                       qla82xx_clear_pending_mbx(vha);
+               } else if (dev_state == QLA82XX_DEV_NEED_RESET &&
                    !test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) {
                        ql_log(ql_log_warn, vha, 0x6001,
                            "Adapter reset needed.\n");
index 4ac50e2..3933198 100644 (file)
@@ -26,6 +26,7 @@
 #define CRB_RCVPEG_STATE               QLA82XX_REG(0x13c)
 #define BOOT_LOADER_DIMM_STATUS                QLA82XX_REG(0x54)
 #define CRB_DMA_SHIFT                  QLA82XX_REG(0xcc)
+#define CRB_TEMP_STATE                 QLA82XX_REG(0x1b4)
 #define QLA82XX_DMA_SHIFT_VALUE                0x55555555
 
 #define QLA82XX_HW_H0_CH_HUB_ADR    0x05
@@ -1178,4 +1179,16 @@ static const int MD_MIU_TEST_AGT_RDDATA[] = { 0x410000A8, 0x410000AC,
 #define CRB_NIU_XG_PAUSE_CTL_P0        0x1
 #define CRB_NIU_XG_PAUSE_CTL_P1        0x8
 
+#define qla82xx_get_temp_val(x)          ((x) >> 16)
+#define qla82xx_get_temp_state(x)        ((x) & 0xffff)
+#define qla82xx_encode_temp(val, state)  (((val) << 16) | (state))
+
+/*
+ * Temperature control.
+ */
+enum {
+       QLA82XX_TEMP_NORMAL = 0x1, /* Normal operating range */
+       QLA82XX_TEMP_WARN,         /* Sound alert, temperature getting high */
+       QLA82XX_TEMP_PANIC         /* Fatal error, hardware has shut down. */
+};
 #endif