[syslinux] [RESEND PATCH] x86_64: Add support for Hygon Dhyana processor

Jinke Fan fanjinke51 at yeah.net
Mon Mar 22 19:39:03 PDT 2021


Hi,
When testing syslinux on Hygon Dhyana processor, there are
some information as follows:
boot: cpuidtest.c32
Vendor      = Unknown Vendor
...
boot: ifcpu.c32 debug multicore
 multicore  : 1 cores on this system

After adding support for Hygon Dhyana processor, the info-
rmation is correct:
boot: cpuidtest.c32
Vendor      = Hygon
...
boot: ifcpu.c32 debug multicore
 multicore  : 64 cores on this system

Thanks!
Jinke Fan

Signed-off-by: Jinke Fan <fanjinke51 at yeah.net>
---
 com32/gplinclude/cpuid.h | 5 +++--
 com32/gpllib/cpuid.c     | 7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/com32/gplinclude/cpuid.h b/com32/gplinclude/cpuid.h
index 02f3a0b3..fd77b69d 100644
--- a/com32/gplinclude/cpuid.h
+++ b/com32/gplinclude/cpuid.h
@@ -187,8 +187,9 @@ extern bool get_cpu_flag_value_from_name(s_cpu *cpu, const char * flag);
 #define X86_VENDOR_RISE 6
 #define X86_VENDOR_TRANSMETA 7
 #define X86_VENDOR_NSC 8
-#define X86_VENDOR_UNKNOWN 9 
-#define X86_VENDOR_NUM 10 
+#define X86_VENDOR_HYGON 9
+#define X86_VENDOR_UNKNOWN 10
+#define X86_VENDOR_NUM 11
 
 #define cpu_has(c, bit)                test_bit(bit, (c)->x86_capability)
 
diff --git a/com32/gpllib/cpuid.c b/com32/gpllib/cpuid.c
index 2abd0bda..0681dbce 100644
--- a/com32/gpllib/cpuid.c
+++ b/com32/gpllib/cpuid.c
@@ -60,6 +60,11 @@ static struct cpu_dev amd_cpu_dev = {
     .c_ident = {"AuthenticAMD"}
 };
 
+static struct cpu_dev hygon_cpu_dev = {
+    .c_vendor = "Hygon",
+    .c_ident = {"HygonGenuine"}
+};
+
 static struct cpu_dev intel_cpu_dev = {
     .c_vendor = "Intel",
     .c_ident = {"GenuineIntel"}
@@ -149,6 +154,7 @@ void init_cpu_devs(void)
     cpu_devs[X86_VENDOR_RISE] = &rise_cpu_dev;
     cpu_devs[X86_VENDOR_TRANSMETA] = &transmeta_cpu_dev;
     cpu_devs[X86_VENDOR_NSC] = &nsc_cpu_dev;
+    cpu_devs[X86_VENDOR_HYGON] = &hygon_cpu_dev;
     cpu_devs[X86_VENDOR_UNKNOWN] = &unknown_cpu_dev;
 }
 
@@ -389,6 +395,7 @@ void generic_identify(struct cpuinfo_x86 *c)
     /* Detecting the number of cores */
     switch (c->x86_vendor) {
     case X86_VENDOR_AMD:
+    case X86_VENDOR_HYGON:
 	if (xlvl >= 0x80000008) {
 	    c->x86_num_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
 	    if (c->x86_num_cores & (c->x86_num_cores - 1))
-- 
2.17.1



More information about the Syslinux mailing list