blob: b9a7557f63980144f7c641650e933e6e2eae410e [file] [log] [blame]
Stefan Reinauerabc0c852010-11-22 08:09:50 +00001/*
2 * This file is part of the coreboot project.
Stefan Reinauer5ff7c132011-10-31 12:56:45 -07003 *
Stefan Reinauerabc0c852010-11-22 08:09:50 +00004 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; version 2 of
7 * the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Stefan Reinauerabc0c852010-11-22 08:09:50 +000013 */
14
Kyösti Mälkki3ee8b752019-03-03 00:35:15 +020015#include <stdint.h>
Stefan Reinauerabc0c852010-11-22 08:09:50 +000016#include <console/console.h>
Julius Wernercd49cce2019-03-05 16:53:33 -080017#if CONFIG(POST_IO)
Kyösti Mälkki3ee8b752019-03-03 00:35:15 +020018#include <arch/io.h>
19#endif
Stefan Reinauerabc0c852010-11-22 08:09:50 +000020
21/* Write POST information */
22
Alexandru Gagniucf88204e2012-08-03 13:20:57 -050023/* Some mainboards have very nice features beyond just a simple display.
24 * They can override this function.
25 */
Kyösti Mälkki0e557ab2020-01-03 12:23:52 +020026void __weak mainboard_post(uint8_t value) { }
Duncan Laurieb6e97b12012-09-09 19:09:56 -070027
Stefan Reinauerabc0c852010-11-22 08:09:50 +000028void post_code(uint8_t value)
29{
Julius Wernercd49cce2019-03-05 16:53:33 -080030#if !CONFIG(NO_POST)
31#if CONFIG(CONSOLE_POST)
Stefan Reinauerd6865222015-01-05 13:12:38 -080032 printk(BIOS_EMERG, "POST: 0x%02x\n", value);
Stefan Reinauerabc0c852010-11-22 08:09:50 +000033#endif
Julius Wernercd49cce2019-03-05 16:53:33 -080034#if CONFIG(CMOS_POST)
Duncan Laurieb6e97b12012-09-09 19:09:56 -070035 cmos_post_code(value);
36#endif
Julius Wernercd49cce2019-03-05 16:53:33 -080037#if CONFIG(POST_IO)
Idwer Vollering5809a732014-03-11 15:36:21 +000038 outb(value, CONFIG_POST_IO_PORT);
David Hendricks6b908d02012-11-05 12:34:09 -080039#endif
Stefan Reinauerabc0c852010-11-22 08:09:50 +000040#endif
Alexandru Gagniucf88204e2012-08-03 13:20:57 -050041 mainboard_post(value);
Stefan Reinauerabc0c852010-11-22 08:09:50 +000042}