This commit is contained in:
Sergey Isakov 2019-12-27 11:14:53 +03:00
commit 89c8fd2a69
14 changed files with 191 additions and 165 deletions

View File

@ -83,7 +83,7 @@ void aml_destroy_node(AML_CHUNK* node)
FreePool(node);
}
AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* buffer, UINT32 size)
AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* buffer, UINT32 size)
{
AML_CHUNK* node = aml_create_node(parent);
@ -376,7 +376,7 @@ AML_CHUNK* aml_add_store(AML_CHUNK* parent)
return node;
}
AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* data, UINT32 size)
AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data, UINT32 size)
{
AML_CHUNK* node = aml_create_node(parent);

View File

@ -21,7 +21,7 @@ static inline BOOLEAN aml_isvalidchar(char c)
BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node);
AML_CHUNK* aml_create_node(AML_CHUNK* parent);
VOID aml_destroy_node(AML_CHUNK* node);
AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* buffer, UINT32 size);
AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* buffer, UINT32 size);
AML_CHUNK* aml_add_byte(AML_CHUNK* parent, UINT8 value);
AML_CHUNK* aml_add_word(AML_CHUNK* parent, UINT16 value);
AML_CHUNK* aml_add_dword(AML_CHUNK* parent, UINT32 value);
@ -39,7 +39,7 @@ UINT32 aml_write_size(UINT32 size, CHAR8* buffer, UINT32 offset);
// add by pcj
AML_CHUNK* aml_add_string(AML_CHUNK* parent, /* CONST*/ CHAR8* string);
AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* data,UINT32 size);
AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data,UINT32 size);
AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* string);
AML_CHUNK* aml_add_device(AML_CHUNK* parent, /* CONST*/ CHAR8* name);
AML_CHUNK* aml_add_local0(AML_CHUNK* parent);

View File

@ -110,9 +110,9 @@ struct lpc_device_t
};
//static
CHAR8 dataBuiltin[] = {0x00};
UINT8 dataBuiltin[] = {0x00};
//static
CHAR8 dataBuiltin1[] = {0x01};
UINT8 dataBuiltin1[] = {0x01};
static struct lpc_device_t lpc_chipset[] =
{
@ -381,57 +381,57 @@ UINT8 hpet1[] = // Name (_CID, EisaId ("PNP0C01"))
0x08, 0x5F, 0x43, 0x49, 0x44, 0x0C, 0x41, 0xD0, 0x0C, 0x01
};
*/
CHAR8 wakret[] = { 0xA4, 0x12, 0x04, 0x02, 0x00, 0x00 };
CHAR8 wakslp1[] = { 0x5B, 0x80, 0x50, 0x4D, 0x33, 0x30, 0x01 };
CHAR8 wakslp2[] = { 0x0A, 0x08, 0x5B, 0x81, 0x0D, 0x50, 0x4D, 0x33, 0x30, 0x01,
UINT8 wakret[] = { 0xA4, 0x12, 0x04, 0x02, 0x00, 0x00 };
UINT8 wakslp1[] = { 0x5B, 0x80, 0x50, 0x4D, 0x33, 0x30, 0x01 };
UINT8 wakslp2[] = { 0x0A, 0x08, 0x5B, 0x81, 0x0D, 0x50, 0x4D, 0x33, 0x30, 0x01,
0x00, 0x04, 0x53, 0x4C, 0x4D, 0x45, 0x01, 0x70, 0x00, 0x53, 0x4C, 0x4D, 0x45 };
CHAR8 waksecur[] = {0xA0, 0x0D, 0x91, 0x95, 0x68, 0x01, 0x94, 0x68, 0x0A, 0x05,
UINT8 waksecur[] = {0xA0, 0x0D, 0x91, 0x95, 0x68, 0x01, 0x94, 0x68, 0x0A, 0x05,
0x70, 0x0A, 0x03, 0x68};
CHAR8 pwrb[] = { //? \_SB_PWRB, 0x02
UINT8 pwrb[] = { //? \_SB_PWRB, 0x02
0x86, 0x5C, 0x2E, 0x5F, 0x53, 0x42, 0x5F, 0x50, 0x57, 0x52, 0x42, 0x0A, 0x02
};
CHAR8 acpi3[] = { //Name(_HID, "ACPI003")
UINT8 acpi3[] = { //Name(_HID, "ACPI003")
0x08, 0x5F, 0x48, 0x49, 0x44, 0x0D,
0x41, 0x43, 0x50, 0x49, 0x30, 0x30, 0x30, 0x33, 0x00
};
//Name (_PRW, Package (0x02){0x1C, 0x03}
CHAR8 prw1c[] = {
UINT8 prw1c[] = {
0x08, 0x5F, 0x50, 0x52, 0x57, 0x12, 0x06, 0x02, 0x0A, 0x1C, 0x0A, 0x03
};
CHAR8 dtgp_1[] = { // DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
UINT8 dtgp_1[] = { // DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
// Return (Local0)
0x44, 0x54, 0x47, 0x50, 0x68, 0x69, 0x6A, 0x6B,
0x71, 0x60, 0xA4, 0x60
};
CHAR8 pwrbcid[] = {
UINT8 pwrbcid[] = {
0x08, 0x5F, 0x43, 0x49, 0x44, 0x0C, 0x41, 0xD0, 0x0C, 0x0E, 0x14,
0x0E, 0x5F, 0x50, 0x52, 0x57, 0x00, 0xA4, 0x12, 0x06, 0x02, 0x0A,
0x0B, 0x0A, 0x04
};
CHAR8 pwrbprw[] = {
UINT8 pwrbprw[] = {
0x14, 0x0E, 0x5F, 0x50, 0x52, 0x57, 0x00, 0xA4, 0x12, 0x06, 0x02,
0x0A, 0x0B, 0x0A, 0x04
};
CHAR8 shutdown0[] = {
UINT8 shutdown0[] = {
0xA0, 0x05, 0x93, 0x68, 0x0A, 0x05, 0xA1, 0x01
};
CHAR8 shutdown1[] = {
UINT8 shutdown1[] = {
0xA0, 0x0F, 0x91, 0x91, 0x93, 0x68, 0x0A, 0x03, 0x93, 0x68, 0x0A, 0x04, 0x93, 0x68, 0x0A, 0x05, 0xA1, 0x01
};
CHAR8 pnlf[] = {
UINT8 pnlf[] = {
0x5B, 0x82, 0x2D, 0x50, 0x4E, 0x4C, 0x46, //Device (PNLF)
0x08, 0x5F, 0x48, 0x49, 0x44, 0x0C, 0x06, 0x10, 0x00, 0x02, // Name (_HID, EisaId ("APP0002"))
0x08, 0x5F, 0x43, 0x49, 0x44, // Name (_CID,
@ -440,11 +440,11 @@ CHAR8 pnlf[] = {
0x08, 0x5F, 0x53, 0x54, 0x41, 0x0A, 0x0B // Name (_STA, 0x0B)
};
CHAR8 app2[] = { //Name (_HID, EisaId("APP0002"))
UINT8 app2[] = { //Name (_HID, EisaId("APP0002"))
0x08, 0x5F, 0x48, 0x49, 0x44, 0x0C, 0x06, 0x10, 0x00, 0x02
};
CHAR8 darwin[] =
UINT8 darwin[] =
{ //addresses shifted by 0x24
0x08, 0x56, 0x45, 0x52, // 00000020 " .. .VER"
0x30, 0x0D, 0x43, 0x6C, 0x6F, 0x76, 0x65, 0x72, // 00000028 "0.Clover"
@ -471,7 +471,7 @@ CHAR8 darwin[] =
};
CHAR8 ClassFix[] = { 0x00, 0x00, 0x03, 0x00 };
UINT8 ClassFix[] = { 0x00, 0x00, 0x03, 0x00 };
BOOLEAN CmpNum(UINT8 *dsdt, INT32 i, BOOLEAN Sure)
{
@ -2345,7 +2345,7 @@ UINT32 FixHPET (UINT8* dsdt, UINT32 len)
return len;
}
CHAR8 dataLPC[] = {0x18, 0x3A, 0x00, 0x00};
UINT8 dataLPC[] = {0x18, 0x3A, 0x00, 0x00};
UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
{
@ -2440,9 +2440,9 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
}
//CONST
CHAR8 Yes[] = {0x01,0x00,0x00,0x00};
CHAR8 data2[] = {0xe0,0x00,0x56,0x28};
CHAR8 VenATI[] = {0x02, 0x10};
UINT8 Yes[] = {0x01,0x00,0x00,0x00};
UINT8 data2[] = {0xe0,0x00,0x56,0x28};
UINT8 VenATI[] = {0x02, 0x10};
UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard)
{
@ -2613,34 +2613,34 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard)
if (gSettings.FakeIntel) {
FakeID = gSettings.FakeIntel >> 16;
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeID, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeID, 4);
FakeVen = gSettings.FakeIntel & 0xFFFF;
aml_add_string(pack, "vendor-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeVen, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeVen, 4);
}
break;
case 0x10DE:
if (gSettings.FakeNVidia) {
FakeID = gSettings.FakeNVidia >> 16;
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeID, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeID, 4);
FakeVen = gSettings.FakeNVidia & 0xFFFF;
aml_add_string(pack, "vendor-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeVen, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeVen, 4);
}
break;
case 0x1002:
if (gSettings.FakeATI) {
FakeID = gSettings.FakeATI >> 16;
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeID, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeID, 4);
aml_add_string(pack, "ATY,DeviceID");
aml_add_byte_buffer(pack, (CHAR8*)&FakeID, 2);
aml_add_byte_buffer(pack, (UINT8*)&FakeID, 2);
FakeVen = gSettings.FakeATI & 0xFFFF;
aml_add_string(pack, "vendor-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeVen, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeVen, 4);
aml_add_string(pack, "ATY,VendorID");
aml_add_byte_buffer(pack, (CHAR8*)&FakeVen, 2);
aml_add_byte_buffer(pack, (UINT8*)&FakeVen, 2);
}/* else {
aml_add_string(pack, "ATY,VendorID");
aml_add_byte_buffer(pack, VenATI, 2);
@ -3062,9 +3062,9 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
// aml_add_string(pack, "model");
// aml_add_string_buffer(pack, "Apple LAN card");
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (CHAR8 *)&FakeID, 4);
aml_add_byte_buffer(pack, (UINT8 *)&FakeID, 4);
aml_add_string(pack, "vendor-id");
aml_add_byte_buffer(pack, (CHAR8 *)&FakeVen, 4);
aml_add_byte_buffer(pack, (UINT8 *)&FakeVen, 4);
aml_add_string(pack, "name");
aml_add_string_buffer(pack, &NameCard[0]);
aml_add_string(pack, "compatible");
@ -3543,9 +3543,9 @@ UINT32 AddIMEI (UINT8 *dsdt, UINT32 len)
pack = aml_add_package(met2);
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeID, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeID, 4);
aml_add_string(pack, "vendor-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeVen, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeVen, 4);
aml_add_local0(met2);
aml_add_buffer(met, dtgp_1, sizeof(dtgp_1));
@ -3569,7 +3569,7 @@ UINT32 AddIMEI (UINT8 *dsdt, UINT32 len)
return len;
}
CHAR8 dataFW[] = {0x00,0x00,0x00,0x00};
UINT8 dataFW[] = {0x00,0x00,0x00,0x00};
UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
{
@ -3875,7 +3875,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
pack = aml_add_package(met2);
if (!CustProperties(pack, DEV_USB)) {
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (/* CONST*/ CHAR8*)&USBID[0], 4);
aml_add_byte_buffer(pack, (/* CONST*/ UINT8*)&USBID[0], 4);
aml_add_string(pack, "built-in");
aml_add_byte_buffer(pack, dataBuiltin, sizeof(dataBuiltin));
aml_add_string(pack, "device_type");
@ -3907,7 +3907,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
pack1 = aml_add_package(met2);
if (!CustProperties(pack, DEV_USB)) {
aml_add_string(pack1, "device-id");
aml_add_byte_buffer(pack1, (/* CONST*/ CHAR8*)&USBID[0], 4);
aml_add_byte_buffer(pack1, (/* CONST*/ UINT8*)&USBID[0], 4);
aml_add_string(pack1, "built-in");
aml_add_byte_buffer(pack1, dataBuiltin, sizeof(dataBuiltin));
aml_add_string(pack1, "device_type");
@ -3990,7 +3990,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
pack1 = aml_add_package(met2);
if (!CustProperties(pack, DEV_USB)) {
aml_add_string(pack1, "device-id");
aml_add_byte_buffer(pack1, (/* CONST*/ CHAR8*)&USBID[0], 4);
aml_add_byte_buffer(pack1, (/* CONST*/ UINT8*)&USBID[0], 4);
aml_add_string(pack1, "built-in");
aml_add_byte_buffer(pack1, dataBuiltin, sizeof(dataBuiltin));
aml_add_string(pack1, "device_type");
@ -4241,8 +4241,8 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
}
CHAR8 DevIDE[] = {0x9E,0x26,0x00,0x00};
CHAR8 VenIDE[] = {0x86,0x80,0x00,0x00};
UINT8 DevIDE[] = {0x9E,0x26,0x00,0x00};
UINT8 VenIDE[] = {0x86,0x80,0x00,0x00};
UINT32 FIXIDE (UINT8 *dsdt, UINT32 len)
{
@ -4468,9 +4468,9 @@ UINT32 FIXSATAAHCI (UINT8 *dsdt, UINT32 len)
pack = aml_add_package(met2);
if (gSettings.FakeSATA) {
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeID, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeID, 4);
aml_add_string(pack, "vendor-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeVen, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeVen, 4);
}
if (!CustProperties(pack, DEV_SATA) &&
!gSettings.NoDefaultProperties &&
@ -4564,9 +4564,9 @@ UINT32 FIXSATA (UINT8 *dsdt, UINT32 len)
pack = aml_add_package(met2);
if (gSettings.FakeSATA) {
aml_add_string(pack, "device-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeID, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeID, 4);
aml_add_string(pack, "vendor-id");
aml_add_byte_buffer(pack, (CHAR8*)&FakeVen, 4);
aml_add_byte_buffer(pack, (UINT8*)&FakeVen, 4);
}
if (!CustProperties(pack, DEV_SATA) &&
!gSettings.NoDefaultProperties &&
@ -4866,7 +4866,7 @@ UINT32 FIXSHUTDOWN_ASUS (UINT8 *dsdt, UINT32 len)
{
UINT32 i, j, sizeoffset = 0;
UINT32 adr, adr1 = 0, adr2, size, shift = 0;
CHAR8 *shutdown = NULL;
UINT8 *shutdown = NULL;
DBG("Start SHUTDOWN Fix len=%x\n", len);
adr = FindMethod(dsdt, len, "_PTS");

View File

@ -757,7 +757,7 @@ struct DEV_PROPERTY {
UINT32 Device;
EFI_DEVICE_PATH_PROTOCOL* DevicePath;
CHAR8 *Key;
CHAR8 *Value;
UINT8 *Value;
UINTN ValueLen;
DEV_PROPERTY *Next; //next device or next property
DEV_PROPERTY *Child; // property list of the device
@ -1013,8 +1013,8 @@ typedef struct {
// BOOLEAN DropMCFG;
BOOLEAN FixMCFG;
UINT32 DeviceRenameCount;
ACPI_NAME_LIST *DeviceRename;
UINT32 DeviceRenameCount;
ACPI_NAME_LIST *DeviceRename;
//Injections
BOOLEAN StringInjector;
BOOLEAN InjectSystemID;

View File

@ -5111,7 +5111,7 @@ GetUserSettings(
else if (Prop3 && (Prop3->type == kTagTypeData)) {
UINTN Size = Prop3->dataLen;
// (*Child)->Value = GetDataSetting(Prop3, "Value", &Size); //TODO
CHAR8* Data = AllocateZeroPool(Size);
UINT8* Data = AllocateZeroPool(Size);
CopyMem(Data, Prop3->data, Size);
(*Child)->Value = Data;
(*Child)->ValueLen = Size;
@ -5996,6 +5996,16 @@ GetUserSettings(
Prop = GetProperty(DictPointer, "MemoryRank");
gSettings.Attribute = (INT8)GetPropertyInteger(Prop, -1); //1==Single Rank, 2 == Dual Rank, 0==undefined -1 == keep as is
// Delete the user memory when a new config is selected
INTN i = 0;
for (i = 0; i < gRAM.UserInUse && i < MAX_RAM_SLOTS; i++) {
gRAM.User[i].ModuleSize = 0;
gRAM.User[i].InUse = 0;
}
gRAM.UserInUse = 0;
gRAM.UserChannels = 0;
gSettings.InjectMemoryTables = FALSE;
// Inject memory tables into SMBIOS
Prop = GetProperty (DictPointer, "Memory");
if (Prop != NULL){

View File

@ -16,7 +16,7 @@ CONST UINT8 pss_ssdt_header[] =
};
CHAR8 cst_ssdt_header[] =
UINT8 cst_ssdt_header[] =
{
0x53, 0x53, 0x44, 0x54, 0xE7, 0x00, 0x00, 0x00, /* SSDT.... */
0x01, 0x17, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x41, /* ..PmRefA */
@ -25,21 +25,21 @@ CHAR8 cst_ssdt_header[] =
0x20, 0x03, 0x12, 0x20 /* 1.._ */
};
CHAR8 resource_template_register_fixedhw[] =
UINT8 resource_template_register_fixedhw[] =
{
0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F,
0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x79, 0x00
};
CHAR8 resource_template_register_systemio[] =
UINT8 resource_template_register_systemio[] =
{
0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x01,
0x08, 0x00, 0x00, 0x15, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x79, 0x00,
};
CHAR8 plugin_type[] =
UINT8 plugin_type[] =
{
0x14, 0x22, 0x5F, 0x44, 0x53, 0x4D, 0x04, 0xA0,
0x09, 0x93, 0x6A, 0x00, 0xA4, 0x11, 0x03, 0x01,
@ -333,7 +333,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
AML_CHUNK* packPCT;
AML_CHUNK* metPCT;
AML_CHUNK* root = aml_create_node(NULL);
aml_add_buffer(root, (CHAR8*)&pss_ssdt_header[0], sizeof(pss_ssdt_header)); // SSDT header
aml_add_buffer(root, (UINT8*)&pss_ssdt_header[0], sizeof(pss_ssdt_header)); // SSDT header
AsciiSPrint(name, 31, "%a%4a", acpi_cpu_score, acpi_cpu_name[0]);
AsciiSPrint(name1, 31, "%a%4aPSS_", acpi_cpu_score, acpi_cpu_name[0]);
AsciiSPrint(name2, 31, "%a%4aPCT_", acpi_cpu_score, acpi_cpu_name[0]);

View File

@ -417,12 +417,11 @@ VOID KernelPatcher_32(VOID* kernelData, CHAR8 *OSVersion)
//Slice - FakeCPUID substitution, (c)2014
//procedure location
STATIC UINT8 StrCpuid1[] = {
0xb8, 0x01, 0x00, 0x00, 0x00, 0x31, 0xdb, 0x89, 0xd9, 0x89, 0xda, 0x0f, 0xa2};
STATIC UINT8 StrCpuid1_tigLeo[] = {0xb9, 0x01, 0x00, 0x00, 0x00, 0x89, 0xc8, 0x0f, 0xa2};
STATIC UINT8 StrCpuid1_snowLeo[] = {0xb8, 0x01, 0x00, 0x00, 0x00, 0x31, 0xdb, 0x89, 0xd9, 0x89, 0xda, 0x0f, 0xa2};
STATIC UINT8 StrMsr8b[] = {0xb9, 0x8b, 0x00, 0x00, 0x00, 0x0f, 0x32};
STATIC UINT8 StrMsr8b[] = {0xb9, 0x8b, 0x00, 0x00, 0x00, 0x0f, 0x32};
// Snow Leopard
// Tiger/Leopard/Snow Leopard
/*
This patch searches
and eax, 0xf0 || and eax, 0x0f0000
@ -430,9 +429,9 @@ STATIC UINT8 StrMsr8b[] = {0xb9, 0x8b, 0x00, 0x00, 0x00, 0x0f, 0x32};
and replaces to
mov eax, FakeModel | mov eax, FakeExt
*/
STATIC UINT8 SnowSearchModel[] = {0x25, 0xf0, 0x00, 0x00, 0x00, 0xc1, 0xe8, 0x04};
STATIC UINT8 SnowSearchExt[] = {0x25, 0x00, 0x00, 0x0f, 0x00, 0xc1, 0xe8, 0x10};
STATIC UINT8 SnowReplaceModel[] = {0xb8, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90};
STATIC UINT8 TigLeoSLSearchModel[] = {0x25, 0xf0, 0x00, 0x00, 0x00, 0xc1, 0xe8, 0x04};
STATIC UINT8 TigLeoSLSearchExt[] = {0x25, 0x00, 0x00, 0x0f, 0x00, 0xc1, 0xe8, 0x10};
STATIC UINT8 TigLeoSLReplaceModel[] = {0xb8, 0x07, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90};
// Lion
/*
@ -530,11 +529,19 @@ BOOLEAN PatchCPUID(UINT8* bytes, UINT8* Location, INT32 LenLoc,
VOID KernelCPUIDPatch(UINT8* kernelData, LOADER_ENTRY *Entry)
{
// Tiger/Leopard patterns
DBG_RT(Entry, "CPUID: try Tiger/Leopard patch...\n");
if (PatchCPUID(kernelData, &StrCpuid1_tigLeo[0], sizeof(StrCpuid1_tigLeo), &TigLeoSLSearchModel[0],
&TigLeoSLSearchExt[0], &TigLeoSLReplaceModel[0], &TigLeoSLReplaceModel[0],
sizeof(TigLeoSLSearchModel), Entry)) {
DBG_RT(Entry, "...done!\n");
return;
}
// Snow Leopard patterns
DBG_RT(Entry, "CPUID: try Snow Leopard patch...\n");
if (PatchCPUID(kernelData, &StrCpuid1[0], sizeof(StrCpuid1), &SnowSearchModel[0],
&SnowSearchExt[0], &SnowReplaceModel[0], &SnowReplaceModel[0],
sizeof(SnowSearchModel), Entry)) {
if (PatchCPUID(kernelData, &StrCpuid1_snowLeo[0], sizeof(StrCpuid1_snowLeo), &TigLeoSLSearchModel[0],
&TigLeoSLSearchExt[0], &TigLeoSLReplaceModel[0], &TigLeoSLReplaceModel[0],
sizeof(TigLeoSLSearchModel), Entry)) {
DBG_RT(Entry, "...done!\n");
return;
}
@ -1817,10 +1824,17 @@ KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry)
}
// Find kernel Mach-O header:
// for 10.4 - 10.5: 0x00111000
// for 10.6 - 10.7: 0x00200000
// for ML: bootArgs2->kslide + 0x00200000
// for older versions: just 0x200000
// for AptioFix booting - it's always at KernelRelocBase + 0x200000
KernelData = (VOID*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000);
// for AptioFix booting - it's always at KernelRelocBase + 0x00200000
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
if (os_version < AsciiOSVersionToUint64("10.6")) {
KernelData = (VOID*)(UINTN)(KernelSlide + KernelRelocBase + 0x00111000);
} else {
KernelData = (VOID*)(UINTN)(KernelSlide + KernelRelocBase + 0x00200000);
}
// check that it is Mach-O header and detect architecture
if(MACH_GET_MAGIC(KernelData) == MH_MAGIC || MACH_GET_MAGIC(KernelData) == MH_CIGAM) {

View File

@ -417,7 +417,7 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry)
CHAR16 UniOSVersion[16];
AsciiStrToUnicodeStrS(Entry->OSVersion, UniOSVersion, 16);
DBG("UniOSVersion == %s\n", UniOSVersion);
DBG("UniOSVersion == %s\n", UniOSVersion);
CHAR16 UniShortOSVersion[6];
CHAR8 ShortOSVersion[6];
@ -429,120 +429,112 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry)
AsciiStrnCpyS(ShortOSVersion, 6, Entry->OSVersion, 5);
AsciiStrToUnicodeStrS(Entry->OSVersion, UniShortOSVersion, 6);
}
DBG("ShortOSVersion == %a\n", ShortOSVersion);
DBG("UniShortOSVersion == %s\n", UniShortOSVersion);
DBG("ShortOSVersion == %a\n", ShortOSVersion);
DBG("UniShortOSVersion == %s\n", UniShortOSVersion);
// syscl - allow specific load inject kext
// Clover/Kexts/Other is for general injection thus we need to scan both Other and OSVersion folder
if ((SrcDir = GetOtherKextsDir(TRUE)) != NULL) {
AddKexts(Entry, SrcDir, L"Other", archCpuType);
FreePool(SrcDir);
}else{
DBG("GetOtherKextsDir(TRUE) return NULL\n");
} else {
DBG("GetOtherKextsDir(TRUE) return NULL\n");
}
// slice: CLOVER/kexts/Off keep disabled kext which can be allowed
if ((SrcDir = GetOtherKextsDir(FALSE)) != NULL) {
AddKexts(Entry, SrcDir, L"Off", archCpuType);
FreePool(SrcDir);
}else{
DBG("GetOtherKextsDir(FALSE) return NULL\n");
} else {
DBG("GetOtherKextsDir(FALSE) return NULL\n");
}
// Add kext from 10
{
{
CHAR16 *OSAllVersionKextsDir;
CHAR16 *OSShortVersionKextsDir;
CHAR16 *OSVersionKextsDirName;
CHAR16 *DirName;
CHAR16 *DirPath;
OSAllVersionKextsDir = PoolPrint(L"%s\\kexts\\10", OEMPath);
// UnicodeSPrint(OSAllVersionKextsDir, sizeof(OSAllVersionKextsDir), L"%s\\kexts\\10", OEMPath);
AddKexts(Entry, OSAllVersionKextsDir, L"10", archCpuType);
// UnicodeSPrint(OSAllVersionKextsDir, sizeof(OSAllVersionKextsDir), L"%s\\kexts\\10", OEMPath);
AddKexts(Entry, OSAllVersionKextsDir, L"10", archCpuType);
FreePool(OSAllVersionKextsDir);
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
DirName = PoolPrint(L"10_install");
// UnicodeSPrint(DirName, sizeof(DirName), L"10_install");
} else {
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
DirName = PoolPrint(L"10_recovery");
// UnicodeSPrint(DirName, sizeof(DirName), L"10_recovery");
}else{
DirName = PoolPrint(L"10_normal");
// UnicodeSPrint(DirName, sizeof(DirName), L"10_normal");
}
}
// UnicodeSPrint(DirName, sizeof(DirName), L"10_install");
} else if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
DirName = PoolPrint(L"10_recovery");
// UnicodeSPrint(DirName, sizeof(DirName), L"10_recovery");
} else {
DirName = PoolPrint(L"10_normal");
// UnicodeSPrint(DirName, sizeof(DirName), L"10_normal");
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
AddKexts(Entry, DirPath, DirName, archCpuType);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
AddKexts(Entry, DirPath, DirName, archCpuType);
FreePool(DirPath);
FreePool(DirName);
// Add kext from 10.{version}
// Add kext from 10.{version}
OSShortVersionKextsDir = PoolPrint(L"%s\\kexts\\%s", OEMPath, UniShortOSVersion);
// UnicodeSPrint(OSShortVersionKextsDir, sizeof(OSShortVersionKextsDir), L"%s\\kexts\\%s", OEMPath, UniShortOSVersion);
AddKexts(Entry, OSShortVersionKextsDir, UniShortOSVersion, archCpuType);
// UnicodeSPrint(OSShortVersionKextsDir, sizeof(OSShortVersionKextsDir), L"%s\\kexts\\%s", OEMPath, UniShortOSVersion);
AddKexts(Entry, OSShortVersionKextsDir, UniShortOSVersion, archCpuType);
FreePool(OSShortVersionKextsDir);
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
DirName = PoolPrint(L"%s_install", UniShortOSVersion);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", UniShortOSVersion);
} else {
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
DirName = PoolPrint(L"%s_recovery", UniShortOSVersion);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", UniShortOSVersion);
}else{
DirName = PoolPrint(L"%s_normal", UniShortOSVersion);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", UniShortOSVersion);
}
}
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", UniShortOSVersion);
} else if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
DirName = PoolPrint(L"%s_recovery", UniShortOSVersion);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", UniShortOSVersion);
} else {
DirName = PoolPrint(L"%s_normal", UniShortOSVersion);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", UniShortOSVersion);
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
AddKexts(Entry, DirPath, DirName, archCpuType);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
AddKexts(Entry, DirPath, DirName, archCpuType);
FreePool(DirPath);
FreePool(DirName);
// Add kext from :
// 10.{version}.0 if NO minor version
// 10.{version}.{minor version} if minor version is > 0
// Add kext from :
// 10.{version}.0 if NO minor version
// 10.{version}.{minor version} if minor version is > 0
if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) {
if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) {
OSVersionKextsDirName = PoolPrint(L"%a.0", Entry->OSVersion);
// UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a.0", Entry->OSVersion);
}else{
OSVersionKextsDirName = PoolPrint(L"%a.0", Entry->OSVersion);
// UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a", Entry->OSVersion);
}
// UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a.0", Entry->OSVersion);
} else {
OSVersionKextsDirName = PoolPrint(L"%a", Entry->OSVersion);
// UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a", Entry->OSVersion);
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, OSVersionKextsDirName);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, OSVersionKextsDirName);
AddKexts(Entry, DirPath, OSVersionKextsDirName, archCpuType);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, OSVersionKextsDirName);
AddKexts(Entry, DirPath, OSVersionKextsDirName, archCpuType);
FreePool(DirPath);
FreePool(OSVersionKextsDirName);
if ( OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
if ( OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
DirName = PoolPrint(L"%s_install", OSVersionKextsDirName);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", OSVersionKextsDirName);
}else{
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
DirName = PoolPrint(L"%s_recovery", OSVersionKextsDirName);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", OSVersionKextsDirName);
}else{
DirName = PoolPrint(L"%s_normal", OSVersionKextsDirName);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", OSVersionKextsDirName);
}
}
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", OSVersionKextsDirName);
} else if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
DirName = PoolPrint(L"%s_recovery", OSVersionKextsDirName);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", OSVersionKextsDirName);
} else {
DirName = PoolPrint(L"%s_normal", OSVersionKextsDirName);
// UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", OSVersionKextsDirName);
}
DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
AddKexts(Entry, DirPath, DirName, archCpuType);
// UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName);
AddKexts(Entry, DirPath, DirName, archCpuType);
FreePool(DirPath);
FreePool(DirName);
}
FreePool(OSVersionKextsDirName);
}
// reserve space in the device tree

View File

@ -56,20 +56,19 @@ extern CHAR8* gDeviceProperties;
//BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev);
struct nvidia_pci_info_t;
typedef struct {
typedef struct nvidia_pci_info_t
{
UINT32 device; // VendorID + DeviceID
CHAR8 *name_model;
} nvidia_pci_info_t;
struct nvidia_card_info_t;
typedef struct
typedef struct nvidia_card_info_t
{
UINT32 device; // VendorID + DeviceID
UINT32 subdev; // SubdeviceID + SubvendorID
CHAR8 *name_model;
UINT8 *custom_NVCAP;
}nvidia_card_info_t;
} nvidia_card_info_t;
#define DCB_MAX_NUM_ENTRIES 16
#define DCB_MAX_NUM_I2C_ENTRIES 16

View File

@ -1295,7 +1295,7 @@ VOID PatchTableType17()
return;
}
// Check channels
if ((gRAM.UserChannels == 0) || (gRAM.UserChannels > 4)) {
if ((gRAM.UserChannels == 0) || (gRAM.UserChannels > 8)) {
gRAM.UserChannels = 1;
}
if (gRAM.UserInUse >= MAX_RAM_SLOTS) {
@ -1364,8 +1364,10 @@ VOID PatchTableType17()
if (gRAM.User[UserIndex].ModuleSize > 0x7FFF) {
newSmbiosTable.Type17->Size = 0x7FFF;
newSmbiosTable.Type17->ExtendedSize = gRAM.User[UserIndex].ModuleSize;
mTotalSystemMemory += newSmbiosTable.Type17->ExtendedSize; //Mb
} else {
newSmbiosTable.Type17->Size = (UINT16)gRAM.User[UserIndex].ModuleSize;
mTotalSystemMemory += newSmbiosTable.Type17->Size; //Mb
}
newSmbiosTable.Type17->MemoryType = gRAM.User[UserIndex].Type;
if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) &&
@ -1375,7 +1377,6 @@ VOID PatchTableType17()
}
DBG("%a %a %dMHz %dMB(Ext:%dMB)\n", bankLocator, deviceLocator, newSmbiosTable.Type17->Speed,
newSmbiosTable.Type17->Size, newSmbiosTable.Type17->ExtendedSize);
mTotalSystemMemory += newSmbiosTable.Type17->Size; //Mb
mMemory17[gRAMCount] = (UINT16)mTotalSystemMemory;
// DBG("mTotalSystemMemory = %d\n", mTotalSystemMemory);
} else {
@ -1632,7 +1633,12 @@ VOID PatchTableType17()
} else {
newSmbiosTable.Type17->Speed = (UINT16)gRAM.SPD[SPDIndex].Frequency;
}
newSmbiosTable.Type17->Size = (UINT16)gRAM.SPD[SPDIndex].ModuleSize;
if (gRAM.SPD[SPDIndex].ModuleSize > 0x7FFF) {
newSmbiosTable.Type17->Size = 0x7FFF;
newSmbiosTable.Type17->ExtendedSize = gRAM.SPD[SPDIndex].ModuleSize;
} else {
newSmbiosTable.Type17->Size = (UINT16)gRAM.SPD[SPDIndex].ModuleSize;
}
newSmbiosTable.Type17->MemoryType = gRAM.SPD[SPDIndex].Type;
}
if (trustSMBIOS && gRAM.SMBIOS[SMBIOSIndex].InUse &&
@ -1676,8 +1682,13 @@ VOID PatchTableType17()
newSmbiosTable.Type17->MemoryType = 0; //MemoryTypeUnknown;
} else {
insertingEmpty = FALSE;
DBG("%a %a %dMHz %dMB\n", bankLocator, deviceLocator, newSmbiosTable.Type17->Speed, newSmbiosTable.Type17->Size);
mTotalSystemMemory += newSmbiosTable.Type17->Size; //Mb
DBG("%a %a %dMHz %dMB(Ext:%dMB)\n", bankLocator, deviceLocator, newSmbiosTable.Type17->Speed,
newSmbiosTable.Type17->Size, newSmbiosTable.Type17->ExtendedSize);
if (newSmbiosTable.Type17->Size == 0x7FFF) {
mTotalSystemMemory += newSmbiosTable.Type17->ExtendedSize; //Mb
} else {
mTotalSystemMemory += newSmbiosTable.Type17->Size; //Mb
}
mMemory17[gRAMCount] = (UINT16)mTotalSystemMemory;
// DBG("mTotalSystemMemory = %d\n", mTotalSystemMemory);
}

View File

@ -64,7 +64,7 @@ static EFI_CONSOLE_CONTROL_SCREEN_MODE CurrentForcedConsoleMode = EfiConsoleCont
static EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE ConsoleControlGetMode = NULL;
static EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE ConsoleControlSetMode = NULL;
static EFI_STATUS GopSetModeAndReconnectTextOut();
static EFI_STATUS GopSetModeAndReconnectTextOut(IN UINT32 ModeNumber);
//
// Wrapped ConsoleControl GetMode() implementation - for blocking resolution switch when changing modes

View File

@ -46,8 +46,8 @@ freely, subject to the following restrictions:
//MODSNI ^
#ifdef __cplusplus
#include <vector>
#include <string>
//#include <vector>
//#include <string>
#endif /*__cplusplus*/
extern const char* LODEPNG_VERSION_STRING;

View File

@ -1879,13 +1879,13 @@ static NSVGclipPath* nsvg__findClipPath(NSVGparser* p, const char* name)
return *link;
}
static int substr(const char* class, char* style)
static int substr(const char* aClass, char* style)
{
const char *p;
while (*class) {
while (*aClass) {
char *s = style;
p = class++;
p = aClass++;
while (*p++ == *s++) {
if (*s == '\0') {
if ((*p == '\0') || (*p == ' ')) {

View File

@ -3934,16 +3934,21 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align)
switch (TextC) {
case TEXT_CORNER_REVISION:
Text = gFirmwareRevision;
// Display Clover boot volume
if (SelfVolume->VolName[0] != L'#') {
Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolName);
}else{
Text = PoolPrint(L"%s", gFirmwareRevision, SelfVolume->VolName);
}
break;
case TEXT_CORNER_HELP:
Text = L"F1:Help";
Text = PoolPrint(L"F1:Help");
break;
case TEXT_CORNER_OPTIMUS:
if (gGraphics[0].Vendor != Intel) {
Text = L"Discrete";
Text = PoolPrint(L"Discrete");
} else {
Text = L"Intel";
Text = PoolPrint(L"Intel");
}
// Text = (NGFX == 2)?L"Intel":L"Discrete";
break;
@ -3962,11 +3967,13 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align)
Xpos = UGAWidth >> 1;
break;
default:
if ( Text ) FreePool(Text);
return;
}
// DBG("draw text %s at (%d, %d)\n", Text, Xpos, UGAHeight - 5 - TextHeight),
// clovy DrawTextXY(Text, Xpos, UGAHeight - 5 - TextHeight, Align);
DrawTextXY(Text, Xpos, UGAHeight - (INTN)(TextHeight * 1.5f), Align);
if ( Text ) FreePool(Text);
}
VOID MainMenuVerticalStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINTN Function, IN CHAR16 *ParamText)
@ -4215,13 +4222,6 @@ VOID MainMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINT
case MENU_FUNCTION_PAINT_ALL:
// Display Clover boot volume
if (SelfVolume->VolName[0] != L'#') {
CHAR16 *line = PoolPrint(L"Clover booted from %s", SelfVolume->VolName);
DrawTextXY(line, (INTN)(100 * GlobalConfig.Scale), (INTN)(50 * GlobalConfig.Scale), X_IS_LEFT);
FreePool(line);
}
for (i = 0; i <= State->MaxIndex; i++) {
if (Screen->Entries[i]->Row == 0) {
if ((i >= State->FirstVisible) && (i <= State->LastVisible)) {