[PATCH v2 3/9] x86: Run QEMU machine setup in SPL
Simon Glass
sjg at chromium.org
Sun Jul 30 19:16:01 CEST 2023
Call the hardware-init function from QEMU from SPL. This allows the video
BIOS to operate correctly.
Create an x86-wide qemu.h header to avoid having to #ifdef the header in
spl.c
Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
---
Changes in v2:
- Drop unnecessary IS_ENABLED(CONFIG_X86)
arch/x86/cpu/qemu/qemu.c | 2 +-
arch/x86/include/asm/qemu.h | 14 ++++++++++++++
arch/x86/lib/spl.c | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 arch/x86/include/asm/qemu.h
diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c
index 274978c023b6..70414556086c 100644
--- a/arch/x86/cpu/qemu/qemu.c
+++ b/arch/x86/cpu/qemu/qemu.c
@@ -48,7 +48,7 @@ static void enable_pm_ich9(void)
pci_write_config32(ICH9_PM, PMBA, CONFIG_ACPI_PM1_BASE | 1);
}
-static void qemu_chipset_init(void)
+void qemu_chipset_init(void)
{
u16 device, xbcs;
int pam, i;
diff --git a/arch/x86/include/asm/qemu.h b/arch/x86/include/asm/qemu.h
new file mode 100644
index 000000000000..f1e95ffd7a4d
--- /dev/null
+++ b/arch/x86/include/asm/qemu.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Generic QEMU header
+ *
+ * Copyright 2023 Google LLC
+ */
+
+#ifndef __QEMU_H
+#define __QEMU_H
+
+/* set up the chipset for QEMU so that video can be used */
+void qemu_chipset_init(void);
+
+#endif
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index 55c061570864..f99df08fbece 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -27,6 +27,7 @@
#include <asm/mtrr.h>
#include <asm/pci.h>
#include <asm/processor.h>
+#include <asm/qemu.h>
#include <asm/spl.h>
#include <asm-generic/sections.h>
@@ -291,6 +292,8 @@ void spl_board_init(void)
#ifndef CONFIG_TPL
preloader_console_init();
#endif
+ if (IS_ENABLED(CONFIG_QEMU))
+ qemu_chipset_init();
if (CONFIG_IS_ENABLED(VIDEO)) {
struct udevice *dev;
--
2.41.0.487.g6d72f3e995-goog
More information about the U-Boot
mailing list