From 22080e05fc4bcfd8c25474ca3ecfce4814fa486d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 11:15:59 -0600 Subject: x86: spl: Drop unwanted debug() This was left over from some previous debugging. Drop it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/lib/spl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/x86') diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c index b6812bb8ca..55c0615708 100644 --- a/arch/x86/lib/spl.c +++ b/arch/x86/lib/spl.c @@ -137,7 +137,6 @@ static int x86_spl_init(void) } #ifndef CONFIG_SYS_COREBOOT - log_debug("bss\n"); debug("BSS clear from %lx to %lx len %lx\n", (ulong)&__bss_start, (ulong)&__bss_end, (ulong)&__bss_end - (ulong)&__bss_start); memset(&__bss_start, 0, (ulong)&__bss_end - (ulong)&__bss_start); -- cgit v1.2.3 From ea6eef27caba27f8b92b13dda123623d59947ece Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 11:16:01 -0600 Subject: 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 Reviewed-by: Bin Meng Tested-by: Bin Meng # qemu-x86_64 --- 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 (limited to 'arch/x86') diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c index 274978c023..7041455608 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 0000000000..f1e95ffd7a --- /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 55c0615708..f99df08fbe 100644 --- a/arch/x86/lib/spl.c +++ b/arch/x86/lib/spl.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -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; -- cgit v1.2.3 From 1fa64e155d93a9e8a44b34e22390db61bfb24afd Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 11:16:02 -0600 Subject: Revert "x86: Switch QEMU over to use the bochs driver" Unfortunately the bochs driver does not currently work with distros. It causes a hang between grub menu selection and the OS displaying something. Preliminary investigation shows that GRUB does not jump to the kernel at all. This reproduces reliably. This reverts commit b8956425d525c3c25fd218f252f89a5e44df6a9f. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Bin Meng # qemu-x86_64 [Slightly modify the commit message about preliminary investigation] Signed-off-by: Bin Meng --- arch/x86/cpu/qemu/Kconfig | 2 +- configs/qemu-x86_64_defconfig | 4 ++++ configs/qemu-x86_defconfig | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'arch/x86') diff --git a/arch/x86/cpu/qemu/Kconfig b/arch/x86/cpu/qemu/Kconfig index aa329b0dab..f8f2f64730 100644 --- a/arch/x86/cpu/qemu/Kconfig +++ b/arch/x86/cpu/qemu/Kconfig @@ -12,7 +12,7 @@ config QEMU imply SYS_NS16550 imply USB imply USB_EHCI_HCD - imply VIDEO_BOCHS + imply VIDEO_VESA if QEMU diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index 9cf38a5c69..c6f30674a8 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -84,6 +84,10 @@ CONFIG_SPL_DM_RTC=y CONFIG_SYS_NS16550_PORT_MAPPED=y CONFIG_SPI=y CONFIG_USB_KEYBOARD=y +CONFIG_SPL_VIDEO=y +CONFIG_FRAMEBUFFER_SET_VESA_MODE=y +CONFIG_FRAMEBUFFER_VESA_MODE_USER=y +CONFIG_FRAMEBUFFER_VESA_MODE=0x144 CONFIG_CONSOLE_SCROLL_LINES=5 # CONFIG_SPL_USE_TINY_PRINTF is not set CONFIG_GENERATE_ACPI_TABLE=y diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index 95a6ff9ae7..56788cd185 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -53,6 +53,9 @@ CONFIG_NVME_PCI=y CONFIG_SYS_NS16550_PORT_MAPPED=y CONFIG_SPI=y CONFIG_USB_KEYBOARD=y +CONFIG_FRAMEBUFFER_SET_VESA_MODE=y +CONFIG_FRAMEBUFFER_VESA_MODE_USER=y +CONFIG_FRAMEBUFFER_VESA_MODE=0x144 CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_GENERATE_ACPI_TABLE=y # CONFIG_GZIP is not set -- cgit v1.2.3 From 4099df48a68fdfdc4b1d57a503679b35e724de4e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 11:16:04 -0600 Subject: x86: Correct copying of BIOS mode information This is copying beyond the end of the destination buffer. Correct the code by using the size of the vesa_mode_info struct. We don't need to copy the rest of the bytes in the buffer. This long-standing bug prevents virtio bootdevs working correctly on qemu-x86 at present. Fixes: 0ca2426beae ("x86: Add support for running option ROMs natively") Signed-off-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Bin Meng # qemu-x86_64 --- arch/x86/lib/bios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/x86') diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c index e29cae78e5..f146bbd542 100644 --- a/arch/x86/lib/bios.c +++ b/arch/x86/lib/bios.c @@ -204,7 +204,7 @@ static u8 vbe_get_mode_info(struct vesa_state *mi) realmode_interrupt(0x10, VESA_GET_MODE_INFO, 0x0000, mi->video_mode, 0x0000, buffer_seg, buffer_adr); - memcpy(mi->mode_info_block, buffer, sizeof(struct vesa_state)); + memcpy(mi->mode_info_block, buffer, sizeof(struct vesa_mode_info)); mi->valid = true; return 0; -- cgit v1.2.3 From edd53bda53b9489aafe6b728b2b71044bb92f248 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 21:01:47 -0600 Subject: x86: Drop CFG_SYS_STACK_SIZE This is only used in one file and the value is the same for both boards which define it. Use the fixed value of 32KB and drop the CFG. This will allow removal of the config.h files. Signed-off-by: Simon Glass Reviewed-by: Andy Shevchenko # Intel Edison Reviewed-by: Bin Meng --- arch/x86/lib/physmem.c | 3 ++- include/configs/edison.h | 4 ---- include/configs/x86-common.h | 10 ---------- 3 files changed, 2 insertions(+), 15 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/lib/physmem.c b/arch/x86/lib/physmem.c index 1eb97ac5bb..382f768149 100644 --- a/arch/x86/lib/physmem.c +++ b/arch/x86/lib/physmem.c @@ -14,6 +14,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -144,7 +145,7 @@ static void x86_phys_memset_page(phys_addr_t map_addr, uintptr_t offset, int c, /* Make sure the window is below U-Boot. */ assert(window + LARGE_PAGE_SIZE < - gd->relocaddr - CONFIG_SYS_MALLOC_LEN - CFG_SYS_STACK_SIZE); + gd->relocaddr - CONFIG_SYS_MALLOC_LEN - SZ_32K); /* Map the page into the window and then memset the appropriate part. */ x86_phys_map_page(window, map_addr, 1); memset((void *)(window + offset), c, size); diff --git a/include/configs/edison.h b/include/configs/edison.h index 455a889b64..558c74d7b4 100644 --- a/include/configs/edison.h +++ b/include/configs/edison.h @@ -8,8 +8,4 @@ #include -/* Miscellaneous configurable options */ - -#define CFG_SYS_STACK_SIZE (32 * 1024) - #endif diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h index c1c5a09a35..608c5ba7b0 100644 --- a/include/configs/x86-common.h +++ b/include/configs/x86-common.h @@ -10,16 +10,6 @@ #ifndef __CONFIG_X86_COMMON_H #define __CONFIG_X86_COMMON_H -/*----------------------------------------------------------------------- - * CPU Features - */ - -#define CFG_SYS_STACK_SIZE (32 * 1024) - -/*----------------------------------------------------------------------- - * Environment configuration - */ - /*----------------------------------------------------------------------- * USB configuration */ -- cgit v1.2.3 From dbfb6c096ed1088b3fa2eb9a140393089a3bd731 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 21:01:48 -0600 Subject: x86: i8254: Include required ibmpc.h header This is needed for this file, so include it here explicitly. Signed-off-by: Simon Glass Reviewed-by: Andy Shevchenko # Intel Edison Reviewed-by: Bin Meng --- arch/x86/lib/i8254.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/x86') diff --git a/arch/x86/lib/i8254.c b/arch/x86/lib/i8254.c index 0f97538910..a8d1db188e 100644 --- a/arch/x86/lib/i8254.c +++ b/arch/x86/lib/i8254.c @@ -7,6 +7,7 @@ #include #include #include +#include #define TIMER1_VALUE 18 /* 15.6us */ #define BEEP_FREQUENCY_HZ 440 -- cgit v1.2.3 From 3cc409536232017cb69a2339c3d9c7e7a3d3d096 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 30 Jul 2023 21:02:04 -0600 Subject: x86: qemu: Add required linux/sizes.h include These files rely on the config.h file provided this include. Add it explictily so we can move to a text environment. Signed-off-by: Simon Glass Reviewed-by: Andy Shevchenko # Intel Edison Reviewed-by: Bin Meng --- arch/x86/cpu/qemu/dram.c | 1 + arch/x86/cpu/qemu/e820.c | 1 + 2 files changed, 2 insertions(+) (limited to 'arch/x86') diff --git a/arch/x86/cpu/qemu/dram.c b/arch/x86/cpu/qemu/dram.c index 595c397d4a..1a52d1dc52 100644 --- a/arch/x86/cpu/qemu/dram.c +++ b/arch/x86/cpu/qemu/dram.c @@ -8,6 +8,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c index 19e54c5202..ebfe595644 100644 --- a/arch/x86/cpu/qemu/e820.c +++ b/arch/x86/cpu/qemu/e820.c @@ -12,6 +12,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; -- cgit v1.2.3