ConnectedCalloutResolution support
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Id1b215d70ca98ae18528f91162ff4d99de9e9ce8
diff --git a/analyzer/ras-data/data/ras-data-explorer-11.json b/analyzer/ras-data/data/ras-data-explorer-11.json
index 8c835b4..37a216e 100644
--- a/analyzer/ras-data/data/ras-data-explorer-11.json
+++ b/analyzer/ras-data/data/ras-data-explorer-11.json
@@ -7,7 +7,7 @@
},
"buses" : {
"omi_bus": {
- "type": "parent"
+ "type": "OMI_BUS"
}
},
"actions" : {
diff --git a/analyzer/ras-data/data/ras-data-explorer-20.json b/analyzer/ras-data/data/ras-data-explorer-20.json
index 2bee510..1d99c6a 100644
--- a/analyzer/ras-data/data/ras-data-explorer-20.json
+++ b/analyzer/ras-data/data/ras-data-explorer-20.json
@@ -7,7 +7,7 @@
},
"buses" : {
"omi_bus": {
- "type": "parent"
+ "type": "OMI_BUS"
}
},
"actions" : {
diff --git a/analyzer/ras-data/ras-data-definition.md b/analyzer/ras-data/ras-data-definition.md
index 2538230..b7846d7 100644
--- a/analyzer/ras-data/ras-data-definition.md
+++ b/analyzer/ras-data/ras-data-definition.md
@@ -58,7 +58,7 @@
| Keyword | Description |
|---------|--------------------------------------------------------------------|
-| type | The bus connection type. Values (string): `peer`, `parent`, `child`|
+| type | The bus connection type. Values (string): `SMP_BUS` and `OMI_BUS` |
| unit | Optional. The `<unit_name>` of the bus endpoint on this chip. |
## 5) `actions` keyword (required)
diff --git a/analyzer/ras-data/ras-data-parser.cpp b/analyzer/ras-data/ras-data-parser.cpp
index d59c289..ea59c07 100644
--- a/analyzer/ras-data/ras-data-parser.cpp
+++ b/analyzer/ras-data/ras-data-parser.cpp
@@ -118,6 +118,33 @@
//------------------------------------------------------------------------------
+std::tuple<callout::BusType, std::string>
+ RasDataParser::parseBus(const nlohmann::json& i_data,
+ const std::string& i_name)
+{
+ auto bus = i_data.at("buses").at(i_name);
+
+ // clang-format off
+ static const std::map<std::string, callout::BusType> m =
+ {
+ {"SMP_BUS", callout::BusType::SMP_BUS},
+ {"OMI_BUS", callout::BusType::OMI_BUS},
+ };
+ // clang-format on
+
+ auto busType = m.at(bus.at("type").get<std::string>());
+
+ std::string unitPath{}; // default empty if unit does not exist
+ if (bus.contains("unit"))
+ {
+ unitPath = bus.at("unit").get<std::string>();
+ }
+
+ return std::make_tuple(busType, unitPath);
+}
+
+//------------------------------------------------------------------------------
+
std::shared_ptr<Resolution>
RasDataParser::parseAction(const nlohmann::json& i_data,
const std::string& i_action)
@@ -168,9 +195,11 @@
auto priority = a.at("priority").get<std::string>();
auto guard = a.at("guard").get<bool>();
- // TODO
- trace::inf("callout_connected: name=%s priority=%s guard=%c",
- name.c_str(), priority.c_str(), guard ? 'T' : 'F');
+ auto busData = parseBus(i_data, name);
+
+ o_list->push(std::make_shared<ConnectedCalloutResolution>(
+ std::get<0>(busData), std::get<1>(busData),
+ getPriority(priority), guard));
}
else if ("callout_bus" == type)
{
diff --git a/analyzer/ras-data/ras-data-parser.hpp b/analyzer/ras-data/ras-data-parser.hpp
index fe5e4a1..60d9ab7 100644
--- a/analyzer/ras-data/ras-data-parser.hpp
+++ b/analyzer/ras-data/ras-data-parser.hpp
@@ -54,6 +54,17 @@
const libhei::Signature& i_signature);
/**
+ * @brief Parses a bus object in the given data file and returns the bus
+ * type and unit path.
+ * @param i_data The parsed RAS data file associated with the signature's
+ * chip type.
+ * @param i_name The name of the target bus.
+ * @return A tuple containing the bus type and unit path.
+ */
+ std::tuple<callout::BusType, std::string>
+ parseBus(const nlohmann::json& i_data, const std::string& i_name);
+
+ /**
* @brief Parses an action in the given data file and returns the
* corresponding resolution.
* @param i_data The parsed RAS data file associated with the signature's
diff --git a/analyzer/ras-data/schema/ras-data-schema-v01.json b/analyzer/ras-data/schema/ras-data-schema-v01.json
index 9ec7150..d675631 100644
--- a/analyzer/ras-data/schema/ras-data-schema-v01.json
+++ b/analyzer/ras-data/schema/ras-data-schema-v01.json
@@ -48,7 +48,7 @@
"properties": {
"type": {
"type": "string",
- "enum": [ "peer", "parent", "child" ]
+ "enum": [ "SMP_BUS", "OMI_BUS" ]
},
"unit": {
"type": "string",