Zane Shelley | d84ed6e | 2020-06-08 13:41:48 -0500 | [diff] [blame] | 1 | #include <assert.h> |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 2 | #include <unistd.h> |
Ben Tyner | 87eabc6 | 2020-05-14 17:56:54 -0500 | [diff] [blame] | 3 | |
Zane Shelley | a9b4434 | 2021-08-08 17:15:52 -0500 | [diff] [blame] | 4 | #include <analyzer/ras-data/ras-data-parser.hpp> |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 5 | #include <analyzer/service_data.hpp> |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 6 | #include <attn/attn_dump.hpp> |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 7 | #include <hei_main.hpp> |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 8 | #include <util/pdbg.hpp> |
Zane Shelley | d84ed6e | 2020-06-08 13:41:48 -0500 | [diff] [blame] | 9 | #include <util/trace.hpp> |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 10 | |
| 11 | namespace analyzer |
| 12 | { |
| 13 | |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 14 | //------------------------------------------------------------------------------ |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 15 | |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 16 | // Forward references for externally defined functions. |
Ben Tyner | 87eabc6 | 2020-05-14 17:56:54 -0500 | [diff] [blame] | 17 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 18 | /** |
| 19 | * @brief Will get the list of active chip and initialize the isolator. |
| 20 | * @param o_chips The returned list of active chips. |
| 21 | */ |
Zane Shelley | 171a2e0 | 2020-11-13 13:56:13 -0600 | [diff] [blame] | 22 | void initializeIsolator(std::vector<libhei::Chip>& o_chips); |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 23 | |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 24 | /** |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 25 | * @brief Will get the list of active chip and initialize the isolator. |
| 26 | * @param i_isoData The data gathered during isolation (for FFDC). |
| 27 | * @param o_rootCause The returned root cause signature. |
| 28 | * @return True, if root cause has been found. False, otherwise. |
| 29 | */ |
| 30 | bool filterRootCause(const libhei::IsolationData& i_isoData, |
| 31 | libhei::Signature& o_rootCause); |
| 32 | |
| 33 | /** |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 34 | * @brief Will create and submit a PEL using the given data. |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 35 | * @param i_isoData The data gathered during isolation (for FFDC). |
Zane Shelley | 4ed4be5 | 2021-02-15 17:53:40 -0600 | [diff] [blame] | 36 | * @param i_servData Data regarding service actions gathered during analysis. |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 37 | * @return Tuple of BMC log id, platform log id |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 38 | */ |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 39 | std::tuple<uint32_t, uint32_t> createPel(const libhei::IsolationData& i_isoData, |
| 40 | const ServiceData& i_servData); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 41 | |
Zane Shelley | d84ed6e | 2020-06-08 13:41:48 -0500 | [diff] [blame] | 42 | //------------------------------------------------------------------------------ |
| 43 | |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 44 | const char* __attn(libhei::AttentionType_t i_attnType) |
| 45 | { |
| 46 | const char* str = ""; |
| 47 | switch (i_attnType) |
| 48 | { |
| 49 | case libhei::ATTN_TYPE_CHECKSTOP: |
| 50 | str = "CHECKSTOP"; |
| 51 | break; |
| 52 | case libhei::ATTN_TYPE_UNIT_CS: |
| 53 | str = "UNIT_CS"; |
| 54 | break; |
| 55 | case libhei::ATTN_TYPE_RECOVERABLE: |
| 56 | str = "RECOVERABLE"; |
| 57 | break; |
| 58 | case libhei::ATTN_TYPE_SP_ATTN: |
| 59 | str = "SP_ATTN"; |
| 60 | break; |
| 61 | case libhei::ATTN_TYPE_HOST_ATTN: |
| 62 | str = "HOST_ATTN"; |
| 63 | break; |
| 64 | default: |
| 65 | trace::err("Unsupported attention type: %u", i_attnType); |
| 66 | assert(0); |
| 67 | } |
| 68 | return str; |
| 69 | } |
| 70 | |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 71 | //------------------------------------------------------------------------------ |
| 72 | |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 73 | bool analyzeHardware(attn::DumpParameters& o_dumpParameters) |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 74 | { |
| 75 | bool attnFound = false; |
| 76 | |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 77 | if (!util::pdbg::queryHardwareAnalysisSupported()) |
| 78 | { |
| 79 | trace::err("Hardware error analysis is not supported on this system"); |
| 80 | return attnFound; |
| 81 | } |
| 82 | |
| 83 | trace::inf(">>> enter analyzeHardware()"); |
| 84 | |
| 85 | // Initialize the isolator and get all of the chips to be analyzed. |
| 86 | trace::inf("Initializing the isolator..."); |
| 87 | std::vector<libhei::Chip> chips; |
| 88 | initializeIsolator(chips); |
| 89 | |
| 90 | // Isolate attentions. |
| 91 | trace::inf("Isolating errors: # of chips=%u", chips.size()); |
| 92 | libhei::IsolationData isoData{}; |
| 93 | libhei::isolate(chips, isoData); |
| 94 | |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 95 | // For debug, trace out the original list of signatures before filtering. |
| 96 | for (const auto& sig : isoData.getSignatureList()) |
| 97 | { |
| 98 | trace::inf("Signature: %s 0x%0" PRIx32 " %s", |
| 99 | util::pdbg::getPath(sig.getChip()), sig.toUint32(), |
| 100 | __attn(sig.getAttnType())); |
| 101 | } |
| 102 | |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 103 | // Filter for root cause attention. |
Zane Shelley | cb45738 | 2020-11-02 20:55:06 -0600 | [diff] [blame] | 104 | libhei::Signature rootCause{}; |
Zane Shelley | 65fefb2 | 2021-10-18 15:35:26 -0500 | [diff] [blame] | 105 | attnFound = filterRootCause(isoData, rootCause); |
Zane Shelley | cb45738 | 2020-11-02 20:55:06 -0600 | [diff] [blame] | 106 | |
| 107 | if (!attnFound) |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 108 | { |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 109 | // It is possible for TI handling, or manually initiated analysis via |
| 110 | // the command line, that there will not be an active attention. In |
| 111 | // which case, we will do nothing and let the caller of this function |
| 112 | // determine if this is the expected behavior. |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 113 | trace::inf("No active attentions found"); |
| 114 | } |
| 115 | else |
| 116 | { |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 117 | trace::inf("Root cause attention: %s 0x%0" PRIx32 " %s", |
Zane Shelley | cb45738 | 2020-11-02 20:55:06 -0600 | [diff] [blame] | 118 | util::pdbg::getPath(rootCause.getChip()), |
| 119 | rootCause.toUint32(), __attn(rootCause.getAttnType())); |
| 120 | |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 121 | // Resolve any service actions required by the root cause. |
Zane Shelley | a9b4434 | 2021-08-08 17:15:52 -0500 | [diff] [blame] | 122 | RasDataParser rasData{}; |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 123 | ServiceData servData{rootCause, isoData.queryCheckstop()}; |
Zane Shelley | a9b4434 | 2021-08-08 17:15:52 -0500 | [diff] [blame] | 124 | rasData.getResolution(rootCause)->resolve(servData); |
Zane Shelley | d3b9bac | 2020-11-17 21:59:12 -0600 | [diff] [blame] | 125 | |
| 126 | // Create and commit a PEL. |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 127 | uint32_t logId = std::get<1>(createPel(isoData, servData)); |
| 128 | |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 129 | trace::inf("PEL created: PLID=0x%0" PRIx32, logId); |
| 130 | |
Zane Shelley | 04f010a | 2021-11-16 16:52:33 -0600 | [diff] [blame^] | 131 | // Gather/return information needed for dump. A hardware dump will |
| 132 | // always be used for system checkstop attenions. Software dumps will be |
| 133 | // reserved for MP-IPLs during TI analysis. |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 134 | // TODO: Need ID from root cause. At the moment, HUID does not exist in |
| 135 | // devtree. Will need a better ID definition. |
Ben Tyner | 7029e52 | 2021-08-09 19:18:24 -0500 | [diff] [blame] | 136 | o_dumpParameters.logId = logId; |
| 137 | o_dumpParameters.unitId = 0; |
| 138 | o_dumpParameters.dumpType = attn::DumpType::Hardware; |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 139 | } |
| 140 | |
Zane Shelley | e5411f0 | 2021-08-04 22:41:35 -0500 | [diff] [blame] | 141 | // All done, clean up the isolator. |
| 142 | trace::inf("Uninitializing isolator..."); |
| 143 | libhei::uninitialize(); |
Ben Tyner | 87eabc6 | 2020-05-14 17:56:54 -0500 | [diff] [blame] | 144 | |
Zane Shelley | 2f26318 | 2020-07-10 21:41:21 -0500 | [diff] [blame] | 145 | trace::inf("<<< exit analyzeHardware()"); |
| 146 | |
Zane Shelley | 097a71a | 2020-06-08 15:55:29 -0500 | [diff] [blame] | 147 | return attnFound; |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 148 | } |
| 149 | |
Ben Tyner | eea4542 | 2021-04-15 10:54:14 -0500 | [diff] [blame] | 150 | //------------------------------------------------------------------------------ |
| 151 | |
| 152 | /** |
| 153 | * @brief Get error isolator build information |
| 154 | * |
| 155 | * @return Pointer to build information |
| 156 | */ |
| 157 | const char* getBuildInfo() |
| 158 | { |
| 159 | return libhei::getBuildInfo(); |
| 160 | } |
| 161 | |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 162 | } // namespace analyzer |