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 | |
| 52 | void ProcedureCalloutResolution::resolve(ServiceData& io_sd) const |
| 53 | { |
| 54 | // Add the actual callout to the service data. |
| 55 | nlohmann::json callout; |
| 56 | callout["Procedure"] = iv_procedure.getString(); |
| 57 | callout["Priority"] = iv_priority.getUserDataString(); |
| 58 | io_sd.addCallout(callout); |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 59 | |
| 60 | // Add the callout FFDC to the service data. |
| 61 | nlohmann::json ffdc; |
| 62 | ffdc["Callout Type"] = "Procedure Callout"; |
| 63 | ffdc["Procedure"] = iv_procedure.getString(); |
| 64 | ffdc["Priority"] = iv_priority.getRegistryString(); |
| 65 | io_sd.addCalloutFFDC(ffdc); |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | //------------------------------------------------------------------------------ |
| 69 | |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 70 | } // namespace analyzer |