summaryrefslogtreecommitdiffstats
path: root/selutility.hpp
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-05-19 10:43:36 +0530
committerTom Joseph <tomjoseph@in.ibm.com>2017-07-08 09:04:32 +0530
commit6b7a14376a46e73b61df9c78771e2063bc0f4008 (patch)
treeddff9ddd5902f912b541e08fcab1918815fa073e /selutility.hpp
parenta62bacc534234558f54bf96f368b2b9574f0def1 (diff)
downloadphosphor-host-ipmid-6b7a14376a46e73b61df9c78771e2063bc0f4008.tar.gz
phosphor-host-ipmid-6b7a14376a46e73b61df9c78771e2063bc0f4008.zip
Create IPMI SEL record from Logging DBUS Entry
The Log Id, resolved field and the timestamp is read from the DBUS entry and mapped to the SEL record. The remaining fields are populated from the generated code which maps an association to the sensor number. Change-Id: I89c3862cf35efa1b9fb86de734431c8141143fb7 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'selutility.hpp')
-rw-r--r--selutility.hpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/selutility.hpp b/selutility.hpp
new file mode 100644
index 0000000..83ff0fd
--- /dev/null
+++ b/selutility.hpp
@@ -0,0 +1,66 @@
+#pragma once
+
+#include <cstdint>
+#include <sdbusplus/server.hpp>
+#include "types.hpp"
+
+namespace ipmi
+{
+
+namespace sel
+{
+
+static constexpr auto mapperBusName = "xyz.openbmc_project.ObjectMapper";
+static constexpr auto mapperObjPath = "/xyz/openbmc_project/object_mapper";
+static constexpr auto mapperIntf = "xyz.openbmc_project.ObjectMapper";
+
+static constexpr auto logBasePath = "/xyz/openbmc_project/logging/entry";
+static constexpr auto logEntryIntf = "xyz.openbmc_project.Logging.Entry";
+static constexpr auto logDeleteIntf = "xyz.openbmc_project.Object.Delete";
+
+static constexpr auto propIntf = "org.freedesktop.DBus.Properties";
+
+using PropertyType = sdbusplus::message::variant<bool, uint32_t, uint64_t,
+ std::string, std::vector<std::string>>;
+
+/** @struct GetSELEntryResponse
+ *
+ * IPMI payload for Get SEL Entry command response.
+ */
+struct GetSELEntryResponse
+{
+ uint16_t nextRecordID; //!< Next RecordID.
+ uint16_t recordID; //!< Record ID.
+ uint8_t recordType; //!< Record Type.
+ uint32_t timeStamp; //!< Timestamp.
+ uint16_t generatorID; //!< Generator ID.
+ uint8_t eventMsgRevision; //!< Event Message Revision.
+ uint8_t sensorType; //!< Sensor Type.
+ uint8_t sensorNum; //!< Sensor Number.
+ uint8_t eventType; //!< Event Dir | Event Type.
+ uint8_t eventData1; //!< Event Data 1.
+ uint8_t eventData2; //!< Event Data 2.
+ uint8_t eventData3; //!< Event Data 3.
+} __attribute__((packed));
+
+namespace internal
+{
+
+/** @brief Convert logging entry to SEL event record
+ *
+ * @param[in] objPath - DBUS object path of the logging entry.
+ * @param[in] iter - Iterator to the sensor data corresponding to the logging
+ * entry
+ *
+ * @return On success return the SEL event record, throw an exception in case
+ * of failure.
+ */
+GetSELEntryResponse prepareSELEntry(
+ const std::string& objPath,
+ ipmi::sensor::InvObjectIDMap::const_iterator iter);
+
+} //internal
+
+} // namespace sel
+
+} // namespace ipmi
OpenPOWER on IntegriCloud