Skip to contentSkip to conversation

x86: qemu: Change default vesa mode to 1024x768x32

PATCH New Bin Meng 2 participants 15 messages Jun 17, 2018 – Jun 22, 2018 x86

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/5 x86: qemu: Change default vesa mode to 1024x768x32

The default vesa mode was changed since commit 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards") for better VxWorks compatibility but with the changes QEMU video console no longer works. This is because QEMU's vgabios implements the VESA mode 8:8:8 as 24bpp without an alpha channel, which U-Boot's video console driver currently does not support yet.

We need change to real 32bpp in order to make it work again. QEMU vgabios implements the custom 32bpp VESA mode starting from 0x140 (320x200x32) to 0x147 (1600x1200x32). Set it to 0x144 (1024x768x32).

Fixes 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards")

---

 configs/qemu-x86_64_defconfig | 3 ++-
 configs/qemu-x86_defconfig    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
configs/qemu-x86_64_defconfig +2 -1
index d2eb53f..51227f1 100644
@@ -67,5 +67,6 @@ CONFIG_SPL_TIMER=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_112=y
+CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
+CONFIG_FRAMEBUFFER_VESA_MODE=0x144
 CONFIG_CONSOLE_SCROLL_LINES=5
configs/qemu-x86_defconfig +2 -1
index f489d52..7144e9c 100644
@@ -47,5 +47,6 @@ CONFIG_SPI=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
-CONFIG_FRAMEBUFFER_VESA_MODE_112=y
+CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
+CONFIG_FRAMEBUFFER_VESA_MODE=0x144
 CONFIG_CONSOLE_SCROLL_LINES=5
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/5 board_r: Do not initialize IDE when DM BLK is on

With driver model philosophy, we should avoid explicitly calling driver initialization routine during boot. This updates the ram init sequence table to exclude the IDE initialization for DM BLK.

---

 common/board_r.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/board_r.c +2 -2
index 6b29706..6949d4a 100644
@@ -596,7 +596,7 @@ static int initr_pcmcia(void)
 }
 #endif
 
-#if defined(CONFIG_IDE)
+#if defined(CONFIG_IDE) && !defined(CONFIG_BLK)
 static int initr_ide(void)
 {
 	puts("IDE:   ");
@@ -826,7 +826,7 @@ static init_fnc_t init_sequence_r[] = {
 #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_IDE)
 	initr_pcmcia,
 #endif
-#if defined(CONFIG_IDE)
+#if defined(CONFIG_IDE) && !defined(CONFIG_BLK)
 	initr_ide,
 #endif
 #ifdef CONFIG_LAST_STAGE_INIT
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 board_r: Do not initialize IDE when DM BLK is on

Quoted 10 lines · Bin Meng

With driver model philosophy, we should avoid explicitly calling driver initialization routine during boot. This updates the ram init sequence table to exclude the IDE initialization for DM BLK.

---

 common/board_r.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
author
#3 lore raw

PATCH 2/5 board_r: Do not initialize IDE when DM BLK is on

Quoted 5 lines · Simon Glass
Quoted 4 lines · Bin Meng

With driver model philosophy, we should avoid explicitly calling driver initialization routine during boot. This updates the ram init sequence table to exclude the IDE initialization for DM BLK.

Quoted 8 lines
Quoted 6 lines

---

 common/board_r.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

applied to u-boot-x86, thanks!

author
#4 lore raw

PATCH 3/5 efi: stub: Move the use_uart assignment immediately after exit_boot_services() call

In reply to Bin Meng

The use_uart assignment should follow immediately after the call to exit_boot_services(), in case we want some debug output after that.

---

 lib/efi/efi_stub.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/efi/efi_stub.c +3 -3
index 262fc56..1b495ec 100644
@@ -361,14 +361,14 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
 		}
 	}
 
+	/* The EFI UART won't work now, switch to a debug one */
+	use_uart = true;
+
 	map.version = version;
 	map.desc_size = desc_size;
 	add_entry_addr(priv, EFIET_MEMORY_MAP, &map, sizeof(map), desc, size);
 	add_entry_addr(priv, EFIET_END, NULL, 0, 0, 0);
 
-	/* The EFI UART won't work now, switch to a debug one */
-	use_uart = true;
-
 	memcpy((void *)CONFIG_SYS_TEXT_BASE, _binary_u_boot_bin_start,
 	       (ulong)_binary_u_boot_bin_end -
 	       (ulong)_binary_u_boot_bin_start);
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH 4/5 x86: efi-x86_payload: Enumerate PCI bus during early boot

In reply to Bin Meng

The generic efi payload currently does not enumerate the PCI bus, which means peripherals on the PCI bus are not discovered by their drivers. This uses board_early_init_r() to do the PCI enumeration.

---

 board/efi/efi-x86_payload/Kconfig   |  1 +
 board/efi/efi-x86_payload/Makefile  |  2 +-
 board/efi/efi-x86_payload/payload.c | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 board/efi/efi-x86_payload/payload.c
board/efi/efi-x86_payload/Kconfig +1 -0
index b6e57b9..08dd0c2 100644
@@ -17,6 +17,7 @@ config SYS_TEXT_BASE
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
+	select BOARD_EARLY_INIT_R
 	imply SYS_NS16550
 	imply SCSI
 	imply SCSI_AHCI
board/efi/efi-x86_payload/Makefile +1 -1
index 6982340..00ef695 100644
@@ -2,4 +2,4 @@
 #
 # Copyright (C) 2018, Bin Meng <[email protected]>
 
-obj-y	+= start.o
+obj-y	+= start.o payload.o
board/efi/efi-x86_payload/payload.c new file +18 -0
new file mode 100644
index 0000000..4eeb49a
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <[email protected]>
+ */
+
+#include <common.h>
+#include <usb.h>
+
+int board_early_init_r(void)
+{
+	/*
+	 * Make sure PCI bus is enumerated so that peripherals on the PCI bus
+	 * can be discovered by their drivers
+	 */
+	pci_init();
+
+	return 0;
+}
Signature · 1 line
2.7.4
#6 lore raw

PATCH 4/5 x86: efi-x86_payload: Enumerate PCI bus during early boot

Hi Bin,

Quoted 4 lines · Bin Meng

The generic efi payload currently does not enumerate the PCI bus, which means peripherals on the PCI bus are not discovered by their drivers. This uses board_early_init_r() to do the PCI enumeration.

Quoted 8 lines

---

 board/efi/efi-x86_payload/Kconfig   |  1 +
 board/efi/efi-x86_payload/Makefile  |  2 +-
 board/efi/efi-x86_payload/payload.c | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 board/efi/efi-x86_payload/payload.c

I would like to consider adding a mechanism to indicate that a uclass should be inited (and its devices probed) on startup. This would be used for things which provide essential peripherals, which otherwise would not be visible in the initial driver-model bind process.

I am not sure whether this should be:

- a flag in the uclass
- a flag in the BOARD driver (assuming we have a BOARD uclass soon)
- a function call into DM
- something else

But I think it is justified in the case of PCI, since some systems cannot find all their devices without scanning it.

What do you think?

Regards,
Simon

author
#7 lore raw

PATCH 4/5 x86: efi-x86_payload: Enumerate PCI bus during early boot

Hi Simon,

Quoted 16 lines · Simon Glass

Hi Bin,

Quoted 4 lines · Bin Meng

The generic efi payload currently does not enumerate the PCI bus, which means peripherals on the PCI bus are not discovered by their drivers. This uses board_early_init_r() to do the PCI enumeration.

Quoted 8 lines

---

 board/efi/efi-x86_payload/Kconfig   |  1 +
 board/efi/efi-x86_payload/Makefile  |  2 +-
 board/efi/efi-x86_payload/payload.c | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 board/efi/efi-x86_payload/payload.c
Quoted 5 lines

I would like to consider adding a mechanism to indicate that a uclass should be inited (and its devices probed) on startup. This would be used for things which provide essential peripherals, which otherwise would not be visible in the initial driver-model bind process.

Good to know!

Quoted 3 lines

I am not sure whether this should be:

- a flag in the uclass

Only adding a flag to the uclass driver seems not working. On some systems like x86 UCLASS_PCI may be init at boot up, but on other systems this might not be the case. So we need find a place to tell DM to init the uclass driver if the uclass driver has the flag, but where?

Quoted 1 line

- a flag in the BOARD driver (assuming we have a BOARD uclass soon)

The concept of BOARD driver sounds interesting. So does the BOARD uclass driver intend to replace various config options like CONFIG_BOARD_EARLY_INIT_F, CONFIG_BOARD_EARLY_INIT_R, CONFIG_BOARD_LATE_INIT, etc? If we do that, how do we guarantee the init order with other components in board_f.c and board_r.c?

Quoted 1 line

- a function call into DM

Like uclass_first_device()?

Quoted 5 lines

- something else

But I think it is justified in the case of PCI, since some systems cannot find all their devices without scanning it.

Yes, this makes sense for PCI on x86.

Quoted 2 lines

What do you think?

Regards,
Bin

#8 lore raw

PATCH 4/5 x86: efi-x86_payload: Enumerate PCI bus during early boot

Hi Bin,

Quoted 29 lines · Bin Meng

Hi Simon,

Quoted 16 lines · Simon Glass

Hi Bin,

Quoted 4 lines · Bin Meng

The generic efi payload currently does not enumerate the PCI bus, which means peripherals on the PCI bus are not discovered by their drivers. This uses board_early_init_r() to do the PCI enumeration.

Quoted 8 lines

---

 board/efi/efi-x86_payload/Kconfig   |  1 +
 board/efi/efi-x86_payload/Makefile  |  2 +-
 board/efi/efi-x86_payload/payload.c | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 board/efi/efi-x86_payload/payload.c
Quoted 5 lines

I would like to consider adding a mechanism to indicate that a uclass should be inited (and its devices probed) on startup. This would be used for things which provide essential peripherals, which otherwise would not be visible in the initial driver-model bind process.

Good to know!

Quoted 2 lines

I am not sure whether this should be:

Quoted 7 lines
Quoted 1 line

- a flag in the uclass

Only adding a flag to the uclass driver seems not working. On some systems like x86 UCLASS_PCI may be init at boot up, but on other systems this might not be the case. So we need find a place to tell DM to init the uclass driver if the uclass driver has the flag, but where?

Yes I figured. Let's drop this idea.

Quoted 8 lines
Quoted 2 lines

- a flag in the BOARD driver (assuming we have a BOARD uclass soon)

The concept of BOARD driver sounds interesting. So does the BOARD uclass driver intend to replace various config options like CONFIG_BOARD_EARLY_INIT_F, CONFIG_BOARD_EARLY_INIT_R, CONFIG_BOARD_LATE_INIT, etc? If we do that, how do we guarantee the init order with other components in board_f.c and board_r.c?

That's a separate issue, but we could certainly ensure that after all devices are bound, we probe things like PCI, which would bind its devices.

Quoted 4 lines
Quoted 2 lines

- a function call into DM

Like uclass_first_device()?

That's what we have today. I was more thinking of something that tells DM (at the start) which uclasses should be probed. E.g.

uclass_set_auto_probe(UCLASS_PCI, true);

Quoted 8 lines
Quoted 6 lines

- something else

But I think it is justified in the case of PCI, since some systems cannot find all their devices without scanning it.

Yes, this makes sense for PCI on x86.

Anyway the patch is fine, but if you want to try something like the above, please go ahead.

Regards,
Simon

author
#9 lore raw

PATCH 4/5 x86: efi-x86_payload: Enumerate PCI bus during early boot

Quoted 72 lines · Simon Glass

Hi Bin,

Quoted 29 lines · Bin Meng

Hi Simon,

Quoted 16 lines · Simon Glass

Hi Bin,

Quoted 4 lines · Bin Meng

The generic efi payload currently does not enumerate the PCI bus, which means peripherals on the PCI bus are not discovered by their drivers. This uses board_early_init_r() to do the PCI enumeration.

Quoted 8 lines

---

 board/efi/efi-x86_payload/Kconfig   |  1 +
 board/efi/efi-x86_payload/Makefile  |  2 +-
 board/efi/efi-x86_payload/payload.c | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 board/efi/efi-x86_payload/payload.c
Quoted 5 lines

I would like to consider adding a mechanism to indicate that a uclass should be inited (and its devices probed) on startup. This would be used for things which provide essential peripherals, which otherwise would not be visible in the initial driver-model bind process.

Good to know!

Quoted 2 lines

I am not sure whether this should be:

Quoted 7 lines
Quoted 1 line

- a flag in the uclass

Only adding a flag to the uclass driver seems not working. On some systems like x86 UCLASS_PCI may be init at boot up, but on other systems this might not be the case. So we need find a place to tell DM to init the uclass driver if the uclass driver has the flag, but where?

Yes I figured. Let's drop this idea.

Quoted 8 lines
Quoted 2 lines

- a flag in the BOARD driver (assuming we have a BOARD uclass soon)

The concept of BOARD driver sounds interesting. So does the BOARD uclass driver intend to replace various config options like CONFIG_BOARD_EARLY_INIT_F, CONFIG_BOARD_EARLY_INIT_R, CONFIG_BOARD_LATE_INIT, etc? If we do that, how do we guarantee the init order with other components in board_f.c and board_r.c?

That's a separate issue, but we could certainly ensure that after all devices are bound, we probe things like PCI, which would bind its devices.

Quoted 4 lines
Quoted 2 lines

- a function call into DM

Like uclass_first_device()?

That's what we have today. I was more thinking of something that tells DM (at the start) which uclasses should be probed. E.g.

uclass_set_auto_probe(UCLASS_PCI, true);

Quoted 7 lines
Quoted 6 lines

- something else

But I think it is justified in the case of PCI, since some systems cannot find all their devices without scanning it.

Quoted 7 lines
Quoted 1 line

Yes, this makes sense for PCI on x86.

Anyway the patch is fine, but if you want to try something like the above, please go ahead.

applied to u-boot-x86, thanks!

author
#10 lore raw

PATCH 5/5 x86: efi-x86_payload: Enable usb keyboard during boot

In reply to Bin Meng

For boards that don't route serial port pins out, it's quite common to attach a USB keyboard as the input device, along with a monitor. However USB is not automatically started in the generic efi payload codes. This uses a payload specific last_stage_init() to start the USB bus, so that a USB keyboard can be used on the U-Boot shell.

---

 arch/x86/cpu/cpu.c                | 2 +-
 arch/x86/cpu/efi/payload.c        | 9 +++++++++
 include/configs/efi-x86_payload.h | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)
arch/x86/cpu/cpu.c +1 -1
index db36553..6aefa12 100644
@@ -193,7 +193,7 @@ void show_boot_progress(int val)
 	outb(val, POST_PORT);
 }
 
-#ifndef CONFIG_SYS_COREBOOT
+#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB)
 /*
  * Implement a weak default function for boards that optionally
  * need to clean up the system before jumping to the kernel.
arch/x86/cpu/efi/payload.c +9 -0
index 9fd9f57..e3f0f82 100644
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <efi.h>
 #include <errno.h>
+#include <usb.h>
 #include <asm/post.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -160,3 +161,11 @@ int reserve_arch(void)
 
 	return 0;
 }
+
+int last_stage_init(void)
+{
+	/* start usb so that usb keyboard can be used as input device */
+	usb_init();
+
+	return 0;
+}
include/configs/efi-x86_payload.h +1 -1
index 9c62fd2..1cf5c03 100644
@@ -14,7 +14,7 @@
 
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
 
-#define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd\0" \
+#define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd,usbkbd\0" \
 					"stdout=serial,vidconsole\0" \
 					"stderr=serial,vidconsole\0"
 
Signature · 1 line
2.7.4
#11 lore raw

PATCH 5/5 x86: efi-x86_payload: Enable usb keyboard during boot

Quoted 6 lines · Bin Meng

For boards that don't route serial port pins out, it's quite common to attach a USB keyboard as the input device, along with a monitor. However USB is not automatically started in the generic efi payload codes. This uses a payload specific last_stage_init() to start the USB bus, so that a USB keyboard can be used on the U-Boot shell.

Quoted 8 lines

---

 arch/x86/cpu/cpu.c                | 2 +-
 arch/x86/cpu/efi/payload.c        | 9 +++++++++
 include/configs/efi-x86_payload.h | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)
author
#12 lore raw

PATCH 5/5 x86: efi-x86_payload: Enable usb keyboard during boot

Quoted 10 lines · Simon Glass
Quoted 9 lines · Bin Meng

For boards that don't route serial port pins out, it's quite common to attach a USB keyboard as the input device, along with a monitor. However USB is not automatically started in the generic efi payload codes. This uses a payload specific last_stage_init() to start the USB bus, so that a USB keyboard can be used on the U-Boot shell.

---

Quoted 7 lines
Quoted 5 lines
 arch/x86/cpu/cpu.c                | 2 +-
 arch/x86/cpu/efi/payload.c        | 9 +++++++++
 include/configs/efi-x86_payload.h | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

applied to u-boot-x86, thanks!

#13 lore raw

PATCH 1/5 x86: qemu: Change default vesa mode to 1024x768x32

In reply to Bin Meng
Quoted 11 lines · Bin Meng

The default vesa mode was changed since commit 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards") for better VxWorks compatibility but with the changes QEMU video console no longer works. This is because QEMU's vgabios implements the VESA mode 8:8:8 as 24bpp without an alpha channel, which U-Boot's video console driver currently does not support yet.

We need change to real 32bpp in order to make it work again. QEMU vgabios implements the custom 32bpp VESA mode starting from 0x140 (320x200x32) to 0x147 (1600x1200x32). Set it to 0x144 (1024x768x32).

Quoted 7 lines
Fixes 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards")

---

 configs/qemu-x86_64_defconfig | 3 ++-
 configs/qemu-x86_defconfig    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
author
#14 lore raw

PATCH 1/5 x86: qemu: Change default vesa mode to 1024x768x32

Quoted 16 lines · Simon Glass
Quoted 15 lines · Bin Meng

The default vesa mode was changed since commit 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards") for better VxWorks compatibility but with the changes QEMU video console no longer works. This is because QEMU's vgabios implements the VESA mode 8:8:8 as 24bpp without an alpha channel, which U-Boot's video console driver currently does not support yet.

We need change to real 32bpp in order to make it work again. QEMU vgabios implements the custom 32bpp VESA mode starting from 0x140 (320x200x32) to 0x147 (1600x1200x32). Set it to 0x144 (1024x768x32).

Fixes 55b4e1b7d999 ("x86: Change default FRAMEBUFFER_VESA_MODE of some boards")

---

Quoted 5 lines
Quoted 3 lines
 configs/qemu-x86_64_defconfig | 3 ++-
 configs/qemu-x86_defconfig    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

applied to u-boot-x86, thanks!