2 * Copyright (c) 2011 The Chromium OS Authors.
4 * Graeme Russ, graeme.russ@gmail.com.
6 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/u-boot-x86.h>
15 #include <asm/cache.h>
18 #include <asm/arch/tables.h>
19 #include <asm/arch/sysinfo.h>
20 #include <asm/arch/timestamp.h>
22 DECLARE_GLOBAL_DATA_PTR;
24 int arch_cpu_init(void)
26 int ret = get_coreboot_info(&lib_sysinfo);
28 printf("Failed to parse coreboot tables.\n");
34 return x86_cpu_init_f();
37 int board_early_init_f(void)
42 int board_early_init_r(void)
44 /* CPU Speed to 100MHz */
45 gd->cpu_clk = 100000000;
47 /* Crystal is 33.000MHz */
48 gd->bus_clk = 33000000;
53 int print_cpuinfo(void)
55 return default_print_cpuinfo();
58 int last_stage_init(void)
60 if (gd->flags & GD_FLG_COLD_BOOT)
61 timestamp_add_to_bootstage();
66 #ifndef CONFIG_SYS_NO_FLASH
67 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
73 int board_eth_init(bd_t *bis)
75 return pci_eth_init(bis);
78 #define MTRR_TYPE_WP 5
79 #define MTRRcap_MSR 0xfe
80 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
81 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
83 void board_final_cleanup(void)
85 /* Un-cache the ROM so the kernel has one
86 * more MTRR available.
88 * Coreboot should have assigned this to the
89 * top available variable MTRR.
91 u8 top_mtrr = (native_read_msr(MTRRcap_MSR) & 0xff) - 1;
92 u8 top_type = native_read_msr(MTRRphysBase_MSR(top_mtrr)) & 0xff;
94 /* Make sure this MTRR is the correct Write-Protected type */
95 if (top_type == MTRR_TYPE_WP) {
97 wrmsrl(MTRRphysBase_MSR(top_mtrr), 0);
98 wrmsrl(MTRRphysMask_MSR(top_mtrr), 0);
102 /* Issue SMI to Coreboot to lock down ME and registers */
103 printf("Finalizing Coreboot\n");
107 void panic_puts(const char *str)
109 NS16550_t port = (NS16550_t)0x3f8;
111 NS16550_init(port, 1);
113 NS16550_putc(port, *str++);