summaryrefslogtreecommitdiffstats
path: root/sensorhandler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'sensorhandler.hpp')
-rw-r--r--sensorhandler.hpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index 0338597..8fcf2b1 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -86,6 +86,7 @@ ipmi_ret_t ipmi_sen_reserve_sdr(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
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 @@ enum SensorDataRecordType
{
SENSOR_DATA_FULL_RECORD = 0x1,
SENSOR_DATA_FRU_RECORD = 0x11,
+ SENSOR_DATA_ENTITY_RECORD = 0x8,
};
// Record key
@@ -232,9 +234,25 @@ struct SensorDataFruRecordKey
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 @@ inline void set_owner_lun_channel(uint8_t channel, SensorDataRecordKey* key)
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 @@ struct SensorDataFruRecordBody
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 @@ struct SensorDataFruRecord
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
OpenPOWER on IntegriCloud