[syslinux] [PATCH] Add support for Hygon Dhyana processor

Jinke Fan fanjinke51 at yeah.net
Wed May 15 00:57:53 PDT 2019


Background:
    Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture
    between AMD and Haiguang Information Technology Co.,Ltd., aims at
    providing high performance x86 processor for China server market.
    Its first generation processor codename is Dhyana, which
    originates from AMD technology and shares most of the
    architecture with AMD's family 17h, but with different CPU Vendor
    ID("HygonGenuine")/Family series number(Family 18h).

Related Hygon kernel patch can be found on:
http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn

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