blob: a20be83b05a3cdfc7d8f1f97e97f34ae8128fbfd [file] [log] [blame]
Zane Shelley0b8368c2021-03-18 17:33:41 -05001#include <analyzer/resolution.hpp>
Zane Shelley236bb732021-03-24 17:07:46 -05002#include <util/pdbg.hpp>
3#include <util/trace.hpp>
Zane Shelley0b8368c2021-03-18 17:33:41 -05004
5namespace analyzer
6{
7
Zane Shelley2d114322021-08-25 17:06:12 -05008//------------------------------------------------------------------------------
9
Zane Shelley236bb732021-03-24 17:07:46 -050010void HardwareCalloutResolution::resolve(ServiceData& io_sd) const
Zane Shelley0b8368c2021-03-18 17:33:41 -050011{
Zane Shelley236bb732021-03-24 17:07:46 -050012 // 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 Shelley95135822021-08-23 09:00:05 -050028 // 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 Shelleyc85716c2021-08-17 10:54:06 -050031
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 Shelley236bb732021-03-24 17:07:46 -050037
Zane Shelley95135822021-08-23 09:00:05 -050038 // Add the guard info to the service data.
Zane Shelley2d114322021-08-25 17:06:12 -050039 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 Shelley0b8368c2021-03-18 17:33:41 -050048}
49
Zane Shelleyc85716c2021-08-17 10:54:06 -050050//------------------------------------------------------------------------------
51
52void 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 Shelley2d114322021-08-25 17:06:12 -050059
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 Shelleyc85716c2021-08-17 10:54:06 -050066}
67
68//------------------------------------------------------------------------------
69
Zane Shelley0b8368c2021-03-18 17:33:41 -050070} // namespace analyzer