Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 1 | #include <analyzer/resolution.hpp> |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 2 | #include <util/pdbg.hpp> |
| 3 | #include <util/trace.hpp> |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 4 | |
| 5 | namespace analyzer |
| 6 | { |
| 7 | |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 8 | //------------------------------------------------------------------------------ |
| 9 | |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 10 | void HardwareCalloutResolution::resolve(ServiceData& io_sd) const |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 11 | { |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 12 | // Get the chip target from the root cause signature. |
| 13 | auto trgt = util::pdbg::getTrgt(io_sd.getRootCause().getChip()); |
| 14 | auto path = std::string{util::pdbg::getPath(trgt)}; |
| 15 | |
| 16 | // Get the unit target, if needed. |
| 17 | if (!iv_path.empty()) |
| 18 | { |
| 19 | path += "/" + iv_path; |
| 20 | trgt = util::pdbg::getTrgt(path); |
| 21 | if (nullptr == trgt) |
| 22 | { |
| 23 | trace::err("Unable to find target for %s", path.c_str()); |
| 24 | return; // can't continue |
| 25 | } |
| 26 | } |
| 27 | |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 28 | // Get the location code and entity path for this target. |
| 29 | auto locCode = util::pdbg::getLocationCode(trgt); |
| 30 | auto entityPath = util::pdbg::getPhysDevPath(trgt); |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 31 | |
| 32 | // Add the actual callout to the service data. |
| 33 | nlohmann::json callout; |
| 34 | callout["LocationCode"] = locCode; |
| 35 | callout["Priority"] = iv_priority.getUserDataString(); |
| 36 | io_sd.addCallout(callout); |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 37 | |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 38 | // Add the guard info to the service data. |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 39 | Guard guard = io_sd.addGuard(entityPath, iv_guard); |
| 40 | |
| 41 | // Add the callout FFDC to the service data. |
| 42 | nlohmann::json ffdc; |
| 43 | ffdc["Callout Type"] = "Hardware Callout"; |
| 44 | ffdc["Target"] = entityPath; |
| 45 | ffdc["Priority"] = iv_priority.getRegistryString(); |
| 46 | ffdc["Guard Type"] = guard.getString(); |
| 47 | io_sd.addCalloutFFDC(ffdc); |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 48 | } |
| 49 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 50 | //------------------------------------------------------------------------------ |
| 51 | |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame^] | 52 | void ClockCalloutResolution::resolve(ServiceData& io_sd) const |
| 53 | { |
| 54 | // Add the callout to the service data. |
| 55 | // TODO: For P10, the callout is simply the backplane. There isn't a devtree |
| 56 | // object for this, yet. So will need to hardcode the location code |
| 57 | // for now. In the future, we will need a mechanism to make this data |
| 58 | // driven. |
| 59 | nlohmann::json callout; |
| 60 | callout["LocationCode"] = "P0"; |
| 61 | callout["Priority"] = iv_priority.getUserDataString(); |
| 62 | io_sd.addCallout(callout); |
| 63 | |
| 64 | // Add the guard info to the service data. |
| 65 | // TODO: Still waiting for clock targets to be defined in the device tree. |
| 66 | // For get the processor path for the FFDC. |
| 67 | // static const std::map<callout::ClockType, std::string> m = { |
| 68 | // {callout::ClockType::OSC_REF_CLOCK_0, ""}, |
| 69 | // {callout::ClockType::OSC_REF_CLOCK_1, ""}, |
| 70 | // }; |
| 71 | // auto target = std::string{util::pdbg::getPath(m.at(iv_clockType))}; |
| 72 | // auto guardPath = util::pdbg::getPhysDevPath(target); |
| 73 | // Guard guard = io_sd.addGuard(guardPath, iv_guard); |
| 74 | auto target = util::pdbg::getTrgt(io_sd.getRootCause().getChip()); |
| 75 | auto guardPath = util::pdbg::getPhysDevPath(target); |
| 76 | |
| 77 | // Add the callout FFDC to the service data. |
| 78 | nlohmann::json ffdc; |
| 79 | ffdc["Callout Type"] = "Clock Callout"; |
| 80 | ffdc["Clock Type"] = iv_clockType.getString(); |
| 81 | ffdc["Target"] = guardPath; |
| 82 | ffdc["Priority"] = iv_priority.getRegistryString(); |
| 83 | ffdc["Guard Type"] = ""; // TODO: guard.getString(); |
| 84 | io_sd.addCalloutFFDC(ffdc); |
| 85 | } |
| 86 | |
| 87 | //------------------------------------------------------------------------------ |
| 88 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 89 | void ProcedureCalloutResolution::resolve(ServiceData& io_sd) const |
| 90 | { |
| 91 | // Add the actual callout to the service data. |
| 92 | nlohmann::json callout; |
| 93 | callout["Procedure"] = iv_procedure.getString(); |
| 94 | callout["Priority"] = iv_priority.getUserDataString(); |
| 95 | io_sd.addCallout(callout); |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 96 | |
| 97 | // Add the callout FFDC to the service data. |
| 98 | nlohmann::json ffdc; |
| 99 | ffdc["Callout Type"] = "Procedure Callout"; |
| 100 | ffdc["Procedure"] = iv_procedure.getString(); |
| 101 | ffdc["Priority"] = iv_priority.getRegistryString(); |
| 102 | io_sd.addCalloutFFDC(ffdc); |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | //------------------------------------------------------------------------------ |
| 106 | |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 107 | } // namespace analyzer |