Matt Ploetz | ba1bdad | 2015-03-04 23:16:34 -0600 | [diff] [blame^] | 1 | From 03029acd024ac886296f8ed0cbc711d9b81b26da Mon Sep 17 00:00:00 2001 |
| 2 | From: Brian Horton <brianh@linux.ibm.com> |
| 3 | Date: Mon, 2 Mar 2015 12:12:28 -0600 |
| 4 | Subject: [PATCH] change error log to SEL processing |
| 5 | |
| 6 | for hostboot runtime, do not send eSEL (AMI bug) |
| 7 | for hostboot ipl, send down SEL following eSEL |
| 8 | |
| 9 | Change-Id: I86ee9766e27548c3f7f72fbdbfd76c8a8be7da73 |
| 10 | RTC: 124971 |
| 11 | --- |
| 12 | src/include/usr/ipmi/ipmisel.H | 18 ++++++++++-- |
| 13 | src/usr/errl/errlmanager_common.C | 4 ++- |
| 14 | src/usr/ipmi/ipmisel.C | 61 ++++++++++++++++++++++++++++++++------- |
| 15 | 3 files changed, 70 insertions(+), 13 deletions(-) |
| 16 | |
| 17 | diff --git a/src/include/usr/ipmi/ipmisel.H b/src/include/usr/ipmi/ipmisel.H |
| 18 | index de2dd32..91e3651 100644 |
| 19 | --- a/src/include/usr/ipmi/ipmisel.H |
| 20 | +++ b/src/include/usr/ipmi/ipmisel.H |
| 21 | @@ -65,11 +65,13 @@ namespace IPMISEL |
| 22 | * @param[in] size of eSEL data |
| 23 | * @param[in] eid of errorlog for this eSEL (for ack) |
| 24 | * @param[in] event_dir_type for this eSEL |
| 25 | + * @param[in] event_offset for this eSEL |
| 26 | * @param[in] sensorType that caused the error/eSEL |
| 27 | * @param[in] sensorNumber that caused the error/eSEL |
| 28 | */ |
| 29 | void sendESEL(uint8_t* i_eselData, uint32_t i_dataSize, |
| 30 | - uint32_t i_eid, uint8_t i_eventDirType, |
| 31 | + uint32_t i_eid, |
| 32 | + uint8_t i_eventDirType, uint8_t i_eventOffset, |
| 33 | uint8_t i_sensorType, uint8_t i_sensorNumber); |
| 34 | |
| 35 | // per IPMI Spec, section 32.1 SEL Event Records |
| 36 | @@ -85,6 +87,7 @@ namespace IPMISEL |
| 37 | format_ipmi_version_2_0 = 0x04, |
| 38 | }; |
| 39 | |
| 40 | + // event_type, per section 42.1 of the IPMI spec |
| 41 | enum sel_event_dir_type |
| 42 | { |
| 43 | event_unspecified = 0x00, |
| 44 | @@ -93,11 +96,22 @@ namespace IPMISEL |
| 45 | event_predictive = 0x04, |
| 46 | event_limit = 0x05, |
| 47 | event_permformance = 0x06, |
| 48 | + event_transition = 0x07, |
| 49 | + event_OEM = 0x70, |
| 50 | }; |
| 51 | |
| 52 | enum sel_event_data |
| 53 | { |
| 54 | - event_data1_ami = 0xAA, |
| 55 | + event_data1_ami = 0xAA, |
| 56 | + event_data1_trans_to_ok = 0x00, |
| 57 | + event_data1_trans_to_noncrit_from_ok = 0x01, |
| 58 | + event_data1_trans_to_crit_from_less = 0x02, |
| 59 | + event_data1_trans_to_non_recv_from_less = 0x03, |
| 60 | + event_data1_trans_to_non_crit_from_more = 0x04, |
| 61 | + event_data1_trans_to_crit_from_non_r = 0x05, |
| 62 | + event_data1_trans_to_non_recoverable = 0x06, |
| 63 | + event_data1_trans_monitor = 0x07, |
| 64 | + event_data1_trans_informational = 0x08, |
| 65 | }; |
| 66 | |
| 67 | enum sel_generator_id |
| 68 | diff --git a/src/usr/errl/errlmanager_common.C b/src/usr/errl/errlmanager_common.C |
| 69 | index a64ed3b..6c68818 100644 |
| 70 | --- a/src/usr/errl/errlmanager_common.C |
| 71 | +++ b/src/usr/errl/errlmanager_common.C |
| 72 | @@ -135,7 +135,9 @@ void ErrlManager::sendErrLogToBmc(errlHndl_t &io_err) |
| 73 | "sendErrLogToBmc: sensor %.2x/%.2x, size %d", |
| 74 | l_sensorType, l_sensorNumber, l_pelSize); |
| 75 | IPMISEL::sendESEL(l_pelData, l_pelSize, |
| 76 | - io_err->eid(), IPMISEL::event_unspecified, |
| 77 | + io_err->eid(), |
| 78 | + IPMISEL::event_transition, |
| 79 | + IPMISEL::event_data1_trans_to_non_recoverable, |
| 80 | l_sensorType, l_sensorNumber); |
| 81 | |
| 82 | // free the buffer |
| 83 | diff --git a/src/usr/ipmi/ipmisel.C b/src/usr/ipmi/ipmisel.C |
| 84 | index c05c60f..49dcee6 100644 |
| 85 | --- a/src/usr/ipmi/ipmisel.C |
| 86 | +++ b/src/usr/ipmi/ipmisel.C |
| 87 | @@ -82,7 +82,8 @@ enum esel_retry |
| 88 | namespace IPMISEL |
| 89 | { |
| 90 | void sendESEL(uint8_t* i_eselData, uint32_t i_dataSize, |
| 91 | - uint32_t i_eid, uint8_t i_eventDirType, |
| 92 | + uint32_t i_eid, |
| 93 | + uint8_t i_eventDirType, uint8_t i_eventOffset, |
| 94 | uint8_t i_sensorType, uint8_t i_sensorNumber) |
| 95 | { |
| 96 | IPMI_TRAC(ENTER_MRK "sendESEL()"); |
| 97 | @@ -100,13 +101,13 @@ void sendESEL(uint8_t* i_eselData, uint32_t i_dataSize, |
| 98 | |
| 99 | // create the sel record of information |
| 100 | selRecord l_sel; |
| 101 | - l_sel.record_type = record_type_ami_esel; |
| 102 | + l_sel.record_type = record_type_system_event; |
| 103 | l_sel.generator_id = generator_id_ami; |
| 104 | l_sel.evm_format_version = format_ipmi_version_2_0; |
| 105 | l_sel.sensor_type = i_sensorType; |
| 106 | l_sel.sensor_number = i_sensorNumber; |
| 107 | l_sel.event_dir_type = i_eventDirType; |
| 108 | - l_sel.event_data1 = event_data1_ami; |
| 109 | + l_sel.event_data1 = i_eventOffset; |
| 110 | |
| 111 | eselInitData *eselData = |
| 112 | new eselInitData(&l_sel, i_eselData, i_dataSize); |
| 113 | @@ -216,13 +217,16 @@ void send_esel(eselInitData * i_data, |
| 114 | { |
| 115 | IPMI_TRAC(ENTER_MRK "send_esel"); |
| 116 | uint8_t* data = NULL; |
| 117 | - const size_t l_eSELlen = i_data->dataSize; |
| 118 | |
| 119 | size_t len = 0; |
| 120 | - uint8_t reserveID[2] = {0,0}; |
| 121 | uint8_t esel_recordID[2] = {0,0}; |
| 122 | + uint8_t sel_recordID[2] = {0,0}; |
| 123 | |
| 124 | +#ifndef __HOSTBOOT_RUNTIME |
| 125 | +// TODO RTC: 124972 take this out when runtime supports the eSEL |
| 126 | do{ |
| 127 | + const size_t l_eSELlen = i_data->dataSize; |
| 128 | + uint8_t reserveID[2] = {0,0}; |
| 129 | // we need to send down the extended sel data (eSEL), which is |
| 130 | // longer than the protocol buffer, so we need to do a reservation and |
| 131 | // call the AMI partial_add_esel command multiple times |
| 132 | @@ -258,6 +262,9 @@ void send_esel(eselInitData * i_data, |
| 133 | // copy in the SEL event record data |
| 134 | memcpy(&data[PARTIAL_ADD_ESEL_REQ], i_data->eSel, |
| 135 | sizeof(selRecord)); |
| 136 | + // update to make this what AMI eSEL wants |
| 137 | + data[PARTIAL_ADD_ESEL_REQ + offsetof(selRecord,record_type)] = record_type_ami_esel; |
| 138 | + data[PARTIAL_ADD_ESEL_REQ + offsetof(selRecord,event_data1)] = event_data1_ami; |
| 139 | |
| 140 | o_cc = IPMI::CC_UNKBAD; |
| 141 | TRACFBIN( g_trac_ipmi, INFO_MRK"1st partial_add_esel:", data, len); |
| 142 | @@ -338,17 +345,51 @@ void send_esel(eselInitData * i_data, |
| 143 | // BMC returns the recordID, it's always the same (unless |
| 144 | // there's a major BMC bug...) |
| 145 | storeReserveRecord(esel_recordID,data); |
| 146 | + } // while eSELindex |
| 147 | + }while(0); |
| 148 | +#endif |
| 149 | + |
| 150 | + // if eSEL wasn't created due to an error, we don't want to continue |
| 151 | + if(o_err == NULL) |
| 152 | + { |
| 153 | + // if the eSEL wasn't created due to a bad completion code, we will |
| 154 | + // still try to send down a SEL that we create, which will contain |
| 155 | + // the eSEL recordID (if it was successful) |
| 156 | + delete [] data; |
| 157 | + len = sizeof(IPMISEL::selRecord); |
| 158 | + data = new uint8_t[len]; |
| 159 | + |
| 160 | + // copy in the SEL event record data |
| 161 | + memcpy(data, i_data->eSel, sizeof(IPMISEL::selRecord)); |
| 162 | + // copy the eSEL recordID (if it was created) into the extra data area |
| 163 | + data[offsetof(selRecord,event_data2)] = esel_recordID[1]; |
| 164 | + data[offsetof(selRecord,event_data3)] = esel_recordID[0]; |
| 165 | + |
| 166 | + // use local cc so that we don't corrupt the esel from above |
| 167 | + IPMI::completion_code l_cc = IPMI::CC_UNKBAD; |
| 168 | + TRACFBIN( g_trac_ipmi, INFO_MRK"add_sel:", data, len); |
| 169 | + o_err = IPMI::sendrecv(IPMI::add_sel(),l_cc,len,data); |
| 170 | + if(o_err) |
| 171 | + { |
| 172 | + IPMI_TRAC(ERR_MRK "error from add_sel"); |
| 173 | } |
| 174 | - if(o_err || (o_cc != IPMI::CC_OK)) |
| 175 | + else if (l_cc != IPMI::CC_OK) |
| 176 | { |
| 177 | - break; |
| 178 | + IPMI_TRAC(ERR_MRK "failed add_sel, l_cc %02x", l_cc); |
| 179 | } |
| 180 | - }while(0); |
| 181 | + else |
| 182 | + { |
| 183 | + // if CC_OK, then len = 2 and data contains the recordID of the new SEL |
| 184 | + storeReserveRecord(sel_recordID,data); |
| 185 | + } |
| 186 | + } |
| 187 | |
| 188 | delete[] data; |
| 189 | |
| 190 | - IPMI_TRAC(EXIT_MRK "send_esel (o_err %.8X, o_cc x%.2x, recID=x%x%x)", |
| 191 | - o_err ? o_err->plid() : NULL, o_cc, esel_recordID[1], esel_recordID[0]); |
| 192 | + IPMI_TRAC(EXIT_MRK |
| 193 | + "send_esel o_err=%.8X, o_cc=x%.2x, sel recID=x%x%x, esel recID=x%x%x", |
| 194 | + o_err ? o_err->plid() : NULL, o_cc, sel_recordID[1], sel_recordID[0], |
| 195 | + esel_recordID[1], esel_recordID[0]); |
| 196 | |
| 197 | return; |
| 198 | } // send_esel |
| 199 | -- |
| 200 | 1.8.2.2 |
| 201 | |