Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

efi/libstub: gop: Find GOP handle instead of GOP data

The device handle of the GOP device is required to retrieve the
correct EDID data. Find the handle instead of the GOP data. Still
return the GOP data in the function arguments, as we already looked
it up.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

authored by

Thomas Zimmermann and committed by
Ard Biesheuvel
9d805709 d85b56af

+17 -10
+17 -10
drivers/firmware/efi/libstub/gop.c
··· 402 402 } 403 403 } 404 404 405 - static efi_graphics_output_protocol_t *find_gop(unsigned long num, 406 - const efi_handle_t handles[]) 405 + static efi_handle_t find_handle_with_primary_gop(unsigned long num, const efi_handle_t handles[], 406 + efi_graphics_output_protocol_t **found_gop) 407 407 { 408 408 efi_graphics_output_protocol_t *first_gop; 409 - efi_handle_t h; 409 + efi_handle_t h, first_gop_handle; 410 410 411 + first_gop_handle = NULL; 411 412 first_gop = NULL; 412 413 413 414 for_each_efi_handle(h, handles, num) { ··· 443 442 */ 444 443 status = efi_bs_call(handle_protocol, h, 445 444 &EFI_CONSOLE_OUT_DEVICE_GUID, &dummy); 446 - if (status == EFI_SUCCESS) 447 - return gop; 448 - 449 - if (!first_gop) 445 + if (status == EFI_SUCCESS) { 446 + if (found_gop) 447 + *found_gop = gop; 448 + return h; 449 + } else if (!first_gop_handle) { 450 + first_gop_handle = h; 450 451 first_gop = gop; 452 + } 451 453 } 452 454 453 - return first_gop; 455 + if (found_gop) 456 + *found_gop = first_gop; 457 + return first_gop_handle; 454 458 } 455 459 456 460 efi_status_t efi_setup_gop(struct screen_info *si) 457 461 { 458 462 efi_handle_t *handles __free(efi_pool) = NULL; 463 + efi_handle_t handle; 459 464 efi_graphics_output_protocol_mode_t *mode; 460 465 efi_graphics_output_mode_info_t *info; 461 466 efi_graphics_output_protocol_t *gop; ··· 474 467 if (status != EFI_SUCCESS) 475 468 return status; 476 469 477 - gop = find_gop(num, handles); 478 - if (!gop) 470 + handle = find_handle_with_primary_gop(num, handles, &gop); 471 + if (!handle) 479 472 return EFI_NOT_FOUND; 480 473 481 474 /* Change mode if requested */