x86: identify Hygon vendor
it's a Zen-based CPU: rely on AMD support code. Change-Id: Ia980a42457575bf8d1130d813310a285bf137691 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3217 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
@@ -499,7 +499,8 @@ enum cpu_vendor {
|
||||
B_CPU_VENDOR_VIA,
|
||||
B_CPU_VENDOR_IBM,
|
||||
B_CPU_VENDOR_MOTOROLA,
|
||||
B_CPU_VENDOR_NEC
|
||||
B_CPU_VENDOR_NEC,
|
||||
B_CPU_VENDOR_HYGON
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -481,6 +481,7 @@ enum x86_vendors {
|
||||
VENDOR_RISE,
|
||||
VENDOR_TRANSMETA,
|
||||
VENDOR_NSC,
|
||||
VENDOR_HYGON,
|
||||
|
||||
VENDOR_NUM,
|
||||
VENDOR_UNKNOWN,
|
||||
|
||||
@@ -173,7 +173,7 @@ get_cpu_vendor_string(enum cpu_vendor cpuVendor)
|
||||
// Should match vendors in OS.h
|
||||
static const char* vendorStrings[] = {
|
||||
NULL, "AMD", "Cyrix", "IDT", "Intel", "National Semiconductor", "Rise",
|
||||
"Transmeta", "VIA", "IBM", "Motorola", "NEC"
|
||||
"Transmeta", "VIA", "IBM", "Motorola", "NEC", "Hygon"
|
||||
};
|
||||
|
||||
if ((size_t)cpuVendor >= sizeof(vendorStrings) / sizeof(const char*))
|
||||
|
||||
+4
-3
@@ -458,7 +458,7 @@ print_processor_signature(enum cpu_vendor vendor, cpuid_info *info)
|
||||
"%1" B_PRIx32 "%1" B_PRIx32 "; ", info->eax_1.extended_family,
|
||||
info->eax_1.extended_model, info->eax_1.family,
|
||||
info->eax_1.model, info->eax_1.stepping);
|
||||
if (vendor == B_CPU_VENDOR_AMD) {
|
||||
if (vendor == B_CPU_VENDOR_AMD || vendor == B_CPU_VENDOR_HYGON) {
|
||||
printf("Type %" B_PRIu32 ", family %" B_PRIu32 ", model %" B_PRIu32
|
||||
", stepping %" B_PRIu32 "\n",
|
||||
info->eax_1.type,
|
||||
@@ -596,14 +596,15 @@ dump_cpu(enum cpu_vendor vendor, uint32 model, int32 cpu)
|
||||
/* Extended CPUID Information */
|
||||
if (maxExtendedFunction >= 1) {
|
||||
get_cpuid(&cpuInfo, 0x80000001, cpu);
|
||||
if (vendor == B_CPU_VENDOR_INTEL || vendor == B_CPU_VENDOR_AMD) {
|
||||
if (vendor == B_CPU_VENDOR_INTEL || vendor == B_CPU_VENDOR_AMD
|
||||
|| vendor == B_CPU_VENDOR_HYGON) {
|
||||
// 0x80000001 EDX has overlap of 64,ED,SY/SE between amd and intel
|
||||
printf("\tExtended Features (0x80000001): 0x%08" B_PRIx32 "\n",
|
||||
cpuInfo.eax_1.features);
|
||||
print_features(kAMDExtFeatures, cpuInfo.regs.edx);
|
||||
}
|
||||
|
||||
if (vendor == B_CPU_VENDOR_AMD) {
|
||||
if (vendor == B_CPU_VENDOR_AMD || vendor == B_CPU_VENDOR_HYGON) {
|
||||
if (maxExtendedFunction >= 7) {
|
||||
get_cpuid(&cpuInfo, 0x80000007, cpu);
|
||||
printf("\tExtended Features (0x80000007): 0x%08" B_PRIx32 "\n",
|
||||
|
||||
@@ -99,7 +99,9 @@ status_t
|
||||
__x86_patch_errata_percpu(int currentCPU)
|
||||
{
|
||||
const cpu_ent* cpu = get_cpu_struct();
|
||||
if (cpu->arch.vendor == VENDOR_AMD)
|
||||
if (cpu->arch.vendor == VENDOR_AMD
|
||||
|| cpu->arch.vendor == VENDOR_HYGON) {
|
||||
return patch_errata_percpu_amd(currentCPU, cpu);
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ static const struct cpu_vendor_info vendor_info[VENDOR_NUM] = {
|
||||
{ "Rise", { "RiseRiseRise" } },
|
||||
{ "Transmeta", { "GenuineTMx86", "TransmetaCPU" } },
|
||||
{ "NSC", { "Geode by NSC" } },
|
||||
{ "Hygon", { "HygonGenuine" } },
|
||||
};
|
||||
|
||||
#define K8_SMIONCMPHALT (1ULL << 27)
|
||||
@@ -860,7 +861,8 @@ detect_cpu_topology(int currentCPU, cpu_ent* cpu, uint32 maxBasicLeaf,
|
||||
|
||||
status_t result = B_UNSUPPORTED;
|
||||
if (x86_check_feature(IA32_FEATURE_HTT, FEATURE_COMMON)) {
|
||||
if (cpu->arch.vendor == VENDOR_AMD) {
|
||||
if (cpu->arch.vendor == VENDOR_AMD
|
||||
|| cpu->arch.vendor == VENDOR_HYGON) {
|
||||
result = detect_amd_cpu_topology(maxBasicLeaf, maxExtendedLeaf);
|
||||
|
||||
if (result == B_OK)
|
||||
|
||||
@@ -87,6 +87,9 @@ arch_system_info_init(struct kernel_args *args)
|
||||
case VENDOR_TRANSMETA:
|
||||
sCPUVendor = B_CPU_VENDOR_TRANSMETA;
|
||||
break;
|
||||
case VENDOR_HYGON:
|
||||
sCPUVendor = B_CPU_VENDOR_HYGON;
|
||||
break;
|
||||
default:
|
||||
sCPUVendor = B_CPU_VENDOR_UNKNOWN;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user