mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
Modify PatchACPI to assign processorIDs from DSDT
macOS assumes that the first processor from DSDT is always enabled, without checking MADT table here we're trying to assign first IDs found in DSDT to enabled processors in MADT, such that macOS assumption to be true
This commit is contained in:
parent
ecab494bd2
commit
d5021f3f04
@ -60,7 +60,8 @@ UINTN *XsdtReplaceSizes = NULL;
|
||||
UINT64 BiosDsdt;
|
||||
UINT32 BiosDsdtLen;
|
||||
UINT8 acpi_cpu_count;
|
||||
CHAR8* acpi_cpu_name[128];
|
||||
CHAR8* acpi_cpu_name[acpi_cpu_max];
|
||||
UINT8 acpi_cpu_processor_id[acpi_cpu_max];
|
||||
CHAR8* acpi_cpu_score;
|
||||
|
||||
UINT64 machineSignature;
|
||||
@ -2171,13 +2172,14 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
|
||||
DBG("Found subtable in MADT: type=%d\n", *SubTable);
|
||||
if (*SubTable == EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC) {
|
||||
ProcLocalApic = (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE *)SubTable;
|
||||
// macOS assumes that the first processor from DSDT is always enabled, without checking MADT table
|
||||
// here we're trying to assign first IDs found in DSDT to enabled processors in MADT, such that macOS assumption to be true
|
||||
if (ProcLocalApic->Flags & EFI_ACPI_4_0_LOCAL_APIC_ENABLED) {
|
||||
if (Index == 0 && ProcLocalApic->AcpiProcessorId > 1) {
|
||||
DBG("ProcLocalApic changed: %d to %d\n", ProcLocalApic->AcpiProcessorId, 0);
|
||||
ProcLocalApic->AcpiProcessorId = 0;
|
||||
ApicCPUBase = 0;
|
||||
if (ProcLocalApic->AcpiProcessorId != acpi_cpu_processor_id[Index]) {
|
||||
DBG("AcpiProcessorId changed: 0x%02x to 0x%02x\n", ProcLocalApic->AcpiProcessorId, acpi_cpu_processor_id[Index]);
|
||||
ProcLocalApic->AcpiProcessorId = acpi_cpu_processor_id[Index];
|
||||
} else {
|
||||
DBG("ProcLocalApic: %d\n", ProcLocalApic->AcpiProcessorId);
|
||||
DBG("AcpiProcessorId: 0x%02x\n", ProcLocalApic->AcpiProcessorId);
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
|
@ -1036,6 +1036,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
if (add_name) {
|
||||
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;
|
||||
|
||||
//if (acpi_cpu_count == 0)
|
||||
@ -1046,7 +1047,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
} else {
|
||||
DBG("| %a ", acpi_cpu_name[acpi_cpu_count]);
|
||||
}
|
||||
if (++acpi_cpu_count == 32)
|
||||
if (++acpi_cpu_count == acpi_cpu_max)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1057,6 +1058,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
|
||||
for (i=0; i<15; i++) {
|
||||
acpi_cpu_name[i] = AllocateZeroPool(5);
|
||||
AsciiSPrint(acpi_cpu_name[i], 5, "CPU%1x", i);
|
||||
acpi_cpu_processor_id[i] = i;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -1674,8 +1674,10 @@ extern UINT8 DefaultAudioVolume;
|
||||
//CHAR8* orgBiosDsdt;
|
||||
extern UINT64 BiosDsdt;
|
||||
extern UINT32 BiosDsdtLen;
|
||||
#define acpi_cpu_max 128
|
||||
extern UINT8 acpi_cpu_count;
|
||||
extern CHAR8 *acpi_cpu_name[];
|
||||
extern UINT8 acpi_cpu_processor_id[];
|
||||
extern CHAR8 *acpi_cpu_score;
|
||||
extern BOOLEAN SSSE3;
|
||||
extern BOOLEAN defDSM;
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include "StateGenerator.h"
|
||||
|
||||
|
||||
//CHAR8* acpi_cpu_name[] = {"CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7", "CPU8", "CPU9"};
|
||||
|
||||
CONST UINT8 pss_ssdt_header[] =
|
||||
{
|
||||
0x53, 0x53, 0x44, 0x54, 0x7E, 0x00, 0x00, 0x00, /* SSDT.... */
|
||||
|
Loading…
Reference in New Issue
Block a user