blob: fe407b614d76319c9503307c86dad76c0d7d4706 [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 Shelley236bb732021-03-24 17:07:46 -05008void HardwareCalloutResolution::resolve(ServiceData& io_sd) const
Zane Shelley0b8368c2021-03-18 17:33:41 -05009{
Zane Shelley236bb732021-03-24 17:07:46 -050010 // 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 Shelley95135822021-08-23 09:00:05 -050026 // 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 Shelleyc85716c2021-08-17 10:54:06 -050029
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 Shelley236bb732021-03-24 17:07:46 -050035
Zane Shelley95135822021-08-23 09:00:05 -050036 // Add the guard info to the service data.
37 io_sd.addGuard(entityPath, iv_guard);
Zane Shelley0b8368c2021-03-18 17:33:41 -050038}
39
Zane Shelleyc85716c2021-08-17 10:54:06 -050040//------------------------------------------------------------------------------
41
42void 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 Shelley0b8368c2021-03-18 17:33:41 -050053} // namespace analyzer