arch/x86: Add a common romstage entry
It might be possible to have this used for more than x86, but that will be for a later commit. Change-Id: I4968364a95b5c69c21d3915d302d23e6f1ca182f Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55067 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
committed by
Felix Held
parent
11cac784ff
commit
bab9e2e6bd
@@ -159,6 +159,7 @@ endif # CONFIG_ARCH_VERSTAGE_X86_32 / CONFIG_ARCH_VERSTAGE_X86_64
|
|||||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
||||||
|
|
||||||
romstage-y += assembly_entry.S
|
romstage-y += assembly_entry.S
|
||||||
|
romstage-y += romstage.c
|
||||||
romstage-y += boot.c
|
romstage-y += boot.c
|
||||||
romstage-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c
|
romstage-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c
|
||||||
romstage-y += post.c
|
romstage-y += post.c
|
||||||
|
16
src/arch/x86/romstage.c
Normal file
16
src/arch/x86/romstage.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <arch/cpu.h>
|
||||||
|
#include <console/console.h>
|
||||||
|
#include <timestamp.h>
|
||||||
|
#include <romstage_common.h>
|
||||||
|
|
||||||
|
asmlinkage void car_stage_entry(void)
|
||||||
|
{
|
||||||
|
timestamp_add_now(TS_ROMSTAGE_START);
|
||||||
|
|
||||||
|
/* Assumes the hardware was set up during the bootblock */
|
||||||
|
console_init();
|
||||||
|
|
||||||
|
romstage_main();
|
||||||
|
}
|
@@ -7,14 +7,14 @@
|
|||||||
#include <arch/symbols.h>
|
#include <arch/symbols.h>
|
||||||
#include <commonlib/helpers.h>
|
#include <commonlib/helpers.h>
|
||||||
#include <program_loading.h>
|
#include <program_loading.h>
|
||||||
#include <timestamp.h>
|
#include <romstage_common.h>
|
||||||
#include <security/vboot/vboot_common.h>
|
#include <security/vboot/vboot_common.h>
|
||||||
|
|
||||||
/* If we do not have a constrained _car_stack region size, use the
|
/* If we do not have a constrained _car_stack region size, use the
|
||||||
following as a guideline for acceptable stack usage. */
|
following as a guideline for acceptable stack usage. */
|
||||||
#define DCACHE_RAM_ROMSTAGE_STACK_SIZE 0x2000
|
#define DCACHE_RAM_ROMSTAGE_STACK_SIZE 0x2000
|
||||||
|
|
||||||
static void romstage_main(void)
|
void __noreturn romstage_main(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const int num_guards = 64;
|
const int num_guards = 64;
|
||||||
@@ -54,14 +54,5 @@ static void romstage_main(void)
|
|||||||
|
|
||||||
prepare_and_run_postcar();
|
prepare_and_run_postcar();
|
||||||
/* We do not return here. */
|
/* We do not return here. */
|
||||||
}
|
die("failed to load postcar\n");
|
||||||
|
|
||||||
asmlinkage void car_stage_entry(void)
|
|
||||||
{
|
|
||||||
timestamp_add_now(TS_ROMSTAGE_START);
|
|
||||||
|
|
||||||
/* Assumes the hardware was set up during the bootblock */
|
|
||||||
console_init();
|
|
||||||
|
|
||||||
romstage_main();
|
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include <smp/node.h>
|
#include <smp/node.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <timestamp.h>
|
#include <timestamp.h>
|
||||||
|
#include <romstage_common.h>
|
||||||
#include <northbridge/amd/agesa/agesa_helper.h>
|
#include <northbridge/amd/agesa/agesa_helper.h>
|
||||||
#include <northbridge/amd/agesa/state_machine.h>
|
#include <northbridge/amd/agesa/state_machine.h>
|
||||||
|
|
||||||
@@ -31,16 +32,12 @@ static void fill_sysinfo(struct sysinfo *cb)
|
|||||||
*/
|
*/
|
||||||
static void ap_romstage_main(void);
|
static void ap_romstage_main(void);
|
||||||
|
|
||||||
static void romstage_main(void)
|
void __noreturn romstage_main(void)
|
||||||
{
|
{
|
||||||
struct sysinfo romstage_state;
|
struct sysinfo romstage_state;
|
||||||
struct sysinfo *cb = &romstage_state;
|
struct sysinfo *cb = &romstage_state;
|
||||||
int cbmem_initted = 0;
|
int cbmem_initted = 0;
|
||||||
|
|
||||||
timestamp_add_now(TS_ROMSTAGE_START);
|
|
||||||
|
|
||||||
console_init();
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "APIC %02u: CPU Family_Model = %08x\n",
|
printk(BIOS_DEBUG, "APIC %02u: CPU Family_Model = %08x\n",
|
||||||
initial_lapicid(), cpuid_eax(1));
|
initial_lapicid(), cpuid_eax(1));
|
||||||
|
|
||||||
@@ -79,6 +76,7 @@ static void romstage_main(void)
|
|||||||
|
|
||||||
prepare_and_run_postcar();
|
prepare_and_run_postcar();
|
||||||
/* We do not return. */
|
/* We do not return. */
|
||||||
|
die("failed to load postcar\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ap_romstage_main(void)
|
static void ap_romstage_main(void)
|
||||||
@@ -96,11 +94,6 @@ static void ap_romstage_main(void)
|
|||||||
halt();
|
halt();
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage void car_stage_entry(void)
|
|
||||||
{
|
|
||||||
romstage_main();
|
|
||||||
}
|
|
||||||
|
|
||||||
void *cbmem_top_chipset(void)
|
void *cbmem_top_chipset(void)
|
||||||
{
|
{
|
||||||
/* Top of CBMEM is at highest usable DRAM address below 4GiB. */
|
/* Top of CBMEM is at highest usable DRAM address below 4GiB. */
|
||||||
|
8
src/include/romstage_common.h
Normal file
8
src/include/romstage_common.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#ifndef ROMSTAGE_COMMON_H
|
||||||
|
#define ROMSTAGE_COMMON_H
|
||||||
|
|
||||||
|
void __noreturn romstage_main(void);
|
||||||
|
|
||||||
|
#endif /* ROMSTAGE_COMMON_H */
|
@@ -8,18 +8,12 @@
|
|||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <fsp/api.h>
|
#include <fsp/api.h>
|
||||||
#include <program_loading.h>
|
#include <program_loading.h>
|
||||||
#include <timestamp.h>
|
#include <romstage_common.h>
|
||||||
|
|
||||||
asmlinkage void car_stage_entry(void)
|
void __noreturn romstage_main(void)
|
||||||
{
|
{
|
||||||
timestamp_add_now(TS_ROMSTAGE_START);
|
|
||||||
|
|
||||||
post_code(0x40);
|
post_code(0x40);
|
||||||
|
|
||||||
console_init();
|
|
||||||
|
|
||||||
post_code(0x41);
|
|
||||||
|
|
||||||
/* Snapshot chipset state prior to any FSP call */
|
/* Snapshot chipset state prior to any FSP call */
|
||||||
fill_chipset_state();
|
fill_chipset_state();
|
||||||
|
|
||||||
@@ -31,4 +25,5 @@ asmlinkage void car_stage_entry(void)
|
|||||||
memmap_stash_early_dram_usage();
|
memmap_stash_early_dram_usage();
|
||||||
|
|
||||||
run_ramstage();
|
run_ramstage();
|
||||||
|
die("failed to load ramstage\n");
|
||||||
}
|
}
|
||||||
|
@@ -8,19 +8,13 @@
|
|||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <fsp/api.h>
|
#include <fsp/api.h>
|
||||||
#include <program_loading.h>
|
#include <program_loading.h>
|
||||||
#include <timestamp.h>
|
#include <romstage_common.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
asmlinkage void car_stage_entry(void)
|
void __noreturn romstage_main(void)
|
||||||
{
|
{
|
||||||
timestamp_add_now(TS_ROMSTAGE_START);
|
|
||||||
|
|
||||||
post_code(0x40);
|
post_code(0x40);
|
||||||
|
|
||||||
console_init();
|
|
||||||
|
|
||||||
post_code(0x42);
|
|
||||||
|
|
||||||
/* Snapshot chipset state prior to any FSP call. */
|
/* Snapshot chipset state prior to any FSP call. */
|
||||||
fill_chipset_state();
|
fill_chipset_state();
|
||||||
|
|
||||||
@@ -33,4 +27,5 @@ asmlinkage void car_stage_entry(void)
|
|||||||
run_ramstage();
|
run_ramstage();
|
||||||
|
|
||||||
post_code(0x50); /* Should never see this post code. */
|
post_code(0x50); /* Should never see this post code. */
|
||||||
|
die("failed to load ramstage\n");
|
||||||
}
|
}
|
||||||
|
@@ -10,18 +10,12 @@
|
|||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <fsp/api.h>
|
#include <fsp/api.h>
|
||||||
#include <program_loading.h>
|
#include <program_loading.h>
|
||||||
#include <timestamp.h>
|
#include <romstage_common.h>
|
||||||
|
|
||||||
asmlinkage void car_stage_entry(void)
|
void __noreturn romstage_main(void)
|
||||||
{
|
{
|
||||||
timestamp_add_now(TS_ROMSTAGE_START);
|
|
||||||
|
|
||||||
post_code(0x40);
|
post_code(0x40);
|
||||||
|
|
||||||
console_init();
|
|
||||||
|
|
||||||
post_code(0x41);
|
|
||||||
|
|
||||||
/* Snapshot chipset state prior to any FSP call */
|
/* Snapshot chipset state prior to any FSP call */
|
||||||
fill_chipset_state();
|
fill_chipset_state();
|
||||||
|
|
||||||
@@ -33,4 +27,5 @@ asmlinkage void car_stage_entry(void)
|
|||||||
memmap_stash_early_dram_usage();
|
memmap_stash_early_dram_usage();
|
||||||
|
|
||||||
run_ramstage();
|
run_ramstage();
|
||||||
|
die("failed to load ramstage\n");
|
||||||
}
|
}
|
||||||
|
@@ -1,28 +1,29 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <acpi/acpi.h>
|
||||||
#include <amdblocks/acpi.h>
|
#include <amdblocks/acpi.h>
|
||||||
|
#include <amdblocks/agesawrapper.h>
|
||||||
|
#include <amdblocks/agesawrapper_call.h>
|
||||||
#include <amdblocks/biosram.h>
|
#include <amdblocks/biosram.h>
|
||||||
#include <device/pci_ops.h>
|
#include <amdblocks/psp.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <arch/romstage.h>
|
#include <arch/romstage.h>
|
||||||
#include <acpi/acpi.h>
|
|
||||||
#include <cpu/x86/msr.h>
|
|
||||||
#include <cpu/x86/mtrr.h>
|
|
||||||
#include <cpu/x86/smm.h>
|
|
||||||
#include <cpu/amd/mtrr.h>
|
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
#include <commonlib/helpers.h>
|
#include <commonlib/helpers.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
#include <cpu/amd/mtrr.h>
|
||||||
|
#include <cpu/x86/msr.h>
|
||||||
|
#include <cpu/x86/mtrr.h>
|
||||||
|
#include <cpu/x86/smm.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <program_loading.h>
|
#include <device/pci_ops.h>
|
||||||
#include <romstage_handoff.h>
|
|
||||||
#include <elog.h>
|
#include <elog.h>
|
||||||
#include <amdblocks/agesawrapper.h>
|
#include <program_loading.h>
|
||||||
#include <amdblocks/agesawrapper_call.h>
|
#include <romstage_common.h>
|
||||||
|
#include <romstage_handoff.h>
|
||||||
#include <soc/northbridge.h>
|
#include <soc/northbridge.h>
|
||||||
#include <soc/pci_devs.h>
|
#include <soc/pci_devs.h>
|
||||||
#include <soc/southbridge.h>
|
#include <soc/southbridge.h>
|
||||||
#include <amdblocks/psp.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
@@ -47,8 +48,7 @@ static void bsp_agesa_call(void)
|
|||||||
set_ap_entry_ptr(agesa_call); /* indicate the path to the AP */
|
set_ap_entry_ptr(agesa_call); /* indicate the path to the AP */
|
||||||
agesa_call();
|
agesa_call();
|
||||||
}
|
}
|
||||||
|
void __noreturn romstage_main(void)
|
||||||
asmlinkage void car_stage_entry(void)
|
|
||||||
{
|
{
|
||||||
msr_t base, mask;
|
msr_t base, mask;
|
||||||
msr_t mtrr_cap = rdmsr(MTRR_CAP_MSR);
|
msr_t mtrr_cap = rdmsr(MTRR_CAP_MSR);
|
||||||
@@ -56,8 +56,6 @@ asmlinkage void car_stage_entry(void)
|
|||||||
int s3_resume = acpi_is_wakeup_s3();
|
int s3_resume = acpi_is_wakeup_s3();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
console_init();
|
|
||||||
|
|
||||||
soc_enable_psp_early();
|
soc_enable_psp_early();
|
||||||
if (CONFIG(SOC_AMD_PSP_SELECTABLE_SMU_FW))
|
if (CONFIG(SOC_AMD_PSP_SELECTABLE_SMU_FW))
|
||||||
psp_load_named_blob(BLOB_SMU_FW, "smu_fw");
|
psp_load_named_blob(BLOB_SMU_FW, "smu_fw");
|
||||||
@@ -121,6 +119,7 @@ asmlinkage void car_stage_entry(void)
|
|||||||
|
|
||||||
post_code(0x44);
|
post_code(0x44);
|
||||||
prepare_and_run_postcar();
|
prepare_and_run_postcar();
|
||||||
|
die("failed to load postcar\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill_postcar_frame(struct postcar_frame *pcf)
|
void fill_postcar_frame(struct postcar_frame *pcf)
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#include <arch/cpu.h>
|
#include <romstage_common.h>
|
||||||
|
#include <halt.h>
|
||||||
|
|
||||||
asmlinkage void car_stage_entry(void)
|
void __noreturn romstage_main(void)
|
||||||
{
|
{
|
||||||
|
/* Needed for __noreturn */
|
||||||
|
halt();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user