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 | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 8 | void HardwareCalloutResolution::resolve(ServiceData& io_sd) const |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 9 | { |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 10 | // Get the chip target from the root cause signature. |
| 11 | auto trgt = util::pdbg::getTrgt(io_sd.getRootCause().getChip()); |
| 12 | auto path = std::string{util::pdbg::getPath(trgt)}; |
| 13 | |
| 14 | // Get the unit target, if needed. |
| 15 | if (!iv_path.empty()) |
| 16 | { |
| 17 | path += "/" + iv_path; |
| 18 | trgt = util::pdbg::getTrgt(path); |
| 19 | if (nullptr == trgt) |
| 20 | { |
| 21 | trace::err("Unable to find target for %s", path.c_str()); |
| 22 | return; // can't continue |
| 23 | } |
| 24 | } |
| 25 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame^] | 26 | // Get the location code for this target. |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 27 | auto locCode = util::pdbg::getLocationCode(trgt); |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame^] | 28 | |
| 29 | // Add the actual callout to the service data. |
| 30 | nlohmann::json callout; |
| 31 | callout["LocationCode"] = locCode; |
| 32 | callout["Priority"] = iv_priority.getUserDataString(); |
| 33 | io_sd.addCallout(callout); |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 34 | |
| 35 | // Add entity path to gard list. |
| 36 | auto entityPath = util::pdbg::getPhysDevPath(trgt); |
| 37 | if (entityPath.empty()) |
| 38 | { |
| 39 | trace::err("Unable to find entity path for %s", path.c_str()); |
| 40 | } |
| 41 | else |
| 42 | { |
Zane Shelley | 2f92130 | 2021-08-09 13:23:25 -0500 | [diff] [blame] | 43 | Guard::Type guard = Guard::NONE; |
| 44 | if (iv_guard) |
| 45 | { |
| 46 | guard = io_sd.queryCheckstop() ? Guard::FATAL : Guard::NON_FATAL; |
| 47 | } |
| 48 | |
| 49 | io_sd.addGuard(std::make_shared<Guard>(entityPath, guard)); |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 50 | } |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 51 | } |
| 52 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame^] | 53 | //------------------------------------------------------------------------------ |
| 54 | |
| 55 | void ProcedureCalloutResolution::resolve(ServiceData& io_sd) const |
| 56 | { |
| 57 | // Add the actual callout to the service data. |
| 58 | nlohmann::json callout; |
| 59 | callout["Procedure"] = iv_procedure.getString(); |
| 60 | callout["Priority"] = iv_priority.getUserDataString(); |
| 61 | io_sd.addCallout(callout); |
| 62 | } |
| 63 | |
| 64 | //------------------------------------------------------------------------------ |
| 65 | |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 66 | } // namespace analyzer |