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 | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame^] | 26 | // Get the location code and entity path for this target. |
| 27 | auto locCode = util::pdbg::getLocationCode(trgt); |
| 28 | auto entityPath = util::pdbg::getPhysDevPath(trgt); |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 29 | |
| 30 | // Add the actual callout to the service data. |
| 31 | nlohmann::json callout; |
| 32 | callout["LocationCode"] = locCode; |
| 33 | callout["Priority"] = iv_priority.getUserDataString(); |
| 34 | io_sd.addCallout(callout); |
Zane Shelley | 236bb73 | 2021-03-24 17:07:46 -0500 | [diff] [blame] | 35 | |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame^] | 36 | // Add the guard info to the service data. |
| 37 | io_sd.addGuard(entityPath, iv_guard); |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 38 | } |
| 39 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 40 | //------------------------------------------------------------------------------ |
| 41 | |
| 42 | void ProcedureCalloutResolution::resolve(ServiceData& io_sd) const |
| 43 | { |
| 44 | // Add the actual callout to the service data. |
| 45 | nlohmann::json callout; |
| 46 | callout["Procedure"] = iv_procedure.getString(); |
| 47 | callout["Priority"] = iv_priority.getUserDataString(); |
| 48 | io_sd.addCallout(callout); |
| 49 | } |
| 50 | |
| 51 | //------------------------------------------------------------------------------ |
| 52 | |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 53 | } // namespace analyzer |