openpower-pels: Create guard using libguard
Replace CreateWithEntityPath D-Bus method with guard library calls for
creating guard entries, as CreateWithEntityPath is not an approved dbus
method.
Tested and the guard record is created with the corresponding PEL id
```
before injecting the error
root@p10bmc:~# guard -l
No unresolved records to display
After injecting error, the guard is created using the PEL ID
root@p10bmc:~# guard -l
ID | ERROR | Type | Path
0x00000001 | 0x5000592b | unrecoverable | physical:sys-0/node-0/proc-0/eq-1/fc-0/core-0
root@p10bmc:~# peltool -l
{
"0x5000592B": {
"SRC": "BD13E510",
"Message": "Error Signature: 0x20DA0020 0x00000001 0x4D740407",
"PLID": "0x5000592B",
"CreatorID": "BMC",
"Subsystem": "Processor Unit (CPU)",
"Commit Time": "10/17/2024 09:54:22",
"Sev": "Unrecoverable Error",
"CompID": "bmc hw diags"
}
}
```
Change-Id: I7531bce403206beaa119aea0a621e6b47d28ffd0
Signed-off-by: deepakala-k <deepakala.karthikeyan@ibm.com>
diff --git a/extensions/openpower-pels/data_interface.hpp b/extensions/openpower-pels/data_interface.hpp
index 93a0e47..bdf93c1 100644
--- a/extensions/openpower-pels/data_interface.hpp
+++ b/extensions/openpower-pels/data_interface.hpp
@@ -3,6 +3,11 @@
#include "dbus_types.hpp"
#include "dbus_watcher.hpp"
+#ifdef PEL_ENABLE_PHAL
+#include <libguard/guard_interface.hpp>
+#include <libguard/include/guard_record.hpp>
+#endif
+
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
@@ -12,6 +17,11 @@
#include <fstream>
#include <unordered_map>
+#ifdef PEL_ENABLE_PHAL
+using GardType = openpower::guard::GardType;
+namespace libguard = openpower::guard;
+#endif
+
namespace openpower
{
namespace pels
@@ -443,16 +453,17 @@
static std::pair<std::string, std::string>
extractConnectorFromLocCode(const std::string& locationCode);
+#ifdef PEL_ENABLE_PHAL
/**
* @brief Create guard record
*
* @param[in] binPath: phal devtree binary path used as key
- * @param[in] type: Guard type
- * @param[in] logPath: error log entry object path
+ * @param[in] eGardType: Guard type enum value
+ * @param[in] plid: Pel ID
*/
virtual void createGuardRecord(const std::vector<uint8_t>& binPath,
- const std::string& type,
- const std::string& logPath) const = 0;
+ GardType eGardType, uint32_t plid) const = 0;
+#endif
/**
* @brief Create Progress SRC property on the boot progress
@@ -856,16 +867,17 @@
*/
bool getQuiesceOnError() const override;
+#ifdef PEL_ENABLE_PHAL
/**
* @brief Create guard record
*
* @param[in] binPath: phal devtree binary path used as key
- * @param[in] type: Guard type
- * @param[in] logPath: error log entry object path
+ * @param[in] eGardType: Guard type enum value
+ * @param[in] plid: pel id to be associated to the guard record
*/
void createGuardRecord(const std::vector<uint8_t>& binPath,
- const std::string& type,
- const std::string& logPath) const override;
+ GardType eGardType, uint32_t plid) const override;
+#endif
/**
* @brief Create Progress SRC property on the boot progress