CloverBootloader/rEFIt_UEFI/Platform/Nvram.h

128 lines
2.3 KiB
C
Raw Normal View History

/*
* Nvram.h
*
* Created on: 16 Apr 2020
* Author: jief
*/
#ifndef PLATFORM_NVRAM_H_
#define PLATFORM_NVRAM_H_
2020-04-16 11:09:22 +02:00
#define NON_APPLE_SMC_SIGNATURE SIGNATURE_64('S','M','C','H','E','L','P','E')
2020-04-27 11:50:49 +02:00
#include "../cpp_foundation/XString.h"
2020-08-17 21:40:52 +02:00
#include "../gui/REFIT_MENU_SCREEN.h"
2020-04-16 11:09:22 +02:00
2022-04-26 00:55:56 +02:00
extern EFI_GUID gEfiBootDeviceGuid;
extern EFI_DEVICE_PATH_PROTOCOL *gEfiBootDeviceData;
INTN
FindStartupDiskVolume (
REFIT_MENU_SCREEN *MainMenu
);
2020-10-03 19:02:31 +02:00
void
*GetNvramVariable(
IN CONST CHAR16 *VariableName,
2022-04-26 00:55:56 +02:00
const EFI_GUID& VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
OUT UINTN *DataSize OPTIONAL
);
XString8 GetNvramVariableAsXString8(
IN CONST CHAR16 *VariableName,
2022-04-26 00:55:56 +02:00
const EFI_GUID& VendorGuid,
OUT UINT32 *Attributes OPTIONAL
);
EFI_STATUS
AddNvramVariable (
IN CONST CHAR16 *VariableName,
2022-04-26 00:55:56 +02:00
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
2020-10-03 19:02:31 +02:00
IN const void *Data
);
EFI_STATUS
AddNvramXString8 (
IN CONST CHAR16 *VariableName,
2022-04-26 00:55:56 +02:00
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
const XString8& s
);
EFI_STATUS
SetNvramVariable (
IN CONST CHAR16 *VariableName,
2022-04-26 00:55:56 +02:00
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST void *Data
);
EFI_STATUS
SetNvramXString8 (
IN CONST CHAR16 *VariableName,
2022-04-26 00:55:56 +02:00
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
const XString8& s
);
EFI_STATUS
DeleteNvramVariable (
2022-04-26 00:55:56 +02:00
IN CONST CHAR16 *VariableName,
const EFI_GUID& VendorGuid
);
2020-10-03 19:02:31 +02:00
void
ResetNvram (void);
XBool
IsDeletableVariable (
2022-04-26 00:55:56 +02:00
IN CHAR16 *Name,
const EFI_GUID& Guid
);
EFI_STATUS
2020-10-03 19:02:31 +02:00
ResetNativeNvram (void);
;
EFI_STATUS
2020-10-03 19:02:31 +02:00
GetEfiBootDeviceFromNvram (void);
EFI_GUID
2022-04-26 00:55:56 +02:00
FindGPTPartitionGuidInDevicePath (
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
2020-10-03 19:02:31 +02:00
void
PutNvramPlistToRtVars (void);
2020-10-03 19:02:31 +02:00
void
GetSmcKeys(XBool WriteToSMC);
#if CHECK_SMC
2020-10-03 19:02:31 +02:00
void DumpSmcKeys();
#endif
EFI_STATUS
SetStartupDiskVolume (
IN REFIT_VOLUME *Volume,
2020-04-27 11:50:49 +02:00
IN CONST XStringW& LoaderPath
);
2020-10-03 19:02:31 +02:00
void
RemoveStartupDiskVolume (void);
UINT64
GetEfiTimeInMs (IN EFI_TIME *T);
#ifdef JIEF_DEBUG
EFI_STATUS DumpNvram();
#endif
#endif /* PLATFORM_NVRAM_H_ */