diff options
Diffstat (limited to 'arch/x86')
51 files changed, 237 insertions, 234 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index f1afc74fff8..fd409b9f720 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -1,16 +1,16 @@ # SPDX-License-Identifier: GPL-2.0+ ifeq ($(CONFIG_EFI_APP),) -ifdef CONFIG_$(SPL_)X86_64 +ifdef CONFIG_$(XPL_)X86_64 head-y := arch/x86/cpu/start64.o else -ifeq ($(CONFIG_$(SPL_TPL_)X86_16BIT_INIT),y) +ifeq ($(CONFIG_$(PHASE_)X86_16BIT_INIT),y) head-y := arch/x86/cpu/start.o else ifndef CONFIG_SPL head-y := arch/x86/cpu/start.o else -ifdef CONFIG_SPL_BUILD +ifdef CONFIG_XPL_BUILD head-y = arch/x86/cpu/start_from_tpl.o else head-y = arch/x86/cpu/start_from_spl.o @@ -20,8 +20,8 @@ endif endif endif # EFI -head-$(CONFIG_$(SPL_TPL_)X86_16BIT_INIT) += arch/x86/cpu/start16.o -head-$(CONFIG_$(SPL_TPL_)X86_16BIT_INIT) += arch/x86/cpu/resetvec.o +head-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += arch/x86/cpu/start16.o +head-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += arch/x86/cpu/resetvec.o libs-y += arch/x86/cpu/ libs-y += arch/x86/lib/ diff --git a/arch/x86/config.mk b/arch/x86/config.mk index 2e3a7119e79..6d4839dfb38 100644 --- a/arch/x86/config.mk +++ b/arch/x86/config.mk @@ -10,7 +10,7 @@ PF_CPPFLAGS_X86 := $(call cc-option, -fno-toplevel-reorder, \ PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86) PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm -ifdef CONFIG_SPL_BUILD +ifdef CONFIG_XPL_BUILD IS_32BIT := y else ifndef CONFIG_X86_64 @@ -26,7 +26,7 @@ endif ifeq ($(IS_32BIT),y) PLATFORM_CPPFLAGS += -march=i386 -m32 else -PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64 +PLATFORM_CPPFLAGS += $(if $(CONFIG_XPL_BUILD),,-fpic) -fno-common -march=core2 -m64 ifndef CONFIG_X86_HARDFP PLATFORM_CPPFLAGS += -mno-mmx -mno-sse @@ -86,12 +86,12 @@ ifeq ($(IS_32BIT),y) PLATFORM_CPPFLAGS += -mregparm=3 endif KBUILD_LDFLAGS += --emit-relocs -LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_SPL_BUILD),,-pie) +LDFLAGS_FINAL += --gc-sections $(if $(CONFIG_XPL_BUILD),,-pie) endif ifdef CONFIG_X86_64 -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD PLATFORM_CPPFLAGS += -D__x86_64__ else PLATFORM_CPPFLAGS += -D__I386__ diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index 16e67e3da24..39c8b0835cc 100644 --- a/arch/x86/cpu/Makefile +++ b/arch/x86/cpu/Makefile @@ -6,16 +6,16 @@ # (C) Copyright 2002 # Daniel Engström, Omicron Ceti AB, daniel@omicron.se. -ifeq ($(CONFIG_$(SPL_)X86_64),y) +ifeq ($(CONFIG_$(XPL_)X86_64),y) extra-y = start64.o else -ifeq ($(CONFIG_$(SPL_TPL_)X86_16BIT_INIT),y) +ifeq ($(CONFIG_$(PHASE_)X86_16BIT_INIT),y) extra-y = start.o else ifndef CONFIG_SPL extra-y = start.o else -ifdef CONFIG_SPL_BUILD +ifdef CONFIG_XPL_BUILD extra-y = start_from_tpl.o else extra-y = start_from_spl.o @@ -24,14 +24,14 @@ endif endif endif -extra-$(CONFIG_$(SPL_TPL_)X86_16BIT_INIT) += resetvec.o start16.o +extra-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += resetvec.o start16.o obj-y += cpu.o ifndef CONFIG_TPL_BUILD obj-y += cpu_x86.o endif -ifndef CONFIG_$(SPL_)X86_64 +ifndef CONFIG_$(XPL_)X86_64 AFLAGS_REMOVE_call32.o := -mregparm=3 \ $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) AFLAGS_call32.o := -fpic -fshort-wchar \ @@ -54,23 +54,23 @@ obj-$(CONFIG_INTEL_QUARK) += quark/ obj-$(CONFIG_INTEL_QUEENSBAY) += queensbay/ obj-$(CONFIG_INTEL_TANGIER) += tangier/ obj-$(CONFIG_APIC) += lapic.o ioapic.o -obj-$(CONFIG_$(SPL_TPL_)ACPI_GPE) += acpi_gpe.o +obj-$(CONFIG_$(PHASE_)ACPI_GPE) += acpi_gpe.o obj-$(CONFIG_QFW) += qfw_cpu.o ifndef CONFIG_SYS_COREBOOT -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += irq.o +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += irq.o endif -ifndef CONFIG_$(SPL_)X86_64 -obj-$(CONFIG_$(SPL_)SMP) += mp_init.o +ifndef CONFIG_$(XPL_)X86_64 +obj-$(CONFIG_$(XPL_)SMP) += mp_init.o endif obj-y += mtrr.o obj-$(CONFIG_PCI) += pci.o -ifndef CONFIG_$(SPL_)X86_64 +ifndef CONFIG_$(XPL_)X86_64 obj-$(CONFIG_SMP) += sipi_vector.o endif obj-y += turbo.o obj-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.o -ifeq ($(CONFIG_$(SPL_)X86_64),y) +ifeq ($(CONFIG_$(XPL_)X86_64),y) obj-y += x86_64/ else obj-y += i386/ diff --git a/arch/x86/cpu/apollolake/Makefile b/arch/x86/cpu/apollolake/Makefile index 2ddf4af62c5..f481f40d9bb 100644 --- a/arch/x86/cpu/apollolake/Makefile +++ b/arch/x86/cpu/apollolake/Makefile @@ -2,20 +2,20 @@ # # Copyright 2019 Google LLC -obj-$(CONFIG_SPL_BUILD) += cpu_spl.o -obj-$(CONFIG_SPL_BUILD) += spl.o -obj-$(CONFIG_SPL_BUILD) += systemagent.o +obj-$(CONFIG_XPL_BUILD) += cpu_spl.o +obj-$(CONFIG_XPL_BUILD) += spl.o +obj-$(CONFIG_XPL_BUILD) += systemagent.o obj-y += cpu_common.o ifndef CONFIG_TPL_BUILD obj-y += cpu.o obj-y += punit.o obj-y += fsp_bindings.o -ifdef CONFIG_SPL_BUILD +ifdef CONFIG_XPL_BUILD obj-y += fsp_m.o endif endif -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-y += acpi.o obj-y += fsp_s.o endif diff --git a/arch/x86/cpu/apollolake/cpu_spl.c b/arch/x86/cpu/apollolake/cpu_spl.c index 8798fa79d4c..8198667fa50 100644 --- a/arch/x86/cpu/apollolake/cpu_spl.c +++ b/arch/x86/cpu/apollolake/cpu_spl.c @@ -184,9 +184,9 @@ int arch_cpu_init(void) { int ret = 0; - if (spl_phase() == PHASE_TPL) + if (xpl_phase() == PHASE_TPL) ret = arch_cpu_init_tpl(); - else if (spl_phase() == PHASE_SPL) + else if (xpl_phase() == PHASE_SPL) ret = arch_cpu_init_spl(); if (ret) printf("%s: Error %d\n", __func__, ret); diff --git a/arch/x86/cpu/apollolake/fsp_bindings.c b/arch/x86/cpu/apollolake/fsp_bindings.c index f6fbddce922..b4bb677f5cd 100644 --- a/arch/x86/cpu/apollolake/fsp_bindings.c +++ b/arch/x86/cpu/apollolake/fsp_bindings.c @@ -247,7 +247,7 @@ static int fsp_update_config_from_dtb(ofnode node, u8 *cfg, return 0; } -#if defined(CONFIG_SPL_BUILD) +#if defined(CONFIG_XPL_BUILD) const struct fsp_binding fsp_m_bindings[] = { { .type = FSP_UINT32, @@ -653,7 +653,7 @@ int fsp_m_update_config_from_dtb(ofnode node, struct fsp_m_config *cfg) } #endif -#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) +#if !defined(CONFIG_XPL_BUILD) && !defined(CONFIG_TPL_BUILD) const struct fsp_binding fsp_s_bindings[] = { { .type = FSP_UINT8, diff --git a/arch/x86/cpu/apollolake/hostbridge.c b/arch/x86/cpu/apollolake/hostbridge.c index 9ee362239ef..039236df02d 100644 --- a/arch/x86/cpu/apollolake/hostbridge.c +++ b/arch/x86/cpu/apollolake/hostbridge.c @@ -255,7 +255,7 @@ static int apl_hostbridge_of_to_plat(struct udevice *dev) static int apl_hostbridge_probe(struct udevice *dev) { - if (spl_phase() == PHASE_TPL) + if (xpl_phase() == PHASE_TPL) return apl_hostbridge_early_init(dev); return 0; diff --git a/arch/x86/cpu/apollolake/lpc.c b/arch/x86/cpu/apollolake/lpc.c index 531ff1cd91f..f34c199bf73 100644 --- a/arch/x86/cpu/apollolake/lpc.c +++ b/arch/x86/cpu/apollolake/lpc.c @@ -80,7 +80,7 @@ int lpc_open_pmio_window(uint base, uint size) lgir_reg_num = find_unused_pmio_window(); if (lgir_reg_num < 0) { - if (spl_phase() > PHASE_TPL) { + if (xpl_phase() > PHASE_TPL) { log_err("LPC: Cannot open IO window: %lx size %lx\n", bridge_base, size - bridged_size); log_err("No more IO windows\n"); diff --git a/arch/x86/cpu/apollolake/pch.c b/arch/x86/cpu/apollolake/pch.c index 32190312ff8..07ef26f6bde 100644 --- a/arch/x86/cpu/apollolake/pch.c +++ b/arch/x86/cpu/apollolake/pch.c @@ -12,7 +12,7 @@ static int apl_set_spi_protect(struct udevice *dev, bool protect) { - if (spl_phase() == PHASE_SPL) + if (xpl_phase() == PHASE_SPL) return lpc_set_spi_protect(dev, BIOS_CTRL, protect); return 0; diff --git a/arch/x86/cpu/apollolake/pmc.c b/arch/x86/cpu/apollolake/pmc.c index 32fd0344861..bfb8a07d47a 100644 --- a/arch/x86/cpu/apollolake/pmc.c +++ b/arch/x86/cpu/apollolake/pmc.c @@ -115,7 +115,7 @@ int apl_pmc_ofdata_to_uc_plat(struct udevice *dev) ARRAY_SIZE(base)); if (ret) return log_msg_ret("Missing/short early-regs", ret); - if (spl_phase() == PHASE_TPL) { + if (xpl_phase() == PHASE_TPL) { upriv->pmc_bar0 = (void *)base[0]; upriv->pmc_bar2 = (void *)base[2]; @@ -186,7 +186,7 @@ static int enable_pmcbar(struct udevice *dev) static int apl_pmc_probe(struct udevice *dev) { - if (spl_phase() == PHASE_TPL) { + if (xpl_phase() == PHASE_TPL) { return enable_pmcbar(dev); } else { struct acpi_pmc_upriv *upriv = dev_get_uclass_priv(dev); diff --git a/arch/x86/cpu/apollolake/punit.c b/arch/x86/cpu/apollolake/punit.c index b1503c25140..9c708e9df55 100644 --- a/arch/x86/cpu/apollolake/punit.c +++ b/arch/x86/cpu/apollolake/punit.c @@ -77,7 +77,7 @@ static int punit_init(struct udevice *dev) static int apl_punit_probe(struct udevice *dev) { - if (spl_phase() == PHASE_SPL) + if (xpl_phase() == PHASE_SPL) return punit_init(dev); return 0; diff --git a/arch/x86/cpu/apollolake/spl.c b/arch/x86/cpu/apollolake/spl.c index b351d73e7d8..510f8c4350f 100644 --- a/arch/x86/cpu/apollolake/spl.c +++ b/arch/x86/cpu/apollolake/spl.c @@ -116,7 +116,7 @@ static int spl_fast_spi_load_image(struct spl_image_info *spl_image, return ret; spl_image->size = CONFIG_SYS_MONITOR_LEN; /* We don't know SPL size */ - spl_image->entry_point = spl_phase() == PHASE_TPL ? + spl_image->entry_point = xpl_phase() == PHASE_TPL ? CONFIG_SPL_TEXT_BASE : CONFIG_TEXT_BASE; spl_image->load_addr = spl_image->entry_point; spl_image->os = IH_OS_U_BOOT; diff --git a/arch/x86/cpu/broadwell/Makefile b/arch/x86/cpu/broadwell/Makefile index 3e1f76d6118..dfe013e3833 100644 --- a/arch/x86/cpu/broadwell/Makefile +++ b/arch/x86/cpu/broadwell/Makefile @@ -2,23 +2,23 @@ # # Copyright (c) 2016 Google, Inc -obj-$(CONFIG_$(SPL_TPL_)X86_16BIT_INIT) += cpu.o -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += cpu_full.o +obj-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += cpu.o +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += cpu_full.o ifdef CONFIG_SPL -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-y += cpu_from_spl.o obj-y += cpu_full.o obj-y += refcode.o endif -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD # obj-y += cpu_from_spl.o obj-y += adsp.o obj-y += sata.o endif endif -ifeq ($(CONFIG_$(SPL_TPL_)X86_32BIT_INIT),) +ifeq ($(CONFIG_$(PHASE_)X86_32BIT_INIT),) #obj-y += cpu_from_spl.o endif @@ -29,5 +29,5 @@ obj-y += northbridge.o obj-y += pch.o obj-y += pinctrl_broadwell.o obj-y += power_state.o -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += refcode.o -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += sdram.o +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += refcode.o +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += sdram.o diff --git a/arch/x86/cpu/broadwell/cpu.c b/arch/x86/cpu/broadwell/cpu.c index dc6717eca40..8127d31e57e 100644 --- a/arch/x86/cpu/broadwell/cpu.c +++ b/arch/x86/cpu/broadwell/cpu.c @@ -68,7 +68,7 @@ int arch_cpu_init(void) post_code(POST_CPU_INIT); /* Do a mini-init if TPL has already done the full init */ - if (IS_ENABLED(CONFIG_TPL) && spl_phase() != PHASE_TPL) + if (IS_ENABLED(CONFIG_TPL) && xpl_phase() != PHASE_TPL) return x86_cpu_reinit_f(); else return x86_cpu_init_f(); @@ -88,18 +88,6 @@ int checkcpu(void) return 0; } -int print_cpuinfo(void) -{ - char processor_name[CPU_MAX_NAME_LEN]; - const char *name; - - /* Print processor name */ - name = cpu_get_name(processor_name); - printf("CPU: %s\n", name); - - return 0; -} - void board_debug_uart_init(void) { /* com1 / com2 decode range */ diff --git a/arch/x86/cpu/broadwell/cpu_full.c b/arch/x86/cpu/broadwell/cpu_full.c index c43fb7a608b..529dab18d5d 100644 --- a/arch/x86/cpu/broadwell/cpu_full.c +++ b/arch/x86/cpu/broadwell/cpu_full.c @@ -84,7 +84,7 @@ static const u8 power_limit_time_msr_to_sec[] = { [0x11] = 128, }; -#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) +#if defined(CONFIG_XPL_BUILD) && !defined(CONFIG_TPL_BUILD) int arch_cpu_init(void) { return 0; diff --git a/arch/x86/cpu/broadwell/pch.c b/arch/x86/cpu/broadwell/pch.c index 2c8b7380d96..5b6147432a7 100644 --- a/arch/x86/cpu/broadwell/pch.c +++ b/arch/x86/cpu/broadwell/pch.c @@ -606,7 +606,7 @@ static int broadwell_pch_probe(struct udevice *dev) return broadwell_pch_early_init(dev); else return broadwell_pch_init(dev); - } else if (IS_ENABLED(CONFIG_SPL) && !IS_ENABLED(CONFIG_SPL_BUILD)) { + } else if (IS_ENABLED(CONFIG_SPL) && !IS_ENABLED(CONFIG_XPL_BUILD)) { return broadwell_pch_init(dev); } else { return 0; diff --git a/arch/x86/cpu/config.mk b/arch/x86/cpu/config.mk index 87e242a2065..6acdf9b3b23 100644 --- a/arch/x86/cpu/config.mk +++ b/arch/x86/cpu/config.mk @@ -9,7 +9,7 @@ LDPPFLAGS += -DRESET_VEC_LOC=$(CONFIG_RESET_VEC_LOC) LDPPFLAGS += -DSTART_16=$(CONFIG_SYS_X86_START16) ifdef CONFIG_X86_64 -ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_EFI_APP),) +ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_EFI_APP),) LDSCRIPT = $(srctree)/arch/x86/cpu/u-boot-64.lds endif endif diff --git a/arch/x86/cpu/coreboot/Makefile b/arch/x86/cpu/coreboot/Makefile index a6cdb9a1485..a6c7d0e56d5 100644 --- a/arch/x86/cpu/coreboot/Makefile +++ b/arch/x86/cpu/coreboot/Makefile @@ -14,7 +14,7 @@ ifndef CONFIG_SPL obj-y += car.o endif -ifdef CONFIG_SPL_BUILD +ifdef CONFIG_XPL_BUILD obj-y += coreboot_spl.o else obj-y += sdram.o diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index d474c79e25e..fa7430b436f 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -38,16 +38,6 @@ int arch_cpu_init(void) return 0; } -int checkcpu(void) -{ - return 0; -} - -int print_cpuinfo(void) -{ - return default_print_cpuinfo(); -} - static void board_final_init(void) { /* @@ -82,7 +72,9 @@ static void board_final_init(void) static int last_stage_init(void) { - if (IS_ENABLED(CONFIG_SPL_BUILD)) + timestamp_add_to_bootstage(); + + if (IS_ENABLED(CONFIG_XPL_BUILD)) return 0; board_final_init(); diff --git a/arch/x86/cpu/coreboot/timestamp.c b/arch/x86/cpu/coreboot/timestamp.c index ec4003c4e77..681191d85bb 100644 --- a/arch/x86/cpu/coreboot/timestamp.c +++ b/arch/x86/cpu/coreboot/timestamp.c @@ -6,13 +6,12 @@ */ #include <bootstage.h> +#include <errno.h> #include <asm/arch/timestamp.h> #include <asm/cb_sysinfo.h> #include <asm/u-boot-x86.h> #include <linux/compiler.h> -static struct timestamp_table *ts_table __section(".data"); - void timestamp_init(void) { timestamp_add_now(TS_U_BOOT_INITTED); @@ -20,6 +19,8 @@ void timestamp_init(void) void timestamp_add(enum timestamp_id id, uint64_t ts_time) { + const struct sysinfo_t *info = cb_get_sysinfo(); + struct timestamp_table *ts_table = info->tstamp_table; struct timestamp_entry *tse; if (!ts_table || (ts_table->num_entries == ts_table->max_entries)) @@ -37,13 +38,15 @@ void timestamp_add_now(enum timestamp_id id) int timestamp_add_to_bootstage(void) { + const struct sysinfo_t *info = cb_get_sysinfo(); + const struct timestamp_table *ts_table = info->tstamp_table; uint i; if (!ts_table) - return -1; + return -ENOENT; for (i = 0; i < ts_table->num_entries; i++) { - struct timestamp_entry *tse = &ts_table->entries[i]; + const struct timestamp_entry *tse = &ts_table->entries[i]; const char *name = NULL; switch (tse->entry_id) { diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index ad21fdb457a..a8b21406ac0 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -163,8 +163,11 @@ char *cpu_get_name(char *name) return ptr; } -int default_print_cpuinfo(void) +#if !CONFIG_IS_ENABLED(CPU) +int print_cpuinfo(void) { + post_code(POST_CPU_INFO); + printf("CPU: %s, vendor %s, device %xh\n", cpu_has_64bit() ? "x86_64" : "x86", cpu_vendor_name(gd->arch.x86_vendor), gd->arch.x86_device); @@ -176,6 +179,7 @@ int default_print_cpuinfo(void) return 0; } +#endif #if CONFIG_IS_ENABLED(SHOW_BOOT_PROGRESS) void show_boot_progress(int val) @@ -185,7 +189,7 @@ void show_boot_progress(int val) #endif #if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB) && \ - !defined(CONFIG_SPL_BUILD) + !defined(CONFIG_XPL_BUILD) /* * Implement a weak default function for boards that need to do some final init * before the system is ready. @@ -247,7 +251,7 @@ static int last_stage_init(void) } EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init); -#endif /* !SYS_COREBOOT && !EFI_STUB && !SPL_BUILD */ +#endif /* !SYS_COREBOOT && !EFI_STUB && !XPL_BUILD */ static int x86_init_cpus(void) { @@ -336,7 +340,7 @@ int reserve_arch(void) } #endif -long detect_coreboot_table_at(ulong start, ulong size) +static long detect_coreboot_table_at(ulong start, ulong size) { u32 *ptr, *end; diff --git a/arch/x86/cpu/cpu_x86.c b/arch/x86/cpu/cpu_x86.c index 6c53f0ea821..6c32ae499df 100644 --- a/arch/x86/cpu/cpu_x86.c +++ b/arch/x86/cpu/cpu_x86.c @@ -7,6 +7,7 @@ #include <dm.h> #include <errno.h> #include <asm/cpu.h> +#include <asm/cpu_x86.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/x86/cpu/efi/app.c b/arch/x86/cpu/efi/app.c index 218a68c4642..84fe50e2f2f 100644 --- a/arch/x86/cpu/efi/app.c +++ b/arch/x86/cpu/efi/app.c @@ -19,11 +19,6 @@ int checkcpu(void) return 0; } -int print_cpuinfo(void) -{ - return default_print_cpuinfo(); -} - void board_final_init(void) { } diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 642a87a37d8..6845ce72ff9 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -144,11 +144,6 @@ int checkcpu(void) return 0; } -int print_cpuinfo(void) -{ - return default_print_cpuinfo(); -} - /* Find any available tables and copy them to a safe place */ int reserve_arch(void) { diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c index 934e98ac582..a51a24498a7 100644 --- a/arch/x86/cpu/i386/cpu.c +++ b/arch/x86/cpu/i386/cpu.c @@ -263,6 +263,49 @@ static int build_vendor_name(char *vendor_name) } #endif +int x86_cpu_vendor_info(char *name) +{ + uint cpu_device; + + cpu_device = 0; + + /* gcc 7.3 does not want to drop x86_vendors, so use #ifdef */ +#ifndef CONFIG_TPL_BUILD + *name = '\0'; /* Unset */ + + /* Find the id and vendor_name */ + if (!has_cpuid()) { + /* Its a 486 if we can modify the AC flag */ + if (flag_is_changeable_p(X86_EFLAGS_AC)) + cpu_device = 0x00000400; /* 486 */ + else + cpu_device = 0x00000300; /* 386 */ + if (cpu_device == 0x00000400 && test_cyrix_52div()) { + /* If we ever care we can enable cpuid here */ + memcpy(name, "CyrixInstead", 13); + + /* Detect NexGen with old hypercode */ + } else if (deep_magic_nexgen_probe()) { + memcpy(name, "NexGenDriven", 13); + } + } else { + int cpuid_level; + + cpuid_level = build_vendor_name(name); + name[12] = '\0'; + + /* Intel-defined flags: level 0x00000001 */ + if (cpuid_level >= 0x00000001) + cpu_device = cpuid_eax(0x00000001); + else + /* Have CPUID level 0 only unheard of */ + cpu_device = 0x00000400; + } +#endif /* CONFIG_TPL_BUILD */ + + return cpu_device; +} + static void identify_cpu(struct cpu_device_id *cpu) { cpu->device = 0; /* fix gcc 4.4.4 warning */ @@ -271,7 +314,7 @@ static void identify_cpu(struct cpu_device_id *cpu) * Do a quick and dirty check to save space - Intel and AMD only and * just the vendor. This is enough for most TPL code. */ - if (spl_phase() == PHASE_TPL) { + if (xpl_phase() == PHASE_TPL) { struct cpuid_result result; result = cpuid(0x00000000); @@ -289,46 +332,19 @@ static void identify_cpu(struct cpu_device_id *cpu) return; } -/* gcc 7.3 does not want to drop x86_vendors, so use #ifdef */ #ifndef CONFIG_TPL_BUILD - char vendor_name[16]; - int i; - - vendor_name[0] = '\0'; /* Unset */ - - /* Find the id and vendor_name */ - if (!has_cpuid()) { - /* Its a 486 if we can modify the AC flag */ - if (flag_is_changeable_p(X86_EFLAGS_AC)) - cpu->device = 0x00000400; /* 486 */ - else - cpu->device = 0x00000300; /* 386 */ - if ((cpu->device == 0x00000400) && test_cyrix_52div()) { - memcpy(vendor_name, "CyrixInstead", 13); - /* If we ever care we can enable cpuid here */ - } - /* Detect NexGen with old hypercode */ - else if (deep_magic_nexgen_probe()) - memcpy(vendor_name, "NexGenDriven", 13); - } else { - int cpuid_level; - - cpuid_level = build_vendor_name(vendor_name); - vendor_name[12] = '\0'; - - /* Intel-defined flags: level 0x00000001 */ - if (cpuid_level >= 0x00000001) { - cpu->device = cpuid_eax(0x00000001); - } else { - /* Have CPUID level 0 only unheard of */ - cpu->device = 0x00000400; - } - } - cpu->vendor = X86_VENDOR_UNKNOWN; - for (i = 0; i < ARRAY_SIZE(x86_vendors); i++) { - if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) { - cpu->vendor = x86_vendors[i].vendor; - break; + { + char vendor_name[16]; + int i; + + cpu->device = x86_cpu_vendor_info(vendor_name); + + cpu->vendor = X86_VENDOR_UNKNOWN; + for (i = 0; i < ARRAY_SIZE(x86_vendors); i++) { + if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) { + cpu->vendor = x86_vendors[i].vendor; + break; + } } } #endif @@ -485,6 +501,11 @@ int x86_cpu_reinit_f(void) return 0; } +void x86_get_identity_for_timer(void) +{ + setup_identity(); +} + void x86_enable_caches(void) { unsigned long cr0; diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c index b3f4214acdb..6f78b072cde 100644 --- a/arch/x86/cpu/i386/interrupt.c +++ b/arch/x86/cpu/i386/interrupt.c @@ -237,7 +237,7 @@ void *x86_get_idt(void) return &idt_ptr; } -void __do_irq(int irq) +static void __do_irq(int irq) { printf("Unhandled IRQ : %d\n", irq); } diff --git a/arch/x86/cpu/intel_common/Makefile b/arch/x86/cpu/intel_common/Makefile index 1dc17b45879..a28e6c77c9c 100644 --- a/arch/x86/cpu/intel_common/Makefile +++ b/arch/x86/cpu/intel_common/Makefile @@ -5,19 +5,19 @@ obj-$(CONFIG_INTEL_ACPIGEN) += acpi.o ifdef CONFIG_HAVE_MRC -obj-$(CONFIG_$(SPL_TPL_)X86_16BIT_INIT) += car.o -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += me_status.o -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += report_platform.o -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += mrc.o +obj-$(CONFIG_$(PHASE_)X86_16BIT_INIT) += car.o +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += me_status.o +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += report_platform.o +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += mrc.o endif -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-$(CONFIG_INTEL_GMA_ACPI) += intel_opregion.o endif ifdef CONFIG_INTEL_CAR_CQOS obj-$(CONFIG_TPL_BUILD) += car2.o -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-y += car2_uninit.o endif endif @@ -26,10 +26,10 @@ obj-y += cpu.o obj-y += fast_spi.o obj-y += lpc.o obj-y += lpss.o -obj-$(CONFIG_$(SPL_)INTEL_GENERIC_WIFI) += generic_wifi.o +obj-$(CONFIG_$(XPL_)INTEL_GENERIC_WIFI) += generic_wifi.o ifndef CONFIG_EFI_APP -obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += microcode.o -ifndef CONFIG_$(SPL_)X86_64 +obj-$(CONFIG_$(PHASE_)X86_32BIT_INIT) += microcode.o +ifndef CONFIG_$(XPL_)X86_64 obj-y += microcode.o endif endif @@ -38,7 +38,7 @@ obj-$(CONFIG_HAVE_ITSS) += itss.o obj-$(CONFIG_HAVE_P2SB) += p2sb.o ifdef CONFIG_SPL -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD ifndef CONFIG_SYS_COREBOOT obj-y += cpu_from_spl.o endif diff --git a/arch/x86/cpu/intel_common/mrc.c b/arch/x86/cpu/intel_common/mrc.c index c834c05d130..baa1f0e32d6 100644 --- a/arch/x86/cpu/intel_common/mrc.c +++ b/arch/x86/cpu/intel_common/mrc.c @@ -259,7 +259,7 @@ int mrc_common_init(struct udevice *dev, void *pei_data, bool use_asm_linkage) return ret; delay = dev_read_u32_default(dev, "fspm,training-delay", 0); - if (spl_phase() == PHASE_SPL) { + if (xpl_phase() == PHASE_SPL) { if (delay) printf("SDRAM training (%d seconds)...", delay); else diff --git a/arch/x86/cpu/intel_common/p2sb.c b/arch/x86/cpu/intel_common/p2sb.c index 7aad8f8ca56..406c41013fc 100644 --- a/arch/x86/cpu/intel_common/p2sb.c +++ b/arch/x86/cpu/intel_common/p2sb.c @@ -96,7 +96,7 @@ int p2sb_of_to_plat(struct udevice *dev) return log_msg_ret("Missing/short early-regs", ret); plat->mmio_base = base[0]; /* TPL sets up the initial BAR */ - if (spl_phase() == PHASE_TPL) { + if (xpl_phase() == PHASE_TPL) { plat->bdf = pci_get_devfn(dev); if (plat->bdf < 0) return log_msg_ret("Cannot get p2sb PCI address", @@ -114,9 +114,9 @@ int p2sb_of_to_plat(struct udevice *dev) static int p2sb_probe(struct udevice *dev) { - if (spl_phase() == PHASE_TPL) + if (xpl_phase() == PHASE_TPL) return p2sb_early_init(dev); - else if (spl_phase() == PHASE_SPL) + else if (xpl_phase() == PHASE_SPL) return p2sb_spl_init(dev); return 0; diff --git a/arch/x86/cpu/ivybridge/Makefile b/arch/x86/cpu/ivybridge/Makefile index 716134e9ff3..471ad8d7ebc 100644 --- a/arch/x86/cpu/ivybridge/Makefile +++ b/arch/x86/cpu/ivybridge/Makefile @@ -5,15 +5,15 @@ ifdef CONFIG_HAVE_FSP obj-y += fsp_configs.o ivybridge.o else -obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += cpu.o +obj-$(CONFIG_$(XPL_)X86_32BIT_INIT) += cpu.o obj-y += early_me.o obj-y += lpc.o obj-y += northbridge.o -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-y += sata.o endif -obj-$(CONFIG_$(SPL_)X86_32BIT_INIT) += sdram.o -ifndef CONFIG_$(SPL_)X86_32BIT_INIT +obj-$(CONFIG_$(XPL_)X86_32BIT_INIT) += sdram.o +ifndef CONFIG_$(XPL_)X86_32BIT_INIT obj-y += sdram_nop.o endif endif diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index 05691a38d2e..d299068a879 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -182,20 +182,6 @@ int checkcpu(void) return 0; } -int print_cpuinfo(void) -{ - char processor_name[CPU_MAX_NAME_LEN]; - const char *name; - - /* Print processor name */ - name = cpu_get_name(processor_name); - printf("CPU: %s\n", name); - - post_code(POST_CPU_INFO); - - return 0; -} - void board_debug_uart_init(void) { /* This enables the debug UART */ diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c index 50cba5fb88d..07ea89162de 100644 --- a/arch/x86/cpu/mtrr.c +++ b/arch/x86/cpu/mtrr.c @@ -87,7 +87,7 @@ void mtrr_read_all(struct mtrr_info *info) } } -void mtrr_write_all(struct mtrr_info *info) +static void mtrr_write_all(struct mtrr_info *info) { int reg_count = mtrr_get_var_count(); struct mtrr_state state; diff --git a/arch/x86/cpu/qemu/Makefile b/arch/x86/cpu/qemu/Makefile index b7dd5bd46c7..1439916ac2d 100644 --- a/arch/x86/cpu/qemu/Makefile +++ b/arch/x86/cpu/qemu/Makefile @@ -2,7 +2,7 @@ # # Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> -ifndef CONFIG_$(SPL_)X86_64 +ifndef CONFIG_$(XPL_)X86_64 obj-y += car.o endif obj-y += dram.o diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c index 262584d01f0..563f63e2bc8 100644 --- a/arch/x86/cpu/qemu/qemu.c +++ b/arch/x86/cpu/qemu/qemu.c @@ -109,12 +109,6 @@ int checkcpu(void) { return 0; } - -int print_cpuinfo(void) -{ - post_code(POST_CPU_INFO); - return default_print_cpuinfo(); -} #endif int arch_early_init_r(void) diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c index fdf92b2c0c3..07504faaffb 100644 --- a/arch/x86/cpu/quark/quark.c +++ b/arch/x86/cpu/quark/quark.c @@ -266,12 +266,6 @@ int checkcpu(void) return 0; } -int print_cpuinfo(void) -{ - post_code(POST_CPU_INFO); - return default_print_cpuinfo(); -} - static void quark_pcie_init(void) { u32 val; diff --git a/arch/x86/cpu/slimbootloader/slimbootloader.c b/arch/x86/cpu/slimbootloader/slimbootloader.c index 142c9341cf8..8a5c78595aa 100644 --- a/arch/x86/cpu/slimbootloader/slimbootloader.c +++ b/arch/x86/cpu/slimbootloader/slimbootloader.c @@ -54,8 +54,3 @@ int checkcpu(void) { return 0; } - -int print_cpuinfo(void) -{ - return default_print_cpuinfo(); -} diff --git a/arch/x86/cpu/tangier/tangier.c b/arch/x86/cpu/tangier/tangier.c index 8a8f7d27a9d..b005bc7d9a0 100644 --- a/arch/x86/cpu/tangier/tangier.c +++ b/arch/x86/cpu/tangier/tangier.c @@ -19,8 +19,3 @@ int checkcpu(void) { return 0; } - -int print_cpuinfo(void) -{ - return default_print_cpuinfo(); -} diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c index 80eab710315..71bc07f872a 100644 --- a/arch/x86/cpu/x86_64/cpu.c +++ b/arch/x86/cpu/x86_64/cpu.c @@ -75,3 +75,9 @@ void board_debug_uart_init(void) /* this was already done in SPL */ } #endif + +void x86_get_identity_for_timer(void) +{ + /* set the vendor to Intel so that native_calibrate_tsc() works */ + gd->arch.x86_vendor = X86_VENDOR_INTEL; +} diff --git a/arch/x86/cpu/x86_64/misc.c b/arch/x86/cpu/x86_64/misc.c index 294511e6eba..fc449ca4ed6 100644 --- a/arch/x86/cpu/x86_64/misc.c +++ b/arch/x86/cpu/x86_64/misc.c @@ -32,9 +32,4 @@ int checkcpu(void) { return 0; } - -int print_cpuinfo(void) -{ - return 0; -} #endif diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile index cd77f4c4e81..9a46726e026 100644 --- a/arch/x86/dts/Makefile +++ b/arch/x86/dts/Makefile @@ -24,12 +24,4 @@ dtb-y += bayleybay.dtb \ include $(srctree)/scripts/Makefile.dts -targets += $(dtb-y) - DTC_FLAGS += -R 4 -p $(if $(CONFIG_EFI_APP),0x8000,0x1000) - -PHONY += dtbs -dtbs: $(addprefix $(obj)/, $(dtb-y)) - @: - -clean-files := *.dtb diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index 87e0c6f12b6..8c1ef4c8cc1 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -293,4 +293,11 @@ u32 cpu_get_stepping(void); */ int cpu_phys_address_size(void); +void board_final_init(void); +void board_final_cleanup(void); + +#ifndef CONFIG_EFI_STUB +int reserve_arch(void); +#endif + #endif diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index 5c49b0f009b..f6836b74488 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -18,7 +18,7 @@ extern char *strchr(const char *s, int c); * Our assembly routines do not work on in 64-bit mode and we don't do a lot of * copying in SPL, so code size is more important there. */ -#if defined(CONFIG_SPL_BUILD) || !IS_ENABLED(CONFIG_X86_32BIT_INIT) +#if defined(CONFIG_XPL_BUILD) || !IS_ENABLED(CONFIG_X86_32BIT_INIT) #undef __HAVE_ARCH_MEMCPY extern void *memcpy(void *, const void *, __kernel_size_t); diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h index 3acc58ad74b..ed2f6aa3893 100644 --- a/arch/x86/include/asm/u-boot-x86.h +++ b/arch/x86/include/asm/u-boot-x86.h @@ -44,6 +44,15 @@ int x86_cpu_reinit_f(void); int x86_cpu_init_tpl(void); /** + * x86_get_identity_for_timer() - Set up CPU identity for use by the early timer + * + * The timer can be needed early in board_f if bootstage is enabled. This + * function can be called from the TSC timer to make sure that the CPU-identity + * info has been set up + */ +void x86_get_identity_for_timer(void); + +/** * cpu_reinit_fpu() - Reinit the FPU if something is wrong with it * * The FSP-M code can leave registers in use in the FPU. This functions reinits @@ -51,6 +60,14 @@ int x86_cpu_init_tpl(void); */ void cpu_reinit_fpu(void); +/** + * x86_cpu_vendor_info() - Get the CPU-vendor name and device number + * + * @name: 13-byte area to hold the returned string + * Return: CPU device number read from cpuid + */ +int x86_cpu_vendor_info(char *name); + int cpu_init_f(void); void setup_gdt(struct global_data *id, u64 *gdt_addr); /* @@ -78,7 +95,6 @@ void x86_enable_caches(void); void x86_disable_caches(void); int x86_init_cache(void); phys_addr_t board_get_usable_ram_top(phys_size_t total_size); -int default_print_cpuinfo(void); /* Set up a UART which can be used with printch(), printhex8(), etc. */ int setup_internal_uart(int enable); diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 8fc35e1b51e..7677c0c352f 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -5,21 +5,21 @@ obj-y += bdinfo.o -ifndef CONFIG_$(SPL_TPL_)X86_64 +ifndef CONFIG_$(PHASE_)X86_64 obj-y += bios.o obj-y += bios_asm.o obj-y += bios_interrupts.o endif -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-$(CONFIG_X86_32BIT_INIT) += string.o endif -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-$(CONFIG_CMD_BOOTM) += bootm.o endif obj-y += cmd_boot.o -obj-$(CONFIG_$(SPL_)COREBOOT_SYSINFO) += coreboot/ +obj-$(CONFIG_$(XPL_)COREBOOT_SYSINFO) += coreboot/ obj-$(CONFIG_SEABIOS) += coreboot_table.o obj-y += early_cmos.o obj-y += e820.o @@ -27,7 +27,7 @@ obj-y += init_helpers.o obj-y += interrupts.o obj-y += lpc-uclass.o obj-y += mpspec.o -obj-$(CONFIG_$(SPL_TPL_)ACPIGEN) += acpi_nhlt.o +obj-$(CONFIG_$(PHASE_)ACPIGEN) += acpi_nhlt.o obj-y += northbridge-uclass.o obj-$(CONFIG_I8259_PIC) += i8259.o obj-$(CONFIG_I8254_TIMER) += i8254.o @@ -44,10 +44,10 @@ obj-y += acpi.o obj-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.o ifndef CONFIG_QEMU obj-y += acpigen.o -obj-$(CONFIG_$(SPL_TPL_)GENERATE_ACPI_TABLE) += acpi_table.o +obj-$(CONFIG_$(PHASE_)GENERATE_ACPI_TABLE) += acpi_table.o endif obj-y += tables.o -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-$(CONFIG_ZBOOT) += zimage.o endif obj-$(CONFIG_USE_HOB) += hob.o @@ -58,7 +58,7 @@ obj-$(CONFIG_FSP_VERSION1) += fsp1/ obj-$(CONFIG_FSP_VERSION2) += fsp2/ endif -ifdef CONFIG_SPL_BUILD +ifdef CONFIG_XPL_BUILD ifdef CONFIG_TPL_BUILD obj-y += tpl.o else @@ -90,13 +90,13 @@ endif ifdef CONFIG_EFI_STUB -ifeq ($(CONFIG_$(SPL_)X86_64),) +ifeq ($(CONFIG_$(XPL_)X86_64),) extra-y += $(EFI_CRT0) $(EFI_RELOC) endif else -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST)$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),) extra-y += $(EFI_CRT0) $(EFI_RELOC) endif diff --git a/arch/x86/lib/bdinfo.c b/arch/x86/lib/bdinfo.c index 165e8ab944f..2a78f578dee 100644 --- a/arch/x86/lib/bdinfo.c +++ b/arch/x86/lib/bdinfo.c @@ -19,7 +19,12 @@ void arch_print_bdinfo(void) bdinfo_print_num_l("clock_rate", gd->arch.clock_rate); bdinfo_print_num_l("tsc_base", gd->arch.tsc_base); bdinfo_print_num_l("vendor", gd->arch.x86_vendor); - bdinfo_print_str(" name", cpu_vendor_name(gd->arch.x86_vendor)); + if (!IS_ENABLED(CONFIG_X86_64)) { + char vendor_name[16]; + + x86_cpu_vendor_info(vendor_name); + bdinfo_print_str(" name", vendor_name); + } bdinfo_print_num_l("model", gd->arch.x86_model); bdinfo_print_num_l("phys_addr in bits", cpu_phys_address_size()); bdinfo_print_num_l("table start", gd->arch.table_start); diff --git a/arch/x86/lib/e820.c b/arch/x86/lib/e820.c index 122b4f7ca01..d478b7486e3 100644 --- a/arch/x86/lib/e820.c +++ b/arch/x86/lib/e820.c @@ -4,6 +4,7 @@ */ #include <efi_loader.h> +#include <lmb.h> #include <asm/e820.h> #include <asm/global_data.h> @@ -41,15 +42,11 @@ void efi_add_known_memory(void) { struct e820_entry e820[E820MAX]; unsigned int i, num; - u64 start, ram_top; + u64 start; int type; num = install_e820_map(ARRAY_SIZE(e820), e820); - ram_top = (u64)gd->ram_top & ~EFI_PAGE_MASK; - if (!ram_top) - ram_top = 0x100000000ULL; - for (i = 0; i < num; ++i) { start = e820[i].addr; @@ -72,13 +69,41 @@ void efi_add_known_memory(void) break; } - if (type == EFI_CONVENTIONAL_MEMORY) { - efi_add_conventional_memory_map(start, - start + e820[i].size, - ram_top); - } else { + if (type != EFI_CONVENTIONAL_MEMORY) efi_add_memory_map(start, e820[i].size, type); - } } } #endif /* CONFIG_IS_ENABLED(EFI_LOADER) */ + +#if CONFIG_IS_ENABLED(LMB_ARCH_MEM_MAP) +void lmb_arch_add_memory(void) +{ + struct e820_entry e820[E820MAX]; + unsigned int i, num; + u64 ram_top; + + num = install_e820_map(ARRAY_SIZE(e820), e820); + + ram_top = (u64)gd->ram_top & ~EFI_PAGE_MASK; + if (!ram_top) + ram_top = 0x100000000ULL; + + for (i = 0; i < num; ++i) { + if (e820[i].type == E820_RAM) { + u64 start, size, rgn_top; + + start = e820[i].addr; + size = e820[i].size; + rgn_top = start + size; + + if (start > ram_top) + continue; + + if (rgn_top > ram_top) + size -= rgn_top - ram_top; + + lmb_add(start, size); + } + } +} +#endif /* CONFIG_IS_ENABLED(LMB_ARCH_MEM_MAP) */ diff --git a/arch/x86/lib/fsp/Makefile b/arch/x86/lib/fsp/Makefile index da6c0a886ae..0039dd1bf5c 100644 --- a/arch/x86/lib/fsp/Makefile +++ b/arch/x86/lib/fsp/Makefile @@ -4,7 +4,7 @@ obj-y += fsp_common.o obj-y += fsp_dram.o -ifndef CONFIG_SPL_BUILD +ifndef CONFIG_XPL_BUILD obj-$(CONFIG_VIDEO_FSP) += fsp_graphics.o endif obj-y += fsp_support.o diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c index c47e6ca4738..7e4c1476634 100644 --- a/arch/x86/lib/fsp/fsp_common.c +++ b/arch/x86/lib/fsp/fsp_common.c @@ -26,12 +26,6 @@ int checkcpu(void) return 0; } -int print_cpuinfo(void) -{ - post_code(POST_CPU_INFO); - return default_print_cpuinfo(); -} - int fsp_init_phase_pci(void) { u32 status; diff --git a/arch/x86/lib/fsp2/fsp_dram.c b/arch/x86/lib/fsp2/fsp_dram.c index a50dc985a3c..4c4c8334bdb 100644 --- a/arch/x86/lib/fsp2/fsp_dram.c +++ b/arch/x86/lib/fsp2/fsp_dram.c @@ -28,7 +28,7 @@ int dram_init(void) return 0; } - if (spl_phase() == PHASE_SPL) { + if (xpl_phase() == PHASE_SPL) { bool s3wake = false; s3wake = IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) && diff --git a/arch/x86/lib/fsp2/fsp_init.c b/arch/x86/lib/fsp2/fsp_init.c index ecbadaae75c..1a2bf46c5c5 100644 --- a/arch/x86/lib/fsp2/fsp_init.c +++ b/arch/x86/lib/fsp2/fsp_init.c @@ -25,7 +25,7 @@ int fsp_setup_pinctrl(void) int ret; /* Make sure pads are set up early in U-Boot */ - if (!ll_boot_init() || spl_phase() != PHASE_BOARD_F) + if (!ll_boot_init() || xpl_phase() != PHASE_BOARD_F) return 0; /* Probe all pinctrl devices to set up the pads */ @@ -134,7 +134,7 @@ int fsp_locate_fsp(enum fsp_type_t type, struct binman_entry *entry, return log_msg_ret("Could not get flash mmap", ret); } - if (spl_phase() >= PHASE_BOARD_F) { + if (xpl_phase() >= PHASE_BOARD_F) { if (type != FSP_S) return -EPROTONOSUPPORT; ret = binman_entry_find("intel-fsp-s", entry); diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c index 7c03dea0711..f7df7e03621 100644 --- a/arch/x86/lib/tpl.c +++ b/arch/x86/lib/tpl.c @@ -103,7 +103,7 @@ int spl_spi_load_image(void) void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) { - debug("Jumping to %s at %lx\n", spl_phase_name(spl_next_phase()), + debug("Jumping to %s at %lx\n", xpl_name(xpl_next_phase()), (ulong)spl_image->entry_point); #ifdef DEBUG print_buffer(spl_image->entry_point, (void *)spl_image->entry_point, 1, |