Skip to content

Commit

Permalink
Merge pull request #18748 from alebcay/linux-amd-cpus
Browse files Browse the repository at this point in the history
  • Loading branch information
carlocab authored Nov 10, 2024
2 parents 5fd34f4 + 33a9d24 commit 40f4ab2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Library/Homebrew/extend/os/linux/hardware/cpu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def family
when "GenuineIntel"
intel_family(cpu_family, cpu_model)
when "AuthenticAMD"
amd_family(cpu_family)
amd_family(cpu_family, cpu_model)
end || unknown
end

Expand Down Expand Up @@ -87,7 +87,7 @@ def intel_family(family, cpu_model)
end
end

def amd_family(family)
def amd_family(family, cpu_model)
case family
when 0x06
:amd_k7
Expand All @@ -106,9 +106,21 @@ def amd_family(family)
when 0x16
:jaguar
when 0x17
:zen
case cpu_model
when 0x10..0x2f
:zen
when 0x30..0x3f, 0x47, 0x60..0x7f, 0x84..0x87, 0x90..0xaf
:zen2
end
when 0x19
:zen3
case cpu_model
when ..0x0f, 0x20..0x5f
:zen3
when 0x10..0x1f, 0x60..0x7f, 0xa0..0xaf
:zen4
end
when 0x1a
:zen5
end
end

Expand Down
10 changes: 10 additions & 0 deletions Library/Homebrew/test/hardware/cpu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
describe "::family" do
let(:cpu_families) do
[
:alderlake,
:amd_k7,
:amd_k8,
:amd_k8_k10_hybrid,
Expand All @@ -38,6 +39,7 @@
:arm_twister,
:arm_typhoon,
:arm_vortex_tempest,
:arrowlake,
:atom,
:bobcat,
:broadwell,
Expand All @@ -47,22 +49,30 @@
:core,
:core2,
:dothan,
:graniterapids,
:haswell,
:icelake,
:ivybridge,
:jaguar,
:kabylake,
:merom,
:nehalem,
:pantherlake,
:penryn,
:ppc,
:prescott,
:presler,
:rocketlake,
:sandybridge,
:sapphirerapids,
:skylake,
:tigerlake,
:westmere,
:zen,
:zen2,
:zen3,
:zen4,
:zen5,
:dunno,
]
end
Expand Down

0 comments on commit 40f4ab2

Please sign in to comment.