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)
25 ret = IS_ENABLED(CONFIG_X86_RUN_64BIT) ? x86_cpu_reinit_f() :
30 ret = get_coreboot_info(&lib_sysinfo);
32 printf("Failed to parse coreboot tables.\n");
41 static void board_final_init(void)
44 * Un-cache the ROM so the kernel has one
45 * more MTRR available.
47 * Coreboot should have assigned this to the
48 * top available variable MTRR.
50 u8 top_mtrr = (native_read_msr(MTRR_CAP_MSR) & 0xff) - 1;
51 u8 top_type = native_read_msr(MTRR_PHYS_BASE_MSR(top_mtrr)) & 0xff;
53 /* Make sure this MTRR is the correct Write-Protected type */
54 if (top_type == MTRR_TYPE_WRPROT) {
55 struct mtrr_state state;
57 mtrr_open(&state, true);
58 wrmsrl(MTRR_PHYS_BASE_MSR(top_mtrr), 0);
59 wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
60 mtrr_close(&state, true);
63 if (!ofnode_conf_read_bool("u-boot,no-apm-finalize")) {
65 * Issue SMI to coreboot to lock down ME and registers
66 * when allowed via device tree
68 printf("Finalizing coreboot\n");
73 static int last_stage_init(void)
75 timestamp_add_to_bootstage();
77 if (IS_ENABLED(CONFIG_XPL_BUILD))
84 EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);