summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>2017-08-22 07:40:27 -0500
committerDhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>2017-10-11 04:28:11 -0500
commite84841ce7e833d527709c557e9e25829f4e3893c (patch)
treed4b3ce2d8a849da1b9b64f2ee3446fce0bd28277
parentd12ae758516436376bb3b918671acc49a2c630ff (diff)
downloadphosphor-host-ipmid-e84841ce7e833d527709c557e9e25829f4e3893c.tar.gz
phosphor-host-ipmid-e84841ce7e833d527709c557e9e25829f4e3893c.zip
IPMI changes to skip updating non present cores
Cores which are not present need not to be updated to inventory. This change is for skipping several updates to inventory based on skipOn value. Change-Id: I29e005a715ccae1df6eeaf35561a20896ecde0ac Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
-rwxr-xr-xscripts/sensor-example.yaml33
-rw-r--r--scripts/writesensor.mako.cpp15
-rw-r--r--sensordatahandler.cpp11
-rw-r--r--types.hpp12
4 files changed, 65 insertions, 6 deletions
diff --git a/scripts/sensor-example.yaml b/scripts/sensor-example.yaml
index 52eb076..98e9ff6 100755
--- a/scripts/sensor-example.yaml
+++ b/scripts/sensor-example.yaml
@@ -37,16 +37,16 @@
interfaces:
xyz.openbmc_project.Inventory.Item:
Present:
- 6:
+ 0x06:
assert: true
deassert: false
type: bool
xyz.openbmc_project.State.Decorator.OperationalStatus:
Functional:
- 4:
- assert: false
- deassert: true
- type: bool
+ 0x04:
+ assert: false
+ deassert: true
+ type: bool
0x63:
interfaces:
@@ -91,3 +91,26 @@
0xFF:
type: int64_t
+0x54:
+ sensorType: 0x07
+ path: /system/chassis/motherboard/cpu0/core22
+ sensorReadingType: 0x6F
+ serviceInterface: xyz.openbmc_project.Inventory.Manager
+ readingType: assertion
+ interfaces:
+ xyz.openbmc_project.State.Decorator.OperationalStatus:
+ Functional:
+ 0x08:
+ assert: false
+ deassert: true
+ type: bool
+ xyz.openbmc_project.Inventory.Item:
+ Present:
+ 0x07:
+ assert: true
+ deassert: false
+ #The update will be skipped based on the value of skipOn
+ #in this case if offset 0x07 is deasserted
+ #the update will be skipped.
+ skipOn: deassert
+ type: bool
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
index 5cc024e..9cd4e48 100644
--- a/scripts/writesensor.mako.cpp
+++ b/scripts/writesensor.mako.cpp
@@ -73,8 +73,21 @@ extern const IdInfoMap sensors = {
<% continue %>\
% endif
<% valueType = values["type"] %>\
+<%
+try:
+ skip = values["skipOn"]
+ if skip == "assert":
+ skipVal = "SkipAssertion::ASSERT"
+ elif skip == "deassert":
+ skipVal = "SkipAssertion::DEASSERT"
+ else:
+ assert "Unknown skip value " + str(skip)
+except KeyError, e:
+ skipVal = "SkipAssertion::NONE"
+%>\
+ ${skipVal},
% for name,value in values.items():
- % if name == "type":
+ % if name == "type" or name == "skipOn":
<% continue %>\
% endif
% if valueType == "string":
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 1776ec7..c8d4fbf 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -318,11 +318,21 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData,
{
if (assertionSet.test(value.first))
{
+ //Skip update if skipOn is ASSERT
+ if (SkipAssertion::ASSERT == value.second.skip)
+ {
+ return IPMI_CC_OK;
+ }
props.emplace(property.first, value.second.assert);
valid = true;
}
else if (deassertionSet.test(value.first))
{
+ //Skip update if skipOn is DEASSERT
+ if (SkipAssertion::DEASSERT == value.second.skip)
+ {
+ return IPMI_CC_OK;
+ }
props.emplace(property.first, value.second.deassert);
valid = true;
}
@@ -333,6 +343,7 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData,
}
}
}
+
objects.emplace(sensorInfo.sensorPath, std::move(interfaces));
msg.append(std::move(objects));
return updateToDbus(msg);
diff --git a/types.hpp b/types.hpp
index 41dddd9..d3be704 100644
--- a/types.hpp
+++ b/types.hpp
@@ -32,8 +32,20 @@ namespace sensor
using Offset = uint8_t;
+/**
+ * @enum SkipAssertion
+ * Matching value for skipping the update
+ */
+enum class SkipAssertion
+{
+ NONE, //No skip defined
+ ASSERT, //Skip on Assert
+ DEASSERT, //Skip on Deassert
+};
+
struct Values
{
+ SkipAssertion skip;
Value assert;
Value deassert;
};
OpenPOWER on IntegriCloud