aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2007-10-27 13:37:05 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:22:31 -0500
commit57127f157298ea2dacbbc878a3c5d2a5daca772c (patch)
tree2536d995c36e068576a690b33cd2029f0749ddbe /drivers/scsi/lpfc/lpfc_sli.c
parentd1a357fcc8348d325d151f6fe0ea54e317652457 (diff)
[SCSI] lpfc 8.2.3 : Added support for ASICs that report temperature
Added support for ASICs that report temperature. Temperature notices are reported as events and logged. Temperature can be read via sysfs. Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index ce348c5c706c..41f13a300ba5 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -199,6 +199,7 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
199 case CMD_RCV_ELS_REQ_CX: 199 case CMD_RCV_ELS_REQ_CX:
200 case CMD_RCV_SEQUENCE64_CX: 200 case CMD_RCV_SEQUENCE64_CX:
201 case CMD_RCV_ELS_REQ64_CX: 201 case CMD_RCV_ELS_REQ64_CX:
202 case CMD_ASYNC_STATUS:
202 case CMD_IOCB_RCV_SEQ64_CX: 203 case CMD_IOCB_RCV_SEQ64_CX:
203 case CMD_IOCB_RCV_ELS64_CX: 204 case CMD_IOCB_RCV_ELS64_CX:
204 case CMD_IOCB_RCV_CONT64_CX: 205 case CMD_IOCB_RCV_CONT64_CX:
@@ -754,6 +755,7 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
754 case MBX_FLASH_WR_ULA: 755 case MBX_FLASH_WR_ULA:
755 case MBX_SET_DEBUG: 756 case MBX_SET_DEBUG:
756 case MBX_LOAD_EXP_ROM: 757 case MBX_LOAD_EXP_ROM:
758 case MBX_ASYNCEVT_ENABLE:
757 case MBX_REG_VPI: 759 case MBX_REG_VPI:
758 case MBX_UNREG_VPI: 760 case MBX_UNREG_VPI:
759 case MBX_HEARTBEAT: 761 case MBX_HEARTBEAT:
@@ -953,6 +955,7 @@ lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag)
953 return &new_hbq_entry->dbuf; 955 return &new_hbq_entry->dbuf;
954} 956}
955 957
958
956static int 959static int
957lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, 960lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
958 struct lpfc_iocbq *saveq) 961 struct lpfc_iocbq *saveq)
@@ -964,6 +967,22 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
964 967
965 match = 0; 968 match = 0;
966 irsp = &(saveq->iocb); 969 irsp = &(saveq->iocb);
970
971 if (irsp->ulpCommand == CMD_ASYNC_STATUS) {
972 if (pring->lpfc_sli_rcv_async_status)
973 pring->lpfc_sli_rcv_async_status(phba, pring, saveq);
974 else
975 lpfc_printf_log(phba,
976 KERN_WARNING,
977 LOG_SLI,
978 "0316 Ring %d handler: unexpected "
979 "ASYNC_STATUS iocb received evt_code "
980 "0x%x\n",
981 pring->ringno,
982 irsp->un.asyncstat.evt_code);
983 return 1;
984 }
985
967 if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) 986 if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX)
968 || (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX) 987 || (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX)
969 || (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX) 988 || (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX)
@@ -2993,6 +3012,61 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba)
2993 return 0; 3012 return 0;
2994} 3013}
2995 3014
3015void
3016lpfc_sli_async_event_handler(struct lpfc_hba * phba,
3017 struct lpfc_sli_ring * pring, struct lpfc_iocbq * iocbq)
3018{
3019 IOCB_t *icmd;
3020 uint16_t evt_code;
3021 uint16_t temp;
3022 struct temp_event temp_event_data;
3023 struct Scsi_Host *shost;
3024
3025 icmd = &iocbq->iocb;
3026 evt_code = icmd->un.asyncstat.evt_code;
3027 temp = icmd->ulpContext;
3028
3029 if ((evt_code != ASYNC_TEMP_WARN) &&
3030 (evt_code != ASYNC_TEMP_SAFE)) {
3031 lpfc_printf_log(phba,
3032 KERN_ERR,
3033 LOG_SLI,
3034 "0327 Ring %d handler: unexpected ASYNC_STATUS"
3035 " evt_code 0x%x\n",
3036 pring->ringno,
3037 icmd->un.asyncstat.evt_code);
3038 return;
3039 }
3040 temp_event_data.data = (uint32_t)temp;
3041 temp_event_data.event_type = FC_REG_TEMPERATURE_EVENT;
3042 if (evt_code == ASYNC_TEMP_WARN) {
3043 temp_event_data.event_code = LPFC_THRESHOLD_TEMP;
3044 lpfc_printf_log(phba,
3045 KERN_WARNING,
3046 LOG_TEMP,
3047 "0339 Adapter is very hot, please take "
3048 "corrective action. temperature : %d Celsius\n",
3049 temp);
3050 }
3051 if (evt_code == ASYNC_TEMP_SAFE) {
3052 temp_event_data.event_code = LPFC_NORMAL_TEMP;
3053 lpfc_printf_log(phba,
3054 KERN_INFO,
3055 LOG_TEMP,
3056 "0340 Adapter temperature is OK now. "
3057 "temperature : %d Celsius\n",
3058 temp);
3059 }
3060
3061 /* Send temperature change event to applications */
3062 shost = lpfc_shost_from_vport(phba->pport);
3063 fc_host_post_vendor_event(shost, fc_get_event_number(),
3064 sizeof(temp_event_data), (char *) &temp_event_data,
3065 SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX);
3066
3067}
3068
3069
2996int 3070int
2997lpfc_sli_setup(struct lpfc_hba *phba) 3071lpfc_sli_setup(struct lpfc_hba *phba)
2998{ 3072{
@@ -3059,6 +3133,8 @@ lpfc_sli_setup(struct lpfc_hba *phba)
3059 pring->fast_iotag = 0; 3133 pring->fast_iotag = 0;
3060 pring->iotag_ctr = 0; 3134 pring->iotag_ctr = 0;
3061 pring->iotag_max = 4096; 3135 pring->iotag_max = 4096;
3136 pring->lpfc_sli_rcv_async_status =
3137 lpfc_sli_async_event_handler;
3062 pring->num_mask = 4; 3138 pring->num_mask = 4;
3063 pring->prt[0].profile = 0; /* Mask 0 */ 3139 pring->prt[0].profile = 0; /* Mask 0 */
3064 pring->prt[0].rctl = FC_ELS_REQ; 3140 pring->prt[0].rctl = FC_ELS_REQ;