Replace EFI_GUID by a class EFI_GUID.

This commit is contained in:
jief666 2022-04-26 00:55:56 +02:00
parent 037c3e7c71
commit 1ea4700bd6
123 changed files with 2256 additions and 1285 deletions

View File

@ -87,8 +87,8 @@ typedef
EFI_STATUS
(EFIAPI *EFI_DATA_HUB_LOG_DATA)(
IN EFI_DATA_HUB_PROTOCOL *This,
IN EFI_GUID *DataRecordGuid,
IN EFI_GUID *ProducerName,
CONST_EFI_GUID_PTR_T DataRecordGuid,
CONST_EFI_GUID_PTR_T ProducerName,
IN UINT64 DataRecordClass,
IN VOID *RawData,
IN UINT32 RawDataSize

View File

@ -184,7 +184,7 @@ EFI_STATUS
EFIAPI
FvReadFile (
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *NameGuid,
CONST_EFI_GUID_PTR_T NameGuid,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT EFI_FV_FILETYPE *FoundType,
@ -225,7 +225,7 @@ EFI_STATUS
EFIAPI
FvReadFileSection (
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *NameGuid,
CONST_EFI_GUID_PTR_T NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
IN OUT VOID **Buffer,
@ -282,7 +282,7 @@ EFI_STATUS
EFIAPI
FvGetVolumeInfo (
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *InformationType,
CONST_EFI_GUID_PTR_T InformationType,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
@ -306,7 +306,7 @@ EFI_STATUS
EFIAPI
FvSetVolumeInfo (
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *InformationType,
CONST_EFI_GUID_PTR_T InformationType,
IN UINTN BufferSize,
IN CONST VOID *Buffer
);

View File

@ -120,7 +120,7 @@ EFI_STATUS
EFIAPI
PeiFfsFvPpiFindFileByName (
IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
IN CONST EFI_GUID *FileName,
CONST_EFI_GUID_PTR_T FileName,
IN EFI_PEI_FV_HANDLE *FvHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);

View File

@ -539,7 +539,7 @@ EFI_STATUS
EFIAPI
PeiLocatePpi (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
IN OUT VOID **Ppi
@ -1065,7 +1065,7 @@ PeiReportStatusCode (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
CONST_EFI_GUID_PTR_T CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
);
@ -1158,7 +1158,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
EFI_STATUS
EFIAPI
PeiFfsFindFileByName (
IN CONST EFI_GUID *FileName,
CONST_EFI_GUID_PTR_T FileName,
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);

View File

@ -253,7 +253,7 @@ EFI_STATUS
EFIAPI
SmmInstallConfigurationTable (
IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Table,
IN UINTN TableSize
);
@ -526,7 +526,7 @@ SmmHandleProtocol (
EFI_STATUS
EFIAPI
SmmRegisterProtocolNotify (
IN CONST EFI_GUID *Protocol,
CONST_EFI_GUID_PTR_T Protocol,
IN EFI_SMM_NOTIFY_FN Function,
OUT VOID **Registration
);
@ -632,7 +632,7 @@ SmmLocateHandleBuffer (
EFI_STATUS
EFIAPI
SmiManage (
IN CONST EFI_GUID *HandlerType,
CONST_EFI_GUID_PTR_T HandlerType,
IN CONST VOID *Context OPTIONAL,
IN OUT VOID *CommBuffer OPTIONAL,
IN OUT UINTN *CommBufferSize OPTIONAL

View File

@ -52,7 +52,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_HII_HANDLE
EFIAPI
HiiAddPackages (
IN CONST EFI_GUID *PackageListGuid,
CONST_EFI_GUID_PTR_T PackageListGuid,
IN EFI_HANDLE DeviceHandle OPTIONAL,
...
)
@ -185,7 +185,7 @@ HiiGetString (
EFI_STRING
EFIAPI
HiiGetPackageString (
IN CONST EFI_GUID *PackageListGuid,
CONST_EFI_GUID_PTR_T PackageListGuid,
IN EFI_STRING_ID StringId,
IN CONST CHAR8 *Language OPTIONAL
)
@ -607,7 +607,7 @@ UINT8 *
EFIAPI
HiiCreateGuidOpCode (
IN VOID *OpCodeHandle,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN CONST VOID *GuidOpCode, OPTIONAL
IN UINTN OpCodeSize
);

View File

@ -1619,7 +1619,7 @@ EFIAPI
HiiListPackageLists (
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN UINT8 PackageType,
IN CONST EFI_GUID *PackageGuid,
CONST_EFI_GUID_PTR_T PackageGuid,
IN OUT UINTN *HandleBufferLength,
OUT EFI_HII_HANDLE *Handle
);
@ -1705,7 +1705,7 @@ EFIAPI
HiiRegisterPackageNotify (
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN UINT8 PackageType,
IN CONST EFI_GUID *PackageGuid,
CONST_EFI_GUID_PTR_T PackageGuid,
IN CONST EFI_HII_DATABASE_NOTIFY PackageNotifyFn,
IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,
OUT EFI_HANDLE *NotifyHandle
@ -1791,7 +1791,7 @@ EFI_STATUS
EFIAPI
HiiGetKeyboardLayout (
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN CONST EFI_GUID *KeyGuid,
CONST_EFI_GUID_PTR_T KeyGuid,
IN OUT UINT16 *KeyboardLayoutLength,
OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout
);
@ -1818,7 +1818,7 @@ EFI_STATUS
EFIAPI
HiiSetKeyboardLayout (
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN CONST EFI_GUID *KeyGuid
CONST_EFI_GUID_PTR_T KeyGuid
);
@ -2120,7 +2120,7 @@ EFIAPI
HiiGetAltCfg (
IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN CONST EFI_STRING Name,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST UINT16 *AltCfgId,

View File

@ -81,7 +81,7 @@ DxeGetPcdInfoGetInfo (
EFI_STATUS
EFIAPI
DxeGetPcdInfoGetInfoEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);
@ -269,7 +269,7 @@ DxePcdGetSize (
UINT8
EFIAPI
DxePcdGet8Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -290,7 +290,7 @@ DxePcdGet8Ex (
UINT16
EFIAPI
DxePcdGet16Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -311,7 +311,7 @@ DxePcdGet16Ex (
UINT32
EFIAPI
DxePcdGet32Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -332,7 +332,7 @@ DxePcdGet32Ex (
UINT64
EFIAPI
DxePcdGet64Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -353,7 +353,7 @@ DxePcdGet64Ex (
VOID *
EFIAPI
DxePcdGetPtrEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -374,7 +374,7 @@ DxePcdGetPtrEx (
BOOLEAN
EFIAPI
DxePcdGetBoolEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -393,7 +393,7 @@ DxePcdGetBoolEx (
UINTN
EFIAPI
DxePcdGetSizeEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -569,7 +569,7 @@ DxePcdSetBool (
EFI_STATUS
EFIAPI
DxePcdSet8Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
@ -595,7 +595,7 @@ DxePcdSet8Ex (
EFI_STATUS
EFIAPI
DxePcdSet16Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
@ -621,7 +621,7 @@ DxePcdSet16Ex (
EFI_STATUS
EFIAPI
DxePcdSet32Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
@ -647,7 +647,7 @@ DxePcdSet32Ex (
EFI_STATUS
EFIAPI
DxePcdSet64Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
@ -677,7 +677,7 @@ DxePcdSet64Ex (
EFI_STATUS
EFIAPI
DxePcdSetPtrEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfBuffer,
IN VOID *Buffer
@ -704,7 +704,7 @@ DxePcdSetPtrEx (
EFI_STATUS
EFIAPI
DxePcdSetBoolEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);
@ -828,7 +828,7 @@ typedef struct {
**/
EFI_STATUS
DxeGetPcdInfo (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);
@ -888,7 +888,7 @@ SetWorker (
EFI_STATUS
ExSetValueWorker (
IN UINTN ExTokenNumber,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Data,
IN UINTN SetSize
);
@ -914,7 +914,7 @@ ExSetValueWorker (
EFI_STATUS
ExSetWorker (
IN UINTN ExTokenNumber,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Data,
IN OUT UINTN *Size,
IN BOOLEAN PtrType
@ -952,7 +952,7 @@ GetWorker (
**/
VOID *
ExGetWorker (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN ExTokenNumber,
IN UINTN GetSize
);
@ -1070,7 +1070,7 @@ BuildPcdDxeDataBase (
**/
UINTN
GetExPcdTokenNumber (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINT32 ExTokenNumber
);
@ -1101,7 +1101,7 @@ GetExPcdTokenNumber (
**/
EFI_STATUS
ExGetNextTokeNumber (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN OUT UINTN *TokenNumber,
IN EFI_GUID *GuidTable,
IN UINTN SizeOfGuidTable,

View File

@ -77,7 +77,7 @@ PeiGetPcdInfoGetInfo (
EFI_STATUS
EFIAPI
PeiGetPcdInfoGetInfoEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);
@ -266,7 +266,7 @@ PeiPcdGetSize (
UINT8
EFIAPI
PeiPcdGet8Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -287,7 +287,7 @@ PeiPcdGet8Ex (
UINT16
EFIAPI
PeiPcdGet16Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -308,7 +308,7 @@ PeiPcdGet16Ex (
UINT32
EFIAPI
PeiPcdGet32Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -329,7 +329,7 @@ PeiPcdGet32Ex (
UINT64
EFIAPI
PeiPcdGet64Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -350,7 +350,7 @@ PeiPcdGet64Ex (
VOID *
EFIAPI
PeiPcdGetPtrEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -371,7 +371,7 @@ PeiPcdGetPtrEx (
BOOLEAN
EFIAPI
PeiPcdGetBoolEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -390,7 +390,7 @@ PeiPcdGetBoolEx (
UINTN
EFIAPI
PeiPcdGetSizeEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -564,7 +564,7 @@ PeiPcdSetBool (
EFI_STATUS
EFIAPI
PeiPcdSet8Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
@ -590,7 +590,7 @@ PeiPcdSet8Ex (
EFI_STATUS
EFIAPI
PeiPcdSet16Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
@ -616,7 +616,7 @@ PeiPcdSet16Ex (
EFI_STATUS
EFIAPI
PeiPcdSet32Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
@ -642,7 +642,7 @@ PeiPcdSet32Ex (
EFI_STATUS
EFIAPI
PeiPcdSet64Ex (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
@ -672,7 +672,7 @@ PeiPcdSet64Ex (
EFI_STATUS
EFIAPI
PeiPcdSetPtrEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfBuffer,
IN VOID *Buffer
@ -699,7 +699,7 @@ PeiPcdSetPtrEx (
EFI_STATUS
EFIAPI
PeiPcdSetBoolEx (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);
@ -821,7 +821,7 @@ PeiPcdGetNextTokenSpace (
**/
EFI_STATUS
PeiGetPcdInfo (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);
@ -893,7 +893,7 @@ SetWorker (
EFI_STATUS
ExSetValueWorker (
IN UINTN ExTokenNumber,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Data,
IN UINTN Size
);
@ -919,7 +919,7 @@ ExSetValueWorker (
EFI_STATUS
ExSetWorker (
IN UINTN ExTokenNumber,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Data,
IN OUT UINTN *Size,
IN BOOLEAN PtrType
@ -957,7 +957,7 @@ GetWorker (
**/
VOID *
ExGetWorker (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN ExTokenNumber,
IN UINTN GetSize
);
@ -983,7 +983,7 @@ typedef struct {
**/
UINTN
GetExPcdTokenNumber (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN ExTokenNumber
);

View File

@ -61,7 +61,7 @@ SerialStatusCodeReportWorker (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
CONST_EFI_GUID_PTR_T CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
);
@ -110,7 +110,7 @@ MemoryStatusCodeReportWorker (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
CONST_EFI_GUID_PTR_T CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
);

View File

@ -97,7 +97,7 @@ EFIAPI
PeiGetVariable (
IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
IN CONST CHAR16 *VariableName,
IN CONST EFI_GUID *VariableGuid,
CONST_EFI_GUID_PTR_T VariableGuid,
OUT UINT32 *Attributes,
IN OUT UINTN *DataSize,
OUT VOID *Data OPTIONAL

View File

@ -215,6 +215,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define PACKED
#endif
#ifndef GUID_PLUSPLUS_DEFINED
///
/// 128 bit buffer containing a unique identifier value.
/// Unless otherwise specified, aligned on a 64 bit boundary.
@ -226,6 +227,11 @@ typedef struct {
UINT8 Data4[8];
} GUID;
#define CONST_EFI_GUID_PTR_T IN CONST EFI_GUID*
#define JCONST_EFI_GUID_PTR_T IN JCONST EFI_GUID*
#endif
///
/// 4-byte buffer. An IPv4 internet protocol address.
///
@ -266,6 +272,7 @@ struct _LIST_ENTRY {
/// Datum is read-only.
///
#define CONST const
// JCONST is for when CONST has been forgotten, creating problem to C++ compiler. When compiling Clover, JCONST is defined to const
#ifndef JCONST
#define JCONST
#endif

View File

@ -24,7 +24,10 @@ typedef struct {
/// The common ACPI description table header. This structure prefaces most ACPI tables.
///
typedef struct {
UINT32 Signature;
union {
UINT32 Signature;
CHAR8 SignatureAs4Char[4];
};
UINT32 Length;
UINT8 Revision;
UINT8 Checksum;

View File

@ -1609,6 +1609,7 @@ StrToIpv4Address (
#define GUID_STRING_LENGTH 36
#ifndef GUID_PLUSPLUS_DEFINED
/**
Convert a Null-terminated Unicode GUID string to a value of type
EFI_GUID.
@ -1659,6 +1660,7 @@ StrToGuid (
IN CONST CHAR16 *String,
OUT GUID *Guid
);
#endif
/**
Convert a Null-terminated Unicode hexadecimal string to a byte array.
@ -2477,6 +2479,7 @@ AsciiStrToIpv4Address (
OUT UINT8 *PrefixLength OPTIONAL
);
#ifndef GUID_PLUSPLUS_DEFINED
/**
Convert a Null-terminated ASCII GUID string to a value of type
EFI_GUID.
@ -2526,6 +2529,7 @@ AsciiStrToGuid (
IN CONST CHAR8 *String,
OUT GUID *Guid
);
#endif
/**
Convert a Null-terminated ASCII hexadecimal string to a byte array.

View File

@ -362,6 +362,7 @@ ScanMemN (
IN UINTN Value
);
#ifndef GUID_PLUSPLUS_DEFINED
/**
Copies a source GUID to a destination GUID.
@ -406,6 +407,7 @@ CompareGuid (
IN CONST GUID *Guid1,
IN CONST GUID *Guid2
);
#endif
/**
Scans a target buffer for a GUID, and returns a pointer to the matching GUID

View File

@ -107,7 +107,7 @@ GetSectionFromAnyFvByFileType (
EFI_STATUS
EFIAPI
GetSectionFromAnyFv (
IN CONST EFI_GUID *NameGuid,
CONST_EFI_GUID_PTR_T NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
OUT VOID **Buffer,
@ -162,7 +162,7 @@ GetSectionFromAnyFv (
EFI_STATUS
EFIAPI
GetSectionFromFv (
IN CONST EFI_GUID *NameGuid,
CONST_EFI_GUID_PTR_T NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
OUT VOID **Buffer,
@ -293,7 +293,7 @@ GetFileBufferByFilePath (
EFI_STATUS
EFIAPI
GetFileDevicePathFromAnyFv (
IN CONST EFI_GUID *NameGuid,
CONST_EFI_GUID_PTR_T NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
OUT EFI_DEVICE_PATH_PROTOCOL **FvFileDevicePath

View File

@ -106,7 +106,7 @@ GetFirstHob (
VOID *
EFIAPI
GetNextGuidHob (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN CONST VOID *HobStart
);
@ -131,7 +131,7 @@ GetNextGuidHob (
VOID *
EFIAPI
GetFirstGuidHob (
IN CONST EFI_GUID *Guid
CONST_EFI_GUID_PTR_T Guid
);
/**
@ -172,7 +172,7 @@ GetBootModeHob (
VOID
EFIAPI
BuildModuleHob (
IN CONST EFI_GUID *ModuleName,
CONST_EFI_GUID_PTR_T ModuleName,
IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
IN UINT64 ModuleLength,
IN EFI_PHYSICAL_ADDRESS EntryPoint
@ -253,7 +253,7 @@ BuildResourceDescriptorHob (
VOID *
EFIAPI
BuildGuidHob (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN DataLength
);
@ -285,7 +285,7 @@ BuildGuidHob (
VOID *
EFIAPI
BuildGuidDataHob (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Data,
IN UINTN DataLength
);
@ -332,8 +332,8 @@ EFIAPI
BuildFv2Hob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN CONST EFI_GUID *FvName,
IN CONST EFI_GUID *FileName
CONST_EFI_GUID_PTR_T FvName,
CONST_EFI_GUID_PTR_T FileName
);
/**

View File

@ -65,7 +65,7 @@ PeiServicesReInstallPpi (
EFI_STATUS
EFIAPI
PeiServicesLocatePpi (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, OPTIONAL
IN OUT VOID **Ppi
@ -354,7 +354,7 @@ PeiServicesResetSystem (
EFI_STATUS
EFIAPI
PeiServicesFfsFindFileByName (
IN CONST EFI_GUID *FileName,
CONST_EFI_GUID_PTR_T FileName,
IN CONST EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);

View File

@ -196,7 +196,7 @@ EfiCreateProtocolNotifyEvent(
EFI_STATUS
EFIAPI
EfiNamedEventListen (
IN CONST EFI_GUID *Name,
CONST_EFI_GUID_PTR_T Name,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN CONST VOID *NotifyContext, OPTIONAL
@ -219,7 +219,7 @@ EfiNamedEventListen (
EFI_STATUS
EFIAPI
EfiNamedEventSignal (
IN CONST EFI_GUID *Name
CONST_EFI_GUID_PTR_T Name
);
/**
@ -237,7 +237,7 @@ EfiNamedEventSignal (
EFI_STATUS
EFIAPI
EfiEventGroupSignal (
IN CONST EFI_GUID *EventGroup
CONST_EFI_GUID_PTR_T EventGroup
);
/**
@ -431,7 +431,7 @@ EFIAPI
EfiTestManagedDevice (
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE DriverBindingHandle,
IN CONST EFI_GUID *ProtocolGuid
CONST_EFI_GUID_PTR_T ProtocolGuid
);
/**
@ -458,7 +458,7 @@ EFIAPI
EfiTestChildHandle (
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE ChildHandle,
IN CONST EFI_GUID *ProtocolGuid
CONST_EFI_GUID_PTR_T ProtocolGuid
);
/**
@ -687,7 +687,7 @@ VOID *
EFIAPI
GetVariable (
IN CONST CHAR16 *Name,
IN CONST EFI_GUID *Guid
CONST_EFI_GUID_PTR_T Guid
);
/**
@ -740,7 +740,7 @@ EFI_STATUS
EFIAPI
GetVariable2 (
IN CONST CHAR16 *Name,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
OUT VOID **Value,
OUT UINTN *Size OPTIONAL
);
@ -799,7 +799,7 @@ EFI_STATUS
EFIAPI
GetVariable3(
IN CONST CHAR16 *Name,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
OUT VOID **Value,
OUT UINTN *Size OPTIONAL,
OUT UINT32 *Attr OPTIONAL
@ -1076,7 +1076,7 @@ VOID
EFIAPI
EfiInitializeFwVolDevicepathNode (
IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
IN CONST EFI_GUID *NameGuid
CONST_EFI_GUID_PTR_T NameGuid
);
/**

View File

@ -638,7 +638,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_SCHEDULE)(
IN EFI_HANDLE FirmwareVolumeHandle,
IN CONST EFI_GUID *FileName
CONST_EFI_GUID_PTR_T FileName
);
/**
@ -656,7 +656,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_TRUST)(
IN EFI_HANDLE FirmwareVolumeHandle,
IN CONST EFI_GUID *FileName
CONST_EFI_GUID_PTR_T FileName
);
/**

View File

@ -48,7 +48,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_MM_INSTALL_CONFIGURATION_TABLE)(
IN CONST EFI_MM_SYSTEM_TABLE *SystemTable,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Table,
IN UINTN TableSize
);
@ -89,7 +89,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_MM_NOTIFY_FN)(
IN CONST EFI_GUID *Protocol,
CONST_EFI_GUID_PTR_T Protocol,
IN VOID *Interface,
IN EFI_HANDLE Handle
);
@ -115,7 +115,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_MM_REGISTER_PROTOCOL_NOTIFY)(
IN CONST EFI_GUID *Protocol,
CONST_EFI_GUID_PTR_T Protocol,
IN EFI_MM_NOTIFY_FN Function,
OUT VOID **Registration
);
@ -136,7 +136,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_MM_INTERRUPT_MANAGE)(
IN CONST EFI_GUID *HandlerType,
CONST_EFI_GUID_PTR_T HandlerType,
IN CONST VOID *Context OPTIONAL,
IN OUT VOID *CommBuffer OPTIONAL,
IN OUT UINTN *CommBufferSize OPTIONAL

View File

@ -206,7 +206,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_PEI_LOCATE_PPI)(
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL,
IN OUT VOID **Ppi
@ -649,7 +649,7 @@ VOID
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_BY_NAME)(
IN CONST EFI_GUID *FileName,
CONST_EFI_GUID_PTR_T FileName,
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);

View File

@ -44,7 +44,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_SMM_INSTALL_CONFIGURATION_TABLE2)(
IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN VOID *Table,
IN UINTN TableSize
);

View File

@ -114,7 +114,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FV_FIND_FILE_NAME)(
IN CONST EFI_PEI_FIRMWARE_VOLUME_PPI *This,
IN CONST EFI_GUID *FileName,
CONST_EFI_GUID_PTR_T FileName,
IN EFI_PEI_FV_HANDLE *FvHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);

View File

@ -205,7 +205,7 @@ UINTN
typedef
UINT8
(EFIAPI *PCD_PPI_GET_EX_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -228,7 +228,7 @@ UINT8
typedef
UINT16
(EFIAPI *PCD_PPI_GET_EX_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -251,7 +251,7 @@ UINT16
typedef
UINT32
(EFIAPI *PCD_PPI_GET_EX_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -274,7 +274,7 @@ UINT32
typedef
UINT64
(EFIAPI *PCD_PPI_GET_EX_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -297,7 +297,7 @@ UINT64
typedef
VOID *
(EFIAPI *PCD_PPI_GET_EX_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -320,7 +320,7 @@ VOID *
typedef
BOOLEAN
(EFIAPI *PCD_PPI_GET_EX_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -341,7 +341,7 @@ BOOLEAN
typedef
UINTN
(EFIAPI *PCD_PPI_GET_EX_SIZE)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -525,7 +525,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_EX_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
@ -553,7 +553,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_EX_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
@ -581,7 +581,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_EX_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
@ -609,7 +609,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_EX_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
@ -641,7 +641,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_EX_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfValue,
IN VOID *Buffer
@ -668,7 +668,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_EX_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);

View File

@ -61,7 +61,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *GET_PCD_INFO_PPI_GET_INFO_EX) (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);

View File

@ -61,7 +61,7 @@ VOID
typedef
UINT8
(EFIAPI *EFI_PEI_PCD_PPI_GET_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -77,7 +77,7 @@ UINT8
typedef
UINT16
(EFIAPI *EFI_PEI_PCD_PPI_GET_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -93,7 +93,7 @@ UINT16
typedef
UINT32
(EFIAPI *EFI_PEI_PCD_PPI_GET_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -109,7 +109,7 @@ UINT32
typedef
UINT64
(EFIAPI *EFI_PEI_PCD_PPI_GET_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -124,7 +124,7 @@ UINT64
typedef
VOID *
(EFIAPI *EFI_PEI_PCD_PPI_GET_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -140,7 +140,7 @@ VOID *
typedef
BOOLEAN
(EFIAPI *EFI_PEI_PCD_PPI_GET_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -156,7 +156,7 @@ BOOLEAN
typedef
UINTN
(EFIAPI *EFI_PEI_PCD_PPI_GET_SIZE)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -179,7 +179,7 @@ UINTN
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
@ -203,7 +203,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
@ -227,7 +227,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
@ -251,7 +251,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
@ -278,7 +278,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfValue,
IN VOID *Buffer
@ -303,7 +303,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCD_PPI_SET_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);

View File

@ -39,7 +39,7 @@ typedef struct _EFI_GET_PCD_INFO_PPI EFI_GET_PCD_INFO_PPI;
typedef
EFI_STATUS
(EFIAPI *EFI_GET_PCD_INFO_PPI_GET_INFO) (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);

View File

@ -51,7 +51,7 @@ EFI_STATUS
(EFIAPI *EFI_PEI_GET_VARIABLE2)(
IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
IN CONST CHAR16 *VariableName,
IN CONST EFI_GUID *VariableGuid,
CONST_EFI_GUID_PTR_T VariableGuid,
OUT UINT32 *Attributes,
IN OUT UINTN *DataSize,
OUT VOID *Data OPTIONAL

View File

@ -21,7 +21,7 @@ EFI_STATUS
IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
CONST_EFI_GUID_PTR_T CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data
);

View File

@ -296,7 +296,7 @@ typedef
EFI_STATUS
(EFIAPI * EFI_FV_READ_FILE)(
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *NameGuid,
CONST_EFI_GUID_PTR_T NameGuid,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT EFI_FV_FILETYPE *FoundType,
@ -404,7 +404,7 @@ typedef
EFI_STATUS
(EFIAPI * EFI_FV_READ_SECTION)(
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *NameGuid,
CONST_EFI_GUID_PTR_T NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
IN OUT VOID **Buffer,
@ -658,7 +658,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_FV_GET_INFO)(
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *InformationType,
CONST_EFI_GUID_PTR_T InformationType,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
@ -708,7 +708,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_FV_SET_INFO)(
IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
IN CONST EFI_GUID *InformationType,
CONST_EFI_GUID_PTR_T InformationType,
IN UINTN BufferSize,
IN CONST VOID *Buffer
);

View File

@ -108,7 +108,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HASH_GET_HASH_SIZE)(
IN CONST EFI_HASH_PROTOCOL *This,
IN CONST EFI_GUID *HashAlgorithm,
CONST_EFI_GUID_PTR_T HashAlgorithm,
OUT UINTN *HashSize
);
@ -139,7 +139,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HASH_HASH)(
IN CONST EFI_HASH_PROTOCOL *This,
IN CONST EFI_GUID *HashAlgorithm,
CONST_EFI_GUID_PTR_T HashAlgorithm,
IN BOOLEAN Extend,
IN CONST UINT8 *Message,
IN UINT64 MessageSize,

View File

@ -75,7 +75,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HASH2_GET_HASH_SIZE)(
IN CONST EFI_HASH2_PROTOCOL *This,
IN CONST EFI_GUID *HashAlgorithm,
CONST_EFI_GUID_PTR_T HashAlgorithm,
OUT UINTN *HashSize
);
@ -103,7 +103,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HASH2_HASH)(
IN CONST EFI_HASH2_PROTOCOL *This,
IN CONST EFI_GUID *HashAlgorithm,
CONST_EFI_GUID_PTR_T HashAlgorithm,
IN CONST UINT8 *Message,
IN UINTN MessageSize,
IN OUT EFI_HASH2_OUTPUT *Hash
@ -129,7 +129,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HASH2_HASH_INIT)(
IN CONST EFI_HASH2_PROTOCOL *This,
IN CONST EFI_GUID *HashAlgorithm
CONST_EFI_GUID_PTR_T HashAlgorithm
);
/**

View File

@ -389,7 +389,7 @@ EFI_STATUS
(EFIAPI * EFI_HII_GET_ALT_CFG)(
IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
IN CONST EFI_STRING ConfigResp,
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN CONST EFI_STRING Name,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST UINT16 *AltCfgId,

View File

@ -59,7 +59,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_DATABASE_NOTIFY)(
IN UINT8 PackageType,
IN CONST EFI_GUID *PackageGuid,
CONST_EFI_GUID_PTR_T PackageGuid,
IN CONST EFI_HII_PACKAGE_HEADER *Package,
IN EFI_HII_HANDLE Handle,
IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType
@ -232,7 +232,7 @@ EFI_STATUS
(EFIAPI *EFI_HII_DATABASE_LIST_PACKS)(
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN UINT8 PackageType,
IN CONST EFI_GUID *PackageGuid,
CONST_EFI_GUID_PTR_T PackageGuid,
IN OUT UINTN *HandleBufferLength,
OUT EFI_HII_HANDLE *Handle
);
@ -344,7 +344,7 @@ EFI_STATUS
(EFIAPI *EFI_HII_DATABASE_REGISTER_NOTIFY)(
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN UINT8 PackageType,
IN CONST EFI_GUID *PackageGuid,
CONST_EFI_GUID_PTR_T PackageGuid,
IN EFI_HII_DATABASE_NOTIFY PackageNotifyFn,
IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,
OUT EFI_HANDLE *NotifyHandle
@ -445,7 +445,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT)(
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN CONST EFI_GUID *KeyGuid,
CONST_EFI_GUID_PTR_T KeyGuid,
IN OUT UINT16 *KeyboardLayoutLength,
OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout
);
@ -474,7 +474,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT)(
IN CONST EFI_HII_DATABASE_PROTOCOL *This,
IN CONST EFI_GUID *KeyGuid
CONST_EFI_GUID_PTR_T KeyGuid
);
/**

View File

@ -45,7 +45,7 @@ EFI_STATUS
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
CONST_EFI_GUID_PTR_T CallerId,
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
);

View File

@ -209,7 +209,7 @@ UINTN
typedef
UINT8
(EFIAPI *PCD_PROTOCOL_GET_EX_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -232,7 +232,7 @@ UINT8
typedef
UINT16
(EFIAPI *PCD_PROTOCOL_GET_EX_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -255,7 +255,7 @@ UINT16
typedef
UINT32
(EFIAPI *PCD_PROTOCOL_GET_EX_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -278,7 +278,7 @@ UINT32
typedef
UINT64
(EFIAPI *PCD_PROTOCOL_GET_EX_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -301,7 +301,7 @@ UINT64
typedef
VOID *
(EFIAPI *PCD_PROTOCOL_GET_EX_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -324,7 +324,7 @@ VOID *
typedef
BOOLEAN
(EFIAPI *PCD_PROTOCOL_GET_EX_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -345,7 +345,7 @@ BOOLEAN
typedef
UINTN
(EFIAPI *PCD_PROTOCOL_GET_EX_SIZE)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -533,7 +533,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
@ -561,7 +561,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
@ -589,7 +589,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
@ -617,7 +617,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
@ -649,7 +649,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfBuffer,
IN VOID *Buffer
@ -678,7 +678,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);

View File

@ -64,7 +64,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *GET_PCD_INFO_PROTOCOL_GET_INFO_EX) (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);

View File

@ -62,7 +62,7 @@ VOID
typedef
UINT8
(EFIAPI *EFI_PCD_PROTOCOL_GET_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -78,7 +78,7 @@ UINT8
typedef
UINT16
(EFIAPI *EFI_PCD_PROTOCOL_GET_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -94,7 +94,7 @@ UINT16
typedef
UINT32
(EFIAPI *EFI_PCD_PROTOCOL_GET_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -111,7 +111,7 @@ UINT32
typedef
UINT64
(EFIAPI *EFI_PCD_PROTOCOL_GET_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -128,7 +128,7 @@ UINT64
typedef
VOID *
(EFIAPI *EFI_PCD_PROTOCOL_GET_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -144,7 +144,7 @@ VOID *
typedef
BOOLEAN
(EFIAPI *EFI_PCD_PROTOCOL_GET_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -160,7 +160,7 @@ BOOLEAN
typedef
UINTN
(EFIAPI *EFI_PCD_PROTOCOL_GET_SIZE)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber
);
@ -183,7 +183,7 @@ UINTN
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_8)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
@ -207,7 +207,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_16)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
@ -231,7 +231,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_32)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
@ -255,7 +255,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_64)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
@ -282,7 +282,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_POINTER)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfValue,
IN VOID *Buffer
@ -307,7 +307,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_BOOLEAN)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);

View File

@ -39,7 +39,7 @@ typedef struct _EFI_GET_PCD_INFO_PROTOCOL EFI_GET_PCD_INFO_PROTOCOL;
typedef
EFI_STATUS
(EFIAPI *EFI_GET_PCD_INFO_PROTOCOL_GET_INFO) (
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);

View File

@ -262,7 +262,7 @@ EFI_STATUS
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE ChildHandle OPTIONAL,
IN CONST UINTN *Instance,
IN CONST EFI_GUID *ParameterTypeGuid,
CONST_EFI_GUID_PTR_T ParameterTypeGuid,
IN CONST VOID *ParameterBlock,
IN CONST UINTN ParameterBlockSize ,
IN CONST EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction

View File

@ -692,7 +692,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_GUID_NAME)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
OUT CONST CHAR16 **GuidName
);
@ -958,7 +958,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_REGISTER_GUID_NAME)(
IN CONST EFI_GUID *Guid,
CONST_EFI_GUID_PTR_T Guid,
IN CONST CHAR16 *GuidName
);

View File

@ -14,6 +14,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __PI_UEFI_H__
#define __PI_UEFI_H__
// This is a hack to replace EFI_GUID by the C++ improved version (they are 100% binary compatible).
// Any reference to CLOVER or Unit tests should not be here, of course.
// Problem is that EFI_GUID ++ version refers to XString and XString is defined inside Clover instead of being of module.
// Because the module CppMemLib is not in Clover anymore (that's because of Visual Studio!) and has no access to XString, I have to not include Guid++.h for CppMemLib
// That should be changed...
#if defined(__cplusplus) && ( defined(CLOVER_BUILD) || defined(UNIT_TESTS) )
#include <Guid++.h>
#endif
#include <Uefi/UefiBaseType.h>
#include <Uefi/UefiSpec.h>

View File

@ -666,7 +666,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_GET_VARIABLE)(
IN JCONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
JCONST_EFI_GUID_PTR_T VendorGuid,
OUT UINT32 *Attributes, OPTIONAL
IN OUT UINTN *DataSize,
OUT VOID *Data OPTIONAL
@ -744,7 +744,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_SET_VARIABLE)(
IN JCONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
JCONST_EFI_GUID_PTR_T VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN JCONST VOID *Data
@ -1328,7 +1328,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_OPEN_PROTOCOL)(
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
JCONST_EFI_GUID_PTR_T Protocol,
OUT VOID **Interface, OPTIONAL
IN EFI_HANDLE AgentHandle,
IN EFI_HANDLE ControllerHandle,
@ -1361,7 +1361,7 @@ typedef
EFI_STATUS
(EFIAPI *EFI_CLOSE_PROTOCOL)(
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
JCONST_EFI_GUID_PTR_T Protocol,
IN EFI_HANDLE AgentHandle,
IN EFI_HANDLE ControllerHandle
);
@ -1596,7 +1596,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_PROTOCOL)(
IN EFI_GUID *Protocol,
JCONST_EFI_GUID_PTR_T Protocol,
IN VOID *Registration, OPTIONAL
OUT VOID **Interface
);

View File

@ -215,6 +215,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define PACKED
#endif
#ifndef GUID_PLUSPLUS_DEFINED
///
/// 128 bit buffer containing a unique identifier value.
/// Unless otherwise specified, aligned on a 64 bit boundary.
@ -226,6 +227,11 @@ typedef struct {
UINT8 Data4[8];
} GUID;
#define CONST_EFI_GUID_PTR_T IN CONST EFI_GUID*
#define JCONST_EFI_GUID_PTR_T IN JCONST EFI_GUID*
#endif
///
/// 4-byte buffer. An IPv4 internet protocol address.
///

View File

@ -25,6 +25,11 @@
<nature>org.eclipse.cdt.core.ccnature</nature>
</natures>
<linkedResources>
<link>
<name>MdePkg</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC/MdePkg</locationURI>
</link>
<link>
<name>MemLogLibDefault</name>
<type>2</type>

View File

@ -1,9 +1,13 @@
echo "
JIEF_DEBUG
UNIT_TESTS
UNIT_TESTS_MACOS
JCONST=const
___NOT___ENABLE_SECURE_BOOT
sprintf=__sprintf_is_disabled__
wcscmp=__wcsncmp_is_disabled__
OC_TARGET_DEBUG
" | awk '$0!=""{ printf " -D%s", $0; }'

View File

@ -49,9 +49,13 @@
9A2755302639A1FA0095D456 /* ConfigPlistAbstract.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A27550B2639A1FA0095D456 /* ConfigPlistAbstract.cpp */; };
9A2755312639A1FA0095D456 /* ConfigPlistAbstract.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A27550B2639A1FA0095D456 /* ConfigPlistAbstract.cpp */; };
9A2A7C7324576CCE00422263 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
9A39C8B02816BB24004B3DCE /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A39C8B32816BFA9004B3DCE /* guid_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A39C8B12816BFA8004B3DCE /* guid_tests.cpp */; };
9A39C8B42816BFA9004B3DCE /* guid_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A39C8B12816BFA8004B3DCE /* guid_tests.cpp */; };
9A39C8B52816BFA9004B3DCE /* guid_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A39C8B12816BFA8004B3DCE /* guid_tests.cpp */; };
9A39C8B62816BFA9004B3DCE /* guid_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A39C8B12816BFA8004B3DCE /* guid_tests.cpp */; };
9A3D2C57261855D000F0D7A1 /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A3D2C58261855D000F0D7A1 /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A3D2C59261855D000F0D7A1 /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A3D2C5A261855D000F0D7A1 /* BootLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */; };
9A3D2C5F261855D000F0D7A1 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4E261855D000F0D7A1 /* abort.cpp */; };
9A3D2C60261855D000F0D7A1 /* abort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A3D2C4E261855D000F0D7A1 /* abort.cpp */; };
@ -335,6 +339,11 @@
9A2755042639A1FA0095D456 /* ConfigPlistAbstract.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConfigPlistAbstract.h; sourceTree = "<group>"; };
9A27550B2639A1FA0095D456 /* ConfigPlistAbstract.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConfigPlistAbstract.cpp; sourceTree = "<group>"; };
9A2A7C8624576CCE00422263 /* cpp_tests UTF32 c++17 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32 c++17"; sourceTree = BUILT_PRODUCTS_DIR; };
9A39C8B12816BFA8004B3DCE /* guid_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guid_tests.cpp; sourceTree = "<group>"; };
9A39C8B22816BFA9004B3DCE /* guid_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guid_tests.h; sourceTree = "<group>"; };
9A39C8B72816C56E004B3DCE /* remove_ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = remove_ref.h; sourceTree = "<group>"; };
9A39C8B82816C56E004B3DCE /* Net.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Net.h; sourceTree = "<group>"; };
9A39C8B92816C56E004B3DCE /* Guid++.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Guid++.h"; sourceTree = "<group>"; };
9A3D2C4B261855D000F0D7A1 /* BootLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BootLog.cpp; sourceTree = "<group>"; };
9A3D2C4E261855D000F0D7A1 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; };
9A3D2C4F261855D000F0D7A1 /* posix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = posix.h; sourceTree = "<group>"; };
@ -12790,6 +12799,8 @@
9A82FCA726184686006F973B /* cpp_unit_test */ = {
isa = PBXGroup;
children = (
9A39C8B12816BFA8004B3DCE /* guid_tests.cpp */,
9A39C8B22816BFA9004B3DCE /* guid_tests.h */,
9A071C2A26196CA40007CC44 /* xml_lite-reapeatingdict-test.cpp */,
9A071C2926196CA40007CC44 /* xml_lite-reapeatingdict-test.h */,
9A82FCC526184686006F973B /* all_tests.cpp */,
@ -12841,6 +12852,9 @@
9A82FCDC26184686006F973B /* include */ = {
isa = PBXGroup;
children = (
9A39C8B92816C56E004B3DCE /* Guid++.h */,
9A39C8B82816C56E004B3DCE /* Net.h */,
9A39C8B72816C56E004B3DCE /* remove_ref.h */,
9A82FCDD26184686006F973B /* Devices.h */,
9A82FCDF26184686006F973B /* syslinux_mbr.h */,
9A82FCE126184686006F973B /* rename_helper.h */,
@ -13406,6 +13420,7 @@
9A071C0D26196C200007CC44 /* xml_lite-test.cpp in Sources */,
9A82FE6626184688006F973B /* XArray_tests.cpp in Sources */,
9A3D2C58261855D000F0D7A1 /* BootLog.cpp in Sources */,
9A39C8B52816BFA9004B3DCE /* guid_tests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -13479,6 +13494,7 @@
9A071C0E26196C210007CC44 /* xml_lite-test.cpp in Sources */,
9A82FE6826184688006F973B /* XArray_tests.cpp in Sources */,
9A3D2C5A261855D000F0D7A1 /* BootLog.cpp in Sources */,
9A39C8B62816BFA9004B3DCE /* guid_tests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -13486,6 +13502,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9A39C8B02816BB24004B3DCE /* BootLog.cpp in Sources */,
9A87876C26186302000B9362 /* BaseMemoryLib.c in Sources */,
9A8200AF26184688006F973B /* XString.cpp in Sources */,
9A82FEA326184688006F973B /* TagDict.cpp in Sources */,
@ -13551,7 +13568,7 @@
9A82FEB726184688006F973B /* TagBool.cpp in Sources */,
9A071C0C26196C200007CC44 /* xml_lite-test.cpp in Sources */,
9A82FE6726184688006F973B /* XArray_tests.cpp in Sources */,
9A3D2C59261855D000F0D7A1 /* BootLog.cpp in Sources */,
9A39C8B42816BFA9004B3DCE /* guid_tests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -13625,6 +13642,7 @@
9A071C0B26196C200007CC44 /* xml_lite-test.cpp in Sources */,
9A8200AD26184688006F973B /* XString.cpp in Sources */,
9A3D2C63261855D000F0D7A1 /* BasicIO.cpp in Sources */,
9A39C8B32816BFA9004B3DCE /* guid_tests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -39,7 +39,7 @@
* OUT: EFI_GUID
* returns null if it is not APFS part
*/
EFI_GUID *APFSPartitionUUIDExtract(
EFI_GUID APFSPartitionUUIDExtract(
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
@ -48,37 +48,13 @@ EFI_GUID *APFSPartitionUUIDExtract(
DevicePath = NextDevicePathNode(DevicePath);
}
if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) {
//Check that vendor-assigned GUID defines APFS Container Partition
if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).isEqualIC(ApfsSignatureUUID) ) {
return (EFI_GUID *)((UINT8 *)DevicePath+0x14);
//Check that vendor-assigned EFI_GUID defines APFS Container Partition
if ( ApfsSignatureUUID == *(EFI_GUID *)((UINT8 *)DevicePath+0x04) ) {
return *(EFI_GUID *)((UINT8 *)DevicePath+0x14);
}
}
return NULL;
}
/*
* Function for obtaining unique part id from APFS partition
* IN: DevicePath
* OUT: EFI_GUID
* returns empty string if it is not APFS part
*/
XString8 APFSPartitionUUIDExtractAsXString8(
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_GUID* uuid = APFSPartitionUUIDExtract(DevicePath);
if ( uuid ) return GuidLEToXString8(*uuid);
return ""_XS8;
return nullGuid;
}
//XStringW APFSPartitionUUIDExtractAsXStringW(
// IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
// )
//{
// EFI_GUID* uuid = APFSPartitionUUIDExtract(DevicePath);
// if ( uuid ) return GuidLEToXStringW(uuid);
// return L""_XSW;
//}

View File

@ -12,7 +12,8 @@ extern "C" {
#include <Protocol/DevicePath.h>
}
constexpr LString8 ApfsSignatureUUID = "BE74FCF7-0B7C-49F3-9147-01F4042E6842"_XS8;
// The conversion from string litteral to EFI_GUID is made at compile time !!! Thanks constexpr.
constexpr const EFI_GUID ApfsSignatureUUID = "BE74FCF7-0B7C-49F3-9147-01F4042E6842"_guid;
/*
* Function for obtaining unique part id from APFS partition
@ -20,18 +21,9 @@ constexpr LString8 ApfsSignatureUUID = "BE74FCF7-0B7C-49F3-9147-01F4042E6842"_XS
* OUT: EFI_GUID
* returns null if it is not APFS part
*/
EFI_GUID* APFSPartitionUUIDExtract(
EFI_GUID APFSPartitionUUIDExtract(
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
XString8 APFSPartitionUUIDExtractAsXString8(
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
//XStringW APFSPartitionUUIDExtractAsXStringW(
// IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
// );
#endif /* PLATFORM_APFS_H_ */

View File

@ -1765,12 +1765,12 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
//try to find in SystemTable
for(Index = 0; Index < gST->NumberOfTableEntries; Index++) {
if(CompareGuid (&gST->ConfigurationTable[Index].VendorGuid, &gEfiAcpi20TableGuid)) {
if( gST->ConfigurationTable[Index].VendorGuid == gEfiAcpi20TableGuid ) {
// Acpi 2.0
RsdPointer = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER*)gST->ConfigurationTable[Index].VendorTable;
break;
}
else if(CompareGuid (&gST->ConfigurationTable[Index].VendorGuid, &gEfiAcpi10TableGuid)) {
else if( gST->ConfigurationTable[Index].VendorGuid == gEfiAcpi10TableGuid ) {
// Acpi 1.0 - RSDT only
RsdPointer = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER*)gST->ConfigurationTable[Index].VendorTable;
continue;

View File

@ -328,31 +328,31 @@ EFI_STATUS ScanDeviceHandles(EFI_HANDLE ControllerHandle,
if (!EFI_ERROR(Status)) {
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid)) {
if ( *(ProtocolGuidArray[ProtocolIndex]) == gEfiLoadedImageProtocolGuid ) {
(*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_IMAGE_HANDLE;
}
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid)) {
if ( *(ProtocolGuidArray[ProtocolIndex]) == gEfiDriverBindingProtocolGuid ) {
(*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DRIVER_BINDING_HANDLE;
}
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid)) {
if ( *(ProtocolGuidArray[ProtocolIndex]) == gEfiDriverConfigurationProtocolGuid ) {
(*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DRIVER_CONFIGURATION_HANDLE;
}
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid)) {
if ( *(ProtocolGuidArray[ProtocolIndex]) == gEfiDriverDiagnosticsProtocolGuid ) {
(*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DRIVER_DIAGNOSTICS_HANDLE;
}
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid)) {
if ( *(ProtocolGuidArray[ProtocolIndex]) == gEfiComponentName2ProtocolGuid ) {
(*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_COMPONENT_NAME_HANDLE;
}
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid) ) {
if ( *(ProtocolGuidArray[ProtocolIndex]) == gEfiComponentNameProtocolGuid ) {
(*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_COMPONENT_NAME_HANDLE;
}
if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid)) {
if ( *(ProtocolGuidArray[ProtocolIndex]) == gEfiDevicePathProtocolGuid ) {
(*HandleType)[HandleIndex] |= EFI_HANDLE_TYPE_DEVICE_HANDLE;
}

View File

@ -355,7 +355,7 @@ GetBootOrder (
//
// Get gEfiGlobalVariableGuid:BootOrder and it's length
//
*BootOrder = (__typeof_am__(*BootOrder))GetNvramVariable(BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
*BootOrder = (__typeof_am__(*BootOrder))GetNvramVariable(BOOT_ORDER_VAR, gEfiGlobalVariableGuid, NULL, &BootOrderSize);
if (*BootOrder == NULL) {
DBG(" EFI_NOT_FOUND\n");
return EFI_NOT_FOUND;
@ -429,7 +429,7 @@ AddToBootOrder (
// Save it
//
Status = gRT->SetVariable (BOOT_ORDER_VAR,
&gEfiGlobalVariableGuid,
gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS,
@ -499,7 +499,7 @@ DeleteFromBootOrder (
// Save it
//
Status = gRT->SetVariable (BOOT_ORDER_VAR,
&gEfiGlobalVariableGuid,
gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS,
@ -697,7 +697,7 @@ GetBootOption (
BootOption->BootNum = BootNum;
snwprintf(VarName, sizeof(VarName), "Boot%04hX", BootNum);
BootOption->Variable = (__typeof__(BootOption->Variable))GetNvramVariable(VarName, &gEfiGlobalVariableGuid, NULL, (UINTN *)(UINTN)(OFFSET_OF(BO_BOOT_OPTION, VariableSize) + (UINTN)BootOption));
BootOption->Variable = (__typeof__(BootOption->Variable))GetNvramVariable(VarName, gEfiGlobalVariableGuid, NULL, (UINTN *)(UINTN)(OFFSET_OF(BO_BOOT_OPTION, VariableSize) + (UINTN)BootOption));
if (BootOption->Variable == NULL) {
return EFI_NOT_FOUND;
}
@ -724,7 +724,7 @@ FindFreeBootNum (
for (Index = 0; Index <= 0xFFFF; Index++) {
snwprintf(VarName, sizeof(VarName), "Boot%04llX", Index);
VarSize = 0;
Status = gRT->GetVariable (VarName, &gEfiGlobalVariableGuid, NULL, &VarSize, NULL);
Status = gRT->GetVariable (VarName, gEfiGlobalVariableGuid, NULL, &VarSize, NULL);
if (Status == EFI_NOT_FOUND) {
*BootNum = (UINT16)Index;
return EFI_SUCCESS;
@ -959,7 +959,7 @@ AddBootOption (
// Save BootXXXX var
//
Status = gRT->SetVariable (VarName,
&gEfiGlobalVariableGuid,
gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS,
@ -1076,7 +1076,7 @@ DeleteBootOption (
// Delete BootXXXX var
//
Status = gRT->SetVariable (VarName,
&gEfiGlobalVariableGuid,
gEfiGlobalVariableGuid,
0,
0,
NULL

View File

@ -26,8 +26,8 @@ DATA_HUB_INSTANCE mDataHub;
Log data record into the data logging hub
@param This Protocol instance structure
@param DataRecordGuid GUID that defines record contents
@param ProducerName GUID that defines the name of the producer of the data
@param DataRecordGuid EFI_GUID that defines record contents
@param ProducerName EFI_GUID that defines the name of the producer of the data
@param DataRecordClass Class that defines generic record type
@param RawData Data Log record as defined by DataRecordGuid
@param RawDataSize Size of Data Log data in bytes
@ -40,8 +40,8 @@ EFI_STATUS
EFIAPI
DataHubLogData (
IN EFI_DATA_HUB_PROTOCOL *This,
IN EFI_GUID *DataRecordGuid,
IN EFI_GUID *ProducerName,
const EFI_GUID& DataRecordGuid,
const EFI_GUID& ProducerName,
IN UINT64 DataRecordClass,
IN VOID *RawData,
IN UINT32 RawDataSize
@ -109,8 +109,8 @@ DataHubLogData (
Record->Version = EFI_DATA_RECORD_HEADER_VERSION;
Record->HeaderSize = (UINT16) sizeof (EFI_DATA_RECORD_HEADER);
Record->RecordSize = RecordSize;
CopyMem (&Record->DataRecordGuid, DataRecordGuid, sizeof (EFI_GUID));
CopyMem (&Record->ProducerName, ProducerName, sizeof (EFI_GUID));
Record->DataRecordGuid = DataRecordGuid;
Record->ProducerName = ProducerName;
Record->DataRecordClass = DataRecordClass;
//
@ -139,9 +139,9 @@ DataHubLogData (
Head = &Private->FilterDriverListHead;
for (Link = GetFirstNode(Head); Link != Head; Link = GetNextNode(Head, Link)) {
FilterEntry = FILTER_ENTRY_FROM_LINK (Link);
if (((FilterEntry->ClassFilter & DataRecordClass) != 0) &&
(IsZeroGuid (&FilterEntry->FilterDataRecordGuid) ||
CompareGuid (&FilterEntry->FilterDataRecordGuid, DataRecordGuid))) {
if ( (FilterEntry->ClassFilter & DataRecordClass) != 0 &&
( FilterEntry->FilterDataRecordGuid.isNull() || FilterEntry->FilterDataRecordGuid == DataRecordGuid )
) {
gBS->SignalEvent (FilterEntry->Event);
}
}

View File

@ -63,12 +63,11 @@ EFI_SUBCLASS_TYPE1_HEADER mCpuDataRecordHeader = {
};
// gDataHubPlatformGuid
/// The GUID of the DataHubProtocol
EFI_GUID gDataHubPlatformGuid = {
/// The EFI_GUID of the DataHubProtocol
constexpr const EFI_GUID gDataHubPlatformGuid = {
0x64517cc8, 0x6561, 0x4051, { 0xb0, 0x3c, 0x59, 0x64, 0xb6, 0x0f, 0x4c, 0x7a }
};
extern EFI_GUID gDataHubPlatformGuid;
extern APPLE_SMC_IO_PROTOCOL *gAppleSmc;
@ -115,7 +114,7 @@ CopyRecord(IN PLATFORM_DATA_RECORD *Rec,
// LogDataHub
/// Adds a key-value-pair to the DataHubProtocol
EFI_STATUS EFIAPI
LogDataHub(IN EFI_GUID *TypeGuid,
LogDataHub(const EFI_GUID& TypeGuid,
IN CONST CHAR16 *Name,
IN const void *Data,
IN UINT32 DataSize)
@ -132,7 +131,7 @@ LogDataHub(IN EFI_GUID *TypeGuid,
RecordSize = CopyRecord(platform_data_record, Name, Data, DataSize);
Status = gDataHub->LogData(gDataHub,
TypeGuid, // DataRecordGuid
&gDataHubPlatformGuid, // ProducerName (always)
gDataHubPlatformGuid, // ProducerName (always)
EFI_DATA_RECORD_CLASS_DATA,
platform_data_record,
RecordSize);
@ -142,7 +141,7 @@ LogDataHub(IN EFI_GUID *TypeGuid,
}
EFI_STATUS EFIAPI
LogDataHubXString8(IN EFI_GUID *TypeGuid,
LogDataHubXString8(const EFI_GUID& TypeGuid,
IN CONST CHAR16 *Name,
const XString8& s)
{
@ -155,7 +154,7 @@ LogDataHubXString8(IN EFI_GUID *TypeGuid,
}
EFI_STATUS EFIAPI
LogDataHubXStringW(IN EFI_GUID *TypeGuid,
LogDataHubXStringW(const EFI_GUID& TypeGuid,
IN CONST CHAR16 *Name,
const XStringW& s)
{
@ -176,7 +175,7 @@ EFI_RUNTIME_SERVICES gOrgRS;
EFI_STATUS EFIAPI
OvrSetVariable(
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN void *Data
@ -189,7 +188,7 @@ OvrSetVariable(
if ( gSettings.RtVariables.BlockRtVariableArray[i].Disabled ) {
continue;
}
if (!CompareGuid(&gSettings.RtVariables.BlockRtVariableArray[i].Guid, VendorGuid)) {
if ( gSettings.RtVariables.BlockRtVariableArray[i].Guid != VendorGuid ) {
continue;
}
if (gSettings.RtVariables.BlockRtVariableArray[i].Name.isEmpty() || gSettings.RtVariables.BlockRtVariableArray[i].Name[0] == L'*' || gSettings.RtVariables.BlockRtVariableArray[i].Name == LStringW(VariableName) ) {
@ -227,8 +226,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
CHAR8 *PlatformLang;
EFI_GUIDClass uuid;
gSettings.getUUID(&uuid);
EFI_GUID uuid = gSettings.getUUID();
//
// firmware Variables
@ -239,7 +237,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// As found on a real Mac, the system-id variable solely has the BS flag
SetNvramVariable(L"system-id",
&gEfiAppleNvramGuid,
gEfiAppleNvramGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof(uuid),
&uuid);
@ -252,45 +250,45 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
}
SetNvramXString8(L"MLB",
&gEfiAppleNvramGuid,
gEfiAppleNvramGuid,
Attributes,
GlobalConfig.RtMLB);
}
if (GlobalConfig.RtROM.notEmpty()) {
SetNvramVariable(L"ROM",
&gEfiAppleNvramGuid,
gEfiAppleNvramGuid,
Attributes,
GlobalConfig.RtROM.size(),
GlobalConfig.RtROM.vdata());
}
SetNvramVariable(L"FirmwareFeatures",
&gEfiAppleNvramGuid,
gEfiAppleNvramGuid,
Attributes,
sizeof(gSettings.Smbios.FirmwareFeatures),
&gSettings.Smbios.FirmwareFeatures);
SetNvramVariable(L"FirmwareFeaturesMask",
&gEfiAppleNvramGuid,
gEfiAppleNvramGuid,
Attributes,
sizeof(gSettings.Smbios.FirmwareFeaturesMask),
&gSettings.Smbios.FirmwareFeaturesMask);
SetNvramVariable(L"ExtendedFirmwareFeatures",
&gEfiAppleNvramGuid,
gEfiAppleNvramGuid,
Attributes,
sizeof(gSettings.Smbios.ExtendedFirmwareFeatures),
&gSettings.Smbios.ExtendedFirmwareFeatures);
SetNvramVariable(L"ExtendedFirmwareFeaturesMask",
&gEfiAppleNvramGuid,
gEfiAppleNvramGuid,
Attributes,
sizeof(gSettings.Smbios.ExtendedFirmwareFeaturesMask),
&gSettings.Smbios.ExtendedFirmwareFeaturesMask);
// HW_MLB and HW_ROM are also around on some Macs with the same values as MLB and ROM
AddNvramXString8(L"HW_BID", &gEfiAppleNvramGuid, Attributes, gSettings.Smbios.BoardNumber);
AddNvramXString8(L"HW_BID", gEfiAppleNvramGuid, Attributes, gSettings.Smbios.BoardNumber);
//
@ -304,10 +302,10 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// using AddNvramVariable content instead of calling the function to do LangLen calculation only when necessary
// Do not mess with prev-lang:kbd on UEFI systems without NVRAM emulation; it's OS X's business
KbdPrevLang = L"prev-lang:kbd";
OldData = (__typeof__(OldData))GetNvramVariable(KbdPrevLang, &gEfiAppleBootGuid, NULL, NULL);
OldData = (__typeof__(OldData))GetNvramVariable(KbdPrevLang, gEfiAppleBootGuid, NULL, NULL);
if (OldData == NULL) {
gSettings.GUI.Language.trim();
SetNvramXString8(KbdPrevLang, &gEfiAppleBootGuid, Attributes, gSettings.GUI.Language);
SetNvramXString8(KbdPrevLang, gEfiAppleBootGuid, Attributes, gSettings.GUI.Language);
} else {
FreePool(OldData);
}
@ -316,7 +314,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
}
//#define EFI_PLATFORM_LANG_VARIABLE_NAME L"PlatformLang"
PlatformLang = (__typeof__(PlatformLang))GetNvramVariable(EFI_PLATFORM_LANG_VARIABLE_NAME, &gEfiGlobalVariableGuid, NULL, NULL);
PlatformLang = (__typeof__(PlatformLang))GetNvramVariable(EFI_PLATFORM_LANG_VARIABLE_NAME, gEfiGlobalVariableGuid, NULL, NULL);
//
// On some platforms with missing gEfiUnicodeCollation2ProtocolGuid EFI_PLATFORM_LANG_VARIABLE_NAME is set
// to the value different from "en-...". This is not going to work with our driver UEFI Shell load failures.
@ -324,7 +322,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
//
// if (!PlatformLang || AsciiStrnCmp (PlatformLang, "en-", 3)) {
if (!PlatformLang) {
SetNvramVariable(EFI_PLATFORM_LANG_VARIABLE_NAME, &gEfiGlobalVariableGuid,
SetNvramVariable(EFI_PLATFORM_LANG_VARIABLE_NAME, gEfiGlobalVariableGuid,
Attributes,
6, "en-US");
}
@ -333,63 +331,63 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
}
None = "none";
AddNvramVariable(L"security-mode", &gEfiAppleBootGuid, Attributes, 5, (void*)None);
AddNvramVariable(L"security-mode", gEfiAppleBootGuid, Attributes, 5, (void*)None);
// we should have two UUID: platform and system
// NO! Only Platform is the best solution
if (!gSettings.ShouldInjectSystemID()) {
if (gSettings.Smbios.SmUUID.notEmpty()) {
SetNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
if (gSettings.Smbios.SmUUID.notNull()) {
SetNvramVariable(L"platform-uuid", gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
} else {
AddNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
AddNvramVariable(L"platform-uuid", gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
}
}
// Download-Fritz: Do not mess with BacklightLevel; it's OS X's business
if (gMobile) {
if (gSettings.SystemParameters.BacklightLevelConfig) {
SetNvramVariable(L"backlight-level", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.SystemParameters.BacklightLevel), &gSettings.SystemParameters.BacklightLevel);
SetNvramVariable(L"backlight-level", gEfiAppleBootGuid, Attributes, sizeof(gSettings.SystemParameters.BacklightLevel), &gSettings.SystemParameters.BacklightLevel);
} else {
AddNvramVariable(L"backlight-level", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.SystemParameters.BacklightLevel), &gSettings.SystemParameters.BacklightLevel);
AddNvramVariable(L"backlight-level", gEfiAppleBootGuid, Attributes, sizeof(gSettings.SystemParameters.BacklightLevel), &gSettings.SystemParameters.BacklightLevel);
}
}
if (gSettings.BootGraphics.DefaultBackgroundColor == 0x80000000) {
DeleteNvramVariable(L"DefaultBackgroundColor", &gEfiAppleNvramGuid);
DeleteNvramVariable(L"DefaultBackgroundColor", gEfiAppleNvramGuid);
} else {
UINT16 ActualDensity = 0xE1;
UINT16 DensityThreshold = 0x96;
UINT64 ConfigStatus = 0;
Color = gSettings.BootGraphics.DefaultBackgroundColor;
DBG("set DefaultBackgroundColor=0x%x\n", Color);
SetNvramVariable(L"DefaultBackgroundColor", &gEfiAppleNvramGuid, Attributes, 4, &Color);
SetNvramVariable(L"DefaultBackgroundColor", gEfiAppleNvramGuid, Attributes, 4, &Color);
// add some UI variables
SetNvramVariable(L"ActualDensity", &gEfiAppleBootGuid, Attributes, 2, &ActualDensity);
SetNvramVariable(L"DensityThreshold", &gEfiAppleBootGuid, Attributes, 2, &DensityThreshold);
SetNvramVariable(L"gfx-saved-config-restore-status", &gEfiAppleNvramGuid, Attributes, 8, &ConfigStatus);
SetNvramVariable(L"ActualDensity", gEfiAppleBootGuid, Attributes, 2, &ActualDensity);
SetNvramVariable(L"DensityThreshold", gEfiAppleBootGuid, Attributes, 2, &DensityThreshold);
SetNvramVariable(L"gfx-saved-config-restore-status", gEfiAppleNvramGuid, Attributes, 8, &ConfigStatus);
}
if (gSettings.BootGraphics.UIScale == 0x80000000) {
DeleteNvramVariable(L"UIScale", &gEfiAppleNvramGuid);
DeleteNvramVariable(L"UIScale", gEfiAppleNvramGuid);
} else {
SetNvramVariable(L"UIScale", &gEfiAppleNvramGuid, Attributes, 1, &gSettings.BootGraphics.UIScale);
SetNvramVariable(L"UIScale", gEfiAppleNvramGuid, Attributes, 1, &gSettings.BootGraphics.UIScale);
}
if (gSettings.BootGraphics.EFILoginHiDPI == 0x80000000) {
DeleteNvramVariable(L"EFILoginHiDPI", &gEfiAppleBootGuid);
DeleteNvramVariable(L"EFILoginHiDPI", gEfiAppleBootGuid);
} else {
SetNvramVariable(L"EFILoginHiDPI", &gEfiAppleBootGuid, Attributes, 4, &gSettings.BootGraphics.EFILoginHiDPI);
SetNvramVariable(L"EFILoginHiDPI", gEfiAppleBootGuid, Attributes, 4, &gSettings.BootGraphics.EFILoginHiDPI);
}
// ->GetVariable(flagstate, gEfiAppleBootGuid, 0/0, 20, 10FE110) = Not Found
if (GlobalConfig.flagstate[3] == 0x80) {
DeleteNvramVariable(L"flagstate", &gEfiAppleBootGuid);
DeleteNvramVariable(L"flagstate", gEfiAppleBootGuid);
} else {
SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &GlobalConfig.flagstate);
SetNvramVariable(L"flagstate", gEfiAppleBootGuid, Attributes, 32, &GlobalConfig.flagstate);
}
if (gSettings.RtVariables.CsrActiveConfig != 0xFFFF) {
SetNvramVariable(L"csr-active-config", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.RtVariables.CsrActiveConfig), &gSettings.RtVariables.CsrActiveConfig);
SetNvramVariable(L"csr-active-config", gEfiAppleBootGuid, Attributes, sizeof(gSettings.RtVariables.CsrActiveConfig), &gSettings.RtVariables.CsrActiveConfig);
}
if (gSettings.RtVariables.HWTarget.isEmpty()) {
@ -397,9 +395,9 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
}
if (gSettings.RtVariables.HWTarget.notEmpty() && (Entry->LoaderType != OSTYPE_OSX_INSTALLER) ) {
SetNvramXString8(L"BridgeOSHardwareModel", &gEfiAppleNvramGuid, Attributes, gSettings.RtVariables.HWTarget);
SetNvramXString8(L"BridgeOSHardwareModel", gEfiAppleNvramGuid, Attributes, gSettings.RtVariables.HWTarget);
} else {
DeleteNvramVariable(L"BridgeOSHardwareModel", &gEfiAppleNvramGuid);
DeleteNvramVariable(L"BridgeOSHardwareModel", gEfiAppleNvramGuid);
}
/*
@ -408,19 +406,19 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
}
*/
if ( gSettings.RtVariables.BooterCfgStr.notEmpty() ) {
SetNvramXString8(L"bootercfg", &gEfiAppleBootGuid, Attributes, gSettings.RtVariables.BooterCfgStr);
SetNvramXString8(L"bootercfg", gEfiAppleBootGuid, Attributes, gSettings.RtVariables.BooterCfgStr);
} else {
DeleteNvramVariable(L"bootercfg", &gEfiAppleBootGuid);
DeleteNvramVariable(L"bootercfg", gEfiAppleBootGuid);
}
if (gSettings.SystemParameters.NvidiaWeb) {
NvidiaWebValue = "1";
SetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, Attributes, 2, (void*)NvidiaWebValue);
SetNvramVariable(L"nvda_drv", gEfiAppleBootGuid, Attributes, 2, (void*)NvidiaWebValue);
} else {
DeleteNvramVariable(L"nvda_drv", &gEfiAppleBootGuid);
DeleteNvramVariable(L"nvda_drv", gEfiAppleBootGuid);
}
if (!gDriversFlags.AptioMemFixLoaded) {
DeleteNvramVariable(L"recovery-boot-mode", &gEfiAppleBootGuid);
DeleteNvramVariable(L"recovery-boot-mode", gEfiAppleBootGuid);
}
// Check for AptioFix2Drv loaded to store efi-boot-device for special boot
@ -430,7 +428,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
REFIT_VOLUME *Volume = Entry->Volume;
const EFI_DEVICE_PATH_PROTOCOL *DevicePath = Volume->DevicePath;
// We need to remember from which device we boot, to make silence boot while special recovery boot
Status = gRT->SetVariable(L"specialbootdevice", &gEfiAppleBootGuid,
Status = gRT->SetVariable(L"specialbootdevice", gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
GetDevicePathSize(DevicePath), (UINT8 *)DevicePath);
if (EFI_ERROR(Status)) {
@ -441,18 +439,18 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// Sherlocks: to fix "OSInstall.mpkg appears to be missing or damaged" in 10.13+, we should remove this variables.
if (Entry->LoaderType == OSTYPE_OSX_INSTALLER) {
if (Entry->macOSVersion.isEmpty() || Entry->macOSVersion > MacOsVersion("10.12"_XS8)) {
DeleteNvramVariable(L"install-product-url", &gEfiAppleBootGuid);
DeleteNvramVariable(L"previous-system-uuid", &gEfiAppleBootGuid);
DeleteNvramVariable(L"install-product-url", gEfiAppleBootGuid);
DeleteNvramVariable(L"previous-system-uuid", gEfiAppleBootGuid);
}
}
//one more variable can be set for 10.15.4
//sudo nvram wake-failure=%00%00%00%00%00
LangLen = 0;
AddNvramVariable(L"wake-failure", &gEfiAppleBootGuid, Attributes, 5, &LangLen);
AddNvramVariable(L"wake-failure", gEfiAppleBootGuid, Attributes, 5, &LangLen);
//clear OC present
DeleteNvramVariable(L"opencore-version", &gEfiAppleBootGuid);
DeleteNvramVariable(L"opencore-version", gEfiAppleBootGuid);
return EFI_SUCCESS;
}
@ -523,7 +521,7 @@ SetupDataForOSX(XBool Hibernate)
getRPlt(GlobalConfig.CurrentModel, gCPUStructure.Model, gSettings.Smbios.Mobile, RPlt);
// Locate DataHub Protocol
Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub);
Status = gBS->LocateProtocol(gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub);
if (!EFI_ERROR(Status)) {
XStringW ProductName;
ProductName.takeValueFrom(gSettings.Smbios.ProductName);
@ -531,48 +529,47 @@ SetupDataForOSX(XBool Hibernate)
XStringW SerialNumber;
SerialNumber.takeValueFrom(gSettings.Smbios.SerialNr);
LogDataHub(&gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64));
LogDataHub(gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64));
if (gCPUStructure.ARTFrequency && gSettings.CPU.UseARTFreq) {
ARTFrequency = gCPUStructure.ARTFrequency;
LogDataHub(&gEfiProcessorSubClassGuid, L"ARTFrequency", &ARTFrequency, sizeof(UINT64));
LogDataHub(gEfiProcessorSubClassGuid, L"ARTFrequency", &ARTFrequency, sizeof(UINT64));
}
TscFrequency = 0; //gCPUStructure.TSCFrequency;
LogDataHub(&gEfiProcessorSubClassGuid, L"InitialTSC", &TscFrequency, sizeof(UINT64));
LogDataHub(&gEfiProcessorSubClassGuid, L"CPUFrequency", &CpuSpeed, sizeof(UINT64));
LogDataHub(gEfiProcessorSubClassGuid, L"InitialTSC", &TscFrequency, sizeof(UINT64));
LogDataHub(gEfiProcessorSubClassGuid, L"CPUFrequency", &CpuSpeed, sizeof(UINT64));
//gSettings.Smbios.BoardNumber
LogDataHubXString8(&gEfiMiscSubClassGuid, L"board-id", gSettings.Smbios.BoardNumber);
LogDataHubXString8(gEfiMiscSubClassGuid, L"board-id", gSettings.Smbios.BoardNumber);
TscFrequency++;
LogDataHub(&gEfiProcessorSubClassGuid, L"board-rev", &TscFrequency, 1);
LogDataHub(gEfiProcessorSubClassGuid, L"board-rev", &TscFrequency, 1);
DevPathSupportedVal = 1;
LogDataHub(&gEfiMiscSubClassGuid, L"DevicePathsSupported", &DevPathSupportedVal, sizeof(UINT32));
LogDataHubXStringW(&gEfiMiscSubClassGuid, L"Model", ProductName);
LogDataHubXStringW(&gEfiMiscSubClassGuid, L"SystemSerialNumber", SerialNumber);
LogDataHub(gEfiMiscSubClassGuid, L"DevicePathsSupported", &DevPathSupportedVal, sizeof(UINT32));
LogDataHubXStringW(gEfiMiscSubClassGuid, L"Model", ProductName);
LogDataHubXStringW(gEfiMiscSubClassGuid, L"SystemSerialNumber", SerialNumber);
if (gSettings.ShouldInjectSystemID()) {
EFI_GUIDClass uuid;
gSettings.getUUID(&uuid);
LogDataHub(&gEfiMiscSubClassGuid, L"system-id", &uuid, sizeof(uuid));
EFI_GUID uuid = gSettings.getUUID();
LogDataHub(gEfiMiscSubClassGuid, L"system-id", &uuid, sizeof(uuid));
}
LogDataHub(&gEfiProcessorSubClassGuid, L"clovergui-revision", &Revision, sizeof(UINT32));
LogDataHub(gEfiProcessorSubClassGuid, L"clovergui-revision", &Revision, sizeof(UINT32));
// collect info about real hardware
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMVendor", GlobalConfig.OEMVendorFromSmbios);
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMProduct", GlobalConfig.OEMProductFromSmbios);
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMBoard", GlobalConfig.OEMBoardFromSmbios);
LogDataHubXString8(gEfiMiscSubClassGuid, L"OEMVendor", GlobalConfig.OEMVendorFromSmbios);
LogDataHubXString8(gEfiMiscSubClassGuid, L"OEMProduct", GlobalConfig.OEMProductFromSmbios);
LogDataHubXString8(gEfiMiscSubClassGuid, L"OEMBoard", GlobalConfig.OEMBoardFromSmbios);
// SMC helper
if (!isRevLess) {
LogDataHub(&gEfiMiscSubClassGuid, L"RBr", &RBr, 8);
LogDataHub(&gEfiMiscSubClassGuid, L"EPCI", &ApplePlatformDataArray[GlobalConfig.CurrentModel].smcConfig, 4);
LogDataHub(&gEfiMiscSubClassGuid, L"REV", &ApplePlatformDataArray[GlobalConfig.CurrentModel].smcRevision, 6);
LogDataHub(gEfiMiscSubClassGuid, L"RBr", &RBr, 8);
LogDataHub(gEfiMiscSubClassGuid, L"EPCI", &ApplePlatformDataArray[GlobalConfig.CurrentModel].smcConfig, 4);
LogDataHub(gEfiMiscSubClassGuid, L"REV", &ApplePlatformDataArray[GlobalConfig.CurrentModel].smcRevision, 6);
}
LogDataHub(&gEfiMiscSubClassGuid, L"RPlt", RPlt, 8);
LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Smbios.Mobile, 1);
LogDataHub(gEfiMiscSubClassGuid, L"RPlt", RPlt, 8);
LogDataHub(gEfiMiscSubClassGuid, L"BEMB", &gSettings.Smbios.Mobile, 1);
// all current settings
// XBuffer<UINT8> xb = gSettings.serialize();

View File

@ -19,7 +19,7 @@ SetVariablesForOSX (LOADER_ENTRY *Entry);
EFI_STATUS
EFIAPI
LogDataHub (
EFI_GUID *TypeGuid,
const EFI_GUID& TypeGuid,
CONST CHAR16 *Name,
const void *Data,
UINT32 DataSize

View File

@ -67,7 +67,7 @@ UINT8* getCurrentEdid (void)
DBG("EdidActive:");
Edid = NULL;
Status = gBS->LocateProtocol (&gEfiEdidActiveProtocolGuid, NULL, (void**)&EdidProtocol);
Status = gBS->LocateProtocol(gEfiEdidActiveProtocolGuid, NULL, (void**)&EdidProtocol);
if (!EFI_ERROR(Status)) {
DBG(" size=%d", EdidProtocol->SizeOfEdid);
if (EdidProtocol->SizeOfEdid > 0) {
@ -112,7 +112,7 @@ EFI_STATUS GetEdidDiscovered(void)
N = gSettings.Graphics.EDID.CustomEDID.size();
DebugDumpEDID("--- Custom EDID Table", N);
} else {
Status = gBS->LocateProtocol (&gEfiEdidDiscoveredProtocolGuid, NULL, (void **)&EdidDiscovered);
Status = gBS->LocateProtocol(gEfiEdidDiscoveredProtocolGuid, NULL, (void **)&EdidDiscovered);
if (!EFI_ERROR(Status)) { //discovered
N = EdidDiscovered->SizeOfEdid;
if (!gSettings.Boot.DebugLog) {

View File

@ -30,7 +30,8 @@
#define CREATE_NEW_BOOT_IMAGE 1
#pragma pack(push, 1)
#pragma pack(push)
#pragma pack(1)
//
// Just the first part of HFS+ volume header from where we can take modification time
@ -393,7 +394,7 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
// find sleep image entry from plist
Status = egLoadFile(Volume->RootDir, PrefName, &PrefBuffer, &PrefBufferLen);
if (EFI_ERROR(Status)) {
XStringW PrefName3 = SWPrintf("\\Library\\Preferences\\com.apple.PowerManagement.%s.plist", gSettings.getUUID().c_str());
XStringW PrefName3 = SWPrintf("\\Library\\Preferences\\com.apple.PowerManagement.%s.plist", gSettings.getUUID().toXString8().c_str());
Status = egLoadFile(Volume->RootDir, PrefName3.wc_str(), &PrefBuffer, &PrefBufferLen);
if (EFI_ERROR(Status)) {
Status = egLoadFile(Volume->RootDir, PrefName2, &PrefBuffer, &PrefBufferLen);
@ -715,15 +716,12 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
EFI_STATUS Status = EFI_SUCCESS;
UINTN Size = 0;
UINT8 *Data = NULL;
// REFIT_VOLUME *ThisVolume = Entry->Volume;
REFIT_VOLUME *Volume = Entry->Volume;
EFI_GUID *BootGUID = NULL;
EFI_GUID BootGUID;
XBool ret = false;
UINT8 *Value = NULL;
// UINTN VolumeIndex;
EFI_GUID *VolumeUUID;
// CHAR16 *VolumeUUIDStr = NULL;
EFI_GUID VolumeUUID;
if (!Volume) {
return false;
@ -765,7 +763,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
DBG("cant find volume with UUID=%ls\n", GuidLEToStr(&ThisVolume->RootUUID));
}
DBG(" got RootUUID %s\n", strguid(&ThisVolume->RootUUID));
DBG(" got RootUUID %s\n", ThisVolume->RootUUID.toXString8().c_str());
VolumeUUIDStr = GuidLEToStr(&ThisVolume->RootUUID);
DBG(" Search for Volume with UUID: %ls\n", VolumeUUIDStr);
@ -793,9 +791,9 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
DBG("got str=%ls\n", Ptr);
Status = StrToGuidBE (Ptr, &TmpGuid);
if (EFI_ERROR(Status)) {
DBG(" cant convert Str %ls to GUID\n", Ptr);
DBG(" cant convert Str %ls to EFI_GUID\n", Ptr);
} else {
XStringW TmpStr = SWPrintf("%ls", strguid(&TmpGuid));
XStringW TmpStr = SWPrintf("%ls", TmpGuid.toXString8().c_str());
DBG("got the guid %ls\n", TmpStr.wc_str());
CopyMem((void*)Ptr, TmpStr, StrSize(TmpStr));
DBG("fter CopyMem: %ls\n", Ptr);
@ -832,7 +830,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
if (!gFirmwareClover &&
(!gDriversFlags.EmuVariableLoaded || gSettings.Boot.HibernationFixup)) {
DBG(" UEFI with NVRAM? ");
Status = GetVariable2 (L"Boot0082", &gEfiGlobalVariableGuid, (void**)&Data, &Size);
Status = GetVariable2 (L"Boot0082", gEfiGlobalVariableGuid, (void**)&Data, &Size);
if (EFI_ERROR(Status)) {
DBG(" no, Boot0082 not exists\n");
ret = false;
@ -843,28 +841,29 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
//Cut Data pointer by 0x08 up to DevicePath
// Data += 0x08;
// Size -= 0x08;
//We get starting offset of media device path, and then jumping 24 bytes to GUID start
//We get starting offset of media device path, and then jumping 24 bytes to EFI_GUID start
// BootGUID = (EFI_GUID*)(Data + NodeParser(Data, Size, 0x04) + 0x18);
/* APFS Hibernation support*/
//Check that current volume is APFS
if ((VolumeUUID = APFSPartitionUUIDExtract(Volume->DevicePath)) != NULL) {
VolumeUUID = APFSPartitionUUIDExtract(Volume->DevicePath);
if ( VolumeUUID.notNull() ) {
//BootGUID = (EFI_GUID*)(Data + Size - 0x14);
BootGUID = (EFI_GUID*)ScanGuid(Data, Size, VolumeUUID);
//DBG(" APFS Boot0082 points to UUID:%s\n", strguid(BootGUID));
BootGUID = *(EFI_GUID*)ScanGuid(Data, Size, &VolumeUUID);
//DBG(" APFS Boot0082 points to UUID:%s\n", BootGUID.toXString8().c_str());
} else {
//BootGUID = (EFI_GUID*)(Data + Size - 0x16);
VolumeUUID = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
if (VolumeUUID != NULL) {
BootGUID = (EFI_GUID*)ScanGuid(Data, Size, VolumeUUID);
//DBG(" Boot0082 points to UUID:%s\n", strguid(BootGUID));
if ( VolumeUUID.notNull() ) {
BootGUID = *(EFI_GUID*)ScanGuid(Data, Size, &VolumeUUID);
//DBG(" Boot0082 points to UUID:%s\n", BootGUID.toXString8().c_str());
}
}
//DBG(" Volume has PartUUID=%s\n", strguid(VolumeUUID));
if (BootGUID != NULL && VolumeUUID != NULL && !CompareGuid(BootGUID, VolumeUUID)) {
//DBG(" Volume has PartUUID=%s\n", VolumeUUID.toXString8().c_str());
if (BootGUID.notNull() && VolumeUUID.notNull() && BootGUID != VolumeUUID ) {
ret = false;
} else {
DBG(" Boot0082 points to Volume with UUID:%s\n", strguid(BootGUID));
DBG(" Boot0082 points to Volume with UUID:%s\n", BootGUID.toXString8().c_str());
//3. Checks for boot-image exists
if (gSettings.Boot.StrictHibernate) {
@ -883,7 +882,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
4:609 0:000 Boot0082 points to Volume with UUID:BA92975E-E2FB-48E6-95CC-8138B286F646
4:609 0:000 boot-image before: PciRoot(0x0)\Pci(0x1F,0x2)\Sata(0x5,0x0,0x0)\25593c7000:A82E84C6-9DD6-49D6-960A-0F4C2FE4851C
*/
Status = GetVariable2 (L"boot-image", &gEfiAppleBootGuid, (void**)&Value, &Size);
Status = GetVariable2 (L"boot-image", gEfiAppleBootGuid, (void**)&Value, &Size);
if (EFI_ERROR(Status)) {
// leave it as is
DBG(" boot-image not found while we want StrictHibernate\n");
@ -911,11 +910,12 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
// DBG("got str=%ls\n", Ptr);
XString8 xs8;
xs8.takeValueFrom(Ptr);
Status = StrToGuidBE(xs8, &TmpGuid);
// Status = StrToGuidBE(xs8, &TmpGuid);
TmpGuid.takeValueFromBE(xs8);
if (EFI_ERROR(Status)) {
DBG(" cant convert Str %ls to GUID\n", Ptr);
DBG(" cant convert Str %ls to EFI_GUID\n", Ptr);
} else {
XStringW TmpStr = GuidLEToXStringW(TmpGuid);
XStringW TmpStr = TmpGuid.toXStringW();
//DBG("got the guid %ls\n", TmpStr);
memcpy((void*)Ptr, TmpStr.wc_str(), TmpStr.sizeInBytes());
}
@ -937,7 +937,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
DBG(" boot-image corrected: %ls\n", FileDevicePathToXStringW((EFI_DEVICE_PATH_PROTOCOL*)Value).wc_str());
PrintBytes(Value, Size);
Status = gRT->SetVariable(L"boot-image", &gEfiAppleBootGuid,
Status = gRT->SetVariable(L"boot-image", gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
Size , Value);
if (EFI_ERROR(Status)) {
@ -1015,7 +1015,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
// VarData[25] = 0xFF;
// DBG("boot-image corrected: %ls\n", FileDevicePathToStr(BootImageDevPath));
Status = gRT->SetVariable(L"boot-image", &gEfiAppleBootGuid,
Status = gRT->SetVariable(L"boot-image", gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
Size , BootImageDevPath);
if (EFI_ERROR(Status)) {
@ -1033,7 +1033,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
//
// If legacy boot-switch-vars exists (NVRAM working), then use it.
//
Status = GetVariable2 (L"boot-switch-vars", &gEfiAppleBootGuid, &Value, &Size);
Status = GetVariable2 (L"boot-switch-vars", gEfiAppleBootGuid, &Value, &Size);
if (!EFI_ERROR(Status)) {
//
// Leave it as is.
@ -1061,7 +1061,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
// If RTC variables is still written to NVRAM (and RTC is broken).
// Prior to 10.13.6.
//
Status = GetVariable2 (L"IOHibernateRTCVariables", &gEfiAppleBootGuid, &Value, &Size);
Status = GetVariable2(L"IOHibernateRTCVariables", gEfiAppleBootGuid, &Value, &Size);
DBG("get IOHR variable status=%s, size=%llu, RTC info=%d\n", efiStrError(Status), Size, (bool)HasHibernateInfoInRTC);
if (!HasHibernateInfo && !EFI_ERROR(Status) && Size == sizeof (RtcVars)) {
CopyMem(RtcRawVars, Value, sizeof (RtcVars));
@ -1073,7 +1073,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
// Erase RTC variables in NVRAM.
//
if (!EFI_ERROR(Status)) {
Status = gRT->SetVariable (L"IOHibernateRTCVariables", &gEfiAppleBootGuid,
Status = gRT->SetVariable (L"IOHibernateRTCVariables", gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
0, NULL);
ZeroMem (Value, Size);
@ -1084,9 +1084,9 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
// Convert RTC data to boot-key and boot-signature
//
if (HasHibernateInfo) {
gRT->SetVariable (L"boot-image-key", &gEfiAppleBootGuid,
gRT->SetVariable (L"boot-image-key", gEfiAppleBootGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS, sizeof (RtcVars.wiredCryptKey), RtcVars.wiredCryptKey);
gRT->SetVariable (L"boot-signature", &gEfiAppleBootGuid,
gRT->SetVariable (L"boot-signature", gEfiAppleBootGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS, sizeof (RtcVars.booterSignature), RtcVars.booterSignature);
DBG("variables boot-image-key and boot-signature saved\n");
}
@ -1120,13 +1120,13 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
// else (no NVRAM) set boot-switch-vars to dummy one
//
Value = NULL;
Status = GetVariable2 (L"IOHibernateRTCVariables", &gEfiAppleBootGuid, &Value, &Size);
Status = GetVariable2 (L"IOHibernateRTCVariables", gEfiAppleBootGuid, &Value, &Size);
if (!EFI_ERROR(Status)) {
DBG(" IOHibernateRTCVariables found - will be used as boot-switch-vars\n");
//
// Delete IOHibernateRTCVariables.
//
Status = gRT->SetVariable(L"IOHibernateRTCVariables", &gEfiAppleBootGuid,
Status = gRT->SetVariable(L"IOHibernateRTCVariables", gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
0, NULL);
HasIORTCVariables = true;
@ -1154,7 +1154,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
Attributes |= EFI_VARIABLE_NON_VOLATILE;
}
Status = gRT->SetVariable(L"boot-switch-vars", &gEfiAppleBootGuid,
Status = gRT->SetVariable(L"boot-switch-vars", gEfiAppleBootGuid,
Attributes,
Size, Value);

View File

@ -36,9 +36,6 @@
#endif
extern EFI_GUID gEfiDevicePathPropertyDatabaseProtocolGuid;
extern EFI_GUID gAppleFramebufferInfoProtocolGuid;
UINT32 mPropSize = 0;
UINT8* mProperties = NULL;
CHAR8* gDeviceProperties = NULL;
@ -241,7 +238,6 @@ EFI_INTERFACE_SCREEN_INFO mScreenInfo=
// OS_INFO_VENDOR_NAME
#define OS_INFO_VENDOR_NAME "Apple Inc."
extern EFI_GUID gAppleOSLoadedNamedEventGuid;
// OSInfoOSNameImpl
void
EFIAPI
@ -254,7 +250,7 @@ OSInfoOSNameImpl (
// as it will be set by boot.efi
BootOSName = (__typeof__(BootOSName))AllocateCopyPool(AsciiStrLen(OSName) + 1, (void*)OSName);
DBG("OSInfo:OSName called. OSName=%s\n", OSName);
EfiNamedEventSignal (&gAppleOSLoadedNamedEventGuid);
EfiNamedEventSignal(gAppleOSLoadedNamedEventGuid);
}
// OSInfoOSVendorImpl

View File

@ -382,7 +382,7 @@ LegacyBiosFarCall86 (
#endif
// Save current rate of DXE Timer and disable DXE timer
Status = gBS->LocateProtocol (&gEfiTimerArchProtocolGuid, NULL, (void **) &Timer);
Status = gBS->LocateProtocol(gEfiTimerArchProtocolGuid, NULL, (void **) &Timer);
if (!EFI_ERROR(Status)) {
Timer->GetTimerPeriod (Timer, &TimerPeriod);
Timer->SetTimerPeriod (Timer, 0);

View File

@ -37,38 +37,38 @@ Copyright (c) 2006 JLA
//CONST MBR_PARTITION_INFO tMBR = {0x80, {0xFE, 0xFF, 0xFF}, 0x06, {0xFE, 0xFF, 0xFF}, 0, 0};
CONST MBR_PARTITION_INFO tMBR = {0x80, {0xFE, 0xFF, 0xFF}, 0xEE, {0xFE, 0xFF, 0xFF}, 0, 0};
typedef struct {
UINT8 loader[0x1BE];
MBR_PARTITION_INFO p[4];
UINT16 signature;
} MBR;
//typedef struct {
// UINT8 loader[0x1BE];
// MBR_PARTITION_INFO p[4];
// UINT16 signature;
//} MBR;
typedef struct {
UINT64 signature;
UINT32 revision;
UINT32 headerSize;
UINT32 headerCRC;
UINT32 reserved;
UINT64 myLBA;
UINT64 alternateLBA;
UINT64 firstUsableLBA;
UINT64 lastUsableLBA;
EFI_GUID diskGUID;
UINT64 partitionEntryLBA;
UINT32 numberOfPartitionEntries;
UINT32 sizeOfPartitionEntry;
UINT32 partitionEntryArrayCRC32;
UINT8 filler[4]; //alignment
} GPT_HEADER;
typedef struct {
EFI_GUID partitionType;
EFI_GUID partitionGuid;
UINT64 startingLBA;
UINT64 endingLBA;
UINT64 attributes;
CHAR16 partitionName[72 / 2];
} GPT_ENTRY;
//typedef struct {
// UINT64 signature;
// UINT32 revision;
// UINT32 headerSize;
// UINT32 headerCRC;
// UINT32 reserved;
// UINT64 myLBA;
// UINT64 alternateLBA;
// UINT64 firstUsableLBA;
// UINT64 lastUsableLBA;
// EFI_GUID diskGUID;
// UINT64 partitionEntryLBA;
// UINT32 numberOfPartitionEntries;
// UINT32 sizeOfPartitionEntry;
// UINT32 partitionEntryArrayCRC32;
// UINT8 filler[4]; //alignment
//} GPT_HEADER;
//
//typedef struct {
// EFI_GUID partitionType;
// EFI_GUID partitionGuid;
// UINT64 startingLBA;
// UINT64 endingLBA;
// UINT64 attributes;
// CHAR16 partitionName[72 / 2];
//} GPT_ENTRY;
typedef struct Address_t {
UINT32 offset;
@ -86,7 +86,7 @@ typedef struct {
UINT64 lba; // LBA of starting sector
} BIOS_DISK_ADDRESS_PACKET;
//located at 0x7F00
//located at 0x7F00
CONST UINT8 VideoTest[] = {
0xb8, 0x02, 0x00, //mov ax,2
0xcd, 0x10, //int 0x10
@ -422,12 +422,12 @@ EFI_STATUS bootElTorito(REFIT_VOLUME* volume)
// Boot it
// dbgStart(bootLoadAddress, enableDebugger);
Status = gBS->LocateProtocol(&gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
Status = gBS->LocateProtocol(gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
if (EFI_ERROR(Status)) {
return Status;
}
/* mCpu = NULL;
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (void **) &mCpu);
Status = gBS->LocateProtocol(gEfiCpuArchProtocolGuid, NULL, (void **) &mCpu);
if (EFI_ERROR(Status)) {
return Status;
}
@ -476,12 +476,12 @@ EFI_STATUS bootMBR(REFIT_VOLUME* volume)
SetMem(&Regs, sizeof (Regs), 0);
addrEnablePaging(0);
Status = gBS->LocateProtocol(&gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
Status = gBS->LocateProtocol(gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
if (EFI_ERROR(Status)) {
return Status;
}
mCpu = NULL;
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (void **) &mCpu);
Status = gBS->LocateProtocol(gEfiCpuArchProtocolGuid, NULL, (void **) &mCpu);
if (EFI_ERROR(Status)) {
return Status;
}
@ -643,7 +643,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
return Status;
}
Status = gBS->LocateProtocol(&gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
Status = gBS->LocateProtocol(gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
if (EFI_ERROR(Status)) {
return Status;
}
@ -779,7 +779,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, XBool SataReset)
//
// get EfiLegacy8259Protocol - mandatory
//
Status = gBS->LocateProtocol(&gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
Status = gBS->LocateProtocol(gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
DBG("EfiLegacy8259ProtocolGuid: %s\n", efiStrError(Status));
if (EFI_ERROR(Status)) {
return Status;
@ -792,7 +792,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, XBool SataReset)
//
// get EfiLegacyBiosProtocol - optional
//
Status = gBS->LocateProtocol(&gEfiLegacyBiosProtocolGuid, NULL, (void**)&LegacyBios);
Status = gBS->LocateProtocol(gEfiLegacyBiosProtocolGuid, NULL, (void**)&LegacyBios);
DBG("EfiLegacyBiosProtocolGuid: %s\n", efiStrError(Status));
if (!EFI_ERROR(Status)) {
//
@ -1061,7 +1061,7 @@ EFI_STATUS bootLegacyBiosDefault(IN UINT16 LegacyBiosDefaultEntry)
//
// get EfiLegacyBiosProtocol - optional
//
Status = gBS->LocateProtocol(&gEfiLegacyBiosProtocolGuid, NULL, (void**)&LegacyBios);
Status = gBS->LocateProtocol(gEfiLegacyBiosProtocolGuid, NULL, (void**)&LegacyBios);
DBG("EfiLegacyBiosProtocolGuid: %s\n", efiStrError(Status));
if (EFI_ERROR(Status)) {
return Status;
@ -1113,7 +1113,7 @@ void DumpBiosMemoryMap()
SetMem(&Regs, sizeof (Regs), 0);
addrEnablePaging(0);
Status = gBS->LocateProtocol(&gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
Status = gBS->LocateProtocol(gEfiLegacy8259ProtocolGuid, NULL, (void**)&gLegacy8259);
if (EFI_ERROR(Status)) {
return;
}

View File

@ -45,30 +45,18 @@ EFI_DEVICE_PATH *gEfiBootVolume;
// contains file path from gEfiBootDeviceData or gBootCampHD (if exists)
CHAR16 *gEfiBootLoaderPath;
// contains GPT GUID from gEfiBootDeviceData or gBootCampHD (if exists)
EFI_GUID *gEfiBootDeviceGuid;
// contains GPT EFI_GUID from gEfiBootDeviceData or gBootCampHD (if exists)
EFI_GUID gEfiBootDeviceGuid;
// Lilu / OpenCore
//EFI_GUID gOcVendorVariableGuid = { 0x4D1FDA02, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x01, 0x02 } };
//EFI_GUID gOcReadOnlyVariableGuid = { 0xE09B9297, 0x7928, 0x4440, { 0x9A, 0xAB, 0xD1, 0xF8, 0x53, 0x6F, 0xBF, 0x0A } };
//EFI_GUID gOcWriteOnlyVariableGuid = { 0xF0B9AF8F, 0x2222, 0x4840, { 0x8A, 0x37, 0xEC, 0xF7, 0xCC, 0x8C, 0x12, 0xE1 } };
//constexpr const EFI_GUID gOcVendorVariableGuid = { 0x4D1FDA02, 0x38C7, 0x4A6A, { 0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x01, 0x02 } };
//constexpr const EFI_GUID gOcReadOnlyVariableGuid = { 0xE09B9297, 0x7928, 0x4440, { 0x9A, 0xAB, 0xD1, 0xF8, 0x53, 0x6F, 0xBF, 0x0A } };
//constexpr const EFI_GUID gOcWriteOnlyVariableGuid = { 0xF0B9AF8F, 0x2222, 0x4840, { 0x8A, 0x37, 0xEC, 0xF7, 0xCC, 0x8C, 0x12, 0xE1 } };
// Ozmosis
EFI_GUID mOzmosisProprietary1Guid = { 0x1F8E0C02, 0x58A9, 0x4E34, { 0xAE, 0x22, 0x2B, 0x63, 0x74, 0x5F, 0xA1, 0x01 } };
EFI_GUID mOzmosisProprietary2Guid = { 0x9480E8A1, 0x1793, 0x46C9, { 0x91, 0xD8, 0x11, 0x08, 0xDB, 0xA4, 0x73, 0x1C } };
constexpr const EFI_GUID mOzmosisProprietary1Guid = { 0x1F8E0C02, 0x58A9, 0x4E34, { 0xAE, 0x22, 0x2B, 0x63, 0x74, 0x5F, 0xA1, 0x01 } };
constexpr const EFI_GUID mOzmosisProprietary2Guid = { 0x9480E8A1, 0x1793, 0x46C9, { 0x91, 0xD8, 0x11, 0x08, 0xDB, 0xA4, 0x73, 0x1C } };
// BootChime
extern EFI_GUID gBootChimeVendorVariableGuid;
//Apple variables
extern EFI_GUID gAppleCoreStorageVariableGuid;
extern EFI_GUID gAppleTamperResistantBootVariableGuid;
extern EFI_GUID gAppleWirelessNetworkVariableGuid;
extern EFI_GUID gApplePersonalizationVariableGuid;
extern EFI_GUID gAppleNetbootVariableGuid;
extern EFI_GUID gAppleSecureBootVariableGuid;
extern EFI_GUID gAppleTamperResistantBootSecureVariableGuid;
extern EFI_GUID gAppleTamperResistantBootEfiUserVariableGuid;
APPLE_SMC_IO_PROTOCOL *gAppleSmc = NULL;
@ -98,7 +86,7 @@ GetEfiTimeInMs (
/** Reads and returns value of NVRAM variable. */
void *GetNvramVariable(
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
OUT UINTN *DataSize OPTIONAL)
{
@ -140,7 +128,7 @@ void *GetNvramVariable(
/** Reads and returns value of NVRAM variable. */
XString8 GetNvramVariableAsXString8(
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
OUT UINT32 *Attributes OPTIONAL)
{
EFI_STATUS Status;
@ -175,7 +163,7 @@ XString8 GetNvramVariableAsXString8(
EFI_STATUS
SetNvramVariable (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST void *Data
@ -186,7 +174,7 @@ SetNvramVariable (
UINTN OldDataSize = 0;
UINT32 OldAttributes = 0;
DBG("SetNvramVariable (%ls, %s, 0x%X, %lld):", VariableName, strguid(VendorGuid), Attributes, DataSize);
DBG("SetNvramVariable (%ls, %s, 0x%X, %lld):", VariableName, VendorGuid.toXString8().c_str(), Attributes, DataSize);
OldData = (__typeof__(OldData))GetNvramVariable(VariableName, VendorGuid, &OldAttributes, &OldDataSize);
if (OldData != NULL) {
// var already exists - check if it equal to new value
@ -220,7 +208,7 @@ SetNvramVariable (
EFI_STATUS
SetNvramXString8 (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
const XString8& s
)
@ -232,7 +220,7 @@ SetNvramXString8 (
EFI_STATUS
AddNvramVariable (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN const void *Data
@ -241,7 +229,7 @@ AddNvramVariable (
EFI_STATUS Status;
void *OldData;
DBG("AddNvramVariable (%ls, %s, 0x%X, %lld):", VariableName, strguid(VendorGuid), Attributes, DataSize);
DBG("AddNvramVariable (%ls, %s, 0x%X, %lld):", VariableName, VendorGuid.toXString8().c_str(), Attributes, DataSize);
OldData = (__typeof__(OldData))GetNvramVariable(VariableName, VendorGuid, NULL, NULL);
if (OldData == NULL) {
// set new value
@ -258,7 +246,7 @@ AddNvramVariable (
EFI_STATUS
AddNvramXString8(
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
const XString8& s
)
@ -269,14 +257,14 @@ AddNvramXString8(
/** Deletes NVRAM variable. */
EFI_STATUS DeleteNvramVariable (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid
const EFI_GUID& VendorGuid
)
{
EFI_STATUS Status;
// Delete: attributes and data size = 0
Status = gRT->SetVariable (VariableName, VendorGuid, 0, 0, NULL);
DBG("DeleteNvramVariable (%ls, %s):\n", VariableName, strguid(VendorGuid));
DBG("DeleteNvramVariable (%ls, %s):\n", VariableName, VendorGuid.toXString8().c_str());
return Status;
}
@ -284,20 +272,20 @@ EFI_STATUS DeleteNvramVariable (
XBool
IsDeletableVariable (
IN CHAR16 *Name,
IN EFI_GUID *Guid
const EFI_GUID& Guid
)
{
// Apple GUIDs
if (CompareGuid(Guid, &gEfiAppleVendorGuid) ||
CompareGuid(Guid, &gEfiAppleBootGuid) ||
CompareGuid(Guid, &gAppleCoreStorageVariableGuid) ||
CompareGuid(Guid, &gAppleTamperResistantBootVariableGuid) ||
CompareGuid(Guid, &gAppleWirelessNetworkVariableGuid) ||
CompareGuid(Guid, &gApplePersonalizationVariableGuid) ||
CompareGuid(Guid, &gAppleNetbootVariableGuid) ||
CompareGuid(Guid, &gAppleSecureBootVariableGuid) ||
CompareGuid(Guid, &gAppleTamperResistantBootSecureVariableGuid) ||
CompareGuid(Guid, &gAppleTamperResistantBootEfiUserVariableGuid)) {
if ( Guid == gEfiAppleVendorGuid ||
Guid == gEfiAppleBootGuid ||
Guid == gAppleCoreStorageVariableGuid ||
Guid == gAppleTamperResistantBootVariableGuid ||
Guid == gAppleWirelessNetworkVariableGuid ||
Guid == gApplePersonalizationVariableGuid ||
Guid == gAppleNetbootVariableGuid ||
Guid == gAppleSecureBootVariableGuid ||
Guid == gAppleTamperResistantBootSecureVariableGuid ||
Guid == gAppleTamperResistantBootEfiUserVariableGuid ) {
return true;
// Disable Clover Boot Options from being deleted
@ -311,18 +299,18 @@ IsDeletableVariable (
}*/
// Lilu / OpenCore extensions
} else if (CompareGuid (Guid, &gOcVendorVariableGuid) ||
CompareGuid(Guid, &gOcReadOnlyVariableGuid) ||
CompareGuid(Guid, &gOcWriteOnlyVariableGuid)) {
} else if ( Guid == gOcVendorVariableGuid ||
Guid == gOcReadOnlyVariableGuid ||
Guid == gOcWriteOnlyVariableGuid ) {
return true;
// Ozmozis extensions
} else if (CompareGuid (Guid, &mOzmosisProprietary1Guid) ||
CompareGuid (Guid, &mOzmosisProprietary2Guid)) {
} else if ( Guid == mOzmosisProprietary1Guid ||
Guid == mOzmosisProprietary2Guid ) {
return true;
// BootChime
} else if (CompareGuid (Guid, &gBootChimeVendorVariableGuid)) {
} else if ( Guid == gBootChimeVendorVariableGuid ) {
return true;
}
@ -340,8 +328,6 @@ DumpNvram()
DbgHeader("DumpNvram");
ZeroMem (&Guid, sizeof(Guid));
do {
Size = Name.sizeInBytes();
Status = gRT->GetNextVariableName(&Size, Name.dataSized(Size+1), &Guid);
@ -350,8 +336,8 @@ DumpNvram()
}
if ( !EFI_ERROR(Status) ) {
XString8 s = GetNvramVariableAsXString8(Name.wc_str(), &Guid, NULL);
DBG("NVRAM : %s,%ls = '%s'\n", GuidLEToXString8(Guid).c_str(), Name.wc_str(), s.c_str());
XString8 s = GetNvramVariableAsXString8(Name.wc_str(), Guid, NULL);
DBG("NVRAM : %s,%ls = '%s'\n", Guid.toXString8().c_str(), Name.wc_str(), s.c_str());
}else if ( Status != EFI_NOT_FOUND ) {
DBG("GetNextVariableName returns '%s'\n", efiStrError(Status));
break;
@ -386,7 +372,7 @@ ResetNativeNvram ()
while (true) {
if (Restart) {
ZeroMem (&Guid, sizeof(Guid));
Guid.setNull();
ZeroMem (Name, sizeof(Name));
Restart = false;
}
@ -408,9 +394,9 @@ ResetNativeNvram ()
}
if (!EFI_ERROR(Status)) {
if (IsDeletableVariable (Name, &Guid)) {
//DBG("Deleting %s:%ls...", strguid(&Guid), Name);
Status = DeleteNvramVariable(Name, &Guid);
if (IsDeletableVariable (Name, Guid)) {
//DBG("Deleting %s:%ls...", Guid.toXString8().c_str(), Name);
Status = DeleteNvramVariable(Name, Guid);
if (!EFI_ERROR(Status)) {
//DBG("OK\n");
Restart = true;
@ -513,7 +499,7 @@ GetSmcKeys (XBool WriteToSMC)
return;
}
DbgHeader("Dump SMC keys from NVRAM");
Status = gBS->LocateProtocol(&gAppleSMCProtocolGuid, NULL, (void**)&gAppleSmc);
Status = gBS->LocateProtocol(gAppleSMCProtocolGuid, NULL, (void**)&gAppleSmc);
if (!EFI_ERROR(Status)) {
DBG("found AppleSMC protocol\n");
} else {
@ -542,7 +528,7 @@ GetSmcKeys (XBool WriteToSMC)
continue; //the variable is not interesting for us
}
Data = (__typeof__(Data))GetNvramVariable(Name, &Guid, NULL, &DataSize);
Data = (__typeof__(Data))GetNvramVariable(Name, Guid, NULL, &DataSize);
if (Data) {
UINTN Index;
DBG(" %ls:", Name);
@ -595,17 +581,17 @@ void DumpSmcKeys()
}
#endif
/** Searches for GPT HDD dev path node and return pointer to partition GUID or NULL. */
/** Searches for GPT HDD dev path node and return pointer to partition EFI_GUID or NULL. */
EFI_GUID
*FindGPTPartitionGuidInDevicePath (
FindGPTPartitionGuidInDevicePath (
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
HARDDRIVE_DEVICE_PATH *HDDDevPath;
EFI_GUID *Guid = NULL;
EFI_GUID Guid;
if (DevicePath == NULL) {
return NULL;
return nullGuid;
}
while (!IsDevicePathEndType(DevicePath) &&
@ -616,7 +602,7 @@ EFI_GUID
if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_HARDDRIVE_DP) {
HDDDevPath = (HARDDRIVE_DEVICE_PATH*)DevicePath;
if (HDDDevPath->SignatureType == SIGNATURE_TYPE_GUID) {
Guid = (EFI_GUID*)HDDDevPath->Signature;
Guid = *(EFI_GUID*)HDDDevPath->Signature;
}
}
@ -788,13 +774,12 @@ BootVolumeMediaDevicePathNodesEqual (
* gBootCampHD - if gEfiBootDeviceData starts with MemoryMapped node, then BootCampHD variable (device path), NULL otherwise
* gEfiBootVolume - volume device path (from efi-boot-device-data or BootCampHD)
* gEfiBootLoaderPath - file path (from efi-boot-device-data or BootCampHD) or NULL
* gEfiBootDeviceGuid - GPT volume GUID if gEfiBootVolume or NULL
* gEfiBootDeviceGuid - GPT volume EFI_GUID if gEfiBootVolume or NULL
*/
EFI_STATUS
GetEfiBootDeviceFromNvram ()
{
UINTN Size = 0;
EFI_GUID *Guid;
FILEPATH_DEVICE_PATH *FileDevPath;
@ -806,7 +791,7 @@ GetEfiBootDeviceFromNvram ()
return EFI_SUCCESS;
}
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable(L"efi-boot-next-data", &gEfiAppleBootGuid, NULL, &Size);
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable(L"efi-boot-next-data", gEfiAppleBootGuid, NULL, &Size);
if (gEfiBootDeviceData != NULL) {
DBG("Got efi-boot-next-data size=%lld\n", Size);
if (IsDevicePathValid(gEfiBootDeviceData, Size)) {
@ -821,11 +806,11 @@ GetEfiBootDeviceFromNvram ()
void *Value;
UINTN Size2=0;
EFI_STATUS Status;
Status = GetVariable2 (L"aptiofixflag", &gEfiAppleBootGuid, &Value, &Size2);
Status = GetVariable2 (L"aptiofixflag", gEfiAppleBootGuid, &Value, &Size2);
if (EFI_ERROR(Status)) {
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable(L"efi-boot-device-data", &gEfiAppleBootGuid, NULL, &Size);
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable(L"efi-boot-device-data", gEfiAppleBootGuid, NULL, &Size);
} else {
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable(L"specialbootdevice", &gEfiAppleBootGuid, NULL, &Size);
gEfiBootDeviceData = (__typeof__(gEfiBootDeviceData))GetNvramVariable(L"specialbootdevice", gEfiAppleBootGuid, NULL, &Size);
}
if (gEfiBootDeviceData != NULL) {
@ -852,7 +837,7 @@ GetEfiBootDeviceFromNvram ()
// then Startup Disk sets BootCampHD to Win disk dev path.
//
if (DevicePathType(gEfiBootDeviceData) == HARDWARE_DEVICE_PATH && DevicePathSubType (gEfiBootDeviceData) == HW_MEMMAP_DP) {
gBootCampHD = (__typeof__(gBootCampHD))GetNvramVariable(L"BootCampHD", &gEfiAppleBootGuid, NULL, &Size);
gBootCampHD = (__typeof__(gBootCampHD))GetNvramVariable(L"BootCampHD", gEfiAppleBootGuid, NULL, &Size);
gEfiBootVolume = gBootCampHD;
if (gBootCampHD == NULL) {
@ -888,16 +873,12 @@ GetEfiBootDeviceFromNvram ()
DBG(" - LoaderPath: '%ls'\n", gEfiBootLoaderPath);
//
// if this is GPT disk, extract GUID
// if this is GPT disk, extract EFI_GUID
// gEfiBootDeviceGuid can be used as a flag for GPT disk then
//
Guid = FindGPTPartitionGuidInDevicePath(gEfiBootVolume);
if (Guid != NULL) {
gEfiBootDeviceGuid = (__typeof__(gEfiBootDeviceGuid))AllocatePool(sizeof(EFI_GUID));
if (gEfiBootDeviceGuid != NULL) {
CopyMem(gEfiBootDeviceGuid, Guid, sizeof(EFI_GUID));
DBG(" - Guid = %s\n", strguid(gEfiBootDeviceGuid));
}
gEfiBootDeviceGuid = FindGPTPartitionGuidInDevicePath (gEfiBootVolume);
if ( gEfiBootDeviceGuid.notNull() ) {
DBG(" - Guid = %s\n", gEfiBootDeviceGuid.toXString8().c_str());
}
return EFI_SUCCESS;
@ -1053,9 +1034,9 @@ LoadLatestNvramPlist()
/* Guid = FindGPTPartitionGuidInDevicePath (Volume->DevicePath);
DBG(" %2d. Volume '%ls', GUID = %s", Index, Volume->VolName, strguid(Guid));
DBG(" %2d. Volume '%ls', EFI_GUID = %s", Index, Volume->VolName, Guid.toXString8().c_str());
if (Guid == NULL) {
// not a GUID partition
// not a EFI_GUID partition
DBG(" - not GPT");
} */
DBG("Volume[%lld]\n", Index);
@ -1150,7 +1131,7 @@ PutNvramPlistToRtVars ()
continue;
}
EFI_GUID *VendorGuid = &gEfiAppleBootGuid;
EFI_GUID VendorGuid = gEfiAppleBootGuid;
// process only valid <key> tags
if ( valueTag == NULL ) {
// DBG(" ERROR: ValTag is not NULL\n");
@ -1174,7 +1155,7 @@ PutNvramPlistToRtVars ()
if (keyTag->keyStringValue() == "Boot0082"_XS8 ||
keyTag->keyStringValue() == "BootNext"_XS8 ) {
VendorGuid = &gEfiGlobalVariableGuid;
VendorGuid = gEfiGlobalVariableGuid;
// it may happen only in this case
gSettings.Boot.HibernationFixup = true;
}
@ -1302,7 +1283,7 @@ FindStartupDiskVolume (
EFI_DEVICE_PATH *MediaPath = Clover_FindDevicePathNodeWithType(DevicePath, MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP);
if (MediaPath) {
EFI_GUID *MediaPathGuid = (EFI_GUID *)&((VENDOR_DEVICE_PATH_WITH_DATA*)MediaPath)->VendorDefinedData;
XStringW MediaPathGuidStr = GuidLEToXStringW(*MediaPathGuid);
XStringW MediaPathGuidStr = MediaPathGuid->toXStringW();
DBG(" checking '%ls'\n", MediaPathGuidStr.wc_str());
if (StrStr(gEfiBootLoaderPath, MediaPathGuidStr.wc_str())) {
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str());
@ -1457,10 +1438,6 @@ EFI_STATUS SetStartupDiskVolume (
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevPath;
EFI_DEVICE_PATH_PROTOCOL *FileDevPath;
EFI_GUID *Guid;
// CHAR8 *EfiBootDevice;
// CONST CHAR8 *EfiBootDeviceTmpl;
// UINTN Size;
UINT32 Attributes;
@ -1478,8 +1455,8 @@ EFI_STATUS SetStartupDiskVolume (
}
DBG(" * DevPath: %ls\n", Volume->VolName.wc_str()/*, FileDevicePathToStr (DevPath)*/);
Guid = FindGPTPartitionGuidInDevicePath (Volume->DevicePath);
DBG(" * GUID = %s\n", strguid(Guid));
EFI_GUID Guid = FindGPTPartitionGuidInDevicePath (Volume->DevicePath);
DBG(" * EFI_GUID = %s\n", Guid.toXString8().c_str());
//
// let's save it without EFI_VARIABLE_NON_VOLATILE in CloverEFI like other vars so far
@ -1493,7 +1470,7 @@ EFI_STATUS SetStartupDiskVolume (
//
// set efi-boot-device-data to volume dev path
//
Status = SetNvramVariable (L"efi-boot-device-data", &gEfiAppleBootGuid, Attributes, GetDevicePathSize(DevPath), DevPath);
Status = SetNvramVariable (L"efi-boot-device-data", gEfiAppleBootGuid, Attributes, GetDevicePathSize(DevPath), DevPath);
if (EFI_ERROR(Status)) {
return Status;
@ -1503,7 +1480,7 @@ EFI_STATUS SetStartupDiskVolume (
// set efi-boot-device to XML string
// (probably not needed at all)
//
if (Guid != NULL) {
if ( Guid.notNull() ) {
XString8 EfiBootDevice;
EfiBootDevice.S8Printf(
"<array><dict>"
@ -1513,9 +1490,9 @@ EFI_STATUS SetStartupDiskVolume (
"<key>IOPropertyMatch</key>"
"<dict><key>UUID</key><string>%s</string></dict>"
"</dict>"
"</dict></array>", strguid(Guid));
"</dict></array>", Guid.toXString8().c_str());
DBG (" * efi-boot-device: %s\n", EfiBootDevice.c_str());
Status = SetNvramXString8(L"efi-boot-device", &gEfiAppleBootGuid, Attributes, EfiBootDevice);
Status = SetNvramXString8(L"efi-boot-device", gEfiAppleBootGuid, Attributes, EfiBootDevice);
}
return Status;
@ -1530,13 +1507,13 @@ RemoveStartupDiskVolume ()
// DBG("RemoveStartupDiskVolume:\n");
/*Status =*/ DeleteNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid);
/*Status =*/ DeleteNvramVariable (L"efi-boot-device", gEfiAppleBootGuid);
// DBG(" * efi-boot-device = %s\n", efiStrError(Status));
/*Status =*/ DeleteNvramVariable (L"efi-boot-device-data", &gEfiAppleBootGuid);
/*Status =*/ DeleteNvramVariable (L"efi-boot-device-data", gEfiAppleBootGuid);
// DBG(" * efi-boot-device-data = %s\n", efiStrError(Status));
/*Status =*/ DeleteNvramVariable (L"BootCampHD", &gEfiAppleBootGuid);
/*Status =*/ DeleteNvramVariable (L"BootCampHD", gEfiAppleBootGuid);
// DBG(" * BootCampHD = %s\n", efiStrError(Status));
// DBG("Removed efi-boot-device-data variable: %s\n", efiStrError(Status));
}

View File

@ -14,7 +14,7 @@
#include "../gui/REFIT_MENU_SCREEN.h"
extern EFI_GUID *gEfiBootDeviceGuid;
extern EFI_GUID gEfiBootDeviceGuid;
extern EFI_DEVICE_PATH_PROTOCOL *gEfiBootDeviceData;
@ -28,20 +28,20 @@ FindStartupDiskVolume (
void
*GetNvramVariable(
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
OUT UINTN *DataSize OPTIONAL
);
XString8 GetNvramVariableAsXString8(
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
OUT UINT32 *Attributes OPTIONAL
);
EFI_STATUS
AddNvramVariable (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN const void *Data
@ -49,7 +49,7 @@ AddNvramVariable (
EFI_STATUS
AddNvramXString8 (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
const XString8& s
);
@ -57,23 +57,23 @@ AddNvramXString8 (
EFI_STATUS
SetNvramVariable (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST void *Data
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST void *Data
);
EFI_STATUS
SetNvramXString8 (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
const XString8& s
const EFI_GUID& VendorGuid,
IN UINT32 Attributes,
const XString8& s
);
EFI_STATUS
DeleteNvramVariable (
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid
IN CONST CHAR16 *VariableName,
const EFI_GUID& VendorGuid
);
void
@ -81,8 +81,8 @@ ResetNvram (void);
XBool
IsDeletableVariable (
IN CHAR16 *Name,
IN EFI_GUID *Guid
IN CHAR16 *Name,
const EFI_GUID& Guid
);
EFI_STATUS
@ -93,7 +93,7 @@ EFI_STATUS
GetEfiBootDeviceFromNvram (void);
EFI_GUID
*FindGPTPartitionGuidInDevicePath (
FindGPTPartitionGuidInDevicePath (
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
);

View File

@ -119,7 +119,7 @@ OurPlatformDriverLoaded (
Status = gBS->OpenProtocol(
DriverImageHandle,
&gEfiComponentNameProtocolGuid,
gEfiComponentNameProtocolGuid,
(void**)&CompName,
gImageHandle,
NULL,
@ -213,7 +213,7 @@ void RegisterDriversToHighestPriority(IN EFI_HANDLE *PriorityDrivers)
EFI_STATUS Status;
mPriorityDrivers = PriorityDrivers;
Status = gBS->LocateProtocol(&gEfiPlatformDriverOverrideProtocolGuid, NULL, (void **) &PlatformDriverOverride);
Status = gBS->LocateProtocol(gEfiPlatformDriverOverrideProtocolGuid, NULL, (void **) &PlatformDriverOverride);
if (EFI_ERROR(Status)) {
DBG("PlatformDriverOverrideProtocol not found. Installing ... ");
Status = gBS->InstallMultipleProtocolInterfaces (

View File

@ -49,13 +49,7 @@
//#define DUMP_KERNEL_KEXT_PATCHES 1
//#define SHORT_LOCATE 1
//#define kXMLTagArray "array"
//EFI_GUID gRandomUUID = {0x0A0B0C0D, 0x0000, 0x1010, {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}};
#define NUM_OF_CONFIGS 3
#define GEN_PMCON_1 0xA0
@ -73,8 +67,6 @@ XObjArray<ACPI_PATCHED_AML> ACPIPatchedAML;
//SYSVARIABLES *SysVariables;
CHAR16 *IconFormat = NULL;
//TagDict* gConfigDict[NUM_OF_CONFIGS] = {NULL, NULL, NULL};
SETTINGS_DATA gSettings;
//GFX_PROPERTIES gGraphics[4]; //no more then 4 graphics cards
@ -255,7 +247,7 @@ SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
VarName = SWPrintf("Boot%04llX", Entry->BootNum);
BootVariable = (UINT8*)GetNvramVariable(VarName.wc_str(), &gEfiGlobalVariableGuid, NULL, &VarSize);
BootVariable = (UINT8*)GetNvramVariable(VarName.wc_str(), gEfiGlobalVariableGuid, NULL, &VarSize);
if ((BootVariable == NULL) || (VarSize == 0)) {
DBG("Boot option %ls not found\n", VarName.wc_str());
return;
@ -295,7 +287,7 @@ SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
FreePool(BootVariable);
//all check passed, save the number
Status = SetNvramVariable (L"BootCurrent",
&gEfiGlobalVariableGuid,
gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(UINT16),
&Entry->BootNum);
@ -303,7 +295,7 @@ SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
DBG("Can't save BootCurrent, status=%s\n", efiStrError(Status));
}
//Next step is rotate BootOrder to set BootNum to first place
BootOrder = (__typeof__(BootOrder))GetNvramVariable(L"BootOrder", &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
BootOrder = (__typeof__(BootOrder))GetNvramVariable(L"BootOrder", gEfiGlobalVariableGuid, NULL, &BootOrderSize);
if (BootOrder == NULL) {
return;
}
@ -324,7 +316,7 @@ SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
*Ptr++ = BootOrder[Index];
}
Status = gRT->SetVariable (L"BootOrder",
&gEfiGlobalVariableGuid,
gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS,
@ -509,9 +501,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData)
GlobalConfig.RtROM = settingsData.RtVariables.RtROMAsData;
}
if ( GlobalConfig.RtROM.isEmpty() ) {
EFI_GUID uuid;
StrToGuidBE(settingsData.Smbios.SmUUID, &uuid);
GlobalConfig.RtROM.ncpy(&uuid.Data4[2], 6);
GlobalConfig.RtROM.ncpy(&settingsData.Smbios.SmUUID.Data4[2], 6);
}
GlobalConfig.RtMLB = settingsData.RtVariables.RtMLBSetting;
if ( GlobalConfig.RtMLB.isEmpty() ) {
@ -1956,7 +1946,7 @@ XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion)
// MsgLog ("Beginning FSInjection\n");
//
// // get FSINJECTION_PROTOCOL
// Status = gBS->LocateProtocol(&gFSInjectProtocolGuid, NULL, (void **)&FSInject);
// Status = gBS->LocateProtocol(gFSInjectProtocolGuid, NULL, (void **)&FSInject);
// if (EFI_ERROR(Status)) {
// //Print (L"- No FSINJECTION_PROTOCOL, Status = %s\n", efiStrError(Status));
// MsgLog (" - ERROR: gFSInjectProtocolGuid not found!\n");
@ -2076,33 +2066,33 @@ XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion)
//}
const XString8& SETTINGS_DATA::getUUID()
const EFI_GUID& SETTINGS_DATA::getUUID()
{
if ( SystemParameters.CustomUuid.notEmpty() ) return SystemParameters.CustomUuid;
return Smbios.SmUUID;
}
const XString8& SETTINGS_DATA::getUUID(EFI_GUIDClass *uuid)
{
if ( SystemParameters.CustomUuid.notEmpty() ) {
if ( uuid ) {
EFI_STATUS Status = StrToGuidBE(SystemParameters.CustomUuid, uuid);
if ( EFI_ERROR(Status) ) {
log_technical_bug("CustomUuid(%s) is not valid", SystemParameters.CustomUuid.c_str()); // it's a technical bug. Validity is checked when imported from settings, so that must never happen.
*uuid = EFI_GUIDClass();
return nullGuidAsString;
}
}
return SystemParameters.CustomUuid;
}
if ( uuid ) {
EFI_STATUS Status = StrToGuidBE(Smbios.SmUUID, uuid);
if ( EFI_ERROR(Status) ) {
log_technical_bug("SmUUID(%s) is not valid", Smbios.SmUUID.c_str()); // same as before
*uuid = EFI_GUIDClass();
return nullGuidAsString;
}
}
if ( SystemParameters.CustomUuid.notNull() ) return SystemParameters.CustomUuid;
return Smbios.SmUUID;
}
//const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid)
//{
// if ( SystemParameters.CustomUuid.notEmpty() ) {
// if ( uuid ) {
// EFI_STATUS Status = StrToGuidBE(SystemParameters.CustomUuid, uuid);
// if ( EFI_ERROR(Status) ) {
// log_technical_bug("CustomUuid(%s) is not valid", SystemParameters.CustomUuid.c_str()); // it's a technical bug. Validity is checked when imported from settings, so that must never happen.
// *uuid = EFI_GUID();
// return nullGuidAsString;
// }
// }
// return SystemParameters.CustomUuid;
// }
// if ( uuid ) {
// EFI_STATUS Status = StrToGuidBE(Smbios.SmUUID, uuid);
// if ( EFI_ERROR(Status) ) {
// log_technical_bug("SmUUID(%s) is not valid", Smbios.SmUUID.c_str()); // same as before
// *uuid = EFI_GUID();
// return nullGuidAsString;
// }
// }
// return Smbios.SmUUID;
//}
//

View File

@ -1279,7 +1279,7 @@ public:
XBool NoCaches = false;
uint16_t BacklightLevel = 0xFFFF;
XBool BacklightLevelConfig = false;
XString8 CustomUuid = XString8();
EFI_GUID CustomUuid = EFI_GUID();
public: // temporary, must be protected:
UINT8 _InjectSystemID = 2; // 0=false, 1=true, other value = default.
public:
@ -2203,7 +2203,7 @@ printf("%s", "");
XBool Disabled = XBool();
XString8 Comment = XStringW();
XStringW Name = XStringW();
EFI_GUIDClass Guid = EFI_GUIDClass();
EFI_GUID Guid = EFI_GUID();
#if __cplusplus > 201703L
XBool operator == (const RT_VARIABLES&) const = default;
@ -2405,7 +2405,7 @@ printf("%s", "");
XString8 ProductName = XString8();
XString8 SystemVersion = XString8();
XString8 SerialNr = XString8();
XString8 SmUUID = XString8();
EFI_GUID SmUUID = EFI_GUID();
XString8 FamilyName = XString8();
// SMBIOS TYPE2
XString8 BoardManufactureName = XString8();
@ -2640,16 +2640,16 @@ printf("%s", "");
~SETTINGS_DATA() {}
const XString8& getUUID();
const XString8& getUUID(EFI_GUIDClass* efiGuid);
const EFI_GUID& getUUID();
// const XString8& getUUID(EFI_GUID* efiGuid);
// If CustomUuid is defined, return false by default
// If SmUUID is defined, return true by default.
XBool ShouldInjectSystemID() {
if ( SystemParameters.CustomUuid.notEmpty() && SystemParameters.CustomUuid != nullGuidAsString ) {
if ( SystemParameters.CustomUuid.notNull() && SystemParameters.CustomUuid.notNull() ) {
if ( SystemParameters._InjectSystemID == 2 ) return false;
else return SystemParameters._InjectSystemID != 0;
}
if ( Smbios.SmUUID.isEmpty() || Smbios.SmUUID == nullGuidAsString ) return false;
if ( Smbios.SmUUID.isNull() || Smbios.SmUUID.isNull() ) return false;
if ( SystemParameters._InjectSystemID == 2 ) return true;
return SystemParameters._InjectSystemID != 0;
}

View File

@ -52,9 +52,6 @@ extern UINTN EmbeddedSoundLength;
#endif
//EFI_GUID gBootChimeVendorVariableGuid = {0x89D4F995, 0x67E3, 0x4895, { 0x8F, 0x18, 0x45, 0x4B, 0x65, 0x1D, 0x92, 0x15 }};
extern EFI_GUID gBootChimeVendorVariableGuid;
EFI_AUDIO_IO_PROTOCOL *AudioIo = NULL;
@ -277,10 +274,10 @@ GetStoredOutput()
}
DBG("found %llu handles with audio\n", AudioIoHandleCount);
// Get stored device path size. First from AppleBootGuid
StoredDevicePath = (__typeof__(StoredDevicePath))GetNvramVariable(L"Clover.SoundDevice", &gEfiAppleBootGuid, NULL, &StoredDevicePathSize);
StoredDevicePath = (__typeof__(StoredDevicePath))GetNvramVariable(L"Clover.SoundDevice", gEfiAppleBootGuid, NULL, &StoredDevicePathSize);
if (!StoredDevicePath) {
// second attempt with BootChimeGuid
StoredDevicePath = (__typeof__(StoredDevicePath))GetNvramVariable(BOOT_CHIME_VAR_DEVICE, &gBootChimeVendorVariableGuid, NULL, &StoredDevicePathSize);
StoredDevicePath = (__typeof__(StoredDevicePath))GetNvramVariable(BOOT_CHIME_VAR_DEVICE, gBootChimeVendorVariableGuid, NULL, &StoredDevicePathSize);
if (!StoredDevicePath) {
MsgLog("No AudioIoDevice stored\n");
Status = EFI_NOT_FOUND;
@ -327,10 +324,10 @@ GetStoredOutput()
// Get stored device index.
OutputPortIndex = 0;
Status = gRT->GetVariable(L"Clover.SoundIndex", &gEfiAppleBootGuid, NULL,
Status = gRT->GetVariable(L"Clover.SoundIndex", gEfiAppleBootGuid, NULL,
&OutputPortIndexSize, &OutputPortIndex);
if (EFI_ERROR(Status)) {
Status = gRT->GetVariable(BOOT_CHIME_VAR_INDEX, &gBootChimeVendorVariableGuid, NULL,
Status = gRT->GetVariable(BOOT_CHIME_VAR_INDEX, gBootChimeVendorVariableGuid, NULL,
&OutputPortIndexSize, &OutputPortIndex);
if (EFI_ERROR(Status)) {
MsgLog("Bad output index, status=%s, set 0\n", efiStrError(Status));
@ -345,10 +342,10 @@ GetStoredOutput()
}
// Get stored volume. If this fails, just use the max.
OutputVolume = DefaultAudioVolume;
Status = gRT->GetVariable(L"Clover.SoundVolume", &gEfiAppleBootGuid, NULL,
Status = gRT->GetVariable(L"Clover.SoundVolume", gEfiAppleBootGuid, NULL,
&OutputVolumeSize, &OutputVolume);
if (EFI_ERROR(Status)) {
Status = gRT->GetVariable(BOOT_CHIME_VAR_VOLUME, &gBootChimeVendorVariableGuid, NULL,
Status = gRT->GetVariable(BOOT_CHIME_VAR_VOLUME, gBootChimeVendorVariableGuid, NULL,
&OutputVolumeSize, &OutputVolume);
if (EFI_ERROR(Status)) {
OutputVolume = DefaultAudioVolume; //EFI_AUDIO_IO_PROTOCOL_MAX_VOLUME;

View File

@ -95,7 +95,10 @@ GetRootUUID (IN REFIT_VOLUME *Volume)
if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in Root UUID\n");
}else{
Status = StrToGuidBE(Prop->getString()->stringValue(), &Volume->RootUUID);
// Status = StrToGuidBE(Prop->getString()->stringValue(), &Volume->RootUUID);
Volume->RootUUID.takeValueFromBE(Prop->getString()->stringValue());
if ( Volume->RootUUID.isNull() ) Status = EFI_UNSUPPORTED;
else Status = EFI_SUCCESS;
}
}

View File

@ -12,7 +12,7 @@
#include <Efi.h>
#include "../cpp_foundation/XString.h"
#include "../libeg/libeg.h"
#include "../Platform/guid.h"
class LEGACY_OS
{
@ -50,13 +50,13 @@ public:
EFI_HANDLE WholeDiskDeviceHandle = 0;
MBR_PARTITION_INFO *MbrPartitionTable = 0;
UINT32 DriveCRC32 = 0;
EFI_GUID RootUUID = EFI_GUID({0,0,0,{0,0,0,0,0,0,0,0}}); //for recovery it is UUID of parent partition
EFI_GUID RootUUID = EFI_GUID(); //for recovery it is UUID of parent partition
UINT64 SleepImageOffset = 0;
XStringW osxVolumeName = XStringW(); // comes from \\System\\Library\\CoreServices\\.disk_label.contentDetails, or empty.
XString8 ApfsFileSystemUUID = XString8(); // apfs file system UUID of that partition. It's not the UUID of subfolder like in Preboot.
XString8 ApfsContainerUUID = XString8();
EFI_GUID ApfsFileSystemUUID = EFI_GUID(); // apfs file system UUID of that partition. It's not the UUID of subfolder like in Preboot.
EFI_GUID ApfsContainerUUID = EFI_GUID();
APPLE_APFS_VOLUME_ROLE ApfsRole = 0;
XString8Array ApfsTargetUUIDArray = XString8Array(); // this is the array of folders that are named as UUID
XObjArray<EFI_GUID> ApfsTargetUUIDArray = XObjArray<EFI_GUID>(); // this is the array of folders that are named as UUID
UINTN Index = 0;
REFIT_VOLUME() {};

View File

@ -16,7 +16,7 @@ VolumesArrayClass Volumes;
//}
REFIT_VOLUME* VolumesArrayClass::getVolumeWithApfsContainerUUIDAndFileSystemUUID(const XString8& ApfsContainerUUID, const XString8& ApfsFileSystemUUID)
REFIT_VOLUME* VolumesArrayClass::getVolumeWithApfsContainerUUIDAndFileSystemUUID(const EFI_GUID& ApfsContainerUUID, const EFI_GUID& ApfsFileSystemUUID)
{
for (size_t VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++) {
REFIT_VOLUME* Volume = &Volumes[VolumeIndex];
@ -30,7 +30,7 @@ REFIT_VOLUME* VolumesArrayClass::getVolumeWithApfsContainerUUIDAndFileSystemUUID
return NULL;
}
REFIT_VOLUME* VolumesArrayClass::getVolumeWithApfsContainerUUIDAndRole(const XString8& ApfsContainerUUID, APPLE_APFS_VOLUME_ROLE roleMask)
REFIT_VOLUME* VolumesArrayClass::getVolumeWithApfsContainerUUIDAndRole(const EFI_GUID& ApfsContainerUUID, APPLE_APFS_VOLUME_ROLE roleMask)
{
REFIT_VOLUME* targetVolume = NULL;
for (size_t VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++) {

View File

@ -21,12 +21,11 @@ extern "C" {
class VolumesArrayClass : public XObjArray<REFIT_VOLUME>
{
public:
// REFIT_VOLUME* getApfsPartitionWithUUID(const XString8& ApfsContainerUUID, const XString8& APFSTargetUUID);
REFIT_VOLUME* getVolumeWithApfsContainerUUIDAndFileSystemUUID(const XString8& ApfsContainerUUID, const XString8& ApfsFileSystemUUID);
REFIT_VOLUME* getVolumeWithApfsContainerUUIDAndFileSystemUUID(const EFI_GUID& ApfsContainerUUID, const EFI_GUID& ApfsFileSystemUUID);
/*
* Return : NULL if not found OR more than one partition with this role is found in this container
*/
REFIT_VOLUME* getVolumeWithApfsContainerUUIDAndRole(const XString8& ApfsContainerUUID, APPLE_APFS_VOLUME_ROLE roleMask);
REFIT_VOLUME* getVolumeWithApfsContainerUUIDAndRole(const EFI_GUID& ApfsContainerUUID, APPLE_APFS_VOLUME_ROLE roleMask);
};

View File

@ -114,13 +114,10 @@ void GetCPUProperties (void)
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer;
// EFI_GUID **ProtocolGuidArray;
EFI_PCI_IO_PROTOCOL *PciIo;
PCI_TYPE00 Pci;
UINTN HandleCount;
// UINTN ArrayCount;
UINTN HandleIndex;
// UINTN ProtocolIndex;
UINT64 qpibusspeed; //units=kHz
UINT32 qpimult = 2;
UINT32 BusSpeed = 0; //units kHz

View File

@ -90,7 +90,7 @@ UINT32 pci_config_read32(pci_dt_t *PciDt, UINT8 reg)
PCI_TYPE00 Pci;
UINT32 res;
Status = gBS->OpenProtocol(PciDt->DeviceHandle, &gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
Status = gBS->OpenProtocol(PciDt->DeviceHandle, gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)){
DBG("pci_config_read cant open protocol\n");
return 0;

View File

@ -24,22 +24,22 @@
//EFI_GUID gEfiAppleVendorGuid = {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27, 0x8F, 0xCC, 0x34, 0x22, 0xB6}};
//EFI_GUID gAppleEFINVRAMTRBSecureGuid = {0xF68DA75E, 0x1B55, 0x4E70, {0xB4, 0x1B, 0xA7, 0xB7, 0xA5, 0xB7, 0x58, 0xEA}};
//EFI_GUID gDataHubOptionsGuid = {0x0021001C, 0x3CE3, 0x41F8, {0x99, 0xC6, 0xEC, 0xF5, 0xDA, 0x75, 0x47, 0x31}};
EFI_GUID gNotifyMouseActivity = {0xF913C2C2, 0x5351, 0x4FDB, {0x93, 0x44, 0x70, 0xFF, 0xED, 0xB8, 0x42, 0x25}};
//EFI_GUID gNotifyMouseActivity = {0xF913C2C2, 0x5351, 0x4FDB, {0x93, 0x44, 0x70, 0xFF, 0xED, 0xB8, 0x42, 0x25}};
//EFI_GUID gEfiDataHubProtocolGuid = {0xAE80D021, 0x618E, 0x11D4, {0xBC, 0xD7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81}};
//EFI_GUID gEfiMiscSubClassGuid = {0x772484B2, 0x7482, 0x4b91, {0x9F, 0x9A, 0xAD, 0x43, 0xF8, 0x1C, 0x58, 0x81}};
//EFI_GUID gEfiProcessorSubClassGuid = {0x26FDEB7E, 0xB8AF, 0x4CCF, {0xAA, 0x97, 0x02, 0x63, 0x3C, 0xE4, 0x8C, 0xA7}};
//EFI_GUID gEfiMemorySubClassGuid = {0x4E8F4EBB, 0x64B9, 0x4e05, {0x9B, 0x18, 0x4C, 0xFE, 0x49, 0x23, 0x50, 0x97}};
//EFI_GUID gMsgLogProtocolGuid = {0x511CE018, 0x0018, 0x4002, {0x20, 0x12, 0x17, 0x38, 0x05, 0x01, 0x02, 0x03}};
//EFI_GUID gEfiLegacy8259ProtocolGuid = {0x38321DBA, 0x4FE0, 0x4E17, {0x8A, 0xEC, 0x41, 0x30, 0x55, 0xEA, 0xED, 0xC1}};
EFI_GUID gAppleDeviceControlProtocolGuid = {0x8ECE08D8, 0xA6D4, 0x430B, {0xA7, 0xB0, 0x2D, 0xF3, 0x18, 0xE7, 0x88, 0x4A}};
//EFI_GUID gAppleDeviceControlProtocolGuid = {0x8ECE08D8, 0xA6D4, 0x430B, {0xA7, 0xB0, 0x2D, 0xF3, 0x18, 0xE7, 0x88, 0x4A}};
//from reza jelveh
EFI_GUID gAppleSystemInfoProducerNameGuid = {0x64517CC8, 0x6561, 0x4051, {0xB0, 0x3C, 0x59, 0x64, 0xB6, 0x0F, 0x4C, 0x7A}};
EFI_GUID gAppleFsbFrequencyPropertyGuid = {0xD1A04D55, 0x75B9, 0x41A3, {0x90, 0x36, 0x8F, 0x4A, 0x26, 0x1C, 0xBB, 0xA2}};
EFI_GUID gAppleDevicePathsSupportedGuid = {0x5BB91CF7, 0xD816, 0x404B, {0x86, 0x72, 0x68, 0xF2, 0x7F, 0x78, 0x31, 0xDC}};
EFI_GUID gAppleSMCProtocolGuid = {0x17407e5a, 0xaf6c, 0x4ee8, {0x98, 0xa8, 0x00, 0x21, 0x04, 0x53, 0xcd, 0xd9}};
EFI_GUID gAppleCursorImageGuid = {0x1A10742F, 0xFA80, 0x4B79, {0x9D, 0xA6, 0x35, 0x70, 0x58, 0xCC, 0x39, 0x7B}};
//EFI_GUID gAppleSystemInfoProducerNameGuid = {0x64517CC8, 0x6561, 0x4051, {0xB0, 0x3C, 0x59, 0x64, 0xB6, 0x0F, 0x4C, 0x7A}};
//EFI_GUID gAppleFsbFrequencyPropertyGuid = {0xD1A04D55, 0x75B9, 0x41A3, {0x90, 0x36, 0x8F, 0x4A, 0x26, 0x1C, 0xBB, 0xA2}};
//EFI_GUID gAppleDevicePathsSupportedGuid = {0x5BB91CF7, 0xD816, 0x404B, {0x86, 0x72, 0x68, 0xF2, 0x7F, 0x78, 0x31, 0xDC}};
//EFI_GUID gAppleSMCProtocolGuid = {0x17407e5a, 0xaf6c, 0x4ee8, {0x98, 0xa8, 0x00, 0x21, 0x04, 0x53, 0xcd, 0xd9}};
//
//EFI_GUID gAppleCursorImageGuid = {0x1A10742F, 0xFA80, 0x4B79, {0x9D, 0xA6, 0x35, 0x70, 0x58, 0xCC, 0x39, 0x7B}};
//all these codes are still under the question
/*
@ -146,60 +146,63 @@ F0 00 00 00 | ....
* @APPLE_LICENSE_HEADER_END@
*/
const XString8 nullGuidAsString = "00000000-0000-0000-0000-000000000000"_XS8;
//const XString8 nullGuidAsString = "00000000-0000-0000-0000-000000000000"_XS8;
class _GUID_H__asserts
{
public:
_GUID_H__asserts() {
// Jief : I know it's a panic, even in a release version. But it's about constants !
if ( !IsValidGuidString(nullGuidAsString) ) panic("!IsValidGuidString(nullGuidAsString)");
}
} _GUID_H__asserts_obj;
//class _GUID_H__asserts
//{
//public:
// _GUID_H__asserts() {
// // Jief : I know it's a panic, even in a release version. But it's about constants !
// if ( !IsValidGuidString(nullGuidAsString) ) panic("!IsValidGuidString(nullGuidAsString)");
// }
//} _GUID_H__asserts_obj;
//constexpr const EFI_GUID nullGuid;
//XStringW GuidBeToXStringW(const EFI_GUID& Guid)
//{
// UINT8 *GuidData = (UINT8 *)&Guid;
// XStringW Str = SWPrintf("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
// GuidData[0], GuidData[1], GuidData[2], GuidData[3],
// GuidData[4], GuidData[5],
// GuidData[6], GuidData[7],
// GuidData[8], GuidData[9], GuidData[10], GuidData[11],
// GuidData[12], GuidData[13], GuidData[14], GuidData[15]);
// return Str;
//}
//
//XString8 GuidBeToXString8(const EFI_GUID& Guid)
//{
// UINT8 *GuidData = (UINT8 *)&Guid;
// XString8 Str = SWPrintf("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
// GuidData[0], GuidData[1], GuidData[2], GuidData[3],
// GuidData[4], GuidData[5],
// GuidData[6], GuidData[7],
// GuidData[8], GuidData[9], GuidData[10], GuidData[11],
// GuidData[12], GuidData[13], GuidData[14], GuidData[15]);
// return Str;
//}
//
//
//XStringW GuidLEToXStringW(const EFI_GUID& Guid)
//{
// XStringW returnValue;
// returnValue.SWPrintf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
// Guid.Data1, Guid.Data2, Guid.Data3, Guid.Data4[0], Guid.Data4[1],
// Guid.Data4[2], Guid.Data4[3], Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]);
// return returnValue;
//}
//
//XString8 GuidLEToXString8(const EFI_GUID& Guid)
//{
// XString8 returnValue;
// returnValue.S8Printf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
// Guid.Data1, Guid.Data2, Guid.Data3, Guid.Data4[0], Guid.Data4[1],
// Guid.Data4[2], Guid.Data4[3], Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]);
// return returnValue;
//}
EFI_GUID nullGuid = {0,0,0,{0,0,0,0,0,0,0,0}};
XStringW GuidBeToXStringW(const EFI_GUID& Guid)
{
UINT8 *GuidData = (UINT8 *)&Guid;
XStringW Str = SWPrintf("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
GuidData[0], GuidData[1], GuidData[2], GuidData[3],
GuidData[4], GuidData[5],
GuidData[6], GuidData[7],
GuidData[8], GuidData[9], GuidData[10], GuidData[11],
GuidData[12], GuidData[13], GuidData[14], GuidData[15]);
return Str;
}
XString8 GuidBeToXString8(const EFI_GUID& Guid)
{
UINT8 *GuidData = (UINT8 *)&Guid;
XString8 Str = SWPrintf("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
GuidData[0], GuidData[1], GuidData[2], GuidData[3],
GuidData[4], GuidData[5],
GuidData[6], GuidData[7],
GuidData[8], GuidData[9], GuidData[10], GuidData[11],
GuidData[12], GuidData[13], GuidData[14], GuidData[15]);
return Str;
}
XStringW GuidLEToXStringW(const EFI_GUID& Guid)
{
XStringW returnValue;
returnValue.SWPrintf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
Guid.Data1, Guid.Data2, Guid.Data3, Guid.Data4[0], Guid.Data4[1],
Guid.Data4[2], Guid.Data4[3], Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]);
return returnValue;
}
XString8 GuidLEToXString8(const EFI_GUID& Guid)
{
XString8 returnValue;
returnValue.S8Printf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
Guid.Data1, Guid.Data2, Guid.Data3, Guid.Data4[0], Guid.Data4[1],
Guid.Data4[2], Guid.Data4[3], Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]);
return returnValue;
}
//int EFI_GUID::parse_guid_error() { panic("Incorrect format for guid operator."); } // note, not constexpr
//EFI_GUID EFI_GUID::parse_guid_error2() { panic("Incorrect format for guid operator."); } // note, not constexpr

View File

@ -16,68 +16,46 @@ extern "C" {
#include <Uefi/UefiBaseType.h> // for EFI_GUID
}
extern "C" EFI_GUID gEfiMiscSubClassGuid;
/*
* Wrapper class to bring some syntaxic sugar : initialisation at construction, assignment, == operator, etc.
*/
class EFI_GUIDClass : public EFI_GUID
{
public:
EFI_GUIDClass() { Data1 = 0; Data2 = 0; Data3 = 0; memset(Data4, 0, sizeof(Data4)); }
EFI_GUIDClass(const EFI_GUID& other) { Data1 = other.Data1; Data2 = other.Data2; Data3 = other.Data3; memcpy(Data4, other.Data4, sizeof(Data4)); }
XBool operator == (const EFI_GUID& other) const {
if ( !(Data1 == other.Data1) ) return false;
if ( !(Data2 == other.Data2) ) return false;
if ( !(Data3 == other.Data3) ) return false;
if ( !(memcmp(Data4, other.Data4, sizeof(Data4)) == 0) ) return false;
return true;
}
};
extern const XString8 nullGuidAsString;
extern EFI_GUID nullGuid;
/** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
template <typename T, typename IntegralType, enable_if( is_char(T) && is_integral(IntegralType) ) >
XBool IsValidGuidString(const T* Str, IntegralType n)
{
UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
if ( n != 36 ) {
return false;
}
for (Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < 36; Index4IsValidGuidAsciiString++) {
if (Index4IsValidGuidAsciiString == 8 || Index4IsValidGuidAsciiString == 13 || Index4IsValidGuidAsciiString == 18 || Index4IsValidGuidAsciiString == 23) {
if (Str[Index4IsValidGuidAsciiString] != '-') {
return false;
}
} else {
if (!(
(Str[Index4IsValidGuidAsciiString] >= '0' && Str[Index4IsValidGuidAsciiString] <= '9')
|| (Str[Index4IsValidGuidAsciiString] >= 'a' && Str[Index4IsValidGuidAsciiString] <= 'f')
|| (Str[Index4IsValidGuidAsciiString] >= 'A' && Str[Index4IsValidGuidAsciiString] <= 'F')
)
)
{
return false;
}
}
}
return true;
}
/** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
template <typename T, enable_if( is___String(T) )>
XBool IsValidGuidString(const T& Str)
{
if ( Str.isEmpty() ) return false;
return IsValidGuidString(Str.data(), Str.length());
}
//
//
///** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
//template <typename T, typename IntegralType, enable_if( is_char(T) && is_integral(IntegralType) ) >
//XBool IsValidGuidString(const T* Str, IntegralType n)
//{
// UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
//
// if ( n != 36 ) {
// return false;
// }
//
// for (Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < 36; Index4IsValidGuidAsciiString++) {
// if (Index4IsValidGuidAsciiString == 8 || Index4IsValidGuidAsciiString == 13 || Index4IsValidGuidAsciiString == 18 || Index4IsValidGuidAsciiString == 23) {
// if (Str[Index4IsValidGuidAsciiString] != '-') {
// return false;
// }
// } else {
// if (!(
// (Str[Index4IsValidGuidAsciiString] >= '0' && Str[Index4IsValidGuidAsciiString] <= '9')
// || (Str[Index4IsValidGuidAsciiString] >= 'a' && Str[Index4IsValidGuidAsciiString] <= 'f')
// || (Str[Index4IsValidGuidAsciiString] >= 'A' && Str[Index4IsValidGuidAsciiString] <= 'F')
// )
// )
// {
// return false;
// }
// }
// }
//
// return true;
//}
//
///** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
//template <typename T, enable_if( is___String(T) )>
//XBool IsValidGuidString(const T& Str)
//{
// if ( Str.isEmpty() ) return false;
// return IsValidGuidString(Str.data(), Str.length());
//}
///** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
//template <typename T, enable_if( is___String(T) )>
@ -110,149 +88,270 @@ XBool IsValidGuidString(const T& Str)
// return true;
//}
//
//template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
//EFI_STATUS
//StrHToBuf (
// OUT UINT8 *Buf,
// IN UINTN BufferLength,
// const T& t
// )
//{
// UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
// UINTN StrLength;
// UINT8 Digit;
// UINT8 Byte;
//
// Digit = 0;
// auto Str = _xstringarray__char_type<T>::getCharPtr(t);
//
// //
// // Two hex char make up one byte
// //
// StrLength = BufferLength * sizeof (CHAR16);
//
// for(Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < StrLength; Index4IsValidGuidAsciiString++) {
//
// if ((Str[Index4IsValidGuidAsciiString] >= (decltype(*Str))'a') && (Str[Index4IsValidGuidAsciiString] <= (decltype(*Str))'f')) {
// Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - (decltype(*Str))'a' + 0x0A);
// } else if ((Str[Index4IsValidGuidAsciiString] >= (decltype(*Str))'A') && (Str[Index4IsValidGuidAsciiString] <= (decltype(*Str))'F')) {
// Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - L'A' + 0x0A);
// } else if ((Str[Index4IsValidGuidAsciiString] >= (decltype(*Str))'0') && (Str[Index4IsValidGuidAsciiString] <= (decltype(*Str))'9')) {
// Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - (decltype(*Str))'0');
// } else {
// return EFI_INVALID_PARAMETER;
// }
//
// //
// // For odd characters, write the upper nibble for each buffer byte,
// // and for even characters, the lower nibble.
// //
// if ((Index4IsValidGuidAsciiString & 1) == 0) {
// Byte = (UINT8) (Digit << 4);
// } else {
// Byte = Buf[Index4IsValidGuidAsciiString / 2];
// Byte &= 0xF0;
// Byte = (UINT8) (Byte | Digit);
// }
//
// Buf[Index4IsValidGuidAsciiString / 2] = Byte;
// }
//
// return EFI_SUCCESS;
//}
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
EFI_STATUS
StrHToBuf (
OUT UINT8 *Buf,
IN UINTN BufferLength,
const T& t
)
{
UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
UINTN StrLength;
UINT8 Digit;
UINT8 Byte;
///*
// * Convert a string to a EFI_GUID.
// * First parameter can by of one of these type : char*, char16_t*, char32_t*, wchar_t*, XString8, XString16, XString32, XStringW
// */
//template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
//EFI_STATUS
//StrToGuidBE (
// const T& t,
// OUT EFI_GUID *Guid
// )
//{
// EFI_STATUS Status;
// UINT8 GuidLE[16];
//
// if ( Guid == NULL ) {
// log_technical_bug("%s : call with Guid==NULL", __PRETTY_FUNCTION__);
// return EFI_UNSUPPORTED;
// }
//
// auto Str = _xstringarray__char_type<T>::getCharPtr(t);
//
// if ( Str == NULL ) {
// memset(Guid, 0, sizeof(EFI_GUID));
// return EFI_SUCCESS;
// }
//
//
// Status = StrHToBuf (&GuidLE[0], 4, Str);
// if ( Status != EFI_SUCCESS ) return Status;
//
// while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
// Str ++;
// }
//
// if (IS_HYPHEN (*Str)) {
// Str++;
// } else {
// return EFI_UNSUPPORTED;
// }
//
// Status = StrHToBuf (&GuidLE[4], 2, Str);
// if ( Status != EFI_SUCCESS ) return Status;
// while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
// Str ++;
// }
//
// if (IS_HYPHEN (*Str)) {
// Str++;
// } else {
// return EFI_UNSUPPORTED;
// }
//
// Status = StrHToBuf (&GuidLE[6], 2, Str);
// if ( Status != EFI_SUCCESS ) return Status;
// while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
// Str ++;
// }
//
// if (IS_HYPHEN (*Str)) {
// Str++;
// } else {
// return EFI_UNSUPPORTED;
// }
//
// Status = StrHToBuf (&GuidLE[8], 2, Str);
// if ( Status != EFI_SUCCESS ) return Status;
// while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
// Str ++;
// }
//
// if (IS_HYPHEN (*Str)) {
// Str++;
// } else {
// return EFI_UNSUPPORTED;
// }
//
// Status = StrHToBuf (&GuidLE[10], 6, Str);
// if ( Status != EFI_SUCCESS ) return Status;
//
// if (Guid) {
// memcpy((UINT8*)Guid, &GuidLE[0], sizeof(EFI_GUID));
// }
//
// return EFI_SUCCESS;
//}
Digit = 0;
auto Str = _xstringarray__char_type<T>::getCharPtr(t);
//
// Two hex char make up one byte
//
StrLength = BufferLength * sizeof (CHAR16);
//XString8 GuidBeToXString8(const EFI_GUID& Guid); // not used
//XStringW GuidBeToXStringW(const EFI_GUID& Guid); // not used
//XString8 GuidLEToXString8(const EFI_GUID& Guid);
//XStringW GuidLEToXStringW(const EFI_GUID& Guid);
for(Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < StrLength; Index4IsValidGuidAsciiString++) {
if ((Str[Index4IsValidGuidAsciiString] >= (decltype(*Str))'a') && (Str[Index4IsValidGuidAsciiString] <= (decltype(*Str))'f')) {
Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - (decltype(*Str))'a' + 0x0A);
} else if ((Str[Index4IsValidGuidAsciiString] >= (decltype(*Str))'A') && (Str[Index4IsValidGuidAsciiString] <= (decltype(*Str))'F')) {
Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - L'A' + 0x0A);
} else if ((Str[Index4IsValidGuidAsciiString] >= (decltype(*Str))'0') && (Str[Index4IsValidGuidAsciiString] <= (decltype(*Str))'9')) {
Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - (decltype(*Str))'0');
} else {
return EFI_INVALID_PARAMETER;
}
//
// For odd characters, write the upper nibble for each buffer byte,
// and for even characters, the lower nibble.
//
if ((Index4IsValidGuidAsciiString & 1) == 0) {
Byte = (UINT8) (Digit << 4);
} else {
Byte = Buf[Index4IsValidGuidAsciiString / 2];
Byte &= 0xF0;
Byte = (UINT8) (Byte | Digit);
}
Buf[Index4IsValidGuidAsciiString / 2] = Byte;
}
return EFI_SUCCESS;
}
//this is standard
//constexpr const EFI_GUID gEfiSmbios3TableGuid = { 0xF2FD1544, 0x9794, 0x4A2C, { 0x99, 0x2E, 0xE5, 0xBB, 0xCF, 0x20, 0xE3, 0x94 }};
//constexpr const EFI_GUID gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}};
//constexpr const EFI_GUID gAppleFirmwarePasswordProtocolGuid = {0x8FFEEB3A, 0x4C98, 0x4630, {0x80, 0x3F, 0x74, 0x0F, 0x95, 0x67, 0x09, 0x1D}};
//gEfiGlobalVariableGuid
//constexpr const EFI_GUID gEfiGlobalVarGuid = {0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
//constexpr const EFI_GUID gEfiDevicePathPropertyDatabaseProtocolGuid = {0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}};
//constexpr const EFI_GUID gEfi AppleBootGuid = {0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}}; //gAppleBootVariableGuid
//constexpr const EFI_GUID gEfiAppleNvramGuid = {0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14}}; //gAppleVendorVariableGuid
//constexpr const EFI_GUID gAppleFramebufferInfoProtocolGuid = {0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03}};
//constexpr const EFI_GUID gAppleKeyStateProtocolGuid = {0x5B213447, 0x6E73, 0x4901, {0xA4, 0xF1, 0xB8, 0x64, 0xF3, 0xB7, 0xA1, 0x72}};
//constexpr const EFI_GUID gAppleNetBootProtocolGuid = {0x78EE99FB, 0x6A5E, 0x4186, {0x97, 0xDE, 0xCD, 0x0A, 0xBA, 0x34, 0x5A, 0x74}};
//constexpr const EFI_GUID gAppleImageCodecProtocolGuid = {0x0DFCE9F6, 0xC4E3, 0x45EE, {0xA0, 0x6A, 0xA8, 0x61, 0x3B, 0x98, 0xA5, 0x07}};
//constexpr const EFI_GUID gEfiAppleVendorGuid = {0xAC39C713, 0x7E50, 0x423D, {0x88, 0x9D, 0x27, 0x8F, 0xCC, 0x34, 0x22, 0xB6}};
//constexpr const EFI_GUID gAppleEFINVRAMTRBSecureGuid = {0xF68DA75E, 0x1B55, 0x4E70, {0xB4, 0x1B, 0xA7, 0xB7, 0xA5, 0xB7, 0x58, 0xEA}};
//constexpr const EFI_GUID gDataHubOptionsGuid = {0x0021001C, 0x3CE3, 0x41F8, {0x99, 0xC6, 0xEC, 0xF5, 0xDA, 0x75, 0x47, 0x31}};
constexpr const EFI_GUID gNotifyMouseActivity = {0xF913C2C2, 0x5351, 0x4FDB, {0x93, 0x44, 0x70, 0xFF, 0xED, 0xB8, 0x42, 0x25}};
//constexpr const EFI_GUID gEfiDataHubProtocolGuid = {0xAE80D021, 0x618E, 0x11D4, {0xBC, 0xD7, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81}};
//constexpr const EFI_GUID gEfiMiscSubClassGuid = {0x772484B2, 0x7482, 0x4b91, {0x9F, 0x9A, 0xAD, 0x43, 0xF8, 0x1C, 0x58, 0x81}};
//constexpr const EFI_GUID gEfiProcessorSubClassGuid = {0x26FDEB7E, 0xB8AF, 0x4CCF, {0xAA, 0x97, 0x02, 0x63, 0x3C, 0xE4, 0x8C, 0xA7}};
//constexpr const EFI_GUID gEfiMemorySubClassGuid = {0x4E8F4EBB, 0x64B9, 0x4e05, {0x9B, 0x18, 0x4C, 0xFE, 0x49, 0x23, 0x50, 0x97}};
//constexpr const EFI_GUID gMsgLogProtocolGuid = {0x511CE018, 0x0018, 0x4002, {0x20, 0x12, 0x17, 0x38, 0x05, 0x01, 0x02, 0x03}};
//constexpr const EFI_GUID gEfiLegacy8259ProtocolGuid = {0x38321DBA, 0x4FE0, 0x4E17, {0x8A, 0xEC, 0x41, 0x30, 0x55, 0xEA, 0xED, 0xC1}};
constexpr const EFI_GUID gAppleDeviceControlProtocolGuid = {0x8ECE08D8, 0xA6D4, 0x430B, {0xA7, 0xB0, 0x2D, 0xF3, 0x18, 0xE7, 0x88, 0x4A}};
//from reza jelveh
constexpr const EFI_GUID gAppleSystemInfoProducerNameGuid = {0x64517CC8, 0x6561, 0x4051, {0xB0, 0x3C, 0x59, 0x64, 0xB6, 0x0F, 0x4C, 0x7A}};
constexpr const EFI_GUID gAppleFsbFrequencyPropertyGuid = {0xD1A04D55, 0x75B9, 0x41A3, {0x90, 0x36, 0x8F, 0x4A, 0x26, 0x1C, 0xBB, 0xA2}};
constexpr const EFI_GUID gAppleDevicePathsSupportedGuid = {0x5BB91CF7, 0xD816, 0x404B, {0x86, 0x72, 0x68, 0xF2, 0x7F, 0x78, 0x31, 0xDC}};
//constexpr const EFI_GUID gAppleSMCProtocolGuid = {0x17407e5a, 0xaf6c, 0x4ee8, {0x98, 0xa8, 0x00, 0x21, 0x04, 0x53, 0xcd, 0xd9}};
constexpr const EFI_GUID gAppleCursorImageGuid = {0x1A10742F, 0xFA80, 0x4B79, {0x9D, 0xA6, 0x35, 0x70, 0x58, 0xCC, 0x39, 0x7B}};
//all these codes are still under the question
/*
constexpr const EFI_GUID GPT_MSDOS_PARTITION = \
{ 0xEBD0A0A2, 0xB9E5, 0x4433,{ 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 }}; //ExFAT
// HFS+ partition - 48465300-0000-11AA-AA11-00306543ECAC
constexpr const EFI_GUID GPT_HFSPLUS_PARTITION = \
{ 0x48465300, 0x0000, 0x11AA, {0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }};
constexpr const EFI_GUID GPT_EMPTY_PARTITION = \
{ 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }};
// turbo - Apple Boot Partition - 426F6F74-0000-11AA-AA11-00306543ECAC //RecoveryHD
// Microsoft Reserved Partition - E3C9E316-0B5C-4DB8-817DF92DF00215AE
EFI_PART_TYPE_LEGACY_MBR_GUID {0x024DEE41, 0x33E7, 0x11D3, {0x9D, 0x69, 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F }};
*/
//constexpr const EFI_GUID ESPGuid = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } };
//TODO - discover the follow guids
//efi/configuration-table/5751DA6E-1376-4E02-BA92-D294FDD30901
//efi/configuration-table/F76761DC-FF89-44E4-9C0C-CD0ADA4EF983
// C5C5DA95-7D5C-45E6-B2F1-3FD52BB10077 - EfiOSInfo
// 03622D6D-362A-4E47-9710-C238B23755C1 - GraphConfig?
// 71B4903C-14EC-42C4-BDC6-CE1449930E49 - WiFi?
// 33BE0EF1-89C9-4A6D-BB9F-69DC8DD516B9 - AppleEvent
// D5B0AC65-9A2D-4D2A-BBD6-E871A95E0435 - UI Theme
// 816749EE-FA96-4853-BF88-2C8AE53B31C9 APPLE_EFI_LOGIN_WINDOW_ENTER_GUID
// 01AAACBA-34AC-42E3-9847-66837DAC5F5E APPLE_EFI_LOGIN_WINDOW_EXIT_GUID
// C649D4F3-D502-4DAA-A139-394ACCF2A63B DEVICE_PATH_PROPERTY_DATABASE
// 5301FE59-1770-4166-A169-00C4BDE4A162 at hibernate = gAppleSMCStateProtocolGuid
// CDEA2BD3-FC25-4C1C-B97C-B31186064990 gEfiBootLogoProtocolGuid
// 13FA7698-C831-49C7-87EA-8F43FCC25196 in ->CreateEventEx(0x200,0x10, ...
// 1C0C34F6-D380-41FA-A049-8AD06C1A66AA gEfiEdidDiscoveredProtocolGuid
// 0ADFB62D-FF74-484C-8944-F85C4BEA87A8 gAmiEfiKeycodeProtocolGuid
// 5D206DD3-516A-47DC-A1BC-6DA204AABE08 OnboardRaidGuid
// AC5E4829-A8FD-440B-AF33-9FFE013B12D8 gApplePlatformInfoDatabaseProtocolGuid
// 1FEDE521-031C-4BC5-8050-F3D6161E2E92
// BD8C1056-9F36-44EC-92A8-A6337F817986 gEfiEdidActiveProtocolGuid
// 26baccba-6f42-11d4-bce7-008081883cc7
// 63FAECF2-E7EE-4CB9-8A0C-11CE5E89E33C protocol at FinalizeBootStruct or DrawBootGraphics
// 03B99B90-ECCF-451D-809E-8341FCB830AC RestartData protocol
// 24B73556-2197-4702-82A8-3E1337DAFBF2 before Firmware password APPLE_SECURE_BOOT_PROTOCOL_GUID
// 24B73556-2197-4702-82A8-3E1337DAFBF3 Apple Trusted Boot enabled configuration
// 1BAD711C-D451-4241-B1F3-8537812E0C70 EFI_GUID for MeBiosExtensionSetup variable
// 36C28AB5-6566-4C50-9EBD-CBB920F83843:preferred-networks gAppleWirelessNetworkVariableGuid
// ->SetVariable(boot-feature-usage, 62BF9B1C-8568-48EE-85DC-DD3057660863, 7, 8, 4C4ABBE8) = Success
// 00 00 08 00 00 00 00 00 | ........
// gAppleFpfConfigurationHobGuid = { 0xE3CC8EC6, 0x81C1, 0x4271, { 0xAC, 0xBC, 0xDB, 0x65, 0x08, 0x6E, 0x8D, 0xC8 }}
// 59D76AE4-37E3-55A7-B460-EF13D46E6020 AppleEncryptedPartitionProtocolGuid
/*
* Convert a string to a GUID.
* First parameter can by of one of these type : char*, char16_t*, char32_t*, wchar_t*, XString8, XString16, XString32, XStringW
*/
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
EFI_STATUS
StrToGuidBE (
const T& t,
OUT EFI_GUID *Guid
)
{
EFI_STATUS Status;
UINT8 GuidLE[16];
if ( Guid == NULL ) {
log_technical_bug("%s : call with Guid==NULL", __PRETTY_FUNCTION__);
return EFI_UNSUPPORTED;
}
#define APPLE_SECURE_BOOT_VARIABLE_GUID \
{ 0x94B73556, 0x2197, 0x4702, \
{ 0x82, 0xA8, 0x3E, 0x13, 0x37, 0xDA, 0xFB, 0xFB } }
auto Str = _xstringarray__char_type<T>::getCharPtr(t);
->SetVariable(ApECID, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 8, 4C4ABC90) = Success
1C 02 1B 03 0D 04 66 05 | ......f.
->SetVariable(ApChipID, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 4, 4C4ABCB4) = Success
12 80 00 00 | ....
->SetVariable(ApBoardID, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 4, 4C4ABCB0) = Success
F0 00 00 00 | ....
->SetVariable(ApSecurityDomain, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 4, 4C4ABCB8) = Success
01 00 00 00 | ....
->SetVariable(ApProductionStatus, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 1, 4C4ABCBD) = Success
01 | .
->SetVariable(ApSecurityMode, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 1, 4C4ABCBD) = Success
01 | .
->SetVariable(EffectiveProductionStatus, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 1, 4C4ABCBD) = Success
01 | .
->SetVariable(EffectiveSecurityMode, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 1, 4C4ABCBD) = Success
01 | .
->SetVariable(CertificateEpoch, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 1, 4C4ABCBF) = Success
02 | .
->SetVariable(MixNMatchPreventionStatus, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 1, 4C4ABCBE) = Success
00 | .
->SetVariable(CryptoDigestMethod, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 10, 4C4ABC70) = Success
73 68 61 32 2D 33 38 34 00 00 00 00 00 00 00 00 | sha2-384........
->SetVariable(HardwareModel, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 10, 4C4ABC60) = Success
78 38 36 6C 65 67 61 63 79 61 70 00 00 00 00 00 | x86legacyap.....
->SetVariable(InternalUseOnlyUnit, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 1, 4C4ABCBD) = Success
01 | .
*/
if ( Str == NULL ) {
memset(Guid, 0, sizeof(EFI_GUID));
return EFI_SUCCESS;
}
Status = StrHToBuf (&GuidLE[0], 4, Str);
if ( Status != EFI_SUCCESS ) return Status;
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
Str ++;
}
if (IS_HYPHEN (*Str)) {
Str++;
} else {
return EFI_UNSUPPORTED;
}
Status = StrHToBuf (&GuidLE[4], 2, Str);
if ( Status != EFI_SUCCESS ) return Status;
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
Str ++;
}
if (IS_HYPHEN (*Str)) {
Str++;
} else {
return EFI_UNSUPPORTED;
}
Status = StrHToBuf (&GuidLE[6], 2, Str);
if ( Status != EFI_SUCCESS ) return Status;
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
Str ++;
}
if (IS_HYPHEN (*Str)) {
Str++;
} else {
return EFI_UNSUPPORTED;
}
Status = StrHToBuf (&GuidLE[8], 2, Str);
if ( Status != EFI_SUCCESS ) return Status;
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
Str ++;
}
if (IS_HYPHEN (*Str)) {
Str++;
} else {
return EFI_UNSUPPORTED;
}
Status = StrHToBuf (&GuidLE[10], 6, Str);
if ( Status != EFI_SUCCESS ) return Status;
if (Guid) {
memcpy((UINT8*)Guid, &GuidLE[0], sizeof(EFI_GUID));
}
return EFI_SUCCESS;
}
XString8 GuidBeToXString8(const EFI_GUID& Guid);
XStringW GuidBeToXStringW(const EFI_GUID& Guid);
XString8 GuidLEToXString8(const EFI_GUID& Guid);
XStringW GuidLEToXStringW(const EFI_GUID& Guid);

View File

@ -128,7 +128,7 @@ XBool EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle)
UINTN Index;
// get device PciIo protocol
Status = gBS->OpenProtocol(PciDevHandle, &gEfiPciIoProtocolGuid, (void **)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
Status = gBS->OpenProtocol(PciDevHandle, gEfiPciIoProtocolGuid, (void **)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)) {
return false;
}

View File

@ -60,8 +60,6 @@
//XBool gSNBEAICPUFixRequire = false; // SandyBridge-E AppleIntelCpuPowerManagement patch require or not
//XBool gBDWEIOPCIFixRequire = false; // Broadwell-E IOPCIFamily fix require or not
extern EFI_GUID gEfiAppleBootGuid;
/*
* the driver OsxAptioFixDrv is old and mostly not used in favour of its successors.
* anyway we will keep it for new investigations.
@ -73,8 +71,8 @@ void LOADER_ENTRY::SetKernelRelocBase()
KernelRelocBase = 0;
// OsxAptioFixDrv will set this
/*Status = */gRT->GetVariable(L"OsxAptioFixDrv-RelocBase", &gEfiAppleBootGuid, NULL, &DataSize, &KernelRelocBase);
DeleteNvramVariable(L"OsxAptioFixDrv-RelocBase", &gEfiAppleBootGuid); // clean up the temporary variable
/*Status = */gRT->GetVariable(L"OsxAptioFixDrv-RelocBase", gEfiAppleBootGuid, NULL, &DataSize, &KernelRelocBase);
DeleteNvramVariable(L"OsxAptioFixDrv-RelocBase", gEfiAppleBootGuid); // clean up the temporary variable
// KernelRelocBase is now either read or 0
return;
}

View File

@ -1675,7 +1675,7 @@ EFI_STATUS read_nVidia_PRAMIN(pci_dt_t *nvda_dev, void* rom, UINT16 arch)
UINT32 old_bar0_pramin = 0;
DBG("read_nVidia_ROM\n");
Status = gBS->OpenProtocol(nvda_dev->DeviceHandle, &gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
Status = gBS->OpenProtocol(nvda_dev->DeviceHandle, gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)) {
return EFI_NOT_FOUND;
}
@ -1758,7 +1758,7 @@ EFI_STATUS read_nVidia_PROM(pci_dt_t *nvda_dev, void* rom)
DBG("PROM\n");
Status = gBS->OpenProtocol(nvda_dev->DeviceHandle,
&gEfiPciIoProtocolGuid,
gEfiPciIoProtocolGuid,
(void**)&PciIo,
gImageHandle,
NULL,

View File

@ -57,48 +57,26 @@ public:
virtual void sprintf(unsigned int ident, XString8* s) const = 0;
void printf(unsigned int ident) const;
virtual void printf() const { printf(0); }
#ifdef JIEF_DEBUG
virtual const TagDict* getDict() const { panic("getDict() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagKey* getKey() const { panic("getKey() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagString* getString() const { panic("getString() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagInt64* getInt64() const { panic("getInt64() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagFloat* getFloat() const { panic("getFloat() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagBool* getBool() const { panic("getBool() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagData* getData() const { panic("getData() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagDate* getDate() const { panic("getDate() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual const TagArray* getArray() const { panic("getArray() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagDict* getDict() { panic("getDict() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagKey* getKey() { panic("getKey() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagString* getString() { panic("getString() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagInt64* getInt64() { panic("getInt64() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagFloat* getFloat() { panic("getFloat() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagBool* getBool() { panic("getBool() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagData* getData() { panic("getData() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagDate* getDate() { panic("getDate() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
virtual TagArray* getArray() { panic("getArray() called on a tag of type %s.", this->getTypeAsXString8().c_str()); }
#else
virtual const TagDict* getDict() const { return NULL; }
virtual const TagKey* getKey() const { return NULL;}
virtual const TagString* getString() const { return NULL; }
virtual const TagInt64* getInt64() const { return NULL; }
virtual const TagFloat* getFloat() const { return NULL; }
virtual const TagBool* getBool() const { return NULL; }
virtual const TagData* getData() const { return NULL; }
virtual const TagDate* getDate() const { return NULL; }
virtual const TagArray* getArray() const { return NULL; }
virtual TagDict* getDict() { return NULL; }
virtual TagKey* getKey() { return NULL; }
virtual TagString* getString() { return NULL; }
virtual TagInt64* getInt64() { return NULL; }
virtual TagFloat* getFloat() { return NULL; }
virtual TagBool* getBool() { return NULL; }
virtual TagData* getData() { return NULL; }
virtual TagDate* getDate() { return NULL; }
virtual TagArray* getArray() { return NULL; }
virtual const TagDict* getDict() const { panic("getDict() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagKey* getKey() const { log_technical_bug("getKey() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagString* getString() const { log_technical_bug("getString() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagInt64* getInt64() const { log_technical_bug("getInt64() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagFloat* getFloat() const { log_technical_bug("getFloat() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagBool* getBool() const { log_technical_bug("getBool() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagData* getData() const { log_technical_bug("getData() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagDate* getDate() const { log_technical_bug("getDate() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual const TagArray* getArray() const { log_technical_bug("getArray() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
#endif
virtual TagDict* getDict() { log_technical_bug("getDict() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagKey* getKey() { log_technical_bug("getKey() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagString* getString() { log_technical_bug("getString() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagInt64* getInt64() { log_technical_bug("getInt64() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagFloat* getFloat() { log_technical_bug("getFloat() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagBool* getBool() { log_technical_bug("getBool() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagData* getData() { log_technical_bug("getData() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagDate* getDate() { log_technical_bug("getDate() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual TagArray* getArray() { log_technical_bug("getArray() called on a tag of type %s.", this->getTypeAsXString8().c_str()); return NULL; }
virtual XBool isDict() const { return false; }
virtual XBool isKey() const { return false; }

View File

@ -50,7 +50,7 @@
EFI_GUID *gTableGuidArray[] = {&gEfiSmbiosTableGuid, &gEfiSmbios3TableGuid};
EFI_GUID gTableGuidArray[] = {gEfiSmbiosTableGuid, gEfiSmbios3TableGuid};
constexpr LString8 unknown = "unknown"_XS8;
@ -193,14 +193,14 @@ void* GetSmbiosTablesFromHob (void)
EFI_PHYSICAL_ADDRESS *Table;
EFI_PEI_HOB_POINTERS GuidHob;
GuidHob.Raw = (__typeof_am__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid);
GuidHob.Raw = (__typeof_am__(GuidHob.Raw))GetFirstGuidHob(gEfiSmbiosTableGuid);
if (GuidHob.Raw != NULL) {
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
if (Table != NULL) {
return (void *)(UINTN)*Table;
}
}
GuidHob.Raw = (__typeof_am__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid);
GuidHob.Raw = (__typeof_am__(GuidHob.Raw))GetFirstGuidHob(gEfiSmbios3TableGuid);
if (GuidHob.Raw != NULL) {
Table = (__typeof_am__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
if (Table != NULL) {
@ -505,19 +505,20 @@ void GetTableType1(SmbiosDiscoveredSettings* smbiosSettings)
return;
}
XString8 getSmUUIDFromSmbios()
EFI_GUID getSmUUIDFromSmbios()
{
// System Information
//
SmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, 0);
if (SmbiosTable.Raw == NULL) {
DBG("SmbiosTable: Type 1 (System Information) not found!\n");
return nullGuidAsString;
return nullGuid;
}
// XString8 g = GuidBeToXString8(SmbiosTable.Type1->Uuid); // should we use the "variant" field to know if it's LE or BE
XString8 g = GuidLEToXString8(SmbiosTable.Type1->Uuid); // 2021-04 : this is a bug, the UUID will be swapped (read as a LE, sent as a BE). I leave for now because it doesn't really matter.
return g;
//// XString8 g = GuidBeToXString8(SmbiosTable.Type1->Uuid); // should we use the "variant" field to know if it's LE or BE
// XString8 g = GuidLEToXString8(SmbiosTable.Type1->Uuid); // 2021-04 : this is a bug, the UUID will be swapped (read as a LE, sent as a BE). I leave for now because it doesn't really matter.
return SmbiosTable.Type1->Uuid;
}
void PatchTableType1(const SmbiosInjectedSettings& smbiosSettings)
@ -543,11 +544,9 @@ void PatchTableType1(const SmbiosInjectedSettings& smbiosSettings)
newSmbiosTable.Type1->WakeUpType = SystemWakeupTypePowerSwitch;
Once = true;
EFI_GUID SmUUID;
// macOs take all guid as BE guid, irrespective to the variant.
StrToGuidBE(smbiosSettings.SmUUID, &SmUUID);
if((SmUUID.Data3 & 0xF000) != 0) {
CopyMem((void*)&newSmbiosTable.Type1->Uuid, (void*)&SmUUID, sizeof(SmUUID));
if((smbiosSettings.SmUUID.Data3 & 0xF000) != 0) {
CopyMem((void*)&newSmbiosTable.Type1->Uuid, (void*)&smbiosSettings.SmUUID, sizeof(smbiosSettings.SmUUID));
}
if( smbiosSettings.ManufactureName.notEmpty() ){

View File

@ -157,7 +157,7 @@ class SmbiosInjectedSettings
XString8 ChassisManufacturer = XString8();
XString8 ChassisAssetTag = XString8();
XString8 FamilyName = XString8();
XString8 SmUUID = XString8();
EFI_GUID SmUUID = EFI_GUID();
XBool NoRomInfo = false;
uint8_t EnabledCores = 0;
XBool TrustSMBIOS = false;
@ -303,7 +303,7 @@ void PatchSmbios(const SmbiosInjectedSettings& smbiosSettings);
void FinalizeSmbios(const SmbiosInjectedSettings& smbiosSettings);
XBool getMobileFromSmbios();
XString8 getSmUUIDFromSmbios();
EFI_GUID getSmUUIDFromSmbios();
extern SmbiosDiscoveredSettings g_SmbiosDiscoveredSettings;

View File

@ -883,12 +883,9 @@ void ScanSPD()
{
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer = NULL;
// EFI_GUID **ProtocolGuidArray;
EFI_PCI_IO_PROTOCOL *PciIo = NULL;
UINTN HandleCount;
// UINTN ArrayCount;
UINTN Index;
// UINTN ProtocolIndex;
PCI_TYPE00 gPci;
DbgHeader("ScanSPD");
@ -941,7 +938,7 @@ void ScanSPD()
if (!EFI_ERROR(Status)) {
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
if (CompareGuid(&gEfiPciIoProtocolGuid, ProtocolGuidArray[ProtocolIndex])) {
Status = gBS->OpenProtocol(HandleBuffer[HandleIndex],&gEfiPciIoProtocolGuid,(void **)&PciIo,gImageHandle,NULL,EFI_OPEN_PROTOCOL_GET_PROTOCOL);
Status = gBS->OpenProtocol(HandleBuffer[HandleIndex],gEfiPciIoProtocolGuid,(void **)&PciIo,gImageHandle,NULL,EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (!EFI_ERROR(Status)) {
// Read PCI BUS

View File

@ -297,10 +297,10 @@ EFI_STATUS SetupBooterLog(XBool AllowGrownSize)
if (MemLogLen > MEM_LOG_INITIAL_SIZE && !AllowGrownSize) {
CHAR8 PrevChar = MemLogBuffer[MEM_LOG_INITIAL_SIZE-1];
MemLogBuffer[MEM_LOG_INITIAL_SIZE-1] = '\0';
Status = LogDataHub(&gEfiMiscSubClassGuid, L"boot-log", MemLogBuffer, MEM_LOG_INITIAL_SIZE);
Status = LogDataHub(gEfiMiscSubClassGuid, L"boot-log", MemLogBuffer, MEM_LOG_INITIAL_SIZE);
MemLogBuffer[MEM_LOG_INITIAL_SIZE-1] = PrevChar;
} else {
Status = LogDataHub(&gEfiMiscSubClassGuid, L"boot-log", MemLogBuffer, (UINT32)MemLogLen);
Status = LogDataHub(gEfiMiscSubClassGuid, L"boot-log", MemLogBuffer, (UINT32)MemLogLen);
}
return Status;

View File

@ -45,6 +45,6 @@ Headers collection for procedures
// Jief : temporary rename
#define AllocateZeroPool AllocateZeroPool
//#define AllocateZeroPool AllocateZeroPool
#endif

View File

@ -43,16 +43,17 @@ const char* efiStrError(EFI_STATUS Status)
return stdio_static_buf.s();
}
//this function print guid in LittleEndian format while we need BigEndian as Apple do
const char* strguid(EFI_GUID* guid)
{
size_t size = stdio_static_buf.allocatedSize();
UINTN n = 0;
n = AsciiSPrint(stdio_static_buf.dataSized(size), size, "%g", guid);
while ( n > size - 2 )
{
size += 10;
n = AsciiSPrint(stdio_static_buf.dataSized(size), size, "%g", guid);
}
return stdio_static_buf.s();
}
//
////this function print guid in LittleEndian format while we need BigEndian as Apple do
//const char* strguid(const EFI_GUID& guid)
//{
// size_t size = stdio_static_buf.allocatedSize();
// UINTN n = 0;
// n = AsciiSPrint(stdio_static_buf.dataSized(size), size, "%g", &guid);
// while ( n > size - 2 )
// {
// size += 10;
// n = AsciiSPrint(stdio_static_buf.dataSized(size), size, "%g", &guid);
// }
// return stdio_static_buf.s();
//}

View File

@ -15,8 +15,7 @@ extern "C" {
#include <Uefi/UefiBaseType.h>
const char* efiStrError(EFI_STATUS errnum);
const char* strguid(EFI_GUID* guid);
//const char* strguid(EFI_GUID* guid);
#ifdef __cplusplus
}

View File

@ -21,8 +21,9 @@ extern "C" {
#include "../../cpp_foundation/XString.h"
static XString8 stdio_static_buf = XString8().takeValueFrom("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX "); // prealloc stdio_static_buf. It has to be at least 2 chars because of 'while ( n > size - 2 )' in strguid and efiStrError
// = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX "_XS8 won't work because allocatedSize() will stay 0
//static XString8 stdio_static_buf = XString8().takeValueFrom("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX "); // prealloc stdio_static_buf. It has to be at least 2 chars because of 'while ( n > size - 2 )' in strguid and efiStrError
// // = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX "_XS8 won't work because allocatedSize() will stay 0
static XStringW stdio_static_wbuf;
int vprintf(const char* format, VA_LIST va)

View File

@ -43,9 +43,9 @@ const char* efiStrError(EFI_STATUS Status)
return efiStrError_buf;
}
//this function print guid in LittleEndian format while we need BigEndian as Apple do
const char* strguid(EFI_GUID* guid)
{
stdio_static_buf.S8Printf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
return stdio_static_buf.s();
}
////this function print guid in LittleEndian format while we need BigEndian as Apple do
//const char* strguid(EFI_GUID* guid)
//{
// stdio_static_buf.S8Printf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
// return stdio_static_buf.s();
//}

View File

@ -12,6 +12,6 @@
// This doesn't compile if compile under posix without all EFI sdk. It's the case for compiling the validator
// It's 2 EFI "utils" that probably shouldn't be here and
const char* efiStrError(EFI_STATUS errnum);
const char* strguid(EFI_GUID* guid);
//const char* strguid(EFI_GUID* guid);
#endif /* PLATFORM_POSIX_POSIX_ADDITIONS_H_ */

View File

@ -9,59 +9,274 @@
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#include <Efi.h>
//#include <Library/MemLogLib.h>
#include "../Platform/DataHubCpu.h"
#include "../Platform/Settings.h"
#include "../Settings/Self.h"
#include "../Platform/guid.h"
/** Prints Number of bytes in a row (hex and ascii). Row size is MaxNumber. */
void
PrintBytesRow(IN UINT8 *Bytes, IN UINTN Number, IN UINTN MaxNumber)
{
UINTN Index;
// print hex vals
for (Index = 0; Index < Number; Index++) {
DebugLog(1, "%02hhX ", Bytes[Index]);
}
// pad to MaxNumber if needed
for (; Index < MaxNumber; Index++) {
DebugLog(1, " ");
}
DebugLog(1, "| ");
// print ASCII
for (Index = 0; Index < Number; Index++) {
if (Bytes[Index] >= 0x20 && Bytes[Index] <= 0x7e) {
DebugLog(1, "%c", (CHAR16)Bytes[Index]);
} else {
DebugLog(1, "%c", L'.');
}
}
DebugLog(1, "\n");
}
#ifndef DEBUG_ALL
#define DEBUG_BOOTLOG 0
#else
#define DEBUG_BOOTLOG DEBUG_ALL
#endif
/** Prints series of bytes. */
void
PrintBytes(IN void *Bytes, IN UINTN Number)
{
UINTN Index;
for (Index = 0; Index < Number; Index += 16) {
PrintBytesRow((UINT8*)Bytes + Index, ((Index + 16 < Number) ? 16 : (Number - Index)), 16);
}
}
#if DEBUG_BOOTLOG == 0
#define DBG(...)
#else
#define DBG(...) DebugLog (DEBUG_BOOTLOG, __VA_ARGS__)
#endif
XBool gEnableCloverLog = false;
// Changed MsgLog(...) it now calls this function
// with DebugMode == 0. - apianti
// DebugMode==0 Prints to msg log, only output to log on SaveBooterLog
// DebugMode==1 Prints to msg log and DEBUG_LOG
// DebugMode==2 Prints to msg log, DEBUG_LOG and display console
//void EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage);
//
//
///** Prints Number of bytes in a row (hex and ascii). Row size is MaxNumber. */
//void
//PrintBytesRow(IN UINT8 *Bytes, IN UINTN Number, IN UINTN MaxNumber)
//{
// UINTN Index;
//
// // print hex vals
// for (Index = 0; Index < Number; Index++) {
// DebugLog(1, "%02hhX ", Bytes[Index]);
// }
//
// // pad to MaxNumber if needed
// for (; Index < MaxNumber; Index++) {
// DebugLog(1, " ");
// }
//
// DebugLog(1, "| ");
//
// // print ASCII
// for (Index = 0; Index < Number; Index++) {
// if (Bytes[Index] >= 0x20 && Bytes[Index] <= 0x7e) {
// DebugLog(1, "%c", (CHAR16)Bytes[Index]);
// } else {
// DebugLog(1, "%c", L'.');
// }
// }
//
// DebugLog(1, "\n");
//}
//
///** Prints series of bytes. */
//void
//PrintBytes(IN void *Bytes, IN UINTN Number)
//{
// UINTN Index;
//
// for (Index = 0; Index < Number; Index += 16) {
// PrintBytesRow((UINT8*)Bytes + Index, ((Index + 16 < Number) ? 16 : (Number - Index)), 16);
// }
//}
//
//static XStringW debugLogFileName;
//static EFI_FILE_PROTOCOL* gLogFile = NULL;
//// Do not keep a pointer to MemLogBuffer. Because a reallocation, it could become invalid.
//
//int g_OpeningLogFile = 0;
//
//
//// Avoid debug looping. TO be able to call DBG from inside function that DBG calls, we need to suspend callback to avoid a loop.
//// Just instanciante this, the destructor will restore the callback.
//class SuspendMemLogCallback
//{
// MEM_LOG_CALLBACK memlogCallBack_saved = NULL;
//public:
// SuspendMemLogCallback() {
// memlogCallBack_saved = GetMemLogCallback();
// SetMemLogCallback(NULL);
// };
// ~SuspendMemLogCallback() { SetMemLogCallback(memlogCallBack_saved); };
//};
//
//#if DEBUG_BOOTLOG == 0
//#define DGB_nbCallback(...)
//#else
//#define DGB_nbCallback(...) do { SuspendMemLogCallback smc; DBG(__VA_ARGS__); } while (0)
//#endif
//
//void closeDebugLog()
//{
//// EFI_STATUS Status;
//
// if ( !gLogFile ) return;
//
// SuspendMemLogCallback smc;
//
// /*Status =*/ gLogFile->Close(gLogFile);
// gLogFile = NULL;
// //DGB_nbCallback("closeDebugLog() -> %s\n", efiStrError(Status));
//}
//
///*
// * Use (or not) self.getCloverDir() to open log file.
// * Not using self has the advantage of being able to generate a log even after uninitreflib().
// * The only thing needed is gImageHandle. But because it's a parameter to main entry point, value can't be wrong.
// * Drawback is that code to find current working directory has to be duplicated.
// */
////#define USE_SELF_INSTANCE
//static UINTN GetDebugLogFile()
//{
// EFI_STATUS Status;
// EFI_FILE_PROTOCOL *LogFile;
//
// if ( gLogFile ) return 0;
//
// #ifdef USE_SELF_INSTANCE
// if ( !self.isInitialized() ) return 0;
// #endif
//
// g_OpeningLogFile = 1;
//
// EFI_TIME Now;
// Status = gRT->GetTime(&Now, NULL);
// if ( EFI_ERROR(Status) ) {
// DBG("GetTime return %s\n", efiStrError(Status));
// }
//
// #ifdef USE_SELF_INSTANCE
// const EFI_FILE_PROTOCOL& CloverDir = self.getCloverDir();
// const XString& efiFileName = self.getCloverEfiFileName();
// #else
// XStringW efiFileName;
// const EFI_FILE_PROTOCOL* CloverDirPtr = Self::getCloverDirAndEfiFileName(gImageHandle, &efiFileName);
// if ( CloverDirPtr == NULL ) return 0;
// const EFI_FILE_PROTOCOL& CloverDir = *CloverDirPtr;
// #endif
//
// if ( debugLogFileName.isEmpty() )
// {
// debugLogFileName = S8Printf("misc\\%04d-%02d-%02d_%02d-%02d_%ls.log", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, efiFileName.wc_str());
// Status = CloverDir.Open(&CloverDir, &LogFile, debugLogFileName.wc_str(), EFI_FILE_MODE_READ, 0);
// if ( !EFI_ERROR(Status) ) LogFile->Close(LogFile); // DO NOT modify Status here.
// INTN i=1;
// while ( Status != EFI_NOT_FOUND && (i < MAX_INTN) ) {
// debugLogFileName = S8Printf("misc\\%04d-%02d-%02d_%02d-%02d_%ls(%lld).log", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, efiFileName.wc_str(), i);
// Status = CloverDir.Open(&CloverDir, &LogFile, debugLogFileName.wc_str(), EFI_FILE_MODE_READ, 0);
// if ( !EFI_ERROR(Status) ) LogFile->Close(LogFile); // DO NOT modify Status here.
// }
// if ( Status != EFI_NOT_FOUND ) {
// DBG("Cannot find a free debug log file name\n"); // I can't imagine that to happen...
// debugLogFileName.setEmpty(); // To allow to retry at the next call
// g_OpeningLogFile = 0;
// return 0;
// }
// Status = CloverDir.Open(&CloverDir, &LogFile, debugLogFileName.wc_str(), EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
// gLogFile = LogFile;
// g_OpeningLogFile = 0;
// return 0;
// }else{
// Status = CloverDir.Open(&CloverDir, &LogFile, debugLogFileName.wc_str(), EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
// g_OpeningLogFile = 0;
//
////// Jief : Instead of EfiLibFileInfo, let's use SetPosition to get the size.
//// if (!EFI_ERROR(Status)) {
//// EFI_FILE_INFO *Info = EfiLibFileInfo(LogFile);
//// if (Info) {
//// Status = LogFile->SetPosition(LogFile, Info->FileSize);
//// if ( EFI_ERROR(Status) ) {
//// DBG("SaveMessageToDebugLogFile SetPosition error %s\n", efiStrError(Status));
//// }
//// }
//// }
//
// if (!EFI_ERROR(Status)) {
// Status = LogFile->SetPosition(LogFile, 0xFFFFFFFFFFFFFFFFULL);
// if ( EFI_ERROR (Status) ) {
// DGB_nbCallback("GetDebugLogFile() -> Cannot set log position to 0xFFFFFFFFFFFFFFFFULL : %s\n", efiStrError(Status));
// LogFile->Close(LogFile);
// }else{
// UINTN size;
// Status = LogFile->GetPosition(LogFile, &size);
// if ( EFI_ERROR (Status) ) {
// DGB_nbCallback("GetDebugLogFile() -> Cannot get log position : %s\n", efiStrError(Status));
// LogFile->Close(LogFile);
// }else{
// //DGB_nbCallback("GetDebugLogFile() -> opened. log position = %lld (lwo %lld)\n", size, lastWrittenOffset);
// gLogFile = LogFile;
// return size;
// }
// }
// }
// return 0;
// }
//}
//
//VOID SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
//{
// EFI_STATUS Status;
//
// UINTN lastWrittenOffset = GetDebugLogFile();
//
// if ( gLogFile == NULL ) return;
//
// // Write out this message
// const char* lastWrittenPointer = GetMemLogBuffer() + lastWrittenOffset;
// UINTN TextLen = strlen(lastWrittenPointer);
// UINTN TextLen2 = TextLen;
//
// Status = gLogFile->Write(gLogFile, &TextLen2, lastWrittenPointer);
// lastWrittenOffset += TextLen2;
// if ( EFI_ERROR(Status) ) {
// DGB_nbCallback("SaveMessageToDebugLogFile write error %s\n", efiStrError(Status));
// closeDebugLog();
// }else{
// if ( TextLen2 != TextLen ) {
// DGB_nbCallback("SaveMessageToDebugLogFile TextLen2(%lld) != TextLen(%lld)\n", TextLen2, TextLen);
// closeDebugLog();
// }else{
// // Not all Firmware implements Flush. So we have to close everytime to force flush. Let's Close() instead of Flush()
// // Is there a performance difference ? Is it worth to create a setting ? Probably not...
//// Status = LogFile->Flush(LogFile);
//// if ( EFI_ERROR(Status) ) {
//// DGB_nbCallback("SaveMessageToDebugLogFile Cannot flush error %s\n", efiStrError(Status));
//// closeDebugLog();
//// }
// }
// }
// // Not all Firmware implements Flush. So we have to close every time to force flush.
// closeDebugLog();
//}
//
//void EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
//{
// // Print message to console
// if (DebugMode >= 2) {
// printf("%s", LastMessage);
// }
//
// if ((DebugMode >= 1) && gSettings.Boot.DebugLog) {
// SuspendMemLogCallback smc;
// SaveMessageToDebugLogFile(LastMessage);
// }
//}
//
//// Changed MsgLog(...) it now calls this function
//// with DebugMode == 0. - apianti
//// DebugMode==0 Prints to msg log, only output to log on SaveBooterLog
//// DebugMode==1 Prints to msg log and DEBUG_LOG
//// DebugMode==2 Prints to msg log, DEBUG_LOG and display console
//void EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...)
//{
// VA_LIST Marker;
// //UINTN offset = 0;
//
// // Make sure the buffer is intact for writing
// if (FormatString == NULL || DebugMode < 0) {
// return;
// }
//
// // Print message to log buffer
// VA_START(Marker, FormatString);
// MemLogfVA(true, DebugMode, FormatString, Marker);
// VA_END(Marker);
//}
void EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...)
{
if ( !gEnableCloverLog ) return;
// if ( !gEnableCloverLog ) return;
VA_LIST Marker;
// Make sure the buffer is intact for writing
@ -77,64 +292,85 @@ void EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...)
#endif
VA_END(Marker);
}
void DbgHeader(CONST CHAR8 *str)
{
CHAR8 strLog[50];
size_t len;
int end = snprintf(strLog, 50, "=== [ %s ] ", str);
if ( end < 0 ) return;
len = 50 - (unsigned int)end;
memset(&strLog[end], '=', len);
strLog[49] = '\0';
DebugLog (1, "%s\n", strLog);
}
void closeDebugLog()
{
}
EFI_STATUS
SaveBooterLog (
const EFI_FILE* BaseDir OPTIONAL,
const CHAR16 *FileName
)
{
return EFI_SUCCESS;
}
EFI_STATUS
SetupBooterLog (
BOOLEAN AllowGrownSize
)
{
return EFI_SUCCESS;
}
void
InitBooterLog (void)
{
}
void EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...)
{
VA_LIST Marker;
//UINTN offset = 0;
// Make sure the buffer is intact for writing
if (FormatString == NULL ) {
return;
}
// Print message to log buffer
VA_START(Marker, FormatString);
printf(FormatString, Marker);
VA_END(Marker);
}
//
//void InitBooterLog(void)
//{
// SetMemLogCallback(MemLogCallback);
//}
//
//
//EFI_STATUS SetupBooterLog(XBool AllowGrownSize)
//{
// EFI_STATUS Status = EFI_SUCCESS;
// CHAR8 *MemLogBuffer;
// UINTN MemLogLen;
//
// MemLogBuffer = GetMemLogBuffer();
// MemLogLen = GetMemLogLen();
//
// if (MemLogBuffer == NULL || MemLogLen == 0) {
// return EFI_NOT_FOUND;
// }
//
// if (MemLogLen > MEM_LOG_INITIAL_SIZE && !AllowGrownSize) {
// CHAR8 PrevChar = MemLogBuffer[MEM_LOG_INITIAL_SIZE-1];
// MemLogBuffer[MEM_LOG_INITIAL_SIZE-1] = '\0';
// Status = LogDataHub(gEfiMiscSubClassGuid, L"boot-log", MemLogBuffer, MEM_LOG_INITIAL_SIZE);
// MemLogBuffer[MEM_LOG_INITIAL_SIZE-1] = PrevChar;
// } else {
// Status = LogDataHub(gEfiMiscSubClassGuid, L"boot-log", MemLogBuffer, (UINT32)MemLogLen);
// }
//
// return Status;
//}
//
//// Made msgbuf and msgCursor private to this source
//// so we need a different way of saving the msg log - apianti
//EFI_STATUS SaveBooterLog(const EFI_FILE* BaseDir OPTIONAL, IN CONST CHAR16 *FileName)
//{
// CHAR8 *MemLogBuffer;
// UINTN MemLogLen;
//
// MemLogBuffer = GetMemLogBuffer();
// MemLogLen = GetMemLogLen();
//
// if (MemLogBuffer == NULL || MemLogLen == 0) {
// return EFI_NOT_FOUND;
// }
//
// return egSaveFile(BaseDir, FileName, (UINT8*)MemLogBuffer, MemLogLen);
//}
//
//void DbgHeader(CONST CHAR8 *str)
//{
// CHAR8 strLog[50];
// INTN len;
// UINTN end = snprintf(strLog, 50, "=== [ %s ] ", str);
// len = 50 - end;
//
// SetMem(&strLog[end], len , '=');
// strLog[49] = '\0';
// DebugLog (1, "%s\n", strLog);
//}
//
//
//
///*
// * Redirection of OpenCore log to Clover Log.
// */
//
///*
// * This function is called from OpenCore when there is a DEBUG ((expression))
// * Mapping from DEBUG to DebugLogForOC is made in OpenCoreFromClover.h
// */
//void EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...)
//{
// VA_LIST Marker;
//
// if (FormatString == NULL ) return;
//
// // Print message to log buffer
// VA_START(Marker, FormatString);
// MemLogVA(true, 1, FormatString, Marker);
// VA_END(Marker);
//}

View File

@ -13,8 +13,10 @@
//}
//#endif
bool stop_at_panic = true;
bool i_have_panicked = false;
#ifdef PANIC_CAN_RETURN
bool stop_at_panic = true;
bool i_have_panicked = false;
#endif
/*
*
@ -37,6 +39,9 @@ static void panic_(const char* format, VA_LIST va)
abort();
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-noreturn"
void panic(const char* format, ...)
{
#ifdef PANIC_CAN_RETURN
@ -54,6 +59,7 @@ void panic(const char* format, ...)
panic_(format, va); // panic doesn't return
#endif
}
#pragma clang diagnostic pop
/*
* Future version to warn about problem but offer the possibility to try to continue

View File

@ -9,8 +9,10 @@
#define bool unsigned char
#endif
extern bool stop_at_panic;
extern bool i_have_panicked;
#ifdef PANIC_CAN_RETURN
extern bool stop_at_panic;
extern bool i_have_panicked;
#endif
#ifdef __cplusplus // C cannot accept 2 functions with same name and different parameters.
#if !defined(PANIC_CAN_RETURN) && defined(_MSC_VER)
@ -51,6 +53,7 @@ void log_technical_bug(const char* format, ...) __attribute__((__format__(__prin
void _assert(bool b, const char* format, ...) __attribute__((__format__(__printf__, 2, 3)));
#ifdef __cplusplus
#ifdef PANIC_CAN_RETURN
class DontStopAtPanic
{
public:
@ -58,5 +61,6 @@ class DontStopAtPanic
~DontStopAtPanic() { stop_at_panic = true; i_have_panicked = false; }
};
#endif
#endif
#endif

View File

@ -734,7 +734,7 @@ void ConfigManager::applySettings() const
}
if ( configPlist.RtVariables.dgetBooterCfgStr().isEmpty() )
{
CHAR8* OldCfgStr = (CHAR8*)GetNvramVariable(L"bootercfg", &gEfiAppleBootGuid, NULL, NULL);
CHAR8* OldCfgStr = (CHAR8*)GetNvramVariable(L"bootercfg", gEfiAppleBootGuid, NULL, NULL);
if ( OldCfgStr )
{
gSettings.RtVariables.BooterCfgStr.takeValueFrom(OldCfgStr);
@ -784,7 +784,7 @@ void ConfigManager::applySettings() const
gSettings.CPU.UseARTFreq = true;
}
}
if ( gSettings.Smbios.SmUUID == nullGuidAsString )
if ( gSettings.Smbios.SmUUID.isNull() )
{
gSettings.Smbios.SmUUID = getSmUUIDFromSmbios();
}

View File

@ -22,7 +22,7 @@ public:
using super = XmlString8AllowEmpty;
virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override {
bool b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors);
if ( !IsValidGuidString(xstring8) ) b = xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid GUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine()));
if ( !EFI_GUID::IsValidGuidString(xstring8) ) b = xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid GUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine()));
return b;
}
};
@ -31,12 +31,12 @@ public:
XmlBool Disabled = XmlBool();
XmlStringW Name = XmlStringW();
public:
GuidClass Guid = GuidClass();
GuidClass GuidString = GuidClass();
XmlDictField m_fields[4] = {
{"Comment", Comment},
{"Disabled", Disabled},
{"Guid", Guid},
{"Guid", GuidString},
{"Name", Name},
};
@ -47,11 +47,12 @@ public:
const decltype(Disabled)::ValueType& dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : Disabled.nullValue; };
uint8_t dgetBValue() const { return Disabled.isDefined() ? Disabled.value() : Disabled.nullValue; };
const EFI_GUID dgetGuid() const {
if ( GuidString.isDefined() ) {
// EFI_STATUS Status = StrToGuidBE(Guid.value(), &efiGuid);
// if ( EFI_ERROR(Status) ) panic("StrToGuidBE failed. This could not happen because Guid is checked to be valid. Did you comment out the field validation ?");
EFI_GUID efiGuid;
EFI_STATUS Status;
if ( Guid.isDefined() ) {
Status = StrToGuidBE(Guid.value(), &efiGuid);
if ( EFI_ERROR(Status) ) panic("StrToGuidBE failed. This could not happen because Guid is checked to be valid. Did you comment out the field validation ?");
efiGuid.takeValueFromBE(GuidString.value());
if ( efiGuid.isNull() ) panic("StrToGuidBE failed. This could not happen because Guid is checked to be valid. Did you comment out the field validation ?");
return efiGuid;
}
return nullGuid;

View File

@ -27,7 +27,7 @@ public:
using super = XmlString8AllowEmpty;
virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override {
bool b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors);
if ( !IsValidGuidString(xstring8) ) b = xmlLiteParser->addWarning(generateErrors, S8Printf(" invalid CustomUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine()));
if ( !EFI_GUID::IsValidGuidString(xstring8) ) b = xmlLiteParser->addWarning(generateErrors, S8Printf(" invalid CustomUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine()));
return b;
}
};
@ -73,7 +73,12 @@ public:
XBool dgetNoCaches() const { return NoCaches.isDefined() ? NoCaches.value() : XBool(false); }
XBool dgetBacklightLevelConfig() const { return BacklightLevel.isDefined(); }
uint16_t dgetBacklightLevel() const { return BacklightLevel.isDefined() && BacklightLevel.xmlInt16.isDefined() ? BacklightLevel.xmlInt16.value() : 0xFFFF; }
const XString8& dgetCustomUuid() const { return CustomUUID.isDefined() ? CustomUUID.value() : NullXString8; }
EFI_GUID dgetCustomUuid() const {
if ( !CustomUUID.isDefined() ) return nullGuid;
EFI_GUID g;
g.takeValueFrom(CustomUUID.value());
return g;
}
UINT8 dget_InjectSystemID() const { return InjectSystemID.isDefined() ? (int)InjectSystemID.value() : 2; }
XBool dgetNvidiaWeb() const { return NvidiaWeb.isDefined() ? NvidiaWeb.value() : XBool(false); }
};

View File

@ -20,6 +20,7 @@
#include "../../entry_scan/loader.h" // for KERNEL_SCAN_xxx constants
#include <IndustryStandard/SmBios.h> // for Smbios memory type
#include "../../Platform/guid.h"
#include "../../include/Guid++.h"
#include "../../Platform/platformdata.h"
#include "../../Platform/smbios.h"
#include "../../Platform/VersionString.h" // for AsciiStrVersionToUint64
@ -363,7 +364,7 @@ public:
protected:
virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override {
bool b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors);
if ( !IsValidGuidString(xstring8) ) b = xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid SmUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine()));
if ( !EFI_GUID::IsValidGuidString(xstring8) ) b = xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid SmUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine()));
return b;
}
};
@ -667,7 +668,13 @@ public:
return ApplePlatformDataArray[dgetModel()].serialNumber;
};
decltype(SmUUID)::ValueType dgetSmUUID() const { return SmUUID.isDefined() ? SmUUID.value() : nullGuidAsString; };
EFI_GUID dgetSmUUID() const {
if ( !SmUUID.isDefined() ) return nullGuid;
EFI_GUID g;
g.takeValueFrom(SmUUID.value());
if ( g.isNull() ) panic("SmUUID is not valid. This could not happen because SmUUID is checked to be valid. Did you comment out the validation ?");
return g;
}
decltype(Family)::ValueType dgetFamilyName() const {
if ( Family.isDefined() ) return Family.value();

View File

@ -23,7 +23,7 @@
#include "xml_lite-test.h"
#include "config-test.h"
#include "XToolsCommon_test.h"
#include "../Platform/guid.h"
#include "guid_tests.h"
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
#include "printlib-test.h"
@ -99,6 +99,11 @@ if ( ret != 0 ) {
all_ok = false;
}
#endif
ret = guid_tests();
if ( ret != 0 ) {
printf("guid_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = strlen_tests();
if ( ret != 0 ) {
printf("strlen_tests() failed at test %d\n", ret);

View File

@ -0,0 +1,255 @@
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#include "../cpp_foundation/XString.h"
#include "../cpp_foundation/unicode_conversions.h"
#include "../Platform/guid.h"
static int breakpoint(int i)
{
return i;
}
int guid_tests()
{
#ifdef JIEF_DEBUG
// printf("XStringW_tests -> Enter\n");
#endif
{
// uncomment to check that it fails at compile time
// empty string
//constexpr const EFI_GUID guidTest1 = ""_guid; (void)guidTest1;
// one non-hex letter in definition
//constexpr const EFI_GUID guidTest2 = "{12345678-4321-87X5-1122-334455667788}"_guid; (void)guidTest2;
// one char missing
//constexpr const EFI_GUID guidTest3 = "{12345678-4321-8715-1122-33445566778}"_guid; (void)guidTest3;
// one char too many
//constexpr const EFI_GUID guidTest4 = "{12345678-4321-8715-1122-3344556677881}"_guid; (void)guidTest4;
}
{
// uncomment to check that it's panicking. Not great that it's panicking, but silently fail would be worse. Anyway, only the constexpr version must be used, therefore catching errors at compile time.
// empty string
// const EFI_GUID guidTest1 = ""_guid; (void)guidTest1;
// one non-hex letter in definition
// const EFI_GUID guidTest2 = "{12345678-4321-87X5-1122-334455667788}"_guid; (void)guidTest2;
// one char missing
// const EFI_GUID guidTest3 = "{12345678-4321-8715-1122-33445566778}"_guid; (void)guidTest3;
// one char too many
// const EFI_GUID guidTest4 = "{12345678-4321-8715-1122-3344556677881}"_guid; (void)guidTest4;
}
{
if ( !EFI_GUID::IsValidGuidString("00112233-4455-6677-C899-AABBCCDDEEFF"_XS8) ) return breakpoint(1);
if ( EFI_GUID::IsValidGuidString("00112233-4455-6677-C899-AABBCCDDEEFZ"_XS8) ) return breakpoint(1);
if ( !EFI_GUID::IsValidGuidString("{00112233-4455-6677-C899-AABBCCDDEEFF}"_XS8) ) return breakpoint(1);
if ( EFI_GUID::IsValidGuidString("{00112233-4455-6677-C899-AABBCCDDEEFZ}"_XS8) ) return breakpoint(1);
}
#ifdef PANIC_CAN_RETURN // 2022-04 : PANIC_CAN_RETURN doesn't work yet.
{
// uncomment to check that it fails at compile time
{
DontStopAtPanic dontStopAtPanic;
// empty string
const EFI_GUID guidTest1 = ""_guid; (void)guidTest1;
if ( !i_have_panicked ) return breakpoint(3);
}
// one non-hex letter in definition
const EFI_GUID guidTest2 = "{12345678-4321-87X5-1122-334455667788}"_guid; (void)guidTest2;
// one char missing
const EFI_GUID guidTest3 = "{12345678-4321-8715-1122-33445566778}"_guid; (void)guidTest3;
// one char too many
const EFI_GUID guidTest4 = "{12345678-4321-8715-1122-3344556677881}"_guid; (void)guidTest4;
}
#endif
{
EFI_GUID guidTest;
XString8 s = "00112233-4455-6677-8899-aabbccddeeff"_XS8; // Variant 1. Stored as BE. Means, in memory 00112233 will be 00112233, but will be seen in debugger as 33221100
guidTest.takeValueFromBE(s);
if ( guidTest.Data1 != 0x33221100 ) return breakpoint(1); // being on a LE machine, BE value appears to be swapped.
if ( guidTest.Data2 != 0x5544 ) return breakpoint(2);
if ( guidTest.Data3 != 0x7766 ) return breakpoint(3);
if ( guidTest.Data4[1] != 0x99 ) return breakpoint(5);
if ( guidTest.Data4[2] != 0xaa ) return breakpoint(6);
if ( guidTest.Data4[3] != 0xbb ) return breakpoint(7);
if ( guidTest.Data4[4] != 0xcc ) return breakpoint(8);
if ( guidTest.Data4[5] != 0xdd ) return breakpoint(9);
if ( guidTest.Data4[6] != 0xee ) return breakpoint(10);
if ( guidTest.Data4[7] != 0xff ) return breakpoint(11);
XString8 guidTestAsString = guidTest.toXString8(true);
if ( guidTestAsString != "00112233-4455-6677-8899-AABBCCDDEEFF"_XS8 ) return breakpoint(10);
}
{
EFI_GUID guidTest;
XString8 s = "{00112233-4455-6677-8899-aabbccddeeff}"_XS8; // Variant 1. Stored as BE. Means, in memory 00112233 will be 00112233, but will be seen in debugger as 33221100
guidTest.takeValueFromBE(s);
if ( guidTest.Data1 != 0x33221100 ) return breakpoint(1); // being on a LE machine, BE value appears to be swapped.
if ( guidTest.Data2 != 0x5544 ) return breakpoint(2);
if ( guidTest.Data3 != 0x7766 ) return breakpoint(3);
if ( guidTest.Data4[1] != 0x99 ) return breakpoint(5);
if ( guidTest.Data4[2] != 0xaa ) return breakpoint(6);
if ( guidTest.Data4[3] != 0xbb ) return breakpoint(7);
if ( guidTest.Data4[4] != 0xcc ) return breakpoint(8);
if ( guidTest.Data4[5] != 0xdd ) return breakpoint(9);
if ( guidTest.Data4[6] != 0xee ) return breakpoint(10);
if ( guidTest.Data4[7] != 0xff ) return breakpoint(11);
XString8 guidTestAsString = guidTest.toXString8(true);
if ( guidTestAsString != "00112233-4455-6677-8899-AABBCCDDEEFF"_XS8 ) return breakpoint(10);
}
{
EFI_GUID guidTest;
XString8 s = "00112233-4455-6677-C899-aabbccddeeff"_XS8; // Variant 2. Value store as LE.
guidTest.takeValueFrom(s);
if ( guidTest.Data1 != 0x00112233 ) return breakpoint(21); // being on a LE machine, BE value appears to be swapped.
if ( guidTest.Data2 != 0x4455 ) return breakpoint(22);
if ( guidTest.Data3 != 0x6677 ) return breakpoint(23);
if ( guidTest.Data4[0] != 0xC8 ) return breakpoint(4);
if ( guidTest.Data4[1] != 0x99 ) return breakpoint(5);
if ( guidTest.Data4[2] != 0xaa ) return breakpoint(6);
if ( guidTest.Data4[3] != 0xbb ) return breakpoint(7);
if ( guidTest.Data4[4] != 0xcc ) return breakpoint(8);
if ( guidTest.Data4[5] != 0xdd ) return breakpoint(9);
if ( guidTest.Data4[6] != 0xee ) return breakpoint(10);
if ( guidTest.Data4[7] != 0xff ) return breakpoint(11);
XString8 guidTestAsString = guidTest.toXString8();
if ( guidTestAsString != "00112233-4455-6677-C899-AABBCCDDEEFF"_XS8 ) return breakpoint(10);
}
{
EFI_GUID guidTest;
XString8 s = "{00112233-4455-6677-C899-aabbccddeeff}"_XS8; // Variant 2. Value store as LE.
guidTest.takeValueFrom(s);
if ( guidTest.Data1 != 0x00112233 ) return breakpoint(21); // being on a LE machine, BE value appears to be swapped.
if ( guidTest.Data2 != 0x4455 ) return breakpoint(22);
if ( guidTest.Data3 != 0x6677 ) return breakpoint(23);
if ( guidTest.Data4[0] != 0xC8 ) return breakpoint(4);
if ( guidTest.Data4[1] != 0x99 ) return breakpoint(5);
if ( guidTest.Data4[2] != 0xaa ) return breakpoint(6);
if ( guidTest.Data4[3] != 0xbb ) return breakpoint(7);
if ( guidTest.Data4[4] != 0xcc ) return breakpoint(8);
if ( guidTest.Data4[5] != 0xdd ) return breakpoint(9);
if ( guidTest.Data4[6] != 0xee ) return breakpoint(10);
if ( guidTest.Data4[7] != 0xff ) return breakpoint(11);
XString8 guidTestAsString = guidTest.toXString8();
if ( guidTestAsString != "00112233-4455-6677-C899-AABBCCDDEEFF"_XS8 ) return breakpoint(10);
}
// if ( sizeof(EFI_GUID) != sizeof(EFI_GUID) ) return 1;
// {
// constexpr EFI_GUID guidTest0 = {0x12345678, 0x4321, 0xC765, {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}};
// if ( guidTest0.Data1 != 0x12345678 ) return 1;
// if ( guidTest0.Data2 != 0x4321 ) return 2;
// if ( guidTest0.Data3 != 0xC765 ) return 3;
// if ( guidTest0.Data4[0] != 0x11 ) return 4;
// if ( guidTest0.Data4[1] != 0x22 ) return 4;
// if ( guidTest0.Data4[2] != 0x33 ) return 4;
// if ( guidTest0.Data4[3] != 0x44 ) return 4;
// if ( guidTest0.Data4[4] != 0x55 ) return 4;
// if ( guidTest0.Data4[5] != 0x66 ) return 4;
// if ( guidTest0.Data4[6] != 0x77 ) return 4;
// if ( guidTest0.Data4[7] != 0x88 ) return 4;
//
// constexpr EFI_GUID guidTest1 = {0x12345678, 0x4321, 0xC765, {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}};
// if ( guidTest1.Data1 != 0x12345678 ) return 1;
// if ( guidTest1.Data2 != 0x4321 ) return 2;
// if ( guidTest1.Data3 != 0xC765 ) return 3;
// if ( guidTest1.Data4[0] != 0x11 ) return 4;
// if ( guidTest1.Data4[1] != 0x22 ) return 4;
// if ( guidTest1.Data4[2] != 0x33 ) return 4;
// if ( guidTest1.Data4[3] != 0x44 ) return 4;
// if ( guidTest1.Data4[4] != 0x55 ) return 4;
// if ( guidTest1.Data4[5] != 0x66 ) return 4;
// if ( guidTest1.Data4[6] != 0x77 ) return 4;
// if ( guidTest1.Data4[7] != 0x88 ) return 4;
//
// if ( memcmp(&guidTest1, &guidTest0, sizeof(EFI_GUID)) != 0 ) return 1;
// }
// constexpr EFI_GUID efiguidTestRef1 = {0x12345678, 0x4321, 0x8765, {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}};
constexpr EFI_GUID guidTestRef1 = {0x12345678, 0x4321, 0x8765, {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}};
// if ( guidTestRef1 != efiguidTestRef1 ) return breakpoint(10);
{
EFI_GUID guidTest2 = {0x12345678, 0x4321, 0x8765, {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}};
if ( guidTest2 != guidTestRef1 ) return breakpoint(10);
}
{
constexpr EFI_GUID guidTest3 = {0x12345678, 0x4321, 0x8765, {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x89}};
if ( guidTest3 == guidTestRef1 ) return breakpoint(10);
}
{
constexpr EFI_GUID guidTest4(guidTestRef1); // copy ctor
if ( guidTest4 != guidTestRef1 ) return breakpoint(10);
}
{
EFI_GUID guidTest5; // assignment
guidTest5 = guidTestRef1;
if ( guidTest5 != guidTestRef1 ) return breakpoint(10);
}
{
EFI_GUID guidTestNull;
if ( guidTestNull.Data1 != 0 ) return breakpoint(1);
if ( guidTestNull.Data2 != 0 ) return breakpoint(2);
if ( guidTestNull.Data3 != 0 ) return breakpoint(3);
if ( guidTestNull.Data4[0] != 0 ) return breakpoint(4);
if ( guidTestNull.Data4[1] != 0 ) return breakpoint(4);
if ( guidTestNull.Data4[2] != 0 ) return breakpoint(4);
if ( guidTestNull.Data4[3] != 0 ) return breakpoint(4);
if ( guidTestNull.Data4[4] != 0 ) return breakpoint(4);
if ( guidTestNull.Data4[5] != 0 ) return breakpoint(4);
if ( guidTestNull.Data4[6] != 0 ) return breakpoint(4);
if ( guidTestNull.Data4[7] != 0 ) return breakpoint(4);
}
{
constexpr const EFI_GUID guidTest6 = "{12345678-4321-8765-1122-334455667788}"_guid;
if ( guidTest6 != guidTestRef1 ) return breakpoint(10);
}
{
constexpr const EFI_GUID guidTest7 = "12345678-4321-8765-1122-334455667788"_guid;
if ( guidTest7 != guidTestRef1 ) return breakpoint(10);
}
{
EFI_GUID guidTest8;
XString8 s = "12345678-4321-8765-1122-334455667788"_XS8;
guidTest8.takeValueFrom(s);
if ( guidTest8 != guidTestRef1 ) return breakpoint(10);
}
// {
// constexpr const EFI_GUID guidTest = "12345678-4321-8765-1122-334455667788"_guid;
// XString8 s = GuidLEToXString8(guidTest);
// if ( s != "12345678-4321-8765-1122-334455667788"_XS8 ) return breakpoint(10);
// if ( guidTest.toXString8() != "12345678-4321-8765-1122-334455667788"_XS8 ) return breakpoint(10);
// if ( guidTest.toXStringW() != L"12345678-4321-8765-1122-334455667788"_XSW ) return breakpoint(10);
// }
//
// {
// constexpr const EFI_GUID guidTest = "12345678-4321-8765-1122-334455667788"_guid;
// XString8 s = GuidBeToXString8(guidTest);
// if ( s != "78563412-2143-6587-1122-334455667788"_XS8 ) return breakpoint(10);
// if ( guidTest.toXString8(true) != "78563412-2143-6587-1122-334455667788"_XS8 ) return breakpoint(10);
// if ( guidTest.toXStringW(true) != L"78563412-2143-6587-1122-334455667788"_XSW ) return breakpoint(10);
// }
// {
// EFI_GUID guidTest1;
// EFI_STATUS Status = StrToGuidBE("12345678-4321-8765-1122-334455667788", &guidTest1);
// if ( Status != 0 ) return breakpoint(0);
// EFI_GUID guidTest2;
// guidTest2.takeValueFromBE("12345678-4321-8765-1122-334455667788"_XS8);
// if ( guidTest1 != guidTest2 ) return breakpoint(10);
// }
// constexpr const EFI_GUID guidTest102 = "12345678 4321-8765-1122-334455667788"_guid; // no constexpr, so this will compile, but panic.
// constexpr const EFI_GUID guidTest103 = "12345678-4321 8765-1122-334455667788"_guid; // no constexpr, so this will compile, but panic.
// constexpr const EFI_GUID guidTest104 = "12345678-4321-8765 1122-334455667788"_guid; // no constexpr, so this will compile, but panic.
// constexpr const EFI_GUID guidTest105 = "12345678-4321-8765-1122 334455667788"_guid; // no constexpr, so this will compile, but panic.
// constexpr const EFI_GUID guidTest106 = "12345678-4321-8765-1122-334455667788-"_guid; // no constexpr, so this will compile, but panic.
// const EFI_GUID guidTest100 = "xx12345678-4321-8765-1122-334455667788"_guid; // no constexpr, so this will compile, but panic.
// constexpr const EFI_GUID guidTest101 = "xx12345678-4321-8765-1122-334455667788"_guid; // This will NOT compile. Clang says "Constexpr variable must be initialized by a constant expression"
return 0;
}

View File

@ -0,0 +1 @@
int guid_tests();

View File

@ -73,7 +73,7 @@ const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const
DevicePath = NextDevicePathNode(DevicePath);
}
if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) {
if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).isEqualIC(ApfsSignatureUUID) ) {
if ( ApfsSignatureUUID == *(EFI_GUID *)((UINT8 *)DevicePath+0x04) ) {
IconNum = BUILTIN_ICON_VOL_INTERNAL_APFS;
}
} else {

Some files were not shown because too many files have changed in this diff Show More