Skip to content

Commit

Permalink
Revert "Agesa bootblock"
Browse files Browse the repository at this point in the history
  • Loading branch information
miczyg1 authored Nov 25, 2020
1 parent 580c883 commit d120418
Show file tree
Hide file tree
Showing 19 changed files with 337 additions and 354 deletions.
1 change: 0 additions & 1 deletion src/cpu/x86/lapic/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ bootblock-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
romstage-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
ramstage-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
postcar-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
verstage_x86-$(CONFIG_UDELAY_LAPIC) += apic_timer.c
bootblock-y += boot_cpu.c
verstage_x86-y += boot_cpu.c
romstage-y += boot_cpu.c
Expand Down
3 changes: 0 additions & 3 deletions src/drivers/amd/agesa/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ ramstage-y += state_machine.c

bootblock-y += bootblock.c
bootblock-y += cache_as_ram.S
bootblock-y += state_machine.c
bootblock-y += def_callouts.c
bootblock-y += eventlog.c

postcar-y += exit_car.S

Expand Down
45 changes: 4 additions & 41 deletions src/drivers/amd/agesa/bootblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@

#include <bootblock_common.h>
#include <halt.h>
#include <string.h>
#include <acpi/acpi.h>
#include <amdblocks/amd_pci_mmconf.h>
#include <amdblocks/biosram.h>
#include <arch/bootblock.h>
#include <arch/cpu.h>
#include <cpu/amd/msr.h>
#include <cpu/x86/mtrr.h>
#include <cpu/x86/lapic.h>
#include <northbridge/amd/agesa/agesa_helper.h>
#include <northbridge/amd/agesa/state_machine.h>

#define EARLY_VMTRR_FLASH 6

void __weak board_BeforeAgesa(struct sysinfo *cb) { }

static void set_early_mtrrs(void)
{
/* Cache the ROM to speed up booting */
Expand All @@ -29,39 +23,6 @@ void bootblock_soc_early_init(void)
bootblock_early_southbridge_init();
}

static void fill_sysinfo(struct sysinfo *cb)
{
memset(cb, 0, sizeof(*cb));
cb->s3resume = acpi_is_wakeup_s3();

agesa_set_interface(cb);
}

void bootblock_soc_init(void)
{
struct sysinfo bootblock_state;
struct sysinfo *cb = &bootblock_state;
u8 initial_apic_id = (u8) (cpuid_ebx(1) >> 24);

fill_sysinfo(cb);

if (initial_apic_id == 0) {
board_BeforeAgesa(cb);
console_init();
}

printk(BIOS_DEBUG, "APIC %02d: CPU Family_Model = %08x\n",
initial_apic_id, cpuid_eax(1));

agesa_execute_state(cb, AMD_INIT_RESET);

agesa_execute_state(cb, AMD_INIT_EARLY);

/* APs shall not get here */
if (initial_apic_id != 0)
halt();
}

asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
{
enable_pci_mmconf();
Expand All @@ -81,5 +42,7 @@ asmlinkage void ap_bootblock_c_entry(void)
if (CONFIG(UDELAY_LAPIC))
enable_lapic();

bootblock_soc_init();
void (*ap_romstage_entry)(void) = get_ap_entry_ptr();
ap_romstage_entry(); /* execution does not return */
halt();
}
39 changes: 38 additions & 1 deletion src/drivers/amd/agesa/romstage.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <northbridge/amd/agesa/agesa_helper.h>
#include <northbridge/amd/agesa/state_machine.h>

void __weak board_BeforeAgesa(struct sysinfo *cb) { }

static void fill_sysinfo(struct sysinfo *cb)
{
memset(cb, 0, sizeof(*cb));
Expand All @@ -23,6 +25,11 @@ static void fill_sysinfo(struct sysinfo *cb)
agesa_set_interface(cb);
}

/* APs will enter directly here from bootblock, bypassing verstage
* and potential fallback / normal bootflow detection.
*/
static void ap_romstage_main(void);

static void romstage_main(void)
{
struct postcar_frame pcf;
Expand All @@ -33,8 +40,23 @@ static void romstage_main(void)

fill_sysinfo(cb);

if (initial_apic_id == 0)
if (initial_apic_id == 0) {

timestamp_add_now(TS_START_ROMSTAGE);

board_BeforeAgesa(cb);

console_init();
}

printk(BIOS_DEBUG, "APIC %02d: CPU Family_Model = %08x\n",
initial_apic_id, cpuid_eax(1));

set_ap_entry_ptr(ap_romstage_main);

agesa_execute_state(cb, AMD_INIT_RESET);

agesa_execute_state(cb, AMD_INIT_EARLY);

timestamp_add_now(TS_BEFORE_INITRAM);

Expand Down Expand Up @@ -66,6 +88,21 @@ static void romstage_main(void)
/* We do not return. */
}

static void ap_romstage_main(void)
{
struct sysinfo romstage_state;
struct sysinfo *cb = &romstage_state;

fill_sysinfo(cb);

agesa_execute_state(cb, AMD_INIT_RESET);

agesa_execute_state(cb, AMD_INIT_EARLY);

/* Not reached. */
halt();
}

asmlinkage void car_stage_entry(void)
{
romstage_main();
Expand Down
19 changes: 3 additions & 16 deletions src/drivers/amd/agesa/state_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,9 @@ static void agesa_locate_image(AMD_CONFIG_PARAMS *StdHeader)
const char ModuleIdentifier[] = AGESA_ID;
const void *agesa, *image;
size_t file_size;
uint32_t cbfs_type = CBFS_TYPE_RAW;
struct cbfsf fh;

if (CONFIG(VBOOT)) {
if (cbfs_locate_file_in_region(&fh, "COREBOOT",
(const char *)CONFIG_AGESA_CBFS_NAME,
&cbfs_type) < 0) {
die("AGESA not found!");
}
file_size = region_device_sz(&fh.data);
agesa = rdev_mmap_full(&fh.data);
} else {
agesa = cbfs_boot_map_with_leak((const char *)CONFIG_AGESA_CBFS_NAME,
CBFS_TYPE_RAW, &file_size);
}

agesa = cbfs_boot_map_with_leak((const char *)CONFIG_AGESA_CBFS_NAME,
CBFS_TYPE_RAW, &file_size);
if (agesa == NULL)
return;

Expand Down Expand Up @@ -276,7 +263,7 @@ int agesa_execute_state(struct sysinfo *cb, AGESA_STRUCT_NAME func)
if (CONFIG(AGESA_EXTRA_TIMESTAMPS) && task.ts_entry_id)
timestamp_add_now(task.ts_entry_id);

if (ENV_ROMSTAGE || ENV_BOOTBLOCK)
if (ENV_ROMSTAGE)
final = romstage_dispatch(cb, func, StdHeader);

if (ENV_RAMSTAGE)
Expand Down
11 changes: 6 additions & 5 deletions src/mainboard/pcengines/apu2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,30 +119,31 @@ config FMDFILE

config CBFS_SIZE
hex
default 0x0020C000 if VBOOT
default 0x00800000

config VBOOT
select VBOOT_VBNV_FLASH
select VBOOT_VBNV_CMOS
select VBOOT_NO_BOARD_SUPPORT
select GBB_FLAG_DISABLE_LID_SHUTDOWN
select GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC
select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC
select GBB_FLAG_DISABLE_FWMP
select RTC
select VBOOT_STARTS_IN_BOOTBLOCK
select VBOOT_SEPARATE_VERSTAGE
select VBOOT_STARTS_IN_ROMSTAGE
select AMDFW_OUTSIDE_CBFS

config VBOOT_MEASURED_BOOT_RUNTIME_DATA
string
default "bootorder" if VBOOT

config VBOOT_VBNV_OFFSET
hex
default 0x2D8 if VBOOT_VBNV_CMOS
default 0x2D8 if VBOOT

config RO_REGION_ONLY
string
default "AGESA apu/amdfw" if VBOOT
default "spd.bin AGESA" if VBOOT

config AGESA_USE_1_0_0_4_HEADER
bool
Expand Down
6 changes: 0 additions & 6 deletions src/mainboard/pcengines/apu2/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
bootblock-y += pmutil.c
bootblock-y += bootblock.c
bootblock-y += bios_knobs.c
bootblock-y += BiosCallOuts.c
bootblock-y += OemCustomize.c
bootblock-y += gpio_ftns.c

verstage-y += pmutil.c
verstage-y += bios_knobs.c

romstage-y += bios_knobs.c
romstage-y += BiosCallOuts.c
Expand Down
Loading

0 comments on commit d120418

Please sign in to comment.