OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcBootManagementLib.c
Go to the documentation of this file.
1
7
8#include <Guid/AppleFile.h>
10#include <Guid/OcVariable.h>
11
13
18#include <Protocol/LoadedImage.h>
19#include <Protocol/OcAudio.h>
20#include <Protocol/SimpleTextOut.h>
21
22#include <Library/BaseLib.h>
23#include <Library/BaseMemoryLib.h>
24#include <Library/BaseOverflowLib.h>
26#include <Library/OcCryptoLib.h>
28#include <Library/DevicePathLib.h>
29#include <Library/OcTimerLib.h>
30#include <Library/OcTypingLib.h>
31#include <Library/MemoryAllocationLib.h>
35#include <Library/OcFileLib.h>
36#include <Library/OcMainLib.h>
37#include <Library/OcMiscLib.h>
38#include <Library/OcRtcLib.h>
39#include <Library/OcStringLib.h>
41#include <Library/PrintLib.h>
42#include <Library/UefiBootServicesTableLib.h>
43#include <Library/UefiRuntimeServicesTableLib.h>
44#include <Library/UefiLib.h>
45#include <Library/ResetSystemLib.h>
46
47STATIC UINT32 mSavedGopMode;
49STATIC INT32 mSavedConsoleMode;
50
51STATIC
52EFI_STATUS
54 VOID
55 )
56{
57 EFI_STATUS Status;
58 EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
59
61
62 mSavedConsoleMode = gST->ConOut->Mode->Mode;
63
64 Status = gBS->HandleProtocol (
65 gST->ConsoleOutHandle,
67 (VOID **)&Gop
68 );
69
70 if (EFI_ERROR (Status)) {
71 mSavedGopMode = MAX_UINT32;
72 } else {
73 mSavedGopMode = Gop->Mode->Mode;
74 }
75
76 DEBUG ((
77 DEBUG_INFO,
78 "OCB: Saved mode %d/%d/%u - %r\n",
82 Status
83 ));
84
85 return Status;
86}
87
88STATIC
89EFI_STATUS
91 VOID
92 )
93{
94 EFI_STATUS Status;
95 EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
96 UINT32 FoundGopMode;
97
99
100 //
101 // This can reset GOP resolution.
102 //
103 gST->ConOut->SetMode (gST->ConOut, mSavedConsoleMode);
104
105 FoundGopMode = MAX_UINT32;
106 if (mSavedGopMode == MAX_UINT32) {
107 Status = EFI_SUCCESS;
108 } else {
109 Status = gBS->HandleProtocol (
110 gST->ConsoleOutHandle,
112 (VOID **)&Gop
113 );
114
115 if (!EFI_ERROR (Status)) {
116 FoundGopMode = Gop->Mode->Mode;
117 if (Gop->Mode->Mode != mSavedGopMode) {
118 Status = Gop->SetMode (Gop, mSavedGopMode);
119 }
120 }
121 }
122
123 DEBUG ((
124 DEBUG_INFO,
125 "OCB: Restored mode %d/%d/%u(%u) - %r\n",
129 FoundGopMode,
130 Status
131 ));
132
133 return Status;
134}
135
136STATIC
137EFI_STATUS
139 IN OC_BOOT_CONTEXT *BootContext,
140 OUT OC_BOOT_ENTRY **ChosenBootEntry
141 )
142{
143 EFI_STATUS Status;
144 OC_BOOT_ENTRY **BootEntries;
145 UINT32 EntryReason;
146
147 ASSERT (
148 BootContext->PickerContext->ApplePickerUnsupported
149 || (BootContext->PickerContext->PickerMode != OcPickerModeApple)
150 );
151
152 BootEntries = OcEnumerateEntries (BootContext);
153 if (BootEntries == NULL) {
154 return EFI_OUT_OF_RESOURCES;
155 }
156
157 //
158 // We are not allowed to have no default entry.
159 // However, if default entry is a tool or a system entry, never autoboot it.
160 //
161 if (BootContext->DefaultEntry == NULL) {
162 BootContext->DefaultEntry = BootEntries[0];
163 BootContext->PickerContext->TimeoutSeconds = 0;
164 }
165
166 //
167 // Ensure that picker entry reason is set as it can be read by boot.efi.
168 //
169 EntryReason = ApplePickerEntryReasonUnknown;
170 gRT->SetVariable (
173 EFI_VARIABLE_BOOTSERVICE_ACCESS,
174 sizeof (EntryReason),
175 &EntryReason
176 );
177
178 Status = OcInitHotKeys (BootContext->PickerContext);
179 if (EFI_ERROR (Status)) {
180 FreePool (BootEntries);
181 return Status;
182 }
183
184 Status = BootContext->PickerContext->ShowMenu (
185 BootContext,
186 BootEntries,
187 ChosenBootEntry
188 );
189
190 OcFreeHotKeys (BootContext->PickerContext);
191
192 FreePool (BootEntries);
193
194 return Status;
195}
196
197BOOLEAN
198EFIAPI
200 IN CONST UINT8 *Password,
201 IN UINT32 PasswordSize,
202 IN CONST OC_PRIVILEGE_CONTEXT *PrivilegeContext
203 )
204{
205 BOOLEAN Result;
206
207 Result = OcVerifyPasswordSha512 (
208 Password,
209 PasswordSize,
210 PrivilegeContext->Salt,
211 PrivilegeContext->SaltSize,
212 PrivilegeContext->Hash
213 );
214
215 return Result;
216}
217
218EFI_STATUS
220 IN OC_PICKER_CONTEXT *PickerContext,
221 IN OC_PRIVILEGE_LEVEL Level
222 )
223{
224 EFI_STATUS Status;
225 BOOLEAN HotKeysAlreadyLive;
226
227 if ( (PickerContext->PrivilegeContext == NULL)
228 || (PickerContext->PrivilegeContext->CurrentLevel >= Level))
229 {
230 return EFI_SUCCESS;
231 }
232
233 HotKeysAlreadyLive = (PickerContext->HotKeyContext != NULL);
234
235 if (!HotKeysAlreadyLive) {
236 Status = OcInitHotKeys (PickerContext);
237 if (EFI_ERROR (Status)) {
238 return Status;
239 }
240 }
241
242 Status = PickerContext->RequestPrivilege (
243 PickerContext,
245 );
246 if (!EFI_ERROR (Status)) {
247 PickerContext->PrivilegeContext->CurrentLevel = Level;
248 }
249
250 if (!HotKeysAlreadyLive) {
251 OcFreeHotKeys (PickerContext);
252 }
253
254 return Status;
255}
256
257EFI_STATUS
259 IN OC_PICKER_CONTEXT *Context
260 )
261{
262 EFI_STATUS Status;
264 OC_BOOT_CONTEXT *BootContext;
265 OC_BOOT_ENTRY *Chosen;
266 BOOLEAN SaidWelcome;
268 BOOLEAN IsApplePickerSelection;
269
270 SaidWelcome = FALSE;
271
273
274 KeyMap = OcAppleKeyMapInstallProtocols (FALSE);
275 if (KeyMap == NULL) {
276 DEBUG ((DEBUG_ERROR, "OCB: AppleKeyMap locate failure\n"));
277 return EFI_NOT_FOUND;
278 }
279
280 //
281 // Use builtin text renderer extension:
282 // - Set for text-based picker, to mark dirty due to BIOS logo, early logs, etc.
283 // (which are not cleared by initial resync when starting in console graphics mode).
284 // - Do no set for graphics-based picker, since we want (expected behaviour, also
285 // similar to how system renderers tend to behave) the debug log to continue on
286 // over the graphics from the position it has reached so far, if we are running
287 // in a mode which will show text output.
288 //
289 if (Context->ShowMenu == OcShowSimpleBootMenu) {
290 gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED);
291 }
292
293 //
294 // This one is handled as is for Apple BootPicker for now.
295 //
296 if (Context->PickerCommand != OcPickerDefault) {
298 if (EFI_ERROR (Status)) {
299 if (Status != EFI_ABORTED) {
300 ASSERT (FALSE);
301 return Status;
302 }
303
304 Context->PickerCommand = OcPickerDefault;
305 }
306 }
307
308 IsApplePickerSelection = FALSE;
309
310 if ((Context->PickerCommand == OcPickerShowPicker) && (Context->PickerMode == OcPickerModeApple)) {
311 Status = OcLaunchAppleBootPicker ();
312 if (EFI_ERROR (Status)) {
313 DEBUG ((DEBUG_WARN, "OCB: Apple BootPicker failed - %r, fallback to builtin\n", Status));
314 Context->ApplePickerUnsupported = TRUE;
315 } else {
316 IsApplePickerSelection = TRUE;
317 }
318 }
319
320 if ((Context->PickerCommand != OcPickerShowPicker) && (Context->PickerCommand != OcPickerDefault)) {
321 //
322 // We cannot ignore auxiliary entries for all other modes.
323 //
324 Context->HideAuxiliary = FALSE;
325 }
326
327 while (TRUE) {
328 //
329 // Never show Apple Picker twice, re-scan for entries if we previously successfully showed it.
330 //
331 if (IsApplePickerSelection && (Context->PickerMode != OcPickerModeApple)) {
332 IsApplePickerSelection = FALSE;
333 Context->BootOrder = NULL;
334 Context->BootOrderCount = 0;
335 }
336
337 //
338 // Turbo-boost scanning when bypassing picker.
339 //
340 if ( (Context->PickerCommand == OcPickerDefault)
341 || (Context->PickerCommand == OcPickerProtocolHotKey)
342 || IsApplePickerSelection
343 )
344 {
345 BootContext = OcScanForDefaultBootEntry (Context, IsApplePickerSelection);
346 } else {
347 ASSERT (
348 Context->PickerCommand == OcPickerShowPicker
349 || Context->PickerCommand == OcPickerBootApple
350 || Context->PickerCommand == OcPickerBootAppleRecovery
351 );
352
353 BootContext = OcScanForBootEntries (Context);
354 }
355
356 //
357 // We have no entries at all or have auxiliary entries.
358 // Fallback to showing menu in the latter case.
359 //
360 if (BootContext == NULL) {
361 //
362 // Because of this fallback code, failed protocol hotkey can access OcPickerShowPicker mode
363 // even if this is denied by InternalRunRequestPrivilege above. Believed to be acceptable
364 // as in a secure system any entry protocol drivers should be locked down and trusted.
365 //
366 if (Context->HideAuxiliary || (Context->PickerCommand == OcPickerProtocolHotKey) || IsApplePickerSelection) {
367 Context->PickerCommand = OcPickerShowPicker;
368 Context->HideAuxiliary = FALSE;
369 if (IsApplePickerSelection) {
370 DEBUG ((DEBUG_WARN, "OCB: Apple Picker returned no entry valid under OC, falling back to builtin\n"));
371 Context->PickerMode = OcPickerModeBuiltin;
372
373 //
374 // Zero here, not before starting Apple picker, to keep safety net of
375 // timeout in builtin picker if Apple picker cannot start.
376 //
377 Context->TimeoutSeconds = 0;
378
379 //
380 // Clears all native picker graphics on switching back to text mode.
381 //
382 gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED);
383 } else {
384 DEBUG ((DEBUG_INFO, "OCB: System has no boot entries, showing picker with auxiliary\n"));
385 }
386
387 continue;
388 }
389
390 DEBUG ((DEBUG_WARN, "OCB: System has no boot entries\n"));
391 return EFI_NOT_FOUND;
392 }
393
394 if ((Context->PickerCommand == OcPickerShowPicker) && !IsApplePickerSelection) {
395 DEBUG ((
396 DEBUG_INFO,
397 "OCB: Showing menu... %a\n",
398 Context->PollAppleHotKeys ? "(polling hotkeys)" : ""
399 ));
400
401 if (!SaidWelcome) {
403 SaidWelcome = TRUE;
404 }
405
406 Status = RunShowMenu (BootContext, &Chosen);
407
408 if (EFI_ERROR (Status) && (Status != EFI_ABORTED)) {
409 if (BootContext->PickerContext->ShowMenu != OcShowSimpleBootMenu) {
410 DEBUG ((DEBUG_WARN, "OCB: External interface ShowMenu failure, fallback to builtin - %r\n", Status));
413 Status = RunShowMenu (BootContext, &Chosen);
414 }
415 }
416
417 if (EFI_ERROR (Status) && (Status != EFI_ABORTED)) {
418 DEBUG ((DEBUG_ERROR, "OCB: ShowMenu failed - %r\n", Status));
419 OcFreeBootContext (BootContext);
420 return Status;
421 }
422 } else if (BootContext->DefaultEntry != NULL) {
423 Chosen = BootContext->DefaultEntry;
424 Status = EFI_SUCCESS;
425 } else {
426 //
427 // This can only be failed macOS or macOS recovery boot.
428 // We may actually not rescan here.
429 //
430 ASSERT (Context->PickerCommand == OcPickerBootApple || Context->PickerCommand == OcPickerBootAppleRecovery);
431 DEBUG ((DEBUG_INFO, "OCB: System has no default boot entry, showing menu\n"));
432 Context->PickerCommand = OcPickerShowPicker;
433 OcFreeBootContext (BootContext);
434 continue;
435 }
436
437 ASSERT (!EFI_ERROR (Status) || Status == EFI_ABORTED);
438
439 Context->TimeoutSeconds = 0;
440
441 if (!EFI_ERROR (Status)) {
442 DEBUG ((
443 DEBUG_INFO,
444 "OCB: Should boot from %u. %s (T:%d|F:%d|G:%d|E:%d|DEF:%d)\n",
445 Chosen->EntryIndex,
446 Chosen->Name,
447 Chosen->Type,
448 Chosen->IsFolder,
449 Chosen->IsGeneric,
450 Chosen->IsExternal,
451 Chosen->SetDefault
452 ));
453
454 if ((Context->PickerCommand == OcPickerShowPicker) && !IsApplePickerSelection) {
455 ASSERT (Chosen->EntryIndex > 0);
456
457 if (Chosen->SetDefault) {
458 if (Context->PickerCommand == OcPickerShowPicker) {
461 OcPlayAudioEntry (Context, Chosen);
462 }
463
464 Status = OcSetDefaultBootEntry (Context, Chosen);
465 DEBUG ((DEBUG_INFO, "OCB: Setting default - %r\n", Status));
466 }
467
468 //
469 // If launching entry in text, clear screen of previous console contents - e.g. from
470 // builtin picker, log messages, or previous console tool - before loading the entry.
471 // Otherwise, if coming from graphics picker, set to trigger a full screen clear if anybody,
472 // but particularly macOS verbose boot, switches to text mode. (If running Canopy with
473 // a background mode of text, this still works: even though Builtin renderer only clears
474 // on change from graphics to text, macOS initially sets graphics, which stays uncontrolled,
475 // then back to text for verbose mode.)
476 // But if coming from text picker do not set uncontrolled, intentionally allowing initial
477 // verbose mode text to run on after the picker text.
478 //
479 if (Chosen->LaunchInText) {
480 gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED);
481 gST->ConOut->ClearScreen (gST->ConOut);
482 } else if (BootContext->PickerContext->ShowMenu != OcShowSimpleBootMenu) {
483 gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED);
484 }
485
486 //
487 // Voice chosen information.
488 //
490 Status = OcPlayAudioEntry (Context, Chosen);
491 if (EFI_ERROR (Status)) {
493 Context,
497 );
498 }
499 }
500
501 SaveMode ();
502 FwRuntime = Chosen->FullNvramAccess ? OcDisableNvramProtection () : NULL;
503
504 Status = OcLoadBootEntry (
505 Context,
506 Chosen,
508 );
509
510 OcRestoreNvramProtection (FwRuntime);
511
512 //
513 // Do not wait on successful return code.
514 //
515 if (EFI_ERROR (Status)) {
517 gBS->Stall (SECONDS_TO_MICROSECONDS (3));
518 //
519 // Show picker on first failure.
520 //
521 Context->PickerCommand = OcPickerShowPicker;
522 } else {
524 }
525
526 //
527 // Restore mode after any delay.
528 //
529 RestoreMode ();
530
531 //
532 // Ensure that we flush all pressed keys after the application.
533 // This resolves the problem of application-pressed keys being used to control the menu.
534 //
535 OcKeyMapFlush (KeyMap, 0, TRUE);
536 }
537
538 OcFreeBootContext (BootContext);
539 }
540}
541
542STATIC
543EFI_STATUS
545 IN APPLE_PICKER_ENTRY_REASON PickerEntryReason
546 )
547{
548 return gRT->SetVariable (
551 EFI_VARIABLE_BOOTSERVICE_ACCESS,
552 sizeof (PickerEntryReason),
553 &PickerEntryReason
554 );
555}
556
557EFI_STATUS
559 IN EFI_GUID *ApplicationGuid,
560 IN BOOLEAN SetReason
561 )
562{
563 EFI_STATUS Status;
564 EFI_HANDLE NewHandle;
565 EFI_DEVICE_PATH_PROTOCOL *Dp;
566
567 DEBUG ((DEBUG_INFO, "OCB: run fw app attempting to find %g...\n", ApplicationGuid));
568
569 Dp = OcCreateFvFileDevicePath (ApplicationGuid);
570 if (Dp != NULL) {
571 DEBUG ((DEBUG_INFO, "OCB: run fw app attempting to load %g...\n", ApplicationGuid));
572 NewHandle = NULL;
573 Status = gBS->LoadImage (
574 FALSE,
576 Dp,
577 NULL,
578 0,
579 &NewHandle
580 );
581 if (EFI_ERROR (Status)) {
582 Status = EFI_INVALID_PARAMETER;
583 }
584 } else {
585 Status = EFI_NOT_FOUND;
586 }
587
588 if (!EFI_ERROR (Status)) {
589 if (SetReason) {
591 }
592
593 DEBUG ((
594 DEBUG_INFO,
595 "OCB: run fw app attempting to start %g (%d) %r...\n",
596 ApplicationGuid,
597 SetReason,
598 Status
599 ));
600 Status = gBS->StartImage (
601 NewHandle,
602 NULL,
603 NULL
604 );
605
606 if (EFI_ERROR (Status)) {
607 Status = EFI_UNSUPPORTED;
608 }
609 }
610
611 return Status;
612}
613
614//
615// Patching prolog of this function works on more similar era firmware
616// than assuming that mGopAlreadyConnected is located immediately after
617// protocol interface (which applies on MacPro5,1 v144.0.0.0.0 but not others).
618//
619// MacPro5,1 + some iMacs:
620//
621// sub rsp, 28h
622// cmp cs:mGopAlreadyConnected, 0 ///< Ignore offset of this var
623// jz short loc_10004431
624// xor eax, eax
625// jmp short loc_1000446F ///< Change this to no jump
626//
627STATIC CONST UINT8 ConnectGopPrologue[] = {
628 0x48, 0x83, 0xEC, 0x28, 0x80, 0x3D, 0x00, 0x00,
629 0x00, 0x00, 0x00, 0x74, 0x04, 0x33, 0xC0, 0xEB,
630 0x3E
631};
632
633STATIC CONST UINT8 ConnectGopPrologueMask[] = {
634 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
635 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
636 0xFF
637};
638
639STATIC CONST UINT8 ConnectGopReplace[] = {
640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
642 0x00
643};
644
645STATIC CONST UINT8 ConnectGopReplaceMask[] = {
646 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
648 0xFF
649};
650
651//
652// iMac11,1:
653//
654// push rbx
655// sub rsp, 30h
656// cmp cs:byte_100065C8, 0
657// jz short loc_10004077
658// xor ebx, ebx
659// jmp short loc_100040D1
660//
661
662STATIC CONST UINT8 AltConnectGopPrologue[] = {
663 0x48, 0x53, 0x48, 0x83, 0xEC, 0x30,
664 0x80, 0x3D, 0x00, 0x00, 0x00, 0x00,0x00,
665 0x74, 0x04, 0x33, 0xDB, 0xEB, 0x5A
666};
667
668STATIC CONST UINT8 AltConnectGopPrologueMask[] = {
669 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
670 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,0xFF,
671 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
672};
673
674STATIC CONST UINT8 AltConnectGopReplace[] = {
675 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
676 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00,
677 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
678};
679
680STATIC CONST UINT8 AltConnectGopReplaceMask[] = {
681 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
682 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00,
683 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
684};
685
686EFI_STATUS
688 VOID
689 )
690{
691 EFI_STATUS Status;
693 UINT32 ReplaceCount;
694
695 Status = gBS->LocateProtocol (
697 NULL,
698 (VOID **)&FirmwareUI
699 );
700
701 if (EFI_ERROR (Status)) {
702 DEBUG ((DEBUG_INFO, "OCB: Cannot locate FirmwareUI protocol - %r\n", Status));
704 DEBUG ((
705 DEBUG_INFO,
706 "OCB: Unlock FirmwareUI incompatible protocol revision %u != %u\n",
707 FirmwareUI->Revision,
709 ));
710 Status = EFI_UNSUPPORTED;
711 }
712
713 if (!EFI_ERROR (Status)) {
714 ReplaceCount = ApplyPatch (
717 sizeof (ConnectGopPrologue),
720 (VOID *)FirmwareUI->ConnectGop,
721 sizeof (ConnectGopPrologue),
722 1,
723 0
724 );
725
726 if (ReplaceCount == 0) {
727 ReplaceCount = ApplyPatch (
730 sizeof (AltConnectGopPrologue),
733 (VOID *)FirmwareUI->ConnectGop,
734 sizeof (AltConnectGopPrologue),
735 1,
736 0
737 );
738 }
739
740 Status = EFI_SUCCESS;
741 if (ReplaceCount == 0) {
742 Status = EFI_NOT_FOUND;
743 DEBUG ((
744 DEBUG_INFO,
745 "OCB: 0x%016LX 0x%016LX 0x%016LX\n",
746 *((UINT64 *)((UINT8 *)FirmwareUI->ConnectGop)),
747 *((UINT64 *)(((UINT8 *)FirmwareUI->ConnectGop) + 8)),
748 *((UINT64 *)(((UINT8 *)FirmwareUI->ConnectGop) + 16))
749 ));
750 }
751
752 DEBUG ((
753 EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_INFO,
754 "OCB: FirmwareUI ConnectGop patch - %r\n",
755 Status
756 ));
757 }
758
759 return Status;
760}
761
762EFI_STATUS
764 VOID
765 )
766{
767 EFI_STATUS Status;
768
770
772
773 return Status;
774}
EFI_GUID gAppleBootPickerFileGuid
EFI_GUID gAppleFirmwareUserInterfaceProtocolGuid
#define APPLE_FIRMWARE_USER_INTERFACE_PROTOCOL_REVISION
#define APPLE_PICKER_ENTRY_REASON_VARIABLE_NAME
EFI_GUID gAppleVendorVariableGuid
APPLE_PICKER_ENTRY_REASON
@ ApplePickerEntryReasonUnknown
Unknown.
EFI_CONSOLE_CONTROL_SCREEN_MODE
APPLE_KEY_MAP_AGGREGATOR_PROTOCOL * OcAppleKeyMapInstallProtocols(IN BOOLEAN Reinstall)
VOID OcKeyMapFlush(IN APPLE_KEY_MAP_AGGREGATOR_PROTOCOL *KeyMap, IN APPLE_KEY_CODE Key, IN BOOLEAN FlushConsole)
#define OC_VOICE_OVER_AUDIO_FILE_LOADING
Definition OcAudio.h:54
#define OC_VOICE_OVER_AUDIO_FILE_SELECTED
Definition OcAudio.h:67
#define OC_VOICE_OVER_AUDIO_FILE_DEFAULT
Definition OcAudio.h:45
#define OC_VOICE_OVER_AUDIO_FILE_EXECUTION_FAILURE
Definition OcAudio.h:48
#define OC_VOICE_OVER_AUDIO_FILE_EXECUTION_SUCCESSFUL
Definition OcAudio.h:49
#define OC_VOICE_OVER_AUDIO_BASE_TYPE_OPEN_CORE
Definition OcAudio.h:38
#define OC_VOICE_OVER_AUDIO_FILE_WELCOME
Definition OcAudio.h:75
STATIC CONST UINT8 AltConnectGopPrologueMask[]
EFI_STATUS InternalRunRequestPrivilege(IN OC_PICKER_CONTEXT *PickerContext, IN OC_PRIVILEGE_LEVEL Level)
STATIC CONST UINT8 AltConnectGopReplace[]
STATIC CONST UINT8 AltConnectGopPrologue[]
STATIC CONST UINT8 ConnectGopPrologue[]
STATIC CONST UINT8 ConnectGopReplaceMask[]
STATIC UINT32 mSavedGopMode
EFI_STATUS OcRunBootPicker(IN OC_PICKER_CONTEXT *Context)
EFI_STATUS OcRunFirmwareApplication(IN EFI_GUID *ApplicationGuid, IN BOOLEAN SetReason)
STATIC CONST UINT8 AltConnectGopReplaceMask[]
STATIC EFI_CONSOLE_CONTROL_SCREEN_MODE mSavedConsoleControlMode
STATIC EFI_STATUS SaveMode(VOID)
STATIC EFI_STATUS SetPickerEntryReason(IN APPLE_PICKER_ENTRY_REASON PickerEntryReason)
STATIC EFI_STATUS RestoreMode(VOID)
STATIC INT32 mSavedConsoleMode
STATIC CONST UINT8 ConnectGopReplace[]
BOOLEAN EFIAPI OcVerifyPassword(IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST OC_PRIVILEGE_CONTEXT *PrivilegeContext)
STATIC CONST UINT8 ConnectGopPrologueMask[]
EFI_STATUS OcUnlockAppleFirmwareUI(VOID)
STATIC EFI_STATUS RunShowMenu(IN OC_BOOT_CONTEXT *BootContext, OUT OC_BOOT_ENTRY **ChosenBootEntry)
EFI_STATUS OcLaunchAppleBootPicker(VOID)
@ OcPickerShowPicker
@ OcPickerBootAppleRecovery
@ OcPickerDefault
@ OcPickerProtocolHotKey
@ OcPickerBootApple
EFI_STATUS EFIAPI OcShowSimplePasswordRequest(IN OC_PICKER_CONTEXT *Context, IN OC_PRIVILEGE_LEVEL Level)
VOID OcFreeHotKeys(IN OC_PICKER_CONTEXT *Context)
#define OC_VOICE_OVER_SILENCE_NORMAL_MS
From boot.efi, constant.
OC_BOOT_CONTEXT * OcScanForBootEntries(IN OC_PICKER_CONTEXT *Context)
OC_BOOT_CONTEXT * OcScanForDefaultBootEntry(IN OC_PICKER_CONTEXT *Context, IN BOOLEAN UseBootNextOnly)
#define OC_VOICE_OVER_SIGNAL_NORMAL_MS
From boot.efi, constant.
EFI_STATUS EFIAPI OcPlayAudioFile(IN OC_PICKER_CONTEXT *Context, IN CONST CHAR8 *BasePath, IN CONST CHAR8 *BaseType, IN BOOLEAN Fallback)
Definition BootAudio.c:77
EFI_STATUS OcSetDefaultBootEntry(IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *Entry)
VOID OcImageLoaderActivate(VOID)
EFI_STATUS OcInitHotKeys(IN OUT OC_PICKER_CONTEXT *Context)
EFI_STATUS EFIAPI OcShowSimpleBootMenu(IN OC_BOOT_CONTEXT *BootContext, IN OC_BOOT_ENTRY **BootEntries, OUT OC_BOOT_ENTRY **ChosenBootEntry)
#define OC_VOICE_OVER_SIGNALS_PASSWORD_OK
Password correct for boot.efi.
EFI_STATUS EFIAPI OcPlayAudioBeep(IN OC_PICKER_CONTEXT *Context, IN UINT32 ToneCount, IN UINT32 ToneLength, IN UINT32 SilenceLength)
Definition BootAudio.c:155
OC_BOOT_ENTRY ** OcEnumerateEntries(IN OC_BOOT_CONTEXT *BootContext)
@ OcPickerModeApple
@ OcPickerModeBuiltin
OC_PRIVILEGE_LEVEL
@ OcPrivilegeAuthorized
EFI_STATUS EFIAPI OcPlayAudioEntry(IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *Entry)
Definition BootAudio.c:188
EFI_STATUS OcLoadBootEntry(IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, IN EFI_HANDLE ParentHandle)
VOID OcFreeBootContext(IN OUT OC_BOOT_CONTEXT *Context)
EFI_SYSTEM_TABLE * gST
EFI_HANDLE gImageHandle
EFI_BOOT_SERVICES * gBS
EFI_CONSOLE_CONTROL_SCREEN_MODE OcConsoleControlSetMode(IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode)
#define OC_CONSOLE_MARK_UNCONTROLLED
EFI_CONSOLE_CONTROL_SCREEN_MODE OcConsoleControlGetMode(VOID)
BOOLEAN OcVerifyPasswordSha512(IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST UINT8 *Salt, IN UINT32 SaltSize, IN CONST UINT8 *RefHash)
EFI_DEVICE_PATH_PROTOCOL * OcCreateFvFileDevicePath(IN EFI_GUID *FileGuid)
#define SECONDS_TO_MICROSECONDS(x)
Definition OcMiscLib.h:30
UINT32 ApplyPatch(IN CONST UINT8 *Pattern, IN CONST UINT8 *PatternMask OPTIONAL, IN CONST UINT32 PatternSize, IN CONST UINT8 *Replace, IN CONST UINT8 *ReplaceMask OPTIONAL, IN UINT8 *Data, IN UINT32 DataSize, IN UINT32 Count, IN UINT32 Skip)
OC_FIRMWARE_RUNTIME_PROTOCOL * OcDisableNvramProtection(VOID)
VOID OcRestoreNvramProtection(IN OC_FIRMWARE_RUNTIME_PROTOCOL *FwRuntime)
EFI_RUNTIME_SERVICES * gRT
EFI_GUID gEfiGraphicsOutputProtocolGuid
#define ASSERT(x)
Definition coder.h:55
OC_BOOT_ENTRY * DefaultEntry
OC_PICKER_CONTEXT * PickerContext
OC_BOOT_ENTRY_TYPE Type
OC_REQ_PRIVILEGE RequestPrivilege