summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg/Include/Coreboot.h
diff options
context:
space:
mode:
authorBenjamin Doron <benjamin.doron00@gmail.com>2022-05-22 14:20:55 -0400
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-07-27 20:54:35 +0000
commitf26b70cb9f1367ceb25190ba2777631ee42c69fe (patch)
tree349032fa52a9d7af1422c5c456687617305c236e /UefiPayloadPkg/Include/Coreboot.h
parent2677286307c67b62c198cf6890d62ec540dd8c99 (diff)
downloadedk2-f26b70cb9f1367ceb25190ba2777631ee42c69fe.tar.gz
UefiPayloadPkg: Add support for logging to CBMEM console
Writes TianoCore debug logs into the CBMEM console ringbuffer, from where the user can retrieve them with the `cbmem` userspace utility. The intention is to aid in debugging non-fatal issues even in release builds, or simply make TianoCore's logs available to those interested. Consequently, MDEPKG_NDEBUG must be masked. As an in-memory debug logging library, ASSERTs must be non-fatal to be seen, so they neither dead-loop nor create a breakpoint. It is assumed that ASSERT() neither enforces fatal conditions nor security integrity, as release builds do not call DebugAssert() from the ASSERT macro. More detailed debug logs are produced with the DEBUG_CODE macro, but this guards other debug-related code throughout the codebase. To avoid changing behaviour on release builds, this is only set for debug builds. Tested on QEMU, dumping the appropriate memory region in the UEFI shell shows the TianoCore log. An improved revision of the debug library used in several coreboot-related EDK2 forks, including MrChromebox's. Previous revisions also tested on an Acer Aspire VN7-572G laptop. Cc: Guo Dong <guo.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
Diffstat (limited to 'UefiPayloadPkg/Include/Coreboot.h')
-rw-r--r--UefiPayloadPkg/Include/Coreboot.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/UefiPayloadPkg/Include/Coreboot.h b/UefiPayloadPkg/Include/Coreboot.h
index a3e1109fe8..2d454f7c89 100644
--- a/UefiPayloadPkg/Include/Coreboot.h
+++ b/UefiPayloadPkg/Include/Coreboot.h
@@ -199,6 +199,13 @@ struct cb_forward {
UINT64 forward;
};
+struct cb_cbmem_ref {
+ UINT32 tag;
+ // Field contains size of this struct == 0x0010
+ UINT32 size;
+ UINT64 cbmem_addr;
+};
+
#define CB_TAG_FRAMEBUFFER 0x0012
struct cb_framebuffer {
UINT32 tag;
@@ -229,7 +236,13 @@ struct cb_vdat {
#define CB_TAG_TIMESTAMPS 0x0016
#define CB_TAG_CBMEM_CONSOLE 0x0017
-#define CB_TAG_MRC_CACHE 0x0018
+struct cbmem_console {
+ UINT32 size;
+ UINT32 cursor;
+ UINT8 body[0];
+} __attribute__ ((packed));
+
+#define CB_TAG_MRC_CACHE 0x0018
struct cb_cbmem_tab {
UINT32 tag;
UINT32 size;