summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-05-12 20:39:16 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-05-17 11:24:12 +0000
commit0a635ab1e875bc96c8c00221659f6e75b4e1db14 (patch)
tree54eb8ca94c8dbc3076db7a6064d352888f4fb39b /src/arch
parent82a8d8172ceef623b78a27bf00b4b9c084623501 (diff)
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>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/ebda.c19
-rw-r--r--src/arch/x86/include/arch/ebda.h19
2 files changed, 16 insertions, 22 deletions
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 <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 @@ 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 <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