Felix Held submitted this change.
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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64297
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
---
M src/arch/x86/ebda.c
D src/arch/x86/include/arch/ebda.h
M src/device/device.c
3 files changed, 16 insertions(+), 30 deletions(-)
diff --git a/src/arch/x86/ebda.c b/src/arch/x86/ebda.c
index 0e3465a0..e576a14 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 <stdint.h>
#include <acpi/acpi.h>
-#include <arch/ebda.h>
+#include <bootstate.h>
#include <commonlib/endian.h>
+#include <stdint.h>
+
+#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 @@
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 @@
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 e625d4a..0000000
--- 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 <stddef.h>
-
-#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 8337d55..ffda588 100644
--- a/src/device/device.c
+++ b/src/device/device.c
@@ -12,9 +12,6 @@
#include <stdlib.h>
#include <string.h>
#include <smp/spinlock.h>
-#if ENV_X86
-#include <arch/ebda.h>
-#endif
#include <timer.h>
/** Pointer to the last device */
@@ -566,11 +563,6 @@
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);
To view, visit change 64297. To unsubscribe, or for help writing mail filters, visit settings.