1 #include <analyzer/resolution.hpp>
2 #include <util/pdbg.hpp>
3 #include <util/trace.hpp>
4 
5 namespace analyzer
6 {
7 
8 void HardwareCalloutResolution::resolve(ServiceData& io_sd) const
9 {
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     // Get the location code and entity path for this target.
27     auto locCode    = util::pdbg::getLocationCode(trgt);
28     auto entityPath = util::pdbg::getPhysDevPath(trgt);
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);
35 
36     // Add the guard info to the service data.
37     io_sd.addGuard(entityPath, iv_guard);
38 }
39 
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 
53 } // namespace analyzer
54