[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] Prefer GOP devices which implement the pci_io protocol
From: |
Matthew Garrett |
Subject: |
[PATCH 3/4] Prefer GOP devices which implement the pci_io protocol |
Date: |
Wed, 8 Feb 2012 11:51:57 -0500 |
Some systems (especially Apple) implement multiple GOP devices representing
the same hardware. The preferred device is the one that also implements the
PCI io protocol.
---
ChangeLog | 5 +++++
grub-core/video/efi_gop.c | 38 +++++++++++++++++++++++++++++++++++++-
2 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e662f3d..26d779b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-02-08 Matthew Garrett <address@hidden>
+ * grub-core/video/efi_gop.c (check_protocol): Prefer GOP devices which
+ implement the pci_io protocol.
+
+2012-02-08 Matthew Garrett <address@hidden>
+
* grub-core/kern/efi/efi.c (grub_efi_get_variable): Add new function.
* include/grub/efi/efi.h: Likewise.
* include/grub/efi/api.h: Add guid for EFI-specified variables.
diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
index d14ae98..47e3ee9 100644
--- a/grub-core/video/efi_gop.c
+++ b/grub-core/video/efi_gop.c
@@ -28,11 +28,14 @@
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/efi/graphics_output.h>
+#include <grub/efi/pci.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_efi_guid_t graphics_output_guid = GRUB_EFI_GOP_GUID;
+static grub_efi_guid_t pci_io_guid = GRUB_EFI_PCI_IO_GUID;
static struct grub_efi_gop *gop;
+static grub_efi_handle_t gop_handle;
static unsigned old_mode;
static int restore_needed;
@@ -47,7 +50,40 @@ static struct
static int
check_protocol (void)
{
- gop = grub_efi_locate_protocol (&graphics_output_guid, 0);
+ grub_efi_handle_t *handle, *handles;
+ grub_efi_uintn_t num_handles;
+
+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL,
+ &pci_io_guid, NULL, &num_handles);
+ if (!num_handles || !handles)
+ return 0;
+
+ for (handle = handles; num_handles--; handle++)
+ {
+ gop = grub_efi_open_protocol (*handle, &graphics_output_guid,
+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (gop)
+ {
+ gop_handle = *handle;
+ break;
+ }
+ }
+
+ grub_free(handles);
+
+ if (!gop)
+ {
+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL,
+ &graphics_output_guid, NULL,
&num_handles);
+ gop = grub_efi_open_protocol (*handles, &graphics_output_guid,
+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ if (gop)
+ {
+ gop_handle = *handles;
+ }
+ grub_free(handles);
+ }
+
if (gop)
return 1;
--
1.7.7.6
[PATCH 4/4] Add support for getting EDID via EFI, Matthew Garrett, 2012/02/08
[PATCH 3/4] Prefer GOP devices which implement the pci_io protocol,
Matthew Garrett <=
[PATCH 1/4] Add PCI protocols, Matthew Garrett, 2012/02/08
Re: Some improvements to EFI GOP support, Keshav P R, 2012/02/08