summaryrefslogtreecommitdiffstats
path: root/sensorhandler.hpp
diff options
context:
space:
mode:
authorJaghathiswari Rankappagounder Natarajan <jaghu@google.com>2019-02-12 13:22:55 -0800
committerJaghathiswari Rankappagounder Natarajan <jaghu@google.com>2019-02-15 21:48:56 +0000
commit9c11894eb919034fb7841520aea3f476783a85c6 (patch)
tree7d3b244ea082418317608fad7877de59bb549bb1 /sensorhandler.hpp
parent0780df105bdd00184de29f48e9946bebfc5b5fb2 (diff)
downloadphosphor-host-ipmid-9c11894eb919034fb7841520aea3f476783a85c6.tar.gz
phosphor-host-ipmid-9c11894eb919034fb7841520aea3f476783a85c6.zip
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>
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