From 0a635ab1e875bc96c8c00221659f6e75b4e1db14 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 12 May 2022 20:39:16 +0200 Subject: [PATCH] arch/x86/ebda.c: Move setting up ebda to a BS hook device.c should not hold arch specific code. Change-Id: I9dfdb905a83916c0e9d298e1c38da89f6bc5e038 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/64297 Tested-by: build bot (Jenkins) Reviewed-by: Elyes Haouas Reviewed-by: Werner Zeh --- src/arch/x86/ebda.c | 19 ++++++++++++++++--- src/arch/x86/include/arch/ebda.h | 19 ------------------- src/device/device.c | 8 -------- 3 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 src/arch/x86/include/arch/ebda.h diff --git a/src/arch/x86/ebda.c b/src/arch/x86/ebda.c index 0e3465a040..e576a14791 100644 --- a/src/arch/x86/ebda.c +++ b/src/arch/x86/ebda.c @@ -1,9 +1,19 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include -#include +#include #include +#include + +#define X86_BDA_SIZE 0x200 +#define X86_BDA_BASE ((void *)0x400) +#define X86_EBDA_SEGMENT ((void *)0x40e) +#define X86_EBDA_LOWMEM ((void *)0x413) + +#define DEFAULT_EBDA_LOWMEM (1024 << 10) +#define DEFAULT_EBDA_SEGMENT 0xF600 +#define DEFAULT_EBDA_SIZE 0x400 + static void *get_ebda_start(void) { @@ -40,7 +50,7 @@ static void setup_ebda(u32 low_memory_size, u16 ebda_segment, u16 ebda_size) write_le16(ebda, ebda_kb); } -void setup_default_ebda(void) +static void setup_default_ebda(void *unused) { if (acpi_is_wakeup_s3()) return; @@ -49,3 +59,6 @@ void setup_default_ebda(void) DEFAULT_EBDA_SEGMENT, DEFAULT_EBDA_SIZE); } + +/* Ensure EBDA is prepared before Option ROMs. */ +BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_ENTRY, setup_default_ebda, NULL); diff --git a/src/arch/x86/include/arch/ebda.h b/src/arch/x86/include/arch/ebda.h deleted file mode 100644 index e625d4a305..0000000000 --- a/src/arch/x86/include/arch/ebda.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef __ARCH_EBDA_H -#define __ARCH_EBDA_H - -#include - -#define X86_BDA_SIZE 0x200 -#define X86_BDA_BASE ((void *)0x400) -#define X86_EBDA_SEGMENT ((void *)0x40e) -#define X86_EBDA_LOWMEM ((void *)0x413) - -#define DEFAULT_EBDA_LOWMEM (1024 << 10) -#define DEFAULT_EBDA_SEGMENT 0xF600 -#define DEFAULT_EBDA_SIZE 0x400 - -void setup_default_ebda(void); - -#endif diff --git a/src/device/device.c b/src/device/device.c index 8337d55300..ffda588d63 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -12,9 +12,6 @@ #include #include #include -#if ENV_X86 -#include -#endif #include /** Pointer to the last device */ @@ -566,11 +563,6 @@ void dev_initialize(void) printk(BIOS_INFO, "Initializing devices...\n"); -#if ENV_X86 - /* Ensure EBDA is prepared before Option ROMs. */ - setup_default_ebda(); -#endif - /* First call the mainboard init. */ init_dev(&dev_root);