Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38190 )
Change subject: drivers/pc80/rtc: Clean up post_log_path() ......................................................................
drivers/pc80/rtc: Clean up post_log_path()
Change-Id: I605d39d907e083e73af4c72607216384e7ce166a Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/drivers/pc80/rtc/post.c M src/include/console/console.h 2 files changed, 27 insertions(+), 24 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/38190/1
diff --git a/src/drivers/pc80/rtc/post.c b/src/drivers/pc80/rtc/post.c index 2893a41..8308504 100644 --- a/src/drivers/pc80/rtc/post.c +++ b/src/drivers/pc80/rtc/post.c @@ -94,8 +94,11 @@ spin_unlock(&cmos_post_lock); }
-static void __unused cmos_post_extra(u32 value) +void cmos_post_extra(u32 value) { + if (!CONFIG(CMOS_POST_EXTRA)) + return; + spin_lock(&cmos_post_lock);
switch (cmos_read(CMOS_POST_BANK_OFFSET)) { @@ -110,20 +113,11 @@ spin_unlock(&cmos_post_lock); }
-#if CONFIG(CMOS_POST_EXTRA) -void post_log_path(const struct device *dev) +void cmos_post_path(const struct device *dev) { - if (dev) { - /* Encode path into lower 3 bytes */ - u32 path = dev_path_encode(dev); - /* Upper byte contains the log type */ - path |= CMOS_POST_EXTRA_DEV_PATH << 24; - cmos_post_extra(path); - } + /* Encode path into lower 3 bytes */ + u32 path = dev_path_encode(dev); + /* Upper byte contains the log type */ + path |= CMOS_POST_EXTRA_DEV_PATH << 24; + cmos_post_extra(path); } - -void post_log_clear(void) -{ - cmos_post_extra(0); -} -#endif /* CONFIG_CMOS_POST_EXTRA */ diff --git a/src/include/console/console.h b/src/include/console/console.h index 9e6c76e..94642cd 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -28,18 +28,27 @@
#include <console/vtxprintf.h>
+struct device; + void post_code(u8 value); void arch_post_code(u8 value); void cmos_post_code(u8 value); +void cmos_post_extra(u32 value); +void cmos_post_path(const struct device *dev); int cmos_post_previous(u8 *code, u32 *extra); -#if CONFIG(CMOS_POST_EXTRA) -struct device; -void post_log_path(const struct device *dev); -void post_log_clear(void); -#else -#define post_log_path(x) do {} while (0) -#define post_log_clear() do {} while (0) -#endif + +static inline void post_log_path(const struct device *dev) +{ + if (CONFIG(CMOS_POST) && dev) + cmos_post_path(dev); +} + +static inline void post_log_clear(void) +{ + if (CONFIG(CMOS_POST)) + cmos_post_extra(0); +} + /* this function is weak and can be overridden by a mainboard function. */ void mainboard_post(u8 value); void __noreturn die(const char *fmt, ...);
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38190 )
Change subject: drivers/pc80/rtc: Clean up post_log_path() ......................................................................
Patch Set 2: Code-Review+1
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38190 )
Change subject: drivers/pc80/rtc: Clean up post_log_path() ......................................................................
Patch Set 4: Code-Review+2
Hello Angel Pons, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38190
to look at the new patch set (#6).
Change subject: drivers/pc80/rtc: Clean up post_log_path() ......................................................................
drivers/pc80/rtc: Clean up post_log_path()
Change-Id: I605d39d907e083e73af4c72607216384e7ce166a Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/drivers/pc80/rtc/post.c M src/include/console/console.h 2 files changed, 27 insertions(+), 24 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/38190/6
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38190 )
Change subject: drivers/pc80/rtc: Clean up post_log_path() ......................................................................
Patch Set 6: Code-Review+2
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38190 )
Change subject: drivers/pc80/rtc: Clean up post_log_path() ......................................................................
Patch Set 9: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38190 )
Change subject: drivers/pc80/rtc: Clean up post_log_path() ......................................................................
drivers/pc80/rtc: Clean up post_log_path()
Change-Id: I605d39d907e083e73af4c72607216384e7ce166a Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38190 Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Nico Huber nico.h@gmx.de Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/drivers/pc80/rtc/post.c M src/include/console/console.h 2 files changed, 27 insertions(+), 24 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, approved
diff --git a/src/drivers/pc80/rtc/post.c b/src/drivers/pc80/rtc/post.c index e143674..5bee5be 100644 --- a/src/drivers/pc80/rtc/post.c +++ b/src/drivers/pc80/rtc/post.c @@ -86,8 +86,11 @@ spin_unlock(&cmos_post_lock); }
-static void __unused cmos_post_extra(u32 value) +void cmos_post_extra(u32 value) { + if (!CONFIG(CMOS_POST_EXTRA)) + return; + spin_lock(&cmos_post_lock);
switch (cmos_read(CMOS_POST_BANK_OFFSET)) { @@ -102,20 +105,11 @@ spin_unlock(&cmos_post_lock); }
-#if CONFIG(CMOS_POST_EXTRA) -void post_log_path(const struct device *dev) +void cmos_post_path(const struct device *dev) { - if (dev) { - /* Encode path into lower 3 bytes */ - u32 path = dev_path_encode(dev); - /* Upper byte contains the log type */ - path |= CMOS_POST_EXTRA_DEV_PATH << 24; - cmos_post_extra(path); - } + /* Encode path into lower 3 bytes */ + u32 path = dev_path_encode(dev); + /* Upper byte contains the log type */ + path |= CMOS_POST_EXTRA_DEV_PATH << 24; + cmos_post_extra(path); } - -void post_log_clear(void) -{ - cmos_post_extra(0); -} -#endif /* CONFIG_CMOS_POST_EXTRA */ diff --git a/src/include/console/console.h b/src/include/console/console.h index f9e9fe2..95c0e7f 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -16,18 +16,27 @@
#include <console/vtxprintf.h>
+struct device; + void post_code(u8 value); void arch_post_code(u8 value); void cmos_post_code(u8 value); +void cmos_post_extra(u32 value); +void cmos_post_path(const struct device *dev); int cmos_post_previous_boot(u8 *code, u32 *extra); -#if CONFIG(CMOS_POST_EXTRA) -struct device; -void post_log_path(const struct device *dev); -void post_log_clear(void); -#else -#define post_log_path(x) do {} while (0) -#define post_log_clear() do {} while (0) -#endif + +static inline void post_log_path(const struct device *dev) +{ + if (CONFIG(CMOS_POST) && dev) + cmos_post_path(dev); +} + +static inline void post_log_clear(void) +{ + if (CONFIG(CMOS_POST)) + cmos_post_extra(0); +} + /* this function is weak and can be overridden by a mainboard function. */ void mainboard_post(u8 value); void __noreturn die(const char *fmt, ...);