summaryrefslogtreecommitdiffstats
path: root/test/openpower-pels/pel_utils.cpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-07-10 14:12:15 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-07-26 13:42:59 -0500
commit03c1d91559b3e9625d21ad96f93e2d8376cfa1d4 (patch)
treee8c690deb175b734984edacf43b1101e10fb97dd /test/openpower-pels/pel_utils.cpp
parentd3335dfa7a13d94d6aca0d77b62f163e9babee05 (diff)
downloadphosphor-logging-03c1d91559b3e9625d21ad96f93e2d8376cfa1d4.tar.gz
phosphor-logging-03c1d91559b3e9625d21ad96f93e2d8376cfa1d4.zip
PEL: Add UserHeader class
The second section in a PEL is always the 'User Header' section. This commit adds a class to represent that. Right now, the only constructor available is filling in its data fields from a PEL stream. Several of the fields in this section have predefined values that are defined by the PEL specification. Defining any constants or enums for those will be left to future commits where they will actually be used. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I8b5f856a4284d44c31b04e98a664f20cd8fa0cb6
Diffstat (limited to 'test/openpower-pels/pel_utils.cpp')
-rw-r--r--test/openpower-pels/pel_utils.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/openpower-pels/pel_utils.cpp b/test/openpower-pels/pel_utils.cpp
index 4e4c32a..b6714eb 100644
--- a/test/openpower-pels/pel_utils.cpp
+++ b/test/openpower-pels/pel_utils.cpp
@@ -1,6 +1,7 @@
#include "pel_utils.hpp"
#include "extensions/openpower-pels/private_header.hpp"
+#include "extensions/openpower-pels/user_header.hpp"
#include <fstream>
@@ -26,8 +27,23 @@ constexpr uint8_t simplePEL[] = {
0x90, 0x91, 0x92, 0x93, // OpenBMC log ID
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, // creator version
0x50, 0x51, 0x52, 0x53, // plid
- 0x80, 0x81, 0x82, 0x83 // id
+ 0x80, 0x81, 0x82, 0x83, // id
+ // user header section header
+ 0x55, 0x48, // ID 'UH'
+ 0x00, 0x18, // Size
+ 0x01, 0x0A, // version, subtype
+ 0x0B, 0x0C, // comp ID
+
+ // user header
+ 0x10, 0x04, // subsystem, scope
+ 0x20, 0x00, // severity, type
+ 0x00, 0x00, 0x00, 0x00, // reserved
+ 0x03, 0x04, // problem domain, vector
+ 0x80, 0xC0, // action flags
+ 0x00, 0x00, 0x00, 0x00 // reserved
+
+ // Add more as the code supports more
};
std::unique_ptr<std::vector<uint8_t>> pelDataFactory(TestPelType type)
@@ -43,6 +59,12 @@ std::unique_ptr<std::vector<uint8_t>> pelDataFactory(TestPelType type)
data = std::make_unique<std::vector<uint8_t>>(
simplePEL, simplePEL + PrivateHeader::flattenedSize());
break;
+ case TestPelType::userHeaderSimple:
+ data = std::make_unique<std::vector<uint8_t>>(
+ simplePEL + PrivateHeader::flattenedSize(),
+ simplePEL + PrivateHeader::flattenedSize() +
+ UserHeader::flattenedSize());
+ break;
}
return data;
}
OpenPOWER on IntegriCloud