Print graphics modes
This commit is contained in:
parent
eb15f473c6
commit
edd7979b3f
43
src/main.c
43
src/main.c
@ -38,8 +38,19 @@ static void write_hex64(size_t n)
|
|||||||
write_string(s);
|
write_string(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wait_key(void)
|
||||||
|
{
|
||||||
|
EFI_INPUT_KEY key;
|
||||||
|
write_string(L"Press any key...\r\n");
|
||||||
|
while (g_system_table->ConIn->ReadKeyStroke(g_system_table->ConIn, &key) == EFI_NOT_READY)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void check_gop_handle(EFI_HANDLE handle)
|
static void check_gop_handle(EFI_HANDLE handle)
|
||||||
{
|
{
|
||||||
|
write_string(L"Going to check GOP handle...\r\n");
|
||||||
|
wait_key();
|
||||||
EFI_HANDLE interface = NULL;
|
EFI_HANDLE interface = NULL;
|
||||||
EFI_STATUS status = g_system_table->BootServices->HandleProtocol(handle,
|
EFI_STATUS status = g_system_table->BootServices->HandleProtocol(handle,
|
||||||
&(EFI_GUID)EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID,
|
&(EFI_GUID)EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID,
|
||||||
@ -63,6 +74,32 @@ static void check_gop_handle(EFI_HANDLE handle)
|
|||||||
write_string(L"\r\n");
|
write_string(L"\r\n");
|
||||||
|
|
||||||
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop = (EFI_GRAPHICS_OUTPUT_PROTOCOL *)interface;
|
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop = (EFI_GRAPHICS_OUTPUT_PROTOCOL *)interface;
|
||||||
|
UINTN info_size;
|
||||||
|
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * info;
|
||||||
|
for (uint32_t mode_number = 0u;
|
||||||
|
(status = gop->QueryMode(gop, mode_number, &info_size, &info)) == EFI_SUCCESS;
|
||||||
|
mode_number++)
|
||||||
|
{
|
||||||
|
write_string(L"Mode ");
|
||||||
|
write_uint(mode_number);
|
||||||
|
write_string(L": ");
|
||||||
|
write_uint(info->HorizontalResolution);
|
||||||
|
write_string(L"x");
|
||||||
|
write_uint(info->VerticalResolution);
|
||||||
|
write_string(L" f=");
|
||||||
|
write_uint(info->PixelFormat);
|
||||||
|
write_string(L" s=");
|
||||||
|
write_uint(info->PixelsPerScanLine);
|
||||||
|
write_string(L"\r\n");
|
||||||
|
g_system_table->BootServices->FreePool(info);
|
||||||
|
if ((mode_number % 20) == 19)
|
||||||
|
{
|
||||||
|
wait_key();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write_string(L"Error ");
|
||||||
|
write_uint(status);
|
||||||
|
write_string(L" from QueryMode\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_memory_map(void)
|
static void dump_memory_map(void)
|
||||||
@ -114,7 +151,6 @@ EFI_STATUS
|
|||||||
efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * system_table)
|
efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * system_table)
|
||||||
{
|
{
|
||||||
EFI_STATUS status;
|
EFI_STATUS status;
|
||||||
EFI_INPUT_KEY key;
|
|
||||||
|
|
||||||
g_system_table = system_table;
|
g_system_table = system_table;
|
||||||
|
|
||||||
@ -151,10 +187,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * system_table)
|
|||||||
check_gop_handle(buffer[i]);
|
check_gop_handle(buffer[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_string(L"Press any key...\r\n");
|
wait_key();
|
||||||
while ((status = system_table->ConIn->ReadKeyStroke(system_table->ConIn, &key)) == EFI_NOT_READY)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user