summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/log_id.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-07-10 16:54:13 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-07-26 13:43:04 -0500
commitdf13bdb6e1423b25e7b737f4bf431af3d5c08d8b (patch)
treef8b9d42b3c78d018e83a5b3fcb4014e57d690281 /extensions/openpower-pels/log_id.hpp
parent03c1d91559b3e9625d21ad96f93e2d8376cfa1d4 (diff)
downloadphosphor-logging-df13bdb6e1423b25e7b737f4bf431af3d5c08d8b.tar.gz
phosphor-logging-df13bdb6e1423b25e7b737f4bf431af3d5c08d8b.zip
PEL: Add function to generate unique PEL IDs
Create generatePELID() to return a unique 4B PEL ID every time it is called. It will start at a base value, and then increment by 1 each time. It uses a file to save the next value to use. This will be used by the PEL handling code to create unique values for the error log ID field in the Private Header section. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I841a8dcc5dc48e2b663004be3dccfb114ba366f2
Diffstat (limited to 'extensions/openpower-pels/log_id.hpp')
-rw-r--r--extensions/openpower-pels/log_id.hpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/extensions/openpower-pels/log_id.hpp b/extensions/openpower-pels/log_id.hpp
new file mode 100644
index 0000000..21f04eb
--- /dev/null
+++ b/extensions/openpower-pels/log_id.hpp
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <cstdint>
+
+namespace openpower
+{
+namespace pels
+{
+
+namespace detail
+{
+
+/**
+ * @brief Adds the 1 byte log creator prefix to the log ID
+ *
+ * @param[in] id - the ID to add it to
+ *
+ * @return - the full log ID
+ */
+uint32_t addLogIDPrefix(uint32_t id);
+
+/**
+ * @brief Generates a PEL ID based on the current time.
+ *
+ * Used for error scenarios where the normal method doesn't
+ * work in order to get a unique ID still.
+ *
+ * @return A unique log ID.
+ */
+uint32_t getTimeBasedLogID();
+
+} // namespace detail
+
+/**
+ * @brief Generates a unique PEL log entry ID every time
+ * it is called.
+ *
+ * This ID is used at offset 0x2C in the Private Header
+ * section of a PEL. For single BMC systems, it must
+ * start with 0x50.
+ *
+ * @return uint32_t - The log ID
+ */
+uint32_t generatePELID();
+
+} // namespace pels
+} // namespace openpower
OpenPOWER on IntegriCloud