97 lines
3.3 KiB
Diff
97 lines
3.3 KiB
Diff
|
|
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
|
||
|
|
index 20f9847..9d13fd0 100644
|
||
|
|
--- a/include/ipmid/utils.hpp
|
||
|
|
+++ b/include/ipmid/utils.hpp
|
||
|
|
@@ -464,4 +464,10 @@ void callDbusMethod(sdbusplus::bus_t& bus, const std::string& service,
|
||
|
|
ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t slaveAddr,
|
||
|
|
std::vector<uint8_t> writeData,
|
||
|
|
std::vector<uint8_t>& readBuf);
|
||
|
|
+
|
||
|
|
+/** @brief Get board object path from DBUS object_mapper
|
||
|
|
+ * @param[in] bus - DBUS Bus Object.
|
||
|
|
+ * @return - string value of board object path
|
||
|
|
+ */
|
||
|
|
+std::string getBoardObjectPath(sdbusplus::bus::bus& bus);
|
||
|
|
} // namespace ipmi
|
||
|
|
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
|
||
|
|
index 1261c2e..64a00d2 100644
|
||
|
|
--- a/libipmid/utils.cpp
|
||
|
|
+++ b/libipmid/utils.cpp
|
||
|
|
@@ -319,6 +319,36 @@ ObjectTree getAllAncestors(sdbusplus::bus_t& bus, const std::string& path,
|
||
|
|
|
||
|
|
return objectTree;
|
||
|
|
}
|
||
|
|
+std::string getBoardObjectPath(sdbusplus::bus::bus& bus)
|
||
|
|
+{
|
||
|
|
+ std::vector<std::string> paths;
|
||
|
|
+
|
||
|
|
+ auto method = bus.new_method_call(MAPPER_BUS_NAME, MAPPER_OBJ, MAPPER_INTF,
|
||
|
|
+ "GetSubTreePaths");
|
||
|
|
+ method.append("/xyz/openbmc_project/inventory/system/board");
|
||
|
|
+ method.append(0); // Depth 0 to search all
|
||
|
|
+ method.append(
|
||
|
|
+ std::vector<std::string>({"xyz.openbmc_project.Inventory.Item.Board"}));
|
||
|
|
+
|
||
|
|
+ try
|
||
|
|
+ {
|
||
|
|
+ auto reply = bus.call(method);
|
||
|
|
+ reply.read(paths);
|
||
|
|
+ }
|
||
|
|
+ catch (const sdbusplus::exception::exception& e)
|
||
|
|
+ {
|
||
|
|
+ log<level::ERR>("Error get board object path ",
|
||
|
|
+ entry("ERROR=%s", e.what()));
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
+ if (paths.empty())
|
||
|
|
+ {
|
||
|
|
+ log<level::ERR>("Error board object path is EMPTY");
|
||
|
|
+ return "";
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
+ return paths[0];
|
||
|
|
+}
|
||
|
|
|
||
|
|
namespace method_no_args
|
||
|
|
{
|
||
|
|
diff --git a/storagehandler.cpp b/storagehandler.cpp
|
||
|
|
index cf5ef5e..405a8a1 100644
|
||
|
|
--- a/storagehandler.cpp
|
||
|
|
+++ b/storagehandler.cpp
|
||
|
|
@@ -79,6 +79,7 @@ std::unique_ptr<sdbusplus::bus::match_t> selRemovedMatch
|
||
|
|
__attribute__((init_priority(101)));
|
||
|
|
std::unique_ptr<sdbusplus::bus::match_t> selUpdatedMatch
|
||
|
|
__attribute__((init_priority(101)));
|
||
|
|
+std::string boardObjectPath __attribute__((init_priority(101)));
|
||
|
|
|
||
|
|
static inline uint16_t getLoggingId(const std::string& p)
|
||
|
|
{
|
||
|
|
@@ -532,6 +533,27 @@ ipmi::RspType<uint8_t // erase status
|
||
|
|
return ipmi::responseUnspecifiedError();
|
||
|
|
}
|
||
|
|
|
||
|
|
+ if (boardObjectPath.empty())
|
||
|
|
+ {
|
||
|
|
+ boardObjectPath = ipmi::getBoardObjectPath(bus);
|
||
|
|
+ }
|
||
|
|
+ if (boardObjectPath.empty())
|
||
|
|
+ {
|
||
|
|
+ // Still empty, fail to add sel for clear SEL event
|
||
|
|
+ log<level::ERR>("Failed to get board object path");
|
||
|
|
+ return ipmi::responseUnspecifiedError();
|
||
|
|
+ }
|
||
|
|
+ std::string dbusIntfPath = boardObjectPath + "/Event_Log";
|
||
|
|
+ constexpr auto selSystemType = 0x02;
|
||
|
|
+ constexpr uint16_t genId = 0x0020;
|
||
|
|
+ constexpr std::array<uint8_t, 3> eventData = {0x02, 0x00, 0x00};
|
||
|
|
+ constexpr bool assert = true;
|
||
|
|
+ auto selDataStr = ipmi::sel::toHexStr(eventData);
|
||
|
|
+ report<SELCreated>(
|
||
|
|
+ Created::RECORD_TYPE(selSystemType), Created::GENERATOR_ID(genId),
|
||
|
|
+ Created::SENSOR_DATA(selDataStr.c_str()), Created::EVENT_DIR(assert),
|
||
|
|
+ Created::SENSOR_PATH(dbusIntfPath.c_str()));
|
||
|
|
+
|
||
|
|
return ipmi::responseSuccess(
|
||
|
|
static_cast<uint8_t>(ipmi::sel::eraseComplete));
|
||
|
|
}
|