drivers/elog,pc80: Move cmos_post_log()
Do this to remove elog header dependency from pc80/ and remove some preprocessor guards. Change-Id: I98044a28c29a2b1756fb25fb593f505e914a71c0 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38189 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
committed by
Patrick Georgi
parent
da42724549
commit
8920ee0dcc
@ -748,16 +748,35 @@ static bool elog_do_add_boot_count(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check and log POST codes from previous boot */
|
||||||
|
static void log_last_boot_post(void)
|
||||||
|
{
|
||||||
|
#if CONFIG(ARCH_X86)
|
||||||
|
u8 code;
|
||||||
|
u32 extra;
|
||||||
|
|
||||||
|
if (!CONFIG(CMOS_POST))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cmos_post_previous_boot(&code, &extra) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printk(BIOS_WARNING, "POST: Unexpected post code/extra "
|
||||||
|
"in previous boot: 0x%02x/0x%04x\n", code, extra);
|
||||||
|
|
||||||
|
elog_add_event_word(ELOG_TYPE_LAST_POST_CODE, code);
|
||||||
|
/* Always zero with !CMOS_POST_EXTRA. */
|
||||||
|
if (extra)
|
||||||
|
elog_add_event_dword(ELOG_TYPE_POST_EXTRA, extra);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void elog_add_boot_count(void)
|
static void elog_add_boot_count(void)
|
||||||
{
|
{
|
||||||
if (elog_do_add_boot_count()) {
|
if (elog_do_add_boot_count()) {
|
||||||
elog_add_event_dword(ELOG_TYPE_BOOT, boot_count_read());
|
elog_add_event_dword(ELOG_TYPE_BOOT, boot_count_read());
|
||||||
|
|
||||||
#if CONFIG(ARCH_X86)
|
log_last_boot_post();
|
||||||
/* Check and log POST codes from previous boot */
|
|
||||||
if (CONFIG(CMOS_POST))
|
|
||||||
cmos_post_log();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
/* This file is part of the coreboot project. */
|
/* This file is part of the coreboot project. */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <elog.h>
|
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <pc80/mc146818rtc.h>
|
#include <pc80/mc146818rtc.h>
|
||||||
@ -10,45 +9,41 @@
|
|||||||
|
|
||||||
DECLARE_SPIN_LOCK(cmos_post_lock)
|
DECLARE_SPIN_LOCK(cmos_post_lock)
|
||||||
|
|
||||||
void cmos_post_log(void)
|
int cmos_post_previous_boot(u8 *code, u32 *extra)
|
||||||
{
|
{
|
||||||
u8 code = 0;
|
*code = 0;
|
||||||
u32 extra = 0;
|
*extra = 0;
|
||||||
|
|
||||||
spin_lock(&cmos_post_lock);
|
spin_lock(&cmos_post_lock);
|
||||||
|
|
||||||
/* Get post code from other bank */
|
/* Get post code from other bank */
|
||||||
switch (cmos_read(CMOS_POST_BANK_OFFSET)) {
|
switch (cmos_read(CMOS_POST_BANK_OFFSET)) {
|
||||||
case CMOS_POST_BANK_0_MAGIC:
|
case CMOS_POST_BANK_0_MAGIC:
|
||||||
code = cmos_read(CMOS_POST_BANK_1_OFFSET);
|
*code = cmos_read(CMOS_POST_BANK_1_OFFSET);
|
||||||
if (CONFIG(CMOS_POST_EXTRA))
|
if (CONFIG(CMOS_POST_EXTRA))
|
||||||
extra = cmos_read32(CMOS_POST_BANK_1_EXTRA);
|
*extra = cmos_read32(CMOS_POST_BANK_1_EXTRA);
|
||||||
break;
|
break;
|
||||||
case CMOS_POST_BANK_1_MAGIC:
|
case CMOS_POST_BANK_1_MAGIC:
|
||||||
code = cmos_read(CMOS_POST_BANK_0_OFFSET);
|
*code = cmos_read(CMOS_POST_BANK_0_OFFSET);
|
||||||
if (CONFIG(CMOS_POST_EXTRA))
|
if (CONFIG(CMOS_POST_EXTRA))
|
||||||
extra = cmos_read32(CMOS_POST_BANK_0_EXTRA);
|
*extra = cmos_read32(CMOS_POST_BANK_0_EXTRA);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock(&cmos_post_lock);
|
spin_unlock(&cmos_post_lock);
|
||||||
|
|
||||||
/* Check last post code in previous boot against normal list */
|
/* Check last post code in previous boot against normal list */
|
||||||
switch (code) {
|
switch (*code) {
|
||||||
case POST_OS_BOOT:
|
case POST_OS_BOOT:
|
||||||
case POST_OS_RESUME:
|
case POST_OS_RESUME:
|
||||||
case POST_ENTER_ELF_BOOT:
|
case POST_ENTER_ELF_BOOT:
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(BIOS_WARNING, "POST: Unexpected post code "
|
return -1;
|
||||||
"in previous boot: 0x%02x\n", code);
|
|
||||||
#if CONFIG(ELOG) && (ENV_RAMSTAGE || CONFIG(ELOG_PRERAM))
|
|
||||||
elog_add_event_word(ELOG_TYPE_LAST_POST_CODE, code);
|
|
||||||
if (CONFIG(CMOS_POST_EXTRA) && extra)
|
|
||||||
elog_add_event_dword(ELOG_TYPE_POST_EXTRA, extra);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmos_post_init(void)
|
void cmos_post_init(void)
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
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);
|
||||||
|
int cmos_post_previous_boot(u8 *code, u32 *extra);
|
||||||
#if CONFIG(CMOS_POST_EXTRA)
|
#if CONFIG(CMOS_POST_EXTRA)
|
||||||
struct device;
|
struct device;
|
||||||
void post_log_path(const struct device *dev);
|
void post_log_path(const struct device *dev);
|
||||||
|
@ -210,9 +210,6 @@ void cmos_set_checksum(int range_start, int range_end, int cks_loc);
|
|||||||
|
|
||||||
#define CMOS_POST_EXTRA_DEV_PATH 0x01
|
#define CMOS_POST_EXTRA_DEV_PATH 0x01
|
||||||
|
|
||||||
void cmos_post_log(void);
|
|
||||||
#else
|
|
||||||
static inline void cmos_post_log(void) {}
|
|
||||||
#endif /* CONFIG_CMOS_POST */
|
#endif /* CONFIG_CMOS_POST */
|
||||||
|
|
||||||
#endif /* CONFIG_ARCH_X86 */
|
#endif /* CONFIG_ARCH_X86 */
|
||||||
|
Reference in New Issue
Block a user