moved Priority class to enum class
The class was over-architected and inflexible. Converted to a simpler
enum class.
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I0515753136d9f78a0d21b6c22794d521fb180df3
diff --git a/analyzer/service_data.cpp b/analyzer/service_data.cpp
index de2c0a7..c13bc8b 100644
--- a/analyzer/service_data.cpp
+++ b/analyzer/service_data.cpp
@@ -6,8 +6,7 @@
//------------------------------------------------------------------------------
void ServiceData::calloutTarget(pdbg_target* i_target,
- const callout::Priority& i_priority,
- bool i_guard)
+ callout::Priority i_priority, bool i_guard)
{
// Add the target to the callout list.
addTargetCallout(i_target, i_priority, i_guard);
@@ -16,7 +15,7 @@
nlohmann::json ffdc;
ffdc["Callout Type"] = "Hardware Callout";
ffdc["Target"] = util::pdbg::getPhysDevPath(i_target);
- ffdc["Priority"] = i_priority.getRegistryString();
+ ffdc["Priority"] = callout::getStringFFDC(i_priority);
ffdc["Guard"] = i_guard;
addCalloutFFDC(ffdc);
}
@@ -25,8 +24,7 @@
void ServiceData::calloutConnected(pdbg_target* i_rxTarget,
const callout::BusType& i_busType,
- const callout::Priority& i_priority,
- bool i_guard)
+ callout::Priority i_priority, bool i_guard)
{
// Get the endpoint target for the transfer side of the bus.
auto txTarget = util::pdbg::getConnectedTarget(i_rxTarget, i_busType);
@@ -40,7 +38,7 @@
ffdc["Bus Type"] = i_busType.getString();
ffdc["RX Target"] = util::pdbg::getPhysDevPath(i_rxTarget);
ffdc["TX Target"] = util::pdbg::getPhysDevPath(txTarget);
- ffdc["Priority"] = i_priority.getRegistryString();
+ ffdc["Priority"] = callout::getStringFFDC(i_priority);
ffdc["Guard"] = i_guard;
addCalloutFFDC(ffdc);
}
@@ -49,7 +47,7 @@
void ServiceData::calloutBus(pdbg_target* i_rxTarget,
const callout::BusType& i_busType,
- const callout::Priority& i_priority, bool i_guard)
+ callout::Priority i_priority, bool i_guard)
{
// Get the endpoint target for the transfer side of the bus.
auto txTarget = util::pdbg::getConnectedTarget(i_rxTarget, i_busType);
@@ -70,7 +68,7 @@
ffdc["Bus Type"] = i_busType.getString();
ffdc["RX Target"] = util::pdbg::getPhysDevPath(i_rxTarget);
ffdc["TX Target"] = util::pdbg::getPhysDevPath(txTarget);
- ffdc["Priority"] = i_priority.getRegistryString();
+ ffdc["Priority"] = callout::getStringFFDC(i_priority);
ffdc["Guard"] = i_guard;
addCalloutFFDC(ffdc);
}
@@ -78,7 +76,7 @@
//------------------------------------------------------------------------------
void ServiceData::calloutClock(const callout::ClockType& i_clockType,
- const callout::Priority& i_priority, bool)
+ callout::Priority i_priority, bool)
{
// Callout the clock target.
// TODO: For P10, the callout is simply the backplane. Also, there are no
@@ -91,33 +89,33 @@
nlohmann::json ffdc;
ffdc["Callout Type"] = "Clock Callout";
ffdc["Clock Type"] = i_clockType.getString();
- ffdc["Priority"] = i_priority.getRegistryString();
+ ffdc["Priority"] = callout::getStringFFDC(i_priority);
addCalloutFFDC(ffdc);
}
//------------------------------------------------------------------------------
void ServiceData::calloutProcedure(const callout::Procedure& i_procedure,
- const callout::Priority& i_priority)
+ callout::Priority i_priority)
{
// Add the actual callout to the service data.
nlohmann::json callout;
callout["Procedure"] = i_procedure.getString();
- callout["Priority"] = i_priority.getUserDataString();
+ callout["Priority"] = callout::getString(i_priority);
addCallout(callout);
// Add the callout FFDC.
nlohmann::json ffdc;
ffdc["Callout Type"] = "Procedure Callout";
ffdc["Procedure"] = i_procedure.getString();
- ffdc["Priority"] = i_priority.getRegistryString();
+ ffdc["Priority"] = callout::getStringFFDC(i_priority);
addCalloutFFDC(ffdc);
}
//------------------------------------------------------------------------------
void ServiceData::calloutPart(const callout::PartType& i_part,
- const callout::Priority& i_priority)
+ callout::Priority i_priority)
{
if (callout::PartType::PNOR == i_part)
{
@@ -135,7 +133,7 @@
nlohmann::json ffdc;
ffdc["Callout Type"] = "Part Callout";
ffdc["Part Type"] = i_part.getString();
- ffdc["Priority"] = i_priority.getRegistryString();
+ ffdc["Priority"] = callout::getStringFFDC(i_priority);
addCalloutFFDC(ffdc);
}
@@ -192,13 +190,12 @@
//------------------------------------------------------------------------------
void ServiceData::addTargetCallout(pdbg_target* i_target,
- const callout::Priority& i_priority,
- bool i_guard)
+ callout::Priority i_priority, bool i_guard)
{
nlohmann::json callout;
callout["LocationCode"] = util::pdbg::getLocationCode(i_target);
- callout["Priority"] = i_priority.getUserDataString();
+ callout["Priority"] = callout::getString(i_priority);
callout["Deconfigured"] = false;
callout["Guarded"] = false; // default
@@ -220,7 +217,7 @@
//------------------------------------------------------------------------------
-void ServiceData::addBackplaneCallout(const callout::Priority& i_priority)
+void ServiceData::addBackplaneCallout(callout::Priority i_priority)
{
// TODO: There isn't a device tree object for this. So will need to hardcode
// the location code for now. In the future, we will need a mechanism
@@ -229,7 +226,7 @@
nlohmann::json callout;
callout["LocationCode"] = "P0";
- callout["Priority"] = i_priority.getUserDataString();
+ callout["Priority"] = callout::getString(i_priority);
callout["Deconfigured"] = false;
callout["Guarded"] = false;