1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2011 The Chromium OS Authors.
13 #include <asm/global_data.h>
17 #include <asm/cb_sysinfo.h>
18 #include <asm/arch/timestamp.h>
19 #include <dm/ofnode.h>
21 int arch_cpu_init(void)
23 int ret = get_coreboot_info(&lib_sysinfo);
25 printf("Failed to parse coreboot tables.\n");
31 return IS_ENABLED(CONFIG_X86_RUN_64BIT) ? x86_cpu_reinit_f() :
40 int print_cpuinfo(void)
42 return default_print_cpuinfo();
45 static void board_final_init(void)
48 * Un-cache the ROM so the kernel has one
49 * more MTRR available.
51 * Coreboot should have assigned this to the
52 * top available variable MTRR.
54 u8 top_mtrr = (native_read_msr(MTRR_CAP_MSR) & 0xff) - 1;
55 u8 top_type = native_read_msr(MTRR_PHYS_BASE_MSR(top_mtrr)) & 0xff;
57 /* Make sure this MTRR is the correct Write-Protected type */
58 if (top_type == MTRR_TYPE_WRPROT) {
59 struct mtrr_state state;
61 mtrr_open(&state, true);
62 wrmsrl(MTRR_PHYS_BASE_MSR(top_mtrr), 0);
63 wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
64 mtrr_close(&state, true);
67 if (!ofnode_conf_read_bool("u-boot,no-apm-finalize")) {
69 * Issue SMI to coreboot to lock down ME and registers
70 * when allowed via device tree
72 printf("Finalizing coreboot\n");
77 int last_stage_init(void)
79 /* start usb so that usb keyboard can be used as input device */
80 if (IS_ENABLED(CONFIG_USB_KEYBOARD))