[v1.04][ARM] Add support for M2 Pro

This commit is contained in:
Dr-Noob
2023-06-09 17:47:05 +02:00
parent 6349f4435e
commit 36071b8eb8
3 changed files with 28 additions and 2 deletions

View File

@@ -351,9 +351,29 @@ struct cpuInfo* get_cpu_info_mach(struct cpuInfo* cpu) {
cpu->peak_performance = get_peak_performance(cpu);
}
else if(cpu_family == CPUFAMILY_ARM_AVALANCHE_BLIZZARD) {
// Just the "normal" M2 exists for now
cpu->num_cpus = 2;
// Now detect the M2 version
uint32_t cpu_subfamily = get_sys_info_by_name("hw.cpusubfamily");
if(cpu_subfamily == CPUSUBFAMILY_ARM_HG) {
// Apple M2
fill_cpu_info_avalanche_blizzard(cpu, 4, 4);
}
else if(cpu_subfamily == CPUSUBFAMILY_ARM_HS) {
// Apple M2 Pro. Detect number of cores
uint32_t physicalcpu = get_sys_info_by_name("hw.physicalcpu");
if(physicalcpu == 10 || physicalcpu == 12) {
// M2 Pro (or Max?)
fill_cpu_info_avalanche_blizzard(cpu, physicalcpu-4, 4);
}
else {
printBug("Found invalid physical cpu number: %d", physicalcpu);
return NULL;
}
}
else {
printBug("Found invalid cpu_subfamily: 0x%.8X", cpu_subfamily);
return NULL;
}
cpu->soc = get_soc();
cpu->peak_performance = get_peak_performance(cpu);
}

View File

@@ -765,6 +765,9 @@ struct system_on_chip* guess_soc_apple(struct system_on_chip* soc) {
if(cpu_subfamily == CPUSUBFAMILY_ARM_HG) {
fill_soc(soc, "M2", SOC_APPLE_M2, 5);
}
else if(cpu_subfamily == CPUSUBFAMILY_ARM_HS) {
fill_soc(soc, "M2 Pro", SOC_APPLE_M2_PRO, 5);
}
else {
printBug("Found invalid cpu_subfamily: 0x%.8X", cpu_subfamily);
soc->soc_vendor = SOC_VENDOR_UNKNOWN;

View File

@@ -259,6 +259,9 @@ enum {
SOC_APPLE_M1_MAX,
SOC_APPLE_M1_ULTRA,
SOC_APPLE_M2,
SOC_APPLE_M2_PRO,
SOC_APPLE_M2_MAX,
SOC_APPLE_M2_ULTRA,
// ALLWINNER
SOC_ALLWINNER_A10,
SOC_ALLWINNER_A13,