2 * This file is part of the coreboot project.
4 * Copyright (C) 2003 Eric Biederman
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
23 #include <console/console.h>
25 #include <pc80/mc146818rtc.h>
29 /* Write POST information */
31 /* someday romcc will be gone. */
33 /* Some mainboards have very nice features beyond just a simple display.
34 * They can override this function.
36 void __attribute__((weak
)) mainboard_post(uint8_t value
)
41 /* This just keeps the number of #ifs to a minimum */
42 #define mainboard_post(x)
47 #if !defined(__PRE_RAM__)
48 void cmos_post_log(void)
52 /* Get post code from other bank */
53 switch (cmos_read(CMOS_POST_BANK_OFFSET
)) {
54 case CMOS_POST_BANK_0_MAGIC
:
55 code
= cmos_read(CMOS_POST_BANK_1_OFFSET
);
57 case CMOS_POST_BANK_1_MAGIC
:
58 code
= cmos_read(CMOS_POST_BANK_0_OFFSET
);
64 /* Check last post code in previous boot against normal list */
68 case POST_ENTER_ELF_BOOT
:
72 printk(BIOS_WARNING
, "POST: Unexpected post code "
73 "in previous boot: 0x%02x\n", code
);
75 elog_add_event_word(ELOG_TYPE_LAST_POST_CODE
, code
);
79 #endif /* !__PRE_RAM__ */
81 static void cmos_post_code(u8 value
)
83 switch (cmos_read(CMOS_POST_BANK_OFFSET
)) {
84 case CMOS_POST_BANK_0_MAGIC
:
85 cmos_write(value
, CMOS_POST_BANK_0_OFFSET
);
87 case CMOS_POST_BANK_1_MAGIC
:
88 cmos_write(value
, CMOS_POST_BANK_1_OFFSET
);
92 #endif /* CONFIG_CMOS_POST */
94 void post_code(uint8_t value
)
97 #if CONFIG_CONSOLE_POST
98 print_emerg("POST: 0x");
99 print_emerg_hex8(value
);
103 cmos_post_code(value
);
106 outb(value
, CONFIG_IO_POST_PORT
);
109 mainboard_post(value
);