Skip to content

Commit 38cb5ef

Browse files
Matthew GarrettMatt Fleming
authored andcommitted
X86: Improve GOP detection in the EFI boot stub
We currently use the PCI IO protocol as a proxy for a functional GOP. This is less than ideal, since some platforms will put the GOP on output devices rather than the GPU itself. Move to using the conout protocol. This is not guaranteed per-spec, but is part of the consplitter implementation that causes this problem in the first place and so should be reliable. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
1 parent 5698bd7 commit 38cb5ef

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

arch/x86/boot/compressed/eboot.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -276,28 +276,31 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
276276
nr_gops = size / sizeof(void *);
277277
for (i = 0; i < nr_gops; i++) {
278278
struct efi_graphics_output_mode_info *info;
279-
efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID;
280-
void *pciio;
279+
efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID;
280+
bool conout_found = false;
281+
void *dummy;
281282
void *h = gop_handle[i];
282283

283284
status = efi_call_phys3(sys_table->boottime->handle_protocol,
284285
h, proto, &gop);
285286
if (status != EFI_SUCCESS)
286287
continue;
287288

288-
efi_call_phys3(sys_table->boottime->handle_protocol,
289-
h, &pciio_proto, &pciio);
289+
status = efi_call_phys3(sys_table->boottime->handle_protocol,
290+
h, &conout_proto, &dummy);
291+
292+
if (status == EFI_SUCCESS)
293+
conout_found = true;
290294

291295
status = efi_call_phys4(gop->query_mode, gop,
292296
gop->mode->mode, &size, &info);
293-
if (status == EFI_SUCCESS && (!first_gop || pciio)) {
297+
if (status == EFI_SUCCESS && (!first_gop || conout_found)) {
294298
/*
295-
* Apple provide GOPs that are not backed by
296-
* real hardware (they're used to handle
297-
* multiple displays). The workaround is to
298-
* search for a GOP implementing the PCIIO
299-
* protocol, and if one isn't found, to just
300-
* fallback to the first GOP.
299+
* Systems that use the UEFI Console Splitter may
300+
* provide multiple GOP devices, not all of which are
301+
* backed by real hardware. The workaround is to search
302+
* for a GOP implementing the ConOut protocol, and if
303+
* one isn't found, to just fall back to the first GOP.
301304
*/
302305
width = info->horizontal_resolution;
303306
height = info->vertical_resolution;
@@ -308,10 +311,10 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
308311
pixels_per_scan_line = info->pixels_per_scan_line;
309312

310313
/*
311-
* Once we've found a GOP supporting PCIIO,
314+
* Once we've found a GOP supporting ConOut,
312315
* don't bother looking any further.
313316
*/
314-
if (pciio)
317+
if (conout_found)
315318
break;
316319

317320
first_gop = gop;

arch/x86/boot/compressed/eboot.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
1515
#define EFI_READ_CHUNK_SIZE (1024 * 1024)
1616

17+
#define EFI_CONSOLE_OUT_DEVICE_GUID \
18+
EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x0, 0x90, 0x27, \
19+
0x3f, 0xc1, 0x4d)
20+
1721
#define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0
1822
#define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1
1923
#define PIXEL_BIT_MASK 2

0 commit comments

Comments
 (0)