Skip to content

Commit

Permalink
[v1.04][ARM] Add support for M2 Max/Ultra
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Noob committed Sep 2, 2023
1 parent 6a5b4c3 commit 7d81d89
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/arm/midr.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ struct cpuInfo* get_cpu_info_mach(struct cpuInfo* cpu) {
fill_cpu_info_avalanche_blizzard(cpu, 4, 4);
}
else if(cpu_subfamily == CPUSUBFAMILY_ARM_HS) {
// Apple M2 Pro. Detect number of cores
// Apple M2 Pro/Max/Ultra. Detect number of cores
uint32_t physicalcpu = get_sys_info_by_name("hw.physicalcpu");
if(physicalcpu == 10 || physicalcpu == 12) {
// M2 Pro (or Max?)
if(physicalcpu == 24) {
// M2 Ultra
fill_cpu_info_avalanche_blizzard(cpu, 16, 8);
}
else if(physicalcpu == 10 || physicalcpu == 12) {
// M2 Pro/Max
fill_cpu_info_avalanche_blizzard(cpu, physicalcpu-4, 4);
}
else {
Expand Down
14 changes: 14 additions & 0 deletions src/arm/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,20 @@ struct system_on_chip* guess_soc_apple(struct system_on_chip* soc) {
else if(cpu_subfamily == CPUSUBFAMILY_ARM_HS) {
fill_soc(soc, "M2 Pro", SOC_APPLE_M2_PRO, 5);
}
else if(cpu_subfamily == CPUSUBFAMILY_ARM_HC_HD) {
// Could be M2 Max or M2 Ultra (2x M1 Max)
uint32_t physicalcpu = get_sys_info_by_name("hw.physicalcpu");
if(physicalcpu == 24) {
fill_soc(soc, "M2 Ultra", SOC_APPLE_M2_ULTRA, 5);
}
else if(physicalcpu == 12) {
fill_soc(soc, "M2 Max", SOC_APPLE_M2_MAX, 5);
}
else {
printBug("Found invalid physical cpu number: %d", physicalcpu);
soc->soc_vendor = SOC_VENDOR_UNKNOWN;
}
}
else {
printBug("Found invalid cpu_subfamily: 0x%.8X", cpu_subfamily);
soc->soc_vendor = SOC_VENDOR_UNKNOWN;
Expand Down

0 comments on commit 7d81d89

Please sign in to comment.