PEL: Fixes for State.Boot.Raw Value updates
The first entry in the std::tuple of the Value property, which is used
to hold the 8 character SRC refcode, changed from a uint64_t to a
std::vector<uint8_t>. Make the necessary updates.
Tested:
Create a PEL with a severity value of 0x51 = critical system
termination. It has the refcode sent to this Value property:
```
$ busctl get-property xyz.openbmc_project.State.Boot.Raw \
/xyz/openbmc_project/state/boot/raw0 \
xyz.openbmc_project.State.Boot.Raw Value
(ayay)
8 49 49 48 48 50 54 48 50
^^ this is the correct 8 byte 11002602 refcode
and the rest is the 72 byte progress SRC:
72 2 9 0 9 0 0 0 188 0 0 0 85 46 45 0
16 0 0 0 0 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 49 48 48 50 54 48
50 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
```
And now create another PEL, and this progress SRC should be in the hex
words:
```
"Reference Code": "BD8D3601",
"Hex Word 2": "00000055",
"Hex Word 3": "2E2D0010",
"Hex Word 4": "11002602", <-------------------
"Hex Word 5": "00000000",
"Hex Word 6": "00000000",
"Hex Word 7": "00000000",
"Hex Word 8": "00000000",
"Hex Word 9": "00000000",
```
Change-Id: I8050eaf3e372b724fa41dc358633d4b3d29fc782
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index 2694499..7153c12 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -1012,6 +1012,9 @@
void Manager::updateProgressSRC(
std::unique_ptr<openpower::pels::PEL>& pel) const
{
+ const size_t refcodeBegin = 40;
+ const size_t refcodeSize = 8;
+
// Check for pel severity of type - 0x51 = critical error, system
// termination
if (pel->userHeader().severity() == 0x51)
@@ -1020,15 +1023,20 @@
if (src)
{
std::vector<uint8_t> asciiSRC = (*src)->getSrcStruct();
- uint64_t srcRefCode = 0;
- // Read bytes from offset [40-47] e.g. BD8D1001
- for (int i = 0; i < 8; i++)
+ if (asciiSRC.size() < (refcodeBegin + refcodeSize))
{
- srcRefCode |=
- (static_cast<uint64_t>(asciiSRC[40 + i]) << (8 * i));
+ lg2::error(
+ "SRC struct is too short to get progress code ({SIZE})",
+ "SIZE", asciiSRC.size());
+ return;
}
+ // Pull the ASCII SRC from offset [40-47] e.g. BD8D1001
+ std::vector<uint8_t> srcRefCode(
+ asciiSRC.begin() + refcodeBegin,
+ asciiSRC.begin() + refcodeBegin + refcodeSize);
+
try
{
_dataIface->createProgressSRC(srcRefCode, asciiSRC);