[U-Boot] [PATCH 5/6] x86: qemu: Create i440fx and q35 board configuration and device tree

Bin Meng bmeng.cn at gmail.com
Mon May 25 16:36:30 CEST 2015


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.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 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

diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile
index ca2eab3..f86514c 100644
--- a/arch/x86/dts/Makefile
+++ b/arch/x86/dts/Makefile
@@ -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)
 
diff --git a/arch/x86/dts/qemu-x86_i440fx.dts b/arch/x86/dts/qemu-x86_i440fx.dts
new file mode 100644
index 0000000..4cf843b
--- /dev/null
+++ b/arch/x86/dts/qemu-x86_i440fx.dts
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn at gmail.com>
+ *
+ * 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>;
+	};
+
+};
diff --git a/arch/x86/dts/qemu-x86.dts b/arch/x86/dts/qemu-x86_q35.dts
similarity index 95%
rename from arch/x86/dts/qemu-x86.dts
rename to arch/x86/dts/qemu-x86_q35.dts
index f1291b5..6c89283 100644
--- a/arch/x86/dts/qemu-x86.dts
+++ b/arch/x86/dts/qemu-x86_q35.dts
@@ -10,7 +10,7 @@
 /include/ "serial.dtsi"
 
 / {
-	model = "QEMU x86";
+	model = "QEMU x86 (Q35)";
 	compatible = "qemu,x86";
 
 	config {
diff --git a/board/coreboot/coreboot/Kconfig b/board/coreboot/coreboot/Kconfig
index 69e3437..2157c1b 100644
--- a/board/coreboot/coreboot/Kconfig
+++ b/board/coreboot/coreboot/Kconfig
@@ -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.
diff --git a/board/emulation/qemu-x86/Kconfig b/board/emulation/qemu-x86/Kconfig
index e777ef4..fbf9018 100644
--- a/board/emulation/qemu-x86/Kconfig
+++ b/board/emulation/qemu-x86/Kconfig
@@ -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
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 198ab97..a894db6 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -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
diff --git a/doc/README.x86 b/doc/README.x86
index 0726205..82b773c 100644
--- a/doc/README.x86
+++ b/doc/README.x86
@@ -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
diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86_i440fx.h
similarity index 78%
rename from include/configs/qemu-x86.h
rename to include/configs/qemu-x86_i440fx.h
index d01936b..53d917d 100644
--- a/include/configs/qemu-x86.h
+++ b/include/configs/qemu-x86_i440fx.h
@@ -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
diff --git a/include/configs/qemu-x86_q35.h b/include/configs/qemu-x86_q35.h
new file mode 100644
index 0000000..ef81ad3
--- /dev/null
+++ b/include/configs/qemu-x86_q35.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn at gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/*
+ * board/config.h - configuration options, board specific
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <configs/x86-common.h>
+
+#define CONFIG_SYS_MONITOR_LEN		(1 << 20)
+
+#define CONFIG_X86_SERIAL
+
+#define CONFIG_PCI_MEM_BUS		0xc0000000
+#define CONFIG_PCI_MEM_PHYS		CONFIG_PCI_MEM_BUS
+#define CONFIG_PCI_MEM_SIZE		0x10000000
+
+#define CONFIG_PCI_PREF_BUS		0xd0000000
+#define CONFIG_PCI_PREF_PHYS		CONFIG_PCI_PREF_BUS
+#define CONFIG_PCI_PREF_SIZE		0x10000000
+
+#define CONFIG_PCI_IO_BUS		0x2000
+#define CONFIG_PCI_IO_PHYS		CONFIG_PCI_IO_BUS
+#define CONFIG_PCI_IO_SIZE		0xe000
+
+#define CONFIG_PCI_CONFIG_HOST_BRIDGE
+#define CONFIG_PCI_PNP
+#define CONFIG_E1000
+
+#define CONFIG_STD_DEVICES_SETTINGS	"stdin=serial,vga\0" \
+					"stdout=serial,vga\0" \
+					"stderr=serial,vga\0"
+
+#define CONFIG_SCSI_DEV_LIST		\
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_AHCI}
+
+/* GPIO is not supported */
+#undef CONFIG_INTEL_ICH6_GPIO
+#undef CONFIG_CMD_GPIO
+
+/* SPI is not supported */
+#undef CONFIG_ICH_SPI
+#undef CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_IS_NOWHERE
+
+#endif	/* __CONFIG_H */
-- 
1.8.2.1



More information about the U-Boot mailing list