Chromebooks: mainboard.c: Do not spell Chromebook in CamelCase
[coreboot.git] / src / console / post.c
blobf55683e4d13e92ee5fb1c3f499ff0f3960fea160
1 /*
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
9 * the License.
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,
19 * MA 02110-1301 USA
22 #include <arch/io.h>
23 #include <console/console.h>
24 #if CONFIG_CMOS_POST
25 #include <pc80/mc146818rtc.h>
26 #endif
27 #include <elog.h>
29 /* Write POST information */
31 /* someday romcc will be gone. */
32 #ifndef __ROMCC__
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)
40 #else
41 /* This just keeps the number of #ifs to a minimum */
42 #define mainboard_post(x)
43 #endif
45 #if CONFIG_CMOS_POST
47 #if !defined(__PRE_RAM__)
48 void cmos_post_log(void)
50 u8 code;
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);
56 break;
57 case CMOS_POST_BANK_1_MAGIC:
58 code = cmos_read(CMOS_POST_BANK_0_OFFSET);
59 break;
60 default:
61 return;
64 /* Check last post code in previous boot against normal list */
65 switch (code) {
66 case POST_OS_BOOT:
67 case POST_OS_RESUME:
68 case POST_ENTER_ELF_BOOT:
69 case 0:
70 break;
71 default:
72 printk(BIOS_WARNING, "POST: Unexpected post code "
73 "in previous boot: 0x%02x\n", code);
74 #if CONFIG_ELOG
75 elog_add_event_word(ELOG_TYPE_LAST_POST_CODE, code);
76 #endif
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);
86 break;
87 case CMOS_POST_BANK_1_MAGIC:
88 cmos_write(value, CMOS_POST_BANK_1_OFFSET);
89 break;
92 #endif /* CONFIG_CMOS_POST */
94 void post_code(uint8_t value)
96 #if !CONFIG_NO_POST
97 #if CONFIG_CONSOLE_POST
98 print_emerg("POST: 0x");
99 print_emerg_hex8(value);
100 print_emerg("\n");
101 #endif
102 #if CONFIG_CMOS_POST
103 cmos_post_code(value);
104 #endif
105 #if CONFIG_IO_POST
106 outb(value, CONFIG_IO_POST_PORT);
107 #endif
108 #endif
109 mainboard_post(value);