Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 1 | #include <attn/attn_common.hpp> |
Ben Tyner | 5c5db65 | 2021-02-22 18:22:35 -0600 | [diff] [blame] | 2 | #include <attn/attn_dbus.hpp> |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 3 | #include <attn/attn_dump.hpp> |
Ben Tyner | b797b3e | 2020-06-29 10:12:05 -0500 | [diff] [blame] | 4 | #include <attn/attn_logging.hpp> |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 5 | #include <attn/pel/pel_common.hpp> |
Ben Tyner | b797b3e | 2020-06-29 10:12:05 -0500 | [diff] [blame] | 6 | #include <attn/ti_handler.hpp> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 7 | #include <sdbusplus/bus.hpp> |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 8 | #include <sdbusplus/exception.hpp> |
Ben Tyner | 9306716 | 2021-07-23 10:39:30 -0500 | [diff] [blame] | 9 | #include <util/dbus.hpp> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 10 | |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 11 | #include <iomanip> |
| 12 | #include <iostream> |
| 13 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 14 | namespace attn |
| 15 | { |
| 16 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 17 | /** |
| 18 | * @brief Determine if this is a HB or PHYP TI event |
| 19 | * |
| 20 | * Use the TI info data area to determine if this is either a HB or a PHYP |
| 21 | * TI event then handle the event. |
| 22 | * |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 23 | * @param i_tiDataArea pointer to the TI info data |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 24 | */ |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 25 | int tiHandler(TiDataArea* i_tiDataArea) |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 26 | { |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 27 | int rc = RC_SUCCESS; |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 28 | |
Ben Tyner | b833556 | 2021-07-16 12:43:52 -0500 | [diff] [blame] | 29 | // capture some additional data for logs/traces |
| 30 | addHbStatusRegs(); |
| 31 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 32 | // check TI data area if it is available |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 33 | if (nullptr != i_tiDataArea) |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 34 | { |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 35 | // HB v. PHYP TI logic: Only hosboot will fill in hbTerminateType |
Ben Tyner | 8882c32 | 2021-02-05 12:13:21 -0600 | [diff] [blame] | 36 | // and it will be non-zero. Only hostboot will fill out source and |
| 37 | // it it will be non-zero. Only PHYP will fill in srcFormat and it |
| 38 | // will be non-zero. |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 39 | if ((0 == i_tiDataArea->hbTerminateType) && |
| 40 | (0 == i_tiDataArea->source) && (0 != i_tiDataArea->srcFormat)) |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 41 | { |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 42 | handlePhypTi(i_tiDataArea); |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 43 | } |
| 44 | else |
| 45 | { |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 46 | handleHbTi(i_tiDataArea); |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 47 | } |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 48 | } |
| 49 | else |
| 50 | { |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 51 | // TI data was not available This should not happen since we provide |
| 52 | // a default TI info in the case where get TI info was not successful. |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 53 | eventAttentionFail((int)AttnSection::tiHandler | ATTN_INFO_NULL); |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 54 | rc = RC_NOT_HANDLED; |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 55 | } |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 56 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 57 | return rc; |
| 58 | } |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 59 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 60 | /** |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 61 | * @brief Handle a PHYP terminate immediate special attention |
| 62 | * |
| 63 | * The TI info data area will contain information pertaining to the TI |
| 64 | * condition. We will wither quiesce the host or initiate a MPIPL depending |
| 65 | * depending on the auto reboot configuration. We will also create a PEL which |
| 66 | * will contain the TI info data and FFDC data captured in the system journal. |
| 67 | * |
| 68 | * @param i_tiDataArea pointer to TI information filled in by hostboot |
| 69 | */ |
| 70 | void handlePhypTi(TiDataArea* i_tiDataArea) |
| 71 | { |
| 72 | trace<level::INFO>("PHYP TI"); |
| 73 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 74 | // gather additional data for PEL |
| 75 | std::map<std::string, std::string> tiAdditionalData; |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 76 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 77 | if (nullptr != i_tiDataArea) |
| 78 | { |
| 79 | parsePhypOpalTiInfo(tiAdditionalData, i_tiDataArea); |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 80 | |
| 81 | tiAdditionalData["Subsystem"] = |
| 82 | std::to_string(static_cast<uint8_t>(pel::SubsystemID::hypervisor)); |
| 83 | |
Ben Tyner | 9d4f91c | 2021-02-09 08:27:58 -0600 | [diff] [blame] | 84 | // Copy all ascii src chars to additional data |
| 85 | char srcChar[33]; // 32 ascii chars + null term |
| 86 | memcpy(srcChar, &(i_tiDataArea->asciiData0), 32); |
| 87 | srcChar[32] = 0; |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 88 | tiAdditionalData["SrcAscii"] = std::string{srcChar}; |
| 89 | |
| 90 | // TI event |
| 91 | eventTerminate(tiAdditionalData, (char*)i_tiDataArea); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 92 | } |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 93 | else |
| 94 | { |
| 95 | // TI data was not available This should not happen since we provide |
| 96 | // a default TI info in the case where get TI info was not successful. |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 97 | eventAttentionFail((int)AttnSection::handlePhypTi | ATTN_INFO_NULL); |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 98 | } |
Ben Tyner | 063f6bd | 2021-03-26 07:45:56 -0500 | [diff] [blame] | 99 | |
| 100 | // We are finished creating the event log entries so transition host to |
| 101 | // the required state. |
Ben Tyner | 39fcf65 | 2021-10-19 20:38:29 -0500 | [diff] [blame] | 102 | if (true == util::dbus::dumpPolicyEnabled()) |
Ben Tyner | 063f6bd | 2021-03-26 07:45:56 -0500 | [diff] [blame] | 103 | { |
Ben Tyner | 39fcf65 | 2021-10-19 20:38:29 -0500 | [diff] [blame] | 104 | // MPIPL is considered a "dump" so we will qualify this transition with |
| 105 | // the dumpPolicyEnabled property. MPIPL is triggered by by starting |
| 106 | // the host "crash" target. |
Ben Tyner | 9306716 | 2021-07-23 10:39:30 -0500 | [diff] [blame] | 107 | util::dbus::transitionHost(util::dbus::HostState::Crash); |
Ben Tyner | 063f6bd | 2021-03-26 07:45:56 -0500 | [diff] [blame] | 108 | } |
| 109 | else |
| 110 | { |
Ben Tyner | 39fcf65 | 2021-10-19 20:38:29 -0500 | [diff] [blame] | 111 | // If dumpPolicyEnabled property is disabled we will quiesce the host |
Ben Tyner | 9306716 | 2021-07-23 10:39:30 -0500 | [diff] [blame] | 112 | util::dbus::transitionHost(util::dbus::HostState::Quiesce); |
Ben Tyner | 063f6bd | 2021-03-26 07:45:56 -0500 | [diff] [blame] | 113 | } |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | /** |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 117 | * @brief Handle a hostboot terminate immediate with SRC provided |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 118 | * |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 119 | * The TI info will contain the log ID of the event log that has already been |
| 120 | * submitted by hostboot. In this case the attention handler does not need to |
| 121 | * create a PEL. A hostboot dump may be requested and the host will be |
| 122 | * transitioned. |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 123 | * |
| 124 | * @param i_tiDataArea pointer to TI information filled in by hostboot |
| 125 | */ |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 126 | void handleHbTiWithEid(TiDataArea* i_tiDataArea) |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 127 | { |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 128 | trace<level::INFO>("HB TI with PLID/EID"); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 129 | |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 130 | if (nullptr != i_tiDataArea) |
| 131 | { |
| 132 | // see if HB dump is requested |
| 133 | if (0 != i_tiDataArea->hbDumpFlag) |
| 134 | { |
| 135 | // retrieve log ID from TI info data |
| 136 | uint32_t logId = be32toh(i_tiDataArea->asciiData1); |
| 137 | requestDump(DumpParameters{logId, 0, DumpType::Hostboot}); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | util::dbus::transitionHost(util::dbus::HostState::Quiesce); |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * @brief Handle a hostboot terminate immediate with SRC provided |
| 146 | * |
| 147 | * The TI info will contain the reason code and additional data necessary |
| 148 | * to create a PEL on behalf of hostboot. A hostboot dump may be created |
| 149 | * (after generating the PEL) and the host may be transitioned depending |
| 150 | * on the reason code. |
| 151 | * |
| 152 | * @param i_tiDataArea pointer to TI information filled in by hostboot |
| 153 | */ |
| 154 | void handleHbTiWithSrc(TiDataArea* i_tiDataArea) |
| 155 | { |
| 156 | trace<level::INFO>("HB TI with SRC"); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 157 | |
| 158 | // handle specific hostboot reason codes |
| 159 | if (nullptr != i_tiDataArea) |
| 160 | { |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 161 | // Reason code is byte 2 and 3 of 4 byte srcWord12HbWord0 |
| 162 | uint16_t reasonCode = be32toh(i_tiDataArea->srcWord12HbWord0); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 163 | |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 164 | if (reasonCode != HB_SRC_SHUTDOWN_REQUEST) |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 165 | { |
Ben Tyner | 5c5db65 | 2021-02-22 18:22:35 -0600 | [diff] [blame] | 166 | // gather additional data for PEL |
| 167 | std::map<std::string, std::string> tiAdditionalData; |
| 168 | |
| 169 | parseHbTiInfo(tiAdditionalData, i_tiDataArea); |
| 170 | |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 171 | tiAdditionalData["Subsystem"] = std::to_string( |
| 172 | static_cast<uint8_t>(pel::SubsystemID::hostboot)); |
| 173 | |
Ben Tyner | 5c5db65 | 2021-02-22 18:22:35 -0600 | [diff] [blame] | 174 | // Translate hex src value to ascii. This results in an 8 |
| 175 | // character SRC (hostboot SRC is 32 bits) |
Ben Tyner | 9d4f91c | 2021-02-09 08:27:58 -0600 | [diff] [blame] | 176 | std::stringstream src; |
Ben Tyner | 4bbcb38 | 2021-02-22 09:29:00 -0600 | [diff] [blame] | 177 | src << std::setw(8) << std::setfill('0') << std::uppercase |
| 178 | << std::hex << be32toh(i_tiDataArea->srcWord12HbWord0); |
Ben Tyner | 9d4f91c | 2021-02-09 08:27:58 -0600 | [diff] [blame] | 179 | tiAdditionalData["SrcAscii"] = src.str(); |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 180 | |
Ben Tyner | 5c5db65 | 2021-02-22 18:22:35 -0600 | [diff] [blame] | 181 | // Request dump after generating event log? |
| 182 | tiAdditionalData["Dump"] = |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 183 | (0 != i_tiDataArea->hbDumpFlag) ? "true" : "false"; |
Ben Tyner | 5c5db65 | 2021-02-22 18:22:35 -0600 | [diff] [blame] | 184 | |
| 185 | // Generate event log |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 186 | eventTerminate(tiAdditionalData, (char*)i_tiDataArea); |
| 187 | } |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 188 | |
| 189 | if (HB_SRC_KEY_TRANSITION != reasonCode) |
Ben Tyner | 5c5db65 | 2021-02-22 18:22:35 -0600 | [diff] [blame] | 190 | { |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 191 | util::dbus::transitionHost(util::dbus::HostState::Quiesce); |
Ben Tyner | 5c5db65 | 2021-02-22 18:22:35 -0600 | [diff] [blame] | 192 | } |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 193 | } |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 194 | else |
Ben Tyner | 063f6bd | 2021-03-26 07:45:56 -0500 | [diff] [blame] | 195 | { |
Ben Tyner | 0f481a4 | 2021-10-19 11:23:43 -0500 | [diff] [blame] | 196 | // TI data was not available, this should not happen |
| 197 | eventAttentionFail((int)AttnSection::handleHbTi | ATTN_INFO_NULL); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * @brief Handle a hostboot terminate immediate special attention |
| 203 | * |
| 204 | * The TI info data area will contain information pertaining to the TI |
| 205 | * condition. The course of action to take regarding the host state will |
| 206 | * depend on the contents of the TI info data area. We will also create a |
| 207 | * PEL containing the TI info data and FFDC data captured in the system |
| 208 | * journal. |
| 209 | * |
| 210 | * @param i_tiDataArea pointer to TI information filled in by hostboot |
| 211 | */ |
| 212 | void handleHbTi(TiDataArea* i_tiDataArea) |
| 213 | { |
| 214 | trace<level::INFO>("HB TI"); |
| 215 | |
| 216 | // handle specific hostboot reason codes |
| 217 | if (nullptr != i_tiDataArea) |
| 218 | { |
| 219 | uint8_t terminateType = i_tiDataArea->hbTerminateType; |
| 220 | |
| 221 | if (TI_WITH_SRC == terminateType) |
| 222 | { |
| 223 | handleHbTiWithSrc(i_tiDataArea); |
| 224 | } |
| 225 | else |
| 226 | { |
| 227 | handleHbTiWithEid(i_tiDataArea); |
| 228 | } |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | // TI data was not available, this should not happen |
| 233 | eventAttentionFail((int)AttnSection::handleHbTi | ATTN_INFO_NULL); |
Ben Tyner | 063f6bd | 2021-03-26 07:45:56 -0500 | [diff] [blame] | 234 | } |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | /** @brief Parse the TI info data area into map as PHYP/OPAL data */ |
| 238 | void parsePhypOpalTiInfo(std::map<std::string, std::string>& i_map, |
| 239 | TiDataArea* i_tiDataArea) |
| 240 | { |
Ben Tyner | 1c4b02e | 2020-11-09 14:00:29 -0600 | [diff] [blame] | 241 | if (nullptr == i_tiDataArea) |
| 242 | { |
| 243 | return; |
| 244 | } |
| 245 | |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 246 | std::stringstream ss; |
| 247 | |
Ben Tyner | feeea83 | 2021-04-06 10:08:11 -0500 | [diff] [blame] | 248 | ss << "0x00 TI Area Valid:" << std::setw(2) << std::setfill('0') << std::hex |
| 249 | << (int)i_tiDataArea->tiAreaValid << ":"; |
| 250 | ss << "0x01 Command:" << std::setw(2) << std::setfill('0') << std::hex |
| 251 | << (int)i_tiDataArea->command << ":"; |
| 252 | ss << "0x02 Num. Data Bytes:" << std::setw(4) << std::setfill('0') |
| 253 | << std::hex << be16toh(i_tiDataArea->numDataBytes) << ":"; |
| 254 | ss << "0x04 Reserved:" << std::setw(2) << std::setfill('0') << std::hex |
| 255 | << (int)i_tiDataArea->reserved1 << ":"; |
| 256 | ss << "0x06 HWDump Type:" << std::setw(4) << std::setfill('0') << std::hex |
| 257 | << be16toh(i_tiDataArea->hardwareDumpType) << ":"; |
| 258 | ss << "0x08 SRC Format:" << std::setw(2) << std::setfill('0') << std::hex |
| 259 | << (int)i_tiDataArea->srcFormat << ":"; |
| 260 | ss << "0x09 SRC Flags:" << std::setw(2) << std::setfill('0') << std::hex |
| 261 | << (int)i_tiDataArea->srcFlags << ":"; |
| 262 | ss << "0x0a Num. ASCII Words:" << std::setw(2) << std::setfill('0') |
| 263 | << std::hex << (int)i_tiDataArea->numAsciiWords << ":"; |
| 264 | ss << "0x0b Num. Hex Words:" << std::setw(2) << std::setfill('0') |
| 265 | << std::hex << (int)i_tiDataArea->numHexWords << ":"; |
| 266 | ss << "0x0e Length of SRC:" << std::setw(4) << std::setfill('0') << std::hex |
| 267 | << be16toh(i_tiDataArea->lenSrc) << ":"; |
| 268 | ss << "0x10 SRC Word 12:" << std::setw(8) << std::setfill('0') << std::hex |
| 269 | << be32toh(i_tiDataArea->srcWord12HbWord0) << ":"; |
| 270 | ss << "0x14 SRC Word 13:" << std::setw(8) << std::setfill('0') << std::hex |
| 271 | << be32toh(i_tiDataArea->srcWord13HbWord2) << ":"; |
| 272 | ss << "0x18 SRC Word 14:" << std::setw(8) << std::setfill('0') << std::hex |
| 273 | << be32toh(i_tiDataArea->srcWord14HbWord3) << ":"; |
| 274 | ss << "0x1c SRC Word 15:" << std::setw(8) << std::setfill('0') << std::hex |
| 275 | << be32toh(i_tiDataArea->srcWord15HbWord4) << ":"; |
| 276 | ss << "0x20 SRC Word 16:" << std::setw(8) << std::setfill('0') << std::hex |
| 277 | << be32toh(i_tiDataArea->srcWord16HbWord5) << ":"; |
| 278 | ss << "0x24 SRC Word 17:" << std::setw(8) << std::setfill('0') << std::hex |
| 279 | << be32toh(i_tiDataArea->srcWord17HbWord6) << ":"; |
| 280 | ss << "0x28 SRC Word 18:" << std::setw(8) << std::setfill('0') << std::hex |
| 281 | << be32toh(i_tiDataArea->srcWord18HbWord7) << ":"; |
| 282 | ss << "0x2c SRC Word 19:" << std::setw(8) << std::setfill('0') << std::hex |
| 283 | << be32toh(i_tiDataArea->srcWord19HbWord8) << ":"; |
| 284 | ss << "0x30 ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 285 | << be32toh(i_tiDataArea->asciiData0) << ":"; |
| 286 | ss << "0x34 ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 287 | << be32toh(i_tiDataArea->asciiData1) << ":"; |
| 288 | ss << "0x38 ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 289 | << be32toh(i_tiDataArea->asciiData2) << ":"; |
| 290 | ss << "0x3c ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 291 | << be32toh(i_tiDataArea->asciiData3) << ":"; |
| 292 | ss << "0x40 ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 293 | << be32toh(i_tiDataArea->asciiData4) << ":"; |
| 294 | ss << "0x44 ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 295 | << be32toh(i_tiDataArea->asciiData5) << ":"; |
| 296 | ss << "0x48 ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 297 | << be32toh(i_tiDataArea->asciiData6) << ":"; |
| 298 | ss << "0x4c ASCII Data:" << std::setw(8) << std::setfill('0') << std::hex |
| 299 | << be32toh(i_tiDataArea->asciiData7) << ":"; |
| 300 | ss << "0x50 Location:" << std::setw(2) << std::setfill('0') << std::hex |
| 301 | << (int)i_tiDataArea->location << ":"; |
| 302 | ss << "0x51 Code Sections:" << std::setw(2) << std::setfill('0') << std::hex |
| 303 | << (int)i_tiDataArea->codeSection << ":"; |
| 304 | ss << "0x52 Additional Size:" << std::setw(2) << std::setfill('0') |
| 305 | << std::hex << (int)i_tiDataArea->additionalSize << ":"; |
| 306 | ss << "0x53 Additional Data:" << std::setw(2) << std::setfill('0') |
| 307 | << std::hex << (int)i_tiDataArea->andData; |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 308 | |
| 309 | std::string key, value; |
| 310 | char delim = ':'; |
| 311 | |
| 312 | while (std::getline(ss, key, delim)) |
| 313 | { |
| 314 | std::getline(ss, value, delim); |
| 315 | i_map[key] = value; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | /** @brief Parse the TI info data area into map as hostboot data */ |
| 320 | void parseHbTiInfo(std::map<std::string, std::string>& i_map, |
| 321 | TiDataArea* i_tiDataArea) |
| 322 | { |
Ben Tyner | 1c4b02e | 2020-11-09 14:00:29 -0600 | [diff] [blame] | 323 | if (nullptr == i_tiDataArea) |
| 324 | { |
| 325 | return; |
| 326 | } |
| 327 | |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 328 | std::stringstream ss; |
| 329 | |
Ben Tyner | feeea83 | 2021-04-06 10:08:11 -0500 | [diff] [blame] | 330 | ss << "0x00 TI Area Valid:" << std::setw(2) << std::setfill('0') << std::hex |
| 331 | << (int)i_tiDataArea->tiAreaValid << ":"; |
| 332 | ss << "0x04 Reserved:" << std::setw(2) << std::setfill('0') << std::hex |
| 333 | << (int)i_tiDataArea->reserved1 << ":"; |
| 334 | ss << "0x05 HB_Term. Type:" << std::setw(2) << std::setfill('0') << std::hex |
| 335 | << (int)i_tiDataArea->hbTerminateType << ":"; |
| 336 | ss << "0x0c HB Dump Flag:" << std::setw(2) << std::setfill('0') << std::hex |
| 337 | << (int)i_tiDataArea->hbDumpFlag << ":"; |
| 338 | ss << "0x0d Source:" << std::setw(2) << std::setfill('0') << std::hex |
| 339 | << (int)i_tiDataArea->source << ":"; |
| 340 | ss << "0x10 HB Word 0:" << std::setw(8) << std::setfill('0') << std::hex |
| 341 | << be32toh(i_tiDataArea->srcWord12HbWord0) << ":"; |
| 342 | ss << "0x14 HB Word 2:" << std::setw(8) << std::setfill('0') << std::hex |
| 343 | << be32toh(i_tiDataArea->srcWord13HbWord2) << ":"; |
| 344 | ss << "0x18 HB Word 3:" << std::setw(8) << std::setfill('0') << std::hex |
| 345 | << be32toh(i_tiDataArea->srcWord14HbWord3) << ":"; |
| 346 | ss << "0x1c HB Word 4:" << std::setw(8) << std::setfill('0') << std::hex |
| 347 | << be32toh(i_tiDataArea->srcWord15HbWord4) << ":"; |
| 348 | ss << "0x20 HB Word 5:" << std::setw(8) << std::setfill('0') << std::hex |
| 349 | << be32toh(i_tiDataArea->srcWord16HbWord5) << ":"; |
| 350 | ss << "0x24 HB Word 6:" << std::setw(8) << std::setfill('0') << std::hex |
| 351 | << be32toh(i_tiDataArea->srcWord17HbWord6) << ":"; |
| 352 | ss << "0x28 HB Word 7:" << std::setw(8) << std::setfill('0') << std::hex |
| 353 | << be32toh(i_tiDataArea->srcWord18HbWord7) << ":"; |
| 354 | ss << "0x2c HB Word 8:" << std::setw(8) << std::setfill('0') << std::hex |
| 355 | << be32toh(i_tiDataArea->srcWord19HbWord8) << ":"; |
| 356 | ss << "0x30 error_data:" << std::setw(8) << std::setfill('0') << std::hex |
| 357 | << be32toh(i_tiDataArea->asciiData0) << ":"; |
| 358 | ss << "0x34 EID:" << std::setw(8) << std::setfill('0') << std::hex |
| 359 | << be32toh(i_tiDataArea->asciiData1); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 360 | |
| 361 | std::string key, value; |
| 362 | char delim = ':'; |
| 363 | |
| 364 | while (std::getline(ss, key, delim)) |
| 365 | { |
| 366 | std::getline(ss, value, delim); |
| 367 | i_map[key] = value; |
| 368 | } |
| 369 | } |
| 370 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 371 | } // namespace attn |