mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] x86: Expand EFI GOP handle search
@ 2012-05-23 18:08 Matthew Garrett
  2012-05-23 18:08 ` [PATCH 2/3] x86: Allow early PCI quirks to trigger on bus 1 Matthew Garrett
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matthew Garrett @ 2012-05-23 18:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, matt.fleming, Matthew Garrett

Some UEFI implementations provide multiple GOP handles, with one acting
as a splitter device to handle the case of multiple outputs being present.
The downside of this approach is that the console splitter device may
report an inaccurate stride value. We currently get around this by looking
for a device that implements the PCI IO protocol. However, this fails on
some devices - the GOP may be attached to the display device rather than
the GPU. We can handle that scenario by looking for a handle with an EDID
protocol attached to it.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Matt Fleming <matt.fleming@intel.com>
---
 arch/x86/boot/compressed/eboot.c |   27 ++++++++++++++++-----------
 include/linux/efi.h              |    3 +++
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 0cdfc0d..781d9f5 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -257,7 +257,8 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
 	for (i = 0; i < nr_gops; i++) {
 		struct efi_graphics_output_mode_info *info;
 		efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID;
-		void *pciio;
+		efi_guid_t edid_proto = EFI_EDID_DISCOVERED_GUID;
+		void *pciio, *edid;
 		void *h = gop_handle[i];
 
 		status = efi_call_phys3(sys_table->boottime->handle_protocol,
@@ -268,16 +269,20 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
 		efi_call_phys3(sys_table->boottime->handle_protocol,
 			       h, &pciio_proto, &pciio);
 
+		efi_call_phys3(sys_table->boottime->handle_protocol,
+			       h, &edid_proto, &edid);
+
 		status = efi_call_phys4(gop->query_mode, gop,
 					gop->mode->mode, &size, &info);
-		if (status == EFI_SUCCESS && (!first_gop || pciio)) {
+		if (status == EFI_SUCCESS && (!first_gop || pciio || edid)) {
 			/*
-			 * Apple provide GOPs that are not backed by
-			 * real hardware (they're used to handle
-			 * multiple displays). The workaround is to
-			 * search for a GOP implementing the PCIIO
-			 * protocol, and if one isn't found, to just
-			 * fallback to the first GOP.
+			 * Some vendors provide GOPs that are not
+			 * backed by real hardware (they're used to
+			 * handle multiple displays). The workaround
+			 * is to search for a GOP implementing the
+			 * PCIIO or EDID discovered protocol, and if
+			 * one isn't found, to just fallback to the
+			 * first GOP.
 			 */
 			width = info->horizontal_resolution;
 			height = info->vertical_resolution;
@@ -288,10 +293,10 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
 			pixels_per_scan_line = info->pixels_per_scan_line;
 
 			/*
-			 * Once we've found a GOP supporting PCIIO,
-			 * don't bother looking any further.
+			 * Once we've found a GOP supporting PCIIO or
+			 * EDID, don't bother looking any further.
 			 */
-			if (pciio)
+			if (pciio || edid)
 				break;
 
 			first_gop = gop;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index ec45ccd..f6fd2ff 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -312,6 +312,9 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
 #define EFI_FILE_SYSTEM_GUID \
     EFI_GUID(  0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
 
+#define EFI_EDID_DISCOVERED_GUID \
+    EFI_GUID(  0x1c0c34f6, 0xd380, 0x41fa, 0xa0, 0x49, 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa )
+
 typedef struct {
 	efi_guid_t guid;
 	u64 table;
-- 
1.7.10.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-23 20:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-23 18:08 [PATCH 1/3] x86: Expand EFI GOP handle search Matthew Garrett
2012-05-23 18:08 ` [PATCH 2/3] x86: Allow early PCI quirks to trigger on bus 1 Matthew Garrett
2012-05-23 18:08 ` [PATCH 3/3] x86: Handle broken Broadcom UEFI driver on Apple hardware Matthew Garrett
2012-05-23 20:21 ` [PATCH 1/3] x86: Expand EFI GOP handle search Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®