x86: Run QEMU machine setup in SPL

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@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64
This commit is contained in:
Simon Glass 2023-07-30 11:16:01 -06:00 committed by Bin Meng
parent d5a3f14c23
commit ea6eef27ca
3 changed files with 18 additions and 1 deletions

View file

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

View file

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

View file

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