| .. | .. |
|---|
| 8 | 8 | #include "helpers/helpers.h" |
|---|
| 9 | 9 | |
|---|
| 10 | 10 | static const char *cpu_vendor_table[X86_VENDOR_MAX] = { |
|---|
| 11 | | - "Unknown", "GenuineIntel", "AuthenticAMD", |
|---|
| 11 | + "Unknown", "GenuineIntel", "AuthenticAMD", "HygonGenuine", |
|---|
| 12 | 12 | }; |
|---|
| 13 | 13 | |
|---|
| 14 | 14 | #if defined(__i386__) || defined(__x86_64__) |
|---|
| .. | .. |
|---|
| 109 | 109 | fclose(fp); |
|---|
| 110 | 110 | /* Get some useful CPU capabilities from cpuid */ |
|---|
| 111 | 111 | if (cpu_info->vendor != X86_VENDOR_AMD && |
|---|
| 112 | + cpu_info->vendor != X86_VENDOR_HYGON && |
|---|
| 112 | 113 | cpu_info->vendor != X86_VENDOR_INTEL) |
|---|
| 113 | 114 | return ret; |
|---|
| 114 | 115 | |
|---|
| .. | .. |
|---|
| 124 | 125 | if (cpuid_level >= 6 && (cpuid_ecx(6) & 0x1)) |
|---|
| 125 | 126 | cpu_info->caps |= CPUPOWER_CAP_APERF; |
|---|
| 126 | 127 | |
|---|
| 127 | | - /* AMD Boost state enable/disable register */ |
|---|
| 128 | | - if (cpu_info->vendor == X86_VENDOR_AMD) { |
|---|
| 128 | + /* AMD or Hygon Boost state enable/disable register */ |
|---|
| 129 | + if (cpu_info->vendor == X86_VENDOR_AMD || |
|---|
| 130 | + cpu_info->vendor == X86_VENDOR_HYGON) { |
|---|
| 129 | 131 | if (ext_cpuid_level >= 0x80000007 && |
|---|
| 130 | 132 | (cpuid_edx(0x80000007) & (1 << 9))) |
|---|
| 131 | 133 | cpu_info->caps |= CPUPOWER_CAP_AMD_CBP; |
|---|
| 134 | + |
|---|
| 135 | + if (ext_cpuid_level >= 0x80000008 && |
|---|
| 136 | + cpuid_ebx(0x80000008) & (1 << 4)) |
|---|
| 137 | + cpu_info->caps |= CPUPOWER_CAP_AMD_RDPRU; |
|---|
| 132 | 138 | } |
|---|
| 133 | 139 | |
|---|
| 134 | 140 | if (cpu_info->vendor == X86_VENDOR_INTEL) { |
|---|