created PluginResolution class
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I68560934b487f12b6b95dc73a93bb049f7777656
diff --git a/analyzer/ras-data/data/ras-data-p10-10.json b/analyzer/ras-data/data/ras-data-p10-10.json
index 0957846..d31ddc5 100644
--- a/analyzer/ras-data/data/ras-data-p10-10.json
+++ b/analyzer/ras-data/data/ras-data-p10-10.json
@@ -936,11 +936,11 @@
{ "type": "action", "name": "self_L" }
],
"pll_unlock_0": [
- { "type": "plugin", "name": "pll_unlock_0" },
+ { "type": "plugin", "name": "pll_unlock", "instance": 0 },
{ "type": "callout_self", "priority": "MED", "guard": false }
],
"pll_unlock_1": [
- { "type": "plugin", "name": "pll_unlock_1" },
+ { "type": "plugin", "name": "pll_unlock", "instance": 1 },
{ "type": "callout_self", "priority": "MED", "guard": false }
],
"pcb_slave_parity": [
diff --git a/analyzer/ras-data/data/ras-data-p10-20.json b/analyzer/ras-data/data/ras-data-p10-20.json
index 957ec43..8ed5f00 100644
--- a/analyzer/ras-data/data/ras-data-p10-20.json
+++ b/analyzer/ras-data/data/ras-data-p10-20.json
@@ -936,11 +936,11 @@
{ "type": "action", "name": "self_L" }
],
"pll_unlock_0": [
- { "type": "plugin", "name": "pll_unlock_0" },
+ { "type": "plugin", "name": "pll_unlock", "instance": 0 },
{ "type": "callout_self", "priority": "MED", "guard": false }
],
"pll_unlock_1": [
- { "type": "plugin", "name": "pll_unlock_1" },
+ { "type": "plugin", "name": "pll_unlock", "instance": 1 },
{ "type": "callout_self", "priority": "MED", "guard": false }
],
"pcb_slave_parity": [
diff --git a/analyzer/ras-data/ras-data-definition.md b/analyzer/ras-data/ras-data-definition.md
index d27b3ab..1ad92d1 100644
--- a/analyzer/ras-data/ras-data-definition.md
+++ b/analyzer/ras-data/ras-data-definition.md
@@ -225,6 +225,7 @@
|----------|-------------------------------------------------------------------|
| type | value (string): `plugin` |
| name | A string representing the plugin name. |
+| instance | Some plugins may be defined for multiple register/unit instances. |
### 5.2) `actions` example
diff --git a/analyzer/ras-data/ras-data-parser.cpp b/analyzer/ras-data/ras-data-parser.cpp
index 6ec8b6c..c6d228e 100644
--- a/analyzer/ras-data/ras-data-parser.cpp
+++ b/analyzer/ras-data/ras-data-parser.cpp
@@ -257,9 +257,9 @@
else if ("plugin" == type)
{
auto name = a.at("name").get<std::string>();
+ auto inst = a.at("instance").get<unsigned int>();
- // TODO
- trace::inf("plugin: name=%s", name.c_str());
+ o_list->push(std::make_shared<PluginResolution>(name, inst));
}
else
{
diff --git a/analyzer/ras-data/schema/ras-data-schema-v01.json b/analyzer/ras-data/schema/ras-data-schema-v01.json
index e18b933..4923ba4 100644
--- a/analyzer/ras-data/schema/ras-data-schema-v01.json
+++ b/analyzer/ras-data/schema/ras-data-schema-v01.json
@@ -205,8 +205,13 @@
}
},
"then": {
- "required": [ "name" ],
- "not": { "required": [ "priority", "guard" ] }
+ "required": [ "name", "instance" ],
+ "not": { "required": [ "priority", "guard" ] },
+ "properties": {
+ "instance": {
+ "type": "integer"
+ }
+ }
}
}
]
diff --git a/analyzer/resolution.cpp b/analyzer/resolution.cpp
index 8bf8b95..c47cb31 100644
--- a/analyzer/resolution.cpp
+++ b/analyzer/resolution.cpp
@@ -282,4 +282,12 @@
//------------------------------------------------------------------------------
+void PluginResolution::resolve(ServiceData&) const
+{
+ trace::inf("PluginResolution: iv_name=%s iv_instance=%u", iv_name.c_str(),
+ iv_instance);
+}
+
+//------------------------------------------------------------------------------
+
} // namespace analyzer
diff --git a/analyzer/resolution.hpp b/analyzer/resolution.hpp
index 9530b70..6626318 100644
--- a/analyzer/resolution.hpp
+++ b/analyzer/resolution.hpp
@@ -196,6 +196,36 @@
};
/**
+ * @brief Some service actions cannot be contained within the RAS data files.
+ * This resolution class allows a predefined plugin function to be
+ * called to do additional service action work.
+ */
+class PluginResolution : public Resolution
+{
+ public:
+ /**
+ * @brief Constructor from components.
+ * @param i_name The name of the plugin.
+ * @param i_instance A plugin could be defined for multiple chip
+ * units/registers.
+ */
+ PluginResolution(const std::string& i_name, unsigned int i_instance) :
+ iv_name(i_name), iv_instance(i_instance)
+ {}
+
+ private:
+ /** The name of the plugin. */
+ const std::string iv_name;
+
+ /** Some plugins will define the same action for multiple instances of a
+ * register (i.e. for each core on a processor). */
+ const unsigned int iv_instance;
+
+ public:
+ void resolve(ServiceData& io_sd) const override;
+};
+
+/**
* @brief Contains a list of resolutions. This resolutions will be resolved the
* list in the order in which they were inputted into the constructor.
*/