@@ -461,25 +461,25 @@ setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line,
461461 }
462462}
463463
464- static efi_graphics_output_protocol_t *
465- find_gop ( efi_guid_t * proto , unsigned long size , void * * handles )
464+ static efi_graphics_output_protocol_t * find_gop ( unsigned long num ,
465+ const efi_handle_t handles [] )
466466{
467467 efi_graphics_output_protocol_t * first_gop ;
468468 efi_handle_t h ;
469469
470470 first_gop = NULL ;
471471
472- for_each_efi_handle (h , handles , efi_get_handle_num ( size ) ) {
472+ for_each_efi_handle (h , handles , num ) {
473473 efi_status_t status ;
474474
475475 efi_graphics_output_protocol_t * gop ;
476476 efi_graphics_output_protocol_mode_t * mode ;
477477 efi_graphics_output_mode_info_t * info ;
478-
479- efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID ;
480478 void * dummy = NULL ;
481479
482- status = efi_bs_call (handle_protocol , h , proto , (void * * )& gop );
480+ status = efi_bs_call (handle_protocol , h ,
481+ & EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID ,
482+ (void * * )& gop );
483483 if (status != EFI_SUCCESS )
484484 continue ;
485485
@@ -499,7 +499,8 @@ find_gop(efi_guid_t *proto, unsigned long size, void **handles)
499499 * Once we've found a GOP supporting ConOut,
500500 * don't bother looking any further.
501501 */
502- status = efi_bs_call (handle_protocol , h , & conout_proto , & dummy );
502+ status = efi_bs_call (handle_protocol , h ,
503+ & EFI_CONSOLE_OUT_DEVICE_GUID , & dummy );
503504 if (status == EFI_SUCCESS )
504505 return gop ;
505506
@@ -510,16 +511,22 @@ find_gop(efi_guid_t *proto, unsigned long size, void **handles)
510511 return first_gop ;
511512}
512513
513- static efi_status_t setup_gop (struct screen_info * si , efi_guid_t * proto ,
514- unsigned long size , void * * handles )
514+ efi_status_t efi_setup_gop (struct screen_info * si )
515515{
516- efi_graphics_output_protocol_t * gop ;
516+ efi_handle_t * handles __free ( efi_pool ) = NULL ;
517517 efi_graphics_output_protocol_mode_t * mode ;
518518 efi_graphics_output_mode_info_t * info ;
519+ efi_graphics_output_protocol_t * gop ;
520+ efi_status_t status ;
521+ unsigned long num ;
519522
520- gop = find_gop (proto , size , handles );
523+ status = efi_bs_call (locate_handle_buffer , EFI_LOCATE_BY_PROTOCOL ,
524+ & EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID , NULL , & num ,
525+ & handles );
526+ if (status != EFI_SUCCESS )
527+ return status ;
521528
522- /* Did we find any GOPs? */
529+ gop = find_gop ( num , handles );
523530 if (!gop )
524531 return EFI_NOT_FOUND ;
525532
@@ -551,29 +558,3 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
551558
552559 return EFI_SUCCESS ;
553560}
554-
555- /*
556- * See if we have Graphics Output Protocol
557- */
558- efi_status_t efi_setup_gop (struct screen_info * si , efi_guid_t * proto ,
559- unsigned long size )
560- {
561- efi_status_t status ;
562- void * * gop_handle = NULL ;
563-
564- status = efi_bs_call (allocate_pool , EFI_LOADER_DATA , size ,
565- (void * * )& gop_handle );
566- if (status != EFI_SUCCESS )
567- return status ;
568-
569- status = efi_bs_call (locate_handle , EFI_LOCATE_BY_PROTOCOL , proto , NULL ,
570- & size , gop_handle );
571- if (status != EFI_SUCCESS )
572- goto free_handle ;
573-
574- status = setup_gop (si , proto , size , gop_handle );
575-
576- free_handle :
577- efi_bs_call (free_pool , gop_handle );
578- return status ;
579- }
0 commit comments