2020-04-16 09:15:26 +02:00
|
|
|
/*
|
|
|
|
* 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;
|
2023-11-18 11:04:54 +01:00
|
|
|
extern apd<EFI_DEVICE_PATH_PROTOCOL*> gEfiBootDeviceData;
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-02-29 08:30:21 +01:00
|
|
|
|
|
|
|
INTN
|
|
|
|
FindStartupDiskVolume (
|
|
|
|
REFIT_MENU_SCREEN *MainMenu
|
|
|
|
);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
2020-10-03 19:02:31 +02:00
|
|
|
void
|
2020-04-28 12:49:24 +02:00
|
|
|
*GetNvramVariable(
|
2020-08-15 15:47:56 +02:00
|
|
|
IN CONST CHAR16 *VariableName,
|
2022-04-26 00:55:56 +02:00
|
|
|
const EFI_GUID& VendorGuid,
|
2020-08-15 15:47:56 +02:00
|
|
|
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,
|
2021-07-02 17:10:10 +02:00
|
|
|
OUT UINT32 *Attributes OPTIONAL
|
2020-08-15 15:47:56 +02:00
|
|
|
);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
AddNvramVariable (
|
|
|
|
IN CONST CHAR16 *VariableName,
|
2022-04-26 00:55:56 +02:00
|
|
|
const EFI_GUID& VendorGuid,
|
2020-04-16 09:15:26 +02:00
|
|
|
IN UINT32 Attributes,
|
|
|
|
IN UINTN DataSize,
|
2020-10-03 19:02:31 +02:00
|
|
|
IN const void *Data
|
2020-04-16 09:15:26 +02:00
|
|
|
);
|
2020-08-15 15:47:56 +02:00
|
|
|
EFI_STATUS
|
|
|
|
AddNvramXString8 (
|
|
|
|
IN CONST CHAR16 *VariableName,
|
2022-04-26 00:55:56 +02:00
|
|
|
const EFI_GUID& VendorGuid,
|
2020-08-15 15:47:56 +02:00
|
|
|
IN UINT32 Attributes,
|
|
|
|
const XString8& s
|
|
|
|
);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
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
|
2020-04-16 09:15:26 +02:00
|
|
|
);
|
2020-08-15 15:47:56 +02:00
|
|
|
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
|
2020-08-15 15:47:56 +02:00
|
|
|
);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
DeleteNvramVariable (
|
2022-04-26 00:55:56 +02:00
|
|
|
IN CONST CHAR16 *VariableName,
|
|
|
|
const EFI_GUID& VendorGuid
|
2020-04-16 09:15:26 +02:00
|
|
|
);
|
|
|
|
|
2020-10-03 19:02:31 +02:00
|
|
|
void
|
|
|
|
ResetNvram (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
2021-09-28 10:28:45 +02:00
|
|
|
XBool
|
2020-04-16 09:15:26 +02:00
|
|
|
IsDeletableVariable (
|
2022-04-26 00:55:56 +02:00
|
|
|
IN CHAR16 *Name,
|
|
|
|
const EFI_GUID& Guid
|
2020-04-16 09:15:26 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
2020-10-03 19:02:31 +02:00
|
|
|
ResetNativeNvram (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
EFI_STATUS
|
2020-10-03 19:02:31 +02:00
|
|
|
GetEfiBootDeviceFromNvram (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
EFI_GUID
|
2022-04-26 00:55:56 +02:00
|
|
|
FindGPTPartitionGuidInDevicePath (
|
2020-09-28 17:57:50 +02:00
|
|
|
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
2020-04-16 09:15:26 +02:00
|
|
|
);
|
|
|
|
|
2020-10-03 19:02:31 +02:00
|
|
|
void
|
|
|
|
PutNvramPlistToRtVars (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
2020-10-03 19:02:31 +02:00
|
|
|
void
|
2021-09-28 10:28:45 +02:00
|
|
|
GetSmcKeys(XBool WriteToSMC);
|
2020-07-14 09:51:12 +02:00
|
|
|
#if CHECK_SMC
|
2020-10-03 19:02:31 +02:00
|
|
|
void DumpSmcKeys();
|
2020-07-14 09:51:12 +02:00
|
|
|
#endif
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
SetStartupDiskVolume (
|
|
|
|
IN REFIT_VOLUME *Volume,
|
2020-04-27 11:50:49 +02:00
|
|
|
IN CONST XStringW& LoaderPath
|
2020-04-16 09:15:26 +02:00
|
|
|
);
|
|
|
|
|
2020-10-03 19:02:31 +02:00
|
|
|
void
|
|
|
|
RemoveStartupDiskVolume (void);
|
2020-04-16 09:15:26 +02:00
|
|
|
|
|
|
|
UINT64
|
|
|
|
GetEfiTimeInMs (IN EFI_TIME *T);
|
|
|
|
|
2021-07-02 17:10:10 +02:00
|
|
|
#ifdef JIEF_DEBUG
|
|
|
|
EFI_STATUS DumpNvram();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-16 09:15:26 +02:00
|
|
|
#endif /* PLATFORM_NVRAM_H_ */
|