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>
This commit is contained in:
Kyösti Mälkki 2020-01-04 15:55:16 +02:00 committed by Patrick Georgi
parent 8920ee0dcc
commit f3dbf4ce6b
2 changed files with 27 additions and 24 deletions

View File

@ -86,8 +86,11 @@ void cmos_post_code(u8 value)
spin_unlock(&cmos_post_lock); 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); spin_lock(&cmos_post_lock);
switch (cmos_read(CMOS_POST_BANK_OFFSET)) { switch (cmos_read(CMOS_POST_BANK_OFFSET)) {
@ -102,20 +105,11 @@ static void __unused cmos_post_extra(u32 value)
spin_unlock(&cmos_post_lock); spin_unlock(&cmos_post_lock);
} }
#if CONFIG(CMOS_POST_EXTRA) void cmos_post_path(const struct device *dev)
void post_log_path(const struct device *dev)
{ {
if (dev) { /* Encode path into lower 3 bytes */
/* Encode path into lower 3 bytes */ u32 path = dev_path_encode(dev);
u32 path = dev_path_encode(dev); /* Upper byte contains the log type */
/* Upper byte contains the log type */ path |= CMOS_POST_EXTRA_DEV_PATH << 24;
path |= CMOS_POST_EXTRA_DEV_PATH << 24; cmos_post_extra(path);
cmos_post_extra(path);
}
} }
void post_log_clear(void)
{
cmos_post_extra(0);
}
#endif /* CONFIG_CMOS_POST_EXTRA */

View File

@ -16,18 +16,27 @@
#include <console/vtxprintf.h> #include <console/vtxprintf.h>
struct device;
void post_code(u8 value); void post_code(u8 value);
void arch_post_code(u8 value); void arch_post_code(u8 value);
void cmos_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); int cmos_post_previous_boot(u8 *code, u32 *extra);
#if CONFIG(CMOS_POST_EXTRA)
struct device; static inline void post_log_path(const struct device *dev)
void post_log_path(const struct device *dev); {
void post_log_clear(void); if (CONFIG(CMOS_POST) && dev)
#else cmos_post_path(dev);
#define post_log_path(x) do {} while (0) }
#define post_log_clear() do {} while (0)
#endif 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. */ /* this function is weak and can be overridden by a mainboard function. */
void mainboard_post(u8 value); void mainboard_post(u8 value);
void __noreturn die(const char *fmt, ...); void __noreturn die(const char *fmt, ...);