oem-ibm: Real SAI sensor and effecter PDR support
Real SAI (Sysytem Attention Indicator) is a physical led
indicator which lights up whenever there is a platform
error (originated from BMC) or a partition error
(originated from remote terminus) that is not mapped to
any physical FRU (Field Replaceable Unit)
Real SAI scenarios
1. Real SAI effecter can be turned off by the user OR by a
remote terminus
2. Real SAI sensor is turned on if any of the partition SAI
OR platform SAI is turned on
3. Real SAI is turned off if both partition and platform SAI
are turned off
4. SAI data should be synced to remote terminus
Tested By:
Verified the sensor values with the dbus property changes.
Also executed the effecter operation to clear the Real SAI
state.
oem-ibm flag:
Change successfully built with oem-ibm as disabled
Change-Id: Ia31a9104589acdc08dc42b51082c8103b1d92754
Signed-off-by: Jayashankar Padath <jayashankarpadath@gmail.com>
diff --git a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Bonnell/4.json b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Bonnell/4.json
index 363afb8..1ff30c0 100644
--- a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Bonnell/4.json
+++ b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Bonnell/4.json
@@ -28,28 +28,6 @@
]
},
{
- "type": 24581,
- "instance": 1,
- "container": 1,
- "parent_entity_path": "/xyz/openbmc_project/inventory/system",
- "sensors": [
- {
- "set": {
- "id": 10,
- "size": 1,
- "states": [1, 2]
- },
- "dbus": {
- "path": "/xyz/openbmc_project/inventory/system",
- "interface": "xyz.openbmc_project.State.Decorator.OperationalStatus",
- "property_name": "Functional",
- "property_type": "bool",
- "property_values": [true, false]
- }
- }
- ]
- },
- {
"entity_path": "/xyz/openbmc_project/inventory/system/chassis/motherboard/base_op_panel_blyth",
"sensors": [
{
diff --git a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Everest/4.json b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Everest/4.json
index fd253db..6a2e23d 100644
--- a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Everest/4.json
+++ b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Everest/4.json
@@ -28,28 +28,6 @@
]
},
{
- "type": 24581,
- "instance": 1,
- "container": 1,
- "parent_entity_path": "/xyz/openbmc_project/inventory/system",
- "sensors": [
- {
- "set": {
- "id": 10,
- "size": 1,
- "states": [1, 2]
- },
- "dbus": {
- "path": "/xyz/openbmc_project/inventory/system",
- "interface": "xyz.openbmc_project.State.Decorator.OperationalStatus",
- "property_name": "Functional",
- "property_type": "bool",
- "property_values": [true, false]
- }
- }
- ]
- },
- {
"entity_path": "/xyz/openbmc_project/inventory/system/chassis/motherboard/bmc",
"sensors": [
{
diff --git a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier1S4U/4.json b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier1S4U/4.json
index 9c1d09c..044bb06 100644
--- a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier1S4U/4.json
+++ b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier1S4U/4.json
@@ -28,28 +28,6 @@
]
},
{
- "type": 24581,
- "instance": 1,
- "container": 1,
- "parent_entity_path": "/xyz/openbmc_project/inventory/system",
- "sensors": [
- {
- "set": {
- "id": 10,
- "size": 1,
- "states": [1, 2]
- },
- "dbus": {
- "path": "/xyz/openbmc_project/inventory/system",
- "interface": "xyz.openbmc_project.State.Decorator.OperationalStatus",
- "property_name": "Functional",
- "property_type": "bool",
- "property_values": [true, false]
- }
- }
- ]
- },
- {
"entity_path": "/xyz/openbmc_project/inventory/system/chassis/motherboard/base_op_panel_blyth",
"sensors": [
{
diff --git a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier2U/4.json b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier2U/4.json
index 74057dc..99285a4 100644
--- a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier2U/4.json
+++ b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier2U/4.json
@@ -28,28 +28,6 @@
]
},
{
- "type": 24581,
- "instance": 1,
- "container": 1,
- "parent_entity_path": "/xyz/openbmc_project/inventory/system",
- "sensors": [
- {
- "set": {
- "id": 10,
- "size": 1,
- "states": [1, 2]
- },
- "dbus": {
- "path": "/xyz/openbmc_project/inventory/system",
- "interface": "xyz.openbmc_project.State.Decorator.OperationalStatus",
- "property_name": "Functional",
- "property_type": "bool",
- "property_values": [true, false]
- }
- }
- ]
- },
- {
"entity_path": "/xyz/openbmc_project/inventory/system/chassis/motherboard/base_op_panel_blyth",
"sensors": [
{
diff --git a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier4U/4.json b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier4U/4.json
index 36e24bb..7fc8d4c 100644
--- a/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier4U/4.json
+++ b/configurations/pdr/com.ibm.Hardware.Chassis.Model.Rainier4U/4.json
@@ -28,28 +28,6 @@
]
},
{
- "type": 24581,
- "instance": 1,
- "container": 1,
- "parent_entity_path": "/xyz/openbmc_project/inventory/system",
- "sensors": [
- {
- "set": {
- "id": 10,
- "size": 1,
- "states": [1, 2]
- },
- "dbus": {
- "path": "/xyz/openbmc_project/inventory/system",
- "interface": "xyz.openbmc_project.State.Decorator.OperationalStatus",
- "property_name": "Functional",
- "property_type": "bool",
- "property_values": [true, false]
- }
- }
- ]
- },
- {
"entity_path": "/xyz/openbmc_project/inventory/system/chassis/motherboard/base_op_panel_blyth",
"sensors": [
{
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index 2a3b0b7..2424efe 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -38,6 +38,7 @@
for (size_t i = 0; i < compSensorCnt; i++)
{
uint8_t sensorOpState{};
+ uint8_t presentState = PLDM_SENSOR_UNKNOWN;
if (entityType == PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE &&
stateSetId == PLDM_OEM_IBM_BOOT_STATE)
{
@@ -57,12 +58,18 @@
}
}
}
+ else if (entityType == PLDM_OEM_IBM_ENTITY_REAL_SAI &&
+ stateSetId == PLDM_STATE_SET_OPERATIONAL_FAULT_STATUS)
+ {
+ sensorOpState = fetchRealSAIStatus();
+ presentState = PLDM_SENSOR_NORMAL;
+ }
else
{
rc = PLDM_PLATFORM_INVALID_STATE_VALUE;
break;
}
- stateField.push_back({PLDM_SENSOR_ENABLED, PLDM_SENSOR_UNKNOWN,
+ stateField.push_back({PLDM_SENSOR_ENABLED, presentState,
PLDM_SENSOR_UNKNOWN, sensorOpState});
}
return rc;
@@ -174,6 +181,11 @@
codeUpdate->processRenameEvent();
}
}
+ else if (entityType == PLDM_OEM_IBM_ENTITY_REAL_SAI &&
+ stateSetId == PLDM_STATE_SET_OPERATIONAL_FAULT_STATUS)
+ {
+ turnOffRealSAIEffecter();
+ }
else
{
rc = PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE;
@@ -415,6 +427,103 @@
}
}
+void buildAllRealSAIEffecterPDR(oem_ibm_platform::Handler* platformHandler,
+ uint16_t entityType, uint16_t entityInstance,
+ pdr_utils::Repo& repo)
+
+{
+ size_t pdrSize = 0;
+ pdrSize = sizeof(pldm_state_effecter_pdr) +
+ sizeof(state_effecter_possible_states);
+ std::vector<uint8_t> entry{};
+ entry.resize(pdrSize);
+ pldm_state_effecter_pdr* pdr =
+ reinterpret_cast<pldm_state_effecter_pdr*>(entry.data());
+ if (!pdr)
+ {
+ error("Failed to get Real SAI effecter PDR record due to the "
+ "error {ERR_CODE}",
+ "ERR_CODE", lg2::hex,
+ static_cast<unsigned>(PLDM_PLATFORM_INVALID_EFFECTER_ID));
+ return;
+ }
+ pdr->hdr.record_handle = 0;
+ pdr->hdr.version = 1;
+ pdr->hdr.type = PLDM_STATE_EFFECTER_PDR;
+ pdr->hdr.record_change_num = 0;
+ pdr->hdr.length = sizeof(pldm_state_effecter_pdr) - sizeof(pldm_pdr_hdr);
+ pdr->terminus_handle = TERMINUS_HANDLE;
+ pdr->effecter_id = platformHandler->getNextEffecterId();
+ pdr->entity_type = entityType;
+ pdr->entity_instance = entityInstance;
+ pdr->container_id = 1;
+ pdr->effecter_semantic_id = 0;
+ pdr->effecter_init = PLDM_NO_INIT;
+ pdr->has_description_pdr = false;
+ pdr->composite_effecter_count = 1;
+
+ auto* possibleStatesPtr = pdr->possible_states;
+ auto possibleStates =
+ reinterpret_cast<state_effecter_possible_states*>(possibleStatesPtr);
+ possibleStates->state_set_id = PLDM_STATE_SET_OPERATIONAL_FAULT_STATUS;
+ possibleStates->possible_states_size = 1;
+ auto state =
+ reinterpret_cast<state_effecter_possible_states*>(possibleStates);
+ state->states[0].byte = 2;
+ pldm::responder::pdr_utils::PdrEntry pdrEntry{};
+ pdrEntry.data = entry.data();
+ pdrEntry.size = pdrSize;
+ repo.addRecord(pdrEntry);
+}
+
+void buildAllRealSAISensorPDR(oem_ibm_platform::Handler* platformHandler,
+ uint16_t entityType, uint16_t entityInstance,
+ pdr_utils::Repo& repo)
+
+{
+ size_t pdrSize = 0;
+ pdrSize = sizeof(pldm_state_sensor_pdr) +
+ sizeof(state_sensor_possible_states);
+ std::vector<uint8_t> entry{};
+ entry.resize(pdrSize);
+ pldm_state_sensor_pdr* pdr =
+ reinterpret_cast<pldm_state_sensor_pdr*>(entry.data());
+ if (!pdr)
+ {
+ error("Failed to get Real SAI sensor PDR record due to the "
+ "error {ERR_CODE}",
+ "ERR_CODE", lg2::hex,
+ static_cast<unsigned>(PLDM_PLATFORM_INVALID_SENSOR_ID));
+ return;
+ }
+ pdr->hdr.record_handle = 0;
+ pdr->hdr.version = 1;
+ pdr->hdr.type = PLDM_STATE_SENSOR_PDR;
+ pdr->hdr.record_change_num = 0;
+ pdr->hdr.length = sizeof(pldm_state_sensor_pdr) - sizeof(pldm_pdr_hdr);
+ pdr->terminus_handle = TERMINUS_HANDLE;
+ pdr->sensor_id = platformHandler->getNextSensorId();
+ pdr->entity_type = entityType;
+ pdr->entity_instance = entityInstance;
+ pdr->container_id = 1;
+ pdr->sensor_init = PLDM_NO_INIT;
+ pdr->sensor_auxiliary_names_pdr = false;
+ pdr->composite_sensor_count = 1;
+
+ auto* possibleStatesPtr = pdr->possible_states;
+ auto possibleStates =
+ reinterpret_cast<state_sensor_possible_states*>(possibleStatesPtr);
+ possibleStates->state_set_id = PLDM_STATE_SET_OPERATIONAL_FAULT_STATUS;
+ possibleStates->possible_states_size = 2;
+ auto state =
+ reinterpret_cast<state_sensor_possible_states*>(possibleStates);
+ state->states[0].byte = 6;
+ pldm::responder::pdr_utils::PdrEntry pdrEntry{};
+ pdrEntry.data = entry.data();
+ pdrEntry.size = pdrSize;
+ repo.addRecord(pdrEntry);
+}
+
void pldm::responder::oem_ibm_platform::Handler::buildOEMPDR(
pdr_utils::Repo& repo)
{
@@ -436,6 +545,10 @@
"xyz.openbmc_project.Inventory.Item.PCIeSlot"};
auto slotPaths = dBusIntf->getSubTreePaths(objectPath, 0, slotInterface);
buildAllSlotEnableEffecterPDR(this, repo, slotPaths);
+
+ buildAllRealSAIEffecterPDR(this, PLDM_OEM_IBM_ENTITY_REAL_SAI,
+ ENTITY_INSTANCE_1, repo);
+
buildAllSlotEnableSensorPDR(this, repo, slotPaths);
buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
@@ -453,6 +566,13 @@
buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
ENTITY_INSTANCE_0,
PLDM_OEM_IBM_BOOT_SIDE_RENAME, repo);
+ buildAllRealSAISensorPDR(this, PLDM_OEM_IBM_ENTITY_REAL_SAI,
+ ENTITY_INSTANCE_1, repo);
+
+ realSAISensorId = findStateSensorId(
+ repo.getPdr(), 0, PLDM_OEM_IBM_ENTITY_REAL_SAI, ENTITY_INSTANCE_1, 1,
+ PLDM_STATE_SET_OPERATIONAL_FAULT_STATUS);
+
auto sensorId = findStateSensorId(
repo.getPdr(), 0, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
ENTITY_INSTANCE_0, 1, PLDM_OEM_IBM_VERIFICATION_STATE);
@@ -948,6 +1068,68 @@
}
}
+void pldm::responder::oem_ibm_platform::Handler::turnOffRealSAIEffecter()
+{
+ try
+ {
+ pldm::utils::DBusMapping dbusPartitionMapping{
+ "/xyz/openbmc_project/led/groups/partition_system_attention_indicator",
+ "xyz.openbmc_project.Led.Group", "Asserted", "bool"};
+ pldm::utils::DBusHandler().setDbusProperty(dbusPartitionMapping, false);
+ }
+ catch (const std::exception& e)
+ {
+ error("Turn off of partition SAI effecter failed with "
+ "error:{ERR_EXCEP}",
+ "ERR_EXCEP", e);
+ }
+ try
+ {
+ pldm::utils::DBusMapping dbusPlatformMapping{
+ "/xyz/openbmc_project/led/groups/platform_system_attention_indicator",
+ "xyz.openbmc_project.Led.Group", "Asserted", "bool"};
+ pldm::utils::DBusHandler().setDbusProperty(dbusPlatformMapping, false);
+ }
+ catch (const std::exception& e)
+ {
+ error("Turn off of platform SAI effecter failed with "
+ "error:{ERR_EXCEP}",
+ "ERR_EXCEP", e);
+ }
+}
+
+uint8_t pldm::responder::oem_ibm_platform::Handler::fetchRealSAIStatus()
+{
+ try
+ {
+ auto isPartitionSAIOn = pldm::utils::DBusHandler().getDbusProperty<bool>(
+ "/xyz/openbmc_project/led/groups/partition_system_attention_indicator",
+ "Asserted", "xyz.openbmc_project.Led.Group");
+ auto isPlatformSAIOn = pldm::utils::DBusHandler().getDbusProperty<bool>(
+ "/xyz/openbmc_project/led/groups/platform_system_attention_indicator",
+ "Asserted", "xyz.openbmc_project.Led.Group");
+
+ if (isPartitionSAIOn || isPlatformSAIOn)
+ {
+ return PLDM_SENSOR_WARNING;
+ }
+ }
+ catch (const std::exception& e)
+ {
+ error("Fetching of Real SAI sensor status failed with "
+ "error:{ERR_EXCEP}",
+ "ERR_EXCEP", e);
+ }
+ return PLDM_SENSOR_NORMAL;
+}
+
+void pldm::responder::oem_ibm_platform::Handler::processSAIUpdate()
+{
+ auto realSAIState = fetchRealSAIStatus();
+ sendStateSensorEvent(realSAISensorId, PLDM_STATE_SENSOR_STATE, 0,
+ uint8_t(realSAIState), uint8_t(PLDM_SENSOR_UNKNOWN));
+}
+
} // namespace oem_ibm_platform
} // namespace responder
} // namespace pldm
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index f859c1b..13b3134 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -13,6 +13,7 @@
#include <libpldm/entity.h>
#include <libpldm/oem/ibm/state_set.h>
#include <libpldm/platform.h>
+#include <libpldm/state_set.h>
#include <sdbusplus/bus/match.hpp>
#include <sdeventplus/event.hpp>
@@ -158,6 +159,7 @@
}
}
});
+
updateBIOSMatch = std::make_unique<sdbusplus::bus::match_t>(
pldm::utils::DBusHandler::getBus(),
propertiesChanged("/xyz/openbmc_project/bios_config/manager",
@@ -191,6 +193,38 @@
}
}
});
+
+ platformSAIMatch = std::make_unique<sdbusplus::bus::match_t>(
+ pldm::utils::DBusHandler::getBus(),
+ propertiesChanged(
+ "/xyz/openbmc_project/led/groups/partition_system_attention_indicator",
+ "xyz.openbmc_project.Led.Group"),
+ [this](sdbusplus::message_t& msg) {
+ pldm::utils::DbusChangedProps props{};
+ std::string intf;
+ msg.read(intf, props);
+ const auto itr = props.find("Asserted");
+ if (itr != props.end())
+ {
+ processSAIUpdate();
+ }
+ });
+
+ partitionSAIMatch = std::make_unique<sdbusplus::bus::match_t>(
+ pldm::utils::DBusHandler::getBus(),
+ propertiesChanged(
+ "/xyz/openbmc_project/led/groups/platform_system_attention_indicator",
+ "xyz.openbmc_project.Led.Group"),
+ [this](sdbusplus::message_t& msg) {
+ pldm::utils::DbusChangedProps props{};
+ std::string intf;
+ msg.read(intf, props);
+ const auto itr = props.find("Asserted");
+ if (itr != props.end())
+ {
+ processSAIUpdate();
+ }
+ });
}
int getOemStateSensorReadingsHandler(
@@ -369,6 +403,19 @@
*/
void setBootTypesBiosAttr(const std::string& restartCause);
+ /** @brief To turn off Real SAI effecter*/
+ void turnOffRealSAIEffecter();
+
+ /** @brief Fetch Real SAI status based on the partition SAI and platform SAI
+ * sensor states. Real SAI is turned on if any of the partition or platform
+ * SAI turned on else Real SAI is turned off
+ * @return Real SAI sensor state PLDM_SENSOR_WARNING/PLDM_SENSOR_NORMAL
+ */
+ uint8_t fetchRealSAIStatus();
+
+ /** @brief Method to process virtual platform/partition SAI update*/
+ void processSAIUpdate();
+
~Handler() = default;
pldm::responder::CodeUpdate* codeUpdate; //!< pointer to CodeUpdate object
@@ -428,6 +475,15 @@
/** @brief Timer used for monitoring surveillance pings from host */
sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer;
+ /** @brief D-Bus Interface added signal match for virtual platform SAI */
+ std::unique_ptr<sdbusplus::bus::match_t> platformSAIMatch;
+
+ /** @brief D-Bus Interface added signal match for virtual partition SAI */
+ std::unique_ptr<sdbusplus::bus::match_t> partitionSAIMatch;
+
+ /** @brief Real SAI sensor id*/
+ uint16_t realSAISensorId;
+
bool hostOff = true;
bool hostTransitioningToOff;
diff --git a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
index ddce8dc..f99962f 100644
--- a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
+++ b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
@@ -329,6 +329,33 @@
bf3.byte = 126;
ASSERT_EQ(states->states[0].byte, bf3.byte);
+ // Test for effecter number 5, to turn off Real SAI led
+ auto record4 = pdr::getRecordByHandle(inRepo, 5, e);
+ ASSERT_NE(record4, nullptr);
+
+ pdr = reinterpret_cast<pldm_state_effecter_pdr*>(e.data);
+
+ ASSERT_EQ(pdr->hdr.record_handle, 5);
+ ASSERT_EQ(pdr->hdr.version, 1);
+ ASSERT_EQ(pdr->hdr.type, PLDM_STATE_EFFECTER_PDR);
+ ASSERT_EQ(pdr->hdr.record_change_num, 0);
+ ASSERT_EQ(pdr->hdr.length, 16);
+ ASSERT_EQ(pdr->terminus_handle, TERMINUS_HANDLE);
+ ASSERT_EQ(pdr->entity_type, PLDM_OEM_IBM_ENTITY_REAL_SAI);
+ ASSERT_EQ(pdr->entity_instance, 1);
+ ASSERT_EQ(pdr->container_id, 1);
+ ASSERT_EQ(pdr->effecter_semantic_id, 0);
+ ASSERT_EQ(pdr->effecter_init, PLDM_NO_INIT);
+ ASSERT_EQ(pdr->has_description_pdr, false);
+ ASSERT_EQ(pdr->composite_effecter_count, 1);
+ states =
+ reinterpret_cast<state_effecter_possible_states*>(pdr->possible_states);
+ ASSERT_EQ(states->state_set_id, PLDM_STATE_SET_OPERATIONAL_FAULT_STATUS);
+ ASSERT_EQ(states->possible_states_size, 1);
+ bitfield8_t bf4{};
+ bf4.byte = 2;
+ ASSERT_EQ(states->states[0].byte, bf4.byte);
+
pldm_pdr_destroy(inPDRRepo);
}
@@ -356,13 +383,13 @@
pdr_utils::PdrEntry e;
// Test for sensor number 1, for current boot side state
- auto record1 = pdr::getRecordByHandle(inRepo, 5, e);
+ auto record1 = pdr::getRecordByHandle(inRepo, 6, e);
ASSERT_NE(record1, nullptr);
pldm_state_sensor_pdr* pdr =
reinterpret_cast<pldm_state_sensor_pdr*>(e.data);
- ASSERT_EQ(pdr->hdr.record_handle, 5);
+ ASSERT_EQ(pdr->hdr.record_handle, 6);
ASSERT_EQ(pdr->hdr.version, 1);
ASSERT_EQ(pdr->hdr.type, PLDM_STATE_SENSOR_PDR);
ASSERT_EQ(pdr->hdr.record_change_num, 0);
@@ -383,12 +410,12 @@
ASSERT_EQ(states->states[0].byte, bf1.byte);
// Test for sensor number 2, for next boot side state
- auto record2 = pdr::getRecordByHandle(inRepo, 6, e);
+ auto record2 = pdr::getRecordByHandle(inRepo, 7, e);
ASSERT_NE(record2, nullptr);
pdr = reinterpret_cast<pldm_state_sensor_pdr*>(e.data);
- ASSERT_EQ(pdr->hdr.record_handle, 6);
+ ASSERT_EQ(pdr->hdr.record_handle, 7);
ASSERT_EQ(pdr->hdr.version, 1);
ASSERT_EQ(pdr->hdr.type, PLDM_STATE_SENSOR_PDR);
ASSERT_EQ(pdr->hdr.record_change_num, 0);
@@ -409,12 +436,12 @@
ASSERT_EQ(states->states[0].byte, bf2.byte);
// Test for sensor number 3, for firmware update state control
- auto record3 = pdr::getRecordByHandle(inRepo, 7, e);
+ auto record3 = pdr::getRecordByHandle(inRepo, 8, e);
ASSERT_NE(record3, nullptr);
pdr = reinterpret_cast<pldm_state_sensor_pdr*>(e.data);
- ASSERT_EQ(pdr->hdr.record_handle, 7);
+ ASSERT_EQ(pdr->hdr.record_handle, 8);
ASSERT_EQ(pdr->hdr.version, 1);
ASSERT_EQ(pdr->hdr.type, PLDM_STATE_SENSOR_PDR);
ASSERT_EQ(pdr->hdr.record_change_num, 0);
@@ -434,6 +461,32 @@
bf3.byte = 126;
ASSERT_EQ(states->states[0].byte, bf3.byte);
+ // Test for sensor number 6, for Real SAI sensor states
+ auto record4 = pdr::getRecordByHandle(inRepo, 11, e);
+ ASSERT_NE(record4, nullptr);
+
+ pdr = reinterpret_cast<pldm_state_sensor_pdr*>(e.data);
+
+ ASSERT_EQ(pdr->hdr.record_handle, 11);
+ ASSERT_EQ(pdr->hdr.version, 1);
+ ASSERT_EQ(pdr->hdr.type, PLDM_STATE_SENSOR_PDR);
+ ASSERT_EQ(pdr->hdr.record_change_num, 0);
+ ASSERT_EQ(pdr->hdr.length, 14);
+ ASSERT_EQ(pdr->terminus_handle, TERMINUS_HANDLE);
+ ASSERT_EQ(pdr->entity_type, PLDM_OEM_IBM_ENTITY_REAL_SAI);
+ ASSERT_EQ(pdr->entity_instance, 1);
+ ASSERT_EQ(pdr->container_id, 1);
+ ASSERT_EQ(pdr->sensor_init, PLDM_NO_INIT);
+ ASSERT_EQ(pdr->sensor_auxiliary_names_pdr, false);
+ ASSERT_EQ(pdr->composite_sensor_count, 1);
+ states =
+ reinterpret_cast<state_sensor_possible_states*>(pdr->possible_states);
+ ASSERT_EQ(states->state_set_id, PLDM_STATE_SET_OPERATIONAL_FAULT_STATUS);
+ ASSERT_EQ(states->possible_states_size, 2);
+ bitfield8_t bf4{};
+ bf4.byte = 6;
+ ASSERT_EQ(states->states[0].byte, bf4.byte);
+
pldm_pdr_destroy(inPDRRepo);
}
diff --git a/pldmtool/oem/ibm/oem_ibm_state_set.hpp b/pldmtool/oem/ibm/oem_ibm_state_set.hpp
index b467b35..5de0c83 100644
--- a/pldmtool/oem/ibm/oem_ibm_state_set.hpp
+++ b/pldmtool/oem/ibm/oem_ibm_state_set.hpp
@@ -47,7 +47,9 @@
*/
extern const std::map<uint8_t, std::string> OemIBMEntityType{
{PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, "OEM IBM Firmware Update"},
- {PLDM_OEM_IBM_ENTITY_TPM, "OEM IBM Trusted Platform Module"}};
+ {PLDM_OEM_IBM_ENTITY_TPM, "OEM IBM Trusted Platform Module"},
+ {PLDM_OEM_IBM_ENTITY_REAL_SAI, "OEM IBM Real SAI"},
+};
/** @brief Map for PLDM OEM IBM State Sets
*/