mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-03-02 03:21:55 +01:00
Refactoring some CHAR8* and CHAR16* to XString.
This commit is contained in:
parent
220b450d60
commit
bc04c86a93
@ -19,10 +19,10 @@
|
||||
#endif
|
||||
*/
|
||||
|
||||
#import "NSWindowFix.h"
|
||||
#import "ThemeImage.h"
|
||||
#import "gfxutil.h"
|
||||
#import "efidevp.h"
|
||||
//#import "NSWindowFix.h"
|
||||
//#import "ThemeImage.h"
|
||||
//#import "gfxutil.h"
|
||||
//#import "efidevp.h"
|
||||
|
||||
#define VOID void
|
||||
#define CONST const
|
||||
@ -31,7 +31,9 @@ typedef signed char INT8;
|
||||
typedef unsigned char UINT8;
|
||||
typedef UINT8 BOOLEAN;
|
||||
typedef char CHAR8;
|
||||
#ifndef CHAR16
|
||||
typedef unsigned short CHAR16;
|
||||
#endif
|
||||
typedef short INT16;
|
||||
typedef unsigned short UINT16;
|
||||
typedef int INT32;
|
||||
@ -112,8 +114,7 @@ typedef enum {
|
||||
kTagTypeArray
|
||||
} TAG_TYPE;
|
||||
|
||||
typedef struct DEV_PROPERTY DEV_PROPERTY; //yyyy
|
||||
struct DEV_PROPERTY {
|
||||
typedef struct DEV_PROPERTY {
|
||||
UINT32 Device;
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath;
|
||||
CHAR8 *Key;
|
||||
@ -124,10 +125,9 @@ struct DEV_PROPERTY {
|
||||
CHAR8 *Label;
|
||||
INPUT_ITEM MenuItem;
|
||||
TAG_TYPE ValueType;
|
||||
};
|
||||
} DEV_PROPERTY;
|
||||
|
||||
typedef struct KEXT_PATCH KEXT_PATCH;
|
||||
struct KEXT_PATCH
|
||||
typedef struct KEXT_PATCH
|
||||
{
|
||||
CHAR8 *Name;
|
||||
CHAR8 *Label;
|
||||
@ -141,7 +141,7 @@ struct KEXT_PATCH
|
||||
CHAR8 *MatchOS;
|
||||
CHAR8 *MatchBuild;
|
||||
INPUT_ITEM MenuItem;
|
||||
};
|
||||
} KEXT_PATCH;
|
||||
|
||||
typedef struct {
|
||||
CHAR8 *Label;
|
||||
@ -209,31 +209,27 @@ typedef struct KERNEL_AND_KEXT_PATCHES
|
||||
|
||||
} KERNEL_AND_KEXT_PATCHES;
|
||||
|
||||
typedef struct ACPI_NAME_LIST ACPI_NAME_LIST;
|
||||
struct ACPI_NAME_LIST {
|
||||
typedef struct ACPI_NAME_LIST {
|
||||
ACPI_NAME_LIST *Next;
|
||||
CHAR8 *Name;
|
||||
};
|
||||
} ACPI_NAME_LIST;
|
||||
|
||||
typedef struct ACPI_DROP_TABLE ACPI_DROP_TABLE;
|
||||
struct ACPI_DROP_TABLE
|
||||
typedef struct ACPI_DROP_TABLE
|
||||
{
|
||||
ACPI_DROP_TABLE *Next;
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT64 TableId;
|
||||
INPUT_ITEM MenuItem;
|
||||
};
|
||||
} ACPI_DROP_TABLE;
|
||||
|
||||
typedef struct RT_VARIABLES RT_VARIABLES;
|
||||
struct RT_VARIABLES {
|
||||
typedef struct RT_VARIABLES {
|
||||
// BOOLEAN Disabled;
|
||||
CHAR16 *Name;
|
||||
EFI_GUID VarGuid;
|
||||
};
|
||||
} RT_VARIABLES;
|
||||
|
||||
typedef struct CUSTOM_LOADER_ENTRY CUSTOM_LOADER_ENTRY;
|
||||
struct CUSTOM_LOADER_ENTRY {
|
||||
typedef struct CUSTOM_LOADER_ENTRY {
|
||||
CUSTOM_LOADER_ENTRY *Next;
|
||||
CUSTOM_LOADER_ENTRY *SubEntries;
|
||||
EG_IMAGE *Image;
|
||||
@ -256,10 +252,9 @@ struct CUSTOM_LOADER_ENTRY {
|
||||
EG_IMAGE *CustomLogo;
|
||||
EG_PIXEL *BootBgColor;
|
||||
KERNEL_AND_KEXT_PATCHES KernelAndKextPatches; //zzzz
|
||||
};
|
||||
} CUSTOM_LOADER_ENTRY;
|
||||
|
||||
typedef struct CUSTOM_LEGACY_ENTRY CUSTOM_LEGACY_ENTRY;
|
||||
struct CUSTOM_LEGACY_ENTRY {
|
||||
typedef struct CUSTOM_LEGACY_ENTRY {
|
||||
CUSTOM_LEGACY_ENTRY *Next;
|
||||
EG_IMAGE *Image;
|
||||
EG_IMAGE *DriveImage;
|
||||
@ -272,10 +267,9 @@ struct CUSTOM_LEGACY_ENTRY {
|
||||
UINT8 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 VolumeType;
|
||||
};
|
||||
} CUSTOM_LEGACY_ENTRY;
|
||||
|
||||
typedef struct CUSTOM_TOOL_ENTRY CUSTOM_TOOL_ENTRY;
|
||||
struct CUSTOM_TOOL_ENTRY {
|
||||
typedef struct CUSTOM_TOOL_ENTRY {
|
||||
CUSTOM_TOOL_ENTRY *Next;
|
||||
EG_IMAGE *Image;
|
||||
CHAR16 *ImagePath;
|
||||
@ -287,7 +281,7 @@ struct CUSTOM_TOOL_ENTRY {
|
||||
CHAR16 Hotkey;
|
||||
UINT8 Flags;
|
||||
UINT8 VolumeType;
|
||||
};
|
||||
} CUSTOM_TOOL_ENTRY;
|
||||
|
||||
// Set of Search & replace bytes for VideoBiosPatchBytes().
|
||||
typedef struct _VBIOS_PATCH_BYTES {
|
||||
|
@ -796,7 +796,7 @@ VOID MarkTableAsSaved(VOID *TableEntry)
|
||||
//DBG(" Allocaing mSavedTables");
|
||||
mSavedTablesEntries = SAVED_TABLES_ALLOC_ENTRIES;
|
||||
mSavedTablesNum = 0;
|
||||
mSavedTables = (__typeof__(mSavedTables))BllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
|
||||
mSavedTables = (__typeof__(mSavedTables))AllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
|
||||
if (mSavedTables == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -1508,7 +1508,7 @@ VOID SaveOemDsdt(BOOLEAN FullPatch)
|
||||
XStringW PathDsdt;
|
||||
XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str());
|
||||
|
||||
PathDsdt.SWPrintf("\\%ls", gSettings.DsdtName);
|
||||
PathDsdt.SWPrintf("\\%ls", gSettings.DsdtName.wc_str());
|
||||
|
||||
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());
|
||||
@ -1713,7 +1713,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
|
||||
|
||||
DbgHeader("PatchACPI");
|
||||
|
||||
PathDsdt = SWPrintf("\\%ls", gSettings.DsdtName);
|
||||
PathDsdt = SWPrintf("\\%ls", gSettings.DsdtName.wc_str());
|
||||
//try to find in SystemTable
|
||||
for(Index = 0; Index < gST->NumberOfTableEntries; Index++) {
|
||||
if(CompareGuid (&gST->ConfigurationTable[Index].VendorGuid, &gEfiAcpi20TableGuid)) {
|
||||
@ -1850,7 +1850,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
|
||||
DBG("old FADT length=%X\n", oldLength);
|
||||
CopyMem(newFadt, FadtPointer, oldLength); //old data
|
||||
newFadt->Header.Length = 0xF4;
|
||||
CopyMem(newFadt->Header.OemId, BiosVendor, 6);
|
||||
CopyMem(newFadt->Header.OemId, BiosVendor.c_str(), 6);
|
||||
if (newFadt->Header.Revision < EFI_ACPI_4_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
|
||||
newFadt->Header.Revision = EFI_ACPI_4_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION;
|
||||
}
|
||||
@ -2069,7 +2069,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
|
||||
|
||||
// XsdtReplaceSizes array is used to keep track of allocations for the merged tables,
|
||||
// as those tables may need to be freed if patched later.
|
||||
XsdtReplaceSizes = (__typeof__(XsdtReplaceSizes))BllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
|
||||
XsdtReplaceSizes = (__typeof__(XsdtReplaceSizes))AllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
|
||||
|
||||
// Load merged ACPI files from ACPI/patched
|
||||
LoadAllPatchedAML(AcpiOemPath.wc_str(), AUTOMERGE_PASS1);
|
||||
@ -2307,11 +2307,11 @@ EFI_STATUS LoadAndInjectDSDT(CONST CHAR16 *PathPatched,
|
||||
EFI_PHYSICAL_ADDRESS Dsdt;
|
||||
|
||||
// load if exists
|
||||
Status = LoadAcpiTable(PathPatched, gSettings.DsdtName, &Buffer, &BufferLen);
|
||||
Status = LoadAcpiTable(PathPatched, gSettings.DsdtName.wc_str(), &Buffer, &BufferLen);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
// loaded - allocate EfiACPIReclaim
|
||||
DBG("Loaded DSDT at %ls\\%ls\n", PathPatched, gSettings.DsdtName);
|
||||
DBG("Loaded DSDT at %ls\\%ls\n", PathPatched, gSettings.DsdtName.wc_str());
|
||||
Dsdt = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
|
@ -52,7 +52,7 @@ BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node)
|
||||
|
||||
AML_CHUNK* aml_create_node(AML_CHUNK* parent)
|
||||
{
|
||||
AML_CHUNK* node = (AML_CHUNK*)BllocateZeroPool(sizeof(AML_CHUNK));
|
||||
AML_CHUNK* node = (AML_CHUNK*)AllocateZeroPool(sizeof(AML_CHUNK));
|
||||
|
||||
aml_add_to_parent(parent, node);
|
||||
|
||||
@ -91,7 +91,7 @@ AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, CONST UINT8* buffer, UINT32 size)
|
||||
{
|
||||
node->Type = AML_CHUNK_NONE;
|
||||
node->Length = (UINT16)size;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
CopyMem(node->Buffer, buffer, node->Length);
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ AML_CHUNK* aml_add_byte(AML_CHUNK* parent, UINT8 value)
|
||||
node->Type = AML_CHUNK_BYTE;
|
||||
|
||||
node->Length = 1;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
node->Buffer[0] = value;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ AML_CHUNK* aml_add_word(AML_CHUNK* parent, UINT16 value)
|
||||
{
|
||||
node->Type = AML_CHUNK_WORD;
|
||||
node->Length = 2;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
node->Buffer[0] = value & 0xff;
|
||||
node->Buffer[1] = value >> 8;
|
||||
}
|
||||
@ -138,7 +138,7 @@ AML_CHUNK* aml_add_dword(AML_CHUNK* parent, UINT32 value)
|
||||
{
|
||||
node->Type = AML_CHUNK_DWORD;
|
||||
node->Length = 4;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
node->Buffer[0] = value & 0xff;
|
||||
node->Buffer[1] = (value >> 8) & 0xff;
|
||||
node->Buffer[2] = (value >> 16) & 0xff;
|
||||
@ -156,7 +156,7 @@ AML_CHUNK* aml_add_qword(AML_CHUNK* parent, UINT64 value)
|
||||
{
|
||||
node->Type = AML_CHUNK_QWORD;
|
||||
node->Length = 8;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
node->Buffer[0] = value & 0xff;
|
||||
node->Buffer[1] = RShiftU64(value, 8) & 0xff;
|
||||
node->Buffer[2] = RShiftU64(value, 16) & 0xff;
|
||||
@ -206,7 +206,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, CONST CHAR8* name)
|
||||
if (count == 1)
|
||||
{
|
||||
node->Length = (UINT16)(4 + root);
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length+4);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length+4);
|
||||
CopyMem(node->Buffer, name, 4 + root);
|
||||
offset += 4 + root;
|
||||
return (UINT32)offset;
|
||||
@ -215,7 +215,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, CONST CHAR8* name)
|
||||
if (count == 2)
|
||||
{
|
||||
node->Length = 2 + 8;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length+4);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length+4);
|
||||
node->Buffer[offset++] = 0x5c; // Root Char
|
||||
node->Buffer[offset++] = 0x2e; // Double name
|
||||
CopyMem(node->Buffer+offset, name + root, 8);
|
||||
@ -224,7 +224,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, CONST CHAR8* name)
|
||||
}
|
||||
|
||||
node->Length = (UINT16)(3 + (count << 2));
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length+4);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length+4);
|
||||
node->Buffer[offset++] = 0x5c; // Root Char
|
||||
node->Buffer[offset++] = 0x2f; // Multi name
|
||||
node->Buffer[offset++] = (CHAR8)count; // Names count
|
||||
@ -288,7 +288,7 @@ AML_CHUNK* aml_add_package(AML_CHUNK* parent)
|
||||
node->Type = AML_CHUNK_PACKAGE;
|
||||
|
||||
node->Length = 1;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
}
|
||||
|
||||
return node;
|
||||
@ -303,7 +303,7 @@ AML_CHUNK* aml_add_alias(AML_CHUNK* parent, /* CONST*/ CHAR8* name1, /* CONST*/
|
||||
node->Type = AML_CHUNK_ALIAS;
|
||||
|
||||
node->Length = 8;
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
aml_fill_simple_name(node->Buffer, name1);
|
||||
aml_fill_simple_name(node->Buffer+4, name2);
|
||||
}
|
||||
@ -385,7 +385,7 @@ AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data, UINT32
|
||||
INTN offset=0;
|
||||
node->Type = AML_CHUNK_BUFFER;
|
||||
node->Length = (UINT8)(size + 2);
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
node->Buffer[offset++] = AML_CHUNK_BYTE; //0x0A
|
||||
node->Buffer[offset++] = (CHAR8)size;
|
||||
CopyMem(node->Buffer+offset, data, node->Length);
|
||||
@ -404,7 +404,7 @@ AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, CONST CHAR8* StringBuf)
|
||||
UINTN len = AsciiStrLen(StringBuf);
|
||||
node->Type = AML_CHUNK_BUFFER;
|
||||
node->Length = (UINT8)(len + 3);
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(node->Length);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(node->Length);
|
||||
node->Buffer[offset++] = AML_CHUNK_BYTE;
|
||||
node->Buffer[offset++] = (CHAR8)(len + 1);
|
||||
CopyMem(node->Buffer+offset, StringBuf, len);
|
||||
@ -423,7 +423,7 @@ AML_CHUNK* aml_add_string(AML_CHUNK* parent, CONST CHAR8* StringBuf)
|
||||
INTN len = AsciiStrLen(StringBuf);
|
||||
node->Type = AML_CHUNK_STRING;
|
||||
node->Length = (UINT8)(len + 1);
|
||||
node->Buffer = (__typeof__(node->Buffer))BllocateZeroPool(len + 1);
|
||||
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool(len + 1);
|
||||
CopyMem(node->Buffer, StringBuf, len);
|
||||
// node->Buffer[len] = '\0';
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ AddToBootOrder (
|
||||
//
|
||||
// Make new order buffer with space for our option
|
||||
//
|
||||
BootOrderNew = (__typeof__(BootOrderNew))BllocateZeroPool((BootOrderLen + 1) * sizeof(UINT16));
|
||||
BootOrderNew = (__typeof__(BootOrderNew))AllocateZeroPool((BootOrderLen + 1) * sizeof(UINT16));
|
||||
if (BootOrderNew == NULL) {
|
||||
DBG("AddToBootOrder: EFI_OUT_OF_RESOURCES\n");
|
||||
if (BootOrder) {
|
||||
@ -647,7 +647,7 @@ CompileBootOption (
|
||||
+ BootOption->DescriptionSize
|
||||
+ BootOption->FilePathListLength
|
||||
+ BootOption->OptionalDataSize;
|
||||
BootOption->Variable = (__typeof__(BootOption->Variable))BllocateZeroPool(BootOption->VariableSize);
|
||||
BootOption->Variable = (__typeof__(BootOption->Variable))AllocateZeroPool(BootOption->VariableSize);
|
||||
if (BootOption->Variable == NULL) {
|
||||
DBG("CompileBootOption: EFI_OUT_OF_RESOURCES\n");
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
@ -83,7 +83,7 @@ typedef struct {
|
||||
UINT32 NameLen; /// 0x58 (in bytes)
|
||||
UINT32 ValLen; /// 0x5c
|
||||
UINT8 Data[1]; /// 0x60 Name Value
|
||||
} PLATFORM_DATA;
|
||||
} PLATFORM_DATA_RECORD;
|
||||
#pragma pack()
|
||||
|
||||
// CopyRecord
|
||||
@ -96,7 +96,7 @@ typedef struct {
|
||||
///
|
||||
/// @return The size of the new PLATFORM_DATA object is returned
|
||||
UINT32 EFIAPI
|
||||
CopyRecord(IN PLATFORM_DATA *Rec,
|
||||
CopyRecord(IN PLATFORM_DATA_RECORD *Rec,
|
||||
IN CONST CHAR16 *Name,
|
||||
IN VOID *Val,
|
||||
IN UINT32 ValLen)
|
||||
@ -116,29 +116,46 @@ EFI_STATUS EFIAPI
|
||||
LogDataHub(IN EFI_GUID *TypeGuid,
|
||||
IN CONST CHAR16 *Name,
|
||||
IN VOID *Data,
|
||||
IN UINT32 DataSize)
|
||||
IN UINT32 DataSize)
|
||||
{
|
||||
UINT32 RecordSize;
|
||||
EFI_STATUS Status;
|
||||
PLATFORM_DATA *PlatformData;
|
||||
PLATFORM_DATA_RECORD *platform_data_record;
|
||||
|
||||
PlatformData = (PLATFORM_DATA*)AllocatePool(sizeof(PLATFORM_DATA) + DataSize + EFI_CPU_DATA_MAXIMUM_LENGTH);
|
||||
if (PlatformData == NULL) {
|
||||
platform_data_record = (PLATFORM_DATA_RECORD*)AllocatePool(sizeof(PLATFORM_DATA_RECORD) + DataSize + EFI_CPU_DATA_MAXIMUM_LENGTH);
|
||||
if (platform_data_record == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
RecordSize = CopyRecord(PlatformData, Name, Data, DataSize);
|
||||
RecordSize = CopyRecord(platform_data_record, Name, Data, DataSize);
|
||||
Status = gDataHub->LogData(gDataHub,
|
||||
TypeGuid, // DataRecordGuid
|
||||
&gDataHubPlatformGuid, // ProducerName (always)
|
||||
EFI_DATA_RECORD_CLASS_DATA,
|
||||
PlatformData,
|
||||
platform_data_record,
|
||||
RecordSize);
|
||||
|
||||
FreePool(PlatformData);
|
||||
FreePool(platform_data_record);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS EFIAPI
|
||||
LogDataHubXString8(IN EFI_GUID *TypeGuid,
|
||||
IN CONST CHAR16 *Name,
|
||||
const XString8& s)
|
||||
{
|
||||
if ( s.sizeInBytesIncludingTerminator() > MAX_UINT32 ) panic("LogDataHub s.length > MAX_UINT32");
|
||||
return LogDataHub(TypeGuid, Name, (void*)s.c_str(), (UINT32)s.sizeInBytesIncludingTerminator());
|
||||
}
|
||||
|
||||
EFI_STATUS EFIAPI
|
||||
LogDataHubXStringW(IN EFI_GUID *TypeGuid,
|
||||
IN CONST CHAR16 *Name,
|
||||
const XStringW& s)
|
||||
{
|
||||
if ( s.sizeInBytesIncludingTerminator() > MAX_UINT32 ) panic("LogDataHub s.length > MAX_UINT32");
|
||||
return LogDataHub(TypeGuid, Name, (void*)s.wc_str(), (UINT32)s.sizeInBytesIncludingTerminator());
|
||||
}
|
||||
|
||||
|
||||
// SetVariablesForOSX
|
||||
@ -194,7 +211,6 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
|
||||
CONST CHAR16 *KbdPrevLang;
|
||||
UINTN LangLen;
|
||||
CHAR8 *VariablePtr;
|
||||
VOID *OldData;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
CHAR8 *PlatformLang;
|
||||
@ -215,15 +231,14 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
|
||||
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
|
||||
|
||||
if (gSettings.RtMLB != NULL) {
|
||||
if (AsciiStrLen(gSettings.RtMLB) != 17) {
|
||||
if (gSettings.RtMLB.notEmpty()) {
|
||||
if ( gSettings.RtMLB.length() != 17 ) {
|
||||
DBG("** Warning: Your MLB is not suitable for iMessage(must be 17 chars long) !\n");
|
||||
}
|
||||
|
||||
SetNvramVariable(L"MLB",
|
||||
SetNvramXString8(L"MLB",
|
||||
&gEfiAppleNvramGuid,
|
||||
Attributes,
|
||||
AsciiStrLen(gSettings.RtMLB),
|
||||
gSettings.RtMLB);
|
||||
}
|
||||
|
||||
@ -249,7 +264,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
&gFwFeaturesMask);
|
||||
|
||||
// HW_MLB and HW_ROM are also around on some Macs with the same values as MLB and ROM
|
||||
AddNvramVariable(L"HW_BID", &gEfiAppleNvramGuid, Attributes, AsciiStrLen(gSettings.BoardNumber), gSettings.BoardNumber);
|
||||
AddNvramXString8(L"HW_BID", &gEfiAppleNvramGuid, Attributes, gSettings.BoardNumber);
|
||||
|
||||
|
||||
//
|
||||
@ -264,17 +279,8 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
// Do not mess with prev-lang:kbd on UEFI systems without NVRAM emulation; it's OS X's business
|
||||
KbdPrevLang = L"prev-lang:kbd";
|
||||
OldData = (__typeof__(OldData))GetNvramVariable(KbdPrevLang, &gEfiAppleBootGuid, NULL, NULL);
|
||||
if (OldData == NULL) {
|
||||
LangLen = 16;
|
||||
VariablePtr = &gSettings.Language[15];
|
||||
for (LangLen = 16; ((*VariablePtr == ' ') || (*VariablePtr == 0)) && (LangLen != 0); --LangLen) {
|
||||
--VariablePtr;
|
||||
}
|
||||
|
||||
gRT->SetVariable(KbdPrevLang, &gEfiAppleBootGuid, Attributes, LangLen, &gSettings.Language);
|
||||
} else {
|
||||
FreePool(OldData);
|
||||
}
|
||||
gSettings.Language.trim();
|
||||
SetNvramXString8(KbdPrevLang, &gEfiAppleBootGuid, Attributes, gSettings.Language);
|
||||
} else {
|
||||
Attributes |= EFI_VARIABLE_NON_VOLATILE;
|
||||
}
|
||||
@ -361,9 +367,8 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
SetNvramVariable(L"bootercfg", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.BooterConfig), &gSettings.BooterConfig);
|
||||
}
|
||||
*/
|
||||
INTN CfgStrLen = AsciiStrLen(gSettings.BooterCfgStr);
|
||||
if (CfgStrLen > 0) {
|
||||
SetNvramVariable(L"bootercfg", &gEfiAppleBootGuid, Attributes, CfgStrLen+1, &gSettings.BooterCfgStr[0]);
|
||||
if ( gSettings.BooterCfgStr.notEmpty() ) {
|
||||
SetNvramXString8(L"bootercfg", &gEfiAppleBootGuid, Attributes, gSettings.BooterCfgStr);
|
||||
} else {
|
||||
DeleteNvramVariable(L"bootercfg", &gEfiAppleBootGuid);
|
||||
}
|
||||
@ -490,14 +495,14 @@ SetupDataForOSX(BOOLEAN Hibernate)
|
||||
LogDataHub(&gEfiProcessorSubClassGuid, L"CPUFrequency", &CpuSpeed, sizeof(UINT64));
|
||||
|
||||
//gSettings.BoardNumber
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"board-id", &gSettings.BoardNumber, (UINT32)iStrLen(gSettings.BoardNumber, 64) + 1);
|
||||
LogDataHubXString8(&gEfiMiscSubClassGuid, L"board-id", gSettings.BoardNumber);
|
||||
TscFrequency++;
|
||||
LogDataHub(&gEfiProcessorSubClassGuid, L"board-rev", &TscFrequency, 1);
|
||||
|
||||
DevPathSupportedVal = 1;
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"DevicePathsSupported", &DevPathSupportedVal, sizeof(UINT32));
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"Model", (VOID*)ProductName.wc_str(), (UINT32)ProductName.sizeInNativeChars());
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"SystemSerialNumber", (VOID*)SerialNumber.wc_str(), (UINT32)SerialNumber.sizeInNativeChars());
|
||||
LogDataHubXStringW(&gEfiMiscSubClassGuid, L"Model", ProductName);
|
||||
LogDataHubXStringW(&gEfiMiscSubClassGuid, L"SystemSerialNumber", SerialNumber);
|
||||
|
||||
if (gSettings.InjectSystemID) {
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"system-id", &gUuid, sizeof(EFI_GUID));
|
||||
@ -506,9 +511,9 @@ SetupDataForOSX(BOOLEAN Hibernate)
|
||||
LogDataHub(&gEfiProcessorSubClassGuid, L"clovergui-revision", &Revision, sizeof(UINT32));
|
||||
|
||||
// collect info about real hardware
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"OEMVendor", &gSettings.OEMVendor, (UINT32)iStrLen(gSettings.OEMVendor, 64) + 1);
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"OEMProduct", &gSettings.OEMProduct, (UINT32)iStrLen(gSettings.OEMProduct, 64) + 1);
|
||||
LogDataHub(&gEfiMiscSubClassGuid, L"OEMBoard", &gSettings.OEMBoard, (UINT32)iStrLen(gSettings.OEMBoard, 64) + 1);
|
||||
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMVendor", gSettings.OEMVendor);
|
||||
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMProduct", gSettings.OEMProduct);
|
||||
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMBoard", gSettings.OEMBoard);
|
||||
|
||||
// SMC helper
|
||||
if (!isRevLess) {
|
||||
|
@ -42,7 +42,7 @@
|
||||
// VA_LIST Args;
|
||||
// UINTN StringSize;
|
||||
//
|
||||
// AppendStr = (__typeof__(AppendStr))BllocateZeroPool(0x1000);
|
||||
// AppendStr = (__typeof__(AppendStr))AllocateZeroPool(0x1000);
|
||||
// if (AppendStr == NULL) {
|
||||
// return Str->Str;
|
||||
// }
|
||||
@ -52,7 +52,7 @@
|
||||
// VA_END (Args);
|
||||
// if (NULL == Str->Str) {
|
||||
// StringSize = StrSize (AppendStr);
|
||||
// Str->Str = (__typeof__(Str->Str))BllocateZeroPool(StringSize);
|
||||
// Str->Str = (__typeof__(Str->Str))AllocateZeroPool(StringSize);
|
||||
//// ASSERT (Str->Str != NULL);
|
||||
// } else {
|
||||
// StringSize = StrSize (AppendStr);
|
||||
|
@ -904,7 +904,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
if (acpi_cpu_score) {
|
||||
FreePool(acpi_cpu_score);
|
||||
}
|
||||
acpi_cpu_score = (__typeof__(acpi_cpu_score))BllocateZeroPool(128);
|
||||
acpi_cpu_score = (__typeof__(acpi_cpu_score))AllocateZeroPool(128);
|
||||
acpi_cpu_count = 0;
|
||||
// 5B 83 41 0C 5C 2E 5F 50 52 5F 43 50 55 30 01 10
|
||||
// 10 00 00 06
|
||||
@ -1054,7 +1054,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
}
|
||||
|
||||
if (add_name) {
|
||||
acpi_cpu_name[acpi_cpu_count] = (__typeof_am__(acpi_cpu_name[acpi_cpu_count]))BllocateZeroPool(5);
|
||||
acpi_cpu_name[acpi_cpu_count] = (__typeof_am__(acpi_cpu_name[acpi_cpu_count]))AllocateZeroPool(5);
|
||||
CopyMem(acpi_cpu_name[acpi_cpu_count], dsdt+offset, 4);
|
||||
acpi_cpu_processor_id[acpi_cpu_count] = dsdt[offset + 4];
|
||||
i = offset + 5;
|
||||
@ -1076,7 +1076,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
|
||||
if (!acpi_cpu_count) {
|
||||
for (i=0; i < acpi_cpu_max; i++) {
|
||||
acpi_cpu_name[i] = (__typeof_am__(acpi_cpu_name[i]))BllocateZeroPool(5);
|
||||
acpi_cpu_name[i] = (__typeof_am__(acpi_cpu_name[i]))AllocateZeroPool(5);
|
||||
snprintf(acpi_cpu_name[i], 5, "CPU%X", i);
|
||||
acpi_cpu_processor_id[i] = (UINT8)(i & 0x7F);
|
||||
}
|
||||
@ -1229,7 +1229,8 @@ BOOLEAN GetName(UINT8 *dsdt, INT32 adr, OUT CHAR8* name, OUT INTN *shift)
|
||||
|
||||
// if (CmpAdr(dsdt, j, NetworkADR1))
|
||||
// Name (_ADR, 0x90000)
|
||||
BOOLEAN CmpAdr (UINT8 *dsdt, UINT32 j, UINT32 PciAdr)
|
||||
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
|
||||
BOOLEAN CmpAdr (const T& dsdt, UINT32 j, UINT32 PciAdr)
|
||||
{
|
||||
// Name (_ADR, 0x001f0001)
|
||||
return (BOOLEAN)
|
||||
@ -1291,7 +1292,8 @@ BOOLEAN CmpPNP (UINT8 *dsdt, UINT32 j, UINT16 PNP)
|
||||
(dsdt[j + 9] == ((PNP & 0x00ff) >> 0)));
|
||||
}
|
||||
|
||||
INT32 CmpDev(UINT8 *dsdt, UINT32 i, UINT8 *Name)
|
||||
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
|
||||
INT32 CmpDev(UINT8 *dsdt, UINT32 i, const T& Name)
|
||||
{
|
||||
if ((dsdt[i+0] == Name[0]) && (dsdt[i+1] == Name[1]) &&
|
||||
(dsdt[i+2] == Name[2]) && (dsdt[i+3] == Name[3]) &&
|
||||
@ -1575,13 +1577,13 @@ BOOLEAN CustProperties(AML_CHUNK* pack, UINT32 Dev)
|
||||
}
|
||||
|
||||
//len = DeleteDevice("AZAL", dsdt, len);
|
||||
UINT32 DeleteDevice(CONST CHAR8 *Name, UINT8 *dsdt, UINT32 len)
|
||||
UINT32 DeleteDevice(const XString8& Name, UINT8 *dsdt, UINT32 len)
|
||||
{
|
||||
UINT32 i, j;
|
||||
INT32 size = 0, sizeoffset;
|
||||
MsgLog(" deleting device %s\n", Name);
|
||||
MsgLog(" deleting device %s\n", Name.c_str());
|
||||
for (i=20; i<len; i++) {
|
||||
j = CmpDev(dsdt, i, (UINT8*)Name);
|
||||
j = CmpDev(dsdt, i, Name);
|
||||
if (j != 0) {
|
||||
size = get_size(dsdt, j);
|
||||
if (!size) {
|
||||
@ -2399,7 +2401,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
|
||||
continue;
|
||||
}
|
||||
LPCBSIZE = get_size(dsdt, LPCBADR);
|
||||
device_name[3] = (__typeof_am__(device_name[3]))BllocateZeroPool(5);
|
||||
device_name[3] = (__typeof_am__(device_name[3]))AllocateZeroPool(5);
|
||||
CopyMem(device_name[3], dsdt + j, 4);
|
||||
MsgLog("found LPCB device NAME(_ADR,0x001F0000) at %X And Name is %s\n", j,
|
||||
device_name[3]);
|
||||
@ -2448,7 +2450,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root);
|
||||
lpcb = (__typeof__(lpcb))BllocateZeroPool(root->Size);
|
||||
lpcb = (__typeof__(lpcb))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, lpcb, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -2698,7 +2700,7 @@ Skip_DSM:
|
||||
//now insert video
|
||||
DBG("now inserting Video device\n");
|
||||
aml_calculate_size(root);
|
||||
display = (__typeof__(display))BllocateZeroPool(root->Size);
|
||||
display = (__typeof__(display))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, display, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -2806,7 +2808,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
|
||||
if (!devadr1) {
|
||||
continue;
|
||||
}
|
||||
device_name[11] = (__typeof_am__(device_name[11]))BllocateZeroPool(5);
|
||||
device_name[11] = (__typeof_am__(device_name[11]))AllocateZeroPool(5);
|
||||
CopyMem(device_name[11], dsdt+k, 4);
|
||||
DBG("found HDMI device [0x%08X:%X] at %X and Name is %s\n",
|
||||
HDMIADR1, HDMIADR2, devadr1, device_name[11]);
|
||||
@ -2894,7 +2896,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root);
|
||||
hdmi = (__typeof__(hdmi))BllocateZeroPool(root->Size);
|
||||
hdmi = (__typeof__(hdmi))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, hdmi, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -2975,7 +2977,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
|
||||
continue;
|
||||
}
|
||||
|
||||
device_name[1] = (__typeof_am__(device_name[1]))BllocateZeroPool(5);
|
||||
device_name[1] = (__typeof_am__(device_name[1]))AllocateZeroPool(5);
|
||||
CopyMem(device_name[1], dsdt+k, 4);
|
||||
DBG("found NetWork device [0x%08X:%X] at %X and Name is %s\n",
|
||||
NetworkADR1[card], NetworkADR2[card], NetworkADR, device_name[1]);
|
||||
@ -3087,7 +3089,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
|
||||
}
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
aml_calculate_size(root);
|
||||
network = (__typeof__(network))BllocateZeroPool(root->Size);
|
||||
network = (__typeof__(network))AllocateZeroPool(root->Size);
|
||||
if (!network) {
|
||||
return len;
|
||||
}
|
||||
@ -3155,7 +3157,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
|
||||
ArptName = FALSE;
|
||||
for (i=0x20; len >= 10 && i < len - 10; i++) {
|
||||
// AirPort Address
|
||||
if (CmpAdr(dsdt, i, ArptADR1) || CmpDev(dsdt, i, (UINT8*)gSettings.AirportBridgeDeviceName)) {
|
||||
if ( CmpAdr(dsdt, i, ArptADR1) || CmpDev(dsdt, i, gSettings.AirportBridgeDeviceName) ) {
|
||||
BrdADR = devFind(dsdt, i);
|
||||
if (!BrdADR) {
|
||||
continue;
|
||||
@ -3169,7 +3171,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
|
||||
if (!ArptADR) {
|
||||
continue;
|
||||
}
|
||||
device_name[9] = (__typeof_am__(device_name[9]))BllocateZeroPool(5);
|
||||
device_name[9] = (__typeof_am__(device_name[9]))AllocateZeroPool(5);
|
||||
CopyMem(device_name[9], dsdt+k, 4);
|
||||
DBG("found Airport device [%08X:%X] at %X And Name is %s\n",
|
||||
ArptADR1, ArptADR2, ArptADR, device_name[9]);
|
||||
@ -3278,7 +3280,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root);
|
||||
network = (__typeof__(network))BllocateZeroPool(root->Size);
|
||||
network = (__typeof__(network))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, network, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -3459,7 +3461,7 @@ UINT32 AddMCHC (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
*/
|
||||
aml_calculate_size(root);
|
||||
mchc = (__typeof__(mchc))BllocateZeroPool(root->Size);
|
||||
mchc = (__typeof__(mchc))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, mchc, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -3546,7 +3548,7 @@ UINT32 AddIMEI (UINT8 *dsdt, UINT32 len)
|
||||
}
|
||||
|
||||
aml_calculate_size(root);
|
||||
imei = (__typeof__(imei))BllocateZeroPool(root->Size);
|
||||
imei = (__typeof__(imei))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, imei, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -3604,7 +3606,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
|
||||
continue;
|
||||
}
|
||||
|
||||
device_name[2] = (__typeof_am__(device_name[2]))BllocateZeroPool(5);
|
||||
device_name[2] = (__typeof_am__(device_name[2]))AllocateZeroPool(5);
|
||||
CopyMem(device_name[2], dsdt+k, 4);
|
||||
DBG("found Firewire device NAME(_ADR,0x%08X) at %X And Name is %s\n",
|
||||
FirewireADR2, k, device_name[2]);
|
||||
@ -3689,7 +3691,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root);
|
||||
firewire = (__typeof__(firewire))BllocateZeroPool(root->Size);
|
||||
firewire = (__typeof__(firewire))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, firewire, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -3742,7 +3744,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, const XString8& OSVersion)
|
||||
}
|
||||
|
||||
// BridgeSize = get_size(dsdt, HDAADR);
|
||||
device_name[4] = (__typeof_am__(device_name[4]))BllocateZeroPool(5);
|
||||
device_name[4] = (__typeof_am__(device_name[4]))AllocateZeroPool(5);
|
||||
CopyMem(device_name[4], dsdt+i, 4);
|
||||
DBG("found HDA device NAME(_ADR,0x%08X) And Name is %s\n",
|
||||
HDAADR1, device_name[4]);
|
||||
@ -3805,7 +3807,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, const XString8& OSVersion)
|
||||
*/
|
||||
}
|
||||
aml_calculate_size(root);
|
||||
hdef = (__typeof__(hdef))BllocateZeroPool(root->Size);
|
||||
hdef = (__typeof__(hdef))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, hdef, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -3878,7 +3880,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
aml_calculate_size(root);
|
||||
|
||||
USBDATA1 = (__typeof__(USBDATA1))BllocateZeroPool(root->Size);
|
||||
USBDATA1 = (__typeof__(USBDATA1))AllocateZeroPool(root->Size);
|
||||
size1 = root->Size;
|
||||
// DBG("USB1 code size = 0x%08X\n", size1);
|
||||
aml_write_node(root, USBDATA1, 0);
|
||||
@ -3951,7 +3953,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root1);
|
||||
USBDATA2 = (__typeof__(USBDATA2))BllocateZeroPool(root1->Size);
|
||||
USBDATA2 = (__typeof__(USBDATA2))AllocateZeroPool(root1->Size);
|
||||
size2 = root1->Size;
|
||||
// DBG("USB2 code size = 0x%08X\n", size2);
|
||||
aml_write_node(root1, USBDATA2, 0);
|
||||
@ -3959,7 +3961,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
|
||||
//NFORCE_USB_START -- already done Intel or NForce same USBDATA2
|
||||
/* aml_calculate_size(root1);
|
||||
USBDATA4 = (__typeof__(USBDATA4))BllocateZeroPool(root1->Size);
|
||||
USBDATA4 = (__typeof__(USBDATA4))AllocateZeroPool(root1->Size);
|
||||
size4 = root1->Size;
|
||||
DBG("USB OHCI code size = 0x%08X\n", size4);
|
||||
aml_write_node(root1, USBDATA4, 0);
|
||||
@ -4000,7 +4002,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root1);
|
||||
USBDATA3 = (__typeof__(USBDATA3))BllocateZeroPool(root1->Size);
|
||||
USBDATA3 = (__typeof__(USBDATA3))AllocateZeroPool(root1->Size);
|
||||
size3 = root1->Size;
|
||||
// DBG("USB3 code size = 0x%08X\n", size3);
|
||||
aml_write_node(root1, USBDATA3, 0);
|
||||
@ -4015,7 +4017,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
for (j = 0x20; len >= 4 && j < len - 4; j++) {
|
||||
if (CmpAdr(dsdt, j, USBADR[i])) { //j+4 -> _ADR
|
||||
XhciName = FALSE;
|
||||
UsbName[i] = (__typeof_am__(UsbName[i]))BllocateZeroPool(5);
|
||||
UsbName[i] = (__typeof_am__(UsbName[i]))AllocateZeroPool(5);
|
||||
// DBG("found USB at 0x%X\n", j);
|
||||
adr1 = devFind(dsdt, j + 2);
|
||||
if (!adr1) {
|
||||
@ -4032,7 +4034,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
continue;
|
||||
}
|
||||
|
||||
device_name[10] = (__typeof_am__(device_name[10]))BllocateZeroPool(5);
|
||||
device_name[10] = (__typeof_am__(device_name[10]))AllocateZeroPool(5);
|
||||
CopyMem(device_name[10], dsdt+k, 4);
|
||||
DBG("found USB device [%08X:%X] at %X and Name was %s ->",
|
||||
USBADR[i], USBADR2[i], k, device_name[10]);
|
||||
@ -4147,7 +4149,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
|
||||
}
|
||||
//NFORCE_USB_START
|
||||
else if (CmpAdr(dsdt, j, USBADR3[i])) {
|
||||
UsbName[i] = (__typeof_am__(UsbName[i]))BllocateZeroPool(5);
|
||||
UsbName[i] = (__typeof_am__(UsbName[i]))AllocateZeroPool(5);
|
||||
CopyMem(UsbName[i], dsdt+j, 4);
|
||||
|
||||
adr1 = devFind(dsdt, j);
|
||||
@ -4347,7 +4349,7 @@ UINT32 FIXIDE (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root);
|
||||
ide = (__typeof__(ide))BllocateZeroPool(root->Size);
|
||||
ide = (__typeof__(ide))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, ide, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -4452,7 +4454,7 @@ UINT32 FIXSATAAHCI (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root);
|
||||
sata = (__typeof__(sata))BllocateZeroPool(root->Size);
|
||||
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, sata, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -4543,7 +4545,7 @@ UINT32 FIXSATA (UINT8 *dsdt, UINT32 len)
|
||||
// finish Method(_DSM,4,NotSerialized)
|
||||
|
||||
aml_calculate_size(root);
|
||||
sata = (__typeof__(sata))BllocateZeroPool(root->Size);
|
||||
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
|
||||
sizeoffset = root->Size;
|
||||
aml_write_node(root, sata, 0);
|
||||
aml_destroy_node(root);
|
||||
@ -4886,7 +4888,7 @@ UINT32 FIXOTHER (UINT8 *dsdt, UINT32 len)
|
||||
for (i=0; i<len-5; i++) {
|
||||
if (CmpAdr(dsdt, i, USBADR[j])) {
|
||||
// get USB name
|
||||
UsbName[j] = (__typeof__(UsbName[j]))BllocateZeroPool(5);
|
||||
UsbName[j] = (__typeof__(UsbName[j]))AllocateZeroPool(5);
|
||||
CopyMem(UsbName[j], dsdt+i, 4);
|
||||
DBG("found USB device NAME(_ADR,0x%08hhX) And Name is %s\n",
|
||||
USBADR[j], UsbName[j]);
|
||||
@ -5107,7 +5109,7 @@ VOID GetBiosRegions(UINT8 *buffer)
|
||||
}
|
||||
}
|
||||
if (tmp.Address) {
|
||||
OPER_REGION *newRegion = (__typeof__(newRegion))BllocateZeroPool(sizeof(OPER_REGION));
|
||||
OPER_REGION *newRegion = (__typeof__(newRegion))AllocateZeroPool(sizeof(OPER_REGION));
|
||||
MsgLog("Found OperationRegion(%s, SystemMemory, %X, ...)\n", tmp.Name, tmp.Address);
|
||||
*newRegion = tmp;
|
||||
newRegion->next = gRegions;
|
||||
@ -5506,15 +5508,15 @@ VOID FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c
|
||||
// DsdtLen = FIXGPE(temp, DsdtLen);
|
||||
if ((gSettings.FixDsdt & FIX_UNUSED)) {
|
||||
//I want these fixes even if no Display fix. We have GraphicsInjector
|
||||
DsdtLen = DeleteDevice("CRT_", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("DVI_", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("CRT_"_XS8, temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("DVI_"_XS8, temp, DsdtLen);
|
||||
//good company
|
||||
DsdtLen = DeleteDevice("SPKR", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("ECP_", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("LPT_", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("FDC0", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("ECP1", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("LPT1", temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("SPKR"_XS8, temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("ECP_"_XS8, temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("LPT_"_XS8, temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("FDC0"_XS8, temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("ECP1"_XS8, temp, DsdtLen);
|
||||
DsdtLen = DeleteDevice("LPT1"_XS8, temp, DsdtLen);
|
||||
}
|
||||
|
||||
if ((gSettings.FixDsdt & FIX_ACST)) {
|
||||
|
@ -412,7 +412,7 @@ EFI_STATUS SaveHdaDumpBin()
|
||||
HdaCodec.WidgetCount = AudioFuncGroup->WidgetsCount;
|
||||
|
||||
// Allocate space for codec data
|
||||
HdaCodecData = (__typeof__(HdaCodecData))BllocateZeroPool(HdaCodecDataSize);
|
||||
HdaCodecData = (__typeof__(HdaCodecData))AllocateZeroPool(HdaCodecDataSize);
|
||||
HdaCodecDataPtr = HdaCodecData;
|
||||
|
||||
if (!HdaCodecData)
|
||||
|
@ -415,12 +415,12 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
|
||||
if (dict2) {
|
||||
prop = GetProperty(dict2, "Hibernate File");
|
||||
if (prop && prop->type == kTagTypeString ) {
|
||||
if (AsciiStrStr(prop->string, "/Volumes/")) {
|
||||
if (prop->string.contains("/Volumes/")) {
|
||||
CHAR8 *VolNameStart = NULL, *VolNameEnd = NULL;
|
||||
XStringW VolName;
|
||||
UINTN VolNameSize = 0;
|
||||
// Extract Volumes Name
|
||||
VolNameStart = AsciiStrStr(prop->string + 1, "/") + 1;
|
||||
VolNameStart = AsciiStrStr(prop->string.c_str() + 1, "/") + 1;
|
||||
if (VolNameStart) {
|
||||
VolNameEnd = AsciiStrStr(VolNameStart, "/");
|
||||
if (VolNameEnd) {
|
||||
@ -438,10 +438,10 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
|
||||
ImageVolume = Volume;
|
||||
}
|
||||
}
|
||||
} else if (AsciiStrStr(prop->string, "/var") && !AsciiStrStr(prop->string, "private")) {
|
||||
SleepImageName = SWPrintf("\\private%s", prop->string);
|
||||
} else if ( prop->string.contains("/var") && !prop->string.contains("private")) {
|
||||
SleepImageName = SWPrintf("\\private%s", prop->string.c_str());
|
||||
} else {
|
||||
SleepImageName = SWPrintf("%s", prop->string);
|
||||
SleepImageName = SWPrintf("%s", prop->string.c_str());
|
||||
}
|
||||
wchar_t* p = SleepImageName.data(0);
|
||||
while (*p) {
|
||||
|
@ -58,7 +58,7 @@ CHAR8* gDeviceProperties = NULL;
|
||||
|
||||
UINT32 cPropSize = 0;
|
||||
UINT8* cProperties = NULL;
|
||||
CHAR8* cDeviceProperties = NULL;
|
||||
XString8 cDeviceProperties;
|
||||
CHAR8* BootOSName = NULL;
|
||||
|
||||
UINT16 KeyboardVendor = 0x05ac; //Apple inc.
|
||||
|
@ -15,7 +15,7 @@ extern UINT8 *mProperties;
|
||||
extern CHAR8 *gDeviceProperties;
|
||||
extern UINT32 cPropSize;
|
||||
extern UINT8 *cProperties;
|
||||
extern CHAR8 *cDeviceProperties;
|
||||
extern XString8 cDeviceProperties;
|
||||
extern CHAR8 *BootOSName;
|
||||
extern OC_ABC_SETTINGS gQuirks;
|
||||
|
||||
|
@ -98,8 +98,8 @@ GetEfiTimeInMs (
|
||||
VOID *GetNvramVariable(
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL)
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Data = NULL;
|
||||
@ -108,7 +108,7 @@ VOID *GetNvramVariable(
|
||||
//
|
||||
UINTN IntDataSize = 0;
|
||||
|
||||
Status = gRT->GetVariable (VariableName, VendorGuid, Attributes, &IntDataSize, NULL);
|
||||
Status = gRT->GetVariable (VariableName, VendorGuid, Attributes, &IntDataSize, NULL);
|
||||
if (IntDataSize == 0) {
|
||||
return NULL;
|
||||
}
|
||||
@ -117,7 +117,7 @@ VOID *GetNvramVariable(
|
||||
//
|
||||
// Allocate the buffer to return
|
||||
//
|
||||
Data = (__typeof__(Data))BllocateZeroPool(IntDataSize + 1);
|
||||
Data = (__typeof__(Data))AllocateZeroPool(IntDataSize + 1);
|
||||
if (Data != NULL) {
|
||||
//
|
||||
// Read variable into the allocated buffer.
|
||||
@ -136,6 +136,42 @@ VOID *GetNvramVariable(
|
||||
return Data;
|
||||
}
|
||||
|
||||
/** Reads and returns value of NVRAM variable. */
|
||||
XString8 GetNvramVariableAsXString8(
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
XString8 returnValue;
|
||||
//
|
||||
// Pass in a zero size buffer to find the required buffer size.
|
||||
//
|
||||
UINTN IntDataSize = 0;
|
||||
|
||||
Status = gRT->GetVariable (VariableName, VendorGuid, Attributes, &IntDataSize, NULL);
|
||||
if (IntDataSize == 0) {
|
||||
return NullXString8;
|
||||
}
|
||||
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
//
|
||||
// Read variable into the allocated buffer.
|
||||
//
|
||||
Status = gRT->GetVariable(VariableName, VendorGuid, Attributes, &IntDataSize, returnValue.dataSized(IntDataSize+1));
|
||||
if (EFI_ERROR(Status)) {
|
||||
IntDataSize = 0;
|
||||
returnValue.setEmpty();
|
||||
}
|
||||
}
|
||||
if (DataSize != NULL) {
|
||||
*DataSize = IntDataSize;
|
||||
}
|
||||
*returnValue.data(IntDataSize) = 0;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
/** Sets NVRAM variable. Does nothing if variable with the same data and attributes already exists. */
|
||||
EFI_STATUS
|
||||
@ -179,9 +215,19 @@ SetNvramVariable (
|
||||
//DBG(" -> writing new (%s)\n", strerror(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
|
||||
SetNvramXString8 (
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
const XString8& s
|
||||
)
|
||||
{
|
||||
return SetNvramVariable(VariableName, VendorGuid, Attributes, s.sizeInBytes(), (void*)s.c_str());
|
||||
}
|
||||
|
||||
/** Sets NVRAM variable. Does nothing if variable with the same name already exists. */
|
||||
EFI_STATUS
|
||||
@ -200,7 +246,7 @@ AddNvramVariable (
|
||||
if (OldData == NULL)
|
||||
{
|
||||
// set new value
|
||||
return gRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||
return gRT->SetVariable(VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||
// DBG(" -> writing new (%s)\n", strerror(Status));
|
||||
} else {
|
||||
FreePool(OldData);
|
||||
@ -208,6 +254,16 @@ AddNvramVariable (
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
AddNvramXString8(
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
const XString8& s
|
||||
)
|
||||
{
|
||||
return AddNvramVariable(VariableName, VendorGuid, Attributes, s.sizeInBytes(), (void*)s.c_str());
|
||||
}
|
||||
|
||||
/** Deletes NVRAM variable. */
|
||||
EFI_STATUS
|
||||
@ -290,7 +346,7 @@ ResetNativeNvram ()
|
||||
//DbgHeader("ResetNativeNvram: cleanup NVRAM variables");
|
||||
|
||||
NameSize = sizeof (CHAR16);
|
||||
Name = (__typeof__(Name))BllocateZeroPool(NameSize);
|
||||
Name = (__typeof__(Name))AllocateZeroPool(NameSize);
|
||||
if (Name == NULL) {
|
||||
return Status;
|
||||
}
|
||||
@ -419,7 +475,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
|
||||
|
||||
|
||||
NameSize = sizeof (CHAR16);
|
||||
Name = (__typeof__(Name))BllocateZeroPool(NameSize);
|
||||
Name = (__typeof__(Name))AllocateZeroPool(NameSize);
|
||||
if (Name == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -1004,45 +1060,45 @@ PutNvramPlistToRtVars ()
|
||||
// DBG("tag: %s\n", Tag->string);
|
||||
// skip OsxAptioFixDrv-RelocBase - appears and causes trouble
|
||||
// in kernel and kext patcher when mixing UEFI and CloverEFI boot
|
||||
if (AsciiStrCmp(Tag->string, "OsxAptioFixDrv-RelocBase") == 0) {
|
||||
if ( Tag->string == "OsxAptioFixDrv-RelocBase"_XS8 ) {
|
||||
DBG(" Skipping OsxAptioFixDrv-RelocBase\n");
|
||||
continue;
|
||||
} else if (AsciiStrCmp(Tag->string, "OsxAptioFixDrv-ErrorExitingBootServices") == 0) {
|
||||
} else if ( Tag->string == "OsxAptioFixDrv-ErrorExitingBootServices"_XS8 ) {
|
||||
DBG(" Skipping OsxAptioFixDrv-ErrorExitingBootServices\n");
|
||||
continue;
|
||||
} else if (AsciiStrCmp(Tag->string, "EmuVariableUefiPresent") == 0) {
|
||||
} else if ( Tag->string == "EmuVariableUefiPresent"_XS8 ) {
|
||||
DBG(" Skipping EmuVariableUefiPresent\n");
|
||||
continue;
|
||||
} else if (AsciiStrCmp(Tag->string, "aapl,panic-info") == 0) {
|
||||
} else if ( Tag->string == "aapl,panic-info"_XS8 ) {
|
||||
DBG(" Skipping aapl,panic-info\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
// key to unicode; check if key buffer is large enough
|
||||
if (AsciiStrLen(Tag->string) > (sizeof(KeyBuf) / 2 - 1)) {
|
||||
DBG(" ERROR: Skipping too large key %s\n", Tag->string);
|
||||
if ( Tag->string.length() > sizeof(KeyBuf) - 1 ) {
|
||||
DBG(" ERROR: Skipping too large key %s\n", Tag->string.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (AsciiStrCmp(Tag->string, "Boot0082") == 0 || AsciiStrCmp(Tag->string, "BootNext") == 0) {
|
||||
if ( Tag->string == "Boot0082"_XS8 || Tag->string == "BootNext"_XS8 ) {
|
||||
VendorGuid = &gEfiGlobalVariableGuid;
|
||||
// it may happen only in this case
|
||||
GlobalConfig.HibernationFixup = TRUE;
|
||||
}
|
||||
|
||||
AsciiStrToUnicodeStrS(Tag->string, KeyBuf, 128);
|
||||
// AsciiStrToUnicodeStrS(Tag->string, KeyBuf, 128);
|
||||
if (!GlobalConfig.DebugLog) {
|
||||
DBG(" Adding Key: %ls: ", KeyBuf);
|
||||
DBG(" Adding Key: %s: ", Tag->string.c_str());
|
||||
}
|
||||
// process value tag
|
||||
|
||||
if (ValTag->type == kTagTypeString) {
|
||||
|
||||
// <string> element
|
||||
Value = ValTag->string;
|
||||
Size = AsciiStrLen((CONST CHAR8*)Value);
|
||||
Value = (void*)ValTag->string.c_str();
|
||||
Size = ValTag->string.length();
|
||||
if (!GlobalConfig.DebugLog) {
|
||||
DBG("String: Size = %lld, Val = '%s'\n", Size, (__typeof__(ValTag->string))Value);
|
||||
DBG("String: Size = %lld, Val = '%s'\n", Size, ValTag->string.c_str());
|
||||
}
|
||||
|
||||
} else if (ValTag->type == kTagTypeData) {
|
||||
@ -1053,14 +1109,14 @@ PutNvramPlistToRtVars ()
|
||||
if (!GlobalConfig.DebugLog) {
|
||||
DBG("Size = %lld, Data: ", Size);
|
||||
for (i = 0; i < Size; i++) {
|
||||
DBG("%02hhX ", *((__typeof__(ValTag->string))Value + i));
|
||||
DBG("%02hhX ", *(((UINT8*)Value) + i));
|
||||
}
|
||||
}
|
||||
if (!GlobalConfig.DebugLog) {
|
||||
DBG("\n");
|
||||
}
|
||||
} else {
|
||||
DBG("ERROR: Unsupported tag type: %llu\n", ValTag->type);
|
||||
DBG("ERROR: Unsupported tag type: %llu\n", ValTag->type);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1380,7 +1436,7 @@ EFI_STATUS SetStartupDiskVolume (
|
||||
"</dict>"
|
||||
"</dict></array>", strguid(Guid));
|
||||
DBG (" * efi-boot-device: %s\n", EfiBootDevice.c_str());
|
||||
Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, EfiBootDevice.sizeInBytes(), EfiBootDevice.c_str());
|
||||
Status = SetNvramXString8(L"efi-boot-device", &gEfiAppleBootGuid, Attributes, EfiBootDevice);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -25,11 +25,17 @@ FindStartupDiskVolume (
|
||||
|
||||
VOID
|
||||
*GetNvramVariable(
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL
|
||||
);
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL
|
||||
);
|
||||
XString8 GetNvramVariableAsXString8(
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
AddNvramVariable (
|
||||
@ -39,6 +45,13 @@ AddNvramVariable (
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data
|
||||
);
|
||||
EFI_STATUS
|
||||
AddNvramXString8 (
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
const XString8& s
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SetNvramVariable (
|
||||
@ -48,6 +61,13 @@ SetNvramVariable (
|
||||
IN UINTN DataSize,
|
||||
IN CONST VOID *Data
|
||||
);
|
||||
EFI_STATUS
|
||||
SetNvramXString8 (
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
const XString8& s
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
DeleteNvramVariable (
|
||||
|
@ -44,6 +44,6 @@ Headers collection for procedures
|
||||
|
||||
|
||||
// Jief : temporary rename
|
||||
#define BllocateZeroPool AllocateZeroPool
|
||||
#define AllocateZeroPool AllocateZeroPool
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -211,42 +211,42 @@ public:
|
||||
DEV_PROPERTY& operator=(const DEV_PROPERTY&) = delete;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic error "-Wpadded"
|
||||
//#pragma GCC diagnostic error "-Wpadded"
|
||||
|
||||
class SETTINGS_DATA {
|
||||
public:
|
||||
// SMBIOS TYPE0
|
||||
CHAR8 VendorName[64];
|
||||
CHAR8 RomVersion[64];
|
||||
XString8 VendorName;
|
||||
XString8 RomVersion;
|
||||
XString8 EfiVersion;
|
||||
CHAR8 ReleaseDate[64];
|
||||
XString8 ReleaseDate;
|
||||
// SMBIOS TYPE1
|
||||
CHAR8 ManufactureName[64];
|
||||
CHAR8 ProductName[64];
|
||||
CHAR8 VersionNr[64];
|
||||
CHAR8 SerialNr[64];
|
||||
XString8 ManufactureName;
|
||||
XString8 ProductName;
|
||||
XString8 VersionNr;
|
||||
XString8 SerialNr;
|
||||
EFI_GUID SmUUID;
|
||||
BOOLEAN SmUUIDConfig;
|
||||
CHAR8 pad0[7];
|
||||
//CHAR8 Uuid[64];
|
||||
//CHAR8 SKUNumber[64];
|
||||
CHAR8 FamilyName[64];
|
||||
CHAR8 OEMProduct[64];
|
||||
CHAR8 OEMVendor[64];
|
||||
//CHAR8 Uuid;
|
||||
//CHAR8 SKUNumber;
|
||||
XString8 FamilyName;
|
||||
XString8 OEMProduct;
|
||||
XString8 OEMVendor;
|
||||
// SMBIOS TYPE2
|
||||
CHAR8 BoardManufactureName[64];
|
||||
CHAR8 BoardSerialNumber[64];
|
||||
CHAR8 BoardNumber[64]; //Board-ID
|
||||
CHAR8 LocationInChassis[64];
|
||||
CHAR8 BoardVersion[64];
|
||||
CHAR8 OEMBoard[64];
|
||||
XString8 BoardManufactureName;
|
||||
XString8 BoardSerialNumber;
|
||||
XString8 BoardNumber; //Board-ID
|
||||
XString8 LocationInChassis;
|
||||
XString8 BoardVersion;
|
||||
XString8 OEMBoard;
|
||||
UINT8 BoardType;
|
||||
UINT8 pad1;
|
||||
// SMBIOS TYPE3
|
||||
BOOLEAN Mobile;
|
||||
UINT8 ChassisType;
|
||||
CHAR8 ChassisManufacturer[64];
|
||||
CHAR8 ChassisAssetTag[64];
|
||||
XString8 ChassisManufacturer;
|
||||
XString8 ChassisAssetTag;
|
||||
// SMBIOS TYPE4
|
||||
UINT32 CpuFreqMHz;
|
||||
UINT32 BusSpeed; //in kHz
|
||||
@ -258,10 +258,10 @@ public:
|
||||
UINT16 SmbiosVersion;
|
||||
INT8 Attribute;
|
||||
INT8 pad17[1];
|
||||
CHAR8 MemoryManufacturer[64];
|
||||
CHAR8 MemorySerialNumber[64];
|
||||
CHAR8 MemoryPartNumber[64];
|
||||
CHAR8 MemorySpeed[64];
|
||||
XString8 MemoryManufacturer;
|
||||
XString8 MemorySerialNumber;
|
||||
XString8 MemoryPartNumber;
|
||||
XString8 MemorySpeed;
|
||||
// SMBIOS TYPE131
|
||||
UINT16 CpuType;
|
||||
// SMBIOS TYPE132
|
||||
@ -280,14 +280,15 @@ public:
|
||||
BOOLEAN NoRomInfo;
|
||||
|
||||
// OS parameters
|
||||
CHAR8 Language[16];
|
||||
CHAR8 BootArgs[256];
|
||||
INT8 pad19[1];
|
||||
CHAR16 CustomUuid[40];
|
||||
INT8 pad181[7];
|
||||
XString8 Language;
|
||||
XString8 BootArgs;
|
||||
INT8 pad19[2];
|
||||
XStringW CustomUuid;
|
||||
|
||||
INT8 pad20[6];
|
||||
CHAR16 *DefaultVolume;
|
||||
CHAR16 *DefaultLoader;
|
||||
XStringW DefaultVolume;
|
||||
XStringW DefaultLoader;
|
||||
//Boot
|
||||
BOOLEAN LastBootedVolume;
|
||||
BOOLEAN SkipHibernateTimeout;
|
||||
@ -342,7 +343,7 @@ public:
|
||||
BOOLEAN EnableC7;
|
||||
UINT8 SavingMode;
|
||||
|
||||
CHAR16 DsdtName[28];
|
||||
XStringW DsdtName;
|
||||
UINT32 FixDsdt;
|
||||
UINT8 MinMultiplier;
|
||||
UINT8 MaxMultiplier;
|
||||
@ -391,7 +392,7 @@ public:
|
||||
UINT8 EdidFixVideoInputSignal;
|
||||
|
||||
UINT8 pad26[1];
|
||||
CHAR16 FBName[16];
|
||||
XStringW FBName;
|
||||
UINT16 VideoPorts;
|
||||
BOOLEAN NvidiaGeneric;
|
||||
BOOLEAN NvidiaNoEFI;
|
||||
@ -436,7 +437,7 @@ public:
|
||||
// UINT8 pad61[2];
|
||||
|
||||
// LegacyBoot
|
||||
CHAR16 LegacyBoot[32];
|
||||
XStringW LegacyBoot;
|
||||
UINT16 LegacyBiosDefaultEntry;
|
||||
|
||||
//SkyLake
|
||||
@ -454,7 +455,7 @@ public:
|
||||
BOOLEAN KextPatchesAllowed;
|
||||
BOOLEAN KernelPatchesAllowed; //From GUI: Only for user patches, not internal Clover
|
||||
|
||||
CHAR8 AirportBridgeDeviceName[5];
|
||||
XString8 AirportBridgeDeviceName;
|
||||
|
||||
// Pre-language
|
||||
BOOLEAN KbdPrevLang;
|
||||
@ -475,13 +476,13 @@ public:
|
||||
|
||||
// SysVariables
|
||||
UINT8 pad30[4];
|
||||
CHAR8 *RtMLB;
|
||||
XString8 RtMLB;
|
||||
UINT8 *RtROM;
|
||||
UINTN RtROMLen;
|
||||
|
||||
UINT32 CsrActiveConfig;
|
||||
UINT16 BooterConfig;
|
||||
CHAR8 BooterCfgStr[64];
|
||||
XString8 BooterCfgStr;
|
||||
BOOLEAN DisableCloverHotkeys;
|
||||
BOOLEAN NeverDoRecovery;
|
||||
|
||||
@ -618,7 +619,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wpadded"
|
||||
//#pragma GCC diagnostic ignored "-Wpadded"
|
||||
|
||||
typedef enum {
|
||||
english = 0, //en
|
||||
|
@ -185,7 +185,7 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
|
||||
// DBG("not found wave data\n");
|
||||
goto DONE_ERROR;
|
||||
}
|
||||
// TempData = (__typeof__(TempData))BllocateZeroPool(Len * sizeof(INT16));
|
||||
// TempData = (__typeof__(TempData))AllocateZeroPool(Len * sizeof(INT16));
|
||||
TempData = (__typeof__(TempData))AllocateAlignedPages(EFI_SIZE_TO_PAGES(Len + 4095), 128);
|
||||
Tmp = *(Ptr++);
|
||||
for (Ind = 0; Ind < WaveData.SamplesLength / 2 - 1; Ind++) {
|
||||
|
@ -463,7 +463,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
aml_calculate_size(root);
|
||||
|
||||
ssdt = (SSDT_TABLE *)BllocateZeroPool(root->Size);
|
||||
ssdt = (SSDT_TABLE *)AllocateZeroPool(root->Size);
|
||||
aml_write_node(root, (CHAR8*)ssdt, 0);
|
||||
ssdt->Length = root->Size;
|
||||
FixChecksum(ssdt);
|
||||
@ -682,7 +682,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
|
||||
aml_calculate_size(root);
|
||||
|
||||
ssdt = (SSDT_TABLE *)BllocateZeroPool(root->Size);
|
||||
ssdt = (SSDT_TABLE *)AllocateZeroPool(root->Size);
|
||||
|
||||
aml_write_node(root, (CHAR8*)ssdt, 0);
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
// }
|
||||
//}
|
||||
|
||||
UINT8 hexstrtouint8 (CHAR8* buf)
|
||||
UINT8 hexstrtouint8 (const CHAR8* buf)
|
||||
{
|
||||
INT8 i = 0;
|
||||
if (IS_DIGIT(buf[0]))
|
||||
@ -60,7 +60,7 @@ BOOLEAN IsHexDigit (CHAR8 c) {
|
||||
|
||||
//out value is a number of byte. out = len
|
||||
|
||||
UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len) //assume len = number of UINT8 values
|
||||
UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len) //assume len = number of UINT8 values
|
||||
{
|
||||
CHAR8 *p;
|
||||
UINT32 i, outlen = 0;
|
||||
|
@ -36,10 +36,39 @@
|
||||
|
||||
|
||||
////VOID LowCase (IN OUT CHAR8 *Str);
|
||||
UINT32 hex2bin(IN CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
|
||||
UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len);
|
||||
BOOLEAN IsHexDigit (CHAR8 c);
|
||||
UINT8 hexstrtouint8 (CHAR8* buf); //one or two hex letters to one byte
|
||||
UINT8 hexstrtouint8 (CONST CHAR8* buf); //one or two hex letters to one byte
|
||||
XString8 Bytes2HexStr(UINT8 *data, UINTN len);
|
||||
|
||||
inline
|
||||
UINT64
|
||||
EFIAPI
|
||||
AsciiStrHexToUint64 (
|
||||
const XString8& String
|
||||
)
|
||||
{
|
||||
return AsciiStrHexToUint64(String.c_str());
|
||||
}
|
||||
|
||||
inline
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiStrHexToUintn (
|
||||
const XString8& String
|
||||
)
|
||||
{
|
||||
return AsciiStrHexToUintn(String.c_str());
|
||||
}
|
||||
|
||||
inline
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiStrDecimalToUintn (
|
||||
const XString8& String
|
||||
)
|
||||
{
|
||||
return AsciiStrDecimalToUintn(String.c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1320,7 +1320,7 @@ BOOLEAN get_nameparent_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
//static CHAR8 pciName[15];
|
||||
BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
{
|
||||
CHAR8* pciName = (__typeof__(pciName))BllocateZeroPool(15);
|
||||
CHAR8* pciName = (__typeof__(pciName))AllocateZeroPool(15);
|
||||
|
||||
if (!card->info->model_name || !gSettings.FakeATI) {
|
||||
return FALSE;
|
||||
@ -1335,7 +1335,7 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
|
||||
BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
{
|
||||
CHAR8 *ModelName = (__typeof__(ModelName))BllocateZeroPool(35);
|
||||
CHAR8 *ModelName = (__typeof__(ModelName))AllocateZeroPool(35);
|
||||
if (!card->info->model_name) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -1507,7 +1507,7 @@ BOOLEAN get_refclk_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
|
||||
BOOLEAN get_platforminfo_val(value_t *val, INTN index, BOOLEAN Sier)
|
||||
{
|
||||
val->data = (__typeof__(val->data))BllocateZeroPool(0x80);
|
||||
val->data = (__typeof__(val->data))AllocateZeroPool(0x80);
|
||||
if (!val->data)
|
||||
return FALSE;
|
||||
|
||||
@ -1550,7 +1550,7 @@ VOID devprop_add_list(AtiDevProp devprop_list[], const XString8& OSVersion)
|
||||
{
|
||||
INTN i, pnum;
|
||||
BOOLEAN Sier;
|
||||
value_t *val = (__typeof__(val))BllocateZeroPool(sizeof(value_t));
|
||||
value_t *val = (__typeof__(val))AllocateZeroPool(sizeof(value_t));
|
||||
|
||||
Sier = (AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.12"_XS8));
|
||||
|
||||
@ -1655,7 +1655,7 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id)
|
||||
}
|
||||
DBG("Loaded ROM len=%llu\n", bufferLen);
|
||||
card->rom_size = (UINT32)bufferLen;
|
||||
card->rom = (__typeof__(card->rom))BllocateZeroPool(bufferLen);
|
||||
card->rom = (__typeof__(card->rom))AllocateZeroPool(bufferLen);
|
||||
if (!card->rom) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -1736,7 +1736,7 @@ BOOLEAN read_vbios(BOOLEAN from_pci)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
card->rom = (__typeof__(card->rom))BllocateZeroPool(card->rom_size);
|
||||
card->rom = (__typeof__(card->rom))AllocateZeroPool(card->rom_size);
|
||||
if (!card->rom) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -1905,7 +1905,7 @@ BOOLEAN devprop_add_pci_config_space(VOID)
|
||||
{
|
||||
int offset;
|
||||
|
||||
UINT8 *config_space = (__typeof__(config_space))BllocateZeroPool(0x100);
|
||||
UINT8 *config_space = (__typeof__(config_space))AllocateZeroPool(0x100);
|
||||
if (!config_space)
|
||||
return FALSE;
|
||||
|
||||
@ -1924,7 +1924,6 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
|
||||
BOOLEAN add_vbios = gSettings.LoadVBios;
|
||||
CHAR8 *name;
|
||||
CHAR8 *name_parent;
|
||||
CHAR8 *CfgName;
|
||||
// CHAR8 *model;
|
||||
INTN NameLen = 0;
|
||||
UINTN i, j;
|
||||
@ -1932,7 +1931,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
|
||||
UINTN ExpansionRom = 0;
|
||||
UINTN Reg1, Reg3, Reg5;
|
||||
|
||||
card = (__typeof__(card))BllocateZeroPool(sizeof(card_t));
|
||||
card = (__typeof__(card))AllocateZeroPool(sizeof(card_t));
|
||||
if (!card) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -2025,12 +2024,10 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
|
||||
|
||||
card->flags |= FLAGNOTFAKE;
|
||||
|
||||
NameLen = StrLen(gSettings.FBName);
|
||||
NameLen = gSettings.FBName.length();
|
||||
if (NameLen > 2) { //fool proof: cfg_name is 3 character or more.
|
||||
CfgName = (__typeof__(CfgName))BllocateZeroPool(NameLen);
|
||||
UnicodeStrToAsciiStrS((CHAR16*)&gSettings.FBName[0], CfgName, 16);
|
||||
DBG("Users config name %s\n", CfgName);
|
||||
card->cfg_name = CfgName;
|
||||
card->cfg_name = S8Printf("%ls", gSettings.FBName.wc_str()).forgetDataWithoutFreeing();
|
||||
DBG("Users config name %s\n", card->cfg_name);
|
||||
} else {
|
||||
// use cfg_name on radeon_cards, to retrive the default name from card_configs,
|
||||
card->cfg_name = card_configs[card->info->cfg_name].name;
|
||||
@ -2065,13 +2062,13 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
|
||||
DBG("Nr of ports set to min: %d\n", card->ports);
|
||||
}
|
||||
//
|
||||
name = (__typeof__(name))BllocateZeroPool(24);
|
||||
name = (__typeof__(name))AllocateZeroPool(24);
|
||||
snprintf(name, 24, "ATY,%s", card->cfg_name);
|
||||
aty_name.type = kStr;
|
||||
aty_name.size = (UINT32)AsciiStrLen(name);
|
||||
aty_name.data = (UINT8 *)name;
|
||||
|
||||
name_parent = (__typeof__(name_parent))BllocateZeroPool(24);
|
||||
name_parent = (__typeof__(name_parent))AllocateZeroPool(24);
|
||||
snprintf(name_parent, 24, "ATY,%sParent", card->cfg_name);
|
||||
aty_nameparent.type = kStr;
|
||||
aty_nameparent.size = (UINT32)AsciiStrLen(name_parent);
|
||||
|
@ -92,7 +92,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
|
||||
* Decodes EncodedData into a new allocated buffer and returns it. Caller is responsible to FreePool() it.
|
||||
* If DecodedSize != NULL, then size od decoded data is put there.
|
||||
*/
|
||||
UINT8 *Base64DecodeClover(IN CHAR8 *EncodedData, OUT UINTN *DecodedSize)
|
||||
UINT8 *Base64DecodeClover(IN CONST CHAR8 *EncodedData, OUT UINTN *DecodedSize)
|
||||
{
|
||||
UINTN EncodedSize;
|
||||
UINTN DecodedSizeInternal;
|
||||
@ -107,7 +107,7 @@ UINT8 *Base64DecodeClover(IN CHAR8 *EncodedData, OUT UINTN *DecodedSize)
|
||||
return NULL;
|
||||
}
|
||||
// to simplify, we'll allocate the same size, although smaller size is needed
|
||||
DecodedData = (__typeof__(DecodedData))BllocateZeroPool(EncodedSize);
|
||||
DecodedData = (__typeof__(DecodedData))AllocateZeroPool(EncodedSize);
|
||||
|
||||
base64_init_decodestate(&state_in);
|
||||
DecodedSizeInternal = base64_decode_block(EncodedData, (const int)EncodedSize, (char*) DecodedData, &state_in);
|
||||
|
@ -53,7 +53,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
|
||||
|
||||
UINT8
|
||||
*Base64DecodeClover (
|
||||
IN CHAR8 *EncodedData,
|
||||
IN CONST CHAR8 *EncodedData,
|
||||
OUT UINTN *DecodedSize
|
||||
);
|
||||
|
||||
|
@ -70,7 +70,7 @@ LIST_ENTRY gCardList = INITIALIZE_LIST_HEAD_VARIABLE (gCardList);
|
||||
VOID AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, BOOLEAN LoadVBios)
|
||||
{
|
||||
CARDLIST* new_card;
|
||||
new_card = (__typeof__(new_card))BllocateZeroPool(sizeof(CARDLIST));
|
||||
new_card = (__typeof__(new_card))AllocateZeroPool(sizeof(CARDLIST));
|
||||
if (new_card) {
|
||||
new_card->Signature = CARDLIST_SIGNATURE;
|
||||
new_card->Id = Id;
|
||||
@ -131,7 +131,7 @@ VOID FillCardList(TagPtr CfgDict)
|
||||
if (status == EFI_SUCCESS) {
|
||||
if (element) {
|
||||
if ((prop2 = GetProperty(element, "Model")) != 0) {
|
||||
model_name = prop2->string;
|
||||
model_name = prop2->string.c_str();
|
||||
} else {
|
||||
model_name = "VideoCard";
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ UINT32 device_inject_stringlength = 0;
|
||||
DevPropString *devprop_create_string(VOID)
|
||||
{
|
||||
// DBG("Begin creating strings for devices:\n");
|
||||
device_inject_string = (DevPropString*)BllocateZeroPool(sizeof(DevPropString));
|
||||
device_inject_string = (DevPropString*)AllocateZeroPool(sizeof(DevPropString));
|
||||
|
||||
if(device_inject_string == NULL)
|
||||
return NULL;
|
||||
@ -138,7 +138,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
|
||||
if (!DevicePath)
|
||||
return NULL;
|
||||
|
||||
device = (__typeof__(device))BllocateZeroPool(sizeof(DevPropDevice));
|
||||
device = (__typeof__(device))AllocateZeroPool(sizeof(DevPropDevice));
|
||||
if (!device) {
|
||||
return NULL;
|
||||
}
|
||||
@ -197,7 +197,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
|
||||
StringBuf->length += device->length;
|
||||
|
||||
if(!StringBuf->entries) {
|
||||
StringBuf->entries = (DevPropDevice**)BllocateZeroPool(MAX_NUM_DEVICES * sizeof(device));
|
||||
StringBuf->entries = (DevPropDevice**)AllocateZeroPool(MAX_NUM_DEVICES * sizeof(device));
|
||||
if(!StringBuf->entries) {
|
||||
FreePool(device);
|
||||
return NULL;
|
||||
@ -230,7 +230,7 @@ BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, UINT8 *vl, UIN
|
||||
DBG("\n"); */
|
||||
l = AsciiStrLen(nm);
|
||||
length = (UINT32)((l * 2) + len + (2 * sizeof(UINT32)) + 2);
|
||||
data = (UINT8*)BllocateZeroPool(length);
|
||||
data = (UINT8*)AllocateZeroPool(length);
|
||||
if(!data)
|
||||
return FALSE;
|
||||
|
||||
@ -256,7 +256,7 @@ BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, UINT8 *vl, UIN
|
||||
|
||||
offset = device->length - (24 + (6 * device->num_pci_devpaths));
|
||||
|
||||
newdata = (UINT8*)BllocateZeroPool((length + offset));
|
||||
newdata = (UINT8*)AllocateZeroPool((length + offset));
|
||||
if(!newdata)
|
||||
return FALSE;
|
||||
if((device->data) && (offset > 1)) {
|
||||
|
@ -141,222 +141,6 @@ F0 00 00 00 | ....
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
/*
|
||||
* string_to_uuid() creates a 128-bit uuid from a well-formatted UUID string
|
||||
* (i.e. aabbccdd-eeff-gghh-iijj-kkllmmnnoopp)
|
||||
*/
|
||||
#if 0
|
||||
|
||||
VOID
|
||||
string_to_uuid(
|
||||
CHAR8 *string,
|
||||
UINT8 *uuid)
|
||||
{
|
||||
UINT8 count;
|
||||
|
||||
/*
|
||||
* scanned bytewise to ensure correct endianness of fields
|
||||
*/
|
||||
count = sscanf (string, UUID_FORMAT_STRING,
|
||||
&uuid[3], &uuid[2], &uuid[1], &uuid[0],
|
||||
&uuid[5], &uuid[4],
|
||||
&uuid[7], &uuid[6],
|
||||
&uuid[8], &uuid[9], &uuid[10], &uuid[11],
|
||||
&uuid[12], &uuid[13], &uuid[14], &uuid[15]);
|
||||
|
||||
if (count != 16) {
|
||||
fatal ("invalid UUID specified for -u option");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
|
||||
BOOLEAN IsValidGuidAsciiString(IN CHAR8 *Str)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if (Str == NULL || AsciiStrLen(Str) != 36) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < 36; Index++, Str++) {
|
||||
if (Index == 8 || Index == 13 || Index == 18 || Index == 23) {
|
||||
if (*Str != '-') {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (!(
|
||||
(*Str >= '0' && *Str <= '9')
|
||||
|| (*Str >= 'a' && *Str <= 'f')
|
||||
|| (*Str >= 'A' && *Str <= 'F')
|
||||
)
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if 1
|
||||
// it is in edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
|
||||
/**
|
||||
Copyed from DevicePathFromText.c
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
Converts a string to GUID value.
|
||||
Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
|
||||
@param Str The registry format GUID string that contains the GUID value.
|
||||
@param Guid A pointer to the converted GUID value.
|
||||
|
||||
@retval EFI_SUCCESS The GUID string was successfully converted to the GUID value.
|
||||
@retval EFI_UNSUPPORTED The input string is not in registry format.
|
||||
@return others Some error occurred when converting part of GUID value.
|
||||
|
||||
**/
|
||||
//#define IS_HYPHEN(a) ((a) == L'-')
|
||||
//#define IS_NULL(a) ((a) == L'\0')
|
||||
/**
|
||||
Converts a list of string to a specified buffer.
|
||||
|
||||
@param Buf The output buffer that contains the string.
|
||||
@param BufferLength The length of the buffer
|
||||
@param Str The input string that contains the hex number
|
||||
|
||||
@retval EFI_SUCCESS The string was successfully converted to the buffer.
|
||||
|
||||
**/
|
||||
static EFI_STATUS
|
||||
StrHToBuf (
|
||||
OUT UINT8 *Buf,
|
||||
IN UINTN BufferLength,
|
||||
IN CONST CHAR16 *Str
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN StrLength;
|
||||
UINT8 Digit;
|
||||
UINT8 Byte;
|
||||
|
||||
Digit = 0;
|
||||
|
||||
//
|
||||
// Two hex char make up one byte
|
||||
//
|
||||
StrLength = BufferLength * sizeof (CHAR16);
|
||||
|
||||
for(Index = 0; Index < StrLength; Index++, Str++) {
|
||||
|
||||
if ((*Str >= L'a') && (*Str <= L'f')) {
|
||||
Digit = (UINT8) (*Str - L'a' + 0x0A);
|
||||
} else if ((*Str >= L'A') && (*Str <= L'F')) {
|
||||
Digit = (UINT8) (*Str - L'A' + 0x0A);
|
||||
} else if ((*Str >= L'0') && (*Str <= L'9')) {
|
||||
Digit = (UINT8) (*Str - L'0');
|
||||
} else {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// For odd characters, write the upper nibble for each buffer byte,
|
||||
// and for even characters, the lower nibble.
|
||||
//
|
||||
if ((Index & 1) == 0) {
|
||||
Byte = (UINT8) (Digit << 4);
|
||||
} else {
|
||||
Byte = Buf[Index / 2];
|
||||
Byte &= 0xF0;
|
||||
Byte = (UINT8) (Byte | Digit);
|
||||
}
|
||||
|
||||
Buf[Index / 2] = Byte;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
Converts a string to GUID value.
|
||||
Guid Format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
|
||||
@param Str The registry format GUID string that contains the GUID value.
|
||||
@param Guid A pointer to the converted GUID value.
|
||||
|
||||
@retval EFI_SUCCESS The GUID string was successfully converted to the GUID value.
|
||||
@retval EFI_UNSUPPORTED The input string is not in registry format.
|
||||
@return others Some error occurred when converting part of GUID value.
|
||||
|
||||
**/
|
||||
|
||||
EFI_STATUS
|
||||
StrToGuidLE (
|
||||
IN CONST CHAR16 *Str,
|
||||
OUT EFI_GUID *Guid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 GuidLE[16];
|
||||
Status = StrHToBuf (&GuidLE[0], 4, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[4], 2, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[6], 2, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[8], 2, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[10], 6, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
|
||||
if (Guid) {
|
||||
CopyMem((UINT8*)Guid, &GuidLE[0], sizeof(EFI_GUID));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//Slice - I need GuidBEToStr :(
|
||||
XStringW GuidBeToStr(EFI_GUID *Guid)
|
||||
@ -390,71 +174,3 @@ XString8 GuidLEToXString8(EFI_GUID *Guid)
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
#if 0
|
||||
EFI_STATUS
|
||||
StrToGuid2 (
|
||||
IN CHAR16 *Str,
|
||||
OUT EFI_GUID *Guid
|
||||
)
|
||||
{
|
||||
//
|
||||
// Get the first UINT32 data
|
||||
//
|
||||
Guid->Data1 = (UINT32) StrHexToUint64 (Str);
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the second UINT16 data
|
||||
//
|
||||
Guid->Data2 = (UINT16) StrHexToUint64 (Str);
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the third UINT16 data
|
||||
//
|
||||
Guid->Data3 = (UINT16) StrHexToUint64 (Str);
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the following 8 bytes data
|
||||
//
|
||||
StrHToBuf (&Guid->Data4[0], 2, Str);
|
||||
//
|
||||
// Skip 2 byte hex chars
|
||||
//
|
||||
Str += 2 * 2;
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
StrHToBuf (&Guid->Data4[2], 6, Str);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
@ -8,18 +8,166 @@
|
||||
#ifndef PLATFORM_GUID_H_
|
||||
#define PLATFORM_GUID_H_
|
||||
|
||||
#include "../cpp_foundation/unicode_conversions.h"
|
||||
|
||||
/** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
|
||||
template <typename T, enable_if( is___String(T) )>
|
||||
BOOLEAN IsValidGuidAsciiString(const T& Str)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
if ( Str.length() != 36 ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < 36; Index++) {
|
||||
if (Index == 8 || Index == 13 || Index == 18 || Index == 23) {
|
||||
if (Str[Index] != '-') {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (!(
|
||||
(Str[Index] >= '0' && Str[Index] <= '9')
|
||||
|| (Str[Index] >= 'a' && Str[Index] <= 'f')
|
||||
|| (Str[Index] >= 'A' && Str[Index] <= 'F')
|
||||
)
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsValidGuidAsciiString (
|
||||
IN CHAR8 *Str
|
||||
);
|
||||
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
|
||||
EFI_STATUS
|
||||
StrHToBuf (
|
||||
OUT UINT8 *Buf,
|
||||
IN UINTN BufferLength,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN StrLength;
|
||||
UINT8 Digit;
|
||||
UINT8 Byte;
|
||||
|
||||
Digit = 0;
|
||||
auto Str = _xstringarray__char_type<T>::getCharPtr(t);
|
||||
|
||||
//
|
||||
// Two hex char make up one byte
|
||||
//
|
||||
StrLength = length_of_utf_string(Str);
|
||||
|
||||
for(Index = 0; Index < StrLength; Index++, Str++) {
|
||||
|
||||
if ((Str[Index] >= (__typeof__(*Str))'a') && (Str[Index] <= (__typeof__(*Str))'f')) {
|
||||
Digit = (UINT8) (Str[Index] - (__typeof__(*Str))'a' + 0x0A);
|
||||
} else if ((Str[Index] >= (__typeof__(*Str))'A') && (Str[Index] <= (__typeof__(*Str))'F')) {
|
||||
Digit = (UINT8) (Str[Index] - L'A' + 0x0A);
|
||||
} else if ((Str[Index] >= (__typeof__(*Str))'0') && (Str[Index] <= (__typeof__(*Str))'9')) {
|
||||
Digit = (UINT8) (Str[Index] - (__typeof__(*Str))'0');
|
||||
} else {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// For odd characters, write the upper nibble for each buffer byte,
|
||||
// and for even characters, the lower nibble.
|
||||
//
|
||||
if ((Index & 1) == 0) {
|
||||
Byte = (UINT8) (Digit << 4);
|
||||
} else {
|
||||
Byte = Buf[Index / 2];
|
||||
Byte &= 0xF0;
|
||||
Byte = (UINT8) (Byte | Digit);
|
||||
}
|
||||
|
||||
Buf[Index / 2] = Byte;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a string to a GUID.
|
||||
* First parameter can by of one of these type : char*, char16_t*, char32_t*, wchar_t*, XString8, XString16, XString32, XStringW
|
||||
*/
|
||||
template <typename T, enable_if( is_char_ptr(T) || is___String(T) )>
|
||||
EFI_STATUS
|
||||
StrToGuidLE (
|
||||
IN CONST CHAR16 *Str,
|
||||
OUT EFI_GUID *Guid);
|
||||
const T& t,
|
||||
OUT EFI_GUID *Guid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 GuidLE[16];
|
||||
|
||||
auto Str = _xstringarray__char_type<T>::getCharPtr(t);
|
||||
|
||||
Status = StrHToBuf (&GuidLE[0], 4, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[4], 2, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[6], 2, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[8], 2, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
while (!IS_HYPHEN (*Str) && !IS_NULL (*Str)) {
|
||||
Str ++;
|
||||
}
|
||||
|
||||
if (IS_HYPHEN (*Str)) {
|
||||
Str++;
|
||||
} else {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = StrHToBuf (&GuidLE[10], 6, Str);
|
||||
if ( Status != EFI_SUCCESS ) return Status;
|
||||
|
||||
if (Guid) {
|
||||
CopyMem((UINT8*)Guid, &GuidLE[0], sizeof(EFI_GUID));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
XStringW GuidBeToStr(EFI_GUID *Guid);
|
||||
XString8 GuidLEToXString8(EFI_GUID *Guid);
|
||||
|
@ -81,7 +81,7 @@ EFI_STATUS EFIAPI ThinFatFile(IN OUT UINT8 **binary, IN OUT UINTN *length, IN cp
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
void toLowerStr(CHAR8 *tstr, CHAR8 *str) {
|
||||
void toLowerStr(CHAR8 *tstr, IN CONST CHAR8 *str) {
|
||||
UINT16 cnt = 0;
|
||||
|
||||
for (cnt = 0; *str != '\0' && cnt <= 0xFF; cnt++, str++, tstr++) {
|
||||
@ -96,21 +96,21 @@ void toLowerStr(CHAR8 *tstr, CHAR8 *str) {
|
||||
BOOLEAN checkOSBundleRequired(UINT8 loaderType, TagPtr dict)
|
||||
{
|
||||
BOOLEAN inject = TRUE;
|
||||
TagPtr osBundleRequired;
|
||||
CHAR8 osbundlerequired[256];
|
||||
TagPtr osBundleRequiredTag;
|
||||
XString8 osbundlerequired;
|
||||
|
||||
osBundleRequired = GetProperty(dict,"OSBundleRequired");
|
||||
if (osBundleRequired)
|
||||
toLowerStr(osbundlerequired, osBundleRequired->string);
|
||||
else
|
||||
osbundlerequired[0] = '\0';
|
||||
osBundleRequiredTag = GetProperty(dict,"OSBundleRequired");
|
||||
if (osBundleRequiredTag) {
|
||||
osbundlerequired = osBundleRequiredTag->string;
|
||||
osbundlerequired.lowerAscii();
|
||||
}
|
||||
|
||||
if (OSTYPE_IS_OSX_RECOVERY(loaderType) ||
|
||||
OSTYPE_IS_OSX_INSTALLER(loaderType)) {
|
||||
if (strncmp(osbundlerequired, "root", 4) &&
|
||||
strncmp(osbundlerequired, "local", 5) &&
|
||||
strncmp(osbundlerequired, "console", 7) &&
|
||||
strncmp(osbundlerequired, "network-root", 12)) {
|
||||
if ( osbundlerequired != "root"_XS8 &&
|
||||
osbundlerequired != "local"_XS8 &&
|
||||
osbundlerequired != "console"_XS8 &&
|
||||
osbundlerequired != "network-root"_XS8 ) {
|
||||
inject = FALSE;
|
||||
}
|
||||
}
|
||||
@ -193,7 +193,7 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CONST CHAR16 *FileNam
|
||||
}
|
||||
}
|
||||
bundlePathBufferLength = StrLen(FileName) + 1;
|
||||
bundlePathBuffer = (__typeof__(bundlePathBuffer))BllocateZeroPool(bundlePathBufferLength);
|
||||
bundlePathBuffer = (__typeof__(bundlePathBuffer))AllocateZeroPool(bundlePathBufferLength);
|
||||
UnicodeStrToAsciiStrS(FileName, bundlePathBuffer, bundlePathBufferLength);
|
||||
|
||||
kext->length = (UINT32)(sizeof(_BooterKextFileInfo) + infoDictBufferLength + executableBufferLength + bundlePathBufferLength);
|
||||
@ -517,10 +517,10 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
|
||||
// reserve space in the device tree
|
||||
if (GetKextCount() > 0) {
|
||||
mm_extra_size = GetKextCount() * (sizeof(DeviceTreeNodeProperty) + sizeof(_DeviceTreeBuffer));
|
||||
mm_extra = (__typeof__(mm_extra))BllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
|
||||
mm_extra = (__typeof__(mm_extra))AllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
|
||||
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"mm_extra", mm_extra, (UINT32)(mm_extra_size - sizeof(DeviceTreeNodeProperty)));
|
||||
extra_size = GetKextsSize();
|
||||
extra = (__typeof__(extra))BllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
|
||||
extra = (__typeof__(extra))AllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
|
||||
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"extra", extra, (UINT32)(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE));
|
||||
// MsgLog("count: %d \n", GetKextCount());
|
||||
// MsgLog("mm_extra_size: %d \n", mm_extra_size);
|
||||
|
@ -2292,7 +2292,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
|
||||
}
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
rom = (__typeof__(rom))BllocateZeroPool(NVIDIA_ROM_SIZE+1);
|
||||
rom = (__typeof__(rom))AllocateZeroPool(NVIDIA_ROM_SIZE+1);
|
||||
// PRAMIN first
|
||||
read_nVidia_PRAMIN(nvda_dev, rom, nvCardType);
|
||||
|
||||
@ -2319,7 +2319,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
|
||||
if (buffer[i] == 0x55 && buffer[i+1] == 0xaa) {
|
||||
DBG(" header found at: %llu\n", i);
|
||||
bufferLen -= i;
|
||||
rom = (__typeof__(rom))BllocateZeroPool(bufferLen);
|
||||
rom = (__typeof__(rom))AllocateZeroPool(bufferLen);
|
||||
for (j = 0; j < bufferLen; j++) {
|
||||
rom[j] = buffer[i+j];
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -137,13 +137,12 @@ typedef enum {
|
||||
} MACHINE_TYPES;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern CONST CHAR8 *BiosVendor;
|
||||
extern CONST CHAR8 *AppleManufacturer;
|
||||
extern CONST CHAR8 *AppleBoardSN;
|
||||
extern CONST CHAR8 *AppleBoardLocation;
|
||||
constexpr LString8 DefaultMemEntry = "N/A";
|
||||
constexpr LString8 DefaultSerial = "CT288GT9VT6";
|
||||
constexpr LString8 BiosVendor = "Apple Inc.";
|
||||
constexpr LString8 AppleManufacturer = "Apple Computer, Inc."; //Old name, before 2007
|
||||
constexpr LString8 AppleBoardSN = "C02140302D5DMT31M";
|
||||
constexpr LString8 AppleBoardLocation = "Part Component";
|
||||
|
||||
extern UINT32 gFwFeatures;
|
||||
extern UINT32 gFwFeaturesMask;
|
||||
@ -158,7 +157,7 @@ SetDMISettingsForModel (
|
||||
);
|
||||
|
||||
MACHINE_TYPES GetModelFromString (
|
||||
CHAR8 *ProductName
|
||||
const XString8& ProductName
|
||||
);
|
||||
|
||||
VOID
|
||||
|
@ -47,7 +47,6 @@
|
||||
|
||||
|
||||
|
||||
SymbolPtr gSymbolsHead = NULL;
|
||||
TagPtr gTagsFree = NULL;
|
||||
CHAR8* buffer_start = NULL;
|
||||
|
||||
@ -66,9 +65,6 @@ EFI_STATUS ParseTagBoolean(CHAR8* buffer, TagPtr * tag, UINT32 type, UINT32* len
|
||||
|
||||
TagPtr NewTag( void );
|
||||
EFI_STATUS FixDataMatchingTag( CHAR8* buffer, CONST CHAR8* tag,UINT32* lenPtr);
|
||||
CHAR8* NewSymbol(CHAR8* string);
|
||||
VOID FreeSymbol(CHAR8* string);
|
||||
SymbolPtr FindSymbol( char * string, SymbolPtr * prevSymbol );
|
||||
|
||||
/* Function for basic XML character entities parsing */
|
||||
typedef struct XMLEntity {
|
||||
@ -85,6 +81,7 @@ CONST XMLEntity ents[] = {
|
||||
_e("amp;", '&')
|
||||
};
|
||||
|
||||
/* Replace XML entities by their value */
|
||||
CHAR8*
|
||||
XMLDecode(CHAR8* src)
|
||||
{
|
||||
@ -99,7 +96,7 @@ XMLDecode(CHAR8* src)
|
||||
len = AsciiStrLen(src);
|
||||
|
||||
#if 0
|
||||
out = (__typeof__(out))BllocateZeroPool(len+1);
|
||||
out = (__typeof__(out))AllocateZeroPool(len+1);
|
||||
if (!out)
|
||||
return 0;
|
||||
#else // unsafe
|
||||
@ -213,7 +210,7 @@ EFI_STATUS ParseXML(const CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
configBuffer = (__typeof__(configBuffer))BllocateZeroPool(bufferSize+1);
|
||||
configBuffer = (__typeof__(configBuffer))AllocateZeroPool(bufferSize+1);
|
||||
if(configBuffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -280,12 +277,12 @@ TagPtr GetProperty( TagPtr dict, const CHAR8* key )
|
||||
tag = tagList;
|
||||
tagList = tag->tagNext;
|
||||
|
||||
if ((tag->type != kTagTypeKey) || (tag->string == 0)) {
|
||||
if ( tag->type != kTagTypeKey || tag->string.isEmpty() ) {
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (!AsciiStriCmp(tag->string, key)) {
|
||||
if ( tag->string.equalIC(key) ) {
|
||||
return tag->tag;
|
||||
}
|
||||
}
|
||||
@ -308,7 +305,7 @@ TagPtr GetNextProperty(TagPtr dict)
|
||||
tag = tagList;
|
||||
tagList = tag->tagNext;
|
||||
|
||||
if ((tag->type != kTagTypeKey) || (tag->string == 0)) {
|
||||
if ( tag->type != kTagTypeKey || tag->string.isEmpty() ) {
|
||||
continue;
|
||||
|
||||
}
|
||||
@ -517,7 +514,7 @@ EFI_STATUS ParseTagList( CHAR8* buffer, TagPtr* tag, UINT32 type, UINT32 empty,
|
||||
}
|
||||
|
||||
tmpTag->type = type;
|
||||
tmpTag->string = 0;
|
||||
tmpTag->string.setEmpty();
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start : 0);
|
||||
tmpTag->tag = tagList;
|
||||
tmpTag->tagNext = 0;
|
||||
@ -536,7 +533,6 @@ EFI_STATUS ParseTagKey( char * buffer, TagPtr* tag, UINT32* lenPtr)
|
||||
EFI_STATUS Status;
|
||||
UINT32 length = 0;
|
||||
UINT32 length2 = 0;
|
||||
CHAR8* tmpString;
|
||||
TagPtr tmpTag;
|
||||
TagPtr subTag = NULL;
|
||||
|
||||
@ -556,15 +552,8 @@ EFI_STATUS ParseTagKey( char * buffer, TagPtr* tag, UINT32* lenPtr)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
tmpString = NewSymbol(buffer);
|
||||
if (tmpString == NULL) {
|
||||
FreeTag(subTag);
|
||||
FreeTag(tmpTag);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
tmpTag->type = kTagTypeKey;
|
||||
tmpTag->string = tmpString;
|
||||
tmpTag->string.takeValueFrom(buffer);
|
||||
tmpTag->tag = subTag;
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start: 0);
|
||||
tmpTag->tagNext = 0;
|
||||
@ -582,7 +571,6 @@ EFI_STATUS ParseTagString(CHAR8* buffer, TagPtr * tag,UINT32* lenPtr)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 length = 0;
|
||||
CHAR8* tmpString;
|
||||
TagPtr tmpTag;
|
||||
|
||||
Status = FixDataMatchingTag(buffer, kXMLTagString, &length);
|
||||
@ -595,16 +583,8 @@ EFI_STATUS ParseTagString(CHAR8* buffer, TagPtr * tag,UINT32* lenPtr)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
tmpString = XMLDecode(buffer);
|
||||
tmpString = NewSymbol(tmpString);
|
||||
if (tmpString == NULL)
|
||||
{
|
||||
FreeTag(tmpTag);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
tmpTag->type = kTagTypeString;
|
||||
tmpTag->string = tmpString;
|
||||
tmpTag->string.takeValueFrom(XMLDecode(buffer));
|
||||
tmpTag->tag = NULL;
|
||||
tmpTag->tagNext = NULL;
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start: 0);
|
||||
@ -641,7 +621,7 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
||||
integer = 0;
|
||||
if(buffer[0] == '<') {
|
||||
tmpTag->type = kTagTypeInteger;
|
||||
tmpTag->string = 0;
|
||||
tmpTag->string.setEmpty();
|
||||
tmpTag->tag = 0;
|
||||
tmpTag->offset = 0;
|
||||
tmpTag->tagNext = 0;
|
||||
@ -696,7 +676,8 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
||||
|
||||
|
||||
tmpTag->type = kTagTypeInteger;
|
||||
tmpTag->string = (CHAR8*)(UINTN)integer;
|
||||
tmpTag->string.S8Printf("%lld", integer);
|
||||
tmpTag->intValue = integer;
|
||||
tmpTag->tag = NULL;
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start: 0);
|
||||
tmpTag->tagNext = NULL;
|
||||
@ -733,7 +714,9 @@ EFI_STATUS ParseTagFloat(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
||||
AsciiStrToFloat(buffer, NULL, &fVar.B.fNum);
|
||||
//----
|
||||
tmpTag->type = kTagTypeFloat;
|
||||
tmpTag->string = fVar.string;
|
||||
tmpTag->string.S8Printf("%f", fVar.B.fNum);
|
||||
tmpTag->intValue = (INTN)fVar.B.fNum;
|
||||
tmpTag->floatValue = fVar.B.fNum;
|
||||
tmpTag->tag = NULL;
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start: 0);
|
||||
tmpTag->tagNext = NULL;
|
||||
@ -752,7 +735,6 @@ EFI_STATUS ParseTagData(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
||||
UINT32 length = 0;
|
||||
UINTN len = 0;
|
||||
TagPtr tmpTag;
|
||||
CHAR8* tmpString;
|
||||
|
||||
Status = FixDataMatchingTag(buffer, kXMLTagData,&length);
|
||||
if (EFI_ERROR(Status)) {
|
||||
@ -764,11 +746,10 @@ EFI_STATUS ParseTagData(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
//Slice - correction as Apple 2003
|
||||
tmpString = NewSymbol(buffer);
|
||||
tmpTag->type = kTagTypeData;
|
||||
tmpTag->string = tmpString;
|
||||
tmpTag->string.takeValueFrom(buffer);
|
||||
// dmazar: base64 decode data
|
||||
tmpTag->data = (UINT8 *)Base64DecodeClover(tmpTag->string, &len);
|
||||
tmpTag->data = (UINT8 *)Base64DecodeClover(tmpTag->string.c_str(), &len);
|
||||
tmpTag->dataLen = len;
|
||||
tmpTag->tag = NULL;
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start: 0);
|
||||
@ -801,7 +782,7 @@ EFI_STATUS ParseTagDate(CHAR8* buffer, TagPtr * tag,UINT32* lenPtr)
|
||||
}
|
||||
|
||||
tmpTag->type = kTagTypeDate;
|
||||
tmpTag->string = NULL;
|
||||
tmpTag->string.setEmpty();
|
||||
tmpTag->tag = NULL;
|
||||
tmpTag->tagNext = NULL;
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start: 0);
|
||||
@ -825,7 +806,7 @@ EFI_STATUS ParseTagBoolean(CHAR8* buffer, TagPtr * tag, UINT32 type,UINT32* lenP
|
||||
}
|
||||
|
||||
tmpTag->type = type;
|
||||
tmpTag->string = NULL;
|
||||
tmpTag->string.setEmpty();
|
||||
tmpTag->tag = NULL;
|
||||
tmpTag->tagNext = NULL;
|
||||
tmpTag->offset = (UINT32)(buffer_start ? buffer - buffer_start: 0);
|
||||
@ -932,7 +913,7 @@ TagPtr NewTag( void )
|
||||
TagPtr tag;
|
||||
|
||||
if (gTagsFree == NULL) {
|
||||
tag = (TagPtr)BllocateZeroPool(TAGCACHESIZE * sizeof(TagStruct));
|
||||
tag = (TagPtr)AllocateZeroPool(TAGCACHESIZE * sizeof(TagStruct));
|
||||
if (tag == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -967,9 +948,8 @@ void FreeTag( TagPtr tag )
|
||||
return;
|
||||
}
|
||||
|
||||
if (tag->type != kTagTypeInteger && tag->string) {
|
||||
FreeSymbol(tag->string);
|
||||
}
|
||||
tag->string.setEmpty();
|
||||
|
||||
if (tag->data) {
|
||||
FreePool(tag->data);
|
||||
}
|
||||
@ -979,7 +959,7 @@ void FreeTag( TagPtr tag )
|
||||
|
||||
// Clear and free the tag.
|
||||
tag->type = kTagTypeNone;
|
||||
tag->string = NULL;
|
||||
tag->string.setEmpty();
|
||||
tag->data = NULL;
|
||||
tag->dataLen = 0;
|
||||
tag->tag = NULL;
|
||||
@ -989,108 +969,6 @@ void FreeTag( TagPtr tag )
|
||||
}
|
||||
|
||||
|
||||
CHAR8* NewSymbol(CHAR8* tmpString)
|
||||
{
|
||||
#if 0
|
||||
SymbolPtr lastGuy = 0; // never used
|
||||
#endif
|
||||
SymbolPtr symbol;
|
||||
UINTN len;
|
||||
// Look for string in the list of symbols.
|
||||
symbol = FindSymbol(tmpString, 0);
|
||||
|
||||
// Add the new symbol.
|
||||
if (symbol == NULL) {
|
||||
len = AsciiStrLen(tmpString);
|
||||
symbol = (SymbolPtr)BllocateZeroPool(sizeof(Symbol) + len + 1);
|
||||
if (symbol == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Set the symbol's data.
|
||||
symbol->refCount = 0;
|
||||
|
||||
AsciiStrnCpyS(symbol->string, len+1, tmpString, len);
|
||||
|
||||
// Add the symbol to the list.
|
||||
symbol->next = gSymbolsHead;
|
||||
gSymbolsHead = symbol;
|
||||
}
|
||||
|
||||
// Update the refCount and return the string.
|
||||
symbol->refCount++;
|
||||
|
||||
#if 0
|
||||
if (lastGuy && lastGuy->next != 0) { // lastGuy is always 0, accessing to ((SymbolPtr)null)->next can be dangerous.
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return symbol->string;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// FreeSymbol
|
||||
|
||||
void FreeSymbol(CHAR8* tmpString)
|
||||
{
|
||||
SymbolPtr symbol, prev;
|
||||
prev = NULL;
|
||||
|
||||
// Look for string in the list of symbols.
|
||||
symbol = FindSymbol(tmpString, &prev);
|
||||
if (symbol == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the refCount.
|
||||
symbol->refCount--;
|
||||
|
||||
if (symbol->refCount != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the symbol from the list.
|
||||
if (prev != NULL) {
|
||||
prev->next = symbol->next;
|
||||
}
|
||||
else {
|
||||
gSymbolsHead = symbol->next;
|
||||
}
|
||||
|
||||
// Free the symbol's memory.
|
||||
FreePool(symbol);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// FindSymbol
|
||||
|
||||
SymbolPtr FindSymbol(CHAR8 *tmpString, SymbolPtr *prevSymbol )
|
||||
{
|
||||
SymbolPtr symbol, prev;
|
||||
|
||||
if (tmpString == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
symbol = gSymbolsHead;
|
||||
prev = NULL;
|
||||
|
||||
while (symbol != NULL) {
|
||||
if (!AsciiStrCmp(symbol->string, tmpString)) {
|
||||
break;
|
||||
}
|
||||
|
||||
prev = symbol;
|
||||
symbol = symbol->next;
|
||||
}
|
||||
|
||||
if ((symbol != NULL) && (prevSymbol != NULL)) {
|
||||
*prevSymbol = prev;
|
||||
}
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1105,7 +983,7 @@ IsPropertyTrue(
|
||||
{
|
||||
return Prop != NULL &&
|
||||
((Prop->type == kTagTypeTrue) ||
|
||||
((Prop->type == kTagTypeString) && Prop->string &&
|
||||
((Prop->type == kTagTypeString) && Prop->string.notEmpty() &&
|
||||
((Prop->string[0] == 'y') || (Prop->string[0] == 'Y'))));
|
||||
}
|
||||
|
||||
@ -1120,7 +998,7 @@ IsPropertyFalse(
|
||||
{
|
||||
return Prop != NULL &&
|
||||
((Prop->type == kTagTypeFalse) ||
|
||||
((Prop->type == kTagTypeString) && Prop->string &&
|
||||
((Prop->type == kTagTypeString) && Prop->string.notEmpty() &&
|
||||
((Prop->string[0] == 'N') || (Prop->string[0] == 'n'))));
|
||||
}
|
||||
|
||||
@ -1142,18 +1020,18 @@ GetPropertyInteger(
|
||||
}
|
||||
|
||||
if (Prop->type == kTagTypeInteger) {
|
||||
return (INTN)Prop->string; //this is union char* or size_t
|
||||
} else if ((Prop->type == kTagTypeString) && Prop->string) {
|
||||
if ((Prop->string[1] == 'x') || (Prop->string[1] == 'X')) {
|
||||
return (INTN)AsciiStrHexToUintn (Prop->string);
|
||||
return Prop->intValue; //this is union char* or size_t
|
||||
} else if ((Prop->type == kTagTypeString) && Prop->string.notEmpty()) {
|
||||
if ( Prop->string.length() > 2 && (Prop->string[1] == 'x' || Prop->string[1] == 'X') ) {
|
||||
return (INTN)AsciiStrHexToUintn(Prop->string);
|
||||
}
|
||||
|
||||
if (Prop->string[0] == '-') {
|
||||
return -(INTN)AsciiStrDecimalToUintn (Prop->string + 1);
|
||||
return -(INTN)AsciiStrDecimalToUintn (Prop->string.c_str() + 1);
|
||||
}
|
||||
|
||||
// return (INTN)AsciiStrDecimalToUintn (Prop->string);
|
||||
return (INTN)AsciiStrDecimalToUintn((Prop->string[0] == '+') ? (Prop->string + 1) : Prop->string);
|
||||
return (INTN)AsciiStrDecimalToUintn((Prop->string[0] == '+') ? (Prop->string.c_str() + 1) : Prop->string.c_str());
|
||||
}
|
||||
return Default;
|
||||
}
|
||||
@ -1164,12 +1042,10 @@ float GetPropertyFloat (TagPtr Prop, float Default)
|
||||
return Default;
|
||||
}
|
||||
if (Prop->type == kTagTypeFloat) {
|
||||
FlMix fVar;
|
||||
fVar.string = Prop->string;
|
||||
return fVar.B.fNum; //this is union char* or float
|
||||
} else if ((Prop->type == kTagTypeString) && Prop->string) {
|
||||
return Prop->floatValue; //this is union char* or float
|
||||
} else if ((Prop->type == kTagTypeString) && Prop->string.notEmpty()) {
|
||||
float fVar = 0.f;
|
||||
if(!AsciiStrToFloat(Prop->string, NULL, &fVar)) //if success then return 0
|
||||
if(!AsciiStrToFloat(Prop->string.c_str(), NULL, &fVar)) //if success then return 0
|
||||
return fVar;
|
||||
}
|
||||
|
||||
|
@ -26,18 +26,13 @@
|
||||
#define kXMLTagFloat "real"
|
||||
|
||||
|
||||
struct Symbol {
|
||||
UINTN refCount;
|
||||
struct Symbol *next;
|
||||
CHAR8 string[1];
|
||||
};
|
||||
typedef struct Symbol Symbol, *SymbolPtr;
|
||||
|
||||
|
||||
typedef struct TagStruct {
|
||||
|
||||
UINTN type;
|
||||
CHAR8 *string;
|
||||
XString8 string;
|
||||
INTN intValue;
|
||||
float floatValue;
|
||||
UINT8 *data;
|
||||
UINTN dataLen;
|
||||
UINTN offset;
|
||||
|
@ -53,7 +53,7 @@ extern "C" {
|
||||
|
||||
EFI_GUID *gTableGuidArray[] = {&gEfiSmbiosTableGuid, &gEfiSmbios3TableGuid};
|
||||
|
||||
const CHAR8 unknown[] = "unknown";
|
||||
constexpr LString8 unknown("unknown");
|
||||
//
|
||||
// syscl: implement Dell truncate fix
|
||||
// remap EFI_SMBIOS_TABLE_1 to new guid to fix Dell
|
||||
@ -282,8 +282,8 @@ EFI_SMBIOS_HANDLE LogSmbiosTable (APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN)
|
||||
|
||||
// the procedure insert Buffer into SmbiosTable by copy and update Field
|
||||
// the Buffer restricted by zero or by space
|
||||
EFI_STATUS UpdateSmbiosString (OUT APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN,
|
||||
SMBIOS_TABLE_STRING* Field, IN CONST CHAR8* Buffer)
|
||||
EFI_STATUS UpdateSmbiosString(OUT APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN,
|
||||
SMBIOS_TABLE_STRING* Field, const XString8& Buffer)
|
||||
{
|
||||
CHAR8* AString;
|
||||
CHAR8* C1; //pointers for copy
|
||||
@ -292,7 +292,7 @@ EFI_STATUS UpdateSmbiosString (OUT APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN,
|
||||
UINTN ALength, BLength;
|
||||
UINT8 IndexStr = 1;
|
||||
|
||||
if ((SmbiosTableN.Raw == NULL) || !Buffer || !Field) {
|
||||
if ((SmbiosTableN.Raw == NULL) || Buffer.isEmpty() || !Field) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
AString = (CHAR8*)(SmbiosTableN.Raw + SmbiosTableN.Hdr->Length); //first string
|
||||
@ -316,7 +316,7 @@ EFI_STATUS UpdateSmbiosString (OUT APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN,
|
||||
}
|
||||
// AString is at place to copy
|
||||
ALength = iStrLen(AString, 0);
|
||||
BLength = iStrLen(Buffer, MAX_OEM_STRING);
|
||||
BLength = iStrLen(Buffer.c_str(), MAX_OEM_STRING);
|
||||
// DBG("Table type %d field %d\n", SmbiosTable.Hdr->Type, *Field);
|
||||
// DBG("Old string length=%d new length=%d\n", ALength, BLength);
|
||||
if (BLength > ALength) {
|
||||
@ -336,7 +336,7 @@ EFI_STATUS UpdateSmbiosString (OUT APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN,
|
||||
*C2 = 0;
|
||||
*(--C2) = 0; //end of table
|
||||
}
|
||||
CopyMem(AString, Buffer, BLength);
|
||||
CopyMem(AString, Buffer.c_str(), BLength);
|
||||
*(AString + BLength) = 0; // not sure there is 0
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -464,17 +464,20 @@ VOID PatchTableType0()
|
||||
|
||||
UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE0_STR_IDX);
|
||||
|
||||
if(iStrLen(gSettings.VendorName, 64)>0){
|
||||
gSettings.VendorName.trim();
|
||||
if( gSettings.VendorName.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->Vendor, gSettings.VendorName);
|
||||
}
|
||||
if(iStrLen(gSettings.RomVersion, 64)>0){
|
||||
gSettings.RomVersion.trim();
|
||||
if( gSettings.RomVersion.notEmpty() ) {
|
||||
if( gSettings.EfiVersion.notEmpty() ) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosVersion, gSettings.EfiVersion.c_str());
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosVersion, gSettings.EfiVersion);
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosVersion, gSettings.RomVersion);
|
||||
}
|
||||
}
|
||||
if(iStrLen(gSettings.ReleaseDate, 64)>0){
|
||||
gSettings.ReleaseDate.trim();
|
||||
if( gSettings.ReleaseDate.notEmpty() ) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosReleaseDate, gSettings.ReleaseDate);
|
||||
}
|
||||
Handle = LogSmbiosTable(newSmbiosTable);
|
||||
@ -493,7 +496,7 @@ VOID GetTableType1()
|
||||
|
||||
CopyMem((VOID*)&gSettings.SmUUID, (VOID*)&SmbiosTable.Type1->Uuid, 16);
|
||||
s = GetSmbiosString(SmbiosTable, SmbiosTable.Type1->ProductName);
|
||||
CopyMem(gSettings.OEMProduct, s, iStrLen(s, 64) + 1); //take ending zero
|
||||
gSettings.OEMProduct.strncpy(s, iStrLen(s, 64)); //strncpy take care of ending zero
|
||||
|
||||
return;
|
||||
}
|
||||
@ -526,22 +529,28 @@ VOID PatchTableType1()
|
||||
CopyMem((VOID*)&newSmbiosTable.Type1->Uuid, (VOID*)&gSettings.SmUUID, 16);
|
||||
}
|
||||
|
||||
if(iStrLen(gSettings.ManufactureName, 64)>0){
|
||||
gSettings.ManufactureName.trim();
|
||||
if( gSettings.ManufactureName.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Manufacturer, gSettings.ManufactureName);
|
||||
}
|
||||
if(iStrLen(gSettings.ProductName, 64)>0){
|
||||
gSettings.ProductName.trim();
|
||||
if( gSettings.ProductName.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->ProductName, gSettings.ProductName);
|
||||
}
|
||||
if(iStrLen( gSettings.VersionNr, 64)>0){
|
||||
gSettings.VersionNr.trim();
|
||||
if( gSettings.VersionNr.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Version, gSettings.VersionNr);
|
||||
}
|
||||
if(iStrLen(gSettings.SerialNr, 64)>0){
|
||||
gSettings.SerialNr.trim();
|
||||
if( gSettings.SerialNr.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->SerialNumber, gSettings.SerialNr);
|
||||
}
|
||||
if(iStrLen(gSettings.BoardNumber, 64)>0){
|
||||
gSettings.BoardNumber.trim();
|
||||
if( gSettings.BoardNumber.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->SKUNumber, gSettings.BoardNumber); //iMac17,1 - there is nothing
|
||||
}
|
||||
if(iStrLen(gSettings.FamilyName, 64)>0){
|
||||
gSettings.FamilyName.trim();
|
||||
if( gSettings.FamilyName.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Family, gSettings.FamilyName);
|
||||
}
|
||||
|
||||
@ -560,9 +569,9 @@ VOID GetTableType2()
|
||||
}
|
||||
|
||||
s = GetSmbiosString(SmbiosTable, SmbiosTable.Type2->ProductName);
|
||||
CopyMem(gSettings.OEMBoard, s, iStrLen(s, 64) + 1);
|
||||
gSettings.OEMBoard.strncpy(s, iStrLen(s, 64) + 1);
|
||||
s = GetSmbiosString(SmbiosTable, SmbiosTable.Type2->Manufacturer);
|
||||
CopyMem(gSettings.OEMVendor, s, iStrLen(s, 64) + 1);
|
||||
gSettings.OEMVendor.strncpy(s, iStrLen(s, 64) + 1);
|
||||
}
|
||||
|
||||
|
||||
@ -605,19 +614,24 @@ VOID PatchTableType2()
|
||||
|
||||
UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE2_STR_IDX);
|
||||
|
||||
if(iStrLen(gSettings.BoardManufactureName, 64)>0){
|
||||
gSettings.BoardManufactureName.trim();
|
||||
if( gSettings.BoardManufactureName.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->Manufacturer, gSettings.BoardManufactureName);
|
||||
}
|
||||
if(iStrLen(gSettings.BoardNumber, 64)>0){
|
||||
gSettings.BoardNumber.trim();
|
||||
if( gSettings.BoardNumber.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->ProductName, gSettings.BoardNumber);
|
||||
}
|
||||
if(iStrLen( gSettings.BoardVersion, 64)>0){
|
||||
gSettings.BoardVersion.trim();
|
||||
if( gSettings.BoardVersion.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->Version, gSettings.BoardVersion); //iMac17,1 - there is ProductName
|
||||
}
|
||||
if(iStrLen(gSettings.BoardSerialNumber, 64)>0){
|
||||
gSettings.BoardSerialNumber.trim();
|
||||
if( gSettings.BoardSerialNumber.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->SerialNumber, gSettings.BoardSerialNumber);
|
||||
}
|
||||
if(iStrLen(gSettings.LocationInChassis, 64)>0){
|
||||
gSettings.LocationInChassis.trim();
|
||||
if( gSettings.LocationInChassis.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->LocationInChassis, gSettings.LocationInChassis);
|
||||
}
|
||||
//what about Asset Tag??? Not used in real mac. till now.
|
||||
@ -688,17 +702,21 @@ VOID PatchTableType3()
|
||||
newSmbiosTable.Type3->Type = gSettings.ChassisType;
|
||||
}
|
||||
|
||||
if(iStrLen(gSettings.ChassisManufacturer, 64)>0){
|
||||
gSettings.ChassisManufacturer.trim();
|
||||
if( gSettings.ChassisManufacturer.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->Manufacturer, gSettings.ChassisManufacturer);
|
||||
}
|
||||
//SIC! According to iMac there must be the BoardNumber
|
||||
if(iStrLen(gSettings.BoardNumber, 64)>0){
|
||||
gSettings.BoardNumber.trim();
|
||||
if( gSettings.BoardNumber.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->Version, gSettings.BoardNumber);
|
||||
}
|
||||
if(iStrLen(gSettings.SerialNr, 64)>0){
|
||||
gSettings.SerialNr.trim();
|
||||
if( gSettings.SerialNr.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->SerialNumber, gSettings.SerialNr);
|
||||
}
|
||||
if(iStrLen(gSettings.ChassisAssetTag, 64)>0){
|
||||
gSettings.ChassisAssetTag.trim();
|
||||
if( gSettings.ChassisAssetTag.notEmpty() ){
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->AssetTag, gSettings.ChassisAssetTag);
|
||||
}
|
||||
|
||||
@ -749,14 +767,11 @@ VOID PatchTableType4()
|
||||
// Processor Information
|
||||
//
|
||||
UINTN AddBrand = 0;
|
||||
CHAR8 BrandStr[48];
|
||||
UINT16 ProcChar = 0;
|
||||
|
||||
//Note. iMac11,2 has four tables for CPU i3
|
||||
UINTN CpuNumber;
|
||||
|
||||
CopyMem(BrandStr, gCPUStructure.BrandString, 48);
|
||||
BrandStr[47] = '\0';
|
||||
// DBG("BrandString=%s\n", BrandStr);
|
||||
for (CpuNumber = 0; CpuNumber < gCPUStructure.Cores; CpuNumber++) {
|
||||
// Get Table Type4
|
||||
@ -909,10 +924,10 @@ VOID PatchTableType4()
|
||||
newSmbiosTable.Type4->ProcessorCharacteristics = ProcChar;
|
||||
}
|
||||
|
||||
// TODO Jief : looks that the next line modify SocketDesignationMac, which is not used
|
||||
CHAR8 SocketDesignationMac[] = "U2E1";
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->Socket, SocketDesignationMac);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->Socket, "U2E1"_XS8);
|
||||
|
||||
XString8 BrandStr;
|
||||
BrandStr.takeValueFrom(gCPUStructure.BrandString);
|
||||
if (AddBrand) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->ProcessorVersion, BrandStr);
|
||||
}
|
||||
@ -920,7 +935,7 @@ VOID PatchTableType4()
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->AssetTag, BrandStr); //like mac
|
||||
// looks to be MicroCode revision
|
||||
if(gCPUStructure.MicroCode > 0){
|
||||
snprintf(BrandStr, 20, "%llX", gCPUStructure.MicroCode); // MicroCode > 0 so %X and %llX do the same
|
||||
BrandStr.S8Printf("%llX", gCPUStructure.MicroCode);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type4->SerialNumber, BrandStr);
|
||||
}
|
||||
|
||||
@ -972,7 +987,6 @@ VOID PatchTableType7()
|
||||
// Handle = 0x0700 + CoreN<<2 + CacheN (4-level cache is supported
|
||||
// L1[CoreN] = Handle
|
||||
|
||||
CHAR8 SSocketD[9];
|
||||
BOOLEAN correctSD = FALSE;
|
||||
|
||||
//according to spec for Smbios v2.0 max handle is 0xFFFE, for v>2.0 (we made 2.6) max handle=0xFEFF.
|
||||
@ -995,9 +1009,8 @@ VOID PatchTableType7()
|
||||
Once = TRUE;
|
||||
|
||||
//SSocketD = "L1-Cache";
|
||||
CopyMem(SSocketD, "L1-Cache", 9);
|
||||
if(correctSD) {
|
||||
SSocketD[1] = (CHAR8)(0x31 + CoreCache);
|
||||
XString8 SSocketD = S8Printf("L%c-Cache", 0x31 + CoreCache);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type7->SocketDesignation, SSocketD);
|
||||
}
|
||||
Handle = LogSmbiosTable(newSmbiosTable);
|
||||
@ -1069,7 +1082,7 @@ VOID PatchTableType9()
|
||||
Dev = SlotDevices[Index].DevFuncNum >> 3;
|
||||
Func = SlotDevices[Index].DevFuncNum & 7;
|
||||
DBG("insert table 9 for dev %llX:%llX\n", Dev, Func);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type9->SlotDesignation, SlotDevices[Index].SlotName);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type9->SlotDesignation, LString8(SlotDevices[Index].SlotName));
|
||||
LogSmbiosTable(newSmbiosTable);
|
||||
}
|
||||
}
|
||||
@ -1082,8 +1095,6 @@ VOID PatchTableType11()
|
||||
// CHAR8 *OEMString = "Apple inc. uses Clover"; //something else here?
|
||||
// System Information
|
||||
//
|
||||
CHAR8 OEMString[MAX_OEM_STRING];
|
||||
CHAR8 TempRev[MAX_OEM_STRING];
|
||||
SmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_OEM_STRINGS, 0);
|
||||
if (SmbiosTable.Raw != NULL) {
|
||||
MsgLog("Table 11 present, but rewritten for us\n");
|
||||
@ -1097,16 +1108,17 @@ VOID PatchTableType11()
|
||||
|
||||
newSmbiosTable.Type11->StringCount = 1;
|
||||
//
|
||||
ZeroMem(OEMString, MAX_OEM_STRING);
|
||||
AsciiStrCatS(OEMString, MAX_OEM_STRING, "Apple ROM Version.\n");
|
||||
//AsciiStrCatS(OEMString, MAX_OEM_STRING, " BIOS ID:");
|
||||
//AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.RomVersion, iStrLen(gSettings.RomVersion, 64));
|
||||
// AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n EFI Version:");
|
||||
// AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.EfiVersion, iStrLen(gSettings.EfiVersion, 64));
|
||||
AsciiStrCatS(OEMString, MAX_OEM_STRING, " Board-ID : ");
|
||||
AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64));
|
||||
snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", gRevisionStr);
|
||||
AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
|
||||
// ZeroMem(OEMString, MAX_OEM_STRING);
|
||||
// AsciiStrCatS(OEMString, MAX_OEM_STRING, "Apple ROM Version.\n");
|
||||
// //AsciiStrCatS(OEMString, MAX_OEM_STRING, " BIOS ID:");
|
||||
// //AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.RomVersion, iStrLen(gSettings.RomVersion, 64));
|
||||
// // AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n EFI Version:");
|
||||
// // AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.EfiVersion, iStrLen(gSettings.EfiVersion, 64));
|
||||
// AsciiStrCatS(OEMString, MAX_OEM_STRING, " Board-ID : ");
|
||||
// AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64));
|
||||
// snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", gRevisionStr);
|
||||
// AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
|
||||
XString8 OEMString = S8Printf("Apple ROM Version.\n Board-ID : %s\n⌘ Powered by %s\n", gSettings.BoardNumber.c_str(), gRevisionStr);
|
||||
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type11->StringCount, OEMString);
|
||||
|
||||
@ -1288,8 +1300,8 @@ VOID GetTableType17()
|
||||
|
||||
VOID PatchTableType17()
|
||||
{
|
||||
CHAR8 deviceLocator[10];
|
||||
CHAR8 bankLocator[10];
|
||||
XString8 deviceLocator;
|
||||
XString8 bankLocator;
|
||||
UINT8 channelMap[MAX_RAM_SLOTS];
|
||||
UINT8 expectedCount = 0;
|
||||
UINT8 channels = 2;
|
||||
@ -1351,13 +1363,13 @@ VOID PatchTableType17()
|
||||
newSmbiosTable.Type17->DeviceSet = bank + 1;
|
||||
newSmbiosTable.Type17->MemoryArrayHandle = mHandle16;
|
||||
if (isMacPro) {
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
deviceLocator.S8Printf("DIMM%d", gRAMCount + 1);
|
||||
} else {
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
snprintf(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, (CONST CHAR8*)&bankLocator[0]);
|
||||
deviceLocator.S8Printf("DIMM%d", bank);
|
||||
bankLocator.S8Printf("BANK %llu", Index % channels);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, bankLocator);
|
||||
}
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, (CONST CHAR8*)&deviceLocator[0]);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, deviceLocator);
|
||||
if ((gRAM.User[UserIndex].InUse) && (gRAM.User[UserIndex].ModuleSize > 0)) {
|
||||
DBG("user SMBIOS data:\n");
|
||||
DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.User[UserIndex].Vendor);
|
||||
@ -1365,18 +1377,18 @@ VOID PatchTableType17()
|
||||
DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.User[UserIndex].PartNo);
|
||||
|
||||
if (iStrLen(gRAM.User[UserIndex].Vendor, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.User[UserIndex].Vendor);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.User[UserIndex].Vendor));
|
||||
} else {
|
||||
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.User[UserIndex].SerialNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.User[UserIndex].SerialNo);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, LString8(gRAM.User[UserIndex].SerialNo));
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.User[UserIndex].PartNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.User[UserIndex].PartNo);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, LString8(gRAM.User[UserIndex].PartNo));
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown);
|
||||
}
|
||||
@ -1395,12 +1407,12 @@ VOID PatchTableType17()
|
||||
(newSmbiosTable.Type17->MemoryType != MemoryTypeDdr)) {
|
||||
newSmbiosTable.Type17->MemoryType = MemoryTypeDdr3;
|
||||
}
|
||||
DBG("%s %s %dMHz %dMB(Ext:%dMB)\n", bankLocator, deviceLocator, newSmbiosTable.Type17->Speed,
|
||||
DBG("%s %s %dMHz %dMB(Ext:%dMB)\n", bankLocator.c_str(), deviceLocator.c_str(), newSmbiosTable.Type17->Speed,
|
||||
newSmbiosTable.Type17->Size, newSmbiosTable.Type17->ExtendedSize);
|
||||
mMemory17[gRAMCount] = (UINT16)mTotalSystemMemory;
|
||||
// DBG("mTotalSystemMemory = %d\n", mTotalSystemMemory);
|
||||
} else {
|
||||
DBG("%s %s EMPTY\n", bankLocator, deviceLocator);
|
||||
DBG("%s %s EMPTY\n", bankLocator.c_str(), deviceLocator.c_str());
|
||||
}
|
||||
newSmbiosTable.Type17->MemoryErrorInformationHandle = 0xFFFF;
|
||||
mHandle17[gRAMCount++] = LogSmbiosTable(newSmbiosTable);
|
||||
@ -1598,22 +1610,22 @@ VOID PatchTableType17()
|
||||
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, gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
snprintf(gSettings.MemoryManufacturer, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.SMBIOS[SMBIOSIndex].Vendor));
|
||||
gSettings.MemoryManufacturer.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->Manufacturer = 0;
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].SerialNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
snprintf(gSettings.MemorySerialNumber, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, LString8(gRAM.SMBIOS[SMBIOSIndex].SerialNo));
|
||||
gSettings.MemorySerialNumber.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].SerialNo);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->SerialNumber = 0;
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].PartNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
snprintf(gSettings.MemoryPartNumber, 64, "%s", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, LString8(gRAM.SMBIOS[SMBIOSIndex].PartNo));
|
||||
gSettings.MemoryPartNumber.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
DBG(" partNum=%s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo);
|
||||
} else {
|
||||
// newSmbiosTable.Type17->PartNumber = 0;
|
||||
@ -1641,20 +1653,20 @@ VOID PatchTableType17()
|
||||
DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SPD[SPDIndex].PartNo);
|
||||
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].Vendor, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SPD[SPDIndex].Vendor);
|
||||
snprintf(gSettings.MemoryManufacturer, 64, "%s", gRAM.SPD[SPDIndex].Vendor);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.SPD[SPDIndex].Vendor));
|
||||
gSettings.MemoryManufacturer.takeValueFrom(gRAM.SPD[SPDIndex].Vendor);
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].SerialNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SPD[SPDIndex].SerialNo);
|
||||
snprintf(gSettings.MemorySerialNumber, 64, "%s", gRAM.SPD[SPDIndex].SerialNo);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, LString8(gRAM.SPD[SPDIndex].SerialNo));
|
||||
gSettings.MemorySerialNumber.takeValueFrom(gRAM.SPD[SPDIndex].SerialNo);
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
|
||||
}
|
||||
if (iStrLen(gRAM.SPD[SPDIndex].PartNo, 64) > 0) {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SPD[SPDIndex].PartNo);
|
||||
snprintf(gSettings.MemoryPartNumber, 64, "%s", gRAM.SPD[SPDIndex].PartNo);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, LString8(gRAM.SPD[SPDIndex].PartNo));
|
||||
gSettings.MemoryPartNumber.takeValueFrom(gRAM.SPD[SPDIndex].PartNo);
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown);
|
||||
}
|
||||
@ -1680,10 +1692,10 @@ VOID PatchTableType17()
|
||||
(iStrLen(gRAM.SMBIOS[SMBIOSIndex].Vendor, 64) > 0) &&
|
||||
(strncmp(gRAM.SPD[SPDIndex].Vendor, "NoName", 6) == 0)) {
|
||||
DBG("Type17->Manufacturer corrected by SMBIOS from NoName to %s\n", gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SMBIOS[SMBIOSIndex].Vendor);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.SMBIOS[SMBIOSIndex].Vendor));
|
||||
}
|
||||
|
||||
snprintf(gSettings.MemorySpeed, 64, "%d", newSmbiosTable.Type17->Speed);
|
||||
gSettings.MemorySpeed.S8Printf("%d", newSmbiosTable.Type17->Speed);
|
||||
|
||||
// Assume DDR3 unless explicitly set to DDR2/DDR/DDR4
|
||||
if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) &&
|
||||
@ -1694,25 +1706,25 @@ VOID PatchTableType17()
|
||||
|
||||
//now I want to update deviceLocator and bankLocator
|
||||
if (isMacPro) {
|
||||
snprintf(deviceLocator, 10, "DIMM%d", gRAMCount + 1);
|
||||
bankLocator[0] = 0;
|
||||
deviceLocator.S8Printf("DIMM%d", gRAMCount + 1);
|
||||
bankLocator.setEmpty();
|
||||
} else {
|
||||
snprintf(deviceLocator, 10, "DIMM%d", bank);
|
||||
snprintf(bankLocator, 10, "BANK %llu", Index % channels);
|
||||
deviceLocator.S8Printf("DIMM%d", bank);
|
||||
bankLocator.S8Printf("BANK %llu", Index % channels);
|
||||
}
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, (CONST CHAR8*)&deviceLocator[0]);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, deviceLocator);
|
||||
if (isMacPro) {
|
||||
newSmbiosTable.Type17->BankLocator = 0; //like in MacPro5,1
|
||||
} else {
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, (CONST CHAR8*)&bankLocator[0]);
|
||||
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, bankLocator);
|
||||
}
|
||||
DBG("SMBIOS Type 17 Index = %d => %llu %llu:\n", gRAMCount, SMBIOSIndex, SPDIndex);
|
||||
if (newSmbiosTable.Type17->Size == 0) {
|
||||
DBG("%s %s EMPTY\n", bankLocator, deviceLocator);
|
||||
DBG("%s %s EMPTY\n", bankLocator.c_str(), deviceLocator.c_str());
|
||||
newSmbiosTable.Type17->MemoryType = 0; //MemoryTypeUnknown;
|
||||
} else {
|
||||
insertingEmpty = FALSE;
|
||||
DBG("%s %s %dMHz %dMB(Ext:%dMB)\n", bankLocator, deviceLocator, newSmbiosTable.Type17->Speed,
|
||||
DBG("%s %s %dMHz %dMB(Ext:%dMB)\n", bankLocator.c_str(), deviceLocator.c_str(), newSmbiosTable.Type17->Speed,
|
||||
newSmbiosTable.Type17->Size, newSmbiosTable.Type17->ExtendedSize);
|
||||
if (newSmbiosTable.Type17->Size == 0x7FFF) {
|
||||
mTotalSystemMemory += newSmbiosTable.Type17->ExtendedSize; //Mb
|
||||
@ -2052,8 +2064,8 @@ EFI_STATUS PrepatchSmbios()
|
||||
}
|
||||
|
||||
//Create space for SPD
|
||||
//gRAM = (__typeof__(gRAM))BllocateZeroPool(sizeof(MEM_STRUCTURE));
|
||||
//gDMI = (__typeof__(gDMI))BllocateZeroPool(sizeof(DMI));
|
||||
//gRAM = (__typeof__(gRAM))AllocateZeroPool(sizeof(MEM_STRUCTURE));
|
||||
//gDMI = (__typeof__(gDMI))AllocateZeroPool(sizeof(DMI));
|
||||
|
||||
//Collect information for use in menu
|
||||
GetTableType1();
|
||||
@ -2073,7 +2085,7 @@ VOID PatchSmbios(VOID) //continue
|
||||
|
||||
DbgHeader("PatchSmbios");
|
||||
|
||||
newSmbiosTable.Raw = (UINT8*)BllocateZeroPool(MAX_TABLE_SIZE);
|
||||
newSmbiosTable.Raw = (UINT8*)AllocateZeroPool(MAX_TABLE_SIZE);
|
||||
//Slice - order of patching is significant
|
||||
PatchTableType0();
|
||||
PatchTableType1();
|
||||
|
@ -671,7 +671,7 @@ STATIC VOID read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
|
||||
// needed at least for laptops
|
||||
//fullBanks = (gDMI->MemoryModules == gDMI->CntMemorySlots);
|
||||
|
||||
spdbuf = (__typeof__(spdbuf))BllocateZeroPool(MAX_SPD_SIZE);
|
||||
spdbuf = (__typeof__(spdbuf))AllocateZeroPool(MAX_SPD_SIZE);
|
||||
|
||||
// Search MAX_RAM_SLOTS slots
|
||||
//==>
|
||||
|
@ -136,7 +136,7 @@ class XBuffer : public XBuffer_Super
|
||||
|
||||
void cat(void* p) { ncat(&p, sizeof(p)); };
|
||||
|
||||
void cat(const XString8 &aXString8);
|
||||
// void cat(const XString8 &aXString8);
|
||||
void cat(const XBuffer &unXBuffer) { ncat(unXBuffer.Length()); ncat(unXBuffer.Data(), unXBuffer.Length()); }
|
||||
void deleteAtPos(unsigned int pos, unsigned int count=1);
|
||||
|
||||
@ -282,13 +282,13 @@ void XBuffer<T>::ncat(const void *buf, size_t len)
|
||||
setSize(size()+len);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void XBuffer<T>::cat(const XString8 &aXString8)
|
||||
{
|
||||
cat(aXString8.sizeInBytes());
|
||||
cat(aXString8.data(),aXString8.sizeInBytes());
|
||||
};
|
||||
//
|
||||
//template <typename T>
|
||||
//void XBuffer<T>::cat(const XString8 &aXString8)
|
||||
//{
|
||||
// cat(aXString8.sizeInBytes());
|
||||
// cat(aXString8.s(), aXString8.sizeInBytes());
|
||||
//};
|
||||
|
||||
template <typename T>
|
||||
void XBuffer<T>::deleteAtPos(unsigned int pos, unsigned int count)
|
||||
|
@ -232,10 +232,6 @@ public:
|
||||
|
||||
// no assignement, no destructor
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* data(IntegralType pos) const { return _data(pos); }
|
||||
|
||||
|
||||
size_t length() const { return length_of_utf_string(m_data); }
|
||||
// size_t sizeZZ() const { return size_of_utf_string(m_data); }
|
||||
size_t sizeInNativeChars() const { return size_of_utf_string(m_data); }
|
||||
@ -244,7 +240,7 @@ public:
|
||||
|
||||
|
||||
const T* s() const { return m_data; }
|
||||
const T* data() const { return m_data; } // todo delete
|
||||
const T* data() const { return m_data; }
|
||||
|
||||
/* Empty ? */
|
||||
bool isEmpty() const { return m_data == nullptr || *m_data == 0; }
|
||||
@ -592,8 +588,12 @@ class XStringAbstract : public __String<T, ThisXStringClass>
|
||||
*/
|
||||
void Alloc(size_t nNewSize)
|
||||
{
|
||||
if ( m_allocatedSize == 0 ) m_data = (T*)malloc( nNewSize*sizeof(T) );
|
||||
else m_data = (T*)Xrealloc(m_data, nNewSize*sizeof(T), m_allocatedSize*sizeof(T));
|
||||
if ( m_allocatedSize == 0 ) {
|
||||
m_data = (T*)malloc( nNewSize*sizeof(T) );
|
||||
}
|
||||
else {
|
||||
m_data = (T*)Xrealloc(m_data, nNewSize*sizeof(T), m_allocatedSize*sizeof(T));
|
||||
}
|
||||
if ( !m_data ) {
|
||||
panic("XStringAbstract::Alloc(%zu) : Xrealloc(%" PRIuPTR ", %lu, %zd) returned NULL. System halted\n", nNewSize, uintptr_t(m_data), nNewSize*sizeof(T), m_allocatedSize*sizeof(T));
|
||||
}
|
||||
@ -604,7 +604,7 @@ class XStringAbstract : public __String<T, ThisXStringClass>
|
||||
/*
|
||||
* Make sure this string has allocated size of at least nNewSize+1.
|
||||
*/
|
||||
T *CheckSize(size_t nNewSize, size_t nGrowBy = XStringGrowByDefault) // nNewSize is in number of chars, NOT bytes
|
||||
bool CheckSize(size_t nNewSize, size_t nGrowBy = XStringGrowByDefault) // nNewSize is in number of chars, NOT bytes
|
||||
{
|
||||
//DBG_XSTRING("CheckSize: m_size=%d, nNewSize=%d\n", m_size, nNewSize);
|
||||
if ( m_allocatedSize < nNewSize+1 )
|
||||
@ -617,11 +617,13 @@ class XStringAbstract : public __String<T, ThisXStringClass>
|
||||
m_data = NULL;
|
||||
Alloc(nNewSize+1);
|
||||
utf_string_from_utf_string(m_data, m_allocatedSize, m_dataSav);
|
||||
return true;
|
||||
}else{
|
||||
Alloc(nNewSize+1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return m_data;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// void setSize(size_t newSize) // nNewSize is in number of chars, NOT bytes
|
||||
// {
|
||||
@ -697,6 +699,10 @@ public:
|
||||
else m_data[0] = 0;
|
||||
}
|
||||
|
||||
T* data() const { return m_data; }
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* data(IntegralType pos) const { return __String<T, ThisXStringClass>::_data(pos); }
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* dataSized(IntegralType size)
|
||||
@ -894,6 +900,39 @@ public:
|
||||
return *((ThisXStringClass*)this);
|
||||
}
|
||||
|
||||
ThisXStringClass& replaceAll(char32_t charToSearch, char32_t charToReplaceBy)
|
||||
{
|
||||
size_t currentSize = __String<T, ThisXStringClass>::sizeInNativeChars(); // size is number of T, not in bytes
|
||||
size_t charToSearchSize = utf_size_of_utf_string_len(m_data, &charToSearch, 1); // size is number of T, not in bytes
|
||||
size_t charToReplaceBySize = utf_size_of_utf_string_len(m_data, &charToReplaceBy, 1); // size is number of T, not in bytes
|
||||
// careful because 'charToReplaceBySize - charToSearchSize' overflows when charToSearchSize > charToReplaceBySize, which happens.
|
||||
|
||||
char32_t char32;
|
||||
T* previousData = m_data;
|
||||
T* previousP = m_data;
|
||||
T* p = get_char32_from_string(previousP, &char32);;
|
||||
while ( char32 ) {
|
||||
if (!char32) break;
|
||||
if ( char32 == charToSearch ) {
|
||||
if ( CheckSize(currentSize + charToReplaceBySize - charToSearchSize) ) {
|
||||
previousP = m_data + ( previousP - previousData );
|
||||
p = m_data + ( p - previousData );
|
||||
previousData = m_data;
|
||||
}
|
||||
memmove(p+charToReplaceBySize-charToSearchSize, p, uintptr_t(m_data + currentSize - p + 1)*sizeof(T));
|
||||
p += charToReplaceBySize;
|
||||
p -= charToSearchSize;
|
||||
currentSize += charToReplaceBySize;
|
||||
currentSize -= charToSearchSize;
|
||||
utf_stringnn_from_utf_string(previousP, charToReplaceBySize, &charToReplaceBy);
|
||||
}
|
||||
previousP = p;
|
||||
p = get_char32_from_string(previousP, &char32);;
|
||||
}
|
||||
return *((ThisXStringClass*)this);
|
||||
}
|
||||
|
||||
|
||||
void trim()
|
||||
{
|
||||
T* start = 0;
|
||||
@ -946,7 +985,7 @@ public:
|
||||
template<typename O, enable_if(is_char(O))>
|
||||
ThisXStringClass& takeValueFrom(const O C) { strcpy(C); return *((ThisXStringClass*)this); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const __String<O, OtherXStringClass>& S, size_t len) { strncpy(S.data(0), len); return *((ThisXStringClass*)this); }
|
||||
ThisXStringClass& takeValueFrom(const __String<O, OtherXStringClass>& S, size_t len) { strncpy(S.s(), len); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& takeValueFrom(const O* S, size_t len) { strncpy(S, len); return *((ThisXStringClass*)this); }
|
||||
|
||||
|
@ -31,24 +31,24 @@ struct _xstringarray__char_type<T*, enable_if_t(is_char(T))>
|
||||
{
|
||||
static const T* getCharPtr(T* t) { return t; }
|
||||
};
|
||||
//
|
||||
|
||||
//template<typename T>
|
||||
//struct _xstringarray__char_type<const T*, enable_if_t(is_char(T))>
|
||||
//{
|
||||
// static const T* getCharPtr(const T* t) { return t; }
|
||||
//};
|
||||
//
|
||||
//template<typename T>
|
||||
//struct _xstringarray__char_type<const T[]>
|
||||
//{
|
||||
// static const T* getCharPtr(const T* t) { return t; }
|
||||
//};
|
||||
//
|
||||
//template<typename T, size_t _Np>
|
||||
//struct _xstringarray__char_type<const T[_Np]>
|
||||
//{
|
||||
// static const T* getCharPtr(const T* t) { return t; }
|
||||
//};
|
||||
|
||||
template<typename T>
|
||||
struct _xstringarray__char_type<const T[]>
|
||||
{
|
||||
static const T* getCharPtr(T* t) { return t; }
|
||||
};
|
||||
|
||||
template<typename T, size_t _Np>
|
||||
struct _xstringarray__char_type<T[_Np]>
|
||||
{
|
||||
static const T* getCharPtr(const T* t) { return t; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -244,6 +244,11 @@ size_t length_of_wchar_string(const wchar_t* s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
inline char* get_char32_from_string(char* s, char32_t* char32) { return (char*)get_char32_from_utf8_string(s, char32); }
|
||||
inline char16_t* get_char32_from_string(char16_t* s, char32_t* char32) { return (char16_t*)get_char32_from_utf16_string(s, char32); }
|
||||
inline char32_t* get_char32_from_string(char32_t* s, char32_t* char32) { *char32 = *s; if ( !*s ) return s; return s+1; }
|
||||
inline wchar_t* get_char32_from_string(wchar_t* s, char32_t* char32) { return (wchar_t*)get_char32_from_string((wchar_cast*)s, char32); }
|
||||
|
||||
inline const char* get_char32_from_string(const char* s, char32_t* char32) { return get_char32_from_utf8_string(s, char32); }
|
||||
inline const char16_t* get_char32_from_string(const char16_t* s, char32_t* char32) { return get_char32_from_utf16_string(s, char32); }
|
||||
inline const char32_t* get_char32_from_string(const char32_t* s, char32_t* char32) { *char32 = *s; if ( !*s ) return s; return s+1; }
|
||||
|
@ -1518,6 +1518,10 @@ class C
|
||||
//constexpr LStringW g_xsw1 = L"foobar";
|
||||
//XString g_xs2 = "foobar"_XS8;
|
||||
|
||||
|
||||
// U'𐄔' = 0x10114 : this is 2 utf16 chars (codepoint > 0xFFFF)
|
||||
// U'𐅃' = 0x10143 : this is 2 utf16 chars (codepoint > 0xFFFF)
|
||||
|
||||
int XString_tests()
|
||||
{
|
||||
#ifdef JIEF_DEBUG
|
||||
@ -1576,6 +1580,12 @@ int XString_tests()
|
||||
XString8 xs8 = " toTRIM "_XS8;
|
||||
// xs8.trim();
|
||||
xs8.lowerAscii();
|
||||
|
||||
XString8 xsReplace = "babcbdeb"_XS8;
|
||||
xsReplace.replaceAll(U'b', U'𐅃');
|
||||
|
||||
XString8 xsReplace2 = "𐄔a𐄔c𐄔de𐄔"_XS8;
|
||||
xsReplace2.replaceAll(U'𐄔', U'x');
|
||||
|
||||
// Quick check of stealValueFrom. TOTO proper test
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ static EFI_STATUS AddLockedGraphicsGOP(IN EFI_HANDLE Handle, IN EFI_HANDLE Agent
|
||||
}
|
||||
// Create a new locked graphics if needed
|
||||
if (Ptr == NULL) {
|
||||
Ptr = (LOCKED_GRAPHICS *)BllocateZeroPool(sizeof(LOCKED_GRAPHICS));
|
||||
Ptr = (LOCKED_GRAPHICS *)AllocateZeroPool(sizeof(LOCKED_GRAPHICS));
|
||||
if (Ptr == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -319,7 +319,7 @@ static EFI_STATUS AddLockedGraphicsUGA(IN EFI_HANDLE Handle, IN EFI_HANDLE Agent
|
||||
}
|
||||
// Create a new locked graphics if needed
|
||||
if (Ptr == NULL) {
|
||||
Ptr = (LOCKED_GRAPHICS *)BllocateZeroPool(sizeof(LOCKED_GRAPHICS));
|
||||
Ptr = (LOCKED_GRAPHICS *)AllocateZeroPool(sizeof(LOCKED_GRAPHICS));
|
||||
if (Ptr == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ STATIC EFI_STATUS AppendSignatureToList(IN OUT EFI_SIGNATURE_LIST **SignatureLis
|
||||
OldSignatureList = *SignatureList;
|
||||
if (OldSignatureList == NULL) {
|
||||
// There is no list so create a new signature list
|
||||
NewSignatureList = (EFI_SIGNATURE_LIST *)BllocateZeroPool(sizeof(EFI_SIGNATURE_LIST) + DataSize);
|
||||
NewSignatureList = (EFI_SIGNATURE_LIST *)AllocateZeroPool(sizeof(EFI_SIGNATURE_LIST) + DataSize);
|
||||
if (NewSignatureList == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -162,7 +162,7 @@ STATIC EFI_STATUS AppendSignatureToList(IN OUT EFI_SIGNATURE_LIST **SignatureLis
|
||||
Ptr += OldSignatureList->SignatureSize;
|
||||
}
|
||||
// Create a new list for signatures
|
||||
NewSignatureList = (EFI_SIGNATURE_LIST *)BllocateZeroPool(OldSignatureList->SignatureListSize + DataSize);
|
||||
NewSignatureList = (EFI_SIGNATURE_LIST *)AllocateZeroPool(OldSignatureList->SignatureListSize + DataSize);
|
||||
if (NewSignatureList == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@ -666,7 +666,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
|
||||
SectionPtr = (EFI_IMAGE_SECTION_HEADER *)(ImageBase + PeHeaderOffset + sizeof(EFI_IMAGE_FILE_HEADER) +
|
||||
sizeof(UINT32) + PeHeader.Pe32->FileHeader.SizeOfOptionalHeader);
|
||||
// Allocate a new array for the image section headers
|
||||
Sections = (__typeof__(Sections))BllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
|
||||
Sections = (__typeof__(Sections))AllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
|
||||
if (Sections == NULL) {
|
||||
goto Failed;
|
||||
}
|
||||
@ -711,7 +711,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
|
||||
}
|
||||
// Create the signature list
|
||||
Size = (sizeof(EFI_SIGNATURE_LIST) + sizeof(EFI_GUID) + 256);
|
||||
Database = (__typeof__(Database))BllocateZeroPool(Size);
|
||||
Database = (__typeof__(Database))AllocateZeroPool(Size);
|
||||
if (Database == NULL) {
|
||||
goto Failed;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ VOID *GetSignatureDatabase(IN CHAR16 *DatabaseName,
|
||||
return NULL;
|
||||
}
|
||||
// Allocate a buffer large enough to hold the database
|
||||
Database = (__typeof__(Database))BllocateZeroPool(Size);
|
||||
Database = (__typeof__(Database))AllocateZeroPool(Size);
|
||||
if (Database == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -453,7 +453,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
|
||||
EVP_PKEY_free(PrivateKey);
|
||||
|
||||
DataSize = i2d_PKCS7(p7, NULL);
|
||||
Data = (__typeof__(Data))BllocateZeroPool(DataSize);
|
||||
Data = (__typeof__(Data))AllocateZeroPool(DataSize);
|
||||
|
||||
i2d_PKCS7(p7, (unsigned char **)&Data);
|
||||
|
||||
@ -468,7 +468,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
|
||||
}
|
||||
// Create the authentication buffer
|
||||
DBG("Creating authentication ...\n");
|
||||
Authentication = (EFI_VARIABLE_AUTHENTICATION_2 *)BllocateZeroPool(Size);
|
||||
Authentication = (EFI_VARIABLE_AUTHENTICATION_2 *)AllocateZeroPool(Size);
|
||||
if (Authentication == NULL) {
|
||||
if (Data != NULL) {
|
||||
FreePool(Data);
|
||||
|
@ -804,7 +804,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
|
||||
|
||||
if (HaveTimeout) {
|
||||
XStringW TOMessage = SWPrintf("%ls in %lld seconds", TimeoutText.wc_str(), TimeoutCountdown);
|
||||
((*this).*(StyleFunc))(MENU_FUNCTION_PAINT_TIMEOUT, TOMessage.data());
|
||||
((*this).*(StyleFunc))(MENU_FUNCTION_PAINT_TIMEOUT, TOMessage.wc_str());
|
||||
}
|
||||
|
||||
if (gEvent) { //for now used at CD eject.
|
||||
@ -1156,7 +1156,7 @@ VOID REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
|
||||
for (i = 0; i < (INTN)InfoLines.size(); i++) {
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 3, 4 + i);
|
||||
gST->ConOut->OutputString (gST->ConOut, InfoLines[i].data());
|
||||
gST->ConOut->OutputString (gST->ConOut, InfoLines[i].wc_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2396,7 +2396,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
|
||||
ThemeX.FillRectAreaOfScreen(textPosX, textPosY, EntriesWidth + ThemeX.TileXSpace,
|
||||
MessageHeight);
|
||||
DrawBCSText(Entries[i].Title.data(), textPosX, textPosY, X_IS_CENTER);
|
||||
DrawBCSText(Entries[i].Title.wc_str(), textPosX, textPosY, X_IS_CENTER);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -2591,7 +2591,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
|
||||
|
||||
if (MenuExit == MENU_EXIT_DETAILS && MainChosenEntry->SubScreen != NULL) {
|
||||
XString8Array TmpArgs;
|
||||
if (AsciiStrLen(gSettings.BootArgs) > 0) {
|
||||
if ( gSettings.BootArgs.length() > 0) {
|
||||
TmpArgs = Split<XString8Array>(gSettings.BootArgs, " ");
|
||||
}
|
||||
SubMenuIndex = -1;
|
||||
@ -2653,11 +2653,11 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
|
||||
|
||||
if (/*MenuExit == MENU_EXIT_ENTER &&*/ TempChosenEntry->getLOADER_ENTRY()) {
|
||||
if (TempChosenEntry->getLOADER_ENTRY()->LoadOptions.notEmpty()) {
|
||||
snprintf(gSettings.BootArgs, 255, "%s", TempChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS8).c_str());
|
||||
gSettings.BootArgs = TempChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS8);
|
||||
} else {
|
||||
ZeroMem(&gSettings.BootArgs, 255);
|
||||
}
|
||||
DBG(" boot with args: %s\n", gSettings.BootArgs);
|
||||
DBG(" boot with args: %s\n", gSettings.BootArgs.c_str());
|
||||
}
|
||||
|
||||
//---- Details submenu (kexts disabling etc)
|
||||
|
@ -114,7 +114,7 @@ EfiLibFileSystemVolumeLabelInfo (
|
||||
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;
|
||||
VolumeInfo = (__typeof__(VolumeInfo))BllocateZeroPool(Size);
|
||||
VolumeInfo = (__typeof__(VolumeInfo))AllocateZeroPool(Size);
|
||||
Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo);
|
||||
// Check to make sure this isn't actually EFI_FILE_SYSTEM_INFO
|
||||
if (!EFI_ERROR(Status))
|
||||
@ -207,7 +207,7 @@ EfiLibFileInfo (
|
||||
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;
|
||||
FileInfo = (__typeof__(FileInfo))BllocateZeroPool(Size);
|
||||
FileInfo = (__typeof__(FileInfo))AllocateZeroPool(Size);
|
||||
Status = FHand->GetInfo (FHand, &gEfiFileInfoGuid, &Size, FileInfo);
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ EfiLibFileSystemInfo (
|
||||
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;
|
||||
FileSystemInfo = (__typeof__(FileSystemInfo))BllocateZeroPool(Size);
|
||||
FileSystemInfo = (__typeof__(FileSystemInfo))AllocateZeroPool(Size);
|
||||
Status = FHand->GetInfo (FHand, &gEfiFileSystemInfoGuid, &Size, FileSystemInfo);
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ EfiReallocatePool (
|
||||
|
||||
NewPool = NULL;
|
||||
if (NewSize != 0) {
|
||||
NewPool = (__typeof__(NewPool))BllocateZeroPool(NewSize);
|
||||
NewPool = (__typeof__(NewPool))AllocateZeroPool(NewSize);
|
||||
}
|
||||
|
||||
if (OldPool != NULL) {
|
||||
|
@ -365,7 +365,7 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
NewFilm->SetIndex((UINTN)GetPropertyInteger(Dict2, 1)); //default=main screen
|
||||
|
||||
Dict2 = GetProperty(Dict3, "Path");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string.notEmpty() ) {
|
||||
NewFilm->Path.takeValueFrom(Dict2->string);
|
||||
}
|
||||
|
||||
@ -376,19 +376,19 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
NewFilm->FrameTime = (UINTN)GetPropertyInteger(Dict2, 50); //default will be 50ms
|
||||
|
||||
Dict2 = GetProperty(Dict3, "ScreenEdgeX");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp(Dict2->string, "left") == 0) {
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string.notEmpty() ) {
|
||||
if (Dict2->string.equal("left")) {
|
||||
NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT;
|
||||
} else if (AsciiStrCmp(Dict2->string, "right") == 0) {
|
||||
} else if (Dict2->string.equal("right")) {
|
||||
NewFilm->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty(Dict3, "ScreenEdgeY");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp(Dict2->string, "top") == 0) {
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string.notEmpty() ) {
|
||||
if (Dict2->string.equal("top")) {
|
||||
NewFilm->ScreenEdgeVertical = SCREEN_EDGE_TOP;
|
||||
} else if (AsciiStrCmp(Dict2->string, "bottom") == 0) {
|
||||
} else if (Dict2->string.equal("bottom")) {
|
||||
NewFilm->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM;
|
||||
}
|
||||
}
|
||||
@ -484,7 +484,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
|
||||
if (!p) {
|
||||
return 0;
|
||||
}
|
||||
NSVGtext* text = (NSVGtext*)BllocateZeroPool(sizeof(NSVGtext));
|
||||
NSVGtext* text = (NSVGtext*)AllocateZeroPool(sizeof(NSVGtext));
|
||||
if (!text) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -609,16 +609,16 @@ EFI_STATUS XImage::LoadXImage(EFI_FILE *BaseDir, const XStringW& IconName)
|
||||
|
||||
// load file
|
||||
XStringW FileName = L"icons\\" + IconName + L".icns";
|
||||
Status = egLoadFile(BaseDir, FileName.data(), &FileData, &FileDataLength);
|
||||
Status = egLoadFile(BaseDir, FileName.wc_str(), &FileData, &FileDataLength);
|
||||
if (EFI_ERROR(Status)) {
|
||||
FileName = L"icons\\" + IconName + L".png";
|
||||
Status = egLoadFile(BaseDir, FileName.data(), &FileData, &FileDataLength);
|
||||
Status = egLoadFile(BaseDir, FileName.wc_str(), &FileData, &FileDataLength);
|
||||
if (EFI_ERROR(Status)) {
|
||||
FileName = IconName + L".png";
|
||||
Status = egLoadFile(BaseDir, FileName.data(), &FileData, &FileDataLength);
|
||||
Status = egLoadFile(BaseDir, FileName.wc_str(), &FileData, &FileDataLength);
|
||||
if (EFI_ERROR(Status)) {
|
||||
FileName = IconName; //may be it already contain extension, for example Logo.png
|
||||
Status = egLoadFile(BaseDir, FileName.data(), &FileData, &FileDataLength);
|
||||
Status = egLoadFile(BaseDir, FileName.wc_str(), &FileData, &FileDataLength);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
@ -629,7 +629,7 @@ EFI_STATUS XImage::LoadXImage(EFI_FILE *BaseDir, const XStringW& IconName)
|
||||
// decode it
|
||||
Status = FromPNG(FileData, FileDataLength);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG("%ls not decoded. Status=%s\n", IconName.data(), strerror(Status));
|
||||
DBG("%ls not decoded. Status=%s\n", IconName.wc_str(), strerror(Status));
|
||||
}
|
||||
FreePool(FileData);
|
||||
return Status;
|
||||
|
@ -488,10 +488,10 @@ static void nsvg__curveBounds(float* bounds, float* curve)
|
||||
NSVGparser* nsvg__createParser()
|
||||
{
|
||||
NSVGparser* p;
|
||||
p = (NSVGparser*)BllocateZeroPool(sizeof(NSVGparser));
|
||||
p = (NSVGparser*)AllocateZeroPool(sizeof(NSVGparser));
|
||||
if (p == NULL) return NULL;
|
||||
|
||||
p->image = (NSVGimage*)BllocateZeroPool(sizeof(NSVGimage));
|
||||
p->image = (NSVGimage*)AllocateZeroPool(sizeof(NSVGimage));
|
||||
if (p->image == NULL) {
|
||||
FreePool(p);
|
||||
return NULL;
|
||||
@ -797,7 +797,7 @@ static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
|
||||
|
||||
static NSVGgradientLink* nsvg__createGradientLink(const char* id)
|
||||
{
|
||||
NSVGgradientLink* grad = (NSVGgradientLink*)BllocateZeroPool(sizeof(NSVGgradientLink));
|
||||
NSVGgradientLink* grad = (NSVGgradientLink*)AllocateZeroPool(sizeof(NSVGgradientLink));
|
||||
if (grad == NULL) return NULL;
|
||||
strncpy(grad->id, id, 63);
|
||||
grad->id[63] = '\0';
|
||||
@ -838,7 +838,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, NSVGshape* shape, NSVGg
|
||||
}
|
||||
if (stops == NULL) return NULL;
|
||||
// DumpFloat2("gradient final xform:", data->xform, 6);
|
||||
grad = (NSVGgradient*)BllocateZeroPool(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1));
|
||||
grad = (NSVGgradient*)AllocateZeroPool(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1));
|
||||
if (grad == NULL) return NULL;
|
||||
// The shape width and height.
|
||||
if (data->units == NSVG_OBJECT_SPACE) {
|
||||
@ -967,7 +967,7 @@ static void nsvg__addShape(NSVGparser* p)
|
||||
if (p->plist == NULL /*&& !p->isText*/ )
|
||||
return;
|
||||
|
||||
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
|
||||
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
|
||||
if (shape == NULL) return;
|
||||
|
||||
memcpy(shape->id, attr->id, sizeof shape->id);
|
||||
@ -1102,11 +1102,11 @@ static void nsvg__addPath(NSVGparser* p, char closed)
|
||||
if (closed)
|
||||
nsvg__lineTo(p, p->pts[0], p->pts[1]);
|
||||
|
||||
path = (NSVGpath*)BllocateZeroPool(sizeof(NSVGpath));
|
||||
path = (NSVGpath*)AllocateZeroPool(sizeof(NSVGpath));
|
||||
if (path == NULL) {
|
||||
return;
|
||||
}
|
||||
path->pts = (float*)BllocateZeroPool(p->npts*2*sizeof(float));
|
||||
path->pts = (float*)AllocateZeroPool(p->npts*2*sizeof(float));
|
||||
if (path->pts == NULL) {
|
||||
FreePool(path);
|
||||
return;
|
||||
@ -1853,7 +1853,7 @@ static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* str
|
||||
|
||||
static NSVGclipPath* nsvg__createClipPath(const char* name, int index)
|
||||
{
|
||||
NSVGclipPath* clipPath = (NSVGclipPath*)BllocateZeroPool(sizeof(NSVGclipPath));
|
||||
NSVGclipPath* clipPath = (NSVGclipPath*)AllocateZeroPool(sizeof(NSVGclipPath));
|
||||
if (clipPath == NULL) return NULL;
|
||||
|
||||
strncpy(clipPath->id, name, 63);
|
||||
@ -1978,7 +1978,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
|
||||
} else if (strcmp(name, "font-size") == 0) {
|
||||
if (!attr->fontFace) {
|
||||
// DBG("font face=%d\n", sizeof(NSVGfont));
|
||||
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
|
||||
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
|
||||
}
|
||||
attr->fontFace->fontSize = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p));
|
||||
} else if (strcmp(name, "clip-path") == 0) {
|
||||
@ -1997,7 +1997,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
|
||||
} else if (strcmp(name, "font-family") == 0) {
|
||||
if (!attr->fontFace) {
|
||||
// DBG("font face=%d\n", sizeof(NSVGfont));
|
||||
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
|
||||
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
|
||||
}
|
||||
if (attr->fontFace) {
|
||||
if (value[0] == 0x27) { //'
|
||||
@ -2010,7 +2010,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
|
||||
}
|
||||
} else if (strcmp(name, "font-weight") == 0) {
|
||||
if (!attr->fontFace) {
|
||||
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
|
||||
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
|
||||
}
|
||||
if (attr->fontFace) {
|
||||
// char* Next = 0;
|
||||
@ -2021,7 +2021,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
|
||||
} else if (strcmp(name, "font-style") == 0) {
|
||||
DBG("attr=%s value=%s\n", name, value);
|
||||
if (!attr->fontFace) {
|
||||
attr->fontFace = (NSVGfont*)BllocateZeroPool(sizeof(NSVGfont));
|
||||
attr->fontFace = (NSVGfont*)AllocateZeroPool(sizeof(NSVGfont));
|
||||
}
|
||||
if (strstr(value, "italic") != NULL) {
|
||||
DBG("it is italic\n");
|
||||
@ -2697,7 +2697,7 @@ static void nsvg__parseUse(NSVGparser* p, const char** dict)
|
||||
takeXformBounds(ref, &xform[0], shape->bounds);
|
||||
// DumpFloat2("used shape has bounds", shape->bounds, 4);
|
||||
} else if (refSym) {
|
||||
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
|
||||
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
|
||||
if (!shape) return;
|
||||
memcpy(shape->xform, xform, sizeof(float)*6);
|
||||
// nsvg__xformMultiply(shape->xform, &xform[0]);
|
||||
@ -2809,7 +2809,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
|
||||
|
||||
int i;
|
||||
DBG("text found\n");
|
||||
NSVGtext* text = (NSVGtext*)BllocateZeroPool(sizeof(NSVGtext));
|
||||
NSVGtext* text = (NSVGtext*)AllocateZeroPool(sizeof(NSVGtext));
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
@ -3123,7 +3123,7 @@ static void nsvg__parsePoly(NSVGparser* p, const char** attr, int closeFlag)
|
||||
if (href == NULL)
|
||||
return;
|
||||
|
||||
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
|
||||
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
|
||||
if (shape == NULL) return;
|
||||
|
||||
memcpy(shape->id, attr->id, sizeof shape->id);
|
||||
@ -3222,7 +3222,7 @@ static void parsePattern(NSVGparser* p, const char** dict)
|
||||
}
|
||||
}
|
||||
|
||||
pt = (__typeof__(pt))BllocateZeroPool(sizeof(NSVGpattern));
|
||||
pt = (__typeof__(pt))AllocateZeroPool(sizeof(NSVGpattern));
|
||||
AsciiStrCpyS(pt->id, 64, attr->id);
|
||||
pt->width = w;
|
||||
pt->height = h;
|
||||
@ -3277,7 +3277,7 @@ static void nsvg__parseSVG(NSVGparser* p, const char** attr)
|
||||
static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type)
|
||||
{
|
||||
int i;
|
||||
NSVGgradientData* grad = (NSVGgradientData*)BllocateZeroPool(sizeof(NSVGgradientData));
|
||||
NSVGgradientData* grad = (NSVGgradientData*)AllocateZeroPool(sizeof(NSVGgradientData));
|
||||
if (grad == NULL) return;
|
||||
//defaults
|
||||
grad->units = NSVG_USER_SPACE; //NSVG_OBJECT_SPACE;
|
||||
@ -3412,7 +3412,7 @@ static void nsvg__parseSymbol(NSVGparser* p, const char** dict)
|
||||
NSVGsymbol* symbol;
|
||||
NSVGattrib* curAttr = nsvg__getAttr(p);
|
||||
int i;
|
||||
symbol = (NSVGsymbol*)BllocateZeroPool(sizeof(NSVGsymbol));
|
||||
symbol = (NSVGsymbol*)AllocateZeroPool(sizeof(NSVGsymbol));
|
||||
for (i = 0; dict[i]; i += 2) {
|
||||
if (strcmp(dict[i], "viewBox") == 0) {
|
||||
char* Next = 0;
|
||||
@ -3440,7 +3440,7 @@ static void nsvg__parseGroup(NSVGparser* p, const char** dict)
|
||||
return;
|
||||
}
|
||||
// DBG("parse group\n");
|
||||
group = (NSVGgroup*)BllocateZeroPool(sizeof(NSVGgroup));
|
||||
group = (NSVGgroup*)AllocateZeroPool(sizeof(NSVGgroup));
|
||||
|
||||
// if (curAttr->id[0] == '\0') //skip anonymous groups
|
||||
// return;
|
||||
@ -3560,7 +3560,7 @@ static void nsvg__parseFont(NSVGparser* p, const char** dict)
|
||||
return;
|
||||
}
|
||||
|
||||
font = (__typeof__(font))BllocateZeroPool(sizeof(*font));
|
||||
font = (__typeof__(font))AllocateZeroPool(sizeof(*font));
|
||||
|
||||
for (i = 0; dict[i]; i += 2) {
|
||||
if (strcmp(dict[i], "horiz-adv-x") == 0) {
|
||||
@ -3737,7 +3737,7 @@ static void nsvg__parseGlyph(NSVGparser* p, const char** dict, BOOLEAN missing)
|
||||
|
||||
p->plist = NULL;
|
||||
|
||||
glyph = (NSVGglyph*)BllocateZeroPool(sizeof(NSVGglyph));
|
||||
glyph = (NSVGglyph*)AllocateZeroPool(sizeof(NSVGglyph));
|
||||
if (!glyph) {
|
||||
return;
|
||||
}
|
||||
@ -3971,7 +3971,7 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN
|
||||
return x;
|
||||
}
|
||||
|
||||
shape = (NSVGshape*)BllocateZeroPool(sizeof(NSVGshape));
|
||||
shape = (NSVGshape*)AllocateZeroPool(sizeof(NSVGshape));
|
||||
if (shape == NULL) return x;
|
||||
|
||||
g = p->text->font->glyphs;
|
||||
@ -4411,7 +4411,7 @@ void nsvgDelete(NSVGimage* image)
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
res = (NSVGpath*)BllocateZeroPool(sizeof(NSVGpath));
|
||||
res = (NSVGpath*)AllocateZeroPool(sizeof(NSVGpath));
|
||||
if (res == NULL) return NULL;
|
||||
|
||||
res->pts = (float*)AllocatePool(p->npts*2*sizeof(float));
|
||||
|
@ -120,7 +120,7 @@ void qsort(void* Array, int Num, INTN Size,
|
||||
//caller is responsible for free memory
|
||||
NSVGrasterizer* nsvgCreateRasterizer()
|
||||
{
|
||||
NSVGrasterizer* r = (NSVGrasterizer*)BllocateZeroPool(sizeof(NSVGrasterizer));
|
||||
NSVGrasterizer* r = (NSVGrasterizer*)AllocateZeroPool(sizeof(NSVGrasterizer));
|
||||
if (r == NULL) return NULL;
|
||||
r->tessTol = 0.1f; //0.25f;
|
||||
r->distTol = 0.01f;
|
||||
@ -159,7 +159,7 @@ static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur)
|
||||
}
|
||||
|
||||
// Alloc new page
|
||||
newp = (NSVGmemPage*)BllocateZeroPool(sizeof(NSVGmemPage));
|
||||
newp = (NSVGmemPage*)AllocateZeroPool(sizeof(NSVGmemPage));
|
||||
if (newp == NULL) return NULL;
|
||||
|
||||
|
||||
@ -1750,7 +1750,7 @@ void nsvg__rasterizeClipPaths(
|
||||
// r->stencil = (unsigned char*)realloc(
|
||||
// r->stencil, r->stencilSize * clipPathCount);
|
||||
if (oldSize == 0) {
|
||||
r->stencil = (unsigned char*)BllocateZeroPool(r->stencilSize * clipPathCount);
|
||||
r->stencil = (unsigned char*)AllocateZeroPool(r->stencilSize * clipPathCount);
|
||||
if (r->stencil == NULL) return;
|
||||
} else {
|
||||
r->stencil = (unsigned char*)ReallocatePool(oldSize, r->stencilSize * clipPathCount, r->stencil);
|
||||
|
@ -999,8 +999,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
||||
//DBG("Skip dot entries: %ls\n", DirEntry->FileName);
|
||||
continue;
|
||||
}
|
||||
EFI_GUID guid;
|
||||
if ( StrToGuidLE(DirEntry->FileName, &guid) == EFI_SUCCESS ) {
|
||||
if ( IsValidGuidAsciiString(LStringW(DirEntry->FileName)) ) {
|
||||
Volume->ApfsTargetUUIDArray.Add(DirEntry->FileName);
|
||||
}
|
||||
}
|
||||
@ -1412,7 +1411,7 @@ EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry,
|
||||
|
||||
// read next directory entry
|
||||
LastBufferSize = BufferSize = 256;
|
||||
Buffer = (__typeof__(Buffer))BllocateZeroPool(BufferSize);
|
||||
Buffer = (__typeof__(Buffer))AllocateZeroPool(BufferSize);
|
||||
for (IterCount = 0; ; IterCount++) {
|
||||
Status = Directory->Read(Directory, &BufferSize, Buffer);
|
||||
if (Status != EFI_BUFFER_TOO_SMALL || IterCount >= 4)
|
||||
@ -1707,7 +1706,7 @@ BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt)
|
||||
|
||||
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
data = (__typeof__(data))BllocateZeroPool(dataSize);
|
||||
data = (__typeof__(data))AllocateZeroPool(dataSize);
|
||||
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG("Can't get %ls, size=%llu\n", Name, dataSize);
|
||||
|
@ -505,7 +505,7 @@ VOID LOADER_ENTRY::FilterBootPatches()
|
||||
VOID ReadSIPCfg()
|
||||
{
|
||||
UINT32 csrCfg = gSettings.CsrActiveConfig & CSR_VALID_FLAGS;
|
||||
CHAR16 *csrLog = (__typeof__(csrLog))BllocateZeroPool(SVALUE_MAX_SIZE);
|
||||
CHAR16 *csrLog = (__typeof__(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE);
|
||||
|
||||
if (csrCfg & CSR_ALLOW_UNTRUSTED_KEXTS)
|
||||
StrCatS(csrLog, SVALUE_MAX_SIZE/2, L"CSR_ALLOW_UNTRUSTED_KEXTS");
|
||||
@ -898,7 +898,7 @@ VOID LOADER_ENTRY::StartLoader()
|
||||
// Let's do it like it was before when not in case of APFSTargetUUID
|
||||
SetStartupDiskVolume(Volume, LoaderType == OSTYPE_OSX ? NullXStringW : LoaderPath);
|
||||
}
|
||||
} else if (gSettings.DefaultVolume != NULL) {
|
||||
} else if (gSettings.DefaultVolume.notEmpty()) {
|
||||
// DefaultVolume specified in Config.plist or in Boot Option
|
||||
// we'll remove macOS Startup Disk vars which may be present if it is used
|
||||
// to reboot into another volume
|
||||
@ -1016,7 +1016,7 @@ VOID LEGACY_ENTRY::StartLegacy()
|
||||
|
||||
if (gSettings.LastBootedVolume) {
|
||||
SetStartupDiskVolume(Volume, NullXStringW);
|
||||
} else if (gSettings.DefaultVolume != NULL) {
|
||||
} else if (gSettings.DefaultVolume.notEmpty()) {
|
||||
// DefaultVolume specified in Config.plist:
|
||||
// we'll remove macOS Startup Disk vars which may be present if it is used
|
||||
// to reboot into another volume
|
||||
@ -1040,11 +1040,11 @@ VOID LEGACY_ENTRY::StartLegacy()
|
||||
Status = bootMBR(Volume);
|
||||
break;
|
||||
case BOOTING_BY_PBR:
|
||||
if (StrCmp(gSettings.LegacyBoot, L"LegacyBiosDefault") == 0) {
|
||||
if (gSettings.LegacyBoot == "LegacyBiosDefault"_XS8) {
|
||||
Status = bootLegacyBiosDefault(gSettings.LegacyBiosDefaultEntry);
|
||||
} else if (StrCmp(gSettings.LegacyBoot, L"PBRtest") == 0) {
|
||||
} else if (gSettings.LegacyBoot == "PBRtest"_XS8) {
|
||||
Status = bootPBRtest(Volume);
|
||||
} else if (StrCmp(gSettings.LegacyBoot, L"PBRsata") == 0) {
|
||||
} else if (gSettings.LegacyBoot == "PBRsata"_XS8) {
|
||||
Status = bootPBR(Volume, TRUE);
|
||||
} else {
|
||||
// default
|
||||
@ -1185,7 +1185,7 @@ static VOID ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne
|
||||
if (DriversArrSize == 0) {
|
||||
// new array
|
||||
DriversArrSize = 16;
|
||||
DriversArr = (__typeof__(DriversArr))BllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
|
||||
DriversArr = (__typeof__(DriversArr))AllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
|
||||
} else if (DriversArrNum + 1 == DriversArrSize) {
|
||||
// extend array
|
||||
DriversArr = (__typeof__(DriversArr))ReallocatePool(DriversArrSize, DriversArrSize + 16, DriversArr);
|
||||
@ -1593,10 +1593,10 @@ INTN FindDefaultEntry(VOID)
|
||||
// if not found, then try DefaultVolume from config.plist
|
||||
// if not null or empty, search volume that matches gSettings.DefaultVolume
|
||||
//
|
||||
if (gSettings.DefaultVolume != NULL) {
|
||||
if (gSettings.DefaultVolume.notEmpty()) {
|
||||
|
||||
// if not null or empty, also search for loader that matches gSettings.DefaultLoader
|
||||
SearchForLoader = (gSettings.DefaultLoader != NULL && gSettings.DefaultLoader[0] != L'\0');
|
||||
SearchForLoader = gSettings.DefaultLoader.notEmpty();
|
||||
/*
|
||||
if (SearchForLoader) {
|
||||
DBG("Searching for DefaultVolume '%ls', DefaultLoader '%ls' ...\n", gSettings.DefaultVolume, gSettings.DefaultLoader);
|
||||
@ -1612,8 +1612,8 @@ INTN FindDefaultEntry(VOID)
|
||||
}
|
||||
|
||||
Volume = Entry.Volume;
|
||||
if ((Volume->VolName.isEmpty() || StrCmp(Volume->VolName.wc_str(), gSettings.DefaultVolume) != 0) &&
|
||||
!StrStr(Volume->DevicePathString.wc_str(), gSettings.DefaultVolume)) {
|
||||
if ( (Volume->VolName.isEmpty() || Volume->VolName != gSettings.DefaultVolume) &&
|
||||
!Volume->DevicePathString.contains(gSettings.DefaultVolume) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1644,7 +1644,7 @@ VOID SetVariablesFromNvram()
|
||||
{
|
||||
CHAR8 *tmpString;
|
||||
UINTN Size = 0;
|
||||
UINTN index = 0, index2, len, i;
|
||||
UINTN index = 0, index2, i;
|
||||
CHAR8 *arg = NULL;
|
||||
|
||||
// DbgHeader("SetVariablesFromNvram");
|
||||
@ -1690,19 +1690,15 @@ VOID SetVariablesFromNvram()
|
||||
DBG("...ignoring arg:%s\n", arg);
|
||||
continue;
|
||||
}
|
||||
if (!AsciiStrStr(gSettings.BootArgs, arg)) {
|
||||
if (!gSettings.BootArgs.contains(arg)) {
|
||||
//this arg is not present will add
|
||||
DBG("...adding arg:%s\n", arg);
|
||||
len = iStrLen(gSettings.BootArgs, 256);
|
||||
if (len + index2 > 256) {
|
||||
DBG("boot-args overflow... bytes=%llu+%llu\n", len, index2);
|
||||
break;
|
||||
}
|
||||
gSettings.BootArgs[len++] = 0x20;
|
||||
gSettings.BootArgs.trim();
|
||||
gSettings.BootArgs += ' ';
|
||||
for (i = 0; i < index2; i++) {
|
||||
gSettings.BootArgs[len++] = arg[i];
|
||||
gSettings.BootArgs += arg[i];
|
||||
}
|
||||
gSettings.BootArgs[len++] = 0x20;
|
||||
gSettings.BootArgs += ' ';
|
||||
}
|
||||
}
|
||||
FreePool(arg);
|
||||
@ -1752,15 +1748,15 @@ VOID SetOEMPath(const XStringW& ConfName)
|
||||
OEMPath.takeValueFrom("EFI\\CLOVER");
|
||||
if ( ConfName.isEmpty() ) {
|
||||
DBG("set OEMPath (ConfName == NULL): %ls\n", OEMPath.wc_str());
|
||||
} else if ( nLanCards > 0 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) {
|
||||
} else if ( nLanCards > 1 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) {
|
||||
} else if ( nLanCards > 2 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) {
|
||||
} else if ( nLanCards > 3 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct, gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) {
|
||||
} else if (!gFirmwareClover && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s\\UEFI", gSettings.OEMBoard), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMProduct), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMProduct, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMBoard), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMBoard, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName) ) {
|
||||
} else if ( nLanCards > 0 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) {
|
||||
} else if ( nLanCards > 1 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) {
|
||||
} else if ( nLanCards > 2 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) {
|
||||
} else if ( nLanCards > 3 && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) {
|
||||
} else if (!gFirmwareClover && SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s\\UEFI", gSettings.OEMBoard.c_str()), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMProduct.c_str()), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMProduct.c_str(), (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMBoard.c_str()), ConfName)) {
|
||||
} else if (SetOEMPathIfExists(SelfRootDir, SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMBoard.c_str(), (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName) ) {
|
||||
} else {
|
||||
DBG("set OEMPath by default: %ls\n", OEMPath.wc_str());
|
||||
}
|
||||
@ -1800,7 +1796,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
REFIT_ABSTRACT_MENU_ENTRY *OptionEntry = NULL;
|
||||
INTN DefaultIndex;
|
||||
UINTN MenuExit;
|
||||
UINTN Size, i;
|
||||
UINTN i;
|
||||
//UINT64 TscDiv;
|
||||
//UINT64 TscRemainder = 0;
|
||||
// LOADER_ENTRY *LoaderEntry;
|
||||
@ -1927,19 +1923,9 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
PrepatchSmbios();
|
||||
|
||||
//replace / with _
|
||||
Size = iStrLen(gSettings.OEMProduct, 64);
|
||||
for (i=0; i<Size; i++) {
|
||||
if (gSettings.OEMProduct[i] == 0x2F) {
|
||||
gSettings.OEMProduct[i] = 0x5F;
|
||||
}
|
||||
}
|
||||
Size = iStrLen(gSettings.OEMBoard, 64);
|
||||
for (i=0; i<Size; i++) {
|
||||
if (gSettings.OEMBoard[i] == 0x2F) {
|
||||
gSettings.OEMBoard[i] = 0x5F;
|
||||
}
|
||||
}
|
||||
DBG("Running on: '%s' with board '%s'\n", gSettings.OEMProduct, gSettings.OEMBoard);
|
||||
gSettings.OEMProduct.replaceAll(U'/', U'_');
|
||||
gSettings.OEMBoard.replaceAll(U'/', U'_');
|
||||
DBG("Running on: '%s' with board '%s'\n", gSettings.OEMProduct.c_str(), gSettings.OEMBoard.c_str());
|
||||
|
||||
GetCPUProperties();
|
||||
GetDevices();
|
||||
@ -2250,7 +2236,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
GlobalConfig.StrictHibernate = FALSE;
|
||||
}
|
||||
*/
|
||||
HaveDefaultVolume = gSettings.DefaultVolume != NULL;
|
||||
HaveDefaultVolume = gSettings.DefaultVolume.notEmpty();
|
||||
if (!gFirmwareClover &&
|
||||
!gDriversFlags.EmuVariableLoaded &&
|
||||
!HaveDefaultVolume &&
|
||||
@ -2316,7 +2302,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
if (ThemeX.embedded) {
|
||||
DBG("Chosen embedded theme\n");
|
||||
} else {
|
||||
DBG("Chosen theme %ls\n", ThemeX.Theme.data());
|
||||
DBG("Chosen theme %ls\n", ThemeX.Theme.wc_str());
|
||||
}
|
||||
|
||||
// DBG("initial boot-args=%s\n", gSettings.BootArgs);
|
||||
@ -2324,7 +2310,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
SetVariablesFromNvram();
|
||||
|
||||
XString8Array TmpArgs = Split<XString8Array>(gSettings.BootArgs, " ");
|
||||
DBG("after NVRAM boot-args=%s\n", gSettings.BootArgs);
|
||||
DBG("after NVRAM boot-args=%s\n", gSettings.BootArgs.c_str());
|
||||
gSettings.OptionsBits = EncodeOptions(TmpArgs);
|
||||
// DBG("initial OptionsBits %X\n", gSettings.OptionsBits);
|
||||
FillInputs(TRUE);
|
||||
@ -2652,7 +2638,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
|
||||
Description = SWPrintf("Clover start %ls at %ls", (LoaderName != NULL)?LoaderName:L"legacy", VolName.wc_str());
|
||||
OptionalDataSize = NameSize + Name2Size + 4 + 2; //signature + VolNameSize
|
||||
OptionalData = (__typeof__(OptionalData))BllocateZeroPool(OptionalDataSize);
|
||||
OptionalData = (__typeof__(OptionalData))AllocateZeroPool(OptionalDataSize);
|
||||
if (OptionalData == NULL) {
|
||||
break;
|
||||
}
|
||||
|
@ -194,10 +194,10 @@ VOID FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6
|
||||
InputItems[InputItemsCount++].BValue = gSettings.InjectATI;
|
||||
InputItems[InputItemsCount].ItemType = ASString; //22+6i
|
||||
if (StrLen(gSettings.FBName) > 2) { //fool proof: cfg_name is 3 character or more.
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%ls", gSettings.FBName);
|
||||
if ( gSettings.FBName.length() > 2 ) { //fool proof: cfg_name is 3 character or more.
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%ls", gSettings.FBName.wc_str());
|
||||
} else {
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gGraphics[i].Config);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gGraphics[i].Config);
|
||||
}
|
||||
} else if (gGraphics[i].Vendor == Nvidia) {
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6
|
||||
@ -335,25 +335,25 @@ VOID FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.SavingMode);
|
||||
|
||||
InputItems[InputItemsCount].ItemType = ASString; //78
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ProductName);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ProductName.c_str());
|
||||
InputItems[InputItemsCount].ItemType = ASString; //79
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.VersionNr);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.VersionNr.c_str());
|
||||
InputItems[InputItemsCount].ItemType = ASString; //80
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.SerialNr);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.SerialNr.c_str());
|
||||
InputItems[InputItemsCount].ItemType = ASString; //81
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardNumber);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardNumber.c_str());
|
||||
InputItems[InputItemsCount].ItemType = ASString; //82
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardSerialNumber);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardSerialNumber.c_str());
|
||||
InputItems[InputItemsCount].ItemType = Decimal; //83
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%d", gSettings.BoardType);
|
||||
InputItems[InputItemsCount].ItemType = ASString; //84
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardVersion);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardVersion.c_str());
|
||||
InputItems[InputItemsCount].ItemType = Decimal; //85
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%d", gSettings.ChassisType);
|
||||
InputItems[InputItemsCount].ItemType = ASString; //86
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.RomVersion);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.RomVersion.c_str());
|
||||
InputItems[InputItemsCount].ItemType = ASString; //87
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ReleaseDate);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ReleaseDate.c_str());
|
||||
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //88
|
||||
InputItems[InputItemsCount++].BValue = gSettings.DoubleFirstState;
|
||||
@ -429,7 +429,7 @@ VOID FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount].ItemType = ASString; //117
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.EfiVersion.c_str());
|
||||
InputItems[InputItemsCount].ItemType = ASString; //118
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BooterCfgStr);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BooterCfgStr.c_str());
|
||||
|
||||
InputItems[InputItemsCount].ItemType = RadioSwitch; //119 - Audio chooser
|
||||
InputItems[InputItemsCount++].IValue = 119;
|
||||
@ -486,11 +486,11 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
} while (*(++ch));
|
||||
|
||||
snprintf(gSettings.BootArgs, 255, "%ls ", InputItems[i].SValue.wc_str());
|
||||
gSettings.BootArgs = InputItems[i].SValue;
|
||||
}
|
||||
i++; //1
|
||||
if (InputItems[i].Valid) {
|
||||
snwprintf(gSettings.DsdtName, sizeof(gSettings.DsdtName), "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.DsdtName = InputItems[i].SValue;
|
||||
}
|
||||
i++; //2
|
||||
if (InputItems[i].Valid) {
|
||||
@ -598,7 +598,7 @@ VOID ApplyInputs(VOID)
|
||||
i++; //22
|
||||
if (InputItems[i].Valid) {
|
||||
if (gGraphics[j].Vendor == Ati) {
|
||||
snwprintf(gSettings.FBName, 32, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.FBName = InputItems[i].SValue;
|
||||
} else if (gGraphics[j].Vendor == Nvidia) {
|
||||
ZeroMem(AString, 256);
|
||||
snprintf(AString, 255, "%ls", InputItems[i].SValue.wc_str());
|
||||
@ -806,7 +806,7 @@ VOID ApplyInputs(VOID)
|
||||
|
||||
i++; //78
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.ProductName, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.ProductName = InputItems[i].SValue;
|
||||
// let's fill all other fields based on this ProductName
|
||||
// to serve as default
|
||||
Model = GetModelFromString(gSettings.ProductName);
|
||||
@ -817,19 +817,19 @@ VOID ApplyInputs(VOID)
|
||||
|
||||
i++; //79
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.VersionNr, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.VersionNr = InputItems[i].SValue;
|
||||
}
|
||||
i++; //80
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.SerialNr, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.SerialNr = InputItems[i].SValue;
|
||||
}
|
||||
i++; //81
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.BoardNumber, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.BoardNumber = InputItems[i].SValue;
|
||||
}
|
||||
i++; //82
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.BoardSerialNumber, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.BoardSerialNumber = InputItems[i].SValue;
|
||||
}
|
||||
i++; //83
|
||||
if (InputItems[i].Valid) {
|
||||
@ -837,7 +837,7 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
i++; //84
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.BoardVersion, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.BoardVersion = InputItems[i].SValue;
|
||||
}
|
||||
i++; //85
|
||||
if (InputItems[i].Valid) {
|
||||
@ -845,11 +845,11 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
i++; //86
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.RomVersion, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.RomVersion = InputItems[i].SValue;
|
||||
}
|
||||
i++; //87
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.ReleaseDate, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.ReleaseDate = InputItems[i].SValue;
|
||||
}
|
||||
|
||||
i++; //88
|
||||
@ -1012,9 +1012,9 @@ VOID ApplyInputs(VOID)
|
||||
i++; //116
|
||||
if (InputItems[i].Valid) {
|
||||
if (OldChosenDsdt == 0xFFFF) {
|
||||
snwprintf(gSettings.DsdtName, 64, "BIOS.aml");
|
||||
gSettings.DsdtName = L"BIOS.aml"_XSW;
|
||||
} else {
|
||||
snwprintf(gSettings.DsdtName, 64, "%ls", DsdtsList[OldChosenDsdt]);
|
||||
gSettings.DsdtName.SWPrintf("%ls", DsdtsList[OldChosenDsdt]);
|
||||
}
|
||||
}
|
||||
i++; //117
|
||||
@ -1023,7 +1023,7 @@ VOID ApplyInputs(VOID)
|
||||
}
|
||||
i++; //118
|
||||
if (InputItems[i].Valid) {
|
||||
snprintf(gSettings.BooterCfgStr, 64, "%ls", InputItems[i].SValue.wc_str());
|
||||
gSettings.BooterCfgStr = InputItems[i].SValue;
|
||||
}
|
||||
i++; //119
|
||||
if (InputItems[i].Valid) {
|
||||
@ -2065,8 +2065,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
|
||||
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->"_XS8);
|
||||
|
||||
SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString);
|
||||
SubScreen->AddMenuInfoLine_f("%s", gSettings.OEMProduct);
|
||||
SubScreen->AddMenuInfoLine_f("with board %s", gSettings.OEMBoard);
|
||||
SubScreen->AddMenuInfoLine_f("%s", gSettings.OEMProduct.c_str());
|
||||
SubScreen->AddMenuInfoLine_f("with board %s", gSettings.OEMBoard.c_str());
|
||||
|
||||
SubScreen->AddMenuItemInput(78, "Product Name:", TRUE);
|
||||
SubScreen->AddMenuItemInput(79, "Product Version:", TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user