Skip to contentSkip to conversation

x86: qemu: Adjust VGA initialization

PATCH New Bin Meng 2 participants 24 messages May 25, 2015 – Jun 2, 2015 1 message not in the archive x86

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Bin Meng

author
#1 lore raw

PATCH 2/6 x86: qemu: Adjust VGA initialization

As VGA option rom needs to run at C segment, although QEMU PAM emulation seems to only guard E/F segments, for correctness, move VGA initialization after PAM decode C/D/E/F segments.

Also since we already tested QEMU targets to differentiate I440FX and Q35 platforms, change to locate the VGA device via hardcoded b.d.f instead of dynamic search for its vendor id & device id pair.

---

 arch/x86/cpu/qemu/pci.c                 | 34 +++++++++++++++------------------
 arch/x86/include/asm/arch-qemu/device.h |  2 ++
 2 files changed, 17 insertions(+), 19 deletions(-)
arch/x86/cpu/qemu/pci.c +15 -19
index 467d51d..1a9140b 100644
@@ -50,27 +50,10 @@ void board_pci_setup_hose(struct pci_controller *hose)
 int board_pci_post_scan(struct pci_controller *hose)
 {
 	int ret = 0;
-	ulong start;
-	pci_dev_t bdf;
-	struct pci_device_id graphic_card[] = { { 0x1234, 0x1111 } };
 	u16 device;
 	int pam, i;
-
-	/*
-	 * QEMU emulated graphic card shows in the PCI configuration space with
-	 * PCI vendor id and device id as an artificial pair 0x1234:0x1111.
-	 * It is on PCI bus 0, function 0, but device number is not consistent
-	 * for the two x86 targets it supports. For i440FX and PIIX chipset
-	 * board, it shows as device 2, while for Q35 and ICH9 chipset board,
-	 * it shows as device 1. Here we locate its bdf at run-time based on
-	 * its vendor id and device id pair so we can support both boards.
-	 */
-	bdf = pci_find_devices(graphic_card, 0);
-	if (bdf != -1) {
-		start = get_timer(0);
-		ret = pci_run_vga_bios(bdf, NULL, PCI_ROM_USE_NATIVE);
-		debug("BIOS ran in %lums\n", get_timer(start));
-	}
+	pci_dev_t vga;
+	ulong start;
 
 	/*
 	 * i440FX and Q35 chipset have different PAM register offset, but with
@@ -101,5 +84,18 @@ int board_pci_post_scan(struct pci_controller *hose)
 		x86_pci_write_config16(PIIX_IDE, IDE1_TIM, IDE_DECODE_EN);
 	}
 
+	/*
+	 * QEMU emulated graphic card shows in the PCI configuration space with
+	 * PCI vendor id and device id as an artificial pair 0x1234:0x1111.
+	 * It is on PCI bus 0, function 0, but device number is not consistent
+	 * for the two x86 targets it supports. For i440FX and PIIX chipset
+	 * board, it shows as device 2, while for Q35 and ICH9 chipset board,
+	 * it shows as device 1.
+	 */
+	vga = (device == PCI_DEVICE_ID_INTEL_82441) ? I440FX_VGA : Q35_VGA;
+	start = get_timer(0);
+	ret = pci_run_vga_bios(vga, NULL, PCI_ROM_USE_NATIVE);
+	debug("BIOS ran in %lums\n", get_timer(start));
+
 	return ret;
 }
arch/x86/include/asm/arch-qemu/device.h +2 -0
index 2a8d460..75a435e 100644
@@ -13,7 +13,9 @@
 #define PIIX_ISA	PCI_BDF(0, 1, 0)
 #define PIIX_IDE	PCI_BDF(0, 1, 1)
 #define PIIX_USB	PCI_BDF(0, 1, 2)
+#define I440FX_VGA	PCI_BDF(0, 2, 0)
 
 #define QEMU_Q35	PCI_BDF(0, 0, 0)
+#define Q35_VGA		PCI_BDF(0, 1, 0)
 
 #endif /* _QEMU_DEVICE_H_ */
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH 2/6 x86: qemu: Adjust VGA initialization

Quoted 8 lines · Bin Meng

As VGA option rom needs to run at C segment, although QEMU PAM emulation seems to only guard E/F segments, for correctness, move VGA initialization after PAM decode C/D/E/F segments.

Also since we already tested QEMU targets to differentiate I440FX and Q35 platforms, change to locate the VGA device via hardcoded b.d.f instead of dynamic search for its vendor id & device id pair.

Quoted 6 lines

---

 arch/x86/cpu/qemu/pci.c                 | 34 +++++++++++++++------------------
 arch/x86/include/asm/arch-qemu/device.h |  2 ++
 2 files changed, 17 insertions(+), 19 deletions(-)
#3 lore raw

PATCH 2/6 x86: qemu: Adjust VGA initialization

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

As VGA option rom needs to run at C segment, although QEMU PAM emulation seems to only guard E/F segments, for correctness, move VGA initialization after PAM decode C/D/E/F segments.

Also since we already tested QEMU targets to differentiate I440FX and Q35 platforms, change to locate the VGA device via hardcoded b.d.f instead of dynamic search for its vendor id & device id pair.

Quoted 8 lines
Quoted 6 lines

---

 arch/x86/cpu/qemu/pci.c                 | 34 +++++++++++++++------------------
 arch/x86/include/asm/arch-qemu/device.h |  2 ++
 2 files changed, 17 insertions(+), 19 deletions(-)

Applied to u-boot-x86, thanks!

author
#4 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

In reply to a message not in the archive

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -4
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
 		wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
 		mtrr_close(&state);
 	}
-
-	/* Issue SMI to Coreboot to lock down ME and registers */
-	printf("Finalizing Coreboot\n");
-	outb(0xcb, 0xb2);
 }
 
 void panic_puts(const char *str)
Signature · 1 line
1.8.2.1
#5 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Bin,

Quoted 25 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -5
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
 void panic_puts(const char *str)
--
Quoted 2 lines

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

Regards,
Simon

author
#6 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -4
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/coreboot/coreboot.c +0 -1
 void panic_puts(const char *str)
--

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

I am not sure if the lock down should be done by the coreboot in the first place. IMHO U-Boot as the coreboot payload should not touch such low-level stuff.

Regards,
Bin

#7 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Bin,

Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -4
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/coreboot/coreboot.c +0 -1
 void panic_puts(const char *str)
--

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

Quoted 3 lines

I am not sure if the lock down should be done by the coreboot in the first place. IMHO U-Boot as the coreboot payload should not touch such low-level stuff.

Well it is telling coreboot that it is about to boot the kernel. I think this is an x86 thing and we should support it.

Regards,
Simon

author
#8 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Bin,

Quoted 38 lines · Bin Meng

Hi Simon,

Quoted 34 lines · Simon Glass

Hi Bin,

Quoted 25 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -5
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
 void panic_puts(const char *str)
--
Quoted 2 lines

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

Quoted 7 lines
Quoted 3 lines

I am not sure if the lock down should be done by the coreboot in the first place. IMHO U-Boot as the coreboot payload should not touch such low-level stuff.

Well it is telling coreboot that it is about to boot the kernel. I think this is an x86 thing and we should support it.

What happens if coreboot directly boot into the kernel? Does coreboot do the same 'outb(0xcb, 0xb2)' thing before jumping to kernel? My understanding is that coreboot payload is to enhance coreboot's functionality as a system BIOS (either having legacy BIOS interface with the help of a SeaBIOS payload, or having UEFI interface with the help of a TinaoCore payload). coreboot itself does the mainboard initialization and payload does something that is not hardware dependent.

Regards,
Bin

#9 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Bin,

Quoted 48 lines · Bin Meng

Hi Simon,

Quoted 45 lines · Simon Glass

Hi Bin,

Quoted 41 lines · Bin Meng

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -4
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/coreboot/coreboot.c +0 -1
 void panic_puts(const char *str)
--

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

I am not sure if the lock down should be done by the coreboot in the first place. IMHO U-Boot as the coreboot payload should not touch such low-level stuff.

Quoted 6 lines
Quoted 3 lines

Well it is telling coreboot that it is about to boot the kernel. I think this is an x86 thing and we should support it.

What happens if coreboot directly boot into the kernel? Does coreboot do the same 'outb(0xcb, 0xb2)' thing before jumping to kernel? My

Kind of, although in that case it is just a function call within coreboot.

Quoted 6 lines

understanding is that coreboot payload is to enhance coreboot's functionality as a system BIOS (either having legacy BIOS interface with the help of a SeaBIOS payload, or having UEFI interface with the help of a TinaoCore payload). coreboot itself does the mainboard initialization and payload does something that is not hardware dependent.

Right, but we need to tell coreboot that we have finished with the ME / registers, etc. It can't lock them before calling U-Boot since we may adjust them.

Regards,
Simon

author
#10 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Bin,

Quoted 48 lines · Bin Meng

Hi Simon,

Quoted 45 lines · Simon Glass

Hi Bin,

Quoted 41 lines · Bin Meng

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -4
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/coreboot/coreboot.c +0 -1
 void panic_puts(const char *str)
--

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

I am not sure if the lock down should be done by the coreboot in the first place. IMHO U-Boot as the coreboot payload should not touch such low-level stuff.

Quoted 6 lines
Quoted 3 lines

Well it is telling coreboot that it is about to boot the kernel. I think this is an x86 thing and we should support it.

What happens if coreboot directly boot into the kernel? Does coreboot do the same 'outb(0xcb, 0xb2)' thing before jumping to kernel? My

Kind of, although in that case it is just a function call within coreboot.

Quoted 6 lines

understanding is that coreboot payload is to enhance coreboot's functionality as a system BIOS (either having legacy BIOS interface with the help of a SeaBIOS payload, or having UEFI interface with the help of a TinaoCore payload). coreboot itself does the mainboard initialization and payload does something that is not hardware dependent.

Quoted 4 lines

Right, but we need to tell coreboot that we have finished with the ME / registers, etc. It can't lock them before calling U-Boot since we may adjust them.

Will use a config option in the device tree in v2.

Regards,
Bin

#11 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Bin,

Quoted 70 lines · Bin Meng

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Bin,

Quoted 48 lines · Bin Meng

Hi Simon,

Quoted 45 lines · Simon Glass

Hi Bin,

Quoted 41 lines · Bin Meng

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -4
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/coreboot/coreboot.c +0 -1
 void panic_puts(const char *str)
--

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

I am not sure if the lock down should be done by the coreboot in the first place. IMHO U-Boot as the coreboot payload should not touch such low-level stuff.

Quoted 6 lines
Quoted 3 lines

Well it is telling coreboot that it is about to boot the kernel. I think this is an x86 thing and we should support it.

What happens if coreboot directly boot into the kernel? Does coreboot do the same 'outb(0xcb, 0xb2)' thing before jumping to kernel? My

Kind of, although in that case it is just a function call within coreboot.

Quoted 6 lines

understanding is that coreboot payload is to enhance coreboot's functionality as a system BIOS (either having legacy BIOS interface with the help of a SeaBIOS payload, or having UEFI interface with the help of a TinaoCore payload). coreboot itself does the mainboard initialization and payload does something that is not hardware dependent.

Quoted 6 lines
Quoted 4 lines

Right, but we need to tell coreboot that we have finished with the ME / registers, etc. It can't lock them before calling U-Boot since we may adjust them.

Will use a config option in the device tree in v2.

OK thanks. When you resend can you please rebase on x86/master?

Regards,
Simon

author
#12 lore raw

PATCH 3/6 x86: coreboot: Don't write I/O port 0xb2 for QEMU targets

Hi Simon,

Quoted 73 lines · Simon Glass

Hi Bin,

Quoted 70 lines · Bin Meng

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Bin,

Quoted 48 lines · Bin Meng

Hi Simon,

Quoted 45 lines · Simon Glass

Hi Bin,

Quoted 41 lines · Bin Meng

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Bin,

Quoted 23 lines · Bin Meng

Writing 0xcb to I/O port 0xb2 (Advanced Power Management Control) causes U-Boot to hang on QEMU q35 target. Disable the writing for QEMU targets.

---

 arch/x86/cpu/coreboot/coreboot.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +0 -4
index 4cdd0d4..2234cf0 100644
@@ -85,10 +85,6 @@ void board_final_cleanup(void)
                wrmsrl(MTRR_PHYS_MASK_MSR(top_mtrr), 0);
                mtrr_close(&state);
        }
-
-       /* Issue SMI to Coreboot to lock down ME and registers */
-       printf("Finalizing Coreboot\n");
-       outb(0xcb, 0xb2);
 }
 
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/coreboot/coreboot.c +0 -1
 void panic_puts(const char *str)
--

1.8.2.1

But how does this run with coreboot on platforms that need it? Should this be controlled by a device tree settings, perhaps?

I am not sure if the lock down should be done by the coreboot in the first place. IMHO U-Boot as the coreboot payload should not touch such low-level stuff.

Quoted 6 lines
Quoted 3 lines

Well it is telling coreboot that it is about to boot the kernel. I think this is an x86 thing and we should support it.

What happens if coreboot directly boot into the kernel? Does coreboot do the same 'outb(0xcb, 0xb2)' thing before jumping to kernel? My

Kind of, although in that case it is just a function call within coreboot.

Quoted 6 lines

understanding is that coreboot payload is to enhance coreboot's functionality as a system BIOS (either having legacy BIOS interface with the help of a SeaBIOS payload, or having UEFI interface with the help of a TinaoCore payload). coreboot itself does the mainboard initialization and payload does something that is not hardware dependent.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

Right, but we need to tell coreboot that we have finished with the ME / registers, etc. It can't lock them before calling U-Boot since we may adjust them.

Will use a config option in the device tree in v2.

OK thanks. When you resend can you please rebase on x86/master?

Yes, already rebased :-)

Regards,
Bin

author
#13 lore raw

PATCH 4/6 x86: coreboot: Fix cosmetic issues

In reply to a message not in the archive

Clean up arch/x86/cpu/coreboot.c to fix several cosmetic issues.

---

 arch/x86/cpu/coreboot/coreboot.c  | 26 ++------------------------
 arch/x86/include/asm/u-boot-x86.h |  1 -
 2 files changed, 2 insertions(+), 25 deletions(-)
arch/x86/cpu/coreboot/coreboot.c +2 -24
index 2234cf0..12b07bf 100644
@@ -7,16 +7,9 @@
  */
 
 #include <common.h>
-#include <asm/u-boot-x86.h>
-#include <flash.h>
 #include <netdev.h>
-#include <ns16550.h>
 #include <asm/msr.h>
-#include <asm/cache.h>
-#include <asm/cpu.h>
-#include <asm/io.h>
 #include <asm/mtrr.h>
-#include <asm/arch/tables.h>
 #include <asm/arch/sysinfo.h>
 #include <asm/arch/timestamp.h>
 
@@ -53,13 +46,6 @@ int last_stage_init(void)
 	return 0;
 }
 
-#ifndef CONFIG_SYS_NO_FLASH
-ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
-{
-	return 0;
-}
-#endif
-
 int board_eth_init(bd_t *bis)
 {
 	return pci_eth_init(bis);
@@ -67,7 +53,8 @@ int board_eth_init(bd_t *bis)
 
 void board_final_cleanup(void)
 {
-	/* Un-cache the ROM so the kernel has one
+	/*
+	 * Un-cache the ROM so the kernel has one
 	 * more MTRR available.
 	 *
 	 * Coreboot should have assigned this to the
@@ -87,15 +74,6 @@ void board_final_cleanup(void)
 	}
 }
 
-void panic_puts(const char *str)
-{
-	NS16550_t port = (NS16550_t)0x3f8;
-
-	NS16550_init(port, 1);
-	while (*str)
-		NS16550_putc(port, *str++);
-}
-
 int misc_init_r(void)
 {
 	return 0;
arch/x86/include/asm/u-boot-x86.h +0 -1
index be103c0..d1d21ed 100644
@@ -16,7 +16,6 @@ void init_gd(gd_t *id, u64 *gdt_addr);
 void setup_gdt(gd_t *id, u64 *gdt_addr);
 int init_cache(void);
 int cleanup_before_linux(void);
-void panic_puts(const char *str);
 
 /* cpu/.../timer.c */
 void timer_isr(void *);
Signature · 1 line
1.8.2.1
#14 lore raw

PATCH 4/6 x86: coreboot: Fix cosmetic issues

Quoted 8 lines · Bin Meng

Clean up arch/x86/cpu/coreboot.c to fix several cosmetic issues.

---

 arch/x86/cpu/coreboot/coreboot.c  | 26 ++------------------------
 arch/x86/include/asm/u-boot-x86.h |  1 -
 2 files changed, 2 insertions(+), 25 deletions(-)
author
#15 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

In reply to a message not in the archive

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h
arch/x86/dts/Makefile +2 -1
index ca2eab3..f86514c 100644
@@ -3,7 +3,8 @@ dtb-y += chromebook_link.dtb \
 	crownbay.dtb \
 	galileo.dtb \
 	minnowmax.dtb \
-	qemu-x86.dtb
+	qemu-x86_i440fx.dtb \
+	qemu-x86_q35.dtb
 
 targets += $(dtb-y)
 
arch/x86/dts/qemu-x86_i440fx.dts new file +34 -0
new file mode 100644
index 0000000..4cf843b
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015, Bin Meng <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+/include/ "serial.dtsi"
+
+/ {
+	model = "QEMU x86 (I440FX)";
+	compatible = "qemu,x86";
+
+	config {
+		silent_console = <0>;
+	};
+
+	chosen {
+		stdout-path = "/serial";
+	};
+
+	pci {
+		compatible = "pci-x86";
+		#address-cells = <3>;
+		#size-cells = <2>;
+		u-boot,dm-pre-reloc;
+		ranges = <0x02000000 0x0 0xc0000000 0xc0000000 0 0x10000000
+			0x42000000 0x0 0xd0000000 0xd0000000 0 0x10000000
+			0x01000000 0x0 0x2000 0x2000 0 0xe000>;
+	};
+
+};
arch/x86/dts/qemu-x86_q35.dts renamed from arch/x86/dts/qemu-x86.dts +1 -1
similarity index 95%
rename from arch/x86/dts/qemu-x86.dts
rename to arch/x86/dts/qemu-x86_q35.dts
index f1291b5..6c89283 100644
@@ -10,7 +10,7 @@
 /include/ "serial.dtsi"
 
 / {
-	model = "QEMU x86";
+	model = "QEMU x86 (Q35)";
 	compatible = "qemu,x86";
 
 	config {
board/coreboot/coreboot/Kconfig +2 -2
index 69e3437..2157c1b 100644
@@ -16,14 +16,14 @@ comment "coreboot-specific options"
 
 config SYS_CONFIG_NAME
 	string "Board configuration file"
-	default "qemu-x86"
+	default "qemu-x86_i440fx"
 	help
 	  This option selects the board configuration file in include/configs/
 	  directory to be used to build U-Boot for coreboot.
 
 config DEFAULT_DEVICE_TREE
 	string "Board Device Tree Source (dts) file"
-	default "qemu-x86"
+	default "qemu-x86_i440fx"
 	help
 	  This option selects the board Device Tree Source (dts) file in
 	  arch/x86/dts/ directory to be used to build U-Boot for coreboot.
board/emulation/qemu-x86/Kconfig +16 -3
index e777ef4..fbf9018 100644
@@ -9,9 +9,6 @@ config SYS_VENDOR
 config SYS_SOC
 	default "qemu"
 
-config SYS_CONFIG_NAME
-	default "qemu-x86"
-
 config SYS_TEXT_BASE
 	default 0xfff00000
 
@@ -21,4 +18,20 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	select QEMU
 	select BOARD_ROMSIZE_KB_1024
 
+comment "qemu-specific options"
+
+config SYS_CONFIG_NAME
+	string "Board configuration file"
+	default "qemu-x86_i440fx"
+	help
+	  This option selects the board configuration file in include/configs/
+	  directory to be used to build U-Boot for qemu-x86.
+
+config DEFAULT_DEVICE_TREE
+	string "Board Device Tree Source (dts) file"
+	default "qemu-x86_i440fx"
+	help
+	  This option selects the board Device Tree Source (dts) file in
+	  arch/x86/dts/ directory to be used to build U-Boot for qemu-x86.
+
 endif
configs/qemu-x86_defconfig +0 -1
index 198ab97..a894db6 100644
@@ -3,7 +3,6 @@ CONFIG_VENDOR_EMULATION=y
 CONFIG_TARGET_QEMU_X86=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_SEPARATE=y
-CONFIG_DEFAULT_DEVICE_TREE="qemu-x86"
 CONFIG_VIDEO_VESA=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_111=y
doc/README.x86 +11 -2
index 0726205..82b773c 100644
@@ -39,8 +39,8 @@ configuration during the 'make menuconfig' process.
 
 x86 architecture  --->
 	...
-	(qemu-x86) Board configuration file
-	(qemu-x86) Board Device Tree Source (dts) file
+	(qemu-x86_i440fx) Board configuration file
+	(qemu-x86_i440fx) Board Device Tree Source (dts) file
 	(0x01920000) Board specific Cache-As-RAM (CAR) address
 	(0x4000) Board specific Cache-As-RAM (CAR) size
 
@@ -186,6 +186,15 @@ To build u-boot.rom for QEMU x86 targets, just simply run
 $ make qemu-x86_defconfig
 $ make all
 
+Note this default configuration will build a U-Boot for the QEMU x86 i440FX
+board. To build a U-Boot against QEMU x86 Q35 board, you can change the build
+configuration during the 'make menuconfig' process like below:
+
+x86 architecture  --->
+	...
+	(qemu-x86_q35) Board configuration file
+	(qemu-x86_q35) Board Device Tree Source (dts) file
+
 Test with coreboot
 ------------------
 For testing U-Boot as the coreboot payload, there are things that need be paid
include/configs/qemu-x86_i440fx.h renamed from include/configs/qemu-x86.h +4 -16
similarity index 78%
rename from include/configs/qemu-x86.h
rename to include/configs/qemu-x86_i440fx.h
index d01936b..53d917d 100644
@@ -37,16 +37,11 @@
 					"stdout=serial,vga\0" \
 					"stderr=serial,vga\0"
 
-/*
- * ATA/SATA support for QEMU x86 targets
- *   - Only legacy IDE controller is supported for QEMU '-M pc' target
- *   - AHCI controller is supported for QEMU '-M q35' target
- *
- * Default configuraion is to support the QEMU default x86 target
- * Undefine CONFIG_CMD_IDE to support q35 target
- */
+/* QEMU i440fx target does not have any AHCI controller */
+#undef CONFIG_SCSI_AHCI
+#undef CONFIG_CMD_SCSI
+
 #define CONFIG_CMD_IDE
-#ifdef CONFIG_CMD_IDE
 #define CONFIG_SYS_IDE_MAXBUS		2
 #define CONFIG_SYS_IDE_MAXDEVICE	4
 #define CONFIG_SYS_ATA_BASE_ADDR	0
@@ -57,13 +52,6 @@
 #define CONFIG_SYS_ATA_IDE1_OFFSET	0x170
 #define CONFIG_ATAPI
 
-#undef CONFIG_SCSI_AHCI
-#undef CONFIG_CMD_SCSI
-#else
-#define CONFIG_SCSI_DEV_LIST		\
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_AHCI}
-#endif
-
 /* GPIO is not supported */
 #undef CONFIG_INTEL_ICH6_GPIO
 #undef CONFIG_CMD_GPIO
include/configs/qemu-x86_q35.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#16 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

Hi Bin,

Quoted 9 lines · Bin Meng

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

Quoted 14 lines
 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h

Do we need a separate config file? It would be good if all the changes were in the device tree so that we don't need a separate config. Or at least that the configs are the same except for the device tree.

Regards,
Simon

author
#17 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

Quoted 14 lines
 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h
Quoted 4 lines

Do we need a separate config file? It would be good if all the changes were in the device tree so that we don't need a separate config. Or at least that the configs are the same except for the device tree.

So far the only difference between two separate config files are the ATA/SATA settings. i440fx has legacy IDE support while q35 has the AHCI support. We can enable them both in just one config files, however turning on legacy IDE support on q35 causes significant boot delay as the legacy IDE driver has some big timeout in probing the attached devices. Do you think this is something we are tolerant of? If yes, I can just do separate device trees.

Regards,
Bin

#18 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

Hi Bin,

Quoted 35 lines · Bin Meng

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

Quoted 14 lines
 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h
Quoted 4 lines

Do we need a separate config file? It would be good if all the changes were in the device tree so that we don't need a separate config. Or at least that the configs are the same except for the device tree.

Quoted 7 lines

So far the only difference between two separate config files are the ATA/SATA settings. i440fx has legacy IDE support while q35 has the AHCI support. We can enable them both in just one config files, however turning on legacy IDE support on q35 causes significant boot delay as the legacy IDE driver has some big timeout in probing the attached devices. Do you think this is something we are tolerant of? If yes, I can just do separate device trees.

I think it is OK. But another option would be to add an IDE node to the device tree and check it when CONFIG_OF_CONTROL is defined...

Regards,
Simon

author
#19 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

Hi Simon,

Quoted 46 lines · Simon Glass

Hi Bin,

Quoted 35 lines · Bin Meng

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

Quoted 14 lines
 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h
Quoted 4 lines

Do we need a separate config file? It would be good if all the changes were in the device tree so that we don't need a separate config. Or at least that the configs are the same except for the device tree.

Quoted 7 lines

So far the only difference between two separate config files are the ATA/SATA settings. i440fx has legacy IDE support while q35 has the AHCI support. We can enable them both in just one config files, however turning on legacy IDE support on q35 causes significant boot delay as the legacy IDE driver has some big timeout in probing the attached devices. Do you think this is something we are tolerant of? If yes, I can just do separate device trees.

Quoted 3 lines

I think it is OK. But another option would be to add an IDE node to the device tree and check it when CONFIG_OF_CONTROL is defined...

I feel that we need convert all block drivers to driver model, so that the driver can probe and initialize IDE/AHCI based on device tree node. But I guess that's a long term goal?

Regards,
Bin

#20 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

Hi Bin,

Quoted 49 lines · Bin Meng

Hi Simon,

Quoted 46 lines · Simon Glass

Hi Bin,

Quoted 42 lines · Bin Meng

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

Quoted 14 lines
 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h
Quoted 4 lines

Do we need a separate config file? It would be good if all the changes were in the device tree so that we don't need a separate config. Or at least that the configs are the same except for the device tree.

So far the only difference between two separate config files are the ATA/SATA settings. i440fx has legacy IDE support while q35 has the AHCI support. We can enable them both in just one config files, however turning on legacy IDE support on q35 causes significant boot delay as the legacy IDE driver has some big timeout in probing the attached devices. Do you think this is something we are tolerant of? If yes, I can just do separate device trees.

Quoted 7 lines
Quoted 3 lines

I think it is OK. But another option would be to add an IDE node to the device tree and check it when CONFIG_OF_CONTROL is defined...

I feel that we need convert all block drivers to driver model, so that the driver can probe and initialize IDE/AHCI based on device tree node. But I guess that's a long term goal?

Yes, perhaps latter in the year. I did create a simple MMC uclass that uses the block driver library just as now, and it seems easy enough. I suppose you could do the same with IDE. But in the meantime just some sort of DT config is good enough to avoid your device.

Regards,
Simon

author
#21 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

Hi Simon,

Quoted 56 lines · Simon Glass

Hi Bin,

Quoted 53 lines · Bin Meng

Hi Simon,

Quoted 49 lines · Simon Glass

Hi Bin,

Quoted 35 lines · Bin Meng

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

Quoted 14 lines
 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h
Quoted 4 lines

Do we need a separate config file? It would be good if all the changes were in the device tree so that we don't need a separate config. Or at least that the configs are the same except for the device tree.

Quoted 7 lines

So far the only difference between two separate config files are the ATA/SATA settings. i440fx has legacy IDE support while q35 has the AHCI support. We can enable them both in just one config files, however turning on legacy IDE support on q35 causes significant boot delay as the legacy IDE driver has some big timeout in probing the attached devices. Do you think this is something we are tolerant of? If yes, I can just do separate device trees.

I think it is OK. But another option would be to add an IDE node to the device tree and check it when CONFIG_OF_CONTROL is defined...

Quoted 9 lines
Quoted 3 lines

I feel that we need convert all block drivers to driver model, so that the driver can probe and initialize IDE/AHCI based on device tree node. But I guess that's a long term goal?

Yes, perhaps latter in the year. I did create a simple MMC uclass that uses the block driver library just as now, and it seems easy enough. I suppose you could do the same with IDE. But in the meantime just some sort of DT config is good enough to avoid your device.

I am not sure I understand your point. Do you mean for now I need modify common/cmd_ide.c::ide_init() to probe the existence of an IDE node in the device tree? I am afraid that's a lot of work too since there are many boards use the IDE driver.

Regards,
Bin

#22 lore raw

PATCH 5/6 x86: qemu: Create i440fx and q35 board configuration and device tree

Hi Bin,

Quoted 69 lines · Bin Meng

Hi Simon,

Quoted 56 lines · Simon Glass

Hi Bin,

Quoted 53 lines · Bin Meng

Hi Simon,

Quoted 49 lines · Simon Glass

Hi Bin,

Quoted 35 lines · Bin Meng

Hi Simon,

Quoted 27 lines · Simon Glass

Hi Bin,

Quoted 9 lines · Bin Meng

Although the two qemu-x86 targets (i440fx and q35) share a lot in common, they still have something that cannot easily handled in one place (like different configurations, different properties in the device tree). Split to create two dedicated board configuration and device tree files and make the i440fx be the default build target.

---

Quoted 14 lines
 arch/x86/dts/Makefile                             |  3 +-
 arch/x86/dts/qemu-x86_i440fx.dts                  | 34 +++++++++++++++
 arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts}   |  2 +-
 board/coreboot/coreboot/Kconfig                   |  4 +-
 board/emulation/qemu-x86/Kconfig                  | 19 +++++++--
 configs/qemu-x86_defconfig                        |  1 -
 doc/README.x86                                    | 13 +++++-
 include/configs/{qemu-x86.h => qemu-x86_i440fx.h} | 20 ++-------
 include/configs/qemu-x86_q35.h                    | 52 +++++++++++++++++++++++
 9 files changed, 122 insertions(+), 26 deletions(-)
 create mode 100644 arch/x86/dts/qemu-x86_i440fx.dts
 rename arch/x86/dts/{qemu-x86.dts => qemu-x86_q35.dts} (95%)
 rename include/configs/{qemu-x86.h => qemu-x86_i440fx.h} (78%)
 create mode 100644 include/configs/qemu-x86_q35.h
Quoted 4 lines

Do we need a separate config file? It would be good if all the changes were in the device tree so that we don't need a separate config. Or at least that the configs are the same except for the device tree.

Quoted 7 lines

So far the only difference between two separate config files are the ATA/SATA settings. i440fx has legacy IDE support while q35 has the AHCI support. We can enable them both in just one config files, however turning on legacy IDE support on q35 causes significant boot delay as the legacy IDE driver has some big timeout in probing the attached devices. Do you think this is something we are tolerant of? If yes, I can just do separate device trees.

I think it is OK. But another option would be to add an IDE node to the device tree and check it when CONFIG_OF_CONTROL is defined...

Quoted 9 lines
Quoted 3 lines

I feel that we need convert all block drivers to driver model, so that the driver can probe and initialize IDE/AHCI based on device tree node. But I guess that's a long term goal?

Yes, perhaps latter in the year. I did create a simple MMC uclass that uses the block driver library just as now, and it seems easy enough. I suppose you could do the same with IDE. But in the meantime just some sort of DT config is good enough to avoid your device.

Quoted 4 lines

I am not sure I understand your point. Do you mean for now I need modify common/cmd_ide.c::ide_init() to probe the existence of an IDE node in the device tree? I am afraid that's a lot of work too since there are many boards use the IDE driver.

Maybe for now you could do:

#ifdef CONFIG_OF_CONTROL
if (!fdtdec_get_config_bool("legacy-ide"))
return; /* skip IDE */
#endif

Regards,
Simon

author
#23 lore raw

PATCH 6/6 x86: qemu: Implement PIRQ routing

In reply to a message not in the archive

Support QEMU PIRQ routing via device tree on both i440fx and q35 platforms. With this commit, Linux booting on QEMU from U-Boot has working ATA/SATA, USB and ethernet.

---

 arch/x86/cpu/coreboot/coreboot.c  |  5 +++++
 arch/x86/cpu/qemu/qemu.c          |  8 ++++++++
 arch/x86/dts/qemu-x86_i440fx.dts  | 16 ++++++++++++++++
 arch/x86/dts/qemu-x86_q35.dts     | 32 ++++++++++++++++++++++++++++++++
 configs/qemu-x86_defconfig        |  1 +
 include/configs/qemu-x86_i440fx.h |  1 +
 include/configs/qemu-x86_q35.h    |  1 +
 7 files changed, 64 insertions(+)
arch/x86/cpu/coreboot/coreboot.c +5 -0
index 12b07bf..041e51e 100644
@@ -78,3 +78,8 @@ int misc_init_r(void)
 {
 	return 0;
 }
+
+int arch_misc_init(void)
+{
+	return 0;
+}
arch/x86/cpu/qemu/qemu.c +8 -0
index 0f98476..930d2b6 100644
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <asm/irq.h>
 #include <asm/post.h>
 #include <asm/processor.h>
 
@@ -35,3 +36,10 @@ void reset_cpu(ulong addr)
 	/* cold reset */
 	x86_full_reset();
 }
+
+int arch_misc_init(void)
+{
+	pirq_init();
+
+	return 0;
+}
arch/x86/dts/qemu-x86_i440fx.dts +16 -0
index 4cf843b..557428a 100644
@@ -6,6 +6,8 @@
 
 /dts-v1/;
 
+#include <dt-bindings/interrupt-router/intel-irq.h>
+
 /include/ "skeleton.dtsi"
 /include/ "serial.dtsi"
 
@@ -29,6 +31,20 @@
 		ranges = <0x02000000 0x0 0xc0000000 0xc0000000 0 0x10000000
 			0x42000000 0x0 0xd0000000 0xd0000000 0 0x10000000
 			0x01000000 0x0 0x2000 0x2000 0 0xe000>;
+
+		irq-router at 1,0 {
+			reg = <0x00000800 0 0 0 0>;
+			compatible = "intel,irq-router";
+			intel,pirq-config = "pci";
+			intel,pirq-link = <0x60 4>;
+			intel,pirq-mask = <0x0e40>;
+			intel,pirq-routing = <
+				/* PIIX UHCI */
+				PCI_BDF(0, 1, 2) INTD PIRQD
+				/* e1000 NIC */
+				PCI_BDF(0, 3, 0) INTA PIRQC
+			>;
+		};
 	};
 
 };
arch/x86/dts/qemu-x86_q35.dts +32 -0
index 6c89283..c8e1a55 100644
@@ -6,6 +6,18 @@
 
 /dts-v1/;
 
+#include <dt-bindings/interrupt-router/intel-irq.h>
+
+/* ICH9 IRQ router has discrete PIRQ control registers */
+#undef PIRQE
+#undef PIRQF
+#undef PIRQG
+#undef PIRQH
+#define PIRQE	8
+#define PIRQF	9
+#define PIRQG	10
+#define PIRQH	11
+
 /include/ "skeleton.dtsi"
 /include/ "serial.dtsi"
 
@@ -29,6 +41,26 @@
 		ranges = <0x02000000 0x0 0xc0000000 0xc0000000 0 0x10000000
 			0x42000000 0x0 0xd0000000 0xd0000000 0 0x10000000
 			0x01000000 0x0 0x2000 0x2000 0 0xe000>;
+
+		irq-router at 1f,0 {
+			reg = <0x0000f800 0 0 0 0>;
+			compatible = "intel,irq-router";
+			intel,pirq-config = "pci";
+			intel,pirq-link = <0x60 8>;
+			intel,pirq-mask = <0x0e40>;
+			intel,pirq-routing = <
+				/* e1000 NIC */
+				PCI_BDF(0, 2, 0) INTA PIRQG
+				/* ICH9 UHCI */
+				PCI_BDF(0, 29, 0) INTA PIRQA
+				PCI_BDF(0, 29, 1) INTB PIRQB
+				PCI_BDF(0, 29, 2) INTC PIRQC
+				/* ICH9 EHCI */
+				PCI_BDF(0, 29, 7) INTD PIRQD
+				/* ICH9 SATA */
+				PCI_BDF(0, 31, 2) INTA PIRQA
+			>;
+		};
 	};
 
 };
configs/qemu-x86_defconfig +1 -0
index a894db6..a5251b5 100644
@@ -6,3 +6,4 @@ CONFIG_OF_SEPARATE=y
 CONFIG_VIDEO_VESA=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_111=y
+CONFIG_GENERATE_PIRQ_TABLE=y
include/configs/qemu-x86_i440fx.h +1 -0
index 53d917d..b710cf7 100644
@@ -14,6 +14,7 @@
 #include <configs/x86-common.h>
 
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
+#define CONFIG_ARCH_MISC_INIT
 
 #define CONFIG_X86_SERIAL
 
include/configs/qemu-x86_q35.h +1 -0
index ef81ad3..db26676 100644
@@ -14,6 +14,7 @@
 #include <configs/x86-common.h>
 
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
+#define CONFIG_ARCH_MISC_INIT
 
 #define CONFIG_X86_SERIAL
 
Signature · 1 line
1.8.2.1
#24 lore raw

PATCH 6/6 x86: qemu: Implement PIRQ routing

Quoted 7 lines · Bin Meng

Support QEMU PIRQ routing via device tree on both i440fx and q35 platforms. With this commit, Linux booting on QEMU from U-Boot has working ATA/SATA, USB and ethernet.

---

Quoted 8 lines
 arch/x86/cpu/coreboot/coreboot.c  |  5 +++++
 arch/x86/cpu/qemu/qemu.c          |  8 ++++++++
 arch/x86/dts/qemu-x86_i440fx.dts  | 16 ++++++++++++++++
 arch/x86/dts/qemu-x86_q35.dts     | 32 ++++++++++++++++++++++++++++++++
 configs/qemu-x86_defconfig        |  1 +
 include/configs/qemu-x86_i440fx.h |  1 +
 include/configs/qemu-x86_q35.h    |  1 +
 7 files changed, 64 insertions(+)