All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 11/18] x86: Add generic EFI payload support
Date: Sun, 10 Jun 2018 06:25:10 -0700	[thread overview]
Message-ID: <1528637118-32739-12-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1528637118-32739-1-git-send-email-bmeng.cn@gmail.com>

It is possible to create a generic EFI payload for all x86 boards.
The payload is configured to include as many generic drivers as
possible. All stuff that touches low-level initialization are not
allowed as such is the EFI BIOS's responsibility. Platform specific
drivers (like gpio, spi, etc) are not included.

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

 arch/x86/dts/Makefile                 |  1 +
 arch/x86/dts/efi-x86_payload.dts      | 36 +++++++++++++++++++++++++++++++++
 board/efi/Kconfig                     |  9 +++++++++
 board/efi/efi-x86_payload/Kconfig     | 38 +++++++++++++++++++++++++++++++++++
 board/efi/efi-x86_payload/MAINTAINERS |  7 +++++++
 board/efi/efi-x86_payload/Makefile    |  5 +++++
 board/efi/efi-x86_payload/start.S     |  8 ++++++++
 configs/efi-x86_payload32_defconfig   | 35 ++++++++++++++++++++++++++++++++
 configs/efi-x86_payload64_defconfig   | 36 +++++++++++++++++++++++++++++++++
 include/configs/efi-x86_payload.h     | 32 +++++++++++++++++++++++++++++
 10 files changed, 207 insertions(+)
 create mode 100644 arch/x86/dts/efi-x86_payload.dts
 create mode 100644 board/efi/efi-x86_payload/Kconfig
 create mode 100644 board/efi/efi-x86_payload/MAINTAINERS
 create mode 100644 board/efi/efi-x86_payload/Makefile
 create mode 100644 board/efi/efi-x86_payload/start.S
 create mode 100644 configs/efi-x86_payload32_defconfig
 create mode 100644 configs/efi-x86_payload64_defconfig
 create mode 100644 include/configs/efi-x86_payload.h

diff --git a/arch/x86/dts/Makefile b/arch/x86/dts/Makefile
index 7379774..9872c04 100644
--- a/arch/x86/dts/Makefile
+++ b/arch/x86/dts/Makefile
@@ -11,6 +11,7 @@ dtb-y += bayleybay.dtb \
 	dfi-bt700-q7x-151.dtb \
 	edison.dtb \
 	efi.dtb \
+	efi-x86_payload.dtb \
 	galileo.dtb \
 	minnowmax.dtb \
 	qemu-x86_i440fx.dtb \
diff --git a/arch/x86/dts/efi-x86_payload.dts b/arch/x86/dts/efi-x86_payload.dts
new file mode 100644
index 0000000..137bde5
--- /dev/null
+++ b/arch/x86/dts/efi-x86_payload.dts
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * Generic EFI payload device tree for x86 targets
+ */
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+/include/ "serial.dtsi"
+/include/ "keyboard.dtsi"
+/include/ "rtc.dtsi"
+/include/ "tsc_timer.dtsi"
+
+/ {
+	model = "EFI x86 Payload";
+	compatible = "efi,x86-payload";
+
+	aliases {
+		serial0 = &serial;
+	};
+
+	config {
+		silent_console = <0>;
+	};
+
+	chosen {
+		stdout-path = "/serial";
+	};
+
+	pci {
+		compatible = "pci-x86";
+		u-boot,dm-pre-reloc;
+	};
+};
diff --git a/board/efi/Kconfig b/board/efi/Kconfig
index 6f86a48..d37f6ff 100644
--- a/board/efi/Kconfig
+++ b/board/efi/Kconfig
@@ -12,8 +12,17 @@ config TARGET_EFI
 	  takes over once the RAM, video and CPU are fully running.
 	  U-Boot is loaded as an application from EFI.
 
+config TARGET_EFI_PAYLOAD
+	bool "efi payload"
+	help
+	  This target is used for running U-Boot on top of EFI. In
+	  this case EFI does the early initialisation, and U-Boot
+	  takes over once the RAM, video and CPU are fully running.
+	  U-Boot is loaded as a payload from EFI.
+
 endchoice
 
 source "board/efi/efi-x86/Kconfig"
+source "board/efi/efi-x86_payload/Kconfig"
 
 endif
diff --git a/board/efi/efi-x86_payload/Kconfig b/board/efi/efi-x86_payload/Kconfig
new file mode 100644
index 0000000..dcf4de8
--- /dev/null
+++ b/board/efi/efi-x86_payload/Kconfig
@@ -0,0 +1,38 @@
+if TARGET_EFI_PAYLOAD
+
+config SYS_BOARD
+	default "efi-x86_payload"
+
+config SYS_VENDOR
+	default "efi"
+
+config SYS_SOC
+	default "efi"
+
+config SYS_CONFIG_NAME
+	default "efi-x86_payload"
+
+config SYS_TEXT_BASE
+	default 0x00200000
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+	imply SYS_NS16550
+	imply SCSI
+	imply SCSI_AHCI
+	imply AHCI_PCI
+	imply MMC
+	imply MMC_PCI
+	imply MMC_SDHCI
+	imply MMC_SDHCI_SDMA
+	imply USB
+	imply USB_EHCI_HCD
+	imply USB_XHCI_HCD
+	imply USB_STORAGE
+	imply USB_KEYBOARD
+	imply E1000
+	imply ETH_DESIGNWARE
+	imply PCH_GBE
+	imply RTL8169
+
+endif
diff --git a/board/efi/efi-x86_payload/MAINTAINERS b/board/efi/efi-x86_payload/MAINTAINERS
new file mode 100644
index 0000000..abf3a15
--- /dev/null
+++ b/board/efi/efi-x86_payload/MAINTAINERS
@@ -0,0 +1,7 @@
+EFI-X86_PAYLOAD BOARD
+M:	Bin Meng <bmeng.cn@gmail.com>
+S:	Maintained
+F:	board/efi/efi-x86_payload/
+F:	include/configs/efi-x86_payload.h
+F:	configs/efi-x86_payload32_defconfig
+F:	configs/efi-x86_payload64_defconfig
diff --git a/board/efi/efi-x86_payload/Makefile b/board/efi/efi-x86_payload/Makefile
new file mode 100644
index 0000000..6982340
--- /dev/null
+++ b/board/efi/efi-x86_payload/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+
+obj-y	+= start.o
diff --git a/board/efi/efi-x86_payload/start.S b/board/efi/efi-x86_payload/start.S
new file mode 100644
index 0000000..f7eaa7c
--- /dev/null
+++ b/board/efi/efi-x86_payload/start.S
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+.globl early_board_init
+early_board_init:
+	jmp	early_board_init_ret
diff --git a/configs/efi-x86_payload32_defconfig b/configs/efi-x86_payload32_defconfig
new file mode 100644
index 0000000..7f0cab0
--- /dev/null
+++ b/configs/efi-x86_payload32_defconfig
@@ -0,0 +1,35 @@
+CONFIG_X86=y
+CONFIG_VENDOR_EFI=y
+CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
+CONFIG_TARGET_EFI_PAYLOAD=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_LAST_STAGE_INIT=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_IDE=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_MAC_PARTITION=y
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+# CONFIG_PCI_PNP is not set
+CONFIG_EFI=y
+CONFIG_EFI_STUB=y
diff --git a/configs/efi-x86_payload64_defconfig b/configs/efi-x86_payload64_defconfig
new file mode 100644
index 0000000..8d7f3f0
--- /dev/null
+++ b/configs/efi-x86_payload64_defconfig
@@ -0,0 +1,36 @@
+CONFIG_X86=y
+CONFIG_VENDOR_EFI=y
+CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
+CONFIG_TARGET_EFI_PAYLOAD=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_LAST_STAGE_INIT=y
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_IDE=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_MAC_PARTITION=y
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+# CONFIG_PCI_PNP is not set
+CONFIG_EFI=y
+CONFIG_EFI_STUB=y
+CONFIG_EFI_STUB_64BIT=y
diff --git a/include/configs/efi-x86_payload.h b/include/configs/efi-x86_payload.h
new file mode 100644
index 0000000..9c62fd2
--- /dev/null
+++ b/include/configs/efi-x86_payload.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+/*
+ * 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_STD_DEVICES_SETTINGS	"stdin=serial,i8042-kbd\0" \
+					"stdout=serial,vidconsole\0" \
+					"stderr=serial,vidconsole\0"
+
+/* ATA/IDE support */
+#define CONFIG_SYS_IDE_MAXBUS		2
+#define CONFIG_SYS_IDE_MAXDEVICE	4
+#define CONFIG_SYS_ATA_BASE_ADDR	0
+#define CONFIG_SYS_ATA_DATA_OFFSET	0
+#define CONFIG_SYS_ATA_REG_OFFSET	0
+#define CONFIG_SYS_ATA_ALT_OFFSET	0
+#define CONFIG_SYS_ATA_IDE0_OFFSET	0x1f0
+#define CONFIG_SYS_ATA_IDE1_OFFSET	0x170
+#define CONFIG_ATAPI
+
+#endif	/* __CONFIG_H */
-- 
2.7.4

  parent reply	other threads:[~2018-06-10 13:25 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-10 13:24 [U-Boot] [PATCH 00/18] x86: efi: Fixes and enhancements to application and payload support Bin Meng
2018-06-10 13:25 ` [U-Boot] [PATCH 01/18] x86: doc: Fix reference to EFI doc in U-Boot Bin Meng
2018-06-10 13:39   ` Heinrich Schuchardt
2018-06-10 14:01     ` Bin Meng
2018-06-10 17:46       ` Heinrich Schuchardt
2018-06-10 13:25 ` [U-Boot] [PATCH 02/18] x86: Conditionally build the pinctrl_ich6 driver Bin Meng
2018-06-11 14:53   ` Simon Glass
2018-06-12 13:07     ` Bin Meng
2018-06-10 13:25 ` [U-Boot] [PATCH 03/18] x86: efi: app: Fix broken EFI application Bin Meng
2018-06-11 14:53   ` Simon Glass
2018-06-12 13:07     ` Bin Meng
2018-06-11 17:18   ` Heinrich Schuchardt
2018-06-11 23:19     ` Bin Meng
2018-06-10 13:25 ` [U-Boot] [PATCH 04/18] x86: efi: payload: Enforce toolchain to generate 64-bit EFI payload stub codes Bin Meng
2018-06-10 19:11   ` Alexander Graf
2018-06-11  2:34     ` Bin Meng
2018-06-11  5:55       ` Alexander Graf
2018-06-11  6:05         ` Bin Meng
2018-06-11 14:53   ` Simon Glass
2018-06-12 13:07     ` Bin Meng
2018-06-10 13:25 ` [U-Boot] [PATCH 05/18] efi: Fix efi_uintn_t for 64-bit EFI payload Bin Meng
2018-06-10 14:02   ` Heinrich Schuchardt
2018-06-10 14:30     ` Bin Meng
2018-06-10 18:17       ` Heinrich Schuchardt
2018-06-10 23:36         ` Bin Meng
2018-06-11 15:31           ` Heinrich Schuchardt
2018-06-11 16:35             ` Bin Meng
2018-06-11 18:35               ` Heinrich Schuchardt
2018-06-11  9:11   ` Bin Meng
2018-06-11 19:43     ` Alexander Graf
2018-06-10 13:25 ` [U-Boot] [PATCH 06/18] dm: pci: Make ranges dt property optional Bin Meng
2018-06-11 14:53   ` Simon Glass
2018-06-12 13:07     ` Bin Meng
2018-06-10 13:25 ` [U-Boot] [PATCH 07/18] dm: pci: Use a 1:1 mapping for bus <-> phy addresses Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-12 13:07     ` Bin Meng
2018-06-10 13:25 ` [U-Boot] [PATCH 08/18] x86: efi: Refactor the directory of EFI app and payload support Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-10 13:25 ` [U-Boot] [PATCH 09/18] x86: efi: payload: Add arch_cpu_init() Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-10 13:25 ` [U-Boot] [PATCH 10/18] x86: efi: payload: Minor clean up on error message output Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-12 13:07     ` Bin Meng
2018-06-10 13:25 ` Bin Meng [this message]
2018-06-11 14:54   ` [U-Boot] [PATCH 11/18] x86: Add generic EFI payload support Simon Glass
2018-06-10 13:25 ` [U-Boot] [PATCH 12/18] x86: Drop QEMU-specific " Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-10 13:25 ` [U-Boot] [PATCH 13/18] x86: baytrail: Drop EFI-specific test logics Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-10 13:25 ` [U-Boot] [PATCH 14/18] efi: stub: Pass EFI GOP information to U-Boot payload Bin Meng
2018-06-10 19:16   ` Alexander Graf
2018-06-10 23:29     ` Bin Meng
2018-06-11  5:52       ` Alexander Graf
2018-06-11  6:01         ` Bin Meng
2018-06-11  7:34           ` Alexander Graf
2018-06-11  7:44             ` Bin Meng
2018-06-11  8:33               ` Alexander Graf
2018-06-11  9:02                 ` Bin Meng
2018-06-11 14:53   ` Simon Glass
2018-06-10 13:25 ` [U-Boot] [PATCH 15/18] dm: video: Add an EFI framebuffer driver Bin Meng
2018-06-10 15:52   ` Anatolij Gustschin
2018-06-10 13:25 ` [U-Boot] [PATCH 16/18] x86: efi: payload: Add EFI framebuffer driver support Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-10 13:25 ` [U-Boot] [PATCH 17/18] x86: Rename efi-x86 target to efi-x86_app Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-11 15:50     ` Bin Meng
2018-06-10 13:25 ` [U-Boot] [PATCH 18/18] x86: efi: app: Display correct CPU info during boot Bin Meng
2018-06-11 14:54   ` Simon Glass
2018-06-11 14:53 ` [U-Boot] [PATCH 00/18] x86: efi: Fixes and enhancements to application and payload support Simon Glass
2018-06-11 15:53   ` Bin Meng
2018-06-11 19:38     ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1528637118-32739-12-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.