mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
Moved check_status to a header file and properly case/named it
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
//#define EFIAPI __attribute__((ms_abi))
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
#define check_status(s, msg) if(EFI_ERROR((s))){Print(L"EFI_ERROR: " msg L" %d\n", (s)); return (s);}
|
||||
#include "utility.h"
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
@@ -19,7 +17,7 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *gfx_out_proto;
|
||||
EFI_GUID gfx_out_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
|
||||
status = SystemTable->BootServices->LocateProtocol(&gfx_out_guid, NULL, (void**)&gfx_out_proto);
|
||||
check_status(status, "LocateProtocol gfx");
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "LocateProtocol gfx");
|
||||
|
||||
const uint32_t modes = gfx_out_proto->Mode->MaxMode;
|
||||
uint32_t res =
|
||||
@@ -31,7 +29,7 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
UINTN size = 0;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info = NULL;
|
||||
status = gfx_out_proto->QueryMode(gfx_out_proto, i, &size, &info);
|
||||
check_status(status, "QueryMode");
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "QueryMode");
|
||||
|
||||
const uint32_t new_res =
|
||||
info->HorizontalResolution *
|
||||
@@ -45,7 +43,7 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
|
||||
|
||||
if (best != (uint32_t)-1) {
|
||||
status = gfx_out_proto->SetMode(gfx_out_proto, best);
|
||||
check_status(status, "SetMode");
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "SetMode");
|
||||
Print(L"*");
|
||||
}
|
||||
Print(L"%ux%u\n",
|
||||
|
||||
9
src/arch/x86_64/utility.h
Normal file
9
src/arch/x86_64/utility.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
#define CHECK_EFI_STATUS_OR_RETURN(s, msg) \
|
||||
if (EFI_ERROR((s))) { \
|
||||
Print(L"EFI_ERROR: " msg L" %d\n", (s)); \
|
||||
return (s); \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user