OpenCore  1.0.4
OpenCore Bootloader
1.0.4
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OcBootManagementLib.c File Reference
#include "BootManagementInternal.h"
#include <Guid/AppleFile.h>
#include <Guid/AppleVariable.h>
#include <Guid/OcVariable.h>
#include <IndustryStandard/AppleCsrConfig.h>
#include <Protocol/AppleBeepGen.h>
#include <Protocol/AppleBootPolicy.h>
#include <Protocol/AppleKeyMapAggregator.h>
#include <Protocol/AppleUserInterface.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/OcAudio.h>
#include <Protocol/SimpleTextOut.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/OcConsoleLib.h>
#include <Library/OcCryptoLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/DevicePathLib.h>
#include <Library/OcTimerLib.h>
#include <Library/OcTypingLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcAppleKeyMapLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcFileLib.h>
#include <Library/OcMainLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcRtcLib.h>
#include <Library/OcStringLib.h>
#include <Library/OcVariableLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/ResetSystemLib.h>

Go to the source code of this file.

Functions

STATIC EFI_STATUS SaveMode (VOID)
 
STATIC EFI_STATUS RestoreMode (VOID)
 
STATIC EFI_STATUS RunShowMenu (IN OC_BOOT_CONTEXT *BootContext, OUT OC_BOOT_ENTRY **ChosenBootEntry)
 
BOOLEAN EFIAPI OcVerifyPassword (IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST OC_PRIVILEGE_CONTEXT *PrivilegeContext)
 
EFI_STATUS InternalRunRequestPrivilege (IN OC_PICKER_CONTEXT *PickerContext, IN OC_PRIVILEGE_LEVEL Level)
 
EFI_STATUS OcRunBootPicker (IN OC_PICKER_CONTEXT *Context)
 
STATIC EFI_STATUS SetPickerEntryReason (IN APPLE_PICKER_ENTRY_REASON PickerEntryReason)
 
EFI_STATUS OcRunFirmwareApplication (IN EFI_GUID *ApplicationGuid, IN BOOLEAN SetReason)
 
EFI_STATUS OcUnlockAppleFirmwareUI (VOID)
 
EFI_STATUS OcLaunchAppleBootPicker (VOID)
 

Variables

STATIC UINT32 mSavedGopMode
 
STATIC EFI_CONSOLE_CONTROL_SCREEN_MODE mSavedConsoleControlMode
 
STATIC INT32 mSavedConsoleMode
 
STATIC CONST UINT8 ConnectGopPrologue []
 
STATIC CONST UINT8 ConnectGopPrologueMask []
 
STATIC CONST UINT8 ConnectGopReplace []
 
STATIC CONST UINT8 ConnectGopReplaceMask []
 
STATIC CONST UINT8 AltConnectGopPrologue []
 
STATIC CONST UINT8 AltConnectGopPrologueMask []
 
STATIC CONST UINT8 AltConnectGopReplace []
 
STATIC CONST UINT8 AltConnectGopReplaceMask []
 

Detailed Description

Copyright (C) 2019, vit9696. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause

Definition in file OcBootManagementLib.c.

Function Documentation

◆ InternalRunRequestPrivilege()

EFI_STATUS InternalRunRequestPrivilege ( IN OC_PICKER_CONTEXT * PickerContext,
IN OC_PRIVILEGE_LEVEL Level )

Definition at line 219 of file OcBootManagementLib.c.

◆ OcLaunchAppleBootPicker()

EFI_STATUS OcLaunchAppleBootPicker ( VOID )

Launch Apple boot picker firmware application.

Return values
EFI_SUCCESSPicker was successfully executed, implies boot selection was returned in BootNext.
otherPicker could not be launched, or error within picker application.

Definition at line 763 of file OcBootManagementLib.c.

◆ OcRunBootPicker()

EFI_STATUS OcRunBootPicker ( IN OC_PICKER_CONTEXT * Context)

Install missing boot policy, scan, and show simple boot menu.

Parameters
[in]ContextPicker context.
Return values
doesnot return unless a fatal error happened.

Definition at line 258 of file OcBootManagementLib.c.

◆ OcRunFirmwareApplication()

EFI_STATUS OcRunFirmwareApplication ( IN EFI_GUID * ApplicationGuid,
IN BOOLEAN SetReason )

Launch firmware application.

Parameters
[in]ApplicationGuidApplication GUID identifier in the firmware.
[in]SetReasonPass enter reason (specific to Apple BootPicker).
Return values
errorcode, should not return.

Definition at line 558 of file OcBootManagementLib.c.

◆ OcUnlockAppleFirmwareUI()

EFI_STATUS OcUnlockAppleFirmwareUI ( VOID )

Force Apple Firmware UI to always reconnect to current console GOP.

Return values
EFI_SUCCESSFirmware UI ConnectGop method was successfully reset.
otherCompatible firmware UI protocol for reset could not be found.

Definition at line 687 of file OcBootManagementLib.c.

◆ OcVerifyPassword()

BOOLEAN EFIAPI OcVerifyPassword ( IN CONST UINT8 * Password,
IN UINT32 PasswordSize,
IN CONST OC_PRIVILEGE_CONTEXT * PrivilegeContext )

Verify password.

Shared context function to be used by all pickers rather than directly linked call to OcVerifyPasswordSha512, to pick up status of Avx acceleration as enabled within OpenCore.efi and to avoid unnecessary OcCryptoLib lib linking into external picker.

Parameters
[in]PasswordPassword.
[in]PasswordSizePassword size.
[in]PrivilegeContextPrivilege context.
Return values
Trueif password verified successfully.

Definition at line 199 of file OcBootManagementLib.c.

◆ RestoreMode()

STATIC EFI_STATUS RestoreMode ( VOID )

Definition at line 90 of file OcBootManagementLib.c.

◆ RunShowMenu()

STATIC EFI_STATUS RunShowMenu ( IN OC_BOOT_CONTEXT * BootContext,
OUT OC_BOOT_ENTRY ** ChosenBootEntry )

Definition at line 138 of file OcBootManagementLib.c.

◆ SaveMode()

STATIC EFI_STATUS SaveMode ( VOID )

Definition at line 53 of file OcBootManagementLib.c.

◆ SetPickerEntryReason()

STATIC EFI_STATUS SetPickerEntryReason ( IN APPLE_PICKER_ENTRY_REASON PickerEntryReason)

Definition at line 544 of file OcBootManagementLib.c.

Variable Documentation

◆ AltConnectGopPrologue

STATIC CONST UINT8 AltConnectGopPrologue[]
Initial value:
= {
0x48, 0x53, 0x48, 0x83, 0xEC, 0x30,
0x80, 0x3D, 0x00, 0x00, 0x00, 0x00,0x00,
0x74, 0x04, 0x33, 0xDB, 0xEB, 0x5A
}

Definition at line 662 of file OcBootManagementLib.c.

◆ AltConnectGopPrologueMask

STATIC CONST UINT8 AltConnectGopPrologueMask[]
Initial value:
= {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
}

Definition at line 668 of file OcBootManagementLib.c.

◆ AltConnectGopReplace

STATIC CONST UINT8 AltConnectGopReplace[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Definition at line 674 of file OcBootManagementLib.c.

◆ AltConnectGopReplaceMask

STATIC CONST UINT8 AltConnectGopReplaceMask[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
}

Definition at line 680 of file OcBootManagementLib.c.

◆ ConnectGopPrologue

STATIC CONST UINT8 ConnectGopPrologue[]
Initial value:
= {
0x48, 0x83, 0xEC, 0x28, 0x80, 0x3D, 0x00, 0x00,
0x00, 0x00, 0x00, 0x74, 0x04, 0x33, 0xC0, 0xEB,
0x3E
}

Definition at line 627 of file OcBootManagementLib.c.

◆ ConnectGopPrologueMask

STATIC CONST UINT8 ConnectGopPrologueMask[]
Initial value:
= {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF
}

Definition at line 633 of file OcBootManagementLib.c.

◆ ConnectGopReplace

STATIC CONST UINT8 ConnectGopReplace[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
}

Definition at line 639 of file OcBootManagementLib.c.

◆ ConnectGopReplaceMask

STATIC CONST UINT8 ConnectGopReplaceMask[]
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF
}

Definition at line 645 of file OcBootManagementLib.c.

◆ mSavedConsoleControlMode

STATIC EFI_CONSOLE_CONTROL_SCREEN_MODE mSavedConsoleControlMode

Definition at line 48 of file OcBootManagementLib.c.

◆ mSavedConsoleMode

STATIC INT32 mSavedConsoleMode

Definition at line 49 of file OcBootManagementLib.c.

◆ mSavedGopMode

STATIC UINT32 mSavedGopMode

Definition at line 47 of file OcBootManagementLib.c.