From 92bb8320d62449207b45f5a76a011f1eacfdbd4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Tue, 24 Sep 2019 22:40:43 +0300 Subject: [PATCH] console: Declare empty printk() for __ROMCC__ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The typical do { } while (0) did not work, so provide empty stub function instead. Change-Id: Ieb0c33b082b4c4453d29d917f46561c0e672d09a Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/35588 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/cpu/intel/microcode/microcode.c | 18 ++---------------- src/include/console/console.h | 8 +++++++- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c index feb73c8b42..80470bf236 100644 --- a/src/cpu/intel/microcode/microcode.c +++ b/src/cpu/intel/microcode/microcode.c @@ -17,11 +17,11 @@ #include #if !defined(__ROMCC__) #include -#include #else #include #endif #include +#include #include #include #include @@ -84,9 +84,7 @@ void intel_microcode_load_unlocked(const void *microcode_patch) /* No use loading the same revision. */ if (current_rev == m->rev) { -#if !defined(__ROMCC__) printk(BIOS_INFO, "microcode: Update skipped, already up-to-date\n"); -#endif return; } @@ -104,18 +102,14 @@ void intel_microcode_load_unlocked(const void *microcode_patch) current_rev = read_microcode_rev(); if (current_rev == m->rev) { -#if !defined(__ROMCC__) printk(BIOS_INFO, "microcode: updated to revision " "0x%x date=%04x-%02x-%02x\n", read_microcode_rev(), m->date & 0xffff, (m->date >> 24) & 0xff, (m->date >> 16) & 0xff); -#endif return; } -#if !defined(__ROMCC__) printk(BIOS_INFO, "microcode: Update failed\n"); -#endif } uint32_t get_current_microcode_rev(void) @@ -180,13 +174,9 @@ const void *intel_microcode_find(void) msr = rdmsr(IA32_PLATFORM_ID); pf = 1 << ((msr.hi >> 18) & 7); } -#if !defined(__ROMCC__) - /* If this code is compiled with ROMCC we're probably in - * the bootblock and don't have console output yet. - */ + printk(BIOS_DEBUG, "microcode: sig=0x%x pf=0x%x revision=0x%x\n", sig, pf, rev); -#endif while (microcode_len >= sizeof(*ucode_updates)) { /* Newer microcode updates include a size field, whereas older @@ -194,17 +184,13 @@ const void *intel_microcode_find(void) if (ucode_updates->total_size) { update_size = ucode_updates->total_size; } else { - #if !defined(__ROMCC__) printk(BIOS_SPEW, "Microcode size field is 0\n"); - #endif update_size = 2048; } /* Checkpoint 1: The microcode update falls within CBFS */ if (update_size > microcode_len) { -#if !defined(__ROMCC__) printk(BIOS_WARNING, "Microcode header corrupted!\n"); -#endif break; } diff --git a/src/include/console/console.h b/src/include/console/console.h index e5b753e8b6..1c2a276af0 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -19,7 +19,6 @@ #include #include #include -#include /* console.h is supposed to provide the log levels defined in here: */ #include @@ -29,6 +28,8 @@ #ifndef __ROMCC__ +#include + void post_code(u8 value); #if CONFIG(CMOS_POST_EXTRA) void post_log_extra(u32 value); @@ -93,6 +94,11 @@ int do_printk(int msg_level, const char *fmt, ...) int do_vprintk(int msg_level, const char *fmt, va_list args); +#else + +static inline void romcc_printk(void) { } +#define printk(...) romcc_printk() + #endif /* !__ROMCC__ */ #endif /* CONSOLE_CONSOLE_H_ */