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 14/18] efi: stub: Pass EFI GOP information to U-Boot payload
Date: Sun, 10 Jun 2018 06:25:13 -0700	[thread overview]
Message-ID: <1528637118-32739-15-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1528637118-32739-1-git-send-email-bmeng.cn@gmail.com>

If UEFI BIOS has the graphics output protocol (GOP), let's pass its
information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

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

 include/efi.h      | 35 +++++++++++++++++++++++++++++++++++
 lib/efi/efi_stub.c | 15 +++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/include/efi.h b/include/efi.h
index 98bddba..e08a913 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -242,6 +242,7 @@ struct efi_open_protocol_info_entry {
 enum efi_entry_t {
 	EFIET_END,	/* Signals this is the last (empty) entry */
 	EFIET_MEMORY_MAP,
+	EFIET_GOP_MODE,
 
 	/* Number of entries */
 	EFIET_MEMORY_COUNT,
@@ -298,6 +299,40 @@ struct efi_entry_memmap {
 	struct efi_mem_desc desc[];
 };
 
+/**
+ * struct efi_entry_gopmode - a GOP mode table passed to U-Boot
+ *
+ * @fb_base:	EFI's framebuffer base address
+ * @fb_size:	EFI's framebuffer size
+ * @info_size:	GOP mode info structure size
+ * @info:	Start address of the GOP mode info structure
+ */
+struct efi_entry_gopmode {
+	efi_physical_addr_t fb_base;
+	/*
+	 * Not like the ones in 'struct efi_gop_mode' which are 'unsigned
+	 * long', @fb_size and @info_size have to be 'u64' here. As the EFI
+	 * stub codes may have different bit size from the U-Boot payload,
+	 * using 'long' will cause mismatch between the producer (stub) and
+	 * the consumer (payload).
+	 */
+	u64 fb_size;
+	u64 info_size;
+	/*
+	 * We cannot directly use 'struct efi_gop_mode_info info[]' here as
+	 * it causes compiler to complain: array type has incomplete element
+	 * type 'struct efi_gop_mode_info'.
+	 */
+	struct /* efi_gop_mode_info */ {
+		u32 version;
+		u32 width;
+		u32 height;
+		u32 pixel_format;
+		u32 pixel_bitmask[4];
+		u32 pixels_per_scanline;
+	} info[];
+};
+
 static inline struct efi_mem_desc *efi_get_next_mem_desc(
 		struct efi_entry_memmap *map, struct efi_mem_desc *desc)
 {
diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
index 09023a2..4819373 100644
--- a/lib/efi/efi_stub.c
+++ b/lib/efi/efi_stub.c
@@ -274,6 +274,9 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	struct efi_boot_services *boot = sys_table->boottime;
 	struct efi_mem_desc *desc;
 	struct efi_entry_memmap map;
+	struct efi_gop *gop;
+	struct efi_entry_gopmode mode;
+	efi_guid_t efi_gop_guid = EFI_GOP_GUID;
 	efi_uintn_t key, desc_size, size;
 	efi_status_t ret;
 	u32 version;
@@ -312,6 +315,18 @@ efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
 	if (ret)
 		return ret;
 
+	ret = boot->locate_protocol(&efi_gop_guid, NULL, (void **)&gop);
+	if (ret) {
+		puts(" GOP unavailable\n");
+	} else {
+		mode.fb_base = gop->mode->fb_base;
+		mode.fb_size = gop->mode->fb_size;
+		mode.info_size = gop->mode->info_size;
+		add_entry_addr(priv, EFIET_GOP_MODE, &mode, sizeof(mode),
+			       gop->mode->info,
+			       sizeof(struct efi_gop_mode_info));
+	}
+
 	ret = boot->get_memory_map(&size, desc, &key, &desc_size, &version);
 	if (ret) {
 		printhex2(ret);
-- 
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 ` [U-Boot] [PATCH 11/18] x86: Add generic EFI payload support Bin Meng
2018-06-11 14:54   ` 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 ` Bin Meng [this message]
2018-06-10 19:16   ` [U-Boot] [PATCH 14/18] efi: stub: Pass EFI GOP information to U-Boot payload 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-15-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.