Add support for Entity Association Record
Adding support for Entity Association Record (SDR type - 0x08h)
This patch includes:
1) Entity Association Record yaml file example
2) Entity Assocation Record related script and mako file changes
3) Adding Entity Association Record in get_sdr IPMI command response
From the host, tested that entity association records can be fetched
Change-Id: I9cf598e5d27d2e8c6751bbaae2176e7c976974b1
Tested: Yes
Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index 0338597..8fcf2b1 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -86,6 +86,7 @@
ipmi_context_t context);
static const uint16_t FRU_RECORD_ID_START = 256;
+static const uint16_t ENTITY_RECORD_ID_START = 512;
static const uint8_t SDR_VERSION = 0x51;
static const uint16_t END_OF_RECORD = 0xFFFF;
static const uint8_t LENGTH_MASK = 0x1F;
@@ -210,6 +211,7 @@
{
SENSOR_DATA_FULL_RECORD = 0x1,
SENSOR_DATA_FRU_RECORD = 0x11,
+ SENSOR_DATA_ENTITY_RECORD = 0x8,
};
// Record key
@@ -232,9 +234,25 @@
uint8_t channelNumber;
} __attribute__((packed));
+/** @struct SensorDataEntityRecordKey
+ *
+ * Entity Association Record(key) - SDR Type 8
+ */
+struct SensorDataEntityRecordKey
+{
+ uint8_t containerEntityId;
+ uint8_t containerEntityInstance;
+ uint8_t flags;
+ uint8_t entityId1;
+ uint8_t entityInstance1;
+} __attribute__((packed));
+
namespace key
{
+static constexpr uint8_t listOrRangeBit = 7;
+static constexpr uint8_t linkedBit = 6;
+
inline void set_owner_id_ipmb(SensorDataRecordKey* key)
{
key->owner_id &= ~0x01;
@@ -268,6 +286,17 @@
key->owner_lun |= ((channel & 0xf) << 4);
};
+inline void set_flags(bool isList, bool isLinked,
+ SensorDataEntityRecordKey* key)
+{
+ key->flags = 0x00;
+ if (!isList)
+ key->flags |= 1 << listOrRangeBit;
+
+ if (isLinked)
+ key->flags |= 1 << linkedBit;
+};
+
} // namespace key
/** @struct GetSensorThresholdsResponse
@@ -347,6 +376,20 @@
char deviceID[FRU_RECORD_DEVICE_ID_MAX_LENGTH];
} __attribute__((packed));
+/** @struct SensorDataEntityRecordBody
+ *
+ * Entity Association Record(body) - SDR Type 8
+ */
+struct SensorDataEntityRecordBody
+{
+ uint8_t entityId2;
+ uint8_t entityInstance2;
+ uint8_t entityId3;
+ uint8_t entityInstance3;
+ uint8_t entityId4;
+ uint8_t entityInstance4;
+} __attribute__((packed));
+
namespace body
{
@@ -594,6 +637,17 @@
SensorDataFruRecordBody body;
} __attribute__((packed));
+/** @struct SensorDataEntityRecord
+ *
+ * Entity Association Record - SDR Type 8
+ */
+struct SensorDataEntityRecord
+{
+ SensorDataRecordHeader header;
+ SensorDataEntityRecordKey key;
+ SensorDataEntityRecordBody body;
+} __attribute__((packed));
+
} // namespace get_sdr
namespace ipmi