summaryrefslogtreecommitdiff
path: root/src/console
diff options
context:
space:
mode:
Diffstat (limited to 'src/console')
-rw-r--r--src/console/Kconfig18
-rw-r--r--src/console/post.c18
2 files changed, 36 insertions, 0 deletions
diff --git a/src/console/Kconfig b/src/console/Kconfig
index f1129a1279..c1c201227f 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -373,5 +373,23 @@ config CONSOLE_POST
usually displayed using a so-called "POST card" ISA/PCI/PCI-E
device) on the debug console.
+config CMOS_POST
+ bool "Store post codes in CMOS for debugging"
+ depends on !NO_POST
+ default n
+ help
+ If enabled, coreboot will store post codes in CMOS and switch between
+ two offsets on each boot so the last post code in the previous boot
+ can be retrieved. This uses 3 bytes of CMOS.
+
+config CMOS_POST_OFFSET
+ hex "Offset into CMOS to store POST codes"
+ depends on CMOS_POST
+ default 0
+ help
+ If CMOS_POST is enabled then an offset into CMOS must be provided.
+ If CONFIG_HAVE_OPTION_TABLE is enabled then it will use the value
+ defined in the mainboard option table.
+
endmenu
diff --git a/src/console/post.c b/src/console/post.c
index be2d0e9307..ab1afcf50a 100644
--- a/src/console/post.c
+++ b/src/console/post.c
@@ -21,6 +21,7 @@
#include <arch/io.h>
#include <console/console.h>
+#include <pc80/mc146818rtc.h>
/* Write POST information */
@@ -38,6 +39,20 @@ void __attribute__((weak)) mainboard_post(uint8_t value)
#define mainboard_post(x)
#endif
+#if CONFIG_CMOS_POST
+static void cmos_post_code(u8 value)
+{
+ switch (cmos_read(CMOS_POST_BANK_OFFSET)) {
+ case CMOS_POST_BANK_0_MAGIC:
+ cmos_write(value, CMOS_POST_BANK_0_OFFSET);
+ break;
+ case CMOS_POST_BANK_1_MAGIC:
+ cmos_write(value, CMOS_POST_BANK_1_OFFSET);
+ break;
+ }
+}
+#endif /* CONFIG_CMOS_POST */
+
void post_code(uint8_t value)
{
#if !CONFIG_NO_POST
@@ -46,6 +61,9 @@ void post_code(uint8_t value)
print_emerg_hex8(value);
print_emerg("\n");
#endif
+#if CONFIG_CMOS_POST
+ cmos_post_code(value);
+#endif
outb(value, CONFIG_POST_PORT);
#endif
mainboard_post(value);