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>
This commit is contained in:
Arthur Heymans 2022-05-12 20:39:16 +02:00 committed by Felix Held
parent 82a8d8172c
commit 0a635ab1e8
3 changed files with 16 additions and 30 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 @@ 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);