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 | |
| 26 | // Add location code to callout list. |
| 27 | auto locCode = util::pdbg::getLocationCode(trgt); |
| 28 | if (locCode.empty()) |
| 29 | { |
| 30 | trace::err("Unable to find location code for %s", path.c_str()); |
| 31 | } |
| 32 | else |
| 33 | { |
| 34 | io_sd.addCallout( |
| 35 | std::make_shared<HardwareCallout>(locCode, iv_priority)); |
| 36 | } |
| 37 | |
| 38 | // Add entity path to gard list. |
| 39 | auto entityPath = util::pdbg::getPhysDevPath(trgt); |
| 40 | if (entityPath.empty()) |
| 41 | { |
| 42 | trace::err("Unable to find entity path for %s", path.c_str()); |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | io_sd.addGuard(std::make_shared<Guard>(entityPath, iv_guard)); |
| 47 | } |
Zane Shelley | 0b8368c | 2021-03-18 17:33:41 -0500 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | } // namespace analyzer |