Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 1 | #include <unistd.h> |
| 2 | |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 3 | #include <analyzer/service_data.hpp> |
Zane Shelley | 8f60a62 | 2021-02-01 14:41:30 -0600 | [diff] [blame] | 4 | #include <analyzer/util.hpp> |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 5 | #include <hei_main.hpp> |
| 6 | #include <phosphor-logging/elog.hpp> |
| 7 | #include <sdbusplus/bus.hpp> |
Zane Shelley | b1106b5 | 2021-01-29 13:44:42 -0600 | [diff] [blame] | 8 | #include <util/bin_stream.hpp> |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 9 | #include <util/dbus.hpp> |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 10 | #include <util/ffdc_file.hpp> |
| 11 | #include <util/pdbg.hpp> |
| 12 | #include <util/trace.hpp> |
| 13 | #include <xyz/openbmc_project/Logging/Create/server.hpp> |
| 14 | #include <xyz/openbmc_project/Logging/Entry/server.hpp> |
| 15 | |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 16 | #include <fstream> |
| 17 | #include <memory> |
| 18 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 19 | namespace LogSvr = sdbusplus::xyz::openbmc_project::Logging::server; |
| 20 | |
| 21 | namespace analyzer |
| 22 | { |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 23 | //------------------------------------------------------------------------------ |
| 24 | |
| 25 | enum FfdcSubType_t : uint8_t |
| 26 | { |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 27 | FFDC_SIGNATURES = 0x01, |
| 28 | FFDC_REGISTER_DUMP = 0x02, |
| 29 | FFDC_CALLOUT_FFDC = 0x03, |
Zane Shelley | c18ba8f | 2021-12-01 16:29:20 -0600 | [diff] [blame] | 30 | FFDC_HB_SCRATCH_REGS = 0x04, |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 31 | FFDC_SCRATCH_SIG = 0x05, |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 32 | |
| 33 | // For the callout section, the value of '0xCA' is required per the |
| 34 | // phosphor-logging openpower-pel extention spec. |
| 35 | FFDC_CALLOUTS = 0xCA, |
| 36 | }; |
| 37 | |
| 38 | enum FfdcVersion_t : uint8_t |
| 39 | { |
| 40 | FFDC_VERSION1 = 0x01, |
| 41 | }; |
| 42 | |
| 43 | //------------------------------------------------------------------------------ |
| 44 | |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 45 | void __getSrc(const libhei::Signature& i_signature, uint32_t& o_word6, |
| 46 | uint32_t& o_word7, uint32_t& o_word8) |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 47 | { |
Zane Shelley | a08d1c3 | 2022-03-01 17:51:09 -0600 | [diff] [blame] | 48 | o_word6 = o_word7 = o_word8 = 0; // default |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 49 | |
Zane Shelley | a08d1c3 | 2022-03-01 17:51:09 -0600 | [diff] [blame] | 50 | // Note that the chip could be null if there was no root cause attention |
| 51 | // found during analysis. |
| 52 | if (nullptr != i_signature.getChip().getChip()) |
| 53 | { |
| 54 | // [ 0:15] chip model |
| 55 | // [16:23] reserved space in chip ID |
| 56 | // [24:31] chip EC level |
| 57 | o_word6 = i_signature.getChip().getType(); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 58 | |
Zane Shelley | a08d1c3 | 2022-03-01 17:51:09 -0600 | [diff] [blame] | 59 | // [ 0:15] chip position |
| 60 | // [16:23] node position |
| 61 | // [24:31] signature attention type |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 62 | auto chipPos = util::pdbg::getChipPos(i_signature.getChip()); |
Zane Shelley | a08d1c3 | 2022-03-01 17:51:09 -0600 | [diff] [blame] | 63 | uint8_t nodePos = 0; // TODO: multi-node support |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 64 | auto attn = i_signature.getAttnType(); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 65 | |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 66 | o_word7 = (chipPos & 0xffff) << 16 | (nodePos & 0xff) << 8 | |
| 67 | (attn & 0xff); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 68 | |
Zane Shelley | a08d1c3 | 2022-03-01 17:51:09 -0600 | [diff] [blame] | 69 | // [ 0:15] signature ID |
| 70 | // [16:23] signature instance |
| 71 | // [24:31] signature bit position |
| 72 | o_word8 = i_signature.toUint32(); |
| 73 | |
| 74 | // Word 9 is currently unused |
| 75 | } |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | //------------------------------------------------------------------------------ |
| 79 | |
| 80 | void __setSrc(const libhei::Signature& i_rootCause, |
| 81 | std::map<std::string, std::string>& io_logData) |
| 82 | { |
| 83 | uint32_t word6 = 0, word7 = 0, word8 = 0; |
| 84 | __getSrc(i_rootCause, word6, word7, word8); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 85 | |
| 86 | io_logData["SRC6"] = std::to_string(word6); |
| 87 | io_logData["SRC7"] = std::to_string(word7); |
| 88 | io_logData["SRC8"] = std::to_string(word8); |
| 89 | } |
| 90 | |
| 91 | //------------------------------------------------------------------------------ |
| 92 | |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 93 | void __addCalloutList(const ServiceData& i_servData, |
| 94 | std::vector<util::FFDCFile>& io_userDataFiles) |
| 95 | { |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 96 | // Create a new entry for the user data section containing the callout list. |
| 97 | io_userDataFiles.emplace_back(util::FFDCFormat::JSON, FFDC_CALLOUTS, |
| 98 | FFDC_VERSION1); |
| 99 | |
| 100 | // Use a file stream to write the JSON to file. |
| 101 | std::ofstream o{io_userDataFiles.back().getPath()}; |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 102 | o << i_servData.getCalloutList(); |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | //------------------------------------------------------------------------------ |
| 106 | |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 107 | void __addCalloutFFDC(const ServiceData& i_servData, |
| 108 | std::vector<util::FFDCFile>& io_userDataFiles) |
| 109 | { |
| 110 | // Create a new entry for the user data section containing the FFDC. |
| 111 | io_userDataFiles.emplace_back(util::FFDCFormat::Custom, FFDC_CALLOUT_FFDC, |
| 112 | FFDC_VERSION1); |
| 113 | |
| 114 | // Use a file stream to write the JSON to file. |
| 115 | std::ofstream o{io_userDataFiles.back().getPath()}; |
| 116 | o << i_servData.getCalloutFFDC(); |
| 117 | } |
| 118 | |
| 119 | //------------------------------------------------------------------------------ |
| 120 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 121 | void __captureSignatureList(const libhei::IsolationData& i_isoData, |
| 122 | std::vector<util::FFDCFile>& io_userDataFiles) |
| 123 | { |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 124 | // Create a new entry for this user data section regardless if there are any |
| 125 | // signatures in the list. |
| 126 | io_userDataFiles.emplace_back(util::FFDCFormat::Custom, FFDC_SIGNATURES, |
| 127 | FFDC_VERSION1); |
| 128 | |
Zane Shelley | b1106b5 | 2021-01-29 13:44:42 -0600 | [diff] [blame] | 129 | // Create a streamer for easy writing to the FFDC file. |
| 130 | auto path = io_userDataFiles.back().getPath(); |
| 131 | util::BinFileWriter stream{path}; |
| 132 | |
| 133 | // The first 4 bytes in the FFDC contains the number of signatures in the |
| 134 | // list. Then, the list of signatures will follow. |
| 135 | |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 136 | auto list = i_isoData.getSignatureList(); |
| 137 | |
Zane Shelley | b1106b5 | 2021-01-29 13:44:42 -0600 | [diff] [blame] | 138 | uint32_t numSigs = list.size(); |
| 139 | stream << numSigs; |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 140 | |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 141 | for (const auto& sig : list) |
| 142 | { |
Zane Shelley | b1106b5 | 2021-01-29 13:44:42 -0600 | [diff] [blame] | 143 | // Each signature will use the same format as the SRC (12 bytes each). |
| 144 | uint32_t word6 = 0, word7 = 0, word8 = 0; |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 145 | __getSrc(sig, word6, word7, word8); |
Zane Shelley | b1106b5 | 2021-01-29 13:44:42 -0600 | [diff] [blame] | 146 | stream << word6 << word7 << word8; |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 147 | } |
| 148 | |
Zane Shelley | b1106b5 | 2021-01-29 13:44:42 -0600 | [diff] [blame] | 149 | // If the stream failed for any reason, remove the FFDC file. |
| 150 | if (!stream.good()) |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 151 | { |
Zane Shelley | b1106b5 | 2021-01-29 13:44:42 -0600 | [diff] [blame] | 152 | trace::err("Unable to write signature list FFDC file: %s", |
| 153 | path.string().c_str()); |
| 154 | io_userDataFiles.pop_back(); |
Zane Shelley | 021dab3 | 2020-12-08 20:28:40 -0600 | [diff] [blame] | 155 | } |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | //------------------------------------------------------------------------------ |
| 159 | |
Zane Shelley | 8f60a62 | 2021-02-01 14:41:30 -0600 | [diff] [blame] | 160 | void __captureRegisterDump(const libhei::IsolationData& i_isoData, |
| 161 | std::vector<util::FFDCFile>& io_userDataFiles) |
| 162 | { |
| 163 | // Create a new entry for this user data section regardless if there are any |
| 164 | // registers in the dump. |
| 165 | io_userDataFiles.emplace_back(util::FFDCFormat::Custom, FFDC_REGISTER_DUMP, |
| 166 | FFDC_VERSION1); |
| 167 | |
| 168 | // Create a streamer for easy writing to the FFDC file. |
| 169 | auto path = io_userDataFiles.back().getPath(); |
| 170 | util::BinFileWriter stream{path}; |
| 171 | |
| 172 | // The first 4 bytes in the FFDC contains the number of chips with register |
| 173 | // data. Then the data for each chip will follow. |
| 174 | |
| 175 | auto dump = i_isoData.getRegisterDump(); |
| 176 | |
| 177 | uint32_t numChips = dump.size(); |
| 178 | stream << numChips; |
| 179 | |
| 180 | for (const auto& entry : dump) |
| 181 | { |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 182 | auto chip = entry.first; |
Zane Shelley | 8f60a62 | 2021-02-01 14:41:30 -0600 | [diff] [blame] | 183 | auto regList = entry.second; |
| 184 | |
| 185 | // Each chip will have the following information: |
| 186 | // 4 byte chip model/EC |
| 187 | // 2 byte chip position |
Zane Shelley | ff068a1 | 2021-06-17 17:45:40 -0500 | [diff] [blame] | 188 | // 1 byte node position |
Zane Shelley | 8f60a62 | 2021-02-01 14:41:30 -0600 | [diff] [blame] | 189 | // 4 byte number of registers |
| 190 | // Then the data for each register will follow. |
| 191 | |
| 192 | uint32_t chipType = chip.getType(); |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 193 | uint16_t chipPos = util::pdbg::getChipPos(chip); |
| 194 | uint8_t nodePos = 0; // TODO: multi-node support |
| 195 | uint32_t numRegs = regList.size(); |
Zane Shelley | ff068a1 | 2021-06-17 17:45:40 -0500 | [diff] [blame] | 196 | stream << chipType << chipPos << nodePos << numRegs; |
Zane Shelley | 8f60a62 | 2021-02-01 14:41:30 -0600 | [diff] [blame] | 197 | |
| 198 | for (const auto& reg : regList) |
| 199 | { |
| 200 | // Each register will have the following information: |
| 201 | // 3 byte register ID |
| 202 | // 1 byte register instance |
| 203 | // 1 byte data size |
| 204 | // * byte data buffer (* depends on value of data size) |
| 205 | |
| 206 | libhei::RegisterId_t regId = reg.regId; // 3 byte |
| 207 | libhei::Instance_t regInst = reg.regInst; // 1 byte |
| 208 | |
| 209 | auto tmp = libhei::BitString::getMinBytes(reg.data->getBitLen()); |
| 210 | if (255 < tmp) |
| 211 | { |
| 212 | trace::inf("Register data execeeded 255 and was truncated: " |
| 213 | "regId=0x%06x regInst=%u", |
| 214 | regId, regInst); |
| 215 | tmp = 255; |
| 216 | } |
| 217 | uint8_t dataSize = tmp; |
| 218 | |
| 219 | stream << regId << regInst << dataSize; |
| 220 | |
| 221 | stream.write(reg.data->getBufAddr(), dataSize); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | // If the stream failed for any reason, remove the FFDC file. |
| 226 | if (!stream.good()) |
| 227 | { |
| 228 | trace::err("Unable to write register dump FFDC file: %s", |
| 229 | path.string().c_str()); |
| 230 | io_userDataFiles.pop_back(); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | //------------------------------------------------------------------------------ |
| 235 | |
Zane Shelley | c18ba8f | 2021-12-01 16:29:20 -0600 | [diff] [blame] | 236 | void __captureHostbootScratchRegisters( |
| 237 | std::vector<util::FFDCFile>& io_userDataFiles) |
| 238 | { |
| 239 | // Get the Hostboot scratch registers from the primary processor. |
| 240 | |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 241 | uint32_t cfamAddr = 0x283C; |
Zane Shelley | c18ba8f | 2021-12-01 16:29:20 -0600 | [diff] [blame] | 242 | uint32_t cfamValue = 0; |
| 243 | |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 244 | uint64_t scomAddr = 0x4602F489; |
Zane Shelley | c18ba8f | 2021-12-01 16:29:20 -0600 | [diff] [blame] | 245 | uint64_t scomValue = 0; |
| 246 | |
| 247 | auto priProc = util::pdbg::getPrimaryProcessor(); |
| 248 | if (nullptr == priProc) |
| 249 | { |
| 250 | trace::err("Unable to get primary processor"); |
| 251 | } |
| 252 | else |
| 253 | { |
| 254 | if (0 != util::pdbg::getCfam(priProc, cfamAddr, cfamValue)) |
| 255 | { |
| 256 | cfamValue = 0; // just in case |
| 257 | } |
| 258 | |
| 259 | if (0 != util::pdbg::getScom(priProc, scomAddr, scomValue)) |
| 260 | { |
| 261 | scomValue = 0; // just in case |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | // Create a new entry for this user data section. |
| 266 | io_userDataFiles.emplace_back(util::FFDCFormat::Custom, |
| 267 | FFDC_HB_SCRATCH_REGS, FFDC_VERSION1); |
| 268 | |
| 269 | // Create a streamer for easy writing to the FFDC file. |
| 270 | auto path = io_userDataFiles.back().getPath(); |
| 271 | util::BinFileWriter stream{path}; |
| 272 | |
| 273 | // Add the data (CFAM addr/val, then SCOM addr/val). |
| 274 | stream << cfamAddr << cfamValue << scomAddr << scomValue; |
| 275 | |
| 276 | // If the stream failed for any reason, remove the FFDC file. |
| 277 | if (!stream.good()) |
| 278 | { |
| 279 | trace::err("Unable to write register dump FFDC file: %s", |
| 280 | path.string().c_str()); |
| 281 | io_userDataFiles.pop_back(); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | //------------------------------------------------------------------------------ |
| 286 | |
Caleb Palmer | 7a46525 | 2022-09-09 13:53:16 -0500 | [diff] [blame] | 287 | void __captureScratchRegSignature(std::vector<util::FFDCFile>& io_userDataFiles) |
| 288 | { |
| 289 | // If analysis was interrupted by a system checkstop, there may exist an |
| 290 | // error signature within Hostboot scratch registers 9 (scom: 0x00050180, |
| 291 | // fsi: 0x2980) and 10 (scom: 0x00050181, fsi: 0x2981) which indicates the |
| 292 | // signature from the interrupted analysis. If data exists within those |
| 293 | // registers a user data section will be created in the PEL to record it. |
| 294 | |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 295 | uint32_t reg9Addr = 0x2980; |
Caleb Palmer | 7a46525 | 2022-09-09 13:53:16 -0500 | [diff] [blame] | 296 | uint32_t reg10Addr = 0x2981; |
| 297 | |
| 298 | uint32_t chipId = 0; // stored in reg9 |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 299 | uint32_t sigId = 0; // stored in reg10 |
Caleb Palmer | 7a46525 | 2022-09-09 13:53:16 -0500 | [diff] [blame] | 300 | |
| 301 | auto priProc = util::pdbg::getPrimaryProcessor(); |
| 302 | if (nullptr == priProc) |
| 303 | { |
| 304 | trace::err("Unable to get primary processor"); |
| 305 | } |
| 306 | else |
| 307 | { |
| 308 | if (0 != util::pdbg::getCfam(priProc, reg9Addr, chipId)) |
| 309 | { |
| 310 | chipId = 0; // just in case |
| 311 | } |
| 312 | |
| 313 | if (0 != util::pdbg::getCfam(priProc, reg10Addr, sigId)) |
| 314 | { |
| 315 | sigId = 0; // just in case |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | // If any non-zero data was found in the registers, add them to the FFDC. |
| 320 | if (0 != chipId || 0 != sigId) |
| 321 | { |
| 322 | // Create a new entry for this user data section. |
| 323 | io_userDataFiles.emplace_back(util::FFDCFormat::Custom, |
| 324 | FFDC_SCRATCH_SIG, FFDC_VERSION1); |
| 325 | |
| 326 | // Create a streamer for easy writing to the FFDC file. |
| 327 | auto path = io_userDataFiles.back().getPath(); |
| 328 | util::BinFileWriter stream{path}; |
| 329 | |
| 330 | stream << chipId << sigId; |
| 331 | |
| 332 | // If the stream failed for any reason, remove the FFDC file. |
| 333 | if (!stream.good()) |
| 334 | { |
| 335 | trace::err("Unable to write register dump FFDC file: %s", |
| 336 | path.string().c_str()); |
| 337 | io_userDataFiles.pop_back(); |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | //------------------------------------------------------------------------------ |
| 343 | |
Zane Shelley | f17bf3e | 2021-12-07 13:16:37 -0600 | [diff] [blame] | 344 | std::string __getMessageRegistry(AnalysisType i_type) |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 345 | { |
Zane Shelley | f17bf3e | 2021-12-07 13:16:37 -0600 | [diff] [blame] | 346 | if (AnalysisType::SYSTEM_CHECKSTOP == i_type) |
| 347 | { |
| 348 | return "org.open_power.HwDiags.Error.Checkstop"; |
| 349 | } |
| 350 | else if (AnalysisType::TERMINATE_IMMEDIATE == i_type) |
| 351 | { |
| 352 | return "org.open_power.HwDiags.Error.Predictive"; |
| 353 | } |
| 354 | |
| 355 | return "org.open_power.HwDiags.Error.Informational"; // default |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 356 | } |
| 357 | |
| 358 | //------------------------------------------------------------------------------ |
| 359 | |
Zane Shelley | f17bf3e | 2021-12-07 13:16:37 -0600 | [diff] [blame] | 360 | std::string __getMessageSeverity(AnalysisType i_type) |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 361 | { |
Zane Shelley | f17bf3e | 2021-12-07 13:16:37 -0600 | [diff] [blame] | 362 | // Default severity is informational (no service action required). |
| 363 | LogSvr::Entry::Level severity = LogSvr::Entry::Level::Informational; |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 364 | |
Zane Shelley | f17bf3e | 2021-12-07 13:16:37 -0600 | [diff] [blame] | 365 | if (AnalysisType::SYSTEM_CHECKSTOP == i_type) |
| 366 | { |
| 367 | // System checkstops are always unrecoverable errors (service action |
| 368 | // required). |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 369 | severity = LogSvr::Entry::Level::Error; |
Zane Shelley | f17bf3e | 2021-12-07 13:16:37 -0600 | [diff] [blame] | 370 | } |
| 371 | else if (AnalysisType::TERMINATE_IMMEDIATE == i_type) |
| 372 | { |
| 373 | // TIs will be reported as a predicive error (service action required). |
| 374 | severity = LogSvr::Entry::Level::Warning; |
| 375 | } |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 376 | |
| 377 | // Convert the message severity to a string. |
| 378 | return LogSvr::Entry::convertLevelToString(severity); |
| 379 | } |
| 380 | |
| 381 | //------------------------------------------------------------------------------ |
| 382 | |
Ben Tyner | c1e1c00 | 2022-02-16 15:09:31 -0600 | [diff] [blame] | 383 | uint32_t commitPel(const ServiceData& i_servData) |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 384 | { |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 385 | uint32_t o_plid = 0; // default, zero indicates PEL was not created |
| 386 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 387 | // The message registry will require additional log data to fill in keywords |
| 388 | // and additional log data. |
| 389 | std::map<std::string, std::string> logData; |
| 390 | |
| 391 | // Keep track of the temporary files associated with the user data FFDC. |
| 392 | // WARNING: Once the objects stored in this vector go out of scope, the |
| 393 | // temporary files will be deleted. So they must remain in scope |
| 394 | // until the PEL is submitted. |
| 395 | std::vector<util::FFDCFile> userDataFiles; |
| 396 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 397 | // Set the subsystem in the primary SRC. |
| 398 | i_servData.addSrcSubsystem(logData); |
| 399 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 400 | // Set words 6-9 of the SRC. |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 401 | __setSrc(i_servData.getRootCause(), logData); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 402 | |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 403 | // Add the list of callouts to the PEL. |
| 404 | __addCalloutList(i_servData, userDataFiles); |
| 405 | |
Zane Shelley | c18ba8f | 2021-12-01 16:29:20 -0600 | [diff] [blame] | 406 | // Add the Hostboot scratch register to the PEL. |
| 407 | __captureHostbootScratchRegisters(userDataFiles); |
| 408 | |
Caleb Palmer | 7a46525 | 2022-09-09 13:53:16 -0500 | [diff] [blame] | 409 | // Add the signature stored in the scratch regs if it exists. |
| 410 | __captureScratchRegSignature(userDataFiles); |
| 411 | |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 412 | // Add the callout FFDC to the PEL. |
| 413 | __addCalloutFFDC(i_servData, userDataFiles); |
| 414 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 415 | // Capture the complete signature list. |
Zane Shelley | 62adf5c | 2022-01-18 21:06:50 -0600 | [diff] [blame] | 416 | __captureSignatureList(i_servData.getIsolationData(), userDataFiles); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 417 | |
Zane Shelley | 8f60a62 | 2021-02-01 14:41:30 -0600 | [diff] [blame] | 418 | // Capture the complete signature list. |
Zane Shelley | 62adf5c | 2022-01-18 21:06:50 -0600 | [diff] [blame] | 419 | __captureRegisterDump(i_servData.getIsolationData(), userDataFiles); |
Zane Shelley | 8f60a62 | 2021-02-01 14:41:30 -0600 | [diff] [blame] | 420 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 421 | // Now, that all of the user data files have been created, transform the |
| 422 | // data into the proper format for the PEL. |
| 423 | std::vector<util::FFDCTuple> userData; |
| 424 | util::transformFFDC(userDataFiles, userData); |
| 425 | |
Ben Tyner | c1e1c00 | 2022-02-16 15:09:31 -0600 | [diff] [blame] | 426 | // Get the message registry entry for this failure. |
| 427 | auto message = __getMessageRegistry(i_servData.getAnalysisType()); |
| 428 | |
| 429 | // Get the message severity for this failure. |
| 430 | auto severity = __getMessageSeverity(i_servData.getAnalysisType()); |
| 431 | |
| 432 | // Create the PEL |
| 433 | o_plid = util::dbus::createPel(message, severity, logData, userData); |
| 434 | |
| 435 | if (0 == o_plid) |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 436 | { |
Ben Tyner | c1e1c00 | 2022-02-16 15:09:31 -0600 | [diff] [blame] | 437 | trace::err("Error while creating event log entry"); |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 438 | } |
| 439 | |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 440 | // Return the platorm log ID of the error. |
| 441 | return o_plid; |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | } // namespace analyzer |