Add support for Hygon Dhyana Family 18h processor.
authorkib <kib@FreeBSD.org>
Tue, 21 Jan 2020 13:22:35 +0000 (13:22 +0000)
committerkib <kib@FreeBSD.org>
Tue, 21 Jan 2020 13:22:35 +0000 (13:22 +0000)
commit69f7c0ee631f179140895528cfea29e271e5186e
tree130e8a98f9cc3d78c6297fa862fcc082450b6658
parenta0c2b658b2780b0160158f32009b944227b852d4
Add support for Hygon Dhyana Family 18h processor.

As a new x86 CPU vendor, Chengdu Haiguang IC Design Co., Ltd (Hygon)
is a joint venture between AMD and Haiguang Information Technology Co.,
Ltd., aims at providing x86 processors for China server market.

The first generation Hygon processor(Dhyana) shares most architecture
with AMD's family 17h, but with different CPU vendor ID("HygonGenuine")
and PCI vendor ID(0x1d94) and family series number 18h(Hygon negotiated
with AMD to confirm that only Hygon use family 18h).

To enable Hygon Dhyana support in FreeBSD, add new definitions
HYGON_VENDOR_ID("HygonGenuine") and X86_VENDOR_HYGON(0x1d94) to identify
Hygon Dhyana CPU.

Initialize the CPU features(topology, local APIC ext, MSI, TSC, hwpstate,
MCA, DEBUG_CTL, etc) for amd64 and i386 mode by sharing the code path of
AMD family 17h.

The changes have been applied on FreeBSD 13.0-CURRENT and tested
successfully on Hygon Dhyana processor.

References:
[1] Linux kernel patches for Hygon Dhyana, merged in 4.20:

https://git.kernel.org/tip/c9661c1e80b609cd038db7c908e061f0535804ef

[2] MSR and CPUID definition:

https://www.amd.com/system/files/TechDocs/54945_PPR_Family_17h_Models_00h-0Fh.pdf

Submitted by: Pu Wen <puwen@hygon.cn>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23163
12 files changed:
stand/i386/libi386/bootinfo64.c
sys/amd64/amd64/initcpu.c
sys/i386/i386/machdep.c
sys/x86/cpufreq/hwpstate.c
sys/x86/include/cputypes.h
sys/x86/include/specialreg.h
sys/x86/x86/identcpu.c
sys/x86/x86/local_apic.c
sys/x86/x86/mca.c
sys/x86/x86/mp_x86.c
sys/x86/x86/msi.c
sys/x86/x86/tsc.c