OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
VariableManagement.c File Reference
#include <Uefi.h>
#include <IndustryStandard/AppleCsrConfig.h>
#include <Guid/AppleVariable.h>
#include <Guid/GlobalVariable.h>
#include <Guid/MicrosoftVariable.h>
#include <Guid/OcVariable.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcDirectResetLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/OcMiscLib.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>

Go to the source code of this file.

Functions

EFI_LOAD_OPTION * OcGetBootOptionData (OUT UINTN *OptionSize, IN UINT16 BootOption, IN CONST EFI_GUID *BootGuid)
 
STATIC BOOLEAN IsDeletableVariable (IN CHAR16 *Name, IN EFI_GUID *Guid, IN BOOLEAN PreserveBoot)
 
VOID OcScanVariables (IN OC_PROCESS_VARIABLE ProcessVariable, IN VOID *Context)
 
STATIC OC_PROCESS_VARIABLE_RESULT EFIAPI DeleteVariable (IN EFI_GUID *Guid, IN CHAR16 *Name, IN VOID *Context)
 
STATIC VOID DeleteVariables (IN BOOLEAN PreserveBoot)
 
STATIC VOID * GetBootstrapBootData (OUT UINTN *OptionSize, OUT UINT16 *Option)
 
OC_FIRMWARE_RUNTIME_PROTOCOLOcDisableNvramProtection (VOID)
 
VOID OcRestoreNvramProtection (IN OC_FIRMWARE_RUNTIME_PROTOCOL *FwRuntime)
 
VOID OcDeleteVariables (IN BOOLEAN PreserveBoot)
 
EFI_STATUS OcResetNvram (IN BOOLEAN PreserveBoot)
 

Variables

STATIC EFI_GUID mOzmosisProprietary1Guid
 
STATIC EFI_GUID mOzmosisProprietary2Guid
 
STATIC EFI_GUID mBootChimeVendorVariableGuid
 

Detailed Description

Copyright (C) 2016-2022, vit9696, mikebeaton. All rights reserved.

All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file VariableManagement.c.

Function Documentation

◆ DeleteVariable()

STATIC OC_PROCESS_VARIABLE_RESULT EFIAPI DeleteVariable ( IN EFI_GUID * Guid,
IN CHAR16 * Name,
IN VOID * Context )

Definition at line 288 of file VariableManagement.c.

◆ DeleteVariables()

STATIC VOID DeleteVariables ( IN BOOLEAN PreserveBoot)

Definition at line 345 of file VariableManagement.c.

◆ GetBootstrapBootData()

STATIC VOID * GetBootstrapBootData ( OUT UINTN * OptionSize,
OUT UINT16 * Option )

Definition at line 354 of file VariableManagement.c.

◆ IsDeletableVariable()

STATIC BOOLEAN IsDeletableVariable ( IN CHAR16 * Name,
IN EFI_GUID * Guid,
IN BOOLEAN PreserveBoot )

Definition at line 98 of file VariableManagement.c.

◆ OcDeleteVariables()

VOID OcDeleteVariables ( IN BOOLEAN PreserveBoot)

Perform NVRAM UEFI variable deletion.

Definition at line 457 of file VariableManagement.c.

◆ OcDisableNvramProtection()

OC_FIRMWARE_RUNTIME_PROTOCOL * OcDisableNvramProtection ( VOID )

When compatible protocol is found, disable OpenRuntime NVRAM protection then return relevant protocol for subsequent restore, else return NULL. Always call OcRestoreNvramProtection to restore normal OpenRuntime operation before booting anything, after disabling with this call.

Return values
Compatibleprotocol if found and firmware runtime was disabled, NULL otherwise.

Definition at line 419 of file VariableManagement.c.

◆ OcGetBootOptionData()

EFI_LOAD_OPTION * OcGetBootOptionData ( OUT UINTN * OptionSize,
IN UINT16 BootOption,
IN CONST EFI_GUID * BootGuid )

Get EFI boot option from specified namespace.

Parameters
[out]OptionSizeBoot option size.
[in]BootOptionWhich boot option to return.
[in]BootGuidBoot namespace to use (OC or default).
Return values
EFIboot option data.

Definition at line 55 of file VariableManagement.c.

◆ OcResetNvram()

EFI_STATUS OcResetNvram ( IN BOOLEAN PreserveBoot)

Resets selected NVRAM variables and reboots the system.

Parameters
[in]PreserveBootShould reset preserve Boot### entries.
Return values
EFI_SUCCESS,orerror returned by called code.

Definition at line 539 of file VariableManagement.c.

◆ OcRestoreNvramProtection()

VOID OcRestoreNvramProtection ( IN OC_FIRMWARE_RUNTIME_PROTOCOL * FwRuntime)

Restore OpenRuntime NVRAM protection if it was disabled by a previous call to OcDisableNvramProtection. Noop when FwRuntime argument is NULL.

Parameters
[in]FwRuntimeFirmware runtime protocol or NULL, from previous call to OcDisableNvramProtection.

Definition at line 446 of file VariableManagement.c.

◆ OcScanVariables()

VOID OcScanVariables ( IN OC_PROCESS_VARIABLE ProcessVariable,
IN VOID * Context )

Apply function to each NVRAM variable.

Parameters
[in]ProcessVariableFunction to apply.
[in]ContextCaller-provided context.

Definition at line 181 of file VariableManagement.c.

Variable Documentation

◆ mBootChimeVendorVariableGuid

STATIC EFI_GUID mBootChimeVendorVariableGuid
Initial value:
= {
0x89D4F995, 0x67E3, 0x4895, { 0x8F, 0x18, 0x45, 0x4B, 0x65, 0x1D, 0x92, 0x15 }
}

Definition at line 50 of file VariableManagement.c.

◆ mOzmosisProprietary1Guid

STATIC EFI_GUID mOzmosisProprietary1Guid
Initial value:
= {
0x1F8E0C02, 0x58A9, 0x4E34, { 0xAE, 0x22, 0x2B, 0x63, 0x74, 0x5F, 0xA1, 0x01 }
}

Definition at line 38 of file VariableManagement.c.

◆ mOzmosisProprietary2Guid

STATIC EFI_GUID mOzmosisProprietary2Guid
Initial value:
= {
0x9480E8A1, 0x1793, 0x46C9, { 0x91, 0xD8, 0x11, 0x08, 0xDB, 0xA4, 0x73, 0x1C }
}

Definition at line 44 of file VariableManagement.c.