summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/openpower-pels/pel_values.cpp9
-rw-r--r--extensions/openpower-pels/pel_values.hpp5
-rw-r--r--extensions/openpower-pels/private_header.cpp49
-rw-r--r--extensions/openpower-pels/private_header.hpp6
4 files changed, 68 insertions, 1 deletions
diff --git a/extensions/openpower-pels/pel_values.cpp b/extensions/openpower-pels/pel_values.cpp
index abf4653..775c0f5 100644
--- a/extensions/openpower-pels/pel_values.cpp
+++ b/extensions/openpower-pels/pel_values.cpp
@@ -230,6 +230,15 @@ const std::map<std::string, std::string> sectionTitles = {
{"ED", "Extended User Data"},
};
+/**
+ * @brief Map for creator IDs
+ */
+const std::map<std::string, std::string> creatorIDs = {
+
+ {"O", "BMC"}, {"C", "HMC"}, {"H", "PHYP"}, {"L", "Partition FW"},
+ {"S", "SLIC"}, {"B", "Hostboot"}, {"T", "OCC"}, {"M", "I/O Drawer"},
+ {"K", "Sapphire"}, {"P", "PowerNV"}};
+
} // namespace pel_values
} // namespace pels
} // namespace openpower
diff --git a/extensions/openpower-pels/pel_values.hpp b/extensions/openpower-pels/pel_values.hpp
index 49aa374..9d49dbe 100644
--- a/extensions/openpower-pels/pel_values.hpp
+++ b/extensions/openpower-pels/pel_values.hpp
@@ -82,6 +82,11 @@ extern const PELValues calloutPriorityValues;
*/
extern const std::map<std::string, std::string> sectionTitles;
+/**
+ * @brief Map for creator IDs
+ */
+extern const std::map<std::string, std::string> creatorIDs;
+
} // namespace pel_values
} // namespace pels
} // namespace openpower
diff --git a/extensions/openpower-pels/private_header.cpp b/extensions/openpower-pels/private_header.cpp
index 7ec87f3..2c1a860 100644
--- a/extensions/openpower-pels/private_header.cpp
+++ b/extensions/openpower-pels/private_header.cpp
@@ -17,6 +17,7 @@
#include "log_id.hpp"
#include "pel_types.hpp"
+#include "pel_values.hpp"
#include <phosphor-logging/log.hpp>
@@ -25,6 +26,7 @@ namespace openpower
namespace pels
{
+namespace pv = openpower::pels::pel_values;
using namespace phosphor::logging;
PrivateHeader::PrivateHeader(uint16_t componentID, uint32_t obmcLogID,
@@ -79,7 +81,52 @@ PrivateHeader::PrivateHeader(Stream& pel) :
_valid = false;
}
}
-
+std::optional<std::string> PrivateHeader::getJSON() const
+{
+ char tmpPhVal[50];
+ sprintf(tmpPhVal, "%02X/%02X/%02X%02X %02X:%02X:%02X",
+ _createTimestamp.month, _createTimestamp.day,
+ _createTimestamp.yearMSB, _createTimestamp.yearLSB,
+ _createTimestamp.hour, _createTimestamp.minutes,
+ _createTimestamp.seconds);
+ std::string phCreateTStr(tmpPhVal);
+ sprintf(tmpPhVal, "%02X/%02X/%02X%02X %02X:%02X:%02X",
+ _commitTimestamp.month, _commitTimestamp.day,
+ _createTimestamp.yearMSB, _commitTimestamp.yearLSB,
+ _commitTimestamp.hour, _commitTimestamp.minutes,
+ _commitTimestamp.seconds);
+ std::string phCommitTStr(tmpPhVal);
+ sprintf(tmpPhVal, "%c", _creatorID);
+ std::string creator(tmpPhVal);
+ creator = pv::creatorIDs.count(creator) ? pv::creatorIDs.at(creator)
+ : "Unknown CreatorID";
+ std::string phCreatorVersionStr =
+ std::string(reinterpret_cast<const char*>(_creatorVersion.version));
+
+ sprintf(tmpPhVal, "0x%X", _header.componentID);
+ std::string phCbStr(tmpPhVal);
+ sprintf(tmpPhVal, "%d", _header.subType);
+ std::string phStStr(tmpPhVal);
+ sprintf(tmpPhVal, "%d", privateHeaderVersion);
+ std::string phVerStr(tmpPhVal);
+ sprintf(tmpPhVal, "0x%X", _plid);
+ std::string phPlatformIDStr(tmpPhVal);
+ sprintf(tmpPhVal, "0x%X", _id);
+ std::string phLogEntryIDStr(tmpPhVal);
+ std::string ph = "{\"Section Version\": \"" + phVerStr +
+ "\"}, \n {\"Sub-section type\": \"" + phStStr +
+ "\"}, \n "
+ "{\"Log Committed by\": \"" +
+ phCbStr + "\"}, \n {\"Entry Creation\": \"" +
+ phCreateTStr + "\"}, \n {\"Entry Commit\": \"" +
+ phCommitTStr + "\"}, \n {\"Creator ID\": \"" + creator +
+ "\"}, \n {\"Creator Implementation\": \"" +
+ phCreatorVersionStr + "\"},\n {\"Platform Log ID\": \"" +
+ phPlatformIDStr + "\"},\n {\"Log Entry ID\": \"" +
+ phLogEntryIDStr + "\"}";
+
+ return ph;
+}
void PrivateHeader::validate()
{
bool failed = false;
diff --git a/extensions/openpower-pels/private_header.hpp b/extensions/openpower-pels/private_header.hpp
index 1302182..dd0d504 100644
--- a/extensions/openpower-pels/private_header.hpp
+++ b/extensions/openpower-pels/private_header.hpp
@@ -219,6 +219,12 @@ class PrivateHeader : public Section
sizeof(_creatorVersion) + sizeof(_plid) + sizeof(_id);
}
+ /**
+ * @brief Get section in JSON.
+ * @return std::optional<std::string> - Private header section's JSON
+ */
+ std::optional<std::string> getJSON() const override;
+
private:
/**
* @brief Fills in the object from the stream data
OpenPOWER on IntegriCloud