OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
BootKicker.c
Go to the documentation of this file.
1
15#include <PiDxe.h>
16#include <Guid/AppleFile.h>
17#include <Library/BaseMemoryLib.h>
18#include <Library/DebugLib.h>
19#include <Library/MemoryAllocationLib.h>
23#include <Library/OcFileLib.h>
24#include <Library/OcMiscLib.h>
25#include <Library/UefiApplicationEntryPoint.h>
26#include <Library/UefiBootServicesTableLib.h>
27#include <Library/UefiLib.h>
28#include <Protocol/DevicePath.h>
29#include <Protocol/GraphicsOutput.h>
30
31EFI_STATUS
32EFIAPI
34 IN EFI_HANDLE ImageHandle,
35 IN EFI_SYSTEM_TABLE *SystemTable
36 )
37{
38 EFI_STATUS Status;
39 EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
40 EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Pixel;
41 UINTN Index;
42
43 gBS->SetWatchdogTimer (0, 0, 0, NULL);
44
45 OcProvideConsoleGop (FALSE);
46
47 OcSetConsoleResolution (0, 0, 0, FALSE);
48
49 Status = gBS->HandleProtocol (
50 gST->ConsoleOutHandle,
52 (VOID **)&Gop
53 );
54
55 if (EFI_ERROR (Status)) {
56 //
57 // Note: Ensure that stall value is within UINT32 in nanoseconds, for
58 // firmware such as APTIO IV with less robust Stall implementations.
59 //
60 for (Index = 0; Index < 10; ++Index) {
61 gBS->Stall (SECONDS_TO_MICROSECONDS (1));
62 }
63
64 return Status;
65 }
66
67 Status = OcLaunchAppleBootPicker ();
68
69 if (!EFI_ERROR (Status)) {
70 //
71 // DirectResetCold too soon after NVRAM write has been observed to lose values written.
72 // However Apple Picker can be very slow to exit, so added delay may well not be necessary.
73 //
74 gBS->Stall (100);
76 }
77
78 Pixel.Raw = 0x0;
79 if (Status == EFI_NOT_FOUND) {
80 //
81 // Red. No BootPicker in firmware or we cannot get it.
82 //
83 Pixel.Pixel.Red = 0xFF;
84 } else if (Status == EFI_UNSUPPORTED) {
85 //
86 // Yellow. BootPicker does not start.
87 //
88 Pixel.Pixel.Red = 0xFF;
89 Pixel.Pixel.Green = 0xFF;
90 } else {
91 //
92 // Fuchsia. BootPicker does not load.
93 //
94 Pixel.Pixel.Blue = 0xFF;
95 Pixel.Pixel.Red = 0xFF;
96 }
97
98 Gop->Blt (
99 Gop,
100 &Pixel.Pixel,
101 EfiBltVideoFill,
102 0,
103 0,
104 0,
105 0,
106 Gop->Mode->Info->HorizontalResolution,
107 Gop->Mode->Info->VerticalResolution,
108 0
109 );
110
111 //
112 // Note: Ensure that stall value is within UINT32 in nanoseconds.
113 //
114 for (Index = 0; Index < 10; ++Index) {
115 gBS->Stall (SECONDS_TO_MICROSECONDS (1));
116 }
117
118 return EFI_SUCCESS;
119}
EFI_STATUS EFIAPI UefiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition BootKicker.c:33
EFI_STATUS OcLaunchAppleBootPicker(VOID)
EFI_SYSTEM_TABLE * gST
EFI_BOOT_SERVICES * gBS
EFI_STATUS OcSetConsoleResolution(IN UINT32 Width OPTIONAL, IN UINT32 Height OPTIONAL, IN UINT32 Bpp OPTIONAL, IN BOOLEAN Force)
EFI_STATUS OcProvideConsoleGop(IN BOOLEAN Route)
Definition ConsoleGop.c:81
VOID DirectResetCold(VOID)
Definition DirectReset.c:16
#define SECONDS_TO_MICROSECONDS(x)
Definition OcMiscLib.h:30
EFI_GUID gEfiGraphicsOutputProtocolGuid