4 extern EFI_GUID GraphicsOutputProtocol
;
7 print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL
*gop
)
13 imax
= gop
->Mode
->MaxMode
;
14 Print(L
"GOP reports MaxMode %d\n", imax
);
16 Print(L
"gop->Mode is NULL\n");
20 for (i
= 0; i
< imax
; i
++) {
21 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
*info
;
23 rc
= uefi_call_wrapper(gop
->QueryMode
, 4, gop
, i
, &SizeOfInfo
,
25 if (EFI_ERROR(rc
) && rc
== EFI_NOT_STARTED
) {
26 Print(L
"gop->QueryMode() returned %r\n", rc
);
27 Print(L
"Trying to start GOP with SetMode().\n");
28 rc
= uefi_call_wrapper(gop
->SetMode
, 2, gop
,
29 gop
->Mode
? gop
->Mode
->Mode
: 0);
30 rc
= uefi_call_wrapper(gop
->QueryMode
, 4, gop
, i
,
35 Print(L
"%d: Bad response from QueryMode: %r (%d)\n",
39 Print(L
"%c%d: %dx%d ",
41 CompareMem(info
,gop
->Mode
->Info
,sizeof(*info
)) == 0
43 i
, info
->HorizontalResolution
, info
->VerticalResolution
);
44 switch(info
->PixelFormat
) {
45 case PixelRedGreenBlueReserved8BitPerColor
:
48 case PixelBlueGreenRedReserved8BitPerColor
:
52 Print(L
"R:%08x G:%08x B:%08x X:%08x",
53 info
->PixelInformation
.RedMask
,
54 info
->PixelInformation
.GreenMask
,
55 info
->PixelInformation
.BlueMask
,
56 info
->PixelInformation
.ReservedMask
);
62 Print(L
"(Invalid pixel format)");
65 Print(L
" pitch %d\n", info
->PixelsPerScanLine
);
70 SetWatchdog(UINTN seconds
)
73 rc
= uefi_call_wrapper(BS
->SetWatchdogTimer
, 4, seconds
, 0x1ffff,
77 StatusToString(Buffer
, rc
);
78 Print(L
"Bad response from QueryMode: %s (%d)\n", Buffer
, rc
);
84 efi_main (EFI_HANDLE image_handle
, EFI_SYSTEM_TABLE
*systab
)
87 EFI_GRAPHICS_OUTPUT_PROTOCOL
*gop
;
89 InitializeLib(image_handle
, systab
);
93 rc
= LibLocateProtocol(&GraphicsOutputProtocol
, (void **)&gop
);
95 Print(L
"Could not locate GOP: %r\n", rc
);
100 Print(L
"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc
);
101 return EFI_UNSUPPORTED
;