From 1e9a91420733bb4ec15170c7eb0e88e2f566c41b Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 16 Sep 2016 16:23:21 -0500 Subject: arch/x86,lib: make cbmem console work in postcar stage Implement postcar stage cbmem console support. The postcar stage is more like ramstage in that RAM is already up. Therefore, in order to make the cbmem console reinit flow work one needs the cbmem init hook infrastructure in place and the cbmem recovery called. This call is added to x86/postcar.c to achieve that. Additionally, one needs to provide postcar stage cbmem init hook callbacks for the cbmem console library to use. A few other places need to become postcar stage aware so that the code paths are taken. Lastly, since postcar is backed by ram indicate that to the cbmem backing store. BUG=chrome-os-partner:57513 Change-Id: I51db65d8502c456b08f291fd1b59f6ea72059dfd Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/16619 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Paul Menzel --- src/include/cbmem.h | 14 ++++++++++++++ src/include/console/cbmem_console.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/cbmem.h b/src/include/cbmem.h index 6a41ec7615..5c4b7c7189 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -117,17 +117,31 @@ void cbmem_add_records_to_cbtable(struct lb_header *header); #define RAMSTAGE_CBMEM_INIT_HOOK(init_fn_) \ static cbmem_init_hook_t init_fn_ ## _ptr_ __attribute__((used, \ section(".rodata.cbmem_init_hooks"))) = init_fn_; +#define POSTCAR_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ + init_fn_ ## _unused2_ __attribute__((unused)) = init_fn_; #elif ENV_ROMSTAGE #define ROMSTAGE_CBMEM_INIT_HOOK(init_fn_) \ static cbmem_init_hook_t init_fn_ ## _ptr_ __attribute__((used, \ section(".rodata.cbmem_init_hooks"))) = init_fn_; #define RAMSTAGE_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ init_fn_ ## _unused_ __attribute__((unused)) = init_fn_; +#define POSTCAR_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ + init_fn_ ## _unused2_ __attribute__((unused)) = init_fn_; +#elif ENV_POSTCAR +#define ROMSTAGE_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ + init_fn_ ## _unused2_ __attribute__((unused)) = init_fn_; +#define RAMSTAGE_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ + init_fn_ ## _unused_ __attribute__((unused)) = init_fn_; +#define POSTCAR_CBMEM_INIT_HOOK(init_fn_) \ + static cbmem_init_hook_t init_fn_ ## _ptr_ __attribute__((used, \ + section(".rodata.cbmem_init_hooks"))) = init_fn_; #else #define ROMSTAGE_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ init_fn_ ## _unused_ __attribute__((unused)) = init_fn_; #define RAMSTAGE_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ init_fn_ ## _unused2_ __attribute__((unused)) = init_fn_; +#define POSTCAR_CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t \ + init_fn_ ## _unused3_ __attribute__((unused)) = init_fn_; #endif /* ENV_RAMSTAGE */ diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h index e8b4d3a23b..de1144b272 100644 --- a/src/include/console/cbmem_console.h +++ b/src/include/console/cbmem_console.h @@ -22,7 +22,7 @@ void cbmemc_init(void); void cbmemc_tx_byte(unsigned char data); #define __CBMEM_CONSOLE_ENABLE__ CONFIG_CONSOLE_CBMEM && \ - (ENV_RAMSTAGE || ENV_VERSTAGE || \ + (ENV_RAMSTAGE || ENV_VERSTAGE || ENV_POSTCAR || \ (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT) && \ (ENV_ROMSTAGE || (ENV_BOOTBLOCK && CONFIG_BOOTBLOCK_CONSOLE)))\ ) -- cgit v1.2.3