Change primary postcode interface to byte array
Test results:
```
root@bmc:~# busctl call xyz.openbmc_project.State.Boot.PostCode0 /xyz/openbmc_project/State/Boot/PostCode0 xyz.openbmc_project.State.Boot.PostCode GetPostCodes q 1 -j
{
"type" : "a(ayay)",
"data" : [
[
[
[
1,
2,
3,
4,
5,
6,
7,
8,
9
],
[]
],
[
[
17,
18,
19,
20,
21,
22,
23,
24,
25
],
[]
],
[
[
33,
34,
35,
36,
37,
38,
39,
40,
41
],
[]
]
]
]
}
```
Change-Id: I81387df590c2c6781451c6dbcc030d48ca011eb6
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/inc/post_code.hpp b/inc/post_code.hpp
index 26b5c48..db7533f 100644
--- a/inc/post_code.hpp
+++ b/inc/post_code.hpp
@@ -50,7 +50,7 @@
}
};
using EventPtr = std::unique_ptr<sd_event, EventDeleter>;
-using primarycode_t = uint64_t;
+using primarycode_t = std::vector<uint8_t>;
using secondarycode_t = std::vector<uint8_t>;
using postcode_t = std::tuple<primarycode_t, secondarycode_t>;
namespace fs = std::filesystem;
diff --git a/src/post_code.cpp b/src/post_code.cpp
index 037f293..6473562 100644
--- a/src/post_code.cpp
+++ b/src/post_code.cpp
@@ -119,16 +119,22 @@
POSTCODE_DISPLAY_PATH + std::to_string(node);
std::ofstream postCodeDisplayFile(postCodeDisplayPath);
- postCodeDisplayFile << "0x" << std::setfill('0') << std::setw(2)
- << std::hex << std::get<0>(code);
+ postCodeDisplayFile << "0x" << std::setfill('0') << std::hex;
+ for (const auto& byte : std::get<0>(code))
+ {
+ postCodeDisplayFile << std::setw(2) << static_cast<int>(byte);
+ }
postCodeDisplayFile.close();
}
#ifdef ENABLE_BIOS_POST_CODE_LOG
uint64_t usTimeOffset = tsUS - firstPostCodeUsSinceEpoch;
std::ostringstream hexCode;
- hexCode << "0x" << std::setfill('0') << std::setw(2) << std::hex
- << std::get<0>(code);
+ hexCode << "0x" << std::setfill('0') << std::hex;
+ for (const auto& byte : std::get<0>(code))
+ {
+ hexCode << std::setw(2) << static_cast<int>(byte);
+ }
std::ostringstream timeOffsetStr;
// Set Fixed-Point Notation