Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1360804

[PATCH v2 7/9] efi/arm*: libstub: wire up GOP protocol to struct screen_info

From Ard Biesheuvel <ard.biesheuvel@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v2 7/9] efi/arm*: libstub: wire up GOP protocol to struct screen_info
Date 2016-03-18 18:00 +0100
Message-ID <re5UK-2fQ-19@gated-at.bofh.it> (permalink)
References <re5L4-23u-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This adds the code to the ARM and arm64 versions of the UEFI stub to
populate struct screen_info based on the information received from the
firmware via the GOP protocol.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 drivers/firmware/efi/libstub/arm-stub.c | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
index 4deb3e7faa0e..94bd51cfb71e 100644
--- a/drivers/firmware/efi/libstub/arm-stub.c
+++ b/drivers/firmware/efi/libstub/arm-stub.c
@@ -147,6 +147,25 @@ void efi_char16_printk(efi_system_table_t *sys_table_arg,
 	out->output_string(out, str);
 }
 
+static struct screen_info *setup_graphics(efi_system_table_t *sys_table_arg)
+{
+	efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
+	efi_status_t status;
+	unsigned long size;
+	void **gop_handle = NULL;
+	struct screen_info *si = NULL;
+
+	size = 0;
+	status = efi_call_early(locate_handle, EFI_LOCATE_BY_PROTOCOL,
+				&gop_proto, NULL, &size, gop_handle);
+	if (status == EFI_BUFFER_TOO_SMALL) {
+		si = alloc_screen_info(sys_table_arg);
+		if (!si)
+			return NULL;
+		efi_setup_gop(sys_table_arg, si, &gop_proto, size);
+	}
+	return si;
+}
 
 /*
  * This function handles the architcture specific differences between arm and
@@ -185,6 +204,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
 	efi_guid_t loaded_image_proto = LOADED_IMAGE_PROTOCOL_GUID;
 	unsigned long reserve_addr = 0;
 	unsigned long reserve_size = 0;
+	struct screen_info *si;
 
 	/* Check if we were booted by the EFI firmware */
 	if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
@@ -233,6 +253,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
 			__nokaslr = true;
 	}
 
+	si = setup_graphics(sys_table);
+
 	status = handle_kernel_image(sys_table, image_addr, &image_size,
 				     &reserve_addr,
 				     &reserve_size,
@@ -305,6 +327,7 @@ fail_free_image:
 	efi_free(sys_table, image_size, *image_addr);
 	efi_free(sys_table, reserve_size, reserve_addr);
 fail_free_cmdline:
+	free_screen_info(sys_table, si);
 	efi_free(sys_table, cmdline_size, (unsigned long)cmdline_ptr);
 fail:
 	return EFI_ERROR;
-- 
2.5.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/9] EFI framebuffer support for ARM and arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 17:50 +0100
  [PATCH v2 4/9] efi: efifb: use builtin_platform_driver and drop unused includes Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 17:50 +0100
  [PATCH v2 8/9] efi/arm*: wire up struct screen_info to efi-framebuffer platform device Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 17:50 +0100
    Re: [PATCH v2 8/9] efi/arm*: wire up struct screen_info to  efi-framebuffer platform device David Herrmann <dh.herrmann@gmail.com> - 2016-03-21 15:00 +0100
  [PATCH v2 3/9] efi/x86: efifb: move DMI based quirks handling out of generic code Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 17:50 +0100
    Re: [PATCH v2 3/9] efi/x86: efifb: move DMI based quirks handling out  of generic code David Herrmann <dh.herrmann@gmail.com> - 2016-03-21 15:00 +0100
  [PATCH v2 5/9] efi/arm64: libstub: make screen_info accessible to the UEFI stub Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 17:50 +0100
  [PATCH v2 9/9] efifb: enable the efi-framebuffer platform driver for ARM and arm64 Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 17:50 +0100
  [PATCH v2 1/9] efi/x86: prepare GOP handling code for reuse as generic code Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 17:50 +0100
  [PATCH v2 2/9] efi: libstub: move Graphics Output Protocol handling to generic code Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 18:00 +0100
  [PATCH v2 7/9] efi/arm*: libstub: wire up GOP protocol to struct screen_info Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 18:00 +0100
  [PATCH v2 6/9] efi/arm: libstub: make screen_info accessible to the UEFI stub Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-18 18:00 +0100

csiph-web