Make Clover path independent.

This commit is contained in:
jief666 2020-10-03 20:02:31 +03:00
parent 2286f19503
commit b8a188382c
124 changed files with 1839 additions and 1573 deletions

View File

@ -519,7 +519,7 @@ MemLogfVA (
//
UINTN LastMessage = mMemLog->Cursor - mMemLog->Buffer;
vprintf_with_callback_timestamp_emitcr(Format, Marker, transmitS8Printf, NULL, &printfNewline, 1, 1);
vprintf_with_callback_timestamp_emitcr(Format, Marker, transmitS8Printf, NULL, &printfNewline, Timing, 1);
size_t DataWritten = mMemLog->Cursor - mMemLog->Buffer - LastMessage;
//

View File

@ -59,7 +59,7 @@ typedef EFI_FILE_PROTOCOL EFI_FILE;
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME)(
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
IN JCONST EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
OUT EFI_FILE_PROTOCOL **Root
);
@ -113,9 +113,9 @@ struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_OPEN)(
IN JCONST EFI_FILE_PROTOCOL *This,
IN JCONST EFI_FILE_PROTOCOL *This,
OUT EFI_FILE_PROTOCOL **NewHandle,
IN JCONST CHAR16 *FileName,
IN JCONST CHAR16 *FileName,
IN UINT64 OpenMode,
IN UINT64 Attributes
);
@ -150,7 +150,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_CLOSE)(
IN EFI_FILE_PROTOCOL *This
IN JCONST EFI_FILE_PROTOCOL *This
);
/**
@ -192,7 +192,7 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_READ)(
IN EFI_FILE_PROTOCOL *This,
JCONST EFI_FILE_PROTOCOL *This,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
@ -287,8 +287,8 @@ EFI_STATUS
typedef
EFI_STATUS
(EFIAPI *EFI_FILE_GET_INFO)(
IN EFI_FILE_PROTOCOL *This,
IN EFI_GUID *InformationType,
JCONST EFI_FILE_PROTOCOL *This,
JCONST EFI_GUID *InformationType,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);

View File

@ -199,6 +199,8 @@
9A9EA807245AD9B30076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
9A9EA808245AD9B40076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
9A9EA80A245AD9E50076EC02 /* XToolsCommon_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */; };
9AABBE1C2524863E0033A009 /* SelfOem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AABBE1A2524863D0033A009 /* SelfOem.cpp */; };
9AABBE1D2524863E0033A009 /* SelfOem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AABBE1B2524863E0033A009 /* SelfOem.h */; };
9AC269A824E0514100254048 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC269A624E0514000254048 /* Utils.cpp */; };
9AC269A924E0514100254048 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC269A724E0514000254048 /* Utils.h */; };
9AC77FB924176C04005CDD5C /* XStringArray_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ECC24176C04005CDD5C /* XStringArray_test.h */; };
@ -789,6 +791,8 @@
9A9D3B2124221563006D8CD9 /* printf_lite-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printf_lite-test.cpp"; sourceTree = "<group>"; };
9A9EA7FC245AD97E0076EC02 /* XToolsCommon_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon_test.h; sourceTree = "<group>"; };
9A9EA7FD245AD97F0076EC02 /* XToolsCommon_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon_test.cpp; sourceTree = "<group>"; };
9AABBE1A2524863D0033A009 /* SelfOem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelfOem.cpp; sourceTree = "<group>"; };
9AABBE1B2524863E0033A009 /* SelfOem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelfOem.h; sourceTree = "<group>"; };
9AC269A624E0514000254048 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = "<group>"; };
9AC269A724E0514000254048 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
9AC77EC424176BF2005CDD5C /* libCloverX64.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCloverX64.a; sourceTree = BUILT_PRODUCTS_DIR; };
@ -1141,6 +1145,8 @@
9AC77F1624176C04005CDD5C /* Platform */ = {
isa = PBXGroup;
children = (
9AABBE1A2524863D0033A009 /* SelfOem.cpp */,
9AABBE1B2524863E0033A009 /* SelfOem.h */,
9A61B2FE2522165100AEE0FA /* Self.cpp */,
9A61B2FF2522165100AEE0FA /* Self.h */,
9A36E57324F56156007A1107 /* plist */,
@ -1455,6 +1461,7 @@
9AC7803E24176C04005CDD5C /* spd.h in Headers */,
9A105B7524483AE40006DE06 /* stdarg.h in Headers */,
9A36E5C224F5616F007A1107 /* TagFloat.h in Headers */,
9AABBE1D2524863E0033A009 /* SelfOem.h in Headers */,
9AD469502452B5A600D6D0DB /* Efi.h in Headers */,
9AC7801724176C04005CDD5C /* device_inject.h in Headers */,
9A36E59524F5616F007A1107 /* TagDict.h in Headers */,
@ -1935,6 +1942,7 @@
9A105B6924483AE40006DE06 /* APFS.cpp in Sources */,
9AC7805124176C04005CDD5C /* egemb_font.cpp in Sources */,
9AC7806424176C04005CDD5C /* securemenu.cpp in Sources */,
9AABBE1C2524863E0033A009 /* SelfOem.cpp in Sources */,
9A36E5D124F5616F007A1107 /* plist.cpp in Sources */,
9AC7804D24176C04005CDD5C /* text.cpp in Sources */,
9AC7800C24176C04005CDD5C /* AmlGenerator.cpp in Sources */,
@ -2326,6 +2334,7 @@
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
$PROJECT_DIR/../../OpenCorePkg/Include/Intel,
$PROJECT_DIR/../../UefiCpuPkg/Include,
);
ONLY_ACTIVE_ARCH = YES;
@ -2410,6 +2419,7 @@
$PROJECT_DIR/../../OpenCorePkg/Include/Apple,
$PROJECT_DIR/../../OpenCorePkg/Include/Acidanthera,
$PROJECT_DIR/../../OpenCorePkg/Include/AMI,
$PROJECT_DIR/../../OpenCorePkg/Include/Intel,
$PROJECT_DIR/../../UefiCpuPkg/Include,
);
ONLY_ACTIVE_ARCH = YES;

View File

@ -24,6 +24,8 @@
#include "platformdata.h"
#include "smbios.h"
#include "cpu.h"
#include "Self.h"
#include "SelfOem.h"
#define EBDA_BASE_ADDRESS 0x40E
@ -103,7 +105,7 @@ static void stripTrailingSpaces(CHAR8* sgn)
lastNonSpace[1] = 0;
}
VOID* FindAcpiRsdPtr()
void* FindAcpiRsdPtr()
{
UINTN Address;
UINTN Index;
@ -112,7 +114,7 @@ VOID* FindAcpiRsdPtr()
//
for (Address = 0xe0000; Address < 0xfffff; Address += 0x10) {
if (*(UINT64 *)(Address) == EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE) {
return (VOID *)Address;
return (void *)Address;
}
}
//
@ -122,13 +124,13 @@ VOID* FindAcpiRsdPtr()
if ( Address == 0 ) return 0; // Jief : if Address==0, the first access at *(UINT64 *)(Address + Index) is at address 0. It's supposed to crash.
for (Index = 0; Index < 0x400 ; Index += 16) {
if (*(UINT64 *)(Address + Index) == EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE) {
return (VOID *)Address;
return (void *)Address;
}
}
return NULL;
}
UINT8 Checksum8(VOID* startPtr, UINT32 len)
UINT8 Checksum8(void* startPtr, UINT32 len)
{
UINT8 Value = 0;
UINT8 *ptr = (UINT8*)startPtr;
@ -247,7 +249,7 @@ void AddDropTable(EFI_ACPI_DESCRIPTION_HEADER* Table, UINT32 Index)
gSettings.ACPIDropTables = DropTable;
}
VOID GetAcpiTablesList()
void GetAcpiTablesList()
{
DbgHeader("GetAcpiTablesList");
@ -401,7 +403,7 @@ BOOLEAN PatchTableHeader(EFI_ACPI_DESCRIPTION_HEADER *Header)
return (Ret1 || Ret2 || Ret3);
}
VOID PatchAllTables()
void PatchAllTables()
{
UINT32 Count = XsdtTableCount();
UINT64* Ptr = XsdtEntryPtrFromIndex(0);
@ -488,7 +490,7 @@ VOID PatchAllTables()
}
}
EFI_STATUS InsertTable(VOID* TableEntry, UINTN Length)
EFI_STATUS InsertTable(void* TableEntry, UINTN Length)
{
if (!TableEntry) {
return EFI_NOT_FOUND;
@ -553,7 +555,7 @@ UINTN IndexFromFileName(CONST CHAR16* FileName)
return Result;
}
EFI_STATUS ReplaceOrInsertTable(VOID* TableEntry, UINTN Length, UINTN MatchIndex, INTN Pass)
EFI_STATUS ReplaceOrInsertTable(void* TableEntry, UINTN Length, UINTN MatchIndex, INTN Pass)
{
if (!TableEntry) {
return EFI_NOT_FOUND;
@ -744,8 +746,8 @@ void PostCleanupXSDT()
}
/** Saves Buffer of Length to disk as DirName\\FileName. */
EFI_STATUS SaveBufferToDisk(VOID *Buffer, UINTN Length, CONST CHAR16 *DirName, CONST CHAR16 *FileName)
/** Saves Buffer of Length to disk as OemDir\\DirName\\FileName. */
EFI_STATUS SaveBufferToDisk(void *Buffer, UINTN Length, CONST CHAR16 *DirName, CONST CHAR16 *FileName)
{
if (DirName == NULL || FileName == NULL) {
return EFI_INVALID_PARAMETER;
@ -753,10 +755,11 @@ EFI_STATUS SaveBufferToDisk(VOID *Buffer, UINTN Length, CONST CHAR16 *DirName, C
XStringW PathName = SWPrintf("%ls\\%ls", DirName, FileName);
EFI_STATUS Status = egSaveFile(SelfRootDir, PathName.wc_str(), Buffer, Length);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, PathName.wc_str(), Buffer, Length);
}
EFI_STATUS Status = egSaveFile(&selfOem.getOemDir(), PathName.wc_str(), Buffer, Length);
// Do not write outside OemDir
// if (EFI_ERROR(Status)) {
// Status = egSaveFile(NULL, PathName.wc_str(), Buffer, Length);
// }
return Status;
}
@ -764,12 +767,12 @@ EFI_STATUS SaveBufferToDisk(VOID *Buffer, UINTN Length, CONST CHAR16 *DirName, C
// Remembering saved tables
//
#define SAVED_TABLES_ALLOC_ENTRIES 64
VOID **mSavedTables = NULL;
void **mSavedTables = NULL;
UINTN mSavedTablesEntries = 0;
UINTN mSavedTablesNum = 0;
/** Returns TRUE is TableEntry is already saved. */
BOOLEAN IsTableSaved(VOID *TableEntry)
BOOLEAN IsTableSaved(void *TableEntry)
{
UINTN Index;
@ -784,7 +787,7 @@ BOOLEAN IsTableSaved(VOID *TableEntry)
}
/** Adds TableEntry to mSavedTables if not already there. */
VOID MarkTableAsSaved(VOID *TableEntry)
void MarkTableAsSaved(void *TableEntry)
{
//
// If mSavedTables does not exists yet - allocate it
@ -875,7 +878,7 @@ static XStringW GenerateFileName(CONST CHAR16* FileNamePrefix, UINTN SsdtCount,
return FileName;
}
VOID DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirName, CONST CHAR16 *FileNamePrefix, UINTN SsdtCount)
void DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirName, CONST CHAR16 *FileNamePrefix, UINTN SsdtCount)
{
EFI_STATUS Status = EFI_SUCCESS;
INTN j, k, pacLen, pacCount;
@ -934,14 +937,14 @@ VOID DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam
for (k = 0; k < 16; k++) {
DBG("%02hhX ", ((UINT8*)adr)[k]);
}
if ((AsciiStrCmp(Signature, "SSDT") == 0) && (len < 0x20000) && DirName != NULL && !IsTableSaved((VOID*)adr)) {
if ((AsciiStrCmp(Signature, "SSDT") == 0) && (len < 0x20000) && DirName != NULL && !IsTableSaved((void*)adr)) {
XStringW FileName = GenerateFileName(FileNamePrefix, SsdtCount, ChildCount, OemTableId);
len = ((UINT16*)adr)[2];
DBG("Internal length = %llu", len);
Status = SaveBufferToDisk((VOID*)adr, len, DirName, FileName.wc_str());
Status = SaveBufferToDisk((void*)adr, len, DirName, FileName.wc_str());
if (!EFI_ERROR(Status)) {
DBG(" -> %ls", FileName.wc_str());
MarkTableAsSaved((VOID*)adr);
MarkTableAsSaved((void*)adr);
ChildCount++;
} else {
DBG(" -> %s", efiStrError(Status));
@ -979,12 +982,12 @@ VOID DumpChildSsdt(EFI_ACPI_DESCRIPTION_HEADER *TableEntry, CONST CHAR16 *DirNam
for(k=0; k<16; k++){
DBG("%02hhX ", ((UINT8*)adr)[k]);
}
if ((AsciiStrCmp(Signature, "SSDT") == 0) && (len < 0x20000) && DirName != NULL && !IsTableSaved((VOID*)adr)) {
if ((AsciiStrCmp(Signature, "SSDT") == 0) && (len < 0x20000) && DirName != NULL && !IsTableSaved((void*)adr)) {
XStringW FileName = GenerateFileName(FileNamePrefix, SsdtCount, ChildCount, OemTableId);
Status = SaveBufferToDisk((VOID*)adr, len, DirName, FileName.wc_str());
Status = SaveBufferToDisk((void*)adr, len, DirName, FileName.wc_str());
if (!EFI_ERROR(Status)) {
DBG(" -> %ls", FileName.wc_str());
MarkTableAsSaved((VOID*)adr);
MarkTableAsSaved((void*)adr);
ChildCount++;
} else {
DBG(" -> %s", efiStrError(Status));
@ -1184,9 +1187,9 @@ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* GetFadt()
RsdPtr = (__typeof__(RsdPtr))FindAcpiRsdPtr();
if (RsdPtr == NULL) {
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (VOID **)&RsdPtr);
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (void **)&RsdPtr);
if (RsdPtr == NULL) {
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **)&RsdPtr);
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (void **)&RsdPtr);
if (RsdPtr == NULL) {
return NULL;
}
@ -1203,7 +1206,7 @@ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* GetFadt()
// Search Acpi 2.0 or newer in UEFI Sys.Tables
//
RsdPtr = NULL;
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (VOID**)&RsdPtr);
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (void**)&RsdPtr);
if (RsdPtr != NULL) {
DBG("Found UEFI Acpi 2.0 RSDP at %p\n", RsdPtr);
Rsdt = (RSDT_TABLE*)(UINTN)(RsdPtr->RsdtAddress);
@ -1234,7 +1237,7 @@ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* GetFadt()
* ACPI tables given by RsdPtr.
* Takes tables from Xsdt if present or from Rsdt if Xsdt is not present.
*/
VOID DumpTables(VOID *RsdPtrVoid, CONST CHAR16 *DirName)
void DumpTables(void *RsdPtrVoid, CONST CHAR16 *DirName)
{
EFI_STATUS Status;
UINTN Length;
@ -1435,11 +1438,11 @@ VOID DumpTables(VOID *RsdPtrVoid, CONST CHAR16 *DirName)
*
* Dumping of other tables to log can be removed if it turns out that there is no value in doing it.
*/
VOID SaveOemTables()
void SaveOemTables()
{
// EFI_STATUS Status;
VOID *RsdPtr;
XStringW AcpiOriginPath = SWPrintf("%ls\\ACPI\\origin", OEMPath.wc_str());
void *RsdPtr;
XStringW AcpiOriginPath = L"ACPI\\origin"_XSW;
BOOLEAN Saved = FALSE;
CHAR8 *MemLogStart;
UINTN MemLogStartLen;
@ -1490,7 +1493,7 @@ VOID SaveOemTables()
FreePool(mSavedTables);
}
VOID SaveOemDsdt(BOOLEAN FullPatch)
void SaveOemDsdt(BOOLEAN FullPatch)
{
EFI_STATUS Status = EFI_NOT_FOUND;
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtPointer = NULL;
@ -1499,23 +1502,24 @@ VOID SaveOemDsdt(BOOLEAN FullPatch)
UINTN Pages;
UINT8 *buffer = NULL;
UINTN DsdtLen = 0;
XStringW OriginDsdt = SWPrintf("%ls\\ACPI\\origin\\DSDT.aml", OEMPath.wc_str());
XStringW OriginDsdtFixed = SWPrintf("%ls\\ACPI\\origin\\DSDT-%x.aml", OEMPath.wc_str(), gSettings.FixDsdt);
constexpr LStringW PathPatched = L"\\EFI\\CLOVER\\ACPI\\patched";
XStringW OriginDsdt = SWPrintf("ACPI\\origin\\DSDT.aml");
XStringW OriginDsdtFixed = SWPrintf("ACPI\\origin\\DSDT-%x.aml", gSettings.FixDsdt);
// constexpr LStringW PathPatched = L"\\EFI\\CL OVER\\ACPI\\patched";
XStringW PathDsdt;
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
// XStringW AcpiOemPath = SWPrintf("ACPI\\patched");
PathDsdt.SWPrintf("\\%ls", gSettings.DsdtName.wc_str());
// PathDsdt.SWPrintf("\\%ls", gSettings.DsdtName.wc_str());
if (FileExists(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()))) {
DBG("SaveOemDsdt: DSDT found in Clover volume OEM folder: %ls%ls\n", AcpiOemPath.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &DsdtLen);
if (FileExists(&selfOem.getOemDir(), SWPrintf("ACPI\\patched\\%ls", gSettings.DsdtName.wc_str()))) {
DBG("SaveOemDsdt: DSDT found in Clover volume OEM folder: ACPI\\patched\\%ls\n", gSettings.DsdtName.wc_str());
Status = egLoadFile(&selfOem.getOemDir(), SWPrintf("ACPI\\patched\\%ls", gSettings.DsdtName.wc_str()).wc_str(), &buffer, &DsdtLen);
}
if (EFI_ERROR(Status) && FileExists(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()))) {
DBG("SaveOemDsdt: DSDT found in Clover volume common folder: %ls%ls\n", PathPatched.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &DsdtLen);
}
// Jief : Do not write outside OemPath
// if (EFI_ERROR(Status) && FileExists(&self.getSelfRootDir(), SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()))) {
// DBG("SaveOemDsdt: DSDT found in Clover volume common folder: %ls%ls\n", PathPatched.wc_str(), PathDsdt.wc_str());
// Status = egLoadFile(&self.getSelfRootDir(), SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &DsdtLen);
// }
if (EFI_ERROR(Status)) {
FadtPointer = GetFadt();
@ -1547,21 +1551,22 @@ VOID SaveOemDsdt(BOOLEAN FullPatch)
//if success insert dsdt pointer into ACPI tables
if(!EFI_ERROR(Status))
{
CopyMem((VOID*)(UINTN)dsdt, buffer, DsdtLen);
CopyMem((void*)(UINTN)dsdt, buffer, DsdtLen);
buffer = (UINT8*)(UINTN)dsdt;
if (FullPatch) {
FixBiosDsdt(buffer, FadtPointer, NullXString8);
DsdtLen = ((EFI_ACPI_DESCRIPTION_HEADER*)buffer)->Length;
OriginDsdt = OriginDsdtFixed;
}
Status = egSaveFile(SelfRootDir, OriginDsdt.wc_str(), buffer, DsdtLen);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, OriginDsdt.wc_str(), buffer, DsdtLen);
}
Status = egSaveFile(&selfOem.getOemDir(), OriginDsdt.wc_str(), buffer, DsdtLen);
// Jief : do not write outside of OemDir
// if (EFI_ERROR(Status)) {
// Status = egSaveFile(NULL, OriginDsdt.wc_str(), buffer, DsdtLen);
// }
if (!EFI_ERROR(Status)) {
MsgLog("DSDT saved to %ls\n", OriginDsdt.wc_str());
} else {
MsgLog("Saving DSDT to %ls failed - %s\n", OriginDsdt.wc_str(), efiStrError(Status));
MsgLog("Saving DSDT to %ls\\%ls failed - %s\n", selfOem.getOemFullPath().wc_str(), OriginDsdt.wc_str(), efiStrError(Status));
}
gBS->FreePages(dsdt, Pages);
}
@ -1569,7 +1574,6 @@ VOID SaveOemDsdt(BOOLEAN FullPatch)
BOOLEAN LoadPatchedAML(CONST CHAR16* AcpiOemPath, CONST CHAR16* PartName, UINTN Pass)
{
CHAR16 FullName[256];
// pass1 prefilter based on file names (optimization that avoids loading same files twice)
UINTN Index = IGNORE_INDEX;
if (AUTOMERGE_PASS1 == Pass) {
@ -1583,10 +1587,9 @@ BOOLEAN LoadPatchedAML(CONST CHAR16* AcpiOemPath, CONST CHAR16* PartName, UINTN
return FALSE;
}
}
snwprintf(FullName, sizeof(FullName), "%ls\\%ls", AcpiOemPath, PartName);
UINT8 *buffer = NULL;
UINTN bufferLen = 0;
EFI_STATUS Status = egLoadFile(SelfRootDir, FullName, &buffer, &bufferLen);
EFI_STATUS Status = egLoadFile(&selfOem.getOemDir(), SWPrintf("%ls\\%ls", AcpiOemPath, PartName).wc_str(), &buffer, &bufferLen);
if (!EFI_ERROR(Status)) {
if (buffer) {
EFI_ACPI_DESCRIPTION_HEADER* TableHeader = (EFI_ACPI_DESCRIPTION_HEADER*)buffer;
@ -1683,14 +1686,14 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
SSDT_TABLE *Ssdt = NULL;
UINT8 *buffer = NULL;
UINTN bufferLen = 0;
constexpr LStringW PathPatched = L"\\EFI\\CLOVER\\ACPI\\patched";
// constexpr LStringW PathPatched = L"\\EFI\\CL OVER\\ACPI\\patched";
XStringW PathDsdt; // = L"\\DSDT.aml";
// CHAR16* PatchedAPIC = L"\\EFI\\CLOVER\\ACPI\\origin\\APIC-p.aml";
// CHAR16* PatchedAPIC = L"\\EFI\\CL OVER\\ACPI\\origin\\APIC-p.aml";
UINT32* rf = NULL;
UINT64* xf = NULL;
UINT64 XDsdt; //save values if present
UINT64 XFirmwareCtrl;
EFI_FILE *RootDir;
// EFI_FILE *RootDir;
UINT32 eCntR; //, eCntX;
UINT32 *pEntryR;
CHAR8 *pEntry;
@ -1706,7 +1709,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
BOOLEAN DsdtLoaded = FALSE;
BOOLEAN NeedUpdate = FALSE;
OPER_REGION *tmpRegion;
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
// XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
DbgHeader("PatchACPI");
@ -1822,7 +1825,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
Status = gBS->AllocatePages(AllocateMaxAddress, EfiACPIReclaimMemory, 1, &BufferPtr);
if(!EFI_ERROR(Status))
{
CopyMem((VOID*)(UINTN)BufferPtr, Xsdt, Xsdt->Header.Length);
CopyMem((void*)(UINTN)BufferPtr, Xsdt, Xsdt->Header.Length);
Xsdt = (XSDT_TABLE*)(UINTN)BufferPtr;
}
// DBG("Finishing RsdPointer\n");
@ -1956,24 +1959,28 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
DBG("Volume not found!\n");
return EFI_NOT_FOUND;
}
RootDir = Volume->RootDir;
// RootDir = Volume->RootDir;
Status = EFI_NOT_FOUND;
if (FileExists(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()))) {
DBG("DSDT found in Clover volume OEM folder: %ls%ls\n", AcpiOemPath.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", AcpiOemPath.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &bufferLen);
XStringW acpiPath = SWPrintf("ACPI\\patched\\%ls", PathDsdt.wc_str());
if ( FileExists(&selfOem.getOemDir(), acpiPath) ) {
DBG("DSDT found in Clover volume OEM folder: %ls\\%ls\n", selfOem.getOemFullPath().wc_str(), acpiPath.wc_str());
Status = egLoadFile(&self.getCloverDir(), acpiPath.wc_str(), &buffer, &bufferLen);
//REVIEW: memory leak... buffer
}
if (EFI_ERROR(Status) && FileExists(RootDir, PathDsdt)) {
// Jief : Do we really need a specific DSDT per volume ?
if (EFI_ERROR(Status) && FileExists(Volume->RootDir, PathDsdt)) {
DBG("DSDT found in booted volume\n");
Status = egLoadFile(RootDir, PathDsdt.wc_str(), &buffer, &bufferLen);
Status = egLoadFile(Volume->RootDir, PathDsdt.wc_str(), &buffer, &bufferLen);
//REVIEW: memory leak... buffer
}
if (EFI_ERROR(Status) && FileExists(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()))) {
DBG("DSDT found in Clover volume: %ls%ls\n", PathPatched.wc_str(), PathDsdt.wc_str());
Status = egLoadFile(SelfRootDir, SWPrintf("%ls%ls", PathPatched.wc_str(), PathDsdt.wc_str()).wc_str(), &buffer, &bufferLen);
// Jief : may I suggest to remove that. Loading from outside of OemPath might be confusing
if ( EFI_ERROR(Status) && FileExists(&self.getCloverDir(), acpiPath) ) {
DBG("DSDT found in Clover volume: %ls\\%ls\n", self.getCloverDirPathAsXStringW().wc_str(), acpiPath.wc_str());
Status = egLoadFile(&self.getCloverDir(), acpiPath.wc_str(), &buffer, &bufferLen);
//REVIEW: memory leak... buffer
}
//
@ -1996,7 +2003,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
//if success insert dsdt pointer into ACPI tables
if(!EFI_ERROR(Status)) {
// DBG("page is allocated, write DSDT into\n");
CopyMem((VOID*)(UINTN)dsdt, buffer, bufferLen);
CopyMem((void*)(UINTN)dsdt, buffer, bufferLen);
FadtPointer->Dsdt = (UINT32)dsdt;
FadtPointer->XDsdt = dsdt;
@ -2021,7 +2028,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
//if success insert dsdt pointer into ACPI tables
if(!EFI_ERROR(Status)) {
CopyMem((VOID*)(UINTN)dsdt, TableHeader, bufferLen);
CopyMem((void*)(UINTN)dsdt, TableHeader, bufferLen);
FadtPointer->Dsdt = (UINT32)dsdt;
FadtPointer->XDsdt = dsdt;
@ -2034,9 +2041,8 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
// }
if (gSettings.DebugDSDT) {
DBG("Output DSDT before patch to /EFI/CLOVER/ACPI/origin/DSDT-or.aml\n");
Status = egSaveFile(SelfRootDir, L"\\EFI\\CLOVER\\ACPI\\origin\\DSDT-or.aml",
(UINT8*)(UINTN)FadtPointer->XDsdt, bufferLen);
DBG("Output DSDT before patch to %ls\\ACPI\\origin\\DSDT-or.aml\n", selfOem.getOemFullPath().wc_str());
Status = egSaveFile(&selfOem.getOemDir(), L"ACPI\\origin\\DSDT-or.aml", (UINT8*)(UINTN)FadtPointer->XDsdt, bufferLen);
}
//native DSDT or loaded we want to apply autoFix to this
// if (gSettings.FixDsdt) { //fix even with zero mask because we want to know PCIRootUID and count(?)
@ -2045,11 +2051,9 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
FixBiosDsdt((UINT8*)(UINTN)FadtPointer->XDsdt, FadtPointer, OSVersion);
if (gSettings.DebugDSDT) {
for (Index=0; Index < 60; Index++) {
CHAR16 DsdtPatchedName[128];
snwprintf(DsdtPatchedName, 256, "\\EFI\\CLOVER\\ACPI\\origin\\DSDT-pa%llu.aml", Index);
if(!FileExists(SelfRootDir, DsdtPatchedName)){
Status = egSaveFile(SelfRootDir, DsdtPatchedName,
(UINT8*)(UINTN)FadtPointer->XDsdt, bufferLen);
XStringW DsdtPatchedName = SWPrintf("ACPI\\origin\\DSDT-pa%llu.aml", Index);
if(!FileExists(&selfOem.getOemDir(), DsdtPatchedName)){
Status = egSaveFile(&selfOem.getOemDir(), DsdtPatchedName.wc_str(), (UINT8*)(UINTN)FadtPointer->XDsdt, bufferLen);
if (!EFI_ERROR(Status)) {
break;
}
@ -2069,7 +2073,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
XsdtReplaceSizes = (__typeof__(XsdtReplaceSizes))AllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
// Load merged ACPI files from ACPI/patched
LoadAllPatchedAML(AcpiOemPath.wc_str(), AUTOMERGE_PASS1);
LoadAllPatchedAML(L"ACPI\\patched", AUTOMERGE_PASS1);
// Drop tables
if (gSettings.ACPIDropTables) {
@ -2096,7 +2100,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
PatchAllTables();
// Load add-on ACPI files from ACPI/patched
LoadAllPatchedAML(AcpiOemPath.wc_str(), AUTOMERGE_PASS2);
LoadAllPatchedAML(L"ACPI\\patched", AUTOMERGE_PASS2);
if (XsdtReplaceSizes) {
FreePool(XsdtReplaceSizes);
@ -2138,7 +2142,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
Status=gBS->AllocatePages(AllocateMaxAddress, EfiACPIReclaimMemory, 1, &BufferPtr);
if(!EFI_ERROR(Status)) {
//save old table and drop it from XSDT
CopyMem((VOID*)(UINTN)BufferPtr, ApicTable, ApicTable->Length);
CopyMem((void*)(UINTN)BufferPtr, ApicTable, ApicTable->Length);
DropTableFromXSDT(APIC_SIGN, 0, 0);
ApicTable = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)BufferPtr;
ApicTable->Revision = EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION;
@ -2194,7 +2198,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
DBG("New APIC table successfully inserted\n");
}
/*
Status = egSaveFile(SelfRootDir, PatchedAPIC, (UINT8 *)ApicTable, ApicTable->Length);
Status = egSaveFile(&self.getSelfRootDir(), PatchedAPIC, (UINT8 *)ApicTable, ApicTable->Length);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, PatchedAPIC, (UINT8 *)ApicTable, ApicTable->Length);
}
@ -2284,9 +2288,9 @@ EFI_STATUS LoadAcpiTable (
// checking \EFI\ACPI\patched dir
XStringW TmpStr = SWPrintf("%ls\\%ls", PathPatched, TableName);
if (FileExists(SelfRootDir, TmpStr)) {
if (FileExists(&self.getCloverDir(), TmpStr)) {
DBG("found %ls\n", TmpStr.wc_str());
Status = egLoadFile(SelfRootDir, TmpStr.wc_str(), Buffer, BufferLen);
Status = egLoadFile(&self.getCloverDir(), TmpStr.wc_str(), Buffer, BufferLen);
}
return Status;
}
@ -2308,7 +2312,7 @@ EFI_STATUS LoadAndInjectDSDT(CONST CHAR16 *PathPatched,
if (!EFI_ERROR(Status)) {
// loaded - allocate EfiACPIReclaim
DBG("Loaded DSDT at %ls\\%ls\n", PathPatched, gSettings.DsdtName.wc_str());
DBG("Loaded DSDT at %ls\\%ls\\%ls\n", self.getCloverDirPathAsXStringW().wc_str(), PathPatched, gSettings.DsdtName.wc_str());
Dsdt = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
Status = gBS->AllocatePages (
AllocateMaxAddress,
@ -2319,13 +2323,13 @@ EFI_STATUS LoadAndInjectDSDT(CONST CHAR16 *PathPatched,
if(!EFI_ERROR(Status)) {
// copy DSDT into EfiACPIReclaim block
CopyMem((VOID*)(UINTN)Dsdt, Buffer, BufferLen);
CopyMem((void*)(UINTN)Dsdt, Buffer, BufferLen);
// update FADT
FadtPointer->Dsdt = (UINT32)Dsdt;
FadtPointer->XDsdt = Dsdt;
FixChecksum(&FadtPointer->Header);
DBG("DSDT at 0x%llX injected to FADT 0x%p\n", Dsdt, FadtPointer);
DBG("DSDT at 0x%llX injected to FADT 0x%p\n", Dsdt, FadtPointer);
}
FreePool(Buffer);
@ -2410,11 +2414,11 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
//
RsdPointer = NULL;
Status = EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (VOID **) &RsdPointer);
Status = EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (void **) &RsdPointer);
if (RsdPointer != NULL) {
DBG("OtherOS: Found Acpi 2.0 RSDP 0x%llX\n", (uintptr_t)RsdPointer);
} else {
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &RsdPointer);
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (void **) &RsdPointer);
if (RsdPointer != NULL) {
DBG("Found Acpi 1.0 RSDP 0x%llX\n", (uintptr_t)RsdPointer);
}
@ -2469,14 +2473,14 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
//
// prepare dirs that will be searched for custom ACPI tables
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\%ls", OEMPath.wc_str(), OsSubdir);
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\%ls", selfOem.getOemPathRelToSelfDir().wc_str(), OsSubdir);
XStringW PathPatched;
if (FileExists(SelfRootDir, AcpiOemPath)) {
if (FileExists(&self.getCloverDir(), AcpiOemPath)) {
PathPatched = AcpiOemPath;
} else {
PathPatched = SWPrintf("\\EFI\\CLOVER\\ACPI\\%ls", OsSubdir);
PathPatched = SWPrintf("ACPI\\%ls", OsSubdir);
}
if (!FileExists(SelfRootDir, PathPatched)) {
if (!FileExists(&self.getCloverDir(), PathPatched)) {
DBG("Dir %ls not found. No patching will be done.\n", OsSubdir);
return EFI_NOT_FOUND;
}
@ -2512,7 +2516,7 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
// find and inject other ACPI tables
//
DirIterOpen(SelfRootDir, PathPatched.wc_str(), &DirIter);
DirIterOpen(&self.getCloverDir(), PathPatched.wc_str(), &DirIter);
while (DirIterNext(&DirIter, 2, L"*.aml", &DirEntry)) {
if (DirEntry->FileName[0] == L'.') {

View File

@ -51,27 +51,27 @@ PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT);
UINT8
Checksum8 (
VOID *startPtr,
void *startPtr,
UINT32 len
);
void FixChecksum(EFI_ACPI_DESCRIPTION_HEADER* Table);
VOID
void
SaveOemDsdt (
BOOLEAN FullPatch
);
VOID
SaveOemTables (VOID);
void
SaveOemTables (void);
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE
*GetFadt (VOID);
*GetFadt (void);
VOID
GetAcpiTablesList (VOID);
void
GetAcpiTablesList (void);
#endif /* PLATFORM_ACPIPATCHER_H_ */

View File

@ -73,7 +73,7 @@ typedef struct aml_chunk AML_CHUNK;
BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node);
AML_CHUNK* aml_create_node(AML_CHUNK* parent);
VOID aml_destroy_node(AML_CHUNK* node);
void aml_destroy_node(AML_CHUNK* node);
AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, CONST UINT8* buffer, UINT32 size);
AML_CHUNK* aml_add_byte(AML_CHUNK* parent, UINT8 value);
AML_CHUNK* aml_add_word(AML_CHUNK* parent, UINT16 value);

View File

@ -18,7 +18,7 @@ extern "C" {
// Keyboard input
//
BOOLEAN ReadAllKeyStrokes(VOID)
BOOLEAN ReadAllKeyStrokes(void)
{
BOOLEAN GotKeyStrokes;
EFI_STATUS Status;
@ -36,7 +36,7 @@ BOOLEAN ReadAllKeyStrokes(VOID)
return GotKeyStrokes;
}
VOID PauseForKey(CONST CHAR16* msg)
void PauseForKey(CONST CHAR16* msg)
{
UINTN index;
if (msg) {
@ -57,7 +57,7 @@ VOID PauseForKey(CONST CHAR16* msg)
// Jief, TODO : not sure of the difference between this and PauseForKey. Looks like none. Can it be removed ?
VOID
void
WaitForKeyPress(
CHAR16 *Message
)
@ -77,7 +77,7 @@ WaitForKeyPress(
}
//#if REFIT_DEBUG > 0
//VOID DebugPause(VOID)
//void DebugPause(void)
//{
// // show console and wait for key
// SwitchToText(FALSE);
@ -88,7 +88,7 @@ WaitForKeyPress(
//}
//#endif
VOID EndlessIdleLoop(VOID)
void EndlessIdleLoop(void)
{
UINTN index;

View File

@ -9,11 +9,11 @@
#define PLATFORM_BASICIO_H_
BOOLEAN ReadAllKeyStrokes(VOID);
VOID PauseForKey(CONST CHAR16* msg);
BOOLEAN ReadAllKeyStrokes(void);
void PauseForKey(CONST CHAR16* msg);
//VOID DebugPause(VOID);
VOID EndlessIdleLoop(VOID);
//void DebugPause(void);
void EndlessIdleLoop(void);

View File

@ -25,10 +25,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
/*
VOID
void
EFIAPI
BdsLibConnectAll (
VOID
void
)
{
//
@ -57,9 +57,9 @@ BdsLibConnectAll (
**/
/*
VOID
void
BdsLibGenericConnectAll (
VOID
void
)
{
//
@ -208,7 +208,7 @@ BdsLibConnectDevicePath (
EFI_STATUS
EFIAPI
BdsLibConnectAllEfi (
VOID
void
)
{
EFI_STATUS Status;
@ -253,7 +253,7 @@ BdsLibConnectAllEfi (
EFI_STATUS
EFIAPI
BdsLibDisconnectAllEfi (
VOID
void
)
{
EFI_STATUS Status;
@ -390,11 +390,15 @@ EFI_STATUS ScanDeviceHandles(EFI_HANDLE ControllerHandle,
}
}
//MsgLog("ScanDeviceHandles FreePool(OpenInfo)\n");
FreePool(OpenInfo);
//MsgLog("ScanDeviceHandles FreePool(OpenInfo) after\n");
}
}
//MsgLog("ScanDeviceHandles FreePool(ProtocolGuidArray)\n");
FreePool(ProtocolGuidArray);
//MsgLog("ScanDeviceHandles FreePool(ProtocolGuidArray) after\n");
}
}
@ -433,7 +437,7 @@ EFI_STATUS BdsLibConnectMostlyAllEfi()
EFI_PCI_IO_PROTOCOL* PciIo = NULL;
PCI_TYPE00 Pci;
MsgLog("1\n");
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &AllHandleCount, &AllHandleBuffer);
if (EFI_ERROR(Status))
return Status;
@ -460,7 +464,7 @@ EFI_STATUS BdsLibConnectMostlyAllEfi()
if (!Parent) {
if (HandleType[Index] & EFI_HANDLE_TYPE_DEVICE_HANDLE) {
Status = gBS->HandleProtocol (AllHandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID**)&PciIo);
Status = gBS->HandleProtocol (AllHandleBuffer[Index], &gEfiPciIoProtocolGuid, (void**)&PciIo);
if (!EFI_ERROR(Status)) {
Status = PciIo->Pci.Read (PciIo,EfiPciIoWidthUint32, 0, sizeof (Pci) / sizeof (UINT32), &Pci);
if (!EFI_ERROR(Status)) {
@ -492,10 +496,10 @@ Done:
sure all the system controllers have driver to manage it if have.
**/
VOID
void
EFIAPI
BdsLibConnectAllDriversToAllControllers (
VOID
void
)
{
EFI_STATUS Status;
@ -589,7 +593,7 @@ BdsLibConnectUsbDevByShortFormDP(
Status = gBS->HandleProtocol (
HandleArray[Index],
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo
(void **)&PciIo
);
if (!EFI_ERROR(Status)) {
//

View File

@ -12,12 +12,12 @@
//#include <Library/MemLogLib.h>
#include "DataHubCpu.h"
#include "../Platform/Settings.h"
#include "Self.h"
#include "guid.h"
/** Prints Number of bytes in a row (hex and ascii). Row size is MaxNumber. */
VOID
void
PrintBytesRow(IN UINT8 *Bytes, IN UINTN Number, IN UINTN MaxNumber)
{
UINTN Index;
@ -47,8 +47,8 @@ PrintBytesRow(IN UINT8 *Bytes, IN UINTN Number, IN UINTN MaxNumber)
}
/** Prints series of bytes. */
VOID
PrintBytes(IN VOID *Bytes, IN UINTN Number)
void
PrintBytes(IN void *Bytes, IN UINTN Number)
{
UINTN Index;
@ -62,24 +62,24 @@ static EFI_FILE_PROTOCOL* gLogFile = NULL;
EFI_FILE_PROTOCOL* GetDebugLogFile()
{
EFI_STATUS Status;
EFI_LOADED_IMAGE *LoadedImage;
EFI_FILE_PROTOCOL *RootDir;
EFI_FILE_PROTOCOL *LogFile;
if ( gLogFile ) return gLogFile;
if ( !self.isInitialized() ) return NULL;
// get RootDir from device we are loaded from
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
if (EFI_ERROR(Status)) {
return NULL;
}
RootDir = EfiLibOpenRoot(LoadedImage->DeviceHandle);
if (RootDir == NULL) {
return NULL;
}
// // get RootDir from device we are loaded from
// Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (void **) &LoadedImage);
// if (EFI_ERROR(Status)) {
// return NULL;
// }
// RootDir = EfiLibOpenRoot(LoadedImage->DeviceHandle);
// if (RootDir == NULL) {
// return NULL;
// }
// Open log file from current root
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
Status = self.getCloverDir().Open(&self.getCloverDir(), &LogFile, DEBUG_LOG_new, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
if ( GlobalConfig.ScratchDebugLogAtStart && Status == EFI_SUCCESS)
{
EFI_STATUS StatusDelete;
@ -87,22 +87,24 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
if ( StatusDelete == EFI_SUCCESS) {
Status = EFI_NOT_FOUND; // to get it created next.
}else{
DebugLog(1, "Cannot delete log file %ls from current root : %s\n", DEBUG_LOG, efiStrError(StatusDelete));
DebugLog(1, "Cannot delete log file %ls\\%ls from current root : %s\n", self.getCloverDirPathAsXStringW().wc_str(), DEBUG_LOG_new, efiStrError(StatusDelete));
}
}
// If the log file is not found try to create it
if (Status == EFI_NOT_FOUND) {
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
Status = self.getCloverDir().Open(&self.getCloverDir(), &LogFile, DEBUG_LOG_new, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
}
RootDir->Close(RootDir);
RootDir = NULL;
// RootDir->Close(RootDir);
// RootDir = NULL;
// Jief : do we really need this ?
if (EFI_ERROR(Status)) {
// try on first EFI partition
EFI_FILE* RootDir;
Status = egFindESP(&RootDir);
if (!EFI_ERROR(Status)) {
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
Status = RootDir->Open(RootDir, &LogFile, SWPrintf("%ls\\%ls", self.getCloverDirPathAsXStringW().wc_str(), DEBUG_LOG_new).wc_str(), EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
if ( GlobalConfig.ScratchDebugLogAtStart && Status == EFI_SUCCESS)
{
EFI_STATUS StatusDelete;
@ -110,12 +112,12 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
if ( StatusDelete == EFI_SUCCESS) {
Status = EFI_NOT_FOUND; // to get it created next.
}else{
DebugLog(1, "Cannot delete log file %ls from 1st EFI partition : %s\n", DEBUG_LOG, efiStrError(StatusDelete));
DebugLog(1, "Cannot delete log file %ls from 1st EFI partition : %s\n", SWPrintf("%ls\\%ls", self.getCloverDirPathAsXStringW().wc_str(), DEBUG_LOG_new).wc_str(), efiStrError(StatusDelete));
}
}
// If the log file is not found try to create it
if (Status == EFI_NOT_FOUND) {
Status = RootDir->Open(RootDir, &LogFile, DEBUG_LOG, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
Status = RootDir->Open(RootDir, &LogFile, SWPrintf("%ls\\%ls", self.getCloverDirPathAsXStringW().wc_str(), DEBUG_LOG_new).wc_str(), EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
}
RootDir->Close(RootDir);
RootDir = NULL;
@ -131,7 +133,7 @@ EFI_FILE_PROTOCOL* GetDebugLogFile()
}
VOID SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
void SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
{
EFI_STATUS Status;
STATIC BOOLEAN FirstTimeSave = TRUE;
@ -140,7 +142,7 @@ VOID SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
UINTN MemLogLen;
CHAR8 *Text;
UINTN TextLen;
EFI_FILE_HANDLE LogFile;
EFI_FILE* LogFile;
MemLogBuffer = GetMemLogBuffer();
MemLogLen = GetMemLogLen();
@ -170,7 +172,7 @@ VOID SaveMessageToDebugLogFile(IN CHAR8 *LastMessage)
}
}
VOID EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
void EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
{
// Print message to console
if (DebugMode >= 2) {
@ -187,7 +189,7 @@ VOID EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
// 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, ...)
void EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...)
{
VA_LIST Marker;
//UINTN offset = 0;
@ -203,7 +205,7 @@ VOID EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...)
VA_END(Marker);
}
VOID InitBooterLog(VOID)
void InitBooterLog(void)
{
SetMemLogCallback(MemLogCallback);
}
@ -235,7 +237,7 @@ EFI_STATUS SetupBooterLog(BOOLEAN AllowGrownSize)
// Made msgbuf and msgCursor private to this source
// so we need a different way of saving the msg log - apianti
EFI_STATUS SaveBooterLog(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *FileName)
EFI_STATUS SaveBooterLog(const EFI_FILE* BaseDir OPTIONAL, IN CONST CHAR16 *FileName)
{
CHAR8 *MemLogBuffer;
UINTN MemLogLen;
@ -261,7 +263,7 @@ EFI_STATUS SaveBooterLog(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *F
* 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, ...)
void EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...)
{
VA_LIST Marker;

View File

@ -11,22 +11,22 @@ extern "C" {
#include <Uefi/UefiBaseType.h>
#include <Protocol/SimpleFileSystem.h> // for EFI_FILE_HANDLE
#include <Protocol/SimpleFileSystem.h> // for EFI_FILE*
//#define SAFE_LOG_SIZE 80
//#define MSG_LOG_SIZE (256 * 1024)
#define PREBOOT_LOG L"EFI\\CLOVER\\misc\\preboot.log"
#define LEGBOOT_LOG L"EFI\\CLOVER\\misc\\legacy_boot.log"
#define BOOT_LOG L"EFI\\CLOVER\\misc\\boot.log"
#define SYSTEM_LOG L"EFI\\CLOVER\\misc\\system.log"
#define DEBUG_LOG L"EFI\\CLOVER\\misc\\debug.log"
//#define PREWAKE_LOG L"EFI\\CLOVER\\misc\\prewake.log"
#define PREBOOT_LOG_new L"misc\\preboot.log"
#define LEGBOOT_LOG_new L"misc\\legacy_boot.log"
#define BOOT_LOG_new L"misc\\boot.log"
#define SYSTEM_LOG_new L"misc\\system.log"
#define DEBUG_LOG_new L"misc\\debug.log"
//#define PREWAKE_LOG L"misc\\prewake.log"
VOID
InitBooterLog (VOID);
void
InitBooterLog (void);
EFI_STATUS
SetupBooterLog (
@ -35,15 +35,15 @@ SetupBooterLog (
EFI_STATUS
SaveBooterLog (
IN EFI_FILE_HANDLE BaseDir OPTIONAL,
IN CONST CHAR16 *FileName
const EFI_FILE* BaseDir OPTIONAL,
const CHAR16 *FileName
);
#ifdef _MSC_VER
#define __attribute__(x)
#endif
VOID
void
EFIAPI
DebugLog (
IN INTN DebugMode,
@ -51,9 +51,9 @@ DebugLog (
/** Prints series of bytes. */
VOID
void
PrintBytes (
IN VOID *Bytes,
IN void *Bytes,
IN UINTN Number
);
@ -62,7 +62,7 @@ PrintBytes (
* OpenCore
*/
// This use the EDK format
VOID EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...);
void EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...);

View File

@ -181,7 +181,7 @@ CreateBootOptionDevicePath (
//
// Check that FileDeviceHandle is file system volume
//
Status = gBS->HandleProtocol (FileDeviceHandle, &gEfiSimpleFileSystemProtocolGuid, (VOID**)&Volume);
Status = gBS->HandleProtocol (FileDeviceHandle, &gEfiSimpleFileSystemProtocolGuid, (void**)&Volume);
if (EFI_ERROR(Status)) {
DBG("CreateBootOptionDevicePath: FileDeviceHandle %p is not fs volume", FileDeviceHandle);
return EFI_INVALID_PARAMETER;
@ -310,7 +310,7 @@ DevicePathEqual (
/** Prints BootOrder with DBG. */
VOID
void
PrintBootOrder (
IN UINT16 BootOrder[],
IN UINTN BootOrderLen
@ -522,7 +522,7 @@ DeleteFromBootOrder (
/** Prints BootOption with DBG(). */
VOID
void
PrintBootOption (
IN BO_BOOT_OPTION *BootOption,
IN UINTN Index
@ -829,7 +829,7 @@ FindBootOptionForFile (
}
/** Prints BootXXXX vars found listed in BootOrder, plus print others if AllBootOptions == TRUE. */
VOID
void
PrintBootOptions (
IN BOOLEAN AllBootOptions
)

View File

@ -16,7 +16,7 @@ typedef struct {
///
/// Pointer to raw EFI_LOAD_OPTION (BootXXXX) variable content.
///
VOID *Variable;
void *Variable;
///
/// Variable size in bytes.
///
@ -65,13 +65,13 @@ EFI_STATUS
ParseBootOption (OUT BO_BOOT_OPTION *BootOption);
/** Prints BootXXXX vars found listed in BootOrder, plus print others if AllBootOptions == TRUE. */
VOID
void
PrintBootOptions (
IN BOOLEAN AllBootOptions
);
/** Prints BootOrder with DBG. */
VOID
void
PrintBootOrder (
IN UINT16 BootOrder[],
IN UINTN BootOrderLen

View File

@ -89,3 +89,19 @@ InitializeConsoleSim ()
return Status;
}
EFI_STATUS
UninitializeConsoleSim ()
{
EFI_STATUS Status;
Status = gBS->UninstallMultipleProtocolInterfaces (
&gImageHandle,
&gEfiConsoleControlProtocolGuid,
&gConsoleController,
NULL
);
MsgLog("UninitializeConsoleSim : Status %s\n", efiStrError(Status));
return Status;
}

View File

@ -11,8 +11,10 @@
EFI_STATUS
InitializeConsoleSim (VOID);
InitializeConsoleSim (void);
EFI_STATUS
UninitializeConsoleSim ();
#endif /* PLATFORM_CONSOLE_H_ */

View File

@ -98,7 +98,7 @@ typedef struct {
UINT32 EFIAPI
CopyRecord(IN PLATFORM_DATA_RECORD *Rec,
IN CONST CHAR16 *Name,
IN const VOID *Val,
IN const void *Val,
IN UINT32 ValLen)
{
CopyMem(&Rec->Hdr, &mCpuDataRecordHeader, sizeof(EFI_SUBCLASS_TYPE1_HEADER));
@ -115,7 +115,7 @@ CopyRecord(IN PLATFORM_DATA_RECORD *Rec,
EFI_STATUS EFIAPI
LogDataHub(IN EFI_GUID *TypeGuid,
IN CONST CHAR16 *Name,
IN const VOID *Data,
IN const void *Data,
IN UINT32 DataSize)
{
UINT32 RecordSize;
@ -169,7 +169,7 @@ OvrSetVariable(
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN void *Data
)
{
EFI_STATUS Status;
@ -211,7 +211,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
CONST CHAR16 *KbdPrevLang;
UINTN LangLen;
VOID *OldData;
void *OldData;
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
CHAR8 *PlatformLang;
@ -310,7 +310,7 @@ 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
@ -381,7 +381,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
}
if (gSettings.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);
}
@ -421,7 +421,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
return EFI_SUCCESS;
}
VOID
void
AddSMCkey(SMC_KEY Key, SMC_DATA_SIZE Size, SMC_KEY_TYPE Type, SMC_DATA *Data)
{
if (gAppleSmc && (gAppleSmc->Signature == NON_APPLE_SMC_SIGNATURE)) {
@ -432,7 +432,7 @@ AddSMCkey(SMC_KEY Key, SMC_DATA_SIZE Size, SMC_KEY_TYPE Type, SMC_DATA *Data)
// SetupDataForOSX
/// Sets the DataHub data used by OS X
VOID EFIAPI
void EFIAPI
SetupDataForOSX(BOOLEAN Hibernate)
{
EFI_STATUS Status;
@ -482,7 +482,7 @@ SetupDataForOSX(BOOLEAN Hibernate)
gSettings.CpuFreqMHz = (UINT32)DivU64x32(CpuSpeed, Mega);
// 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.ProductName);

View File

@ -20,11 +20,11 @@ EFIAPI
LogDataHub (
EFI_GUID *TypeGuid,
CONST CHAR16 *Name,
const VOID *Data,
const void *Data,
UINT32 DataSize
);
VOID
void
EFIAPI
SetupDataForOSX (BOOLEAN Hibernate);

View File

@ -86,7 +86,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathPci (
// IN OUT POOL_PRINT *Str,
// IN PCI_DEVICE_PATH *DevPath
@ -108,7 +108,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathPccard (
// IN OUT POOL_PRINT *Str,
// IN PCCARD_DEVICE_PATH *DevPath
@ -130,7 +130,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathMemMap (
// IN OUT POOL_PRINT *Str,
// IN MEMMAP_DEVICE_PATH *DevPath
@ -158,7 +158,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathController (
// IN OUT POOL_PRINT *Str,
// IN CONTROLLER_DEVICE_PATH *DevPath
@ -178,7 +178,7 @@
// @param DevPath Pointer to vendor device path
//
//**/
//VOID
//void
//DevPathVendor (
// IN OUT POOL_PRINT *Str,
// IN VENDOR_DEVICE_PATH *DevPath
@ -303,7 +303,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathAcpi (
// IN OUT POOL_PRINT *Str,
// IN ACPI_HID_DEVICE_PATH *DevPath
@ -329,7 +329,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathExtendedAcpi (
// IN OUT POOL_PRINT *Str,
// IN ACPI_EXTENDED_HID_DEVICE_PATH *DevPath
@ -447,7 +447,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathAdrAcpi (
// IN OUT POOL_PRINT *Str,
// IN ACPI_ADR_DEVICE_PATH *DevPath
@ -479,7 +479,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathAtapi (
// IN OUT POOL_PRINT *Str,
// IN ATAPI_DEVICE_PATH *DevPath
@ -506,7 +506,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathScsi (
// IN OUT POOL_PRINT *Str,
// IN SCSI_DEVICE_PATH *DevPath
@ -528,7 +528,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathFibre (
// IN OUT POOL_PRINT *Str,
// IN FIBRECHANNEL_DEVICE_PATH *DevPath
@ -550,7 +550,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPath1394 (
// IN OUT POOL_PRINT *Str,
// IN F1394_DEVICE_PATH *DevPath
@ -572,7 +572,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathUsb (
// IN OUT POOL_PRINT *Str,
// IN USB_DEVICE_PATH *DevPath
@ -594,7 +594,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathUsbWWID (
// IN OUT POOL_PRINT *Str,
// IN USB_WWID_DEVICE_PATH *DevPath
@ -622,7 +622,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathLogicalUnit (
// IN OUT POOL_PRINT *Str,
// IN DEVICE_LOGICAL_UNIT_DEVICE_PATH *DevPath
@ -644,7 +644,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathUsbClass (
// IN OUT POOL_PRINT *Str,
// IN USB_CLASS_DEVICE_PATH *DevPath
@ -674,7 +674,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathSata (
// IN OUT POOL_PRINT *Str,
// IN SATA_DEVICE_PATH *DevPath
@ -714,7 +714,7 @@
// representation for a device node can be used, where applicable.
//
// **/
//VOID
//void
//DevPathToTextNVMe (
// IN OUT POOL_PRINT *Str,
// IN NVME_NAMESPACE_DEVICE_PATH *DevPath /*,
@ -748,7 +748,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathI2O (
// IN OUT POOL_PRINT *Str,
// IN I2O_DEVICE_PATH *DevPath
@ -770,7 +770,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathMacAddr (
// IN OUT POOL_PRINT *Str,
// IN MAC_ADDR_DEVICE_PATH *DevPath
@ -806,7 +806,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathIPv4 (
// IN OUT POOL_PRINT *Str,
// IN IPv4_DEVICE_PATH *DevPath
@ -836,7 +836,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathIPv6 (
// IN OUT POOL_PRINT *Str,
// IN IPv6_DEVICE_PATH *DevPath
@ -877,7 +877,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathInfiniBand (
// IN OUT POOL_PRINT *Str,
// IN INFINIBAND_DEVICE_PATH *DevPath
@ -907,7 +907,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathUart (
// IN OUT POOL_PRINT *Str,
// IN UART_DEVICE_PATH *DevPath
@ -992,7 +992,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathiSCSI (
// IN OUT POOL_PRINT *Str,
// IN ISCSI_DEVICE_PATH_WITH_NAME *DevPath
@ -1035,7 +1035,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathVlan (
// IN OUT POOL_PRINT *Str,
// IN VLAN_DEVICE_PATH *DevPath
@ -1057,7 +1057,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathHardDrive (
// IN OUT POOL_PRINT *Str,
// IN HARDDRIVE_DEVICE_PATH *DevPath
@ -1107,7 +1107,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathCDROM (
// IN OUT POOL_PRINT *Str,
// IN CDROM_DEVICE_PATH *DevPath
@ -1129,7 +1129,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathFilePath (
// IN OUT POOL_PRINT *Str,
// IN FILEPATH_DEVICE_PATH *DevPath
@ -1151,7 +1151,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathMediaProtocol (
// IN OUT POOL_PRINT *Str,
// IN MEDIA_PROTOCOL_DEVICE_PATH *DevPath
@ -1173,7 +1173,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathFvFilePath (
// IN OUT POOL_PRINT *Str,
// IN MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *DevPath
@ -1195,7 +1195,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathRelativeOffsetRange0 (
// IN OUT POOL_PRINT *Str,
// IN MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *DevPath
@ -1222,7 +1222,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathBssBss (
// IN OUT POOL_PRINT *Str,
// IN BBS_BBS_DEVICE_PATH *DevPath
@ -1278,10 +1278,10 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathEndInstance (
// IN OUT POOL_PRINT *Str,
// IN VOID *DevPath
// IN void *DevPath
// )
//{
// CatPrint (Str, L",");
@ -1297,10 +1297,10 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathNodeUnknown (
// IN OUT POOL_PRINT *Str,
// IN VOID *DevPath
// IN void *DevPath
// )
//{
// CatPrint (Str, L"?");
@ -1315,7 +1315,7 @@
// @param DevPath The device path.
//
//**/
//static VOID
//static void
//DevPathFvPath (
// IN OUT POOL_PRINT *Str,
// IN MEDIA_FW_VOL_DEVICE_PATH *DevPath
@ -1537,7 +1537,7 @@
//{
// POOL_PRINT Str;
// EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
// VOID (*DumpNode) (POOL_PRINT *, VOID *);
// void (*DumpNode) (POOL_PRINT *, void *);
//
// UINTN Index;
// UINTN NewSize;
@ -1555,7 +1555,7 @@
// Status = gBS->LocateProtocol (
// &gEfiDevicePathToTextProtocolGuid,
// NULL,
// (VOID **) &DevPathToText
// (void **) &DevPathToText
// );
// if (!EFI_ERROR(Status)) {
// ToText = DevPathToText->ConvertDevicePathToText (

View File

@ -58,7 +58,7 @@ InitializeEdidOverride ()
}
//used only if VBiosPatchNeeded and if no CustomEDID
UINT8* getCurrentEdid (VOID)
UINT8* getCurrentEdid (void)
{
EFI_STATUS Status;
EFI_EDID_ACTIVE_PROTOCOL *EdidProtocol;
@ -66,7 +66,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) {
@ -78,7 +78,7 @@ UINT8* getCurrentEdid (VOID)
return Edid;
}
VOID DebugDumpEDID(CONST CHAR8 *Message, INTN N)
void DebugDumpEDID(CONST CHAR8 *Message, INTN N)
{
INTN i,j;
// Don't dump in the case of debug logging because of too slow output
@ -100,7 +100,7 @@ VOID DebugDumpEDID(CONST CHAR8 *Message, INTN N)
// if EFI_SUCCESS then result in gSettings.CustomEDID != NULL
// first priority is CustomEDID
// second is UEFI EDID from EdidDiscoveredProtocol
EFI_STATUS GetEdidDiscovered(VOID)
EFI_STATUS GetEdidDiscovered(void)
{
EFI_STATUS Status = EFI_SUCCESS;
UINTN N = 0;
@ -111,7 +111,7 @@ EFI_STATUS GetEdidDiscovered(VOID)
N = gSettings.CustomEDIDsize;
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 (!GlobalConfig.DebugLog) {

View File

@ -11,13 +11,13 @@
EFI_STATUS
InitializeEdidOverride (VOID);
InitializeEdidOverride (void);
UINT8*
getCurrentEdid (VOID);
getCurrentEdid (void);
EFI_STATUS
GetEdidDiscovered (VOID);
GetEdidDiscovered (void);

View File

@ -61,7 +61,7 @@ EFI_HANDLE mHandle = NULL;
extern EFI_RUNTIME_SERVICES gOrgRS;
/*
VOID WaitForCR()
void WaitForCR()
{
EFI_STATUS Status;
EFI_INPUT_KEY key;
@ -81,7 +81,7 @@ VOID WaitForCR()
*/
#if 0
//this procedure was developed for 10.5. Seems no more needed
VOID CorrectMemoryMap(IN UINT32 memMap,
void CorrectMemoryMap(IN UINT32 memMap,
IN UINT32 memDescriptorSize,
IN OUT UINT32 *memMapSize)
{
@ -217,9 +217,9 @@ VOID CorrectMemoryMap(IN UINT32 memMap,
}
#endif
VOID
void
EFIAPI
OnExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
OnExitBootServices(IN EFI_EVENT Event, IN void *Context)
{
/*
if (gCPUStructure.Vendor == CPU_VENDOR_INTEL &&
@ -339,11 +339,11 @@ OnExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
}
}
VOID
void
EFIAPI
OnReadyToBoot (
IN EFI_EVENT Event,
IN VOID *Context
IN void *Context
)
{
/*
@ -360,22 +360,22 @@ OnReadyToBoot (
gST->ConOut->OutputString (gST->ConOut, L"-- ReadyToBoot --\n");
}
VOID
void
EFIAPI
VirtualAddressChangeEvent (
IN EFI_EVENT Event,
IN VOID *Context
IN void *Context
)
{
// EfiConvertPointer (0x0, (VOID **) &mProperty);
// EfiConvertPointer (0x0, (VOID **) &mSmmCommunication);
// EfiConvertPointer (0x0, (void **) &mProperty);
// EfiConvertPointer (0x0, (void **) &mSmmCommunication);
}
VOID
void
EFIAPI
OnSimpleFileSystem (
IN EFI_EVENT Event,
IN VOID *Context
IN void *Context
)
{
EFI_TPL OldTpl;
@ -397,7 +397,7 @@ GuiEventsInitialize ()
{
EFI_STATUS Status;
EFI_EVENT Event;
VOID* RegSimpleFileSystem = NULL;
void* RegSimpleFileSystem = NULL;
gEvent = 0;
Status = gBS->CreateEvent (
@ -515,7 +515,7 @@ EFI_STATUS
EventsInitialize (IN LOADER_ENTRY *Entry)
{
EFI_STATUS Status;
VOID* Registration = NULL;
void* Registration = NULL;
//
// Register the event to reclaim variable for OS usage.
@ -585,7 +585,7 @@ EFI_STATUS EjectVolume(IN REFIT_VOLUME *Volume)
ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);
Status = gBS->HandleProtocol(Volume->DeviceHandle, &gEfiScsiIoProtocolGuid, (VOID **) &ScsiIo);
Status = gBS->HandleProtocol(Volume->DeviceHandle, &gEfiScsiIoProtocolGuid, (void **) &ScsiIo);
if (ScsiIo) {
// Target = &TargetArray[0];
// ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
@ -602,7 +602,7 @@ EFI_STATUS EjectVolume(IN REFIT_VOLUME *Volume)
Status = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
} else {
Status = gBS->HandleProtocol(Volume->DeviceHandle, &gEfiBlockIoProtocolGuid, (VOID **) &BlkIo);
Status = gBS->HandleProtocol(Volume->DeviceHandle, &gEfiBlockIoProtocolGuid, (void **) &BlkIo);
if (BlkIo) {
UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (BlkIo);
if (!UsbMass) {

View File

@ -21,7 +21,7 @@ EventsInitialize (
EFI_STATUS
GuiEventsInitialize (VOID);
GuiEventsInitialize (void);
// timeout will be in ms here, as small as 1ms and up

View File

@ -550,7 +550,7 @@ CONST CHAR8* get_net_model(UINT32 id) {
return NetChipsets[0].name;
}
VOID GetPciADR(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *Addr1, OUT UINT32 *Addr2, OUT UINT32 *Addr3)
void GetPciADR(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *Addr1, OUT UINT32 *Addr2, OUT UINT32 *Addr3)
{
PCI_DEVICE_PATH *PciNode;
UINTN PciNodeCount;
@ -600,7 +600,7 @@ BOOLEAN NativeUSB(UINT16 DID)
return ((d == 0x2600) || (d == 0x2700) || (d == 0x2800) || (d == 0x3a00) || (d == /*NFORCE_USB->*/0x0a00));
}
VOID CheckHardware()
void CheckHardware()
{
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer = NULL;
@ -636,7 +636,7 @@ VOID CheckHardware()
Status = gBS->HandleProtocol (
Handle,
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo
(void **)&PciIo
);
if (!EFI_ERROR(Status)) {
UINT32 deviceid;
@ -851,7 +851,7 @@ VOID CheckHardware()
UINT8 slash[] = {0x5c, 0};
VOID InsertScore(UINT8* dsdt, UINT32 off2, INTN root)
void InsertScore(UINT8* dsdt, UINT32 off2, INTN root)
{
UINT8 NumNames = 0;
UINT32 ind = 0, i;
@ -894,7 +894,7 @@ VOID InsertScore(UINT8* dsdt, UINT32 off2, INTN root)
acpi_cpu_score[ind] = 0;
}
VOID findCPU(UINT8* dsdt, UINT32 length)
void findCPU(UINT8* dsdt, UINT32 length)
{
UINT32 i, k, size;
UINT32 SBSIZE = 0, SBADR = 0;
@ -1655,7 +1655,7 @@ UINT32 GetPciDevice(UINT8 *dsdt, UINT32 len)
// Find PCIRootUID and all need Fix Device
VOID findPciRoot (UINT8 *dsdt, UINT32 len)
void findPciRoot (UINT8 *dsdt, UINT32 len)
{
UINTN j;
UINT32 PCIADR, PCISIZE = 0;
@ -1888,7 +1888,7 @@ UINT32 FIXDarwin (UINT8* dsdt, UINT32 len)
return len;
}
VOID FixS3D (UINT8* dsdt, UINT32 len)
void FixS3D (UINT8* dsdt, UINT32 len)
{
UINT32 i;
DBG("Start _S3D Fix\n");
@ -1972,7 +1972,7 @@ UINT32 AddPNLF (UINT8 *dsdt, UINT32 len)
Status = gBS->HandleProtocol (
Handle,
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo
(void **)&PciIo
);
if (!EFI_ERROR(Status)) {
PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
@ -4129,7 +4129,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
if (gSettings.FakeXHCI) {
USBID[i] = gSettings.FakeXHCI >> 16;
}
CopyMem(USBDATA3+k, (VOID*)&USBID[i], 4);
CopyMem(USBDATA3+k, (void*)&USBID[i], 4);
sizeoffset = size3;
} else if (USB20[i]) {
if ((USBDATA2[25] == 0x0A) && (USBDATA2[26] == 0x04)) {
@ -4139,7 +4139,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
} else {
continue;
}
CopyMem(USBDATA2+k, (VOID*)&USBID[i], 4);
CopyMem(USBDATA2+k, (void*)&USBID[i], 4);
sizeoffset = size2;
} else {
if ((USBDATA1[25] == 0x0A) && (USBDATA1[26] == 0x04)) {
@ -4150,7 +4150,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
continue;
}
CopyMem(USBDATA1+k, (VOID*)&USBID[i], 4);
CopyMem(USBDATA1+k, (void*)&USBID[i], 4);
sizeoffset = size1;
}
@ -4200,7 +4200,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
continue;
}
CopyMem(USBDATA2+k, (VOID*)&USBID[i], 4);
CopyMem(USBDATA2+k, (void*)&USBID[i], 4);
sizeoffset = size2;
} else {
@ -4212,7 +4212,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
continue;
}
CopyMem(USBDATA1+k, (VOID*)&USBID[i], 4);
CopyMem(USBDATA1+k, (void*)&USBID[i], 4);
sizeoffset = size1;
}
@ -5024,7 +5024,7 @@ UINT32 FIXOTHER (UINT8 *dsdt, UINT32 len)
}
#endif
VOID FixRegions (UINT8 *dsdt, UINT32 len)
void FixRegions (UINT8 *dsdt, UINT32 len)
{
UINTN i, j;
INTN shift;
@ -5088,7 +5088,7 @@ VOID FixRegions (UINT8 *dsdt, UINT32 len)
}
}
VOID GetBiosRegions(UINT8 *buffer)
void GetBiosRegions(UINT8 *buffer)
{
EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
// UINT8 *buffer = NULL;
@ -5152,7 +5152,7 @@ VOID GetBiosRegions(UINT8 *buffer)
// Although Mutex with non-zero SyncLevel is perfectly legal macOS/OS X doesn't like
// One of the common fixes for ACPI battery status on laptops
#define IsNameChar(ch) (((ch)>='A' && (ch)<='Z') || ((ch)>='0' && (ch)<='9') || (ch)=='_')
VOID FixMutex(UINT8 *dsdt, UINT32 len)
void FixMutex(UINT8 *dsdt, UINT32 len)
{
UINT8* p = dsdt + sizeof(EFI_ACPI_DESCRIPTION_HEADER);
UINT8* end = dsdt + len - 7; // pattern is 7-bytes
@ -5236,7 +5236,7 @@ BOOLEAN CmpFullName(UINT8* Table, UINTN Len, ACPI_NAME_LIST *Bridge)
return TRUE;
}
VOID RenameDevices(UINT8* table)
void RenameDevices(UINT8* table)
{
ACPI_NAME_LIST *List;
ACPI_NAME_LIST *Bridge;
@ -5326,7 +5326,7 @@ VOID RenameDevices(UINT8* table)
MsgLog(" %lld replacements\n", Num);
}
VOID FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, const XString8& OSVersion)
void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, const XString8& OSVersion)
{
UINT32 DsdtLen;

View File

@ -57,7 +57,7 @@ struct _oper_region {
typedef struct _oper_region OPER_REGION;
VOID
void
FixBiosDsdt (
UINT8 *Dsdt,
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *fadt,
@ -65,10 +65,10 @@ FixBiosDsdt (
);
VOID
void
RenameDevices(UINT8* table);
VOID
void
GetBiosRegions (
UINT8 *buffer
);

View File

@ -26,6 +26,7 @@
#include "StateGenerator.h"
#include "AmlGenerator.h"
#include "../Platform/Settings.h"
#include "Self.h"
CONST CHAR8 *gWidgetNames[HDA_WIDGET_TYPE_VENDOR + 1] = {
"Audio Output", "Audio Input", "Audio Mixer",
@ -59,7 +60,7 @@ CONST CHAR8 hdcID[4] = HDC_ID;
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
extern XStringW OEMPath;
VOID
void
EFIAPI
HdaCodecDumpPrintRatesFormats(
IN UINT32 Rates,
@ -117,7 +118,7 @@ HdaCodecDumpPrintRatesFormats(
HdaLog("\n");
}
VOID
void
EFIAPI
HdaCodecDumpPrintAmpCaps(
IN UINT32 AmpCaps) {
@ -129,7 +130,7 @@ HdaCodecDumpPrintAmpCaps(
HdaLog("N/A\n");
}
VOID
void
EFIAPI
HdaCodecDumpPrintWidgets(
IN EFI_HDA_IO_PROTOCOL *HdaIo,
@ -273,7 +274,6 @@ EFI_STATUS SaveHdaDumpTxt()
// EFI_HDA_CODEC_INFO_PROTOCOL *HdaCodecInfo;
HDA_FUNC_GROUP *AudioFuncGroup;
EFI_HDA_IO_PROTOCOL *HdaIo;
XStringW MiscPath = SWPrintf("%ls\\misc", OEMPath.wc_str());
CHAR8 *MemLogStart;
UINTN MemLogStartLen;
@ -284,7 +284,7 @@ EFI_STATUS SaveHdaDumpTxt()
HdaLog("HdaCodecDump Start\n");
Status = gBS->HandleProtocol(AudioList[i].Handle, &gEfiAudioIoProtocolGuid, (VOID**)&AudioIo);
Status = gBS->HandleProtocol(AudioList[i].Handle, &gEfiAudioIoProtocolGuid, (void**)&AudioIo);
if (EFI_ERROR(Status))
continue;
@ -332,11 +332,12 @@ EFI_STATUS SaveHdaDumpTxt()
UINTN WidgetCount = AudioFuncGroup->WidgetsCount;
HdaCodecDumpPrintWidgets(HdaIo, Widgets, WidgetCount);
XStringW PathHdaDump = SWPrintf("%ls\\HdaCodec#%llu (%ls).txt", MiscPath.wc_str(), i, HdaCodecDev->Name);
XStringW PathHdaDump = SWPrintf("misc\\HdaCodec#%llu (%ls).txt", i, HdaCodecDev->Name);
Status = egSaveFile(SelfRootDir, PathHdaDump.wc_str(), (VOID *)MemLogStart, GetMemLogLen() - MemLogStartLen);
Status = egSaveFile(&self.getCloverDir(), PathHdaDump.wc_str(), (void *)MemLogStart, GetMemLogLen() - MemLogStartLen);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, PathHdaDump.wc_str(), (VOID *)MemLogStart, GetMemLogLen() - MemLogStartLen);
// Jief : don't write outside SelfDir
// Status = egSaveFile(NULL, PathHdaDump.wc_str(), (void *)MemLogStart, GetMemLogLen() - MemLogStartLen);
}
}
return Status;
@ -350,7 +351,6 @@ EFI_STATUS SaveHdaDumpBin()
// EFI_HDA_CODEC_INFO_PROTOCOL *HdaCodecInfo;
HDA_FUNC_GROUP *AudioFuncGroup;
EFI_HDA_IO_PROTOCOL *HdaIo;
XStringW MiscPath = SWPrintf("%ls\\misc", OEMPath.wc_str());
for (UINTN i = 0; i < AudioList.size(); i++) {
HDA_WIDGET_DEV *Widgets;
@ -362,7 +362,7 @@ EFI_STATUS SaveHdaDumpBin()
UINT8 *HdaCodecDataPtr;
XStringW PathHdaDump;
Status = gBS->HandleProtocol(AudioList[i].Handle, &gEfiAudioIoProtocolGuid, (VOID**)&AudioIo);
Status = gBS->HandleProtocol(AudioList[i].Handle, &gEfiAudioIoProtocolGuid, (void**)&AudioIo);
if (EFI_ERROR(Status))
continue;
@ -471,9 +471,9 @@ EFI_STATUS SaveHdaDumpBin()
HdaCodecDataPtr += sizeof(HdaWidget);
}
PathHdaDump = SWPrintf("%ls\\HdaCodec#%llu (%ls).bin", MiscPath.wc_str(), i, HdaCodecDev->Name);
PathHdaDump = SWPrintf("misc\\HdaCodec#%llu (%ls).bin", i, HdaCodecDev->Name);
Status = egSaveFile(SelfRootDir, PathHdaDump.wc_str(), HdaCodecData, HdaCodecDataSize);
Status = egSaveFile(&self.getCloverDir(), PathHdaDump.wc_str(), HdaCodecData, HdaCodecDataSize);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, PathHdaDump.wc_str(), HdaCodecData, HdaCodecDataSize);
}

View File

@ -200,7 +200,7 @@ INT32 mac_to_posix(UINT32 mac_time)
return mac_time ? mac_time - 2082844800 : 0;
}
/* not used
VOID fsw_efi_decode_time(OUT EFI_TIME *EfiTime, IN UINT32 UnixTime)
void fsw_efi_decode_time(OUT EFI_TIME *EfiTime, IN UINT32 UnixTime)
{
INT32 days, rem;
INT32 y, newy, yleap;
@ -291,7 +291,7 @@ SimpleRtcRead (
}
STATIC
VOID
void
SimpleRtcWrite (
IN UINT8 Offset,
IN UINT8 Value
@ -321,7 +321,7 @@ EFIAPI OurBlockIoRead (
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
OUT VOID *Buffer
OUT void *Buffer
)
{
EFI_STATUS Status;
@ -374,7 +374,7 @@ EFIAPI OurBlockIoRead (
}
/** Get sleep image location (volume and name) */
VOID
void
GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume, XStringW* SleepImageNamePtr)
{
EFI_STATUS Status = EFI_NOT_FOUND;
@ -486,7 +486,7 @@ GetSleepImagePosition (IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume)
{
EFI_STATUS Status = EFI_SUCCESS;
EFI_FILE *File = NULL;
VOID *Buffer;
void *Buffer;
UINTN BufferSize;
XStringW ImageName;
REFIT_VOLUME *ImageVolume;
@ -592,7 +592,7 @@ BOOLEAN
IsSleepImageValidBySleepTime (IN REFIT_VOLUME *Volume)
{
EFI_STATUS Status;
VOID *Buffer;
void *Buffer;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
HFSPlusVolumeHeaderMin *HFSHeader;
UINT32 HFSVolumeModifyDate;
@ -804,7 +804,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
} else {
XStringW TmpStr = SWPrintf("%ls", strguid(&TmpGuid));
DBG("got the guid %ls\n", TmpStr.wc_str());
CopyMem((VOID*)Ptr, TmpStr, StrSize(TmpStr));
CopyMem((void*)Ptr, TmpStr, StrSize(TmpStr));
DBG("fter CopyMem: %ls\n", Ptr);
}
}
@ -839,7 +839,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
if (!gFirmwareClover &&
(!gDriversFlags.EmuVariableLoaded || GlobalConfig.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;
@ -890,7 +890,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");
@ -922,7 +922,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
} else {
XStringW TmpStr = GuidLEToXStringW(TmpGuid);
//DBG("got the guid %ls\n", TmpStr);
memcpy((VOID*)Ptr, TmpStr.wc_str(), TmpStr.sizeInBytes());
memcpy((void*)Ptr, TmpStr.wc_str(), TmpStr.sizeInBytes());
}
}
if (StrCmp(gST->FirmwareVendor, L"INSYDE Corp.") != 0) {
@ -986,7 +986,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume)
UINT64 SleepImageOffset;
EFI_DEVICE_PATH_PROTOCOL *BootImageDevPath;
UINTN Size = 0;
VOID *Value = NULL;
void *Value = NULL;
AppleRTCHibernateVars RtcVars;
UINT8 *VarData = NULL;
REFIT_VOLUME *SleepImageVolume;

View File

@ -82,7 +82,7 @@ EFI_STATUS
IN APPLE_GETVAR_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CHAR16 *Name,
OUT VOID *Value, OPTIONAL
OUT void *Value, OPTIONAL
IN OUT UINTN *Size
);
@ -107,7 +107,7 @@ EFI_STATUS
IN APPLE_GETVAR_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CHAR16 *Name,
IN VOID *Value,
IN void *Value,
IN UINTN Size
);
@ -187,7 +187,7 @@ APPLE_GETVAR_PROTOCOL mDeviceProperties=
};
typedef EFI_STATUS (EFIAPI *EFI_SCREEN_INFO_FUNCTION)(
VOID* This,
void* This,
UINT64* baseAddress,
UINT64* frameBufferSize,
UINT32* byterPerRow,
@ -200,7 +200,7 @@ typedef struct {
EFI_SCREEN_INFO_FUNCTION GetScreenInfo;
} EFI_INTERFACE_SCREEN_INFO;
EFI_STATUS EFIAPI GetScreenInfo(VOID* This, UINT64* baseAddress, UINT64* frameBufferSize,
EFI_STATUS EFIAPI GetScreenInfo(void* This, UINT64* baseAddress, UINT64* frameBufferSize,
UINT32* bpr, UINT32* w, UINT32* h, UINT32* colorDepth)
{
/*
@ -215,7 +215,7 @@ EFI_STATUS EFIAPI GetScreenInfo(VOID* This, UINT64* baseAddress, UINT64* frameBu
Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
(VOID **) &mGraphicsOutput);
(void **) &mGraphicsOutput);
if(EFI_ERROR(Status))
return EFI_UNSUPPORTED;
//this print never occured so this procedure is redundant
@ -246,7 +246,7 @@ EFI_INTERFACE_SCREEN_INFO mScreenInfo=
extern EFI_GUID gAppleOSLoadedNamedEventGuid;
// OSInfoOSNameImpl
VOID
void
EFIAPI
OSInfoOSNameImpl (
OUT CHAR8 *OSName
@ -255,13 +255,13 @@ OSInfoOSNameImpl (
// for future developers
// this variable can be used at OnExitBoootServices,
// as it will be set by boot.efi
BootOSName = (__typeof__(BootOSName))AllocateCopyPool(AsciiStrLen(OSName) + 1, (VOID*)OSName);
BootOSName = (__typeof__(BootOSName))AllocateCopyPool(AsciiStrLen(OSName) + 1, (void*)OSName);
DBG("OSInfo:OSName called\n");
EfiNamedEventSignal (&gAppleOSLoadedNamedEventGuid);
}
// OSInfoOSVendorImpl
VOID
void
EFIAPI
OSInfoOSVendorImpl (
IN CHAR8 *OSVendor
@ -299,7 +299,7 @@ EFI_OS_INFO_PROTOCOL mEfiOSInfo = {
EFI_STATUS
EFIAPI
RestoreConfig (APPLE_GRAPH_CONFIG_PROTOCOL* This,
UINT32 Param1, UINT32 Param2, VOID* Param3, VOID* Param4, VOID* Param5
UINT32 Param1, UINT32 Param2, void* Param3, void* Param4, void* Param5
)
{
DBG("RestoreConfig called Param1=%x\n", Param1);
@ -359,7 +359,7 @@ EFI_KEYBOARD_INFO_PROTOCOL mKeyboardInfo = {
//};
EFI_STATUS
SetPrivateVarProto(VOID)
SetPrivateVarProto(void)
{
EFI_STATUS Status;
//This must be independent install

View File

@ -20,7 +20,7 @@ extern CHAR8 *BootOSName;
//extern OC_ABC_SETTINGS_4CLOVER gQuirks;
EFI_STATUS
SetPrivateVarProto (VOID);
SetPrivateVarProto (void);

View File

@ -65,7 +65,7 @@ InitializeBiosIntCaller (
return Status;
}
mThunkContext->RealModeBuffer = (VOID*)(UINTN)LegacyRegionBase;
mThunkContext->RealModeBuffer = (void*)(UINTN)LegacyRegionBase;
mThunkContext->RealModeBufferSize = LegacyRegionSize;
mThunkContext->ThunkAttributes = THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15;
DBG("mThunkContext->RealModeBuffer: %p, mThunkContext->RealModeBufferSize: %d\n", mThunkContext->RealModeBuffer, mThunkContext->RealModeBufferSize);
@ -126,7 +126,7 @@ InitializeInterruptRedirection (
//
// Copy code to legacy region
//
CopyMem((VOID *)(UINTN)LegacyRegionBase, (VOID *)&InterruptRedirectionCode[0], sizeof (InterruptRedirectionCode));
CopyMem((void *)(UINTN)LegacyRegionBase, (void *)&InterruptRedirectionCode[0], sizeof (InterruptRedirectionCode));
//
// Get VectorBase, it should be 0x68
@ -153,7 +153,7 @@ InitializeInterruptRedirection (
When BiosVideo disconnects, it takes care of setting Text VGA Mode (80x25) which works properly with Legacy mode
**/
EFI_STATUS
DisconnectVga ( VOID )
DisconnectVga ( void )
{
EFI_STATUS Status;
UINTN HandleCount = 0;
@ -166,7 +166,7 @@ DisconnectVga ( VOID )
Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiPciIoProtocolGuid, NULL, &HandleCount, &Handles);
if (Status == EFI_SUCCESS) {
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol(Handles[Index], &gEfiPciIoProtocolGuid, (VOID **) &PciIo);
Status = gBS->HandleProtocol(Handles[Index], &gEfiPciIoProtocolGuid, (void **) &PciIo);
if (EFI_ERROR(Status)) {
continue;
}
@ -305,7 +305,7 @@ LegacyBiosFarCall86 (
IN UINT16 Segment,
IN UINT16 Offset,
IN IA32_REGISTER_SET *Regs
// IN VOID *Stack
// IN void *Stack
// IN UINTN StackSize
)
{
@ -380,7 +380,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

@ -103,7 +103,7 @@ LegacyBiosFarCall86 (
IN UINT16 Segment,
IN UINT16 Offset,
IN IA32_REGISTER_SET *Regs //,
// IN VOID *Stack,
// IN void *Stack,
// IN UINTN StackSize
);

View File

@ -14,6 +14,7 @@ Copyright (c) 2006 JLA
#include "LegacyBiosThunk.h"
//#include <Protocol/Bds.h>
#include "AcpiPatcher.h"
#include "Self.h"
#ifndef DEBUG_ALL
@ -235,7 +236,7 @@ EFI_STATUS BiosReadSectorsFromDrive(UINT8 DriveNum, UINT64 Lba, UINTN NumSectors
EFI_STATUS GetBiosDriveCRC32(UINT8 DriveNum,
UINT32 *DriveCRC32,
BIOS_DISK_ADDRESS_PACKET *Dap,
VOID *Buffer)
void *Buffer)
{
EFI_STATUS Status;
@ -331,7 +332,7 @@ EFI_STATUS bootElTorito(REFIT_VOLUME* volume)
Status = pBlockIO->ReadBlocks(pBlockIO, pBlockIO->Media->MediaId, 0x11, 2048, sectorBuffer);
if (EFI_ERROR(Status)) {
// Retry in case the CD was swapped out
Status = gBS->HandleProtocol(volume->DeviceHandle, &gEfiBlockIoProtocolGuid, (VOID **) &pBlockIO);
Status = gBS->HandleProtocol(volume->DeviceHandle, &gEfiBlockIoProtocolGuid, (void **) &pBlockIO);
if (!EFI_ERROR(Status)) {
// pCDROMBlockIO = pBlockIO;
Status = pBlockIO->ReadBlocks(pBlockIO, pBlockIO->Media->MediaId, 0x11, 2048, sectorBuffer);
@ -397,13 +398,16 @@ EFI_STATUS bootElTorito(REFIT_VOLUME* volume)
return Status;
}
Status = SaveBooterLog(SelfRootDir, LEGBOOT_LOG);
if (EFI_ERROR(Status)) {
DBG("can't save legacy-boot.log\n");
Status = SaveBooterLog(NULL, LEGBOOT_LOG);
}
Status = SaveBooterLog(&self.getCloverDir(), LEGBOOT_LOG_new);
// Jief : don't write outside of SelfDir
// if (EFI_ERROR(Status)) {
// DBG("can't save legacy-boot.log\n");
// Status = SaveBooterLog(NULL, LEGBOOT_LOG);
// }
/*LogSize = msgCursor - msgbuf;
Status = egSaveFile(SelfRootDir, LEGBOOT_LOG, (UINT8*)msgbuf, LogSize);
Status = egSaveFile(&self.getSelfRootDir(), LEGBOOT_LOG, (UINT8*)msgbuf, LogSize);
if (EFI_ERROR(Status)) {
DBG("can't save legacy-boot.log\n");
Status = egSaveFile(NULL, LEGBOOT_LOG, (UINT8*)msgbuf, LogSize);
@ -419,18 +423,18 @@ 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;
}
*/
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(VOID **)&mThunkContext);
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(void **)&mThunkContext);
if (EFI_ERROR(Status)) {
return Status;
}
@ -473,17 +477,17 @@ 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;
}
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(VOID **)&mThunkContext);
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(void **)&mThunkContext);
if (EFI_ERROR(Status)) {
return Status;
}
@ -512,13 +516,14 @@ EFI_STATUS bootMBR(REFIT_VOLUME* volume)
DBG("\n");
}
Status = SaveBooterLog(SelfRootDir, LEGBOOT_LOG);
if (EFI_ERROR(Status)) {
Status = SaveBooterLog(NULL, LEGBOOT_LOG);
}
Status = SaveBooterLog(&self.getCloverDir(), LEGBOOT_LOG_new);
// Jief : don't write outside SelfDir
// if (EFI_ERROR(Status)) {
// Status = SaveBooterLog(NULL, LEGBOOT_LOG);
// }
/*
LogSize = msgCursor - msgbuf;
Status = egSaveFile(SelfRootDir, LEGBOOT_LOG, (UINT8*)msgbuf, LogSize);
Status = egSaveFile(&self.getSelfRootDir(), LEGBOOT_LOG, (UINT8*)msgbuf, LogSize);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, LEGBOOT_LOG, (UINT8*)msgbuf, LogSize);
}
@ -639,13 +644,13 @@ 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;
}
DBG("gEfiLegacy8259ProtocolGuid found\n");
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(VOID **)&mThunkContext);
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(void **)&mThunkContext);
if (EFI_ERROR(Status)) {
return Status;
}
@ -666,10 +671,11 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
DBG("\n");
}
DBG("Reset disk controller 0x80\n");
Status = SaveBooterLog(SelfRootDir, LEGBOOT_LOG);
Status = SaveBooterLog(&self.getCloverDir(), LEGBOOT_LOG_new);
if (EFI_ERROR(Status)) {
DBG("can't save legacy-boot.log\n");
Status = SaveBooterLog(NULL, LEGBOOT_LOG);
// Jief : don't write outside SelfDir
// Status = SaveBooterLog(NULL, LEGBOOT_LOG);
}
//after reset we can't save boot log
Regs.H.AH = 0x0D; // INT 13h AH=00h: Reset floppy disk controller; 0x0D - reset hard disk controller
@ -717,10 +723,11 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
*/
//if not success then save legacyboot.log
Status = SaveBooterLog(SelfRootDir, LEGBOOT_LOG);
Status = SaveBooterLog(&self.getCloverDir(), LEGBOOT_LOG_new);
if (EFI_ERROR(Status)) {
DBG("can't save legacy-boot.log\n");
/*Status = */SaveBooterLog(NULL, LEGBOOT_LOG);
// Jief : don't write outside SelfDir
// /*Status = */SaveBooterLog(NULL, LEGBOOT_LOG);
}
return EFI_SUCCESS;
@ -773,7 +780,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN 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;
@ -786,7 +793,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN 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)) {
//
@ -890,7 +897,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
// prepare ThunkContext for 16bit BIOS calls
//
if (mThunkContext == NULL) {
Status = gBS->AllocatePool (EfiBootServicesData, sizeof(THUNK_CONTEXT), (VOID **)&mThunkContext);
Status = gBS->AllocatePool (EfiBootServicesData, sizeof(THUNK_CONTEXT), (void **)&mThunkContext);
if (EFI_ERROR(Status)) {
return Status;
}
@ -968,10 +975,11 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
//Status = gLegacy8259->SetMask(gLegacy8259, &OldMask, NULL, NULL, NULL);
PauseForKey(L"save legacy-boot.log ...\n");
Status = SaveBooterLog(SelfRootDir, LEGBOOT_LOG);
Status = SaveBooterLog(&self.getCloverDir(), LEGBOOT_LOG_new);
if (EFI_ERROR(Status)) {
DBG("can't save legacy-boot.log\n");
/*Status = */SaveBooterLog(NULL, LEGBOOT_LOG);
// Jief : don't write outside SelfDir
// /*Status = */SaveBooterLog(NULL, LEGBOOT_LOG);
}
return EFI_SUCCESS;
@ -981,7 +989,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
/** For DefaultLegacyBios (UEFI)
* Patch BBS Table priorities to allow booting not only from first partition.
*/
static VOID PatchBbsTable(EFI_LEGACY_BIOS_PROTOCOL *LegacyBios, UINT16 BootEntry)
static void PatchBbsTable(EFI_LEGACY_BIOS_PROTOCOL *LegacyBios, UINT16 BootEntry)
{
UINT16 Idx;
UINT16 IdxCount = 0;
@ -1054,7 +1062,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;
@ -1063,7 +1071,7 @@ EFI_STATUS bootLegacyBiosDefault(IN UINT16 LegacyBiosDefaultEntry)
// Patch BBS Table
if (LegacyBiosDefaultEntry > 0) {
PatchBbsTable(LegacyBios, LegacyBiosDefaultEntry);
/*Status = SaveBooterLog(SelfRootDir, LEGBOOT_LOG);
/*Status = SaveBooterLog(&self.getSelfRootDir(), LEGBOOT_LOG);
if (EFI_ERROR(Status)) {
DBG("can't save legacy-boot.log\n");
Status = SaveBooterLog(NULL, LEGBOOT_LOG);
@ -1095,7 +1103,7 @@ EFI_STATUS bootLegacyBiosDefault(IN UINT16 LegacyBiosDefaultEntry)
return Status;
}
VOID DumpBiosMemoryMap()
void DumpBiosMemoryMap()
{
EFI_STATUS Status;
INT32 i, Length; //for debug dump
@ -1106,13 +1114,13 @@ 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;
}
DBG("gEfiLegacy8259ProtocolGuid found\n");
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(VOID **)&mThunkContext);
Status = gBS->AllocatePool (EfiBootServicesData,sizeof(THUNK_CONTEXT),(void **)&mThunkContext);
if (EFI_ERROR(Status)) {
return;
}

View File

@ -36,8 +36,8 @@ bootLegacyBiosDefault (
IN UINT16 LegacyBiosDefaultEntry
);
VOID
DumpBiosMemoryMap (VOID);
void
DumpBiosMemoryMap (void);
#endif /* PLATFORM_LEGACYBOOT_H_ */

View File

@ -3,6 +3,7 @@
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#include <Library/NetLib.h>
#include "../refit/lib.h"
#include "Net.h"
#ifndef DEBUG_MAC
#ifndef DEBUG_ALL
@ -18,11 +19,13 @@
#define DBG(...) DebugLog(DEBUG_MAC, __VA_ARGS__)
#endif
extern UINTN nLanCards; // number of LAN cards
extern UINTN nLanPaths; // number of UEFI LAN
extern UINT16 gLanVendor[4]; // their vendors
extern UINT8 *gLanMmio[4]; // their MMIO regions
extern UINT8 gLanMac[4][6]; // their MAC addresses
UINTN nLanCards; // number of LAN cards
UINT16 gLanVendor[4]; // their vendors
UINT8 *gLanMmio[4]; // their MMIO regions
UINT8 gLanMac[4][6]; // their MAC addresses
UINTN nLanPaths; // number of UEFI LAN
extern BOOLEAN GetLegacyLanAddress;
//Marvell Yukon
@ -67,7 +70,7 @@ typedef struct {
*/
VOID
void
GetMacAddress()
{
EFI_STATUS Status;
@ -111,7 +114,7 @@ GetMacAddress()
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
(VOID **) &Node
(void **) &Node
);
if (EFI_ERROR(Status)) {
continue;

View File

@ -10,9 +10,14 @@
VOID
GetMacAddress(VOID);
void
GetMacAddress(void);
extern UINTN nLanCards; // number of LAN cards
extern UINT16 gLanVendor[4]; // their vendors
extern UINT8 *gLanMmio[4]; // their MMIO regions
extern UINT8 gLanMac[4][6]; // their MAC addresses
extern UINTN nLanPaths; // number of UEFI LAN
#endif /* PLATFORM_NET_H_ */

View File

@ -95,14 +95,14 @@ GetEfiTimeInMs (
}
/** Reads and returns value of NVRAM variable. */
VOID *GetNvramVariable(
void *GetNvramVariable(
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
OUT UINTN *DataSize OPTIONAL)
{
EFI_STATUS Status;
VOID *Data = NULL;
void *Data = NULL;
//
// Pass in a zero size buffer to find the required buffer size.
//
@ -180,11 +180,11 @@ SetNvramVariable (
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST VOID *Data
IN CONST void *Data
)
{
//EFI_STATUS Status;
VOID *OldData;
void *OldData;
UINTN OldDataSize = 0;
UINT32 OldAttributes = 0;
@ -215,7 +215,7 @@ SetNvramVariable (
//DBG(" -> writing new (%s)\n", efiStrError(Status));
//return Status;
return gRT->SetVariable(VariableName, VendorGuid, Attributes, DataSize, (VOID*)Data); // CONST missing in EFI_SET_VARIABLE->SetVariable
return gRT->SetVariable(VariableName, VendorGuid, Attributes, DataSize, (void*)Data); // CONST missing in EFI_SET_VARIABLE->SetVariable
}
EFI_STATUS
@ -236,10 +236,10 @@ AddNvramVariable (
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN const VOID *Data
IN const void *Data
)
{
VOID *OldData;
void *OldData;
//DBG("SetNvramVariable (%ls, guid, 0x%X, %d):\n", VariableName, Attributes, DataSize);
OldData = (__typeof__(OldData))GetNvramVariable(VariableName, VendorGuid, NULL, NULL);
@ -341,7 +341,7 @@ ResetNativeNvram ()
BOOLEAN Restart = TRUE;
UINTN VolumeIndex;
REFIT_VOLUME *Volume;
EFI_FILE_HANDLE FileHandle;
EFI_FILE* FileHandle;
//DbgHeader("ResetNativeNvram: cleanup NVRAM variables");
@ -457,7 +457,7 @@ INT8 NKey[4] = {0, 0, 0, 0};
INT8 SAdr[4] = {0, 0, 3, 0};
INT8 SNum[1] = {1};
VOID
void
GetSmcKeys (BOOLEAN WriteToSMC)
{
EFI_STATUS Status;
@ -480,7 +480,7 @@ GetSmcKeys (BOOLEAN 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 {
@ -553,7 +553,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
FreePool(Name);
}
#if CHECK_SMC
VOID DumpSmcKeys()
void DumpSmcKeys()
{
if (!gAppleSmc || !gAppleSmc->DumpData) {
return;
@ -785,7 +785,7 @@ GetEfiBootDeviceFromNvram ()
}
}
if (gEfiBootDeviceData == NULL) {
VOID *Value;
void *Value;
UINTN Size2=0;
EFI_STATUS Status;
Status = GetVariable2 (L"aptiofixflag", &gEfiAppleBootGuid, &Value, &Size2);
@ -925,7 +925,7 @@ LoadLatestNvramPlist()
// UINTN Index;
REFIT_VOLUME *Volume;
// EFI_GUID *Guid;
EFI_FILE_HANDLE FileHandle = NULL;
EFI_FILE* FileHandle = NULL;
EFI_FILE_INFO *FileInfo = NULL;
UINT64 LastModifTimeMs;
UINT64 ModifTimeMs;
@ -1026,12 +1026,12 @@ LoadLatestNvramPlist()
/** Puts all vars from nvram.plist to RT vars. Should be used in CloverEFI only
* or if some UEFI boot uses EmuRuntimeDxe driver.
*/
VOID
void
PutNvramPlistToRtVars ()
{
// EFI_STATUS Status;
size_t Size;
const VOID *Value;
const void *Value;
if (gNvramDict == NULL) {
/*Status = */LoadLatestNvramPlist();
@ -1453,7 +1453,7 @@ EFI_STATUS SetStartupDiskVolume (
/** Deletes Startup disk vars: efi-boot-device, efi-boot-device-data, BootCampHD. */
VOID
void
RemoveStartupDiskVolume ()
{
// EFI_STATUS Status;
@ -1472,7 +1472,7 @@ RemoveStartupDiskVolume ()
}
VOID ResetNvram ()
void ResetNvram ()
{
if (gFirmwareClover || gDriversFlags.EmuVariableLoaded) {
if (gEmuVariableControl != NULL) {

View File

@ -25,7 +25,7 @@ FindStartupDiskVolume (
REFIT_MENU_SCREEN *MainMenu
);
VOID
void
*GetNvramVariable(
IN CONST CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
@ -45,7 +45,7 @@ AddNvramVariable (
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN const VOID *Data
IN const void *Data
);
EFI_STATUS
AddNvramXString8 (
@ -61,7 +61,7 @@ SetNvramVariable (
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN CONST VOID *Data
IN CONST void *Data
);
EFI_STATUS
SetNvramXString8 (
@ -77,8 +77,8 @@ DeleteNvramVariable (
IN EFI_GUID *VendorGuid
);
VOID
ResetNvram (VOID);
void
ResetNvram (void);
BOOLEAN
IsDeletableVariable (
@ -87,24 +87,24 @@ IsDeletableVariable (
);
EFI_STATUS
ResetNativeNvram (VOID);
ResetNativeNvram (void);
;
EFI_STATUS
GetEfiBootDeviceFromNvram (VOID);
GetEfiBootDeviceFromNvram (void);
EFI_GUID
*FindGPTPartitionGuidInDevicePath (
const EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
VOID
PutNvramPlistToRtVars (VOID);
void
PutNvramPlistToRtVars (void);
VOID
void
GetSmcKeys(BOOLEAN WriteToSMC);
#if CHECK_SMC
VOID DumpSmcKeys();
void DumpSmcKeys();
#endif
EFI_STATUS
@ -113,8 +113,8 @@ SetStartupDiskVolume (
IN CONST XStringW& LoaderPath
);
VOID
RemoveStartupDiskVolume (VOID);
void
RemoveStartupDiskVolume (void);
UINT64
GetEfiTimeInMs (IN EFI_TIME *T);

View File

@ -23,7 +23,7 @@ Headers collection for procedures
#include "../include/OneLinerMacros.h"
#include "Self.h"
//#include "Self.h"
#include "../entry_scan/common.h"
#include "../libeg/BmLib.h"
#include "BootLog.h"

View File

@ -111,7 +111,7 @@ OurPlatformDriverLoaded (
Status = gBS->HandleProtocol (
ControllerHandle,
&gEfiBlockIoProtocolGuid,
(VOID **) &BlkIo
(void **) &BlkIo
);
if (EFI_ERROR(Status)) {
return EFI_UNSUPPORTED;
@ -120,7 +120,7 @@ OurPlatformDriverLoaded (
Status = gBS->OpenProtocol(
DriverImageHandle,
&gEfiComponentNameProtocolGuid,
(VOID**)&CompName,
(void**)&CompName,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
@ -207,13 +207,13 @@ OvrPlatformGetDriver(
//
////
VOID RegisterDriversToHighestPriority(IN EFI_HANDLE *PriorityDrivers)
void RegisterDriversToHighestPriority(IN EFI_HANDLE *PriorityDrivers)
{
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *PlatformDriverOverride;
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

@ -13,7 +13,7 @@
* Does this by installing our EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL
* or by overriding existing EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL.GetDriver.
*/
VOID
void
RegisterDriversToHighestPriority (
IN EFI_HANDLE *PriorityDrivers
);

View File

@ -32,7 +32,7 @@
//#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,(UINTN)count+1,strSource,(UINTN)count)
//#define strlen(str) (size_t)(AsciiStrLen(str))
//#define strcat(strDest,strSource) AsciiStrCatS(strDest,AsciiStrLen(strDest)+1,strSource)
#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)
#define strchr(str,ch) ScanMem8((void *)(str),AsciiStrSize(str),(UINT8)ch)
#define strstr(a,b) AsciiStrStr(a,b)
void abort(void);

View File

@ -24,19 +24,94 @@
Self self;
EFI_STATUS Self::initialize(EFI_HANDLE ImageHandle)
constexpr const LStringW THEMES_DIRNAME(L"Themes");
EFI_STATUS Self::_openDir(const XStringW& path, bool* b, EFI_FILE** efiDir)
{
EFI_STATUS Status;
m_SelfImageHandle = ImageHandle;
Status = gBS->HandleProtocol(self.getSelfImageHandle(), &gEfiLoadedImageProtocolGuid, (VOID **) &m_SelfLoadedImage);
Status = self.getCloverDir().Open(&self.getCloverDir(), efiDir, path.wc_str(), EFI_FILE_MODE_READ, 0);
if ( EFI_ERROR(Status) ) {
DBG("Error when opening dir '%ls\\%ls' : %s\n", self.getCloverDirPathAsXStringW().wc_str(), path.wc_str(), efiStrError(Status));
*efiDir = NULL;
*b = false;
}else{
*b = true;
}
return Status;
}
EFI_STATUS Self::_initialize()
{
EFI_STATUS Status;
Status = gBS->HandleProtocol(self.getSelfImageHandle(), &gEfiLoadedImageProtocolGuid, (void **)&m_SelfLoadedImage);
if ( EFI_ERROR(Status) ) panic("Cannot get SelfLoadedImage");
if ( self.getSelfDeviceHandle() == NULL ) panic("self.getSelfDeviceHandle() == NULL");
m_SelfDevicePath = DuplicateDevicePath(DevicePathFromHandle(self.getSelfDeviceHandle()));
if ( m_SelfDevicePath == NULL ) panic("m_SelfDevicePath == NULL");
DBG("self.getSelfDevicePath()=%ls @%llX\n", FileDevicePathToXStringW(&self.getSelfDevicePath()).wc_str(), (uintptr_t)self.getSelfDeviceHandle());
Status = gBS->HandleProtocol(self.getSelfDeviceHandle(), &gEfiSimpleFileSystemProtocolGuid, (void**)&m_SelfSimpleVolume);
if ( EFI_ERROR(Status) ) panic("Cannot get m_SelfSimpleVolume");
Status = getSelfSimpleVolume().OpenVolume(&getSelfSimpleVolume(), &m_SelfRootDir);
if ( EFI_ERROR(Status) ) panic("Cannot get m_SelfRootDir");
// find the current directory
m_CloverDirPathAsXStringW = FileDevicePathToXStringW(self.getSelfLoadedImage().FilePath);
// History : if this Clover was started as BootX64.efi, redirect to /EFI/CLOVER
if ( m_CloverDirPathAsXStringW.equalIC("\\EFI\\Boot\\BootX64.efi") ) {
m_CloverDirPathAsXStringW.takeValueFrom("\\EFI\\CLOVER\\CloverX64.efi");
}
if ( m_CloverDirPathAsXStringW.isEmpty() ) panic("m_CloverDirPathAsXStringW.isEmpty()");
m_SelfDevicePath = FileDevicePath(self.getSelfDeviceHandle(), m_CloverDirPathAsXStringW);
m_SelfDevicePathAsXStringW = FileDevicePathToXStringW(m_SelfDevicePath);
if ( !m_CloverDirPathAsXStringW.startWith('\\') ) panic("m_CloverDirPathAsXStringW.endsWith('\\')");
if ( m_CloverDirPathAsXStringW.lastChar() == U'\\' ) panic("m_CloverDirPathAsXStringW.lastChar() == U'\\'");
//if ( m_CloverDirPathAsXStringW.endsWith('\\') ) panic("m_CloverDirPathAsXStringW.endsWith('\\')");
size_t i = m_CloverDirPathAsXStringW.rindexOf(U'\\', SIZE_T_MAX-1);
if ( i != SIZE_T_MAX && i > 0 ) m_CloverDirPathAsXStringW.deleteCharsAtPos(i, SIZE_T_MAX);
DBG("SelfDirPath = %ls\n", m_CloverDirPathAsXStringW.wc_str());
Status = self.getSelfVolumeRootDir().Open(&self.getSelfVolumeRootDir(), &m_CloverDir, m_CloverDirPathAsXStringW.wc_str(), EFI_FILE_MODE_READ, 0);
if ( EFI_ERROR(Status) ) panic("Cannot open getSelfRootDir()");
_openDir(THEMES_DIRNAME, &m_ThemesDirExists, &m_ThemesDir); // don't need to check returned status as it's ok to not have a themes dir.
return EFI_SUCCESS;
}
EFI_STATUS Self::initialize(EFI_HANDLE ImageHandle)
{
m_SelfImageHandle = ImageHandle;
return _initialize();
}
EFI_STATUS Self::reInitialize()
{
closeHandle();
return _initialize();
}
void Self::closeHandle(void)
{
// called before running external programs to close open file handles
if (m_CloverDir != NULL) {
m_CloverDir->Close(m_CloverDir);
m_CloverDir = NULL;
}
if (m_SelfRootDir != NULL) {
m_SelfRootDir->Close(m_SelfRootDir);
m_SelfRootDir = NULL;
}
}

View File

@ -13,24 +13,62 @@
class Self
{
protected:
EFI_HANDLE m_SelfImageHandle;
EFI_LOADED_IMAGE *m_SelfLoadedImage;
EFI_DEVICE_PATH *m_SelfDevicePath;
EFI_HANDLE m_SelfImageHandle; // this efi.
EFI_LOADED_IMAGE* m_SelfLoadedImage; // this efi.
EFI_DEVICE_PATH* m_SelfDevicePath; // path to device containing this efi.
XStringW m_SelfDevicePathAsXStringW; // path to device containing this efi.
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *m_SelfSimpleVolume; // Volume containing this efi.
EFI_FILE* m_SelfRootDir; // Root dir of the volume containing this efi.
EFI_DEVICE_PATH* m_CloverDirFullDevicePath; // full path, including device, to this efi.
EFI_FILE* m_CloverDir; // opened m_SelfDirPath
XStringW m_CloverDirPathAsXStringW; // full path, including device, to this efi.
XStringW m_CloverDirPath; // dirname containing this efi (contains just the dir, not the device path)
// bool m_OemDirExists;
// EFI_FILE *m_OemDir;
bool m_ThemesDirExists;
EFI_FILE *m_ThemesDir;
EFI_STATUS _openDir(const XStringW& path, bool* b, EFI_FILE** efiDir);
EFI_STATUS _initialize();
public:
Self () : m_SelfImageHandle(NULL), m_SelfLoadedImage{0}, m_SelfDevicePath(NULL) {};
Self () : m_SelfImageHandle(NULL), m_SelfLoadedImage(NULL), m_SelfDevicePath(NULL), m_SelfDevicePathAsXStringW(),
m_SelfSimpleVolume(NULL), m_SelfRootDir(NULL),
m_CloverDirFullDevicePath(NULL), m_CloverDir(NULL), m_CloverDirPathAsXStringW(), m_CloverDirPath(), m_ThemesDirExists(false), m_ThemesDir(0) {};
Self(const Self&) = delete;
Self& operator = (const Self&) = delete;
~Self () {};
EFI_STATUS initialize(EFI_HANDLE ImageHandle);
EFI_STATUS reInitialize();
void closeHandle();
bool isInitialized() const { return m_SelfImageHandle != NULL; }
EFI_HANDLE getSelfImageHandle() { return m_SelfImageHandle; }
const EFI_LOADED_IMAGE& getSelfLoadedImage() { return *m_SelfLoadedImage; }
EFI_HANDLE getSelfDeviceHandle() { return getSelfLoadedImage().DeviceHandle; }
const EFI_DEVICE_PATH& getSelfDevicePath() { return *m_SelfDevicePath; }
const EFI_SIMPLE_FILE_SYSTEM_PROTOCOL& getSelfSimpleVolume() { return *m_SelfSimpleVolume; }
const EFI_FILE& getSelfVolumeRootDir() { return *m_SelfRootDir; }
const EFI_DEVICE_PATH& getCloverDirFullDevicePath() { return *m_CloverDirFullDevicePath; }
const EFI_FILE& getCloverDir() { return *m_CloverDir; }
const XStringW& getCloverDirPathAsXStringW() { return m_CloverDirPathAsXStringW; }
const XStringW& getCloverDirPath() { return m_CloverDirPath; } // returns path containing this efi. Like \\EFI\\CLOVER
// bool oemDirExists() { return m_OemDirExists; }
// const EFI_FILE& getOemDir() { return *m_OemDir; } // Oem dir name under SelfDir. Like "OEM\\MyBoard"
bool themesDirExists() { return m_ThemesDirExists; }
const EFI_FILE& getThemesDir() { return *m_ThemesDir; }
};
extern Self self;

View File

@ -0,0 +1,163 @@
/*
* Self.cpp
*
* Created on: Sep 28, 2020
* Author: jief
*/
#include <Platform.h>
#include "SelfOem.h"
#include "Self.h"
#include "../refit/lib.h"
#ifndef DEBUG_ALL
#define DEBUG_SELF 1
#else
#define DEBUG_SELF DEBUG_ALL
#endif
#if DEBUG_SELF == 0
#define DBG(...)
#else
#define DBG(...) DebugLog(DEBUG_SELF, __VA_ARGS__)
#endif
constexpr const LStringW KEXTS_DIRNAME(L"Kexts");
SelfOem selfOem;
EFI_STATUS SelfOem::_openDir(const XStringW& path, bool* b, EFI_FILE** efiDir)
{
EFI_STATUS Status;
Status = self.getCloverDir().Open(&self.getCloverDir(), efiDir, path.wc_str(), EFI_FILE_MODE_READ, 0);
if ( EFI_ERROR(Status) ) {
DBG("Error when opening dir '%ls\\%ls' : %s\n", self.getCloverDirPathAsXStringW().wc_str(), path.wc_str(), efiStrError(Status));
*efiDir = NULL;
*b = false;
}else{
*b = true;
}
return Status;
}
bool SelfOem::_checkOEMPath()
{
EFI_STATUS Status;
// if ( !selfOem.oemDirExists() ) return false;
EFI_FILE* efiDir;
Status = self.getCloverDir().Open(&self.getCloverDir(), &efiDir, m_OemPathRelToSelfDir.wc_str(), EFI_FILE_MODE_READ, 0);
if ( Status == EFI_NOT_FOUND ) {
DBG("_checkOEMPath Look for oem dir at path '%ls\\%ls'. Dir doesn't exist.\n", self.getCloverDirPathAsXStringW().wc_str(), m_OemPathRelToSelfDir.wc_str());
return false;
}
if ( EFI_ERROR(Status) != EFI_SUCCESS ) {
DBG("Cannot open dir at '%ls\\%ls' dir : %s\n", self.getCloverDirPathAsXStringW().wc_str(), m_OemPathRelToSelfDir.wc_str(), efiStrError(Status));
return false;
}
BOOLEAN res2 = FileExists(efiDir, SWPrintf("%s.plist", m_ConfName.c_str()));
if ( !res2 ) {
DBG("_checkOEMPath looked for config file at '%ls\\%ls\\%s.plist'. File doesn't exist.\n", self.getCloverDirPathAsXStringW().wc_str(), m_OemPathRelToSelfDir.wc_str(), m_ConfName.c_str());
return false;
}
DBG("_checkOEMPath: set OEMPath: '%ls\\%ls'\n", self.getCloverDirPathAsXStringW().wc_str(), m_OemPathRelToSelfDir.wc_str());
return true;
}
bool SelfOem::_setOEMPath(bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, UINTN nLanCards, UINT8 gLanMac[4][6])
{
if ( nLanCards > 0 ) {
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", OEMProduct.c_str(), gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]);
if ( _checkOEMPath() ) return true;
}
if ( nLanCards > 1 ) {
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", OEMProduct.c_str(), gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]);
if ( _checkOEMPath() ) return true;
}
if ( nLanCards > 2 ) {
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", OEMProduct.c_str(), gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]);
if ( _checkOEMPath() ) return true;
}
if ( nLanCards > 3 ) {
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", OEMProduct.c_str(), gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]);
if ( _checkOEMPath() ) return true;
}
if ( !isFirmwareClover ) {
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s\\UEFI", OEMBoard.c_str());
if ( _checkOEMPath() ) return true;
}
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s", OEMProduct.c_str());
if ( _checkOEMPath() ) return true;
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s-%d", OEMProduct.c_str(), frequency);
if ( _checkOEMPath() ) return true;
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s", OEMBoard.c_str());
if ( _checkOEMPath() ) return true;
m_OemPathRelToSelfDir.SWPrintf("OEM\\%s-%d", OEMBoard.c_str(), frequency);
if ( _checkOEMPath() ) return true;
m_OemPathRelToSelfDir.takeValueFrom(".");
DBG("set OEMPath to \".\"\n");
return false;
}
EFI_STATUS SelfOem::_initialize()
{
EFI_STATUS Status;
Status = self.getCloverDir().Open(&self.getCloverDir(), &m_OemDir, m_OemPathRelToSelfDir.wc_str(), EFI_FILE_MODE_READ, 0);
if ( EFI_ERROR(Status) ) panic("Cannot open oem dir at '%ls\\%ls'", self.getCloverDirPathAsXStringW().wc_str(), m_OemPathRelToSelfDir.wc_str());
DBG("Oem dir = %ls\n", (*this).getOemFullPath().wc_str());
Status = m_OemDir->Open(m_OemDir, &m_KextsDir, KEXTS_DIRNAME.wc_str(), EFI_FILE_MODE_READ, 0);
if ( Status != EFI_SUCCESS && Status != EFI_NOT_FOUND ) {
panic("Cannot open kexts dir %ls\\%ls : %s", getOemFullPath().wc_str(), KEXTS_DIRNAME.wc_str(), efiStrError(Status));
}
if ( Status == EFI_NOT_FOUND ) {
Status = self.getCloverDir().Open(&self.getCloverDir(), &m_KextsDir, KEXTS_DIRNAME.wc_str(), EFI_FILE_MODE_READ, 0);
if ( EFI_ERROR(Status) ) panic("Cannot open kexts dir at '%ls\\%ls'", self.getCloverDirPathAsXStringW().wc_str(), KEXTS_DIRNAME.wc_str());
m_KextsPathRelToSelfDir = KEXTS_DIRNAME;
m_KextsFullPath.SWPrintf("%ls\\%ls", self.getCloverDirPathAsXStringW().wc_str(), KEXTS_DIRNAME.wc_str());
}else{
m_KextsPathRelToSelfDir.SWPrintf("%ls\\%ls", getOemPathRelToSelfDir().wc_str(), KEXTS_DIRNAME.wc_str());
m_KextsFullPath.SWPrintf("%ls\\%ls", getOemFullPath().wc_str(), KEXTS_DIRNAME.wc_str());
}
DBG("Kexts dir = '%ls'\n", getKextsFullPath().wc_str());
return EFI_SUCCESS;
}
EFI_STATUS SelfOem::initialize(const XString8& confName, bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, UINTN nLanCards, UINT8 gLanMac[4][6])
{
m_ConfName = confName;
if ( _setOEMPath(isFirmwareClover, OEMBoard, OEMProduct, frequency, nLanCards, gLanMac) ) {
m_OemFulPath = SWPrintf("%ls\\%ls", self.getCloverDirPathAsXStringW().wc_str(), m_OemPathRelToSelfDir.wc_str());
m_OemDirExists = true;
}else{
m_OemFulPath = self.getCloverDirPathAsXStringW();
m_OemDirExists = false;
}
return _initialize();
}
EFI_STATUS SelfOem::reInitialize()
{
closeHandle();
return _initialize();
}
void SelfOem::closeHandle(void)
{
if (m_OemDir != NULL) {
m_OemDir->Close(m_OemDir);
m_OemDir = NULL;
}
}

View File

@ -0,0 +1,58 @@
/*
* Self.h
*
* Created on: Sep 28, 2020
* Author: jief
*/
#ifndef PLATFORM_SELFOEM_H_
#define PLATFORM_SELFOEM_H_
#include <Platform.h>
class SelfOem
{
protected:
XString8 m_ConfName;
bool m_OemDirExists;
EFI_FILE* m_OemDir;
XStringW m_OemPathRelToSelfDir;
XStringW m_OemFulPath;
EFI_FILE* m_KextsDir;
XStringW m_KextsPathRelToSelfDir;
XStringW m_KextsFullPath;
EFI_STATUS _openDir(const XStringW& path, bool* b, EFI_FILE** efiDir);
bool _checkOEMPath();
bool _setOEMPath(bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, UINTN nLanCards, UINT8 gLanMac[4][6]);
EFI_STATUS _initialize();
public:
SelfOem () : m_ConfName(), m_OemDirExists(false), m_OemDir(NULL), m_OemPathRelToSelfDir(), m_OemFulPath(), m_KextsDir(NULL), m_KextsPathRelToSelfDir(), m_KextsFullPath() {};
SelfOem(const SelfOem&) = delete;
SelfOem& operator = (const SelfOem&) = delete;
~SelfOem () {};
EFI_STATUS initialize(const XString8& confName, bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, UINTN nLanCards, UINT8 gLanMac[4][6]);
EFI_STATUS reInitialize();
void closeHandle();
const XString8& getConfName() { return m_ConfName; }
bool oemDirExists() { return m_OemDirExists; }
const EFI_FILE& getOemDir() { return *m_OemDir; }
const XStringW& getOemPathRelToSelfDir() { return m_OemPathRelToSelfDir; }
const XStringW& getOemFullPath() { return m_OemFulPath; }
const EFI_FILE& getKextsDir() { return *m_KextsDir; }
const XStringW& getKextsPathRelToSelfDir() { return m_KextsPathRelToSelfDir; }
const XStringW& getKextsFullPath() { return m_KextsFullPath; }
};
extern SelfOem selfOem;
#endif /* PLATFORM_SELF_H_ */

View File

@ -31,6 +31,9 @@
#include "ati_reg.h"
#include "../../Version.h"
#include "../Platform/Settings.h"
#include "Self.h"
#include "SelfOem.h"
#include "Net.h"
#ifndef DEBUG_ALL
@ -88,12 +91,6 @@ UINTN NGFX = 0; // number of GF
UINTN NHDA = 0; // number of HDA Devices
UINTN nLanCards; // number of LAN cards
UINT16 gLanVendor[4]; // their vendors
UINT8 *gLanMmio[4]; // their MMIO regions
UINT8 gLanMac[4][6]; // their MAC addresses
UINTN nLanPaths; // number of LAN pathes
XStringWArray ThemeNameArray;
UINTN ConfigsNum;
CHAR16 *ConfigsList[20];
@ -134,6 +131,8 @@ CONST CHAR8* gFirmwareBuildDate = "unknown";
CONST CHAR8* gBuildInfo = NULL;
#endif
const char* path_independant __attribute__((used)) = "path_independant";
EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL;
extern BOOLEAN NeedPMfix;
@ -225,7 +224,7 @@ ParseACPIName(const XString8& String)
return List;
}
VOID
void
ParseLoadOptions (
OUT XStringW* ConfNamePtr,
OUT TagDict** Dict
@ -306,8 +305,8 @@ ParseLoadOptions (
// analyze self.getSelfLoadedImage().LoadOptions to extract Default Volume and Default Loader
// input and output data are global
//
VOID
GetBootFromOption(VOID)
void
GetBootFromOption(void)
{
UINT8 *Data = (UINT8*)self.getSelfLoadedImage().LoadOptions;
UINTN Len = self.getSelfLoadedImage().LoadOptionsSize;
@ -333,7 +332,7 @@ GetBootFromOption(VOID)
//
// check if this entry corresponds to Boot# variable and then set BootCurrent
//
VOID
void
SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
{
EFI_STATUS Status;
@ -494,15 +493,14 @@ UINT8
EFI_STATUS
LoadUserSettings (
IN EFI_FILE *RootDir,
IN const XStringW& ConfName,
TagDict** Dict)
{
EFI_STATUS Status = EFI_NOT_FOUND;
UINTN Size = 0;
CHAR8* ConfigPtr = NULL;
XStringW ConfigPlistPath;
XStringW ConfigOemPath;
// XStringW ConfigPlistPath;
// XStringW ConfigOemPath;
// DbgHeader("LoadUserSettings");
@ -511,27 +509,24 @@ LoadUserSettings (
return EFI_NOT_FOUND;
}
ConfigPlistPath = SWPrintf("EFI\\CLOVER\\%ls.plist", ConfName.wc_str());
ConfigOemPath = SWPrintf("%ls\\%ls.plist", OEMPath.wc_str(), ConfName.wc_str());
if (FileExists (SelfRootDir, ConfigOemPath)) {
Status = egLoadFile(SelfRootDir, ConfigOemPath.wc_str(), (UINT8**)&ConfigPtr, &Size);
// ConfigPlistPath = SWPrintf("%ls.plist", ConfName.wc_str());
// ConfigOemPath = SWPrintf("%ls\\%ls.plist", selfOem.getOOEMPath.wc_str(), ConfName.wc_str());
XStringW configFilename = SWPrintf("%ls.plist", ConfName.wc_str());
if (FileExists (&selfOem.getOemDir(), configFilename)) {
Status = egLoadFile(&selfOem.getOemDir(), configFilename.wc_str(), (UINT8**)&ConfigPtr, &Size);
}
if (EFI_ERROR(Status)) {
if ((RootDir != NULL) && FileExists (RootDir, ConfigPlistPath)) {
Status = egLoadFile(RootDir, ConfigPlistPath.wc_str(), (UINT8**)&ConfigPtr, &Size);
DBG("Cannot find %ls at path: '%ls', trying '%ls'\n", configFilename.wc_str(), selfOem.getOemFullPath().wc_str(), self.getCloverDirPathAsXStringW().wc_str());
if ( FileExists(&self.getCloverDir(), configFilename.wc_str())) {
Status = egLoadFile(&self.getCloverDir(), configFilename.wc_str(), (UINT8**)&ConfigPtr, &Size);
}
if (!EFI_ERROR(Status)) {
DBG("Using %ls.plist at RootDir at path: %ls\n", ConfName.wc_str(), ConfigPlistPath.wc_str());
DBG("Using %ls at path: %ls\n", configFilename.wc_str(), self.getCloverDirPathAsXStringW().wc_str());
} else {
Status = egLoadFile(SelfRootDir, ConfigPlistPath.wc_str(), (UINT8**)&ConfigPtr, &Size);
if (!EFI_ERROR(Status)) {
DBG("Using %ls.plist at SelfRootDir at path: %ls\n", ConfName.wc_str(), ConfigPlistPath.wc_str());
}else{
DBG("Cannot find %ls.plist at path: '%ls' or '%ls'\n", ConfName.wc_str(), ConfigPlistPath.wc_str(), ConfigOemPath.wc_str());
}
DBG("Cannot find %ls at path: '%ls'\n", configFilename.wc_str(), self.getCloverDirPathAsXStringW().wc_str());
}
}else{
DBG("Using %ls.plist at SelfRootDir at path: %ls\n", ConfName.wc_str(), ConfigOemPath.wc_str());
DBG("Using %ls at path: %ls\n", configFilename.wc_str(), selfOem.getOemFullPath().wc_str());
}
if (!EFI_ERROR(Status) && ConfigPtr != NULL) {
@ -1728,7 +1723,7 @@ FillinCustomEntry (
} else {
XStringW customLogo = XStringW() = Prop->getString()->stringValue();
Entry->CustomBoot = CUSTOM_BOOT_USER;
Entry->CustomLogo.LoadXImage(SelfRootDir, customLogo);
Entry->CustomLogo.LoadXImage(&self.getSelfVolumeRootDir(), customLogo);
if (Entry->CustomLogo.isEmpty()) {
DBG("Custom boot logo not found at path `%ls`!\n", customLogo.wc_str());
Entry->CustomBoot = CUSTOM_BOOT_DISABLED;
@ -1974,7 +1969,7 @@ FillingCustomLegacy (
Prop = DictPointer->propertyForKey("Image");
if (Prop != NULL) {
if (Prop->isString()) {
Entry->Image.LoadXImage(ThemeX.ThemeDir, Prop->getString()->stringValue());
Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Prop->getString()->stringValue());
}
} else {
UINTN DataLen = 0;
@ -1990,7 +1985,7 @@ FillingCustomLegacy (
Prop = DictPointer->propertyForKey("DriveImage");
if (Prop != NULL) {
if (Prop->isString()) {
Entry->Image.LoadXImage(ThemeX.ThemeDir, Prop->getString()->stringValue());
Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Prop->getString()->stringValue());
}
} else {
UINTN DataLen = 0;
@ -2088,7 +2083,7 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
if (Prop->isString()) {
Entry->ImagePath = Prop->getString()->stringValue();
}
Entry->Image.LoadXImage(ThemeX.ThemeDir, Entry->ImagePath);
Entry->Image.LoadXImage(&ThemeX.getThemeDir(), Entry->ImagePath);
} else {
UINTN DataLen = 0;
UINT8 *TmpData = GetDataSetting (DictPointer, "ImageData", &DataLen);
@ -2126,7 +2121,7 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagDict* DictPointer)
}
// EDID reworked by Sherlocks
VOID
void
GetEDIDSettings(const TagDict* DictPointer)
{
const TagStruct* Prop;
@ -2183,7 +2178,6 @@ GetEDIDSettings(const TagDict* DictPointer)
EFI_STATUS
GetEarlyUserSettings (
IN EFI_FILE *RootDir,
const TagDict* CfgDict
)
{
@ -2193,7 +2187,7 @@ GetEarlyUserSettings (
// const TagDict* DictPointer;
// const TagStruct* Prop;
// const TagArray* arrayProp;
VOID *Value = NULL;
void *Value = NULL;
BOOLEAN SpecialBootMode = FALSE;
{
@ -2456,7 +2450,7 @@ GetEarlyUserSettings (
delete gSettings.CustomLogo;
}
gSettings.CustomLogo = new XImage;
gSettings.CustomLogo->LoadXImage(RootDir, customLogo);
gSettings.CustomLogo->LoadXImage(&self.getSelfVolumeRootDir(), customLogo);
if (gSettings.CustomLogo->isEmpty()) {
DBG("Custom boot logo not found at path `%ls`!\n", customLogo.wc_str());
gSettings.CustomBoot = CUSTOM_BOOT_DISABLED;
@ -3091,7 +3085,7 @@ if ( !Prop ) panic("Cannot find DisableIoMapper in config.plist/Quirks. You forg
return Status;
}
VOID
void
GetListOfConfigs ()
{
REFIT_DIR_ITER DirIter;
@ -3101,16 +3095,12 @@ GetListOfConfigs ()
ConfigsNum = 0;
OldChosenConfig = 0;
DirIterOpen(SelfRootDir, OEMPath.wc_str(), &DirIter);
DirIterOpen(&selfOem.getOemDir(), NULL, &DirIter);
DbgHeader("Found config plists");
while (DirIterNext(&DirIter, 2, L"config*.plist", &DirEntry)) {
CHAR16 FullName[256];
if (DirEntry->FileName[0] == L'.') {
continue;
}
snwprintf(FullName, 512, "%ls\\%ls", OEMPath.wc_str(), DirEntry->FileName);
if (FileExists(SelfRootDir, FullName)) {
if (StriCmp(DirEntry->FileName, L"config.plist") == 0) {
OldChosenConfig = ConfigsNum;
}
@ -3119,17 +3109,15 @@ GetListOfConfigs ()
ConfigsList[ConfigsNum++][NameLen] = L'\0';
DBG("- %ls\n", DirEntry->FileName);
}
}
DirIterClose(&DirIter);
}
VOID
void
GetListOfDsdts()
{
REFIT_DIR_ITER DirIter;
EFI_FILE_INFO *DirEntry;
INTN NameLen;
XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
if (DsdtsNum > 0) {
for (UINTN i = 0; i < DsdtsNum; i++) {
@ -3141,16 +3129,12 @@ GetListOfDsdts()
DsdtsNum = 0;
OldChosenDsdt = 0xFFFF;
DirIterOpen(SelfRootDir, AcpiPath.wc_str(), &DirIter);
DirIterOpen(&selfOem.getOemDir(), L"ACPI\\patched", &DirIter);
DbgHeader("Found DSDT tables");
while (DirIterNext(&DirIter, 2, L"DSDT*.aml", &DirEntry)) {
CHAR16 FullName[256];
if (DirEntry->FileName[0] == L'.') {
continue;
}
snwprintf(FullName, 512, "%ls\\%ls", AcpiPath.wc_str(), DirEntry->FileName);
if (FileExists(SelfRootDir, FullName)) {
if ( gSettings.DsdtName.equalIC(DirEntry->FileName) ) {
OldChosenDsdt = DsdtsNum;
}
@ -3159,19 +3143,18 @@ GetListOfDsdts()
DsdtsList[DsdtsNum++][NameLen] = L'\0';
DBG("- %ls\n", DirEntry->FileName);
}
}
DirIterClose(&DirIter);
}
VOID
void
GetListOfACPI()
{
REFIT_DIR_ITER DirIter;
EFI_FILE_INFO *DirEntry = NULL;
ACPI_PATCHED_AML *ACPIPatchedAMLTmp;
INTN Count = gSettings.DisabledAMLCount;
XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
// XStringW AcpiPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
// DBG("Get list of ACPI at path %ls\n", AcpiPath.wc_str());
while (ACPIPatchedAML != NULL) {
if (ACPIPatchedAML->FileName) {
@ -3183,10 +3166,9 @@ GetListOfACPI()
}
ACPIPatchedAML = NULL;
// DBG("free acpi list done\n");
DirIterOpen(SelfRootDir, AcpiPath.wc_str(), &DirIter);
DirIterOpen(&selfOem.getOemDir(), L"ACPI\\patched", &DirIter);
while (DirIterNext(&DirIter, 2, L"*.aml", &DirEntry)) {
CHAR16 FullName[256];
// DBG("next entry is %ls\n", DirEntry->FileName);
if (DirEntry->FileName[0] == L'.') {
continue;
@ -3195,8 +3177,6 @@ GetListOfACPI()
continue;
}
// DBG("Found name %ls\n", DirEntry->FileName);
snwprintf(FullName, 512, "%ls\\%ls", AcpiPath.wc_str(), DirEntry->FileName);
if (FileExists(SelfRootDir, FullName)) {
BOOLEAN ACPIDisabled = FALSE;
ACPIPatchedAMLTmp = new ACPI_PATCHED_AML; // if changing, notice freepool above
ACPIPatchedAMLTmp->FileName = SWPrintf("%ls", DirEntry->FileName).forgetDataWithoutFreeing(); // if changing, notice freepool above
@ -3213,12 +3193,14 @@ GetListOfACPI()
ACPIPatchedAMLTmp->Next = ACPIPatchedAML;
ACPIPatchedAML = ACPIPatchedAMLTmp;
}
}
DirIterClose(&DirIter);
}
XStringW GetBundleVersion(const XStringW& FullName)
/*
* Relative path to SelfDir (the efi dir)
*/
XStringW GetBundleVersion(const XStringW& pathUnderSelf)
{
EFI_STATUS Status;
XStringW CFBundleVersion;
@ -3227,11 +3209,11 @@ XStringW GetBundleVersion(const XStringW& FullName)
TagDict* InfoPlistDict = NULL;
const TagStruct* Prop = NULL;
UINTN Size;
InfoPlistPath = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Contents\\Info.plist");
Status = egLoadFile(SelfRootDir, InfoPlistPath.wc_str(), (UINT8**)&InfoPlistPtr, &Size);
InfoPlistPath = SWPrintf("%ls\\%ls", pathUnderSelf.wc_str(), L"Contents\\Info.plist");
Status = egLoadFile(&self.getCloverDir(), InfoPlistPath.wc_str(), (UINT8**)&InfoPlistPtr, &Size);
if (EFI_ERROR(Status)) {
InfoPlistPath = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Info.plist");
Status = egLoadFile(SelfRootDir, FullName.wc_str(), (UINT8**)&InfoPlistPtr, &Size);
InfoPlistPath = SWPrintf("%ls\\%ls", pathUnderSelf.wc_str(), L"Info.plist");
Status = egLoadFile(&self.getCloverDir(), InfoPlistPath.wc_str(), (UINT8**)&InfoPlistPtr, &Size);
}
if(!EFI_ERROR(Status)) {
//DBG("about to parse xml file %ls\n", InfoPlistPath.wc_str());
@ -3250,7 +3232,7 @@ XStringW GetBundleVersion(const XStringW& FullName)
return CFBundleVersion;
}
VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
void GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
{
REFIT_DIR_ITER DirIter;
@ -3258,7 +3240,7 @@ VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
SIDELOAD_KEXT* mKext;
SIDELOAD_KEXT* mPlugInKext;
XStringW FullName;
XStringW FullPath = SWPrintf("%ls\\KEXTS\\%ls", OEMPath.wc_str(), KextDirNameUnderOEMPath);
// XStringW FullPath = SWPrintf("%ls\\KEXTS\\%ls", OEMPath.wc_str(), KextDirNameUnderOEMPath);
REFIT_DIR_ITER PlugInsIter;
EFI_FILE_INFO *PlugInEntry;
XStringW PlugInsPath;
@ -3267,7 +3249,7 @@ VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
if (StrCmp(KextDirNameUnderOEMPath, L"Off") == 0) {
Blocked = TRUE;
}
DirIterOpen(SelfRootDir, FullPath.wc_str(), &DirIter);
DirIterOpen(&selfOem.getKextsDir(), KextDirNameUnderOEMPath, &DirIter);
while (DirIterNext(&DirIter, 1, L"*.kext", &DirEntry)) {
if (DirEntry->FileName[0] == L'.' || StrStr(DirEntry->FileName, L".kext") == NULL) {
continue;
@ -3276,21 +3258,22 @@ VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
<key>CFBundleVersion</key>
<string>8.8.8</string>
*/
FullName = SWPrintf("%ls\\%ls", FullPath.wc_str(), DirEntry->FileName);
// FullName = SWPrintf("%ls\\%ls", FullPath.wc_str(), DirEntry->FileName);
XStringW pathRelToSelfDir = SWPrintf("%ls\\%ls\\%ls", selfOem.getKextsPathRelToSelfDir().wc_str(), KextDirNameUnderOEMPath, DirEntry->FileName);
mKext = new SIDELOAD_KEXT;
mKext->FileName.SWPrintf("%ls", DirEntry->FileName);
mKext->MenuItem.BValue = Blocked;
mKext->KextDirNameUnderOEMPath.SWPrintf("%ls", KextDirNameUnderOEMPath);
mKext->Version = GetBundleVersion(FullName);
mKext->Version = GetBundleVersion(pathRelToSelfDir);
InjectKextList.AddReference(mKext, true);
DBG("Added Kext=%ls\\%ls\n", KextDirNameUnderOEMPath, mKext->FileName.wc_str());
DBG("Added Kext=%ls\\%ls\n", mKext->KextDirNameUnderOEMPath.wc_str(), mKext->FileName.wc_str());
// Obtain PlugInList
// Iterate over PlugIns directory
PlugInsPath = SWPrintf("%ls\\Contents\\PlugIns", FullName.wc_str());
PlugInsPath = SWPrintf("%ls\\Contents\\PlugIns", pathRelToSelfDir.wc_str());
DirIterOpen(SelfRootDir, PlugInsPath.wc_str(), &PlugInsIter);
DirIterOpen(&self.getCloverDir(), PlugInsPath.wc_str(), &PlugInsIter);
while (DirIterNext(&PlugInsIter, 1, L"*.kext", &PlugInEntry)) {
if (PlugInEntry->FileName[0] == L'.' || StrStr(PlugInEntry->FileName, L".kext") == NULL) {
continue;
@ -3309,19 +3292,19 @@ VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
DirIterClose(&DirIter);
}
VOID InitKextList()
void InitKextList()
{
REFIT_DIR_ITER KextsIter;
EFI_FILE_INFO *FolderEntry = NULL;
XStringW KextsPath;
// XStringW KextsPath;
if (InjectKextList.notEmpty()) {
return; //don't scan again
}
KextsPath = SWPrintf("%ls\\kexts", OEMPath.wc_str());
// KextsPath = SWPrintf("%ls\\kexts", OEMPath.wc_str());
// Iterate over kexts directory
DirIterOpen(SelfRootDir, KextsPath.wc_str(), &KextsIter);
DirIterOpen(&selfOem.getKextsDir(), NULL, &KextsIter);
while (DirIterNext(&KextsIter, 1, L"*", &FolderEntry)) {
if (FolderEntry->FileName[0] == L'.') {
continue;
@ -3334,7 +3317,7 @@ VOID InitKextList()
#define CONFIG_THEME_FILENAME L"theme.plist"
#define CONFIG_THEME_SVG L"theme.svg"
VOID
void
GetListOfThemes ()
{
EFI_STATUS Status = EFI_NOT_FOUND;
@ -3348,7 +3331,7 @@ GetListOfThemes ()
DbgHeader("GetListOfThemes");
ThemeNameArray.setEmpty();
DirIterOpen(SelfRootDir, L"\\EFI\\CLOVER\\themes", &DirIter);
DirIterOpen(&self.getThemesDir(), NULL, &DirIter);
while (DirIterNext(&DirIter, 1, L"*", &DirEntry)) {
if (DirEntry->FileName[0] == '.') {
//DBG("Skip theme: %ls\n", DirEntry->FileName);
@ -3356,8 +3339,7 @@ GetListOfThemes ()
}
//DBG("Found theme directory: %ls", DirEntry->FileName);
DBG("- [%02zu]: %ls", ThemeNameArray.size(), DirEntry->FileName);
ThemeTestPath = SWPrintf("EFI\\CLOVER\\themes\\%ls", DirEntry->FileName);
Status = SelfRootDir->Open(SelfRootDir, &ThemeTestDir, ThemeTestPath.wc_str(), EFI_FILE_MODE_READ, 0);
Status = self.getThemesDir().Open(&self.getThemesDir(), &ThemeTestDir, DirEntry->FileName, EFI_FILE_MODE_READ, 0);
if (!EFI_ERROR(Status)) {
Status = egLoadFile(ThemeTestDir, CONFIG_THEME_FILENAME, (UINT8**)&ThemePtr, &Size);
if (EFI_ERROR(Status) || (ThemePtr == NULL) || (Size == 0)) {
@ -3768,18 +3750,18 @@ TagDict* XTheme::LoadTheme(const XStringW& TestTheme)
return NULL;
}
if (UGAHeight > HEIGHT_2K) {
ThemePath = SWPrintf("EFI\\CLOVER\\themes\\%ls@2x", TestTheme.wc_str());
m_ThemePath = SWPrintf("%ls@2x", TestTheme.wc_str());
} else {
ThemePath = SWPrintf("EFI\\CLOVER\\themes\\%ls", TestTheme.wc_str());
m_ThemePath = SWPrintf("%ls", TestTheme.wc_str());
}
Status = SelfRootDir->Open(SelfRootDir, &ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
Status = self.getThemesDir().Open(&self.getThemesDir(), &ThemeDir, m_ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
if (EFI_ERROR(Status)) {
if (ThemeDir != NULL) {
ThemeDir->Close (ThemeDir);
ThemeDir = NULL;
}
ThemePath = SWPrintf("EFI\\CLOVER\\themes\\%ls", TestTheme.wc_str());
Status = SelfRootDir->Open(SelfRootDir, &ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
m_ThemePath = SWPrintf("%ls", TestTheme.wc_str());
Status = self.getThemesDir().Open(&self.getThemesDir(), &ThemeDir, m_ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
}
if (!EFI_ERROR(Status)) {
@ -3794,7 +3776,7 @@ TagDict* XTheme::LoadTheme(const XStringW& TestTheme)
if (ThemeDict == NULL) {
DBG("svg file %ls not parsed\n", CONFIG_THEME_SVG);
} else {
DBG("Using vector theme '%ls' (%ls)\n", TestTheme.wc_str(), ThemePath.wc_str());
DBG("Using vector theme '%ls' (%ls)\n", TestTheme.wc_str(), m_ThemePath.wc_str());
}
} else {
Status = egLoadFile(ThemeDir, CONFIG_THEME_FILENAME, (UINT8**)&ThemePtr, &Size);
@ -3806,7 +3788,7 @@ TagDict* XTheme::LoadTheme(const XStringW& TestTheme)
if (ThemeDict == NULL) {
DBG("xml file %ls not parsed\n", CONFIG_THEME_FILENAME);
} else {
DBG("Using theme '%ls' (%ls)\n", TestTheme.wc_str(), ThemePath.wc_str());
DBG("Using theme '%ls' (%ls)\n", TestTheme.wc_str(), m_ThemePath.wc_str());
}
}
}
@ -3969,16 +3951,17 @@ finish:
ThemeX.FillByEmbedded();
OldChosenTheme = 0xFFFF;
if (ThemeX.ThemeDir != NULL) {
ThemeX.ThemeDir->Close(ThemeX.ThemeDir);
ThemeX.ThemeDir = NULL;
}
ThemeX.closeThemeDir();
// if (ThemeX.ThemeDir != NULL) {
// ThemeX.ThemeDir->Close(ThemeX.ThemeDir);
// ThemeX.ThemeDir = NULL;
// }
// ThemeX.GetThemeTagSettings(NULL); already done
//fill some fields
//ThemeX.Font = FONT_ALFA; //to be inverted later. At start we have FONT_GRAY
ThemeX.embedded = true;
Status = StartupSoundPlay(ThemeX.ThemeDir, NULL);
Status = StartupSoundPlay(&ThemeX.getThemeDir(), NULL);
} else { // theme loaded successfully
ThemeX.embedded = false;
ThemeX.Theme.takeValueFrom(GlobalConfig.Theme); //XStringW from CHAR16*)
@ -3997,12 +3980,12 @@ finish:
ThemeDict->FreeTag();
if (!ThemeX.Daylight) {
Status = StartupSoundPlay(ThemeX.ThemeDir, L"sound_night.wav");
Status = StartupSoundPlay(&ThemeX.getThemeDir(), L"sound_night.wav");
if (EFI_ERROR(Status)) {
Status = StartupSoundPlay(ThemeX.ThemeDir, L"sound.wav");
Status = StartupSoundPlay(&ThemeX.getThemeDir(), L"sound.wav");
}
} else {
Status = StartupSoundPlay(ThemeX.ThemeDir, L"sound.wav");
Status = StartupSoundPlay(&ThemeX.getThemeDir(), L"sound.wav");
}
}
@ -4023,7 +4006,7 @@ finish:
return Status;
}
VOID
void
ParseSMBIOSSettings(
const TagDict* DictPointer
)
@ -5950,7 +5933,7 @@ GetUserSettings(const TagDict* CfgDict)
gSettings.RtROM.ncpy(&gLanMac[1][0], 6);
} else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both
UINTN ROMLength = 0;
VOID* ROM = GetDataSetting(RtVariablesDict, "ROM", &ROMLength);
void* ROM = GetDataSetting(RtVariablesDict, "ROM", &ROMLength);
gSettings.RtROM.ncpy(ROM, ROMLength);
} else {
MsgLog("MALFORMED PLIST : property not string or data in RtVariables/ROM\n");
@ -6054,7 +6037,7 @@ GetUserSettings(const TagDict* CfgDict)
// if CustomUUID and InjectSystemID are not specified
// then use InjectSystemID=TRUE and SMBIOS UUID
// to get Chameleon's default behaviour (to make user's life easier)
// CopyMem((VOID*)&gUuid, (VOID*)&gSettings.SmUUID, sizeof(EFI_GUID));
// CopyMem((void*)&gUuid, (void*)&gSettings.SmUUID, sizeof(EFI_GUID));
// SystemParameters again - values that can depend on previous params
const TagDict* SystemParametersDict = CfgDict->dictPropertyForKey("SystemParameters");
@ -6153,7 +6136,7 @@ GetUserSettings(const TagDict* CfgDict)
{
EFI_GUID AppleGuid;
CopyMem((VOID*)&AppleGuid, (VOID*)&gUuid, sizeof(EFI_GUID));
CopyMem((void*)&AppleGuid, (void*)&gUuid, sizeof(EFI_GUID));
AppleGuid.Data1 = SwapBytes32 (AppleGuid.Data1);
AppleGuid.Data2 = SwapBytes16 (AppleGuid.Data2);
AppleGuid.Data3 = SwapBytes16 (AppleGuid.Data3);
@ -6718,7 +6701,7 @@ GetRootUUID (IN REFIT_VOLUME *Volume)
}
VOID
void
GetDevices ()
{
EFI_STATUS Status;
@ -6764,7 +6747,7 @@ GetDevices ()
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < HandleCount; ++Index) {
Status = gBS->HandleProtocol(HandleArray[Index], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
Status = gBS->HandleProtocol(HandleArray[Index], &gEfiPciIoProtocolGuid, (void **)&PciIo);
if (!EFI_ERROR(Status)) {
// Read PCI BUS
PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
@ -7083,7 +7066,7 @@ GetDevices ()
}
VOID
void
SetDevices (LOADER_ENTRY *Entry)
{
// EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *modeInfo;
@ -7161,7 +7144,7 @@ SetDevices (LOADER_ENTRY *Entry)
if (!EFI_ERROR(Status)) {
for (i = 0; i < HandleCount; i++) {
Status = gBS->HandleProtocol (HandleBuffer[i], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
Status = gBS->HandleProtocol (HandleBuffer[i], &gEfiPciIoProtocolGuid, (void **)&PciIo);
if (!EFI_ERROR(Status)) {
// Read PCI BUS
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, sizeof (Pci) / sizeof (UINT32), &Pci);
@ -7951,7 +7934,7 @@ SetDevices (LOADER_ENTRY *Entry)
mPropSize = hex2bin (gDeviceProperties, mProperties, mPropSize);
// DBG("Final size of mProperties=%d\n", mPropSize);
//---------
// Status = egSaveFile(SelfRootDir, L"EFI\\CLOVER\\misc\\devprop.bin", (UINT8*)mProperties, mPropSize);
// Status = egSaveFile(&self.getSelfRootDir(), SWPrintf("%ls\\misc\\devprop.bin", self.getCloverDirPathAsXStringW().wc_str()).wc_str() , (UINT8*)mProperties, mPropSize);
//and now we can free memory?
if (gSettings.AddProperties) {
FreePool(gSettings.AddProperties);
@ -8075,21 +8058,13 @@ SaveSettings ()
XStringW GetOtherKextsDir (BOOLEAN On)
{
XStringW SrcDir;
SrcDir = SWPrintf("%ls\\kexts\\%s", OEMPath.wc_str(), On?"Other":"Off");
if (!FileExists (SelfVolume->RootDir, SrcDir)) {
SrcDir = SWPrintf("\\EFI\\CLOVER\\kexts\\%s", On?"Other":"Off");
if (!FileExists (SelfVolume->RootDir, SrcDir)) {
SrcDir.setEmpty();
}
if ( FileExists(&selfOem.getKextsDir(), On ? L"Other" : L"Off") ) {
return On ? L"Other"_XSW : L"Off"_XSW;
}
return SrcDir;
return NullXStringW;
}
//dmazar
// caller is responsible for FreePool the result
XStringW
GetOSVersionKextsDir (
const XString8& OSVersion
@ -8116,9 +8091,9 @@ GetOSVersionKextsDir (
// find source injection folder with kexts
// note: we are just checking for existance of particular folder, not checking if it is empty or not
// check OEM subfolders: version specific or default to Other
XStringW SrcDir = SWPrintf("%ls\\kexts\\%s", OEMPath.wc_str(), FixedVersion.c_str());
if (!FileExists (SelfVolume->RootDir, SrcDir)) {
SrcDir = SWPrintf("\\EFI\\CLOVER\\kexts\\%s", FixedVersion.c_str());
XStringW SrcDir = SWPrintf("%ls\\kexts\\%s", selfOem.getOemFullPath().wc_str(), FixedVersion.c_str());
if (!FileExists (&self.getSelfVolumeRootDir(), SrcDir)) {
SrcDir = SWPrintf("\\%ls\\kexts\\%s", self.getCloverDirPathAsXStringW().wc_str(), FixedVersion.c_str());
if (!FileExists (SelfVolume->RootDir, SrcDir)) {
SrcDir.setEmpty();
}

View File

@ -895,14 +895,14 @@ SetFSInjection (
IN LOADER_ENTRY *Entry
);
VOID
void
SetDevices (
LOADER_ENTRY *Entry
);
//
// check if this entry corresponds to Boot# variable and then set BootCurrent
//
VOID
void
SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *LoadedEntry);
@ -912,13 +912,13 @@ GetOSVersion (
);
VOID GetListOfThemes(VOID);
VOID GetListOfConfigs(VOID);
VOID GetListOfACPI(VOID);
VOID GetListOfDsdts(VOID);
void GetListOfThemes(void);
void GetListOfConfigs(void);
void GetListOfACPI(void);
void GetListOfDsdts(void);
// syscl - get list of inject kext(s)
VOID GetListOfInjectKext(CHAR16 *);
void GetListOfInjectKext(CHAR16 *);
UINT32
GetCrc32 (
@ -926,8 +926,8 @@ GetCrc32 (
UINTN Size
);
VOID
GetDevices(VOID);
void
GetDevices(void);
CONST XStringW
@ -942,8 +942,7 @@ GetRootUUID (
EFI_STATUS
GetEarlyUserSettings (
IN EFI_FILE *RootDir,
const TagDict* CfgDict
const TagDict* CfgDict
);
EFI_STATUS
@ -969,14 +968,14 @@ InjectKextsFromDir (
CHAR16 *SrcDir
);
VOID
void
ParseLoadOptions (
OUT XStringW* ConfName,
OUT TagDict** Dict
);
EFI_STATUS
SaveSettings (VOID);
SaveSettings (void);
@ -990,18 +989,17 @@ BOOLEAN IsOSValid(const XString8& MatchOS, const XString8& CurrOS);
//get default boot
VOID GetBootFromOption(VOID);
VOID
InitKextList(VOID);
void GetBootFromOption(void);
void
InitKextList(void);
EFI_STATUS
LoadUserSettings (
IN EFI_FILE *RootDir,
const XStringW& ConfName,
TagDict** dict
);
VOID
void
ParseSMBIOSSettings (
const TagDict* dictPointer
);

View File

@ -59,7 +59,7 @@ EFI_AUDIO_IO_PROTOCOL *AudioIo = NULL;
EFI_STATUS
StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
StartupSoundPlay(const EFI_FILE* Dir, CONST CHAR16* SoundFile)
{
EFI_STATUS Status;
UINT8 *FileData = NULL;
@ -299,7 +299,7 @@ GetStoredOutput()
// Try to find the matching device exposing an Audio I/O protocol.
for (h = 0; h < AudioIoHandleCount; h++) {
// Open Device Path protocol.
Status = gBS->HandleProtocol(AudioIoHandles[h], &gEfiDevicePathProtocolGuid, (VOID**)&DevicePath);
Status = gBS->HandleProtocol(AudioIoHandles[h], &gEfiDevicePathProtocolGuid, (void**)&DevicePath);
if (EFI_ERROR(Status)) {
DBG("no DevicePath at %llu handle AudioIo\n", h);
continue;
@ -308,7 +308,7 @@ GetStoredOutput()
// Compare Device Paths. If they match, we have our Audio I/O device.
if (!CompareMem(StoredDevicePath, DevicePath, StoredDevicePathSize)) {
// Open Audio I/O protocol.
Status = gBS->HandleProtocol(AudioIoHandles[h], &gEfiAudioIoProtocolGuid, (VOID**)&AudioIoProto);
Status = gBS->HandleProtocol(AudioIoHandles[h], &gEfiAudioIoProtocolGuid, (void**)&AudioIoProto);
if (EFI_ERROR(Status)) {
DBG("dont handle AudioIo\n");
goto DONE;
@ -402,7 +402,7 @@ EFI_STATUS CheckSyncSound(BOOLEAN Stop)
return Status;
}
VOID GetOutputs()
void GetOutputs()
{
EFI_STATUS Status;
// Audio I/O.
@ -427,7 +427,7 @@ VOID GetOutputs()
for (h = 0; h < AudioIoHandleCount; h++) {
UINTN i;
Status = gBS->HandleProtocol(AudioIoHandles[h], &gEfiAudioIoProtocolGuid, (VOID**)&AudioIoTmp);
Status = gBS->HandleProtocol(AudioIoHandles[h], &gEfiAudioIoProtocolGuid, (void**)&AudioIoTmp);
if (EFI_ERROR(Status)) {
DBG("dont handle AudioIo at %llu\n", h);
continue;

View File

@ -21,9 +21,9 @@ extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
EFI_STATUS
StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile);
StartupSoundPlay(const EFI_FILE* Dir, CONST CHAR16* SoundFile);
VOID GetOutputs();
void GetOutputs();
EFI_STATUS CheckSyncSound(BOOLEAN Stop);

View File

@ -689,7 +689,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
ssdt->Length = root->Size;
FixChecksum(ssdt);
// ssdt->Checksum = 0;
// ssdt->Checksum = (UINT8)(256 - Checksum8((VOID*)ssdt, ssdt->Length));
// ssdt->Checksum = (UINT8)(256 - Checksum8((void*)ssdt, ssdt->Length));
aml_destroy_node(root);

View File

@ -23,7 +23,7 @@
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
//
//VOID LowCase (IN OUT CHAR8 *Str)
//void LowCase (IN OUT CHAR8 *Str)
//{
// while (*Str) {
// if (IS_UPPER(*Str)) {

View File

@ -35,7 +35,7 @@
#define IS_PUNCT(x) ((x == '.') || (x == '-'))
////VOID LowCase (IN OUT CHAR8 *Str);
////void LowCase (IN OUT CHAR8 *Str);
UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
BOOLEAN IsHexDigit (CHAR8 c);
UINT8 hexstrtouint8 (CONST CHAR8* buf); //one or two hex letters to one byte
@ -80,7 +80,7 @@ BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
//EFI_DEVICE_PATH_PROTOCOL *
//EFIAPI
//NextDevicePathNode (
// IN VOID *Node
// IN void *Node
// );
#endif

View File

@ -13,6 +13,8 @@
#include "../include/Pci.h"
#include "../include/Devices.h"
#include "../Platform/Settings.h"
#include "Self.h"
#include "SelfOem.h"
#ifndef DEBUG_ALL
#define DEBUG_ATI 1
@ -1529,7 +1531,7 @@ BOOLEAN get_vramtotalsize_val(value_t *val, INTN index, BOOLEAN Sier)
return TRUE;
}
VOID free_val(value_t *val )
void free_val(value_t *val )
{
// if (val->type == kPtr) {
FreePool(val->data);
@ -1547,7 +1549,7 @@ VOID free_val(value_t *val )
value_t default_val;
} AtiDevProp;
*/
VOID devprop_add_list(AtiDevProp devprop_list[], const XString8& OSVersion)
void devprop_add_list(AtiDevProp devprop_list[], const XString8& OSVersion)
{
INTN i, pnum;
BOOLEAN Sier;
@ -1570,7 +1572,7 @@ VOID devprop_add_list(AtiDevProp devprop_list[], const XString8& OSVersion)
newname[1] = (CHAR8)(0x30 + pnum); // convert to ascii for number 0..9
devprop_add_value(card->device, newname, val->data, val->size);
free_val(val);
FreePool((VOID*)newname);
FreePool((void*)newname);
}
}
// devprop_list[i].name[1] = 0x30; // write back our "@0," for a next possible card
@ -1592,7 +1594,7 @@ VOID devprop_add_list(AtiDevProp devprop_list[], const XString8& OSVersion)
devprop_list[i].default_val.type == kCst ?
(UINT8 *)&(devprop_list[i].default_val.data) : devprop_list[i].default_val.data,
devprop_list[i].default_val.size);
FreePool((VOID*)newname);
FreePool((void*)newname);
}
}
// devprop_list[i].name[1] = 0x30; // write back our "@0," for a next possible card
@ -1632,19 +1634,17 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id)
{
EFI_STATUS Status = EFI_NOT_FOUND;
UINTN bufferLen = 0;
CHAR16 FileName[64];
UINT8* buffer = 0;
snwprintf(FileName, 128, "\\ROM\\%04hX_%04hX.rom", vendor_id, device_id);
if (FileExists(OEMDir, FileName)) {
XStringW FileName = SWPrintf("ROM\\%04hX_%04hX.rom", vendor_id, device_id);
if (FileExists(&selfOem.getOemDir(), FileName)) {
DBG("Found generic VBIOS ROM file (%04hX_%04hX.rom)\n", vendor_id, device_id);
Status = egLoadFile(OEMDir, FileName, &buffer, &bufferLen);
Status = egLoadFile(&selfOem.getOemDir(), FileName.wc_str(), &buffer, &bufferLen);
}
if (EFI_ERROR(Status)) {
snwprintf(FileName, 128, "\\EFI\\CLOVER\\ROM\\%04hX_%04hX.rom", vendor_id, device_id);
if (FileExists(SelfRootDir, FileName)){
if (FileExists(&self.getCloverDir(), FileName)){
DBG("Found generic VBIOS ROM file (%04hX_%04hX.rom)\n", vendor_id, device_id);
Status = egLoadFile(SelfRootDir, FileName, &buffer, &bufferLen);
Status = egLoadFile(&self.getCloverDir(), FileName.wc_str(), &buffer, &bufferLen);
}
}
@ -1746,7 +1746,7 @@ BOOLEAN read_vbios(BOOLEAN from_pci)
return TRUE;
}
BOOLEAN read_disabled_vbios(VOID)
BOOLEAN read_disabled_vbios(void)
{
BOOLEAN ret = FALSE;
ati_chip_family_t chip_family = card->info->chip_family;
@ -1859,7 +1859,7 @@ BOOLEAN read_disabled_vbios(VOID)
return ret;
}
BOOLEAN radeon_card_posted(VOID)
BOOLEAN radeon_card_posted(void)
{
UINTN reg;
// ati_chip_family_t chip_family = card->info->chip_family;
@ -1902,7 +1902,7 @@ BOOLEAN radeon_card_posted(VOID)
}
#if 0 //may be inject this as saved-config?
BOOLEAN devprop_add_pci_config_space(VOID)
BOOLEAN devprop_add_pci_config_space(void)
{
int offset;

View File

@ -67,7 +67,7 @@
LIST_ENTRY gCardList = INITIALIZE_LIST_HEAD_VARIABLE (gCardList);
VOID AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, BOOLEAN LoadVBios)
void AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, BOOLEAN LoadVBios)
{
CARDLIST* new_card;
new_card = (__typeof__(new_card))AllocateZeroPool(sizeof(CARDLIST));
@ -101,7 +101,7 @@ CARDLIST* FindCardWithIds(UINT32 Id, UINT32 SubId)
return NULL;
}
VOID FillCardList(const TagDict* CfgDict)
void FillCardList(const TagDict* CfgDict)
{
if (IsListEmpty(&gCardList) && (CfgDict != NULL)) {
CONST CHAR8 *VEN[] = { "NVIDIA", "ATI" };

View File

@ -26,7 +26,7 @@ typedef struct {
#define CARDLIST_SIGNATURE SIGNATURE_32('C','A','R','D')
VOID
void
FillCardList (
const TagDict* CfgDict
);
@ -37,7 +37,7 @@ CARDLIST
UINT32 SubId
);
VOID
void
AddCard (
CONST CHAR8 *Model,
UINT32 Id,

View File

@ -99,7 +99,7 @@ void post_startup_cpu_fixups(void)
}
VOID DoCpuid(UINT32 selector, UINT32 *data)
void DoCpuid(UINT32 selector, UINT32 *data)
{
AsmCpuid(selector, data, data+1, data+2, data+3);
}
@ -107,7 +107,7 @@ VOID DoCpuid(UINT32 selector, UINT32 *data)
//
// Should be used after PrepatchSmbios() but before users's config.plist reading
//
VOID GetCPUProperties (VOID)
void GetCPUProperties (void)
{
UINT32 reg[4];
UINT64 msr = 0;
@ -1092,7 +1092,7 @@ VOID GetCPUProperties (VOID)
Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiPciIoProtocolGuid, NULL, &HandleCount, &HandleBuffer);
if (Status == EFI_SUCCESS) {
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Status = gBS->HandleProtocol(HandleBuffer[HandleIndex], &gEfiPciIoProtocolGuid, (VOID **) &PciIo);
Status = gBS->HandleProtocol(HandleBuffer[HandleIndex], &gEfiPciIoProtocolGuid, (void **) &PciIo);
if (!EFI_ERROR(Status)) {
/* Read PCI BUS */
Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
@ -1162,7 +1162,7 @@ VOID GetCPUProperties (VOID)
// return;
}
VOID SetCPUProperties (VOID)
void SetCPUProperties (void)
{
UINT64 msr = 0;

View File

@ -388,17 +388,17 @@ extern UINT64 TurboMsr;
extern CPU_STRUCTURE gCPUStructure;
VOID
GetCPUProperties (VOID);
void
GetCPUProperties (void);
MACHINE_TYPES
GetDefaultModel (VOID);
GetDefaultModel (void);
UINT16
GetAdvancedCpuType (VOID);
GetAdvancedCpuType (void);
VOID
SetCPUProperties (VOID);
void
SetCPUProperties (void);

View File

@ -54,7 +54,7 @@ UINT32 device_inject_stringlength = 0;
}
*/
DevPropString *devprop_create_string(VOID)
DevPropString *devprop_create_string(void)
{
// DBG("Begin creating strings for devices:\n");
device_inject_string = (DevPropString*)AllocateZeroPool(sizeof(DevPropString));
@ -91,7 +91,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;
@ -262,10 +262,10 @@ BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, UINT8 *vl, UIN
if(!newdata)
return FALSE;
if((device->data) && (offset > 1)) {
CopyMem((VOID*)newdata, (VOID*)device->data, offset);
CopyMem((void*)newdata, (void*)device->data, offset);
}
CopyMem((VOID*)(newdata + offset), (VOID*)data, length);
CopyMem((void*)(newdata + offset), (void*)data, length);
device->length += length;
device->string->length += length;
@ -328,7 +328,7 @@ CHAR8 *devprop_generate_string(DevPropString *StringBuf)
return ptr;
}
VOID devprop_free_string(DevPropString *StringBuf)
void devprop_free_string(DevPropString *StringBuf)
{
INT32 i;
if(!StringBuf)

View File

@ -49,10 +49,10 @@ typedef struct {
XString8 get_pci_dev_path(pci_dt_t *pci_dt);
UINT32 pci_config_read32(pci_dt_t *pci_dt, UINT8 reg);
extern pci_dt_t* nvdevice;
VOID* PCIReadRom(pci_dt_t* device);
void* PCIReadRom(pci_dt_t* device);
#if 0 //never do this
extern VOID setupDeviceProperties(Node *node);
extern void setupDeviceProperties(Node *node);
#endif
struct ACPIDevPath {
@ -117,7 +117,7 @@ DevPropString *devprop_create_string(void);
DevPropDevice *devprop_add_device_pci(DevPropString *string, pci_dt_t *PciDt, EFI_DEVICE_PATH_PROTOCOL *DevicePath);
BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, UINT8 *vl, UINTN len);
CHAR8 *devprop_generate_string(DevPropString *string);
VOID devprop_free_string(DevPropString *string);
void devprop_free_string(DevPropString *string);
BOOLEAN set_eth_props(pci_dt_t *eth_dev);
BOOLEAN set_usb_props(pci_dt_t *usb_dev);

View File

@ -128,7 +128,7 @@ BOOLEAN 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

@ -63,7 +63,7 @@ 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.
*/
VOID LOADER_ENTRY::SetKernelRelocBase()
void LOADER_ENTRY::SetKernelRelocBase()
{
// EFI_STATUS Status;
UINTN DataSize = sizeof(KernelRelocBase);
@ -393,7 +393,7 @@ UINTN LOADER_ENTRY::searchProc(const XString8& procedure)
#if 0
//TimeWalker - extended and corrected for systems up to Yosemite
//TODO - Slice: no more needed
VOID LOADER_ENTRY::KernelPatcher_64()
void LOADER_ENTRY::KernelPatcher_64()
{
UINT8 *bytes = KernelData;
UINT32 patchLocation=0, patchLocation1=0;
@ -527,7 +527,7 @@ VOID LOADER_ENTRY::KernelPatcher_64()
// patch ssse3
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.6",4)==0)) {
Patcher_SSE3_6((VOID*)bytes);
Patcher_SSE3_6((void*)bytes);
}
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.7",4)==0)) {
Patcher_SSE3_7();
@ -626,7 +626,7 @@ VOID LOADER_ENTRY::KernelPatcher_64()
}
}
VOID LOADER_ENTRY::KernelPatcher_32()
void LOADER_ENTRY::KernelPatcher_32()
{
UINT8* bytes = KernelData;
UINT32 patchLocation=0, patchLocation1=0;
@ -727,10 +727,10 @@ VOID LOADER_ENTRY::KernelPatcher_32()
if (AsciiStrnCmp(OSVersion,"10.7",4)==0) return;
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.6",4)==0)) {
Patcher_SSE3_6((VOID*)bytes);
Patcher_SSE3_6((void*)bytes);
}
if (!SSSE3 && (AsciiStrnCmp(OSVersion,"10.5",4)==0)) {
Patcher_SSE3_5((VOID*)bytes);
Patcher_SSE3_5((void*)bytes);
}
}
}
@ -850,7 +850,7 @@ BOOLEAN LOADER_ENTRY::PatchCPUID(const UINT8* Location, INT32 LenLoc,
return Patched;
}
VOID LOADER_ENTRY::KernelCPUIDPatch()
void LOADER_ENTRY::KernelCPUIDPatch()
{
// Tiger/Leopard patterns
DBG_RT( "CPUID: try Tiger/Leopard patch...\n");
@ -1256,12 +1256,12 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_32()
// SandyBridge-E, Ivy Bridge, Ivy Bridge-E, Haswell Celeron/Pentium, Haswell-E, Broadwell-E, ...
// credit Pike R.Alpha, stinga11, syscl
//
//BOOLEAN (*EnableExtCpuXCPM)(VOID *kernelData);
//BOOLEAN (*EnableExtCpuXCPM)(void *kernelData);
//
// syscl - applyKernPatch a wrapper for SearchAndReplace() to make the CpuPM patch tidy and clean
//
VOID LOADER_ENTRY::applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *repl, const CHAR8 *comment)
void LOADER_ENTRY::applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *repl, const CHAR8 *comment)
{
DBG("Searching %s...\n", comment);
if (SearchAndReplace(KernelData, KERNEL_MAX_SIZE, find, size, repl, 0)) {
@ -1888,7 +1888,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM()
return TRUE;
}
#if 0
VOID Patcher_SSE3_6(VOID* kernelData)
void Patcher_SSE3_6(void* kernelData)
{
UINT8* bytes = (UINT8*)kernelData;
UINT32 patchLocation1 = 0;
@ -1960,7 +1960,7 @@ VOID Patcher_SSE3_6(VOID* kernelData)
}
VOID Patcher_SSE3_5(VOID* kernelData)
void Patcher_SSE3_5(void* kernelData)
{
UINT8* bytes = (UINT8*)kernelData;
UINT32 patchLocation1 = 0;
@ -2028,7 +2028,7 @@ VOID Patcher_SSE3_5(VOID* kernelData)
}
VOID Patcher_SSE3_7()
void Patcher_SSE3_7()
{
// not support yet
return;
@ -2275,7 +2275,7 @@ void LOADER_ENTRY::Get_PreLink()
return;
}
VOID
void
LOADER_ENTRY::FindBootArgs()
{
UINT8 *ptr;
@ -2480,7 +2480,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize)
return (y != 0);
}
VOID
void
LOADER_ENTRY::KernelAndKextPatcherInit()
{
if (PatcherInited) {
@ -2591,7 +2591,7 @@ LOADER_ENTRY::KernelAndKextPatcherInit()
DBG( "isKernelcache: %ls\n", isKernelcache ? L"Yes" : L"No");
}
VOID
void
LOADER_ENTRY::KernelAndKextsPatcherStart()
{
BOOLEAN KextPatchesNeeded, patchedOk;

View File

@ -140,24 +140,24 @@ extern LIST_ENTRY gKextList; // Jief : globals variables... not great.
//extern UINT32 DisplayVendor[];
//VOID findCPUfamily();
//void findCPUfamily();
//extern BOOLEAN SSSE3;
//UINT64 kernelsize;
//VOID Patcher_SSE3_5(VOID* kernelData);
//VOID Patcher_SSE3_6(VOID* kernelData);
//VOID Patcher_SSE3_7();
//void Patcher_SSE3_5(void* kernelData);
//void Patcher_SSE3_6(void* kernelData);
//void Patcher_SSE3_7();
//#include "../gui/menu_items/menu_items.h" // for LOADER_ENTRY
//class LOADER_ENTRY;
//VOID KernelAndKextsPatcherStart(IN LOADER_ENTRY *Entry);
//void KernelAndKextsPatcherStart(IN LOADER_ENTRY *Entry);
//VOID register_kernel_symbol(CONST CHAR8* name);
//void register_kernel_symbol(CONST CHAR8* name);
//UINT64 symbol_handler(CHAR8* symbolName, UINT64 addr);
//INTN locate_symbols(VOID* kernelData);
//INTN locate_symbols(void* kernelData);
/////////////////////
@ -169,14 +169,14 @@ extern LIST_ENTRY gKextList; // Jief : globals variables... not great.
// Called from SetFSInjection(), before boot.efi is started,
// to allow patchers to prepare FSInject to force load needed kexts.
//
//VOID KextPatcherRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_LIST *ForceLoadKexts, LOADER_ENTRY *Entry);
//void KextPatcherRegisterKexts(FSINJECTION_PROTOCOL *FSInject, FSI_STRING_LIST *ForceLoadKexts, LOADER_ENTRY *Entry);
//
// Entry for all kext patches.
// Will iterate through kext in prelinked kernel (kernelcache)
// or DevTree (drivers boot) and do patches.
//
//VOID KextPatcherStart(LOADER_ENTRY *Entry);
//void KextPatcherStart(LOADER_ENTRY *Entry);
//
// Searches Source for Search pattern of size SearchSize
@ -185,7 +185,7 @@ extern LIST_ENTRY gKextList; // Jief : globals variables... not great.
UINTN SearchAndCount(const UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UINTN SearchSize);
BOOLEAN CompareMemMask(const UINT8 *Source, const UINT8 *Search, UINTN SearchSize, const UINT8 *Mask, UINTN MaskSize);
VOID CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize);
void CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize);
UINTN FindMemMask(const UINT8 *Source, UINTN SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *MaskSearch, UINTN MaskSize);
UINTN FindRelative32(const UINT8 *Source, UINTN Start, UINTN SourceSize, UINTN taskLocation);
//UINTN FindSection(const UINT8 *Source, UINTN len, const UINT8* seg, const UINT8* sec);

View File

@ -127,10 +127,10 @@ BOOLEAN checkOSBundleRequired(UINT8 loaderType, const TagDict* dict)
return inject;
}
//extern VOID KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry);
//extern VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N, LOADER_ENTRY *Entry);
//extern void KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry);
//extern void AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N, LOADER_ENTRY *Entry);
EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext_v)
EFI_STATUS LOADER_ENTRY::LoadKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType, IN OUT void *kext_v)
{
EFI_STATUS Status;
UINT8* infoDictBuffer = NULL;
@ -220,7 +220,7 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, const XString8& FileName
return EFI_SUCCESS;
}
EFI_STATUS LOADER_ENTRY::AddKext(IN EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType)
EFI_STATUS LOADER_ENTRY::AddKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType)
{
EFI_STATUS Status;
KEXT_ENTRY *KextEntry;
@ -270,7 +270,7 @@ UINT32 GetKextsSize()
return kextsSize;
}
VOID LOADER_ENTRY::LoadPlugInKexts(IN EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force)
void LOADER_ENTRY::LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force)
{
REFIT_DIR_ITER PlugInIter;
EFI_FILE_INFO *PlugInFile;
@ -290,7 +290,7 @@ VOID LOADER_ENTRY::LoadPlugInKexts(IN EFI_FILE *RootDir, const XString8& DirName
DirIterClose(&PlugInIter);
}
//VOID LOADER_ENTRY::AddKexts(const XStringW& SrcDir, const XStringW& Path, cpu_type_t archCpuType)
//void LOADER_ENTRY::AddKexts(const XStringW& SrcDir, const XStringW& Path, cpu_type_t archCpuType)
//{
// XStringW FileName;
// XStringW PlugInName;
@ -338,7 +338,7 @@ VOID LOADER_ENTRY::LoadPlugInKexts(IN EFI_FILE *RootDir, const XString8& DirName
//}
// Jief : this should replace LOADER_ENTRY::AddKexts
VOID LOADER_ENTRY::AddKextsFromDirInArray(const XString8& SrcDir, const XString8& Path, cpu_type_t archCpuType, XObjArray<SIDELOAD_KEXT>* kextArray)
void LOADER_ENTRY::AddKextsFromDirInArray(const XString8& SrcDir, const XString8& Path, cpu_type_t archCpuType, XObjArray<SIDELOAD_KEXT>* kextArray)
{
XStringW FileName;
XStringW PlugInName;
@ -489,7 +489,7 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
XStringW DirName;
XStringW DirPath;
OSAllVersionKextsDir = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), osMajorVersion.wc_str());
OSAllVersionKextsDir = SWPrintf("%ls", osMajorVersion.wc_str());
AddKextsFromDirInArray(OSAllVersionKextsDir, osMajorVersion, archCpuType, kextArray);
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
@ -499,13 +499,13 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
} else {
DirName = SWPrintf("%ls_normal", osMajorVersion.wc_str());
}
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), DirName.wc_str());
DirPath = SWPrintf("%ls", DirName.wc_str());
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
// Add kext from ${osMajorVersion}.{version}
OSShortVersionKextsDir = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), UniShortOSVersion.wc_str());
OSShortVersionKextsDir = SWPrintf("%ls", UniShortOSVersion.wc_str());
AddKextsFromDirInArray( OSShortVersionKextsDir, UniShortOSVersion, archCpuType, kextArray);
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
@ -515,7 +515,7 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
} else {
DirName = SWPrintf("%ls_normal", UniShortOSVersion.wc_str());
}
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), DirName.wc_str());
DirPath = SWPrintf("%ls", DirName.wc_str());
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
@ -529,7 +529,7 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
OSVersionKextsDirName = SWPrintf("%s", OSVersion.c_str());
}
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), OSVersionKextsDirName.wc_str());
DirPath = SWPrintf("%ls", OSVersionKextsDirName.wc_str());
AddKextsFromDirInArray(DirPath, OSVersionKextsDirName, archCpuType, kextArray);
if ( OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
@ -539,7 +539,7 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
} else {
DirName = SWPrintf("%ls_normal", OSVersionKextsDirName.wc_str());
}
DirPath = SWPrintf("%ls\\kexts\\%ls", OEMPath.wc_str(), DirName.wc_str());
DirPath = SWPrintf("%ls", DirName.wc_str());
AddKextsFromDirInArray(DirPath, DirName, archCpuType, kextArray);
}else{
//MsgLog("No os version is detected\n");
@ -579,13 +579,13 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
}
for (size_t idx = 0 ; idx < kextArray.size() ; idx++ ) {
AddKext(SelfVolume->RootDir, S8Printf("%ls\\kexts\\%ls\\%ls", OEMPath.wc_str(), kextArray[idx].KextDirNameUnderOEMPath.wc_str(), kextArray[idx].FileName.wc_str()), archCpuType);
AddKext(SelfVolume->RootDir, S8Printf("%ls\\%ls", kextArray[idx].KextDirNameUnderOEMPath.wc_str(), kextArray[idx].FileName.wc_str()), archCpuType);
}
UINTN mm_extra_size;
VOID *mm_extra;
void *mm_extra;
UINTN extra_size;
VOID *extra;
void *extra;
// reserve space in the device tree
if (GetKextCount() > 0) {
@ -798,7 +798,7 @@ EFI_STATUS LOADER_ENTRY::InjectKexts(IN UINT32 deviceTreeP, IN UINT32* deviceTre
// Status = gBS->AllocatePages(AllocateAddress, EfiLoaderData, kextsPages, &kextsBase);
// if (EFI_ERROR(Status)) { MsgLog("Kext inject: could not allocate memory\n"); return Status; }
// Desc->NumberOfPages += kextsPages;
// CopyMem((VOID*)kextsBase, (VOID*)(UINTN)kext.paddr, kext.length);
// CopyMem((void*)kextsBase, (void*)(UINTN)kext.paddr, kext.length);
// drvinfo = (_BooterKextFileInfo*) kextsBase;
// drvinfo->infoDictPhysAddr += (UINT32)kextsBase;
// drvinfo->executablePhysAddr += (UINT32)kextsBase;
@ -854,7 +854,7 @@ EFI_STATUS LOADER_ENTRY::InjectKexts(IN UINT32 deviceTreeP, IN UINT32* deviceTre
for (Link = gKextList.ForwardLink; Link != &gKextList; Link = Link->ForwardLink) {
KextEntry = CR(Link, KEXT_ENTRY, Link, KEXT_SIGNATURE);
CopyMem((VOID*) KextBase, (VOID*)(UINTN) KextEntry->kext.paddr, KextEntry->kext.length);
CopyMem((void*) KextBase, (void*)(UINTN) KextEntry->kext.paddr, KextEntry->kext.length);
drvinfo = (_BooterKextFileInfo*) KextBase;
drvinfo->infoDictPhysAddr += (UINT32) KextBase;
drvinfo->executablePhysAddr += (UINT32) KextBase;
@ -936,7 +936,7 @@ const UINT8 KBELionReplaceEXT_X64[] = { 0xE8, 0x0C, 0xFD, 0xFF, 0xFF, 0x90, 0
//
VOID EFIAPI LOADER_ENTRY::KernelBooterExtensionsPatch()
void EFIAPI LOADER_ENTRY::KernelBooterExtensionsPatch()
{
// UINTN Num = 0;
UINTN NumSnow_i386_EXT = 0;

View File

@ -112,7 +112,7 @@ BOOLEAN CompareMemMask(const UINT8 *Source, const UINT8 *Search, UINTN SearchSiz
return TRUE;
}
VOID CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize)
void CopyMemMask(UINT8 *Dest, const UINT8 *Replace, const UINT8 *Mask, UINTN SearchSize)
{
UINT8 M, D;
// the procedure is called from SearchAndReplaceMask with own check but for future it is better to check twice
@ -276,7 +276,7 @@ UINTN SearchAndReplaceTxt(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search,
CHAR8 gKextBundleIdentifier[256];
/** Extracts kext BundleIdentifier from given Plist into gKextBundleIdentifier */
VOID ExtractKextBundleIdentifier(CHAR8 *Plist)
void ExtractKextBundleIdentifier(CHAR8 *Plist)
{
CHAR8 *Tag;
CHAR8 *BIStart;
@ -360,7 +360,7 @@ CHAR8 ATIKextBundleId[2][64];
//
// Inits patcher: prepares ATIKextBundleIds.
//
VOID LOADER_ENTRY::ATIConnectorsPatchInit()
void LOADER_ENTRY::ATIConnectorsPatchInit()
{
//
// prepar boundle ids
@ -390,7 +390,7 @@ VOID LOADER_ENTRY::ATIConnectorsPatchInit()
//
// Registers kexts that need force-load during WithKexts boot.
//
VOID LOADER_ENTRY::ATIConnectorsPatchRegisterKexts(void *FSInject_v, void *ForceLoadKexts_v)
void LOADER_ENTRY::ATIConnectorsPatchRegisterKexts(void *FSInject_v, void *ForceLoadKexts_v)
{
FSINJECTION_PROTOCOL *FSInject = (FSINJECTION_PROTOCOL *)FSInject_v;
FSI_STRING_LIST *ForceLoadKexts = (FSI_STRING_LIST *)ForceLoadKexts_v;
@ -418,7 +418,7 @@ VOID LOADER_ENTRY::ATIConnectorsPatchRegisterKexts(void *FSInject_v, void *Force
//
// Patch function.
//
VOID LOADER_ENTRY::ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
void LOADER_ENTRY::ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
{
UINTN Num = 0;
@ -470,7 +470,7 @@ const UINT8 MovlE2ToEcx[] = { 0xB9, 0xE2, 0x00, 0x00, 0x00 };
const UINT8 MovE2ToCx[] = { 0x66, 0xB9, 0xE2, 0x00 };
const UINT8 Wrmsr[] = { 0x0F, 0x30 };
VOID LOADER_ENTRY::AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
void LOADER_ENTRY::AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
{
UINTN Index1;
UINTN Index2;
@ -578,7 +578,7 @@ const UINT8 Moj4CataReplace[] = { 0xeb, 0x33, 0x0f, 0xb7 };
// we are planning to patch.
//
VOID LOADER_ENTRY::AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
void LOADER_ENTRY::AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
{
#if OLD_METHOD
UINTN Num = 0;
@ -670,7 +670,7 @@ VOID LOADER_ENTRY::AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPl
//
// not used since 4242
#if 0
VOID LOADER_ENTRY::CheckForFakeSMC(CHAR8 *InfoPlist)
void LOADER_ENTRY::CheckForFakeSMC(CHAR8 *InfoPlist)
{
if (OSFLAG_ISSET(Flags, OSFLAG_CHECKFAKESMC) &&
OSFLAG_ISSET(Flags, OSFLAG_WITHKEXTS)) {
@ -703,7 +703,7 @@ STATIC UINT8 DELL_SMBIOS_GUID_Replace[] = { 0x45, 0x42, 0x39, 0x44, 0x32, 0x44
// all computers even though Apple.Inc should obey the rule
// that's why we can be so confident to write patch pattern this way - syscl
//
VOID LOADER_ENTRY::DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
void LOADER_ENTRY::DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
{
//
// syscl
@ -744,7 +744,7 @@ VOID LOADER_ENTRY::DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
// SNBE_AICPUPatch implemented by syscl
// Fix AppleIntelCPUPowerManagement on SandyBridge-E (c) omni, stinga11
//
VOID LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
{
UINT32 i;
UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
@ -1020,7 +1020,7 @@ const UINT8 BroadwellE_IOPCI_Repl_SieHS[] = { 0x48, 0x81, 0xFB, 0x00, 0x00, 0x
const UINT8 BroadwellE_IOPCI_Find_MojCata[] = { 0x48, 0x3D, 0x00, 0x00, 0x00, 0x40 };
const UINT8 BroadwellE_IOPCI_Repl_MojCata[] = { 0x48, 0x3D, 0x00, 0x00, 0x00, 0x80 };
VOID LOADER_ENTRY::BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
void LOADER_ENTRY::BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
{
UINTN count = 0;
UINT64 os_ver = AsciiOSVersionToUint64(OSVersion);
@ -1052,7 +1052,7 @@ VOID LOADER_ENTRY::BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info
Stall(5000000);
}
VOID LOADER_ENTRY::EightApplePatch(UINT8 *Driver, UINT32 DriverSize)
void LOADER_ENTRY::EightApplePatch(UINT8 *Driver, UINT32 DriverSize)
{
// UINTN procLen = 0;
DBG("8 apple patch\n");
@ -1110,7 +1110,7 @@ VOID LOADER_ENTRY::EightApplePatch(UINT8 *Driver, UINT32 DriverSize)
// Generic kext patch functions
//
//
VOID LOADER_ENTRY::AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, size_t N)
void LOADER_ENTRY::AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, size_t N)
{
UINTN Num = 0;
@ -1216,7 +1216,7 @@ VOID LOADER_ENTRY::AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPli
// Called from SetFSInjection(), before boot.efi is started,
// to allow patchers to prepare FSInject to force load needed kexts.
//
VOID LOADER_ENTRY::KextPatcherRegisterKexts(void *FSInject_v, void *ForceLoadKexts)
void LOADER_ENTRY::KextPatcherRegisterKexts(void *FSInject_v, void *ForceLoadKexts)
{
FSINJECTION_PROTOCOL *FSInject = (FSINJECTION_PROTOCOL *)FSInject_v;
if (KernelAndKextPatches.KPATIConnectorsController.notEmpty()) {
@ -1233,7 +1233,7 @@ VOID LOADER_ENTRY::KextPatcherRegisterKexts(void *FSInject_v, void *ForceLoadKex
// PatchKext is called for every kext from prelinked kernel (kernelcache) or from DevTree (booting with drivers).
// Add kext detection code here and call kext specific patch function.
//
VOID LOADER_ENTRY::PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
void LOADER_ENTRY::PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize)
{
if (KernelAndKextPatches.KPATIConnectorsController.notEmpty()) {
//
@ -1488,7 +1488,7 @@ UINT64 GetPlistHexValue(CONST CHAR8 *Plist, CONST CHAR8 *Key, CONST CHAR8 *Whole
// ...
// </dict>
// ...
VOID LOADER_ENTRY::PatchPrelinkedKexts()
void LOADER_ENTRY::PatchPrelinkedKexts()
{
CHAR8 *WholePlist;
CHAR8 *DictPtr;
@ -1588,7 +1588,7 @@ VOID LOADER_ENTRY::PatchPrelinkedKexts()
// Iterates over kexts loaded by booter
// and calls PatchKext() for each.
//
VOID LOADER_ENTRY::PatchLoadedKexts()
void LOADER_ENTRY::PatchLoadedKexts()
{
DTEntry MMEntry;
_BooterKextFileInfo *KextFileInfo;
@ -1650,7 +1650,7 @@ VOID LOADER_ENTRY::PatchLoadedKexts()
// Will iterate through kext in prelinked kernel (kernelcache)
// or DevTree (drivers boot) and do patches.
//
VOID LOADER_ENTRY::KextPatcherStart()
void LOADER_ENTRY::KextPatcherStart()
{
// if (isKernelcache) {
DBG_RT("Patching kernelcache ...\n");

View File

@ -56,6 +56,8 @@
#include "../include/Pci.h"
#include "../include/Devices.h"
#include "../Platform/Settings.h"
#include "Self.h"
#include "SelfOem.h"
#ifndef DEBUG_NVIDIA
#ifndef DEBUG_ALL
@ -1663,7 +1665,7 @@ static nvidia_card_info_t nvidia_card_exceptions[] = {
{ 0x10DE124D, 0x146210CC, "MSi GeForce GT 635M" }
};
EFI_STATUS read_nVidia_PRAMIN(pci_dt_t *nvda_dev, VOID* rom, UINT16 arch)
EFI_STATUS read_nVidia_PRAMIN(pci_dt_t *nvda_dev, void* rom, UINT16 arch)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
@ -1673,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;
}
@ -1747,7 +1749,7 @@ EFI_STATUS read_nVidia_PRAMIN(pci_dt_t *nvda_dev, VOID* rom, UINT16 arch)
}
EFI_STATUS read_nVidia_PROM(pci_dt_t *nvda_dev, VOID* rom)
EFI_STATUS read_nVidia_PROM(pci_dt_t *nvda_dev, void* rom)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
@ -1757,7 +1759,7 @@ EFI_STATUS read_nVidia_PROM(pci_dt_t *nvda_dev, VOID* rom)
DBG("PROM\n");
Status = gBS->OpenProtocol(nvda_dev->DeviceHandle,
&gEfiPciIoProtocolGuid,
(VOID**)&PciIo,
(void**)&PciIo,
gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
@ -2190,7 +2192,6 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
//UINT32 subsystem;
INT32 nvPatch = 0;
CONST CHAR8 *model = NULL;
CHAR16 FileName[64];
UINT8 *buffer = NULL;
UINTN bufferLen = 0;
UINTN j, n_ports = 0;
@ -2259,34 +2260,29 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
if (load_vbios) {
snwprintf(FileName, 128, "ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
XStringW FileName = SWPrintf("ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
if (FileExists(OEMDir, FileName)) {
DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
Status = egLoadFile(OEMDir, FileName, &buffer, &bufferLen);
if (FileExists(&selfOem.getOemDir(), FileName)) {
DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
Status = egLoadFile(&selfOem.getOemDir(), FileName.wc_str(), &buffer, &bufferLen);
} else {
snwprintf(FileName, 128, "ROM\\10de_%04hX.rom", nvda_dev->device_id);
if (FileExists(OEMDir, FileName)) {
FileName.SWPrintf("ROM\\10de_%04hX.rom", nvda_dev->device_id);
if (FileExists(&selfOem.getOemDir(), FileName)) {
DBG("Found generic VBIOS ROM file (10de_%04hX.rom)\n", nvda_dev->device_id);
Status = egLoadFile(OEMDir, FileName, &buffer, &bufferLen);
Status = egLoadFile(&selfOem.getOemDir(), FileName.wc_str(), &buffer, &bufferLen);
}
}
snwprintf(FileName, 128, "\\EFI\\CLOVER\\ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
FileName.SWPrintf("ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
if (EFI_ERROR(Status)) {
if (FileExists(SelfRootDir, FileName)) {
DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
Status = egLoadFile(SelfRootDir, FileName, &buffer, &bufferLen);
if (FileExists(&self.getCloverDir(), FileName)) {
DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id);
Status = egLoadFile(&self.getCloverDir(), FileName.wc_str(), &buffer, &bufferLen);
} else {
snwprintf(FileName, 128, "\\EFI\\CLOVER\\ROM\\10de_%04hX.rom", nvda_dev->device_id);
if (FileExists(SelfRootDir, FileName)) {
DBG("Found generic VBIOS ROM file (10de_%04hX.rom)\n", nvda_dev->device_id);
Status = egLoadFile(SelfRootDir, FileName, &buffer, &bufferLen);
FileName.SWPrintf("ROM\\10de_%04hX.rom", nvda_dev->device_id);
if (FileExists(&self.getCloverDir(), FileName)) {
DBG("Found generic VBIOS ROM file (10de_%04hX.rom)\n", nvda_dev->device_id);
Status = egLoadFile(&self.getCloverDir(), FileName.wc_str(), &buffer, &bufferLen);
}
}
}

View File

@ -570,7 +570,7 @@ PLATFORMDATA ApplePlatformData[] =
0x01, 0x43, 0x0f, 0, 0, 0x04, "NA"_XS8, "NA"_XS8, 0x79001 }, // need rBR RPlt EPCI
};
VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
{
const CHAR8 *i;
@ -1361,7 +1361,7 @@ MACHINE_TYPES GetModelFromString(const XString8& ProductName)
return MaxMachineType;
}
VOID GetDefaultSettings()
void GetDefaultSettings()
{
MACHINE_TYPES Model;
//UINT64 msr = 0;

View File

@ -150,7 +150,7 @@ extern UINT64 gPlatformFeature;
VOID
void
SetDMISettingsForModel (
MACHINE_TYPES Model,
BOOLEAN Redefine
@ -160,8 +160,8 @@ MACHINE_TYPES GetModelFromString (
const XString8& ProductName
);
VOID
GetDefaultSettings(VOID);
void
GetDefaultSettings(void);
#endif /* PLATFORM_PLATFORMDATA_H_ */

View File

@ -63,7 +63,7 @@ constexpr LString8 unknown("unknown");
EFI_GUID gRemapEfiSmbiosTableGuid = REMAP_SMBIOS_TABLE_GUID;
//EFI_PHYSICAL_ADDRESS *smbiosTable;
VOID *Smbios; //pointer to SMBIOS data
void *Smbios; //pointer to SMBIOS data
SMBIOS_TABLE_ENTRY_POINT *EntryPoint; //SmbiosEps original
SMBIOS_TABLE_ENTRY_POINT *SmbiosEpsNew; //new SmbiosEps
//for patching
@ -176,20 +176,20 @@ BOOLEAN IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStruc
return (Checksum == 0);
}
VOID* FindOemSMBIOSPtr (VOID)
void* FindOemSMBIOSPtr (void)
{
UINTN Address;
// Search 0x0f0000 - 0x0fffff for SMBIOS Ptr
for (Address = 0xf0000; Address < 0xfffff; Address += 0x10) {
if (*(UINT32 *)(Address) == SMBIOS_PTR && IsEntryPointStructureValid((SMBIOS_TABLE_ENTRY_POINT*)Address)) {
return (VOID *)Address;
return (void *)Address;
}
}
return NULL;
}
VOID* GetSmbiosTablesFromHob (VOID)
void* GetSmbiosTablesFromHob (void)
{
EFI_PHYSICAL_ADDRESS *Table;
EFI_PEI_HOB_POINTERS GuidHob;
@ -198,28 +198,28 @@ VOID* GetSmbiosTablesFromHob (VOID)
if (GuidHob.Raw != NULL) {
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
if (Table != NULL) {
return (VOID *)(UINTN)*Table;
return (void *)(UINTN)*Table;
}
}
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) {
return (VOID *)(UINTN)*Table;
return (void *)(UINTN)*Table;
}
}
return NULL;
}
VOID* GetSmbiosTablesFromConfigTables (VOID)
void* GetSmbiosTablesFromConfigTables (void)
{
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS *Table;
Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **)&Table);
Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (void **)&Table);
if (EFI_ERROR(Status) || Table == NULL) {
Table = NULL;
Status = EfiGetSystemConfigurationTable (&gEfiSmbios3TableGuid, (VOID **)&Table);
Status = EfiGetSystemConfigurationTable (&gEfiSmbios3TableGuid, (void **)&Table);
if (EFI_ERROR(Status)) {
Table = NULL;
}
@ -388,7 +388,7 @@ CHAR8* GetSmbiosString (APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN, SMBIOS_TABL
return AString; //return pointer to Ascii string
}
VOID AddSmbiosEndOfTable()
void AddSmbiosEndOfTable()
{
SMBIOS_STRUCTURE* StructurePtr = (SMBIOS_STRUCTURE*)Current;
StructurePtr->Type = SMBIOS_TYPE_END_OF_TABLE;
@ -400,7 +400,7 @@ VOID AddSmbiosEndOfTable()
NumberOfRecords++;
}
VOID UniquifySmbiosTableStr (APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN, SMBIOS_TABLE_STRING* str_idx)
void UniquifySmbiosTableStr (APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN, SMBIOS_TABLE_STRING* str_idx)
{
INTN i, j;
SMBIOS_TABLE_STRING cmp_idx;
@ -425,7 +425,7 @@ VOID UniquifySmbiosTableStr (APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN, SMBIOS
}
/* Patching Functions */
VOID PatchTableType0()
void PatchTableType0()
{
// BIOS information
//
@ -435,8 +435,8 @@ VOID PatchTableType0()
return;
}
TableSize = SmbiosTableLength(SmbiosTable);
ZeroMem((VOID*)newSmbiosTable.Type0, MAX_TABLE_SIZE);
CopyMem((VOID*)newSmbiosTable.Type0, (VOID*)SmbiosTable.Type0, TableSize); //can't point to union
ZeroMem((void*)newSmbiosTable.Type0, MAX_TABLE_SIZE);
CopyMem((void*)newSmbiosTable.Type0, (void*)SmbiosTable.Type0, TableSize); //can't point to union
/* Real Mac
BIOS Information (Type 0)
Raw Data:
@ -484,7 +484,7 @@ VOID PatchTableType0()
Handle = LogSmbiosTable(newSmbiosTable);
}
VOID GetTableType1()
void GetTableType1()
{
CHAR8* s;
// System Information
@ -503,7 +503,7 @@ VOID GetTableType1()
}
VOID PatchTableType1()
void PatchTableType1()
{
// System Information
//
@ -516,8 +516,8 @@ VOID PatchTableType1()
Size = SmbiosTable.Type1->Hdr.Length; //old size
TableSize = SmbiosTableLength(SmbiosTable); //including strings
NewSize = 27; //sizeof(SMBIOS_TABLE_TYPE1);
ZeroMem((VOID*)newSmbiosTable.Type1, MAX_TABLE_SIZE);
CopyMem((VOID*)newSmbiosTable.Type1, (VOID*)SmbiosTable.Type1, Size); //copy main table
ZeroMem((void*)newSmbiosTable.Type1, MAX_TABLE_SIZE);
CopyMem((void*)newSmbiosTable.Type1, (void*)SmbiosTable.Type1, Size); //copy main table
CopyMem((CHAR8*)newSmbiosTable.Type1+NewSize, (CHAR8*)SmbiosTable.Type1+Size, TableSize - Size); //copy strings
newSmbiosTable.Type1->Hdr.Length = (UINT8)NewSize;
@ -529,7 +529,7 @@ VOID PatchTableType1()
EFI_GUID SmUUID;
StrToGuidLE(gSettings.SmUUID, &SmUUID);
if((SmUUID.Data3 & 0xF000) != 0) {
CopyMem((VOID*)&newSmbiosTable.Type1->Uuid, (VOID*)&SmUUID, sizeof(SmUUID));
CopyMem((void*)&newSmbiosTable.Type1->Uuid, (void*)&SmUUID, sizeof(SmUUID));
}
gSettings.ManufactureName.trim();
@ -561,7 +561,7 @@ VOID PatchTableType1()
return;
}
VOID GetTableType2()
void GetTableType2()
{
CHAR8* s;
// System Information
@ -578,12 +578,12 @@ VOID GetTableType2()
}
VOID PatchTableType2()
void PatchTableType2()
{
// BaseBoard Information
//
NewSize = 0x10; //sizeof(SMBIOS_TABLE_TYPE2);
ZeroMem((VOID*)newSmbiosTable.Type2, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type2, MAX_TABLE_SIZE);
SmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION, 0);
if (SmbiosTable.Raw == NULL) {
@ -597,17 +597,17 @@ VOID PatchTableType2()
TableSize = SmbiosTableLength(SmbiosTable); //including strings
if (NewSize > Size) {
CopyMem((VOID*)newSmbiosTable.Type2, (VOID*)SmbiosTable.Type2, Size); //copy main table
CopyMem((void*)newSmbiosTable.Type2, (void*)SmbiosTable.Type2, Size); //copy main table
CopyMem((CHAR8*)newSmbiosTable.Type2 + NewSize, (CHAR8*)SmbiosTable.Type2 + Size, TableSize - Size); //copy strings
} else {
CopyMem((VOID*)newSmbiosTable.Type2, (VOID*)SmbiosTable.Type2, TableSize); //copy full table
CopyMem((void*)newSmbiosTable.Type2, (void*)SmbiosTable.Type2, TableSize); //copy full table
}
}
newSmbiosTable.Type2->Hdr.Length = (UINT8)NewSize;
newSmbiosTable.Type2->ChassisHandle = mHandle3; //from GetTableType3
newSmbiosTable.Type2->BoardType = gSettings.BoardType;
ZeroMem((VOID*)&newSmbiosTable.Type2->FeatureFlag, sizeof(BASE_BOARD_FEATURE_FLAGS));
ZeroMem((void*)&newSmbiosTable.Type2->FeatureFlag, sizeof(BASE_BOARD_FEATURE_FLAGS));
newSmbiosTable.Type2->FeatureFlag.Motherboard = 1;
newSmbiosTable.Type2->FeatureFlag.Replaceable = 1;
if (gSettings.BoardType == 11) {
@ -652,7 +652,7 @@ VOID PatchTableType2()
return;
}
VOID GetTableType3()
void GetTableType3()
{
// System Chassis Information
//
@ -668,7 +668,7 @@ VOID GetTableType3()
return;
}
VOID PatchTableType3()
void PatchTableType3()
{
// System Chassis Information
//
@ -680,14 +680,14 @@ VOID PatchTableType3()
Size = SmbiosTable.Type3->Hdr.Length; //old size
TableSize = SmbiosTableLength(SmbiosTable); //including strings
NewSize = 0x15; //sizeof(SMBIOS_TABLE_TYPE3);
ZeroMem((VOID*)newSmbiosTable.Type3, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type3, MAX_TABLE_SIZE);
if (NewSize > Size) {
CopyMem((VOID*)newSmbiosTable.Type3, (VOID*)SmbiosTable.Type3, Size); //copy main table
CopyMem((void*)newSmbiosTable.Type3, (void*)SmbiosTable.Type3, Size); //copy main table
CopyMem((CHAR8*)newSmbiosTable.Type3 + NewSize, (CHAR8*)SmbiosTable.Type3 + Size, TableSize - Size); //copy strings
newSmbiosTable.Type3->Hdr.Length = (UINT8)NewSize;
} else {
CopyMem((VOID*)newSmbiosTable.Type3, (VOID*)SmbiosTable.Type3, TableSize); //copy full table
CopyMem((void*)newSmbiosTable.Type3, (void*)SmbiosTable.Type3, TableSize); //copy full table
}
newSmbiosTable.Type3->BootupState = ChassisStateSafe;
@ -727,7 +727,7 @@ VOID PatchTableType3()
return;
}
VOID GetTableType4()
void GetTableType4()
{
// Processor Information
//
@ -766,7 +766,7 @@ VOID GetTableType4()
return;
}
VOID PatchTableType4()
void PatchTableType4()
{
// Processor Information
//
@ -791,8 +791,8 @@ VOID PatchTableType4()
AddBrand = 48;
}
NewSize = sizeof(SMBIOS_TABLE_TYPE4);
ZeroMem((VOID*)newSmbiosTable.Type4, MAX_TABLE_SIZE);
CopyMem((VOID*)newSmbiosTable.Type4, (VOID*)SmbiosTable.Type4, Size); //copy main table
ZeroMem((void*)newSmbiosTable.Type4, MAX_TABLE_SIZE);
CopyMem((void*)newSmbiosTable.Type4, (void*)SmbiosTable.Type4, Size); //copy main table
CopyMem((CHAR8*)newSmbiosTable.Type4+NewSize, (CHAR8*)SmbiosTable.Type4+Size, TableSize - Size); //copy strings
newSmbiosTable.Type4->Hdr.Length = (UINT8)NewSize;
@ -915,7 +915,7 @@ VOID PatchTableType4()
newSmbiosTable.Type4->ProcessorId.Signature.ProcessorType = gCPUStructure.Type;
newSmbiosTable.Type4->ProcessorId.Signature.ProcessorXModel = gCPUStructure.Extmodel;
newSmbiosTable.Type4->ProcessorId.Signature.ProcessorXFamily = gCPUStructure.Extfamily;
// CopyMem((VOID*)&newSmbiosTable.Type4->ProcessorId.FeatureFlags, (VOID*)&gCPUStructure.Features, 4);
// CopyMem((void*)&newSmbiosTable.Type4->ProcessorId.FeatureFlags, (void*)&gCPUStructure.Features, 4);
// newSmbiosTable.Type4->ProcessorId.FeatureFlags = (PROCESSOR_FEATURE_FLAGS)(UINT32)gCPUStructure.Features;
if (Size <= 0x26) {
newSmbiosTable.Type4->ProcessorFamily2 = newSmbiosTable.Type4->ProcessorFamily;
@ -948,7 +948,7 @@ VOID PatchTableType4()
return;
}
VOID PatchTableType6()
void PatchTableType6()
{
UINT8 SizeField = 0;
//
@ -982,7 +982,7 @@ VOID PatchTableType6()
return;
}
VOID PatchTableType7()
void PatchTableType7()
{
// Cache Information
//
@ -1006,8 +1006,8 @@ VOID PatchTableType7()
break;
}
TableSize = SmbiosTableLength(SmbiosTable);
ZeroMem((VOID*)newSmbiosTable.Type7, MAX_TABLE_SIZE);
CopyMem((VOID*)newSmbiosTable.Type7, (VOID*)SmbiosTable.Type7, TableSize);
ZeroMem((void*)newSmbiosTable.Type7, MAX_TABLE_SIZE);
CopyMem((void*)newSmbiosTable.Type7, (void*)SmbiosTable.Type7, TableSize);
correctSD = (newSmbiosTable.Type7->SocketDesignation == 0);
CoreCache = newSmbiosTable.Type7->CacheConfiguration & 3;
Once = TRUE;
@ -1036,7 +1036,7 @@ VOID PatchTableType7()
return;
}
VOID PatchTableType9()
void PatchTableType9()
{
//
// System Slots (Type 9)
@ -1066,7 +1066,7 @@ VOID PatchTableType9()
for (Index = 0; Index < 15; Index++) {
if (SlotDevices[Index].Valid) {
INTN Dev, Func;
ZeroMem((VOID*)newSmbiosTable.Type9, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type9, MAX_TABLE_SIZE);
newSmbiosTable.Type9->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS;
newSmbiosTable.Type9->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE9);
newSmbiosTable.Type9->Hdr.Handle = (UINT16)(0x0900 + Index);
@ -1094,7 +1094,7 @@ VOID PatchTableType9()
return;
}
VOID PatchTableType11()
void PatchTableType11()
{
// CHAR8 *OEMString = "Apple inc. uses Clover"; //something else here?
// System Information
@ -1104,8 +1104,8 @@ VOID PatchTableType11()
MsgLog("Table 11 present, but rewritten for us\n");
}
// TableSize = SmbiosTableLength(SmbiosTable);
ZeroMem((VOID*)newSmbiosTable.Type11, MAX_TABLE_SIZE);
// CopyMem((VOID*)newSmbiosTable.Type11, (VOID*)SmbiosTable.Type11, 5); //minimum, other bytes = 0
ZeroMem((void*)newSmbiosTable.Type11, MAX_TABLE_SIZE);
// CopyMem((void*)newSmbiosTable.Type11, (void*)SmbiosTable.Type11, 5); //minimum, other bytes = 0
newSmbiosTable.Type11->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;
newSmbiosTable.Type11->Hdr.Length = 5;
newSmbiosTable.Type11->Hdr.Handle = 0x0B00; //common rule
@ -1134,7 +1134,7 @@ VOID PatchTableType11()
#define NUM_OTHER_TYPES 14
const UINT8 tableTypes[] = {8, 10, 13, 18, 21, 22, 27, 28, 32, 33, 41, 129, 217, 219};
VOID PatchTableTypeSome()
void PatchTableTypeSome()
{
for (UINTN IndexType = 0; IndexType < sizeof(tableTypes); IndexType++) {
for (Index = 0; Index < 32; Index++) {
@ -1148,7 +1148,7 @@ VOID PatchTableTypeSome()
return;
}
VOID GetTableType16()
void GetTableType16()
{
// Physical Memory Array
//
@ -1172,7 +1172,7 @@ VOID GetTableType16()
}
VOID PatchTableType16()
void PatchTableType16()
{
// Physical Memory Array
//
@ -1184,8 +1184,8 @@ VOID PatchTableType16()
return;
}
TableSize = SmbiosTableLength(SmbiosTable);
ZeroMem((VOID*)newSmbiosTable.Type16, MAX_TABLE_SIZE);
CopyMem((VOID*)newSmbiosTable.Type16, (VOID*)SmbiosTable.Type16, TableSize);
ZeroMem((void*)newSmbiosTable.Type16, MAX_TABLE_SIZE);
CopyMem((void*)newSmbiosTable.Type16, (void*)SmbiosTable.Type16, TableSize);
newSmbiosTable.Type16->Hdr.Handle = mHandle16;
// Slice - I am not sure if I want these values
// newSmbiosTable.Type16->Location = MemoryArrayLocationProprietaryAddonCard;
@ -1198,7 +1198,7 @@ VOID PatchTableType16()
LogSmbiosTable(newSmbiosTable);
}
VOID GetTableType17()
void GetTableType17()
{
// Memory Device
//
@ -1304,7 +1304,7 @@ VOID GetTableType17()
}
}
VOID PatchTableType17()
void PatchTableType17()
{
XString8 deviceLocator;
XString8 bankLocator;
@ -1358,7 +1358,7 @@ VOID PatchTableType17()
for (Index = 0; Index < gRAM.UserInUse; Index++) {
UINTN UserIndex = channelMap[Index];
UINT8 bank = (UINT8)(Index / gRAM.UserChannels);
ZeroMem((VOID*)newSmbiosTable.Type17, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type17, MAX_TABLE_SIZE);
newSmbiosTable.Type17->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_DEVICE;
newSmbiosTable.Type17->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE17);
newSmbiosTable.Type17->TotalWidth = 0xFFFF;
@ -1613,7 +1613,7 @@ VOID PatchTableType17()
DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo);
TableSize = SmbiosTableLength(SmbiosTable);
CopyMem((VOID*)newSmbiosTable.Type17, (VOID *)SmbiosTable.Type17, TableSize);
CopyMem((void*)newSmbiosTable.Type17, (void *)SmbiosTable.Type17, TableSize);
newSmbiosTable.Type17->AssetTag = 0;
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].Vendor, 64) > 0) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.SMBIOS[SMBIOSIndex].Vendor));
@ -1639,7 +1639,7 @@ VOID PatchTableType17()
DBG(" partNum unknown\n");
}
} else {
ZeroMem((VOID*)newSmbiosTable.Type17, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type17, MAX_TABLE_SIZE);
newSmbiosTable.Type17->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_DEVICE;
newSmbiosTable.Type17->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE17);
newSmbiosTable.Type17->TotalWidth = 0xFFFF;
@ -1751,7 +1751,7 @@ VOID PatchTableType17()
}
}
VOID
void
PatchTableType19 ()
{
//
@ -1789,7 +1789,7 @@ PatchTableType19 ()
TotalEnd = (UINT32)(LShiftU64(mTotalSystemMemory, 10) - 1);
}
gTotalMemory = LShiftU64(mTotalSystemMemory, 20);
ZeroMem((VOID*)newSmbiosTable.Type19, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type19, MAX_TABLE_SIZE);
newSmbiosTable.Type19->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS;
newSmbiosTable.Type19->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE19);
newSmbiosTable.Type19->Hdr.Handle = SomeHandle;
@ -1801,7 +1801,7 @@ PatchTableType19 ()
return ;
}
VOID PatchTableType20 ()
void PatchTableType20 ()
{
UINTN j = 0, k = 0, m = 0;
//
@ -1814,8 +1814,8 @@ VOID PatchTableType20 ()
return ;
}
TableSize = SmbiosTableLength(SmbiosTable);
ZeroMem((VOID*)newSmbiosTable.Type20, MAX_TABLE_SIZE);
CopyMem((VOID*)newSmbiosTable.Type20, (VOID*)SmbiosTable.Type20, TableSize);
ZeroMem((void*)newSmbiosTable.Type20, MAX_TABLE_SIZE);
CopyMem((void*)newSmbiosTable.Type20, (void*)SmbiosTable.Type20, TableSize);
for (j=0; j < TotalCount; j++) {
//EndingAddress in kb while mMemory in Mb
if ((UINT32)(mMemory17[j] << 10) > newSmbiosTable.Type20->EndingAddress) {
@ -1840,7 +1840,7 @@ VOID PatchTableType20 ()
return ;
}
VOID GetTableType32()
void GetTableType32()
{
SmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, 0);
if (SmbiosTable.Raw == NULL) {
@ -1853,7 +1853,7 @@ VOID GetTableType32()
* Apple Specific Structures.
* Firmware Table, FirmwareVolume (TYPE 128).
*/
VOID PatchTableType128()
void PatchTableType128()
{
/**
* Useful information.
@ -1871,7 +1871,7 @@ VOID PatchTableType128()
//SmbiosTable = GetSmbiosTableFromType (EntryPoint, 128, 0);
// initialise new table
ZeroMem((VOID*)newSmbiosTable.Type128, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type128, MAX_TABLE_SIZE);
// common rules
newSmbiosTable.Type128->Hdr.Type = 128;
@ -1904,7 +1904,7 @@ VOID PatchTableType128()
return ;
}
VOID PatchTableType130()
void PatchTableType130()
{
//
// MemorySPD (TYPE 130)
@ -1923,7 +1923,7 @@ VOID PatchTableType130()
VOID PatchTableType131()
void PatchTableType131()
{
// Get Table Type131
SmbiosTable = GetSmbiosTableFromType (EntryPoint, 131, 0);
@ -1932,7 +1932,7 @@ VOID PatchTableType131()
MsgLog("Change to: %hX\n", gSettings.CpuType);
}
ZeroMem((VOID*)newSmbiosTable.Type131, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type131, MAX_TABLE_SIZE);
newSmbiosTable.Type131->Hdr.Type = 131;
newSmbiosTable.Type131->Hdr.Length = sizeof(SMBIOS_STRUCTURE)+2;
newSmbiosTable.Type131->Hdr.Handle = 0x8300; //common rule
@ -1942,7 +1942,7 @@ VOID PatchTableType131()
return;
}
VOID PatchTableType132()
void PatchTableType132()
{
if (!gSettings.SetTable132) {
//DBG("disabled Table 132\n");
@ -1956,7 +1956,7 @@ VOID PatchTableType132()
MsgLog("Change to: %hX\n", gSettings.QPI);
}
ZeroMem((VOID*)newSmbiosTable.Type132, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type132, MAX_TABLE_SIZE);
newSmbiosTable.Type132->Hdr.Type = 132;
newSmbiosTable.Type132->Hdr.Length = sizeof(SMBIOS_STRUCTURE)+2;
newSmbiosTable.Type132->Hdr.Handle = 0x8400; //ugly
@ -1972,7 +1972,7 @@ VOID PatchTableType132()
return;
}
VOID PatchTableType133()
void PatchTableType133()
{
if (gPlatformFeature == 0xFFFF) {
return;
@ -1983,12 +1983,12 @@ VOID PatchTableType133()
MsgLog("Table 133 is present, PlatformFeature=%llX\n", SmbiosTable.Type133->PlatformFeature);
MsgLog("Change to: %llX\n", gPlatformFeature);
}
ZeroMem((VOID*)newSmbiosTable.Type133, MAX_TABLE_SIZE);
ZeroMem((void*)newSmbiosTable.Type133, MAX_TABLE_SIZE);
newSmbiosTable.Type133->Hdr.Type = 133;
newSmbiosTable.Type133->Hdr.Length = sizeof(SMBIOS_STRUCTURE)+8;
newSmbiosTable.Type133->Hdr.Handle = 0x8500; //ugly
// newSmbiosTable.Type133->PlatformFeature = gPlatformFeature;
CopyMem((VOID*)&newSmbiosTable.Type133->PlatformFeature, (VOID*)&gPlatformFeature, 8);
CopyMem((void*)&newSmbiosTable.Type133->PlatformFeature, (void*)&gPlatformFeature, 8);
Handle = LogSmbiosTable(newSmbiosTable);
return;
}
@ -2023,7 +2023,7 @@ EFI_STATUS PrepatchSmbios()
//original EPS and tables
EntryPoint = (SMBIOS_TABLE_ENTRY_POINT*)Smbios; //yes, it is old SmbiosEPS
// Smbios = (VOID*)(UINT32)EntryPoint->TableAddress; // here is flat Smbios database. Work with it
// Smbios = (void*)(UINT32)EntryPoint->TableAddress; // here is flat Smbios database. Work with it
//how many we need to add for tables 128, 130, 131, 132 and for strings?
BufferLen = 0x20 + EntryPoint->TableLength + 64 * 10;
//new place for EPS and tables. Allocated once for both
@ -2049,10 +2049,10 @@ EFI_STATUS PrepatchSmbios()
NumberOfRecords = 0;
MaxStructureSize = 0;
//preliminary fill EntryPoint with some data
CopyMem((VOID *)SmbiosEpsNew, (VOID *)EntryPoint, sizeof(SMBIOS_TABLE_ENTRY_POINT));
CopyMem((void *)SmbiosEpsNew, (void *)EntryPoint, sizeof(SMBIOS_TABLE_ENTRY_POINT));
Smbios = (VOID*)(SmbiosEpsNew + 1); //this is a C-language trick. I hate it but use. +1 means +sizeof(SMBIOS_TABLE_ENTRY_POINT)
Smbios = (void*)(SmbiosEpsNew + 1); //this is a C-language trick. I hate it but use. +1 means +sizeof(SMBIOS_TABLE_ENTRY_POINT)
Current = (UINT8*)Smbios; //begin fill tables from here
SmbiosEpsNew->TableAddress = (UINT32)(UINTN)Current;
SmbiosEpsNew->EntryPointLength = sizeof(SMBIOS_TABLE_ENTRY_POINT); // no matter on other versions
@ -2085,7 +2085,7 @@ EFI_STATUS PrepatchSmbios()
return Status;
}
VOID PatchSmbios(VOID) //continue
void PatchSmbios(void) //continue
{
DbgHeader("PatchSmbios");
@ -2117,13 +2117,13 @@ VOID PatchSmbios(VOID) //continue
if(MaxStructureSize > MAX_TABLE_SIZE){
// DBG("Too long SMBIOS!\n");
}
FreePool((VOID*)newSmbiosTable.Raw);
FreePool((void*)newSmbiosTable.Raw);
// there is no need to keep all tables in numeric order. It is not needed
// neither by specs nor by AppleSmbios.kext
}
VOID FinalizeSmbios() //continue
void FinalizeSmbios() //continue
{
EFI_PEI_HOB_POINTERS GuidHob;
EFI_PEI_HOB_POINTERS HobStart;
@ -2175,7 +2175,7 @@ VOID FinalizeSmbios() //continue
// syscl: remap smbios table 1 guid
//
DBG("Remap smbios table type 1 guid.\n");
gBS->InstallConfigurationTable (&gRemapEfiSmbiosTableGuid, (VOID*)SmbiosEpsNew);
gBS->InstallConfigurationTable (&gRemapEfiSmbiosTableGuid, (void*)SmbiosEpsNew);
}
else
{
@ -2183,7 +2183,7 @@ VOID FinalizeSmbios() //continue
// use origin smbios guid table
//
DBG("Use origin smbios table type 1 guid.\n");
gBS->InstallConfigurationTable (&gEfiSmbiosTableGuid, (VOID*)SmbiosEpsNew);
gBS->InstallConfigurationTable (&gEfiSmbiosTableGuid, (void*)SmbiosEpsNew);
}
gST->Hdr.CRC32 = 0;
@ -2202,7 +2202,7 @@ VOID FinalizeSmbios() //continue
//PauseForKey(L"installing SMBIOS in Hob\n");
*Table = (UINT32)(UINTN)SmbiosEpsNew;
}
// egSaveFile(NULL, L"EFI\\CLOVER\\misc\\smbios.bin", (UINT8*)(UINTN)SmbiosEpsNew, SmbiosEpsNew->TableLength);
// egSaveFile(NULL, SWPrintf("%ls\\misc\\smbios.bin", self.getCloverDirPathAsXStringW().wc_str()).wc_str(), (UINT8*)(UINTN)SmbiosEpsNew, SmbiosEpsNew->TableLength);
return;
}

View File

@ -63,13 +63,13 @@ iStrLen(
);
EFI_STATUS
PrepatchSmbios (VOID);
PrepatchSmbios (void);
VOID
PatchSmbios (VOID);
void
PatchSmbios (void);
VOID
FinalizeSmbios (VOID);
void
FinalizeSmbios (void);

View File

@ -305,7 +305,7 @@ UINT8 smb_read_byte(UINT32 base, UINT8 adr, UINT16 cmd)
/** Read from spd *used* values only*/
VOID init_spd(UINT16* spd_indexes, UINT8* spd, UINT32 base, UINT8 slot)
void init_spd(UINT16* spd_indexes, UINT8* spd, UINT32 base, UINT8 slot)
{
UINT16 i;
for (i=0; spd_indexes[i]; i++) {
@ -589,7 +589,7 @@ CHAR8* getDDRPartNum(UINT8* spd, UINT32 base, UINT8 slot)
#define PCI_COMMAND_OFFSET 0x04
/** Read from smbus the SPD content and interpret it for detecting memory attributes */
STATIC VOID read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
STATIC void read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
{
// EFI_STATUS Status;
UINT16 speed;
@ -859,7 +859,7 @@ STATIC VOID read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
}
}
VOID ScanSPD()
void ScanSPD()
{
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer = NULL;
@ -884,7 +884,7 @@ VOID ScanSPD()
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < HandleCount; ++Index) {
Status = gBS->HandleProtocol(HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);
Status = gBS->HandleProtocol(HandleBuffer[Index], &gEfiPciIoProtocolGuid, (void **)&PciIo);
if (!EFI_ERROR(Status)) {
// Read PCI BUS
//PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
@ -921,7 +921,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

@ -177,7 +177,7 @@ Byte Number Function Described Notes
*/
VOID
ScanSPD (VOID);
void
ScanSPD (void);
#endif /* !__LIBSAIO_SPD_H */

View File

@ -28,7 +28,7 @@
#define OHCI_INTRSTATUS 0x0c
EFI_STATUS
FixOwnership(VOID)
FixOwnership(void)
/*++
Routine Description:
@ -80,7 +80,7 @@ FixOwnership(VOID)
Status = gBS->HandleProtocol (
HandleArray[Index],
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo
(void **)&PciIo
);
if (!EFI_ERROR(Status)) {
//
@ -301,7 +301,7 @@ FixOwnership(VOID)
if (!(Value & (0x1 << 16)))
break;
Value |= (0x1 << 24);
(VOID) PciIo->Mem.Write(PciIo, EfiPciIoWidthUint32, 0 /* BAR0 */, (UINT64) ExtendCap, 1, &Value);
(void) PciIo->Mem.Write(PciIo, EfiPciIoWidthUint32, 0 /* BAR0 */, (UINT64) ExtendCap, 1, &Value);
TimeOut = 40;
while (TimeOut--) {
gBS->Stall(500);
@ -317,7 +317,7 @@ FixOwnership(VOID)
break;
Value &= 0x1F1FEE;
Value |= 0xE0000000;
(VOID) PciIo->Mem.Write(PciIo, EfiPciIoWidthUint32, 0 /* BAR0 */, (UINT64) ExtendCap + 4, 1, &Value);
(void) PciIo->Mem.Write(PciIo, EfiPciIoWidthUint32, 0 /* BAR0 */, (UINT64) ExtendCap + 4, 1, &Value);
//
// Clear all ownership
//
@ -325,7 +325,7 @@ FixOwnership(VOID)
if (EFI_ERROR(Status))
break;
Value &= ~((0x1 << 24) | (0x1 << 16));
(VOID) PciIo->Mem.Write(PciIo, EfiPciIoWidthUint32, 0 /* BAR0 */, (UINT64) ExtendCap, 1, &Value);
(void) PciIo->Mem.Write(PciIo, EfiPciIoWidthUint32, 0 /* BAR0 */, (UINT64) ExtendCap, 1, &Value);
break;
} //Value & FF
if (!(Value & 0xFF00))

View File

@ -11,7 +11,7 @@
EFI_STATUS
FixOwnership (VOID);
FixOwnership (void);

View File

@ -176,6 +176,10 @@ size_t XStringAbstract__indexOf(const O* s, size_t Pos, const P* other, bool toL
return XStringAbstract__indexOf(&s, other, Pos, toLower);
}
/*
* Find the last occurence of other, until pos
* NOTE : do not pass SIZE_T_MAX as pos. maximum value is SIZE_T_MAX-1
*/
template<typename O, typename P>
size_t XStringAbstract__rindexOf(const O* s, size_t Pos, const P* other, bool toLower)
{
@ -379,6 +383,11 @@ public:
return ret;
}
template<typename O, enable_if(is_char(O))>
bool startWith(O otherChar) const {
O other[2] = { otherChar, 0};
return XStringAbstract__startWith(m_data, other, false);
}
template<typename O, class OtherXStringClass>
bool startWith(const __String<O, OtherXStringClass>& otherS) const { return XStringAbstract__startWith(m_data, otherS.m_data, false); }
template<typename O>

View File

@ -30,7 +30,7 @@ typedef ctor* ctor_ptr;
void construct_globals_objects(EFI_HANDLE ImageHandle)
{
EFI_LOADED_IMAGE* LoadedImage;
EFI_STATUS Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
EFI_STATUS Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (void **) &LoadedImage);
if ( EFI_ERROR(Status) ) {
panic("construct_globals_objects: Cannot get LoadedImage protocol");
}
@ -58,12 +58,14 @@ void construct_globals_objects(EFI_HANDLE ImageHandle)
ctor_ptr* currentCtor = (ctor_ptr*) (((UINTN) (LoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
ctor_ptr* ctorend = (ctor_ptr*) (((UINTN) (LoadedImage->ImageBase)) + SectionHeader->PointerToRawData + SectionHeader->Misc.VirtualSize);
size_t i = 0;
while (currentCtor < ctorend)
{
DBG("&currentCtor %X %d\n", (UINTN) (currentCtor), (UINTN) (currentCtor));
DBG("currentCtor %X %d\n", (UINTN) (*currentCtor), (UINTN) (*currentCtor));
DBG("&currentCtor[%zu] %llX %lld\n", i, (UINTN) (currentCtor), (UINTN) (currentCtor));
DBG("currentCtor[%zu] %llX %lld\n", i, (UINTN) (*currentCtor), (UINTN) (*currentCtor));
if (*currentCtor != NULL) (*currentCtor)();
currentCtor++;
i++;
}
}
}
@ -82,9 +84,9 @@ ctor_ptr* pend = (ctor_ptr*)&__end_of_section_ctors;
void construct_globals_objects(EFI_HANDLE ImageHandle)
{
(void)ImageHandle;
DBG("CTOR %X %d\n", (UINTN)p, (UINTN)p);
DBG("CTOR %llX %lld\n", (UINTN)p, (UINTN)p);
while ( p < pend ) {
DBG("CTOR %X %d\n", (UINTN)p[0], (UINTN)p[0]);
DBG("CTOR %llX %lld\n", (UINTN)p[0], (UINTN)p[0]);
(*p)();
p++;
}

View File

@ -257,7 +257,7 @@ CONST CHAR16 *StriStr(IN CONST CHAR16 *Str,
return NULL;
}
VOID StrToLower(IN CHAR16 *Str)
void StrToLower(IN CHAR16 *Str)
{
while (*Str) {
*Str = TO_LOWER(*Str);
@ -324,7 +324,7 @@ extern REFIT_MENU_ITEM_RETURN MenuEntryReturn;
// it is not good to use Options menu style for messages and one line dialogs
// it can be a semitransparent rectangular at the screen centre as it was in Clover v1.0
STATIC REFIT_MENU_SCREEN AlertMessageMenu(0, XStringW(), XStringW(), &MenuEntryReturn, NULL);
VOID AlertMessage(IN XStringW& Title, IN CONST XStringW& Message)
void AlertMessage(IN XStringW& Title, IN CONST XStringW& Message)
{
CreateInfoLines(Message, &AlertMessageMenu.InfoLines);
AlertMessageMenu.Title = Title;
@ -363,7 +363,7 @@ BOOLEAN YesNoMessage(IN XStringW& Title, IN CONST XStringW& Message)
}
// Ask user for file path from directory menu
BOOLEAN AskUserForFilePathFromDir(IN CHAR16 *Title OPTIONAL, IN REFIT_VOLUME *Volume,
IN CHAR16 *ParentPath OPTIONAL, IN EFI_FILE *Dir,
IN CHAR16 *ParentPath OPTIONAL, const EFI_FILE *Dir,
OUT EFI_DEVICE_PATH_PROTOCOL **Result)
{
//REFIT_MENU_SCREEN Menu = { 0, L"Please Select File...", NULL, 0, NULL, 0, NULL,

View File

@ -26,12 +26,12 @@ CONST CHAR16
IN CONST CHAR16 *SearchFor
);
VOID
void
StrToLower (
IN CHAR16 *Str
);
VOID
void
AlertMessage (
IN CONST CHAR16 *Title,
IN CONST CHAR16 *Message

View File

@ -52,7 +52,7 @@ const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const
// Ask user for file path from directory menu
BOOLEAN AskUserForFilePathFromDir(IN CHAR16 *Title OPTIONAL, IN REFIT_VOLUME *Volume,
IN CHAR16 *ParentPath, IN EFI_FILE *Dir,
IN CHAR16 *ParentPath, const EFI_FILE *Dir,
OUT EFI_DEVICE_PATH_PROTOCOL **Result);
// Ask user for file path from volumes menu
BOOLEAN AskUserForFilePathFromVolumes(IN CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result);
@ -60,22 +60,22 @@ BOOLEAN AskUserForFilePathFromVolumes(IN CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_
BOOLEAN AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *Root OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result);
// legacy
VOID ScanLegacy(VOID);
VOID AddCustomLegacy(VOID);
void ScanLegacy(void);
void AddCustomLegacy(void);
// loader
VOID ScanLoader(VOID);
VOID AddCustomEntries(VOID);
void ScanLoader(void);
void AddCustomEntries(void);
BOOLEAN IsCustomBootEntry(IN LOADER_ENTRY *Entry);
// tool
VOID ScanTool(VOID);
VOID AddCustomTool(VOID);
void ScanTool(void);
void AddCustomTool(void);
// locked graphics
CONST CHAR8 *CustomBootModeToStr(IN UINT8 Mode);
EFI_STATUS LockBootScreen(VOID);
EFI_STATUS UnlockBootScreen(VOID);
EFI_STATUS LockBootScreen(void);
EFI_STATUS UnlockBootScreen(void);
// secure boot
#ifdef ENABLE_SECURE_BOOT
@ -96,56 +96,56 @@ EFI_STATUS UnlockBootScreen(VOID);
#define DEFAULT_UNAUTHORIZED_DATABASE_NAME L"dbxDefault"
#define DEFAULT_UNAUTHORIZED_DATABASE_GUID gEfiGlobalVariableGuid
VOID AddSecureBootTool(VOID);
VOID InitializeSecureBoot(VOID);
EFI_STATUS InstallSecureBoot(VOID);
VOID UninstallSecureBoot(VOID);
VOID EnableSecureBoot(VOID);
VOID DisableSecureBoot(VOID);
BOOLEAN ConfigureSecureBoot(VOID);
void AddSecureBootTool(void);
void InitializeSecureBoot(void);
EFI_STATUS InstallSecureBoot(void);
void UninstallSecureBoot(void);
void EnableSecureBoot(void);
void DisableSecureBoot(void);
BOOLEAN ConfigureSecureBoot(void);
CONST CHAR16 *SecureBootPolicyToStr(IN UINTN Policy);
EFI_STATUS VerifySecureBootImage(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath);
UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath);
EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
EFI_STATUS EnrollSecureBootKeys(IN void *AuthorizedDatabase,
IN UINTN AuthorizedDatabaseSize,
IN BOOLEAN WantDefaultKeys);
EFI_STATUS ClearSecureBootKeys(VOID);
EFI_STATUS ClearSecureBootKeys(void);
// secure boot database
VOID *GetSignatureDatabase(IN CHAR16 *DatabaseName,
void *GetSignatureDatabase(IN CHAR16 *DatabaseName,
IN EFI_GUID *DatabaseGuid,
OUT UINTN *DatabaseSize);
EFI_STATUS SetSignatureDatabase(IN CHAR16 *DatabaseName,
IN EFI_GUID *DatabaseGuid,
IN VOID *Database,
IN void *Database,
IN UINTN DatabaseSize);
// secure boot authorized database
VOID *GetAuthorizedDatabase(UINTN *DatabaseSize);
EFI_STATUS SetAuthorizedDatabase(IN VOID *Database,
void *GetAuthorizedDatabase(UINTN *DatabaseSize);
EFI_STATUS SetAuthorizedDatabase(IN void *Database,
IN UINTN DatabaseSize);
EFI_STATUS ClearAuthorizedDatabase(VOID);
VOID *GetImageSignatureDatabase(IN VOID *FileBuffer,
EFI_STATUS ClearAuthorizedDatabase(void);
void *GetImageSignatureDatabase(IN void *FileBuffer,
IN UINT64 FileSize,
IN UINTN *DatabaseSize,
IN BOOLEAN HashIfNoDatabase);
EFI_STATUS AppendImageDatabaseToAuthorizedDatabase(IN VOID *Database,
EFI_STATUS AppendImageDatabaseToAuthorizedDatabase(IN void *Database,
IN UINTN DatabaseSize);
EFI_STATUS RemoveImageDatabaseFromAuthorizedDatabase(IN VOID *Database,
EFI_STATUS RemoveImageDatabaseFromAuthorizedDatabase(IN void *Database,
IN UINTN DatabaseSize);
EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *FileBuffer,
IN void *FileBuffer,
IN UINTN FileSize);
EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *FileBuffer,
IN void *FileBuffer,
IN UINTN FileSize);
EFI_STATUS AppendSignatureDatabaseToDatabase(IN OUT VOID **Database,
EFI_STATUS AppendSignatureDatabaseToDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN VOID *SignatureDatabase,
IN void *SignatureDatabase,
IN UINTN SignatureDatabaseSize);
EFI_STATUS AppendSignatureToDatabase(IN OUT VOID **Database,
EFI_STATUS AppendSignatureToDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN EFI_GUID *SignatureType,
IN VOID *Signature,
IN void *Signature,
IN UINTN SignatureSize);
#endif //ENABLE_SECURE_BOOT

View File

@ -188,7 +188,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi
return true;
}
VOID ScanLegacy(VOID)
void ScanLegacy(void)
{
UINTN VolumeIndex, VolumeIndex2;
BOOLEAN ShowVolume, HideIfOthersFound;
@ -270,7 +270,7 @@ VOID ScanLegacy(VOID)
}
// Add custom legacy
VOID AddCustomLegacy(VOID)
void AddCustomLegacy(void)
{
UINTN VolumeIndex, VolumeIndex2;
BOOLEAN ShowVolume, HideIfOthersFound;
@ -373,13 +373,13 @@ VOID AddCustomLegacy(VOID)
// Change to custom image if needed
MainIcon = Custom->Image;
if (MainIcon.Image.isEmpty()) {
MainIcon.Image.LoadXImage(ThemeX.ThemeDir, Custom->ImagePath);
MainIcon.Image.LoadXImage(&ThemeX.getThemeDir(), Custom->ImagePath);
}
// Change to custom drive image if needed
DriveIcon = Custom->DriveImage;
if (DriveIcon.Image.isEmpty()) {
DriveIcon.Image.LoadXImage(ThemeX.ThemeDir, Custom->DriveImagePath);
DriveIcon.Image.LoadXImage(&ThemeX.getThemeDir(), Custom->DriveImagePath);
}
// Create a legacy entry for this volume
if (AddLegacyEntry(Custom->FullTitle, Custom->Title, Volume, &MainIcon, &DriveIcon, Custom->Hotkey, TRUE))

View File

@ -46,6 +46,7 @@
#include "../Platform/guid.h"
#include "../refit/lib.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#include "Self.h"
#ifndef DEBUG_ALL
#define DEBUG_SCAN_LOADER 1
@ -299,7 +300,7 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path)
static const XStringW linux = L"linux"_XSW;
STATIC CONST XStringW& LinuxIconNameFromPath(IN CONST XStringW& Path,
IN EFI_FILE_PROTOCOL *RootDir)
const EFI_FILE_PROTOCOL *RootDir)
{
UINTN Index;
#if defined(ANDX86)
@ -350,7 +351,7 @@ STATIC CONST XString8 LinuxInitImagePath[] = {
};
STATIC CONST UINTN LinuxInitImagePathCount = (sizeof(LinuxInitImagePath) / sizeof(LinuxInitImagePath[0]));
STATIC XString8Array LinuxKernelOptions(IN EFI_FILE_PROTOCOL *Dir,
STATIC XString8Array LinuxKernelOptions(const EFI_FILE_PROTOCOL *Dir,
IN CONST CHAR16 *Version,
IN CONST CHAR16 *PartUUID,
IN CONST XString8Array& Options OPTIONAL)
@ -410,7 +411,7 @@ STATIC EFI_STATUS GetOSXVolumeName(LOADER_ENTRY *Entry)
// CHAR16 *tmpName;
//Create null terminated string
// targetString = (CHAR8*) A_llocateZeroPool(fileLen+1);
// CopyMem( (VOID*)targetString, (VOID*)fileBuffer, fileLen);
// CopyMem( (void*)targetString, (void*)fileBuffer, fileLen);
// DBG("found disk_label with contents:%s\n", targetString);
// NOTE: Sothor - This was never run. If we need this correct it and uncomment it.
@ -479,13 +480,10 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
}
// Ignore this loader if it's self path
FilePathAsString = FileDevicePathToXStringW(SelfFullDevicePath);
if (FilePathAsString.notEmpty()) {
INTN Comparison = StriCmp(FilePathAsString.wc_str(), LoaderDevicePathString.wc_str());
if (Comparison == 0) {
DBG("%s skipped because path `%ls` is self path!\n", indent, LoaderDevicePathString.wc_str());
return NULL;
}
XStringW selfDevicePathAsXStringW = FileDevicePathToXStringW(&self.getSelfDevicePath());
if ( selfDevicePathAsXStringW == LoaderDevicePathString ) {
DBG("%s skipped because path `%ls` is self path!\n", indent, LoaderDevicePathString.wc_str());
return NULL;
}
// DBG("OSType =%d\n", OSType);
// DBG("prepare the menu entry\n");
@ -1057,7 +1055,7 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Arr
return NULL;
}
STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStringW *CustomPath, XIcon *CustomImage)
STATIC void LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStringW *CustomPath, XIcon *CustomImage)
{
// When used for Regular Entries, all found entries will be added by AddLoaderEntry()
// When used for Custom Entries (detected by CustomPath!=NULL), CustomPath+CustomImage will be set to the first entry found and execution will stop
@ -1098,7 +1096,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
XIcon ImageX = ThemeX.GetIcon(L"os_"_XSW + OSName); //will the image be destroyed or rewritten by next image after the cycle end?
if (ImageX.isEmpty()) {
// no preloaded icon, try to load from dir
ImageX.LoadXImage(ThemeX.ThemeDir, L"os_"_XSW + OSName);
ImageX.LoadXImage(&ThemeX.getThemeDir(), L"os_"_XSW + OSName);
}
if (CustomPath) {
*CustomPath = File;
@ -1121,7 +1119,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
OSIconName = OSIconName.subString(0, OSIconName.indexOf(','));
XIcon ImageX = ThemeX.GetIcon(L"os_"_XSW + OSIconName);
if (ImageX.isEmpty()) {
ImageX.LoadXImage(ThemeX.ThemeDir, L"os_"_XSW + OSIconName);
ImageX.LoadXImage(&ThemeX.getThemeDir(), L"os_"_XSW + OSIconName);
}
if (CustomPath) {
*CustomPath = LinuxEntryData[Index].Path;
@ -1290,7 +1288,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
#define Rock 2
#define Scissor 4
VOID AddPRSEntry(REFIT_VOLUME *Volume)
void AddPRSEntry(REFIT_VOLUME *Volume)
{
INTN WhatBoot = 0;
//CONST INTN Paper = 1;
@ -1323,7 +1321,7 @@ VOID AddPRSEntry(REFIT_VOLUME *Volume)
#undef Rock
#undef Scissor
VOID ScanLoader(VOID)
void ScanLoader(void)
{
//DBG("Scanning loaders...\n");
DbgHeader("ScanLoader");
@ -1453,7 +1451,7 @@ VOID ScanLoader(VOID)
if (aFound && (aFound == aIndex)) {
XIcon ImageX;
XStringW IconXSW = XStringW().takeValueFrom(AndroidEntryData[Index].Icon);
ImageX.LoadXImage(ThemeX.ThemeDir, (L"os_"_XSW + IconXSW.subString(0, IconXSW.indexOf(','))).wc_str());
ImageX.LoadXImage(&ThemeX.getThemeDir(), (L"os_"_XSW + IconXSW.subString(0, IconXSW.indexOf(','))).wc_str());
AddLoaderEntry(AndroidEntryData[Index].Path, NullXString8Array, L""_XSW, XStringW().takeValueFrom(AndroidEntryData[Index].Title), Volume, L""_XSW,
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LIN, OSFLAG_NODEFAULTARGS);
}
@ -1555,7 +1553,7 @@ VOID ScanLoader(VOID)
}
STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
STATIC void AddCustomEntry(IN UINTN CustomIndex,
IN XStringW CustomPath,
IN CUSTOM_LOADER_ENTRY *Custom,
IN REFIT_MENU_SCREEN *SubMenu)
@ -1704,13 +1702,13 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
// Change to custom image if needed
if (Image.isEmpty() && Custom->ImagePath.notEmpty()) {
Image.LoadXImage(ThemeX.ThemeDir, Custom->ImagePath);
Image.LoadXImage(&ThemeX.getThemeDir(), Custom->ImagePath);
if (Image.isEmpty()) {
Image.LoadXImage(ThemeX.ThemeDir, L"os_"_XSW + Custom->ImagePath);
Image.LoadXImage(&ThemeX.getThemeDir(), L"os_"_XSW + Custom->ImagePath);
if (Image.isEmpty()) {
Image.LoadXImage(SelfDir, Custom->ImagePath);
Image.LoadXImage(&self.getCloverDir(), Custom->ImagePath);
if (Image.isEmpty()) {
Image.LoadXImage(SelfRootDir, Custom->ImagePath);
Image.LoadXImage(&self.getSelfVolumeRootDir(), Custom->ImagePath);
if (Image.isEmpty()) {
Image.LoadXImage(Volume->RootDir, Custom->ImagePath);
}
@ -1721,11 +1719,11 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
// Change to custom drive image if needed
if (DriveImage.isEmpty() && Custom->DriveImagePath.notEmpty()) {
DriveImage.LoadXImage(ThemeX.ThemeDir, Custom->DriveImagePath);
DriveImage.LoadXImage(&ThemeX.getThemeDir(), Custom->DriveImagePath);
if (DriveImage.isEmpty()) {
DriveImage.LoadXImage(SelfDir, Custom->ImagePath);
DriveImage.LoadXImage(&self.getCloverDir(), Custom->ImagePath);
if (DriveImage.isEmpty()) {
DriveImage.LoadXImage(SelfRootDir, Custom->ImagePath);
DriveImage.LoadXImage(&self.getSelfVolumeRootDir(), Custom->ImagePath);
if (DriveImage.isEmpty()) {
DriveImage.LoadXImage(Volume->RootDir, Custom->ImagePath);
}
@ -1916,7 +1914,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
}
// Add custom entries
VOID AddCustomEntries(VOID)
void AddCustomEntries(void)
{
CUSTOM_LOADER_ENTRY *Custom;
UINTN i = 0;

View File

@ -28,7 +28,7 @@ UINT8 GetOSTypeFromPath(IN CONST XStringW& Path);
#ifdef DUMP_KERNEL_KEXT_PATCHES
// Utils functions
VOID DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches);
void DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches);
#endif

View File

@ -34,6 +34,7 @@
#include <Platform.h>
#include "entry_scan.h"
#include "Self.h"
#ifndef DEBUG_ALL
#define DEBUG_LOCK_BOOT_SCREEN 1
@ -343,7 +344,7 @@ static EFI_STATUS AddLockedGraphicsUGA(IN EFI_HANDLE Handle, IN EFI_HANDLE Agent
return EFI_SUCCESS;
}
static EFI_STATUS EFIAPI LockedOpenProtocol(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT VOID **Interface OPTIONAL, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes)
static EFI_STATUS EFIAPI LockedOpenProtocol(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT void **Interface OPTIONAL, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes)
{
if ((Attributes & EFI_OPEN_PROTOCOL_GET_PROTOCOL) != 0) {
if ((Protocol == NULL) || (Interface == NULL)) {
@ -352,7 +353,7 @@ static EFI_STATUS EFIAPI LockedOpenProtocol(IN EFI_HANDLE Handle, IN EFI_GUID *P
if (CompareMem(Protocol, &gEfiGraphicsOutputProtocolGuid, sizeof(EFI_GUID)) == 0) {
EFI_GRAPHICS_OUTPUT_PROTOCOL *GOPInterface = NULL;
// Open the actual protocol
EFI_STATUS Status = OldBootServices.OpenProtocol(Handle, Protocol, (VOID **)&GOPInterface, AgentHandle, ControllerHandle, Attributes);
EFI_STATUS Status = OldBootServices.OpenProtocol(Handle, Protocol, (void **)&GOPInterface, AgentHandle, ControllerHandle, Attributes);
if (EFI_ERROR(Status)) {
return Status;
}
@ -369,7 +370,7 @@ static EFI_STATUS EFIAPI LockedOpenProtocol(IN EFI_HANDLE Handle, IN EFI_GUID *P
} else if (CompareMem(Protocol, &gEfiUgaDrawProtocolGuid, sizeof(EFI_GUID)) == 0) {
EFI_UGA_DRAW_PROTOCOL *UGAInterface = NULL;
// Open the actual protocol
EFI_STATUS Status = OldBootServices.OpenProtocol(Handle, Protocol, (VOID **)&UGAInterface, AgentHandle, ControllerHandle, Attributes);
EFI_STATUS Status = OldBootServices.OpenProtocol(Handle, Protocol, (void **)&UGAInterface, AgentHandle, ControllerHandle, Attributes);
if (EFI_ERROR(Status)) {
return Status;
}
@ -412,10 +413,10 @@ static EFI_STATUS EFIAPI LockedCloseProtocol(IN EFI_HANDLE Handle, IN EFI_GUID *
}
// Lock the graphics GOP
static EFI_STATUS LockGraphicsGOP(VOID)
static EFI_STATUS LockGraphicsGOP(void)
{
EFI_HANDLE *Buffer;
VOID *Interface;
void *Interface;
UINTN i, Size = 0;
// Get needed buffer size
EFI_STATUS Status = gBS->LocateHandle(ByProtocol, &gEfiGraphicsOutputProtocolGuid, NULL, &Size, NULL);
@ -441,10 +442,10 @@ static EFI_STATUS LockGraphicsGOP(VOID)
}
// Lock the graphics UGA
static EFI_STATUS LockGraphicsUGA(VOID)
static EFI_STATUS LockGraphicsUGA(void)
{
EFI_HANDLE *Buffer;
VOID *Interface;
void *Interface;
UINTN i, Size = 0;
// Get needed buffer size
EFI_STATUS Status = gBS->LocateHandle(ByProtocol, &gEfiUgaDrawProtocolGuid, NULL, &Size, NULL);
@ -470,7 +471,7 @@ static EFI_STATUS LockGraphicsUGA(VOID)
}
// Lock the graphics
EFI_STATUS LockBootScreen(VOID)
EFI_STATUS LockBootScreen(void)
{
// Make sure we're not locked
if (ScreenIsLocked) {
@ -493,7 +494,7 @@ EFI_STATUS LockBootScreen(VOID)
}
// Unlock the graphics
EFI_STATUS UnlockBootScreen(VOID)
EFI_STATUS UnlockBootScreen(void)
{
// Make sure we're locked
if (!ScreenIsLocked) {

View File

@ -55,13 +55,13 @@
#endif
// Enable secure boot
VOID EnableSecureBoot(VOID)
void EnableSecureBoot(void)
{
EFI_STATUS Status = EFI_NOT_FOUND;
BOOLEAN WantDefaultKeys;
CONST CHAR16 *ErrorString = NULL;
UINTN CloverSignatureSize = 0;
VOID *CloverSignature = NULL;
void *CloverSignature = NULL;
// Check in setup mode
if (gSettings.SecureBoot || !gSettings.SecureBootSetupMode) {
return;
@ -70,36 +70,34 @@ VOID EnableSecureBoot(VOID)
WantDefaultKeys = YesNoMessage(L"Secure Boot", L"Enroll the default keys too?");
DBG("Enabling secure boot with%s default keys\n", WantDefaultKeys ? "" : "out");
// Get this image's certificate
if (SelfFullDevicePath != NULL) {
UINT32 AuthenticationStatus = 0;
UINTN FileSize = 0;
// Open the file buffer
VOID *FileBuffer = GetFileBufferByFilePath(FALSE, SelfFullDevicePath, &FileSize, &AuthenticationStatus);
if (FileBuffer != NULL) {
if (FileSize > 0) {
// Retrieve the certificates
CloverSignature = GetImageSignatureDatabase(FileBuffer, FileSize, &CloverSignatureSize, FALSE);
if (CloverSignature != NULL) {
if (CloverSignatureSize > 0) {
// Found signature
Status = EFI_SUCCESS;
} else {
FreePool(CloverSignature);
CloverSignature = NULL;
}
UINT32 AuthenticationStatus = 0;
UINTN FileSize = 0;
// Open the file buffer
void *FileBuffer = GetFileBufferByFilePath(FALSE, &self.getSelfFullPath(), &FileSize, &AuthenticationStatus);
if (FileBuffer != NULL) {
if (FileSize > 0) {
// Retrieve the certificates
CloverSignature = GetImageSignatureDatabase(FileBuffer, FileSize, &CloverSignatureSize, FALSE);
if (CloverSignature != NULL) {
if (CloverSignatureSize > 0) {
// Found signature
Status = EFI_SUCCESS;
} else {
FreePool(CloverSignature);
CloverSignature = NULL;
}
}
FreePool(FileBuffer);
}
// Check and alert about image not found
if ((FileBuffer == NULL) || (FileSize == 0)) {
CHAR16 *FilePath = FileDevicePathToStr(SelfFullDevicePath);
if (FilePath != NULL) {
DBG("Failed to load Clover image from %ls\n", FilePath);
FreePool(FilePath);
} else {
DBG("Failed to load Clover image\n");
}
FreePool(FileBuffer);
}
// Check and alert about image not found
if ((FileBuffer == NULL) || (FileSize == 0)) {
CHAR16 *FilePath = FileDevicePathToStr(&self.getSelfFullPath());
if (FilePath != NULL) {
DBG("Failed to load Clover image from %ls\n", FilePath);
FreePool(FilePath);
} else {
DBG("Failed to load Clover image\n");
}
}
if (EFI_ERROR(Status) || (CloverSignature == NULL)) {
@ -147,7 +145,7 @@ CONST CHAR16 *SecureBootPolicyToStr(IN UINTN Policy)
return L"Deny";
}
STATIC VOID PrintSecureBootInfo(VOID)
STATIC void PrintSecureBootInfo(void)
{
// Nothing to do if secure boot is disabled or in setup mode
if (!gSettings.SecureBoot) {
@ -160,7 +158,7 @@ STATIC VOID PrintSecureBootInfo(VOID)
}
// Alert message for disable failure
STATIC VOID DisableMessage(IN EFI_STATUS Status,
STATIC void DisableMessage(IN EFI_STATUS Status,
IN CHAR16 *String,
IN CHAR16 *ErrorString)
{
@ -175,7 +173,7 @@ STATIC VOID DisableMessage(IN EFI_STATUS Status,
}
// Disable secure boot
VOID DisableSecureBoot(VOID)
void DisableSecureBoot(void)
{
EFI_STATUS Status;
CHAR16 *ErrorString = NULL;
@ -292,7 +290,7 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt
STATIC BOOLEAN EFIAPI
CheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationStatus,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *FileBuffer,
IN void *FileBuffer,
IN UINTN FileSize)
{
UINTN UserResponse = SECURE_BOOT_POLICY_DENY;
@ -369,7 +367,7 @@ InternalFileAuthentication(IN CONST EFI_SECURITY_ARCH_PROTOCOL *This,
EFI_STATUS EFIAPI
Internal2FileAuthentication(IN CONST EFI_SECURITY2_ARCH_PROTOCOL *This,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *FileBuffer,
IN void *FileBuffer,
IN UINTN FileSize,
IN BOOLEAN BootPolicy)
{
@ -412,7 +410,7 @@ EFI_STATUS VerifySecureBootImage(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
}
// Install secure boot
EFI_STATUS InstallSecureBoot(VOID)
EFI_STATUS InstallSecureBoot(void)
{
EFI_STATUS Status;
EFI_SECURITY_ARCH_PROTOCOL *Security = NULL;
@ -427,8 +425,8 @@ EFI_STATUS InstallSecureBoot(VOID)
return EFI_SUCCESS;
}
// Locate security protocols
gBS->LocateProtocol(&gEfiSecurity2ArchProtocolGuid, NULL, (VOID **)&Security2);
Status = gBS->LocateProtocol(&gEfiSecurityArchProtocolGuid, NULL, (VOID **)&Security);
gBS->LocateProtocol(&gEfiSecurity2ArchProtocolGuid, NULL, (void **)&Security2);
Status = gBS->LocateProtocol(&gEfiSecurityArchProtocolGuid, NULL, (void **)&Security);
if (EFI_ERROR(Status)) {
return Status;
}
@ -446,13 +444,13 @@ EFI_STATUS InstallSecureBoot(VOID)
}
// Uninstall secure boot
VOID UninstallSecureBoot(VOID)
void UninstallSecureBoot(void)
{
// Uninstall policy hooks
if (gSecurityFileAuthentication) {
EFI_SECURITY_ARCH_PROTOCOL *Security = NULL;
// Restore the security protocol function
gBS->LocateProtocol(&gEfiSecurityArchProtocolGuid, NULL, (VOID **)&Security);
gBS->LocateProtocol(&gEfiSecurityArchProtocolGuid, NULL, (void **)&Security);
if (Security) {
Security->FileAuthenticationState = gSecurityFileAuthentication;
}
@ -461,7 +459,7 @@ VOID UninstallSecureBoot(VOID)
if (gSecurity2FileAuthentication) {
EFI_SECURITY2_ARCH_PROTOCOL *Security2 = NULL;
// Restory the security 2 protocol function
gBS->LocateProtocol(&gEfiSecurity2ArchProtocolGuid, NULL, (VOID **)&Security2);
gBS->LocateProtocol(&gEfiSecurity2ArchProtocolGuid, NULL, (void **)&Security2);
if (Security2) {
Security2->FileAuthentication = gSecurity2FileAuthentication;
}
@ -470,7 +468,7 @@ VOID UninstallSecureBoot(VOID)
}
// Initialize secure boot
VOID InitializeSecureBoot(VOID)
void InitializeSecureBoot(void)
{
// Set secure boot variables to firmware values
UINTN Size = sizeof(gSettings.SecureBootSetupMode);

View File

@ -61,10 +61,10 @@
#define EFIGUID_SIZE (CERT_SIZE + sizeof(EFI_GUID))
// Check database for signature
STATIC EFI_STATUS CheckSignatureIsInDatabase(IN VOID *Database,
STATIC EFI_STATUS CheckSignatureIsInDatabase(IN void *Database,
IN UINTN DatabaseSize,
IN EFI_GUID *SignatureType,
IN VOID *Signature,
IN void *Signature,
IN UINTN SignatureSize)
{
UINT8 *DatabasePtr;
@ -113,7 +113,7 @@ STATIC EFI_STATUS CheckSignatureIsInDatabase(IN VOID *Database,
// Append a signature to a signature list
STATIC EFI_STATUS AppendSignatureToList(IN OUT EFI_SIGNATURE_LIST **SignatureList,
IN EFI_GUID *SignatureType,
IN VOID *Signature,
IN void *Signature,
IN UINTN SignatureSize)
{
EFI_SIGNATURE_LIST *OldSignatureList;
@ -179,7 +179,7 @@ STATIC EFI_STATUS AppendSignatureToList(IN OUT EFI_SIGNATURE_LIST **SignatureLis
}
// Append a signature list to a signature database
STATIC EFI_STATUS AppendSignatureListToDatabase(IN OUT VOID **Database,
STATIC EFI_STATUS AppendSignatureListToDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN EFI_SIGNATURE_LIST *SignatureList)
{
@ -262,10 +262,10 @@ STATIC EFI_STATUS AppendSignatureListToDatabase(IN OUT VOID **Data
}
// Append a signature to a signature database
EFI_STATUS AppendSignatureToDatabase(IN OUT VOID **Database,
EFI_STATUS AppendSignatureToDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN EFI_GUID *SignatureType,
IN VOID *Signature,
IN void *Signature,
IN UINTN SignatureSize)
{
// Create a new signature list
@ -284,9 +284,9 @@ EFI_STATUS AppendSignatureToDatabase(IN OUT VOID **Database,
}
// Append a signature database to another signature database
EFI_STATUS AppendSignatureDatabaseToDatabase(IN OUT VOID **Database,
EFI_STATUS AppendSignatureDatabaseToDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN VOID *SignatureDatabase,
IN void *SignatureDatabase,
IN UINTN SignatureDatabaseSize)
{
UINT8 *Ptr, *End;
@ -316,11 +316,11 @@ EFI_STATUS AppendSignatureDatabaseToDatabase(IN OUT VOID **Database,
}
// Add image signature database to authorized database
EFI_STATUS AppendImageDatabaseToAuthorizedDatabase(IN VOID *Database,
EFI_STATUS AppendImageDatabaseToAuthorizedDatabase(IN void *Database,
IN UINTN DatabaseSize)
{
EFI_STATUS Status;
VOID *AuthDatabase;
void *AuthDatabase;
UINTN AuthDatabaseSize;
// Check parameters
if ((Database == NULL) || (DatabaseSize <= sizeof(EFI_SIGNATURE_LIST))) {
@ -350,15 +350,15 @@ EFI_STATUS AppendImageDatabaseToAuthorizedDatabase(IN VOID *Database,
return Status;
}
STATIC EFI_STATUS RemoveSignatureFromDatabase(IN OUT VOID **Database,
STATIC EFI_STATUS RemoveSignatureFromDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN EFI_GUID *SignatureType,
IN VOID *Signature,
IN void *Signature,
IN UINTN SignatureSize)
{
UINT8 *Ptr, *End;
VOID *OldDatabase;
VOID *NewDatabase = NULL;
void *OldDatabase;
void *NewDatabase = NULL;
UINTN OldDatabaseSize;
UINTN NewDatabaseSize = 0;
// Check parameters
@ -433,7 +433,7 @@ STATIC EFI_STATUS RemoveSignatureFromDatabase(IN OUT VOID **Database,
return EFI_SUCCESS;
}
STATIC EFI_STATUS RemoveSignatureListFromDatabase(IN OUT VOID **Database,
STATIC EFI_STATUS RemoveSignatureListFromDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN EFI_SIGNATURE_LIST *SignatureList)
{
@ -469,9 +469,9 @@ STATIC EFI_STATUS RemoveSignatureListFromDatabase(IN OUT VOID **Da
return EFI_SUCCESS;
}
STATIC EFI_STATUS RemoveSignatureDatabaseFromDatabase(IN OUT VOID **Database,
STATIC EFI_STATUS RemoveSignatureDatabaseFromDatabase(IN OUT void **Database,
IN OUT UINTN *DatabaseSize,
IN VOID *SignatureDatabase,
IN void *SignatureDatabase,
IN UINTN SignatureDatabaseSize)
{
UINT8 *Ptr, *End;
@ -501,11 +501,11 @@ STATIC EFI_STATUS RemoveSignatureDatabaseFromDatabase(IN OUT VOID **Database,
}
// Remove image signature database from authorized database
EFI_STATUS RemoveImageDatabaseFromAuthorizedDatabase(IN VOID *Database,
EFI_STATUS RemoveImageDatabaseFromAuthorizedDatabase(IN void *Database,
IN UINTN DatabaseSize)
{
EFI_STATUS Status;
VOID *AuthDatabase;
void *AuthDatabase;
UINTN AuthDatabaseSize;
// Check parameters
if ((Database == NULL) || (DatabaseSize <= sizeof(EFI_SIGNATURE_LIST))) {
@ -533,24 +533,24 @@ EFI_STATUS RemoveImageDatabaseFromAuthorizedDatabase(IN VOID *Database,
return Status;
}
VOID *GetAuthorizedDatabase(UINTN *DatabaseSize)
void *GetAuthorizedDatabase(UINTN *DatabaseSize)
{
return GetSignatureDatabase(AUTHORIZED_DATABASE_NAME, &AUTHORIZED_DATABASE_GUID, DatabaseSize);
}
EFI_STATUS SetAuthorizedDatabase(IN VOID *Database,
EFI_STATUS SetAuthorizedDatabase(IN void *Database,
IN UINTN DatabaseSize)
{
return SetSignatureDatabase(AUTHORIZED_DATABASE_NAME, &AUTHORIZED_DATABASE_GUID, Database, DatabaseSize);
}
// Clear authorized signature database
EFI_STATUS ClearAuthorizedDatabase(VOID)
EFI_STATUS ClearAuthorizedDatabase(void)
{
return SetAuthorizedDatabase(NULL, 0);
}
// Create a secure boot image signature
STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
STATIC void *CreateImageSignatureDatabase(IN void *FileBuffer,
IN UINT64 FileSize,
IN UINTN *DatabaseSize)
{
@ -742,13 +742,13 @@ Failed:
}
// Get a secure boot image signature
VOID *GetImageSignatureDatabase(IN VOID *FileBuffer,
void *GetImageSignatureDatabase(IN void *FileBuffer,
IN UINT64 FileSize,
IN UINTN *DatabaseSize,
IN BOOLEAN HashIfNoDatabase)
{
UINTN Size = 0;
VOID *Database = NULL;
void *Database = NULL;
UINT8 *Ptr, *End;
WIN_CERTIFICATE_UEFI_GUID *GuidCert;
EFI_IMAGE_DOS_HEADER *DosHeader;
@ -818,7 +818,7 @@ VOID *GetImageSignatureDatabase(IN VOID *FileBuffer,
UINTN Length = Cert->dwLength;
UINTN Alignment = (Length % SECDIR_ALIGNMENT_SIZE);
UINTN SigSize = 0;
VOID *Signature = NULL;
void *Signature = NULL;
EFI_GUID *SigGuid = NULL;
// Get the alignment length
if (Alignment != 0) {

View File

@ -57,7 +57,7 @@ extern BOOLEAN gGuiIsReady;
extern BOOLEAN gThemeNeedInit;
// Add secure boot tool entry
VOID AddSecureBootTool(VOID)
void AddSecureBootTool(void)
{
LOADER_ENTRY *Entry;
// If in forced mode or no secure boot then don't add tool
@ -145,7 +145,7 @@ UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
}
// Find a device path's signature list
STATIC VOID *FindImageSignatureDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
STATIC void *FindImageSignatureDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINTN *DatabaseSize)
{
EFI_IMAGE_EXECUTION_INFO_TABLE *ImageExeInfoTable = NULL;
@ -162,7 +162,7 @@ STATIC VOID *FindImageSignatureDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *Devi
return NULL;
}
// Get the execution information table
if (EFI_ERROR(EfiGetSystemConfigurationTable(&gEfiImageSecurityDatabaseGuid, (VOID **)&ImageExeInfoTable)) ||
if (EFI_ERROR(EfiGetSystemConfigurationTable(&gEfiImageSecurityDatabaseGuid, (void **)&ImageExeInfoTable)) ||
(ImageExeInfoTable == NULL)) {
return NULL;
}
@ -210,12 +210,12 @@ STATIC VOID *FindImageSignatureDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *Devi
// Insert secure boot image signature
EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *FileBuffer,
IN void *FileBuffer,
IN UINTN FileSize)
{
EFI_STATUS Status = EFI_INVALID_PARAMETER;
CHAR16 *ErrorString = NULL;
VOID *Database = NULL;
void *Database = NULL;
UINTN DatabaseSize = 0;
// Check that either the device path or the file buffer is valid
if ((DevicePath == NULL) && ((FileBuffer == NULL) || (FileSize == 0))) {
@ -285,12 +285,12 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De
// Insert secure boot image signature
EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *FileBuffer,
IN void *FileBuffer,
IN UINTN FileSize)
{
EFI_STATUS Status = EFI_INVALID_PARAMETER;
CHAR16 *ErrorString = NULL;
VOID *Database;
void *Database;
UINTN DatabaseSize = 0;
// Check that either the device path or the file buffer is valid
if (DevicePath == NULL) {
@ -403,7 +403,7 @@ STATIC REFIT_MENU_SCREEN SecureBootPolicyMenu = { 0, L"Secure Boot Policy", NUL
/* FILM_CENTRE, FILM_CENTRE,*/ { 0, 0, 0, 0 } , NULL };
// Configure secure boot
BOOLEAN ConfigureSecureBoot(VOID)
BOOLEAN ConfigureSecureBoot(void)
{
BOOLEAN StillConfiguring = TRUE;
do

View File

@ -64,14 +64,14 @@
#define SET_ADD_DATABASE_ATTRIBUTES (SET_DATABASE_ATTRIBUTES | EFI_VARIABLE_APPEND_WRITE)
// Clear the secure boot keys
EFI_STATUS ClearSecureBootKeys(VOID)
EFI_STATUS ClearSecureBootKeys(void)
{
// Clear the platform database
return gRT->SetVariable(PLATFORM_DATABASE_NAME, &PLATFORM_DATABASE_GUID, SET_DATABASE_ATTRIBUTES, sizeof(gSecureBootPlatformNullSignedKey), (VOID *)gSecureBootPlatformNullSignedKey);
return gRT->SetVariable(PLATFORM_DATABASE_NAME, &PLATFORM_DATABASE_GUID, SET_DATABASE_ATTRIBUTES, sizeof(gSecureBootPlatformNullSignedKey), (void *)gSecureBootPlatformNullSignedKey);
}
// Enroll the secure boot keys
EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
EFI_STATUS EnrollSecureBootKeys(IN void *AuthorizedDatabase,
IN UINTN AuthorizedDatabaseSize,
IN BOOLEAN WantDefaultKeys)
{
@ -79,7 +79,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
// Enroll this image's certificate
UINTN DatabaseSize = 0;
VOID *Database = NULL;
void *Database = NULL;
FreePool(AuthorizedDatabase);
@ -96,7 +96,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
if (Database != NULL) {
DBG("Appending default authorized database to authorized database ...\n");
//Status = AppendSignatureDatabaseToDatabase(&Database, &DatabaseSize, AuthorizedDatabase, AuthorizedDatabaseSize);
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (VOID *)gSecureBootDatabaseKey, sizeof(gSecureBootDatabaseKey));
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (void *)gSecureBootDatabaseKey, sizeof(gSecureBootDatabaseKey));
if (EFI_ERROR(Status)) {
FreePool(Database);
return Status;
@ -113,7 +113,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
DBG("No default authorized database found, using built-in default keys ...\n");
DatabaseSize = 0;
Database = NULL;
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (VOID *)gSecureBootCanonicalDatabaseKey, sizeof(gSecureBootCanonicalDatabaseKey));
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (void *)gSecureBootCanonicalDatabaseKey, sizeof(gSecureBootCanonicalDatabaseKey));
if (EFI_ERROR(Status)) {
if (Database != NULL) {
FreePool(Database);
@ -121,7 +121,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
DBG("Failed to modify authorized database with Canonical key! %s\n", efiStrError(Status));
return Status;
}
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (VOID *)gSecureBootMSPCADatabaseKey, sizeof(gSecureBootMSPCADatabaseKey));
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (void *)gSecureBootMSPCADatabaseKey, sizeof(gSecureBootMSPCADatabaseKey));
if (EFI_ERROR(Status)) {
if (Database != NULL) {
FreePool(Database);
@ -129,7 +129,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
DBG("Failed to modify authorized database with MS PCA key! %s\n", efiStrError(Status));
return Status;
}
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (VOID *)gSecureBootMSUEFICADatabaseKey, sizeof(gSecureBootMSUEFICADatabaseKey));
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (void *)gSecureBootMSUEFICADatabaseKey, sizeof(gSecureBootMSUEFICADatabaseKey));
if (EFI_ERROR(Status)) {
if (Database != NULL) {
FreePool(Database);
@ -138,7 +138,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
return Status;
}
}
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (VOID *)gSecureBootDatabaseKey, sizeof(gSecureBootDatabaseKey));
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (void *)gSecureBootDatabaseKey, sizeof(gSecureBootDatabaseKey));
//Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, AuthorizedDatabase, AuthorizedDatabaseSize);
Status = SetAuthorizedDatabase(Database, DatabaseSize);
FreePool(Database);
@ -189,7 +189,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
DBG("No default exchange database found, using built-in default keys ...\n");
DatabaseSize = 0;
Database = NULL;
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (VOID *)gSecureBootMSExchangeKey, sizeof(gSecureBootMSExchangeKey));
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (void *)gSecureBootMSExchangeKey, sizeof(gSecureBootMSExchangeKey));
if (EFI_ERROR(Status)) {
if (Database != NULL) {
FreePool(Database);
@ -201,7 +201,7 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
}
// Set the exchange database
DBG("Modifying exchange database ...\n");
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (VOID *)gSecureBootExchangeKeyDER, sizeof(gSecureBootExchangeKeyDER));
Status = AppendSignatureToDatabase(&Database, &DatabaseSize, &gEfiCertX509Guid, (void *)gSecureBootExchangeKeyDER, sizeof(gSecureBootExchangeKeyDER));
if (EFI_ERROR(Status)) {
if (Database != NULL) {
@ -222,18 +222,18 @@ EFI_STATUS EnrollSecureBootKeys(IN VOID *AuthorizedDatabase,
// Unsure if default platform database should be enrolled.....???
// Set the platform database - NOT ENROLLING DEFAULT PLATFORM DATABASE, ONLY CLOVER SHOULD OWN PLATFORM(?)
DBG("Setting the platform database ...\n");
Status = gRT->SetVariable(PLATFORM_DATABASE_NAME, &PLATFORM_DATABASE_GUID, SET_DATABASE_ATTRIBUTES, sizeof(gSecureBootPlatformSignedKey), (VOID *)gSecureBootPlatformSignedKey);
Status = gRT->SetVariable(PLATFORM_DATABASE_NAME, &PLATFORM_DATABASE_GUID, SET_DATABASE_ATTRIBUTES, sizeof(gSecureBootPlatformSignedKey), (void *)gSecureBootPlatformSignedKey);
return Status;
}
// Read signature database
VOID *GetSignatureDatabase(IN CHAR16 *DatabaseName,
void *GetSignatureDatabase(IN CHAR16 *DatabaseName,
IN EFI_GUID *DatabaseGuid,
OUT UINTN *DatabaseSize)
{
UINTN Size = 0;
VOID *Database;
void *Database;
// Check parameters
if (DatabaseSize == NULL) {
return NULL;
@ -371,7 +371,7 @@ STATIC EFI_STATUS GetUTCTime(OUT EFI_TIME *Timestamp)
EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
IN EFI_GUID *DatabaseGuid,
IN UINT32 Attributes,
IN VOID *Database,
IN void *Database,
IN UINTN DatabaseSize)
{
EFI_STATUS Status;
@ -379,7 +379,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
UINTN Size, NameLen;
UINTN DataSize = 0;
EFI_TIME Timestamp;
VOID *Data = NULL;
void *Data = NULL;
BIO *BioData = NULL;
PKCS7 *p7;
X509 *Certificate = NULL;
@ -499,7 +499,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
// Write signature database
EFI_STATUS SetSignatureDatabase(IN CHAR16 *DatabaseName,
IN EFI_GUID *DatabaseGuid,
IN VOID *Database,
IN void *Database,
IN UINTN DatabaseSize)
{
EFI_STATUS Status;

View File

@ -39,14 +39,14 @@
#include "../libeg/XImage.h"
#include "../refit/lib.h"
#include "../gui/REFIT_MENU_SCREEN.h"
#include "../Platform/Self.h"
//
// Clover File location to boot from on removable media devices
//
#define CLOVER_MEDIA_FILE_NAME_IA32 L"\\EFI\\CLOVER\\CLOVERIA32.EFI"_XSW
#define CLOVER_MEDIA_FILE_NAME_IA64 L"\\EFI\\CLOVER\\CLOVERIA64.EFI"_XSW
#define CLOVER_MEDIA_FILE_NAME_X64 L"\\EFI\\CLOVER\\CLOVERX64.EFI"_XSW
#define CLOVER_MEDIA_FILE_NAME_ARM L"\\EFI\\CLOVER\\CLOVERARM.EFI"_XSW
#define CLOVER_MEDIA_FILE_NAME_IA32 L"CLOVERIA32.EFI"_XSW
#define CLOVER_MEDIA_FILE_NAME_IA64 L"CLOVERIA64.EFI"_XSW
#define CLOVER_MEDIA_FILE_NAME_X64 L"CLOVERX64.EFI"_XSW
#define CLOVER_MEDIA_FILE_NAME_ARM L"CLOVERARM.EFI"_XSW
#if defined (MDE_CPU_IA32)
#define CLOVER_MEDIA_FILE_NAME CLOVER_MEDIA_FILE_NAME_IA32
@ -113,7 +113,7 @@ STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Full
return TRUE;
}
STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume)
STATIC void AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume)
{
REFIT_MENU_ENTRY_CLOVER *Entry;
REFIT_MENU_ENTRY_CLOVER *SubEntry;
@ -185,19 +185,19 @@ STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade
MainMenu.AddMenuEntry(Entry, true);
}
VOID ScanTool(VOID)
void ScanTool(void)
{
EFI_STATUS Status;
UINTN VolumeIndex;
REFIT_VOLUME *Volume;
VOID *Interface;
void *Interface;
if (ThemeX.HideUIFlags & HIDEUI_FLAG_TOOLS)
return;
// DBG("Scanning for tools...\n");
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_SHELL)) {
if (!AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64U.efi"_XSW, NULL, L"UEFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXString8Array)) {
AddToolEntry(L"\\EFI\\CLOVER\\tools\\Shell64.efi"_XSW, NULL, L"EFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXString8Array);
if (!AddToolEntry(SWPrintf("%ls\\tools\\Shell64U.efi", self.getCloverDirPathAsXStringW().wc_str()), NULL, L"UEFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXString8Array)) {
AddToolEntry(SWPrintf("%ls\\tools\\Shell64.efi", self.getCloverDirPathAsXStringW().wc_str()), NULL, L"EFI Shell 64", SelfVolume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), 'S', NullXString8Array);
}
}
@ -219,10 +219,10 @@ VOID ScanTool(VOID)
DBG(" Deleted /EFI label\n");
}
if (FileExists(Volume->RootDir, CLOVER_MEDIA_FILE_NAME)) {
if (FileExists(&self.getCloverDir(), CLOVER_MEDIA_FILE_NAME)) {
DBG(" Found Clover\n");
// Volume->BootType = BOOTING_BY_EFI;
AddCloverEntry(CLOVER_MEDIA_FILE_NAME, L"Clover Boot Options", Volume);
AddCloverEntry(SWPrintf("%ls\\%ls", self.getCloverDirPathAsXStringW().wc_str(), CLOVER_MEDIA_FILE_NAME.wc_str()), L"Clover Boot Options", Volume);
break;
}
}
@ -231,7 +231,7 @@ VOID ScanTool(VOID)
}
// Add custom tool entries
VOID AddCustomTool(VOID)
void AddCustomTool(void)
{
UINTN VolumeIndex;
REFIT_VOLUME *Volume;
@ -301,7 +301,7 @@ VOID AddCustomTool(VOID)
// Change to custom image if needed
Image = Custom->Image;
if (Image.isEmpty() && Custom->ImagePath.notEmpty()) {
Image.LoadXImage(ThemeX.ThemeDir, Custom->ImagePath);
Image.LoadXImage(&ThemeX.getThemeDir(), Custom->ImagePath);
}
if (Image.isEmpty()) {
AddToolEntry(Custom->Path, Custom->FullTitle.wc_str(), Custom->Title.wc_str(), Volume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), Custom->Hotkey, Custom->LoadOptions);

View File

@ -53,6 +53,7 @@
#include "../Platform/Nvram.h"
#include "../refit/screen.h"
#include "../Platform/Events.h"
#include "Self.h"
#ifndef DEBUG_ALL
#define DEBUG_MENU 1
@ -147,7 +148,7 @@ BOOLEAN mGuiReady = FALSE;
VOID REFIT_MENU_SCREEN::AddMenuInfo_f(CONST char *format, ...)
void REFIT_MENU_SCREEN::AddMenuInfo_f(CONST char *format, ...)
{
//DBG("%s, %s : Line=%s\n", __FILE__, __LINE__, XString(Line).c);
@ -185,7 +186,7 @@ VOID REFIT_MENU_SCREEN::AddMenuInfo_f(CONST char *format, ...)
#define CONSTRAIN_MIN(Variable, MinValue) if (Variable < MinValue) Variable = MinValue
#define CONSTRAIN_MAX(Variable, MaxValue) if (Variable > MaxValue) Variable = MaxValue
VOID REFIT_MENU_SCREEN::InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
void REFIT_MENU_SCREEN::InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
IN UINTN VisibleSpace, IN INTN Selected)
{
//ItemCount - a number to scroll (Row0)
@ -242,7 +243,7 @@ VOID REFIT_MENU_SCREEN::InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
}
VOID REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement)
void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement)
{
INTN Lines;
UINTN ScrollMovement = SCROLL_SCROLL_DOWN;
@ -418,7 +419,7 @@ VOID REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement)
HidePointer();
}
VOID REFIT_MENU_SCREEN::HidePointer()
void REFIT_MENU_SCREEN::HidePointer()
{
if ( mPointer.isAlive() ) mPointer.Hide();
}
@ -430,12 +431,12 @@ EFI_STATUS REFIT_MENU_SCREEN::MouseBirth()
return mPointer.MouseBirth();
}
VOID REFIT_MENU_SCREEN::KillMouse()
void REFIT_MENU_SCREEN::KillMouse()
{
/*if ( mPointer ) */mPointer.KillMouse();
}
VOID REFIT_MENU_SCREEN::AddMenuInfoLine_f(CONST char *format, ...)
void REFIT_MENU_SCREEN::AddMenuInfoLine_f(CONST char *format, ...)
{
XStringW* s = new XStringW();
VA_LIST va;
@ -445,14 +446,14 @@ VOID REFIT_MENU_SCREEN::AddMenuInfoLine_f(CONST char *format, ...)
InfoLines.AddReference(s, true);
}
VOID REFIT_MENU_SCREEN::AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt)
void REFIT_MENU_SCREEN::AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt)
{
if ( !Entry ) return;
Entries.AddReference(Entry, freeIt);
}
// This is supposed to be a destructor ?
VOID REFIT_MENU_SCREEN::FreeMenu()
void REFIT_MENU_SCREEN::FreeMenu()
{
REFIT_ABSTRACT_MENU_ENTRY *Tentry = NULL;
//TODO - here we must Free for a list of Entries, Screens, InputBootArgs
@ -611,7 +612,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog(IN MENU_STYLE_FUNC StyleFunc)
break;
//not used here
/* case SCAN_F6:
Status = egSaveFile(SelfRootDir, VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000);
Status = egSaveFile(&self.getSelfRootDir(), VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000);
}
@ -964,10 +965,11 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
case SCAN_F2:
SavePreBootLog = TRUE;
//let it be twice
Status = SaveBooterLog(SelfRootDir, PREBOOT_LOG);
if (EFI_ERROR(Status)) {
Status = SaveBooterLog(NULL, PREBOOT_LOG);
}
Status = SaveBooterLog(&self.getCloverDir(), PREBOOT_LOG_new);
// Jief : don't write outside SelfDir
// if (EFI_ERROR(Status)) {
// Status = SaveBooterLog(NULL, PREBOOT_LOG);
// }
break;
case SCAN_F3:
MenuExit = MENU_EXIT_HIDE_TOGGLE;
@ -979,17 +981,18 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
SaveOemDsdt(TRUE); //full patch
break;
case SCAN_F6:
Status = egSaveFile(SelfRootDir, VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000);
if (EFI_ERROR(Status)) {
Status = egSaveFile(NULL, VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000);
}
Status = egSaveFile(&self.getCloverDir(), VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000);
// Jief : don't write outside SelfDir
// if (EFI_ERROR(Status)) {
// Status = egSaveFile(NULL, VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000);
// }
break;
/* just a sample code
case SCAN_F7:
Status = egMkDir(SelfRootDir, L"EFI\\CLOVER\\new_folder");
Status = egMkDir(&self.getCloverDir(), L"new_folder");
DBG("create folder %s\n", efiStrError(Status));
if (!EFI_ERROR(Status)) {
Status = egSaveFile(SelfRootDir, L"EFI\\CLOVER\\new_folder\\new_file.txt", (UINT8*)SomeText, sizeof(*SomeText)+1);
Status = egSaveFile(&self.getCloverDir(), L"new_folder\\new_file.txt", (UINT8*)SomeText, sizeof(*SomeText)+1);
DBG("create file %s\n", efiStrError(Status));
}
break;
@ -998,10 +1001,10 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
if (OldChosenAudio >= AudioList.size()) {
OldChosenAudio = 0; //security correction
}
Status = gBS->HandleProtocol(AudioList[OldChosenAudio].Handle, &gEfiAudioIoProtocolGuid, (VOID**)&AudioIo);
DBG("open %llu audio handle status=%s\n", OldChosenAudio, efiStrError(Status));
Status = gBS->HandleProtocol(AudioList[OldChosenAudio].Handle, &gEfiAudioIoProtocolGuid, (void**)&AudioIo);
DBG("open %llu audio handle status=%s\n", OldChosenAudio, efiStrError(Status));
if (!EFI_ERROR(Status)) {
StartupSoundPlay(SelfRootDir, NULL); //play embedded sound
StartupSoundPlay(&self.getCloverDir(), NULL); //play embedded sound
}
break;
case SCAN_F8:
@ -1081,7 +1084,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
/**
* Text Mode menu.
*/
VOID REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
void REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
{
INTN i = 0, j = 0;
static UINTN TextMenuWidth = 0,ItemWidth = 0, MenuHeight = 0;
@ -1412,7 +1415,7 @@ void REFIT_MENU_SCREEN::EraseTextXY() //used on boot screen
* Helper function to draw text for Boot Camp Style.
* @author: Needy
*/
VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
void REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
{
// check if text was provided. And what else?
if (!Text) {
@ -1437,7 +1440,7 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN
DrawTextXY(BCSTextX, XPos, YPos, XAlign);
}
VOID REFIT_MENU_SCREEN::DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor, IN INTN MaxWidth)
void REFIT_MENU_SCREEN::DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor, IN INTN MaxWidth)
{
INTN Width = (MaxWidth > 0 && (XPos + MaxWidth <= UGAWidth)) ? MaxWidth : UGAWidth - XPos;
XImage TextBufferX(Width, ThemeX.TextHeight);
@ -1476,7 +1479,7 @@ VOID REFIT_MENU_SCREEN::DrawMenuText(IN const XStringW& Text, IN INTN SelectedWi
SelectionBar.DrawWithoutCompose(XPos, YPos);
}
VOID REFIT_MENU_SCREEN::SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State)
void REFIT_MENU_SCREEN::SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State)
{
// DBG("SetBar <= %d %d %d %d %d\n", UpPosY, DownPosY, State->MaxVisible, State->MaxIndex, State->FirstVisible);
//SetBar <= 302 722 19 31 0
@ -1521,7 +1524,7 @@ VOID REFIT_MENU_SCREEN::SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_
// DBG("ScrollTotal.Height = %d\n", ScrollTotal.Height); //ScrollTotal.Height = 420
}
VOID REFIT_MENU_SCREEN::ScrollingBar()
void REFIT_MENU_SCREEN::ScrollingBar()
{
ScrollEnabled = (ScrollState.MaxFirstVisible != 0);
if (!ScrollEnabled) {
@ -1556,7 +1559,7 @@ VOID REFIT_MENU_SCREEN::ScrollingBar()
/**
* Graphical menu.
*/
VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
void REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
{
INTN Chosen = 0;
INTN ItemWidth = 0;
@ -1875,7 +1878,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
* Draw entries for GUI.
*/
VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos)
void REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos)
{
INTN TextWidth = 0;
INTN BadgeDim = (INTN)(BADGE_DIMENSION * ThemeX.Scale);
@ -1919,7 +1922,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos,
OldRow = Entries[ScrollState.CurrentSelection].Row;
}
VOID REFIT_MENU_SCREEN::CountItems()
void REFIT_MENU_SCREEN::CountItems()
{
row0PosX = 0;
row1PosX = Entries.size();
@ -1937,7 +1940,7 @@ VOID REFIT_MENU_SCREEN::CountItems()
}
}
VOID REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
void REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
{
INTN Xpos;
// CHAR16 *Text = NULL;
@ -1996,7 +1999,7 @@ VOID REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
DrawTextXY(Text, Xpos, UGAHeight - (INTN)(ThemeX.TextHeight * 1.5f), Align);
}
VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos)
void REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos)
{
INTN MainSize = ThemeX.MainEntriesSize;
// XImage MainImage(MainSize, MainSize);
@ -2012,7 +2015,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
//this should be inited by the Theme
if (MainIcon.isEmpty()) {
// DBG(" why MainImage is empty? Report to devs\n");
if (!IsEmbeddedTheme()) {
if (!ThemeX.IsEmbeddedTheme()) {
MainIcon = ThemeX.GetIcon("os_mac"_XS8);
}
if (MainIcon.Image.isEmpty()) {
@ -2134,7 +2137,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
}
VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
void REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
{
// INTN i;
INTN row0PosYRunning;
@ -2285,7 +2288,7 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
/**
* Main screen text.
*/
VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
void REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
{
EFI_STATUS Status = EFI_SUCCESS;
// INTN i = 0;
@ -2508,7 +2511,7 @@ UINTN REFIT_MENU_SCREEN::RunMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
}
VOID REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum)
void REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum)
{
REFIT_MENU_CHECKBIT *InputBootArgs;
@ -2523,7 +2526,7 @@ VOID REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum)
}
VOID REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
void REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
{
InputBootArgs->Title.takeValueFrom(Line);
if (Inx == 3 || Inx == 116) {
@ -2539,13 +2542,13 @@ VOID REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootAr
AddMenuEntry(InputBootArgs, true);
}
VOID REFIT_MENU_SCREEN::AddMenuItemInput(INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
void REFIT_MENU_SCREEN::AddMenuItemInput(INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
{
REFIT_INPUT_DIALOG *InputBootArgs = new REFIT_INPUT_DIALOG;
AddMenuItem_(InputBootArgs, Inx, Line, Cursor);
}
VOID REFIT_MENU_SCREEN::AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
void REFIT_MENU_SCREEN::AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
{
REFIT_MENU_SWITCH *InputBootArgs = new REFIT_MENU_SWITCH;
AddMenuItem_(InputBootArgs, Inx, Line, Cursor);

View File

@ -67,7 +67,7 @@ class REFIT_MENU_ENTRY_ITEM_ABSTRACT;
class REFIT_MENU_ENTRY;
class REFIT_ABSTRACT_MENU_ENTRY;
typedef VOID (REFIT_MENU_SCREEN::*MENU_STYLE_FUNC)(IN UINTN Function, IN CONST CHAR16 *ParamText);
typedef void (REFIT_MENU_SCREEN::*MENU_STYLE_FUNC)(IN UINTN Function, IN CONST CHAR16 *ParamText);
class EntryArray : public XObjArray<REFIT_ABSTRACT_MENU_ENTRY>
{
@ -224,29 +224,29 @@ public:
//Scroll functions
VOID InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
void InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
IN UINTN VisibleSpace, IN INTN Selected);
VOID UpdateScroll(IN UINTN Movement);
void UpdateScroll(IN UINTN Movement);
// void InitBar();
VOID ScrollingBar();
VOID SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State);
void ScrollingBar();
void SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State);
//mouse functions and event
VOID HidePointer();
void HidePointer();
EFI_STATUS MouseBirth();
VOID KillMouse();
void KillMouse();
EFI_STATUS CheckMouseEvent();
EFI_STATUS WaitForInputEventPoll(UINTN TimeoutDefault);
//menu functions
VOID AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
VOID AddMenuInfo_f(CONST char *format, ...) __attribute__((format(printf, 2, 3)));
VOID AddMenuInfoLine_f(CONST char *format, ...) __attribute__((format(printf, 2, 3)));
VOID AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt);
VOID AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
VOID AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum);
VOID AddMenuItemInput(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
VOID FreeMenu();
void AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
void AddMenuInfo_f(CONST char *format, ...) __attribute__((format(printf, 2, 3)));
void AddMenuInfoLine_f(CONST char *format, ...) __attribute__((format(printf, 2, 3)));
void AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt);
void AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
void AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum);
void AddMenuItemInput(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
void FreeMenu();
INTN FindMenuShortcutEntry(IN CHAR16 Shortcut);
UINTN RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INTN *DefaultEntryIndex, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
UINTN RunMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
@ -254,24 +254,24 @@ public:
UINTN InputDialog(IN MENU_STYLE_FUNC StyleFunc);
VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos);
VOID DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos);
void DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos);
void DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos);
INTN DrawTextXY(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
void EraseTextXY();
VOID DrawTextCorner(UINTN TextC, UINT8 Align);
VOID DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor, IN INTN MaxWidth);
VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
VOID CountItems();
VOID InitAnime();
VOID GetAnime(); //same for xcinema
VOID UpdateFilm();
void DrawTextCorner(UINTN TextC, UINT8 Align);
void DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor, IN INTN MaxWidth);
void DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
void CountItems();
void InitAnime();
void GetAnime(); //same for xcinema
void UpdateFilm();
//Style functions
virtual VOID MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual VOID MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual VOID GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual VOID TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual void MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual void MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual void GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual void TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
virtual ~REFIT_MENU_SCREEN() {};
};

View File

@ -425,6 +425,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
{};
LOADER_ENTRY(const LOADER_ENTRY&) = delete;
LOADER_ENTRY& operator=(const LOADER_ENTRY&) = delete;
~LOADER_ENTRY() {};
void SetKernelRelocBase();
void FindBootArgs();
@ -461,9 +462,9 @@ class REFIT_ABSTRACT_MENU_ENTRY
// int is_mkext_v1(UINT8* drvPtr);
// void patch_mkext_v1(UINT8 *drvPtr); //not used
EFI_STATUS LoadKext(IN EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType, IN OUT void *kext);
EFI_STATUS AddKext(IN EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType);
void LoadPlugInKexts(IN EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
EFI_STATUS LoadKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType, IN OUT void *kext);
EFI_STATUS AddKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType);
void LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
// void AddKexts(const XStringW& SrcDir, const XStringW& Path, cpu_type_t archCpuType);
void AddKextsFromDirInArray(const XString8& SrcDir, const XString8& Path, cpu_type_t archCpuType, XObjArray<SIDELOAD_KEXT>* kextArray);
void AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray);
@ -492,7 +493,6 @@ class REFIT_ABSTRACT_MENU_ENTRY
void Stall(int Pause) { if ( KernelAndKextPatches.KPDebug ) { gBS->Stall(Pause); } };
void StartLoader();
void StartLoader11();
void AddDefaultMenu();
LOADER_ENTRY* getPartiallyDuplicatedEntry() const;
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };

View File

@ -67,7 +67,7 @@ CONST XString8 ArgOptional[NUM_OPT] = {
"-shikioff"_XS8, //18
"nvda_drv=1"_XS8 //19
};
CONST CHAR16 *VBIOS_BIN = L"EFI\\CLOVER\\misc\\c0000.bin";
CONST CHAR16 *VBIOS_BIN = L"misc\\c0000.bin";
INPUT_ITEM *InputItems = NULL;
INTN TextStyle; //why global? It will be class SCREEN member
@ -90,7 +90,7 @@ UINT32 EncodeOptions(const XString8Array& Options)
return OptionsBits;
}
VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
{
//set checked option
INTN Index;

View File

@ -19,7 +19,7 @@ extern CONST CHAR16 *VBIOS_BIN;
extern INPUT_ITEM *InputItems;
VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry);
void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry);
UINT32 EncodeOptions(const XString8Array& Options);

View File

@ -32,7 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
EFI_STATUS
EfiLibLocateProtocol (
IN EFI_GUID *ProtocolGuid,
OUT VOID **Interface
OUT void **Interface
)
{
EFI_STATUS Status;
@ -40,7 +40,7 @@ EfiLibLocateProtocol (
Status = gBS->LocateProtocol (
ProtocolGuid,
NULL,
(VOID **) Interface
(void **) Interface
);
return Status;
}
@ -54,14 +54,14 @@ EfiLibLocateProtocol (
@return A valid file handle or NULL is returned
**/
EFI_FILE_HANDLE
EFI_FILE*
EfiLibOpenRoot (
IN EFI_HANDLE DeviceHandle
)
{
EFI_STATUS Status;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
EFI_FILE_HANDLE File;
EFI_FILE* File;
File = NULL;
@ -71,7 +71,7 @@ EfiLibOpenRoot (
Status = gBS->HandleProtocol (
DeviceHandle,
&gEfiSimpleFileSystemProtocolGuid,
(VOID **) &Volume
(void **) &Volume
);
//
@ -102,7 +102,7 @@ EfiLibOpenRoot (
**/
XStringW
EfiLibFileSystemVolumeLabelInfo (
IN EFI_FILE_HANDLE FHand
const EFI_FILE* FHand
)
{
EFI_STATUS Status;
@ -110,7 +110,7 @@ EfiLibFileSystemVolumeLabelInfo (
UINTN Size = 0;
XStringW returnValue;
Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo);
Status = FHand->GetInfo(FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo);
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
@ -196,7 +196,7 @@ AsciiStrStriN (
**/
EFI_FILE_INFO *
EfiLibFileInfo (
IN EFI_FILE_HANDLE FHand
const EFI_FILE* FHand
)
{
EFI_STATUS Status;
@ -216,7 +216,7 @@ EfiLibFileInfo (
EFI_FILE_SYSTEM_INFO *
EfiLibFileSystemInfo (
IN EFI_FILE_HANDLE FHand
const EFI_FILE* FHand
)
{
EFI_STATUS Status;
@ -273,14 +273,14 @@ EfiDevicePathInstanceCount (
@retval NULL Allocation failed.
**/
VOID *
void *
EfiReallocatePool (
IN VOID *OldPool,
IN void *OldPool,
IN UINTN OldSize,
IN UINTN NewSize
)
{
VOID *NewPool;
void *NewPool;
NewPool = NULL;
if (NewSize != 0) {

View File

@ -29,7 +29,7 @@
EFI_STATUS
EfiLibLocateProtocol (
IN EFI_GUID *ProtocolGuid,
OUT VOID **Interface
OUT void **Interface
);
/**
@ -41,7 +41,7 @@ EfiLibLocateProtocol (
@return A valid file handle or NULL is returned
**/
EFI_FILE_HANDLE
EFI_FILE*
EfiLibOpenRoot (
IN EFI_HANDLE DeviceHandle
);
@ -60,7 +60,7 @@ EfiLibOpenRoot (
**/
XStringW
EfiLibFileSystemVolumeLabelInfo (
IN EFI_FILE_HANDLE FHand
const EFI_FILE* FHand
);
@ -101,12 +101,12 @@ AsciiStrStriN (
**/
EFI_FILE_INFO *
EfiLibFileInfo (
IN EFI_FILE_HANDLE FHand
const EFI_FILE* FHand
);
EFI_FILE_SYSTEM_INFO *
EfiLibFileSystemInfo (
IN EFI_FILE_HANDLE FHand
const EFI_FILE* FHand
);
/**
@ -138,9 +138,9 @@ EfiDevicePathInstanceCount (
@retval NULL Allocation failed.
**/
VOID *
void *
EfiReallocatePool (
IN VOID *OldPool,
IN void *OldPool,
IN UINTN OldSize,
IN UINTN NewSize
);

View File

@ -250,7 +250,7 @@ EfiSeek (
EFI_STATUS
EfiRead (
IN EFI_OPEN_FILE *Stream,
OUT VOID *Buffer,
OUT void *Buffer,
OUT UINTN *BufferSize
);
@ -277,7 +277,7 @@ EfiRead (
EFI_STATUS
EfiReadAllocatePool (
IN EFI_OPEN_FILE *Stream,
OUT VOID **Buffer,
OUT void **Buffer,
OUT UINTN *BufferSize
);
@ -300,7 +300,7 @@ EfiReadAllocatePool (
EFI_STATUS
EfiWrite (
IN EFI_OPEN_FILE *Stream,
OUT VOID *Buffer,
OUT void *Buffer,
OUT UINTN *BufferSize
);
@ -348,7 +348,7 @@ EfiSetCwd (
**/
CHAR8 *
EfiGetCwd (
VOID
void
);
#endif

View File

@ -310,9 +310,9 @@ AsciiStrToFloat(IN CONST CHAR8 *String,
}
*/
#if 0
VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONST VOID* a, CONST VOID* b)) {
void QuickSort(void* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONST void* a, CONST void* b)) {
INTN i = Low, j = High;
VOID *Med, *Temp;
void *Med, *Temp;
Med = Array + ((Low + High) / 2) * Size; // Central element, just pointer
Temp = (__typeof__(Temp))AllocatePool(Size);
// Sort around center
@ -336,7 +336,7 @@ VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONS
}
//
////S must be allocated before use
//VOID AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X)
//void AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X)
//{
// INTN I, Fract;
// float D;

View File

@ -43,10 +43,10 @@ AsciiStrToFloat(IN CONST CHAR8 *String,
OUT CHAR8 **EndPointer, OPTIONAL
OUT float *Data);
#if 0
//VOID AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X);
//void AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X);
VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size,
INTN (*compare)(CONST VOID* a, CONST VOID* b));
void QuickSort(void* Array, INTN Low, INTN High, INTN Size,
INTN (*compare)(CONST void* a, CONST void* b));
#endif

View File

@ -22,6 +22,7 @@
#include "../refit/screen.h"
#include "../cpp_foundation/XString.h"
#include "../refit/lib.h"
#include "Self.h"
#ifndef DEBUG_ALL
#define DEBUG_VEC 1
@ -44,7 +45,7 @@ extern const INTN IconsNamesSize;
#define NSVG_RGB(r, g, b) (((unsigned int)b) | ((unsigned int)g << 8) | ((unsigned int)r << 16))
//#define NSVG_RGBA(r, g, b, a) (((unsigned int)b) | ((unsigned int)g << 8) | ((unsigned int)r << 16) | ((unsigned int)a << 24))
extern VOID
extern void
WaitForKeyPress(CHAR16 *Message);
extern void DumpFloat2 (CONST char* s, float* t, int N);
@ -538,7 +539,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
return (INTN)RealWidth; //x;
}
VOID testSVG()
void testSVG()
{
do {
@ -607,7 +608,7 @@ VOID testSVG()
float Scale, ScaleX, ScaleY;
// load file
Status = egLoadFile(SelfRootDir, L"Sample.svg", &FileData, &FileDataLength);
Status = egLoadFile(&self.getSelfVolumeRootDir(), L"Sample.svg", &FileData, &FileDataLength);
if (!EFI_ERROR(Status)) {
//Parse XML to vector data
@ -653,7 +654,7 @@ VOID testSVG()
Width = UGAWidth-200;
// DBG("create test textbuffer\n");
XImage TextBufferXY(Width, Height);
Status = egLoadFile(SelfRootDir, L"Font.svg", &FileData, &FileDataLength);
Status = egLoadFile(&self.getSelfVolumeRootDir(), L"Font.svg", &FileData, &FileDataLength);
DBG("test Font.svg loaded status=%s\n", efiStrError(Status));
if (!EFI_ERROR(Status)) {
p = nsvgParse((CHAR8*)FileData, 72, 1.f);

View File

@ -13,7 +13,7 @@
INTN renderSVGtext(XImage* TextBufferXY, INTN posX, INTN posY, INTN textType, const XStringW& string, UINTN Cursor);
VOID testSVG(VOID);
void testSVG(void);
#endif /* LIBEG_VECTORGRAPHICS_H_ */

View File

@ -29,7 +29,7 @@
// object XCinema Cinema is a part of Theme
// object FILM* FilmC is a part or current Screen. Must be initialized from Cinema somewhere on Screen init
// assumed one Film per screen
VOID REFIT_MENU_SCREEN::UpdateFilm()
void REFIT_MENU_SCREEN::UpdateFilm()
{
if (FilmC == nullptr || !FilmC->AnimeRun) {
// DBG("no anime -> run=%d\n", FilmC->AnimeRun?1:0);
@ -128,7 +128,7 @@ void FILM::AddFrame(XImage* Frame, INTN Index)
void FILM::GetFrames(XTheme& TheTheme /*, const XStringW& Path*/) // Path already exist as a member. Is it the same ?
{
EFI_FILE *ThemeDir = TheTheme.ThemeDir;
const EFI_FILE *ThemeDir = &TheTheme.getThemeDir();
EFI_STATUS Status;
LastIndex = 0;
for (INTN Index = 0; Index < NumFrames; Index++) {

View File

@ -227,18 +227,18 @@ void XIcon::GetEmbedded()
XIcon::~XIcon() {}
//copy from XImage for our purpose
EFI_STATUS XIcon::LoadXImage(EFI_FILE *BaseDir, const char* IconName)
EFI_STATUS XIcon::LoadXImage(const EFI_FILE *BaseDir, const char* IconName)
{
return LoadXImage(BaseDir, XStringW().takeValueFrom(IconName));
}
EFI_STATUS XIcon::LoadXImage(EFI_FILE *BaseDir, const wchar_t* LIconName)
EFI_STATUS XIcon::LoadXImage(const EFI_FILE *BaseDir, const wchar_t* LIconName)
{
return LoadXImage(BaseDir, XStringW().takeValueFrom(LIconName));
}
//dont call this procedure for SVG theme BaseDir == NULL?
//it can be used for other files
EFI_STATUS XIcon::LoadXImage(EFI_FILE *BaseDir, const XStringW& IconName)
EFI_STATUS XIcon::LoadXImage(const EFI_FILE *BaseDir, const XStringW& IconName)
{
EFI_STATUS Status = Image.LoadXImage(BaseDir, IconName);
ImageNight.LoadXImage(BaseDir, IconName + L"_night"_XSW);

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