From 41956b574212224127ba393f6e65be88de6f3f21 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Mon, 2 Dec 2019 11:11:53 +0800 Subject: libpayload: Implement reading from CBMEM console To support showing CBMEM logs on recovery screen, add a function cbmem_console_snapshot() to copy the CBMEM console to an allocated buffer. Non-printable characters are automatically replaced with '?' to ensure the returned string is printable. BRANCH=none BUG=b:146105976 TEST=emerge-nami libpayload Change-Id: Ie324055f5fd8276f1d833fc9d04f60a792dbb9f6 Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/37667 Tested-by: build bot (Jenkins) Reviewed-by: Hung-Te Lin --- payloads/libpayload/include/libpayload.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'payloads/libpayload/include') diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index 934c368e5c..4b6a250f28 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -313,6 +313,13 @@ void video_printf(int foreground, int background, enum video_printf_align align, */ void cbmem_console_init(void); void cbmem_console_write(const void *buffer, size_t count); +/** + * Take a snapshot of the CBMEM memory console. This function will allocate a + * range of memory. Callers must free the returned buffer by themselves. + * + * @return The allocated buffer on success, NULL on failure. + */ +char *cbmem_console_snapshot(void); /** @} */ /* drivers/option.c */ -- cgit v1.2.3