Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/loader/framebuffer.c
| Show First 20 Lines • Show All 584 Lines • ▼ Show 20 Lines | if (status == EFI_BUFFER_TOO_SMALL) { | ||||
| hlist = malloc(hsize); | hlist = malloc(hsize); | ||||
| if (hlist == NULL) | if (hlist == NULL) | ||||
| return (ENOMEM); | return (ENOMEM); | ||||
| status = BS->LocateHandle(ByProtocol, &gop_guid, NULL, &hsize, | status = BS->LocateHandle(ByProtocol, &gop_guid, NULL, &hsize, | ||||
| hlist); | hlist); | ||||
| if (EFI_ERROR(status)) | if (EFI_ERROR(status)) | ||||
| free(hlist); | free(hlist); | ||||
| } | } | ||||
| if (EFI_ERROR(status)) | |||||
| return (efi_status_to_errno(status)); | |||||
| if (EFI_ERROR(status)) { | |||||
| status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); | |||||
| if (status == EFI_SUCCESS) { | |||||
| gfx_state->tg_fb_type = FB_UGA; | |||||
| gfx_state->tg_private = uga; | |||||
| } else { | |||||
| return (efi_status_to_errno(status)); | |||||
| } | |||||
| } else { | |||||
| nhandles = hsize / sizeof(*hlist); | nhandles = hsize / sizeof(*hlist); | ||||
| /* | /* | ||||
| * Search for ConOut protocol, if not found, use first handle. | * Search for ConOut protocol, if not found, use first handle. | ||||
| */ | */ | ||||
| gop_handle = NULL; | gop_handle = NULL; | ||||
| for (i = 0; i < nhandles; i++) { | for (i = 0; i < nhandles; i++) { | ||||
| EFI_GRAPHICS_OUTPUT_PROTOCOL *tgop; | EFI_GRAPHICS_OUTPUT_PROTOCOL *tgop; | ||||
| void *dummy; | void *dummy; | ||||
| status = OpenProtocolByHandle(hlist[i], &gop_guid, (void **)&tgop); | status = OpenProtocolByHandle(hlist[i], &gop_guid, | ||||
| (void **)&tgop); | |||||
| if (status != EFI_SUCCESS) | if (status != EFI_SUCCESS) | ||||
| continue; | continue; | ||||
| if (tgop->Mode->Info->PixelFormat == PixelBltOnly || | if (tgop->Mode->Info->PixelFormat == PixelBltOnly || | ||||
| tgop->Mode->Info->PixelFormat >= PixelFormatMax) | tgop->Mode->Info->PixelFormat >= PixelFormatMax) | ||||
| continue; | continue; | ||||
| status = OpenProtocolByHandle(hlist[i], &conout_guid, &dummy); | status = OpenProtocolByHandle(hlist[i], &conout_guid, | ||||
| &dummy); | |||||
| if (status == EFI_SUCCESS) { | if (status == EFI_SUCCESS) { | ||||
| gop_handle = hlist[i]; | gop_handle = hlist[i]; | ||||
| gop = tgop; | gop = tgop; | ||||
| break; | break; | ||||
| } else if (gop_handle == NULL) { | } else if (gop_handle == NULL) { | ||||
| gop_handle = hlist[i]; | gop_handle = hlist[i]; | ||||
| gop = tgop; | gop = tgop; | ||||
| } | } | ||||
| } | } | ||||
| free(hlist); | free(hlist); | ||||
| if (gop_handle == NULL) | |||||
| return (ENXIO); | |||||
| if (gop_handle != NULL) { | |||||
| gfx_state->tg_fb_type = FB_GOP; | gfx_state->tg_fb_type = FB_GOP; | ||||
| gfx_state->tg_private = gop; | gfx_state->tg_private = gop; | ||||
| if (edid_info == NULL) | if (edid_info == NULL) | ||||
| edid_info = efifb_gop_get_edid(gop_handle); | edid_info = efifb_gop_get_edid(gop_handle); | ||||
| } else { | |||||
| status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); | |||||
| if (status == EFI_SUCCESS) { | |||||
| gfx_state->tg_fb_type = FB_UGA; | |||||
| gfx_state->tg_private = uga; | |||||
| } else { | |||||
| return (efi_status_to_errno(status)); | |||||
| } | |||||
| } | } | ||||
| switch (gfx_state->tg_fb_type) { | switch (gfx_state->tg_fb_type) { | ||||
| case FB_GOP: | case FB_GOP: | ||||
| rv = efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info); | rv = efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info); | ||||
| break; | break; | ||||
| case FB_UGA: | case FB_UGA: | ||||
| ▲ Show 20 Lines • Show All 348 Lines • Show Last 20 Lines | |||||