blob: 354ccbc6b620c652b3a797bb9f256092c90c6d6c [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
Zane Shelley84721d92021-09-08 13:30:27 -050052void ClockCalloutResolution::resolve(ServiceData& io_sd) const
53{
54 // Add the callout to the service data.
55 // TODO: For P10, the callout is simply the backplane. There isn't a devtree
56 // object for this, yet. So will need to hardcode the location code
57 // for now. In the future, we will need a mechanism to make this data
58 // driven.
59 nlohmann::json callout;
60 callout["LocationCode"] = "P0";
61 callout["Priority"] = iv_priority.getUserDataString();
62 io_sd.addCallout(callout);
63
64 // Add the guard info to the service data.
65 // TODO: Still waiting for clock targets to be defined in the device tree.
66 // For get the processor path for the FFDC.
67 // static const std::map<callout::ClockType, std::string> m = {
68 // {callout::ClockType::OSC_REF_CLOCK_0, ""},
69 // {callout::ClockType::OSC_REF_CLOCK_1, ""},
70 // };
71 // auto target = std::string{util::pdbg::getPath(m.at(iv_clockType))};
72 // auto guardPath = util::pdbg::getPhysDevPath(target);
73 // Guard guard = io_sd.addGuard(guardPath, iv_guard);
74 auto target = util::pdbg::getTrgt(io_sd.getRootCause().getChip());
75 auto guardPath = util::pdbg::getPhysDevPath(target);
76
77 // Add the callout FFDC to the service data.
78 nlohmann::json ffdc;
79 ffdc["Callout Type"] = "Clock Callout";
80 ffdc["Clock Type"] = iv_clockType.getString();
81 ffdc["Target"] = guardPath;
82 ffdc["Priority"] = iv_priority.getRegistryString();
83 ffdc["Guard Type"] = ""; // TODO: guard.getString();
84 io_sd.addCalloutFFDC(ffdc);
85}
86
87//------------------------------------------------------------------------------
88
Zane Shelleyc85716c2021-08-17 10:54:06 -050089void ProcedureCalloutResolution::resolve(ServiceData& io_sd) const
90{
91 // Add the actual callout to the service data.
92 nlohmann::json callout;
93 callout["Procedure"] = iv_procedure.getString();
94 callout["Priority"] = iv_priority.getUserDataString();
95 io_sd.addCallout(callout);
Zane Shelley2d114322021-08-25 17:06:12 -050096
97 // Add the callout FFDC to the service data.
98 nlohmann::json ffdc;
99 ffdc["Callout Type"] = "Procedure Callout";
100 ffdc["Procedure"] = iv_procedure.getString();
101 ffdc["Priority"] = iv_priority.getRegistryString();
102 io_sd.addCalloutFFDC(ffdc);
Zane Shelleyc85716c2021-08-17 10:54:06 -0500103}
104
105//------------------------------------------------------------------------------
106
Zane Shelley0b8368c2021-03-18 17:33:41 -0500107} // namespace analyzer