1 2 #include <analyzer/plugins/plugin.hpp> 3 #include <hei_util.hpp> 4 #include <util/pdbg.hpp> 5 #include <util/trace.hpp> 6 7 namespace analyzer 8 { 9 10 namespace P10 11 { 12 13 /** 14 * @brief Adds all clocks/chips reporting PLL unlock attentions to the callout 15 * list. 16 * 17 * Processors are always called out at medium priority and never guarded. If 18 * more than one processor is reporting a PLL unlock attention on the same 19 * clock, the clock is called out with high priority. Otherwise, the clock 20 * callout priority is medium. 21 */ 22 void pll_unlock(unsigned int i_instance, const libhei::Chip&, 23 ServiceData& io_servData) 24 { 25 auto nodeId = libhei::hash<libhei::NodeId_t>("PLL_UNLOCK"); 26 27 auto sigList = io_servData.getIsolationData().getSignatureList(); 28 29 // The PLL list is initially the same size of the signature list. 30 std::vector<libhei::Signature> pllList{sigList.size()}; 31 32 // Copy all signatures that match the node ID and bit position. Note that 33 // in this case the bit position is the same as the plugin instance. 34 auto itr = std::copy_if(sigList.begin(), sigList.end(), pllList.begin(), 35 [&nodeId, &i_instance](const auto& s) { 36 return (nodeId == s.getId() && 37 i_instance == s.getBit()); 38 }); 39 40 // Shrink the size of the PLL list if necessary. 41 pllList.resize(std::distance(pllList.begin(), itr)); 42 43 // The clock callout priority is dependent on the number of chips with PLL 44 // unlock attentions. 45 auto clockPriority = 46 (1 < pllList.size()) ? callout::Priority::HIGH : callout::Priority::MED; 47 48 // Callout the clock. 49 auto clockCallout = (0 == i_instance) ? callout::ClockType::OSC_REF_CLOCK_0 50 : callout::ClockType::OSC_REF_CLOCK_1; 51 io_servData.calloutClock(clockCallout, clockPriority, true); 52 53 // Callout the processors connected to this clock that are reporting PLL 54 // unlock attentions. Always a medium callout and no guarding. 55 for (const auto& sig : pllList) 56 { 57 io_servData.calloutTarget(util::pdbg::getTrgt(sig.getChip()), 58 callout::Priority::MED, false); 59 } 60 } 61 62 } // namespace P10 63 64 PLUGIN_DEFINE_NS(P10_10, P10, pll_unlock); 65 PLUGIN_DEFINE_NS(P10_20, P10, pll_unlock); 66 67 } // namespace analyzer 68