Support OCP debug card postcode display
Description:
- Meson option postcode display path is supported
- Support OCP debug card postcode display
Example of test process:
1. Set postcode-display-path as /sys/bus/i2c/devices/12-
000f/postcode-display-slot in project layer
2. Press OCP debug card uart button to the host to check
3. Host power on
4. The postcode should start displaying on the OCP debug card screen
with user-readable string representation for those codes
Note:
- The postcode-display-path was setting by CLD driver, which
will though CPLD setting ocp-debug card
(link: https://lore.kernel.org/lkml/20230117094425.19004-1-Delphine_CC_Chiu@Wiwynn.com/)
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Change-Id: I915c0ec29d763b8933835a9fdc8881648ca95d24
diff --git a/src/post_code.cpp b/src/post_code.cpp
index 327e29e..ddabf30 100644
--- a/src/post_code.cpp
+++ b/src/post_code.cpp
@@ -112,6 +112,17 @@
timer->start(std::chrono::microseconds(timeoutMicroSeconds));
}
+ if (strlen(POSTCODE_DISPLAY_PATH) > 0)
+ {
+ std::string postCodeDisplayPath = 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.close();
+ }
+
#ifdef ENABLE_BIOS_POST_CODE_LOG
uint64_t usTimeOffset = tsUS - firstPostCodeUsSinceEpoch;
std::ostringstream hexCode;