1e4b8688Cheng Sean Ye/*
2e4b8688Cheng Sean Ye * CDDL HEADER START
3e4b8688Cheng Sean Ye *
4e4b8688Cheng Sean Ye * The contents of this file are subject to the terms of the
5e4b8688Cheng Sean Ye * Common Development and Distribution License (the "License").
6e4b8688Cheng Sean Ye * You may not use this file except in compliance with the License.
7e4b8688Cheng Sean Ye *
8e4b8688Cheng Sean Ye * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e4b8688Cheng Sean Ye * or http://www.opensolaris.org/os/licensing.
10e4b8688Cheng Sean Ye * See the License for the specific language governing permissions
11e4b8688Cheng Sean Ye * and limitations under the License.
12e4b8688Cheng Sean Ye *
13e4b8688Cheng Sean Ye * When distributing Covered Code, include this CDDL HEADER in each
14e4b8688Cheng Sean Ye * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15e4b8688Cheng Sean Ye * If applicable, add the following below this CDDL HEADER, with the
16e4b8688Cheng Sean Ye * fields enclosed by brackets "[]" replaced with your own identifying
17e4b8688Cheng Sean Ye * information: Portions Copyright [yyyy] [name of copyright owner]
18e4b8688Cheng Sean Ye *
19e4b8688Cheng Sean Ye * CDDL HEADER END
20e4b8688Cheng Sean Ye */
21e4b8688Cheng Sean Ye
22e4b8688Cheng Sean Ye/*
2389e921dKuriakose Kuruvilla * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24e4b8688Cheng Sean Ye * Use is subject to license terms.
2579ec9daYuri Pankov *
2679ec9daYuri Pankov * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
27e4b8688Cheng Sean Ye */
28e4b8688Cheng Sean Ye
29e4b8688Cheng Sean Ye/*
3089e921dKuriakose Kuruvilla * Portions Copyright 2009 Advanced Micro Devices, Inc.
3189e921dKuriakose Kuruvilla */
3289e921dKuriakose Kuruvilla
3389e921dKuriakose Kuruvilla/*
347932179Jens Elkner * Copyright 2012 Jens Elkner <jel+illumos@cs.uni-magdeburg.de>
357932179Jens Elkner * Copyright 2012 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
36c069210Robert Mustacchi * Copyright 2019 Joyent, Inc.
377932179Jens Elkner */
387932179Jens Elkner
397932179Jens Elkner/*
40e4b8688Cheng Sean Ye * Support functions that interpret CPUID and similar information.
41e4b8688Cheng Sean Ye * These should not be used from anywhere other than cpuid.c and
42e4b8688Cheng Sean Ye * cmi_hw.c - as such we will not list them in any header file
43e4b8688Cheng Sean Ye * such as x86_archext.h.
44e4b8688Cheng Sean Ye *
45e4b8688Cheng Sean Ye * In cpuid.c we process CPUID information for each cpu_t instance
46e4b8688Cheng Sean Ye * we're presented with, and stash this raw information and material
47e4b8688Cheng Sean Ye * derived from it in per-cpu_t structures.
48e4b8688Cheng Sean Ye *
49e4b8688Cheng Sean Ye * If we are virtualized then the CPUID information derived from CPUID
50e4b8688Cheng Sean Ye * instructions executed in the guest is based on whatever the hypervisor
51e4b8688Cheng Sean Ye * wanted to make things look like, and the cpu_t are not necessarily in 1:1
52e4b8688Cheng Sean Ye * or fixed correspondence with real processor execution resources.  In cmi_hw.c
53e4b8688Cheng Sean Ye * we are interested in the native properties of a processor - for fault
54e4b8688Cheng Sean Ye * management (and potentially other, such as power management) purposes;
55e4b8688Cheng Sean Ye * it will tunnel through to real hardware information, and use the
56e4b8688Cheng Sean Ye * functionality provided in this file to process it.
57e4b8688Cheng Sean Ye */
58e4b8688Cheng Sean Ye
59e4b8688Cheng Sean Ye#include <sys/types.h>
60e4b8688Cheng Sean Ye#include <sys/systm.h>
6189e921dKuriakose Kuruvilla#include <sys/bitmap.h>
62e4b8688Cheng Sean Ye#include <sys/x86_archext.h>
6389e921dKuriakose Kuruvilla#include <sys/pci_cfgspace.h>
6489e921dKuriakose Kuruvilla#ifdef __xpv
6589e921dKuriakose Kuruvilla#include <sys/hypervisor.h>
6689e921dKuriakose Kuruvilla#endif
67e4b8688Cheng Sean Ye
68e4b8688Cheng Sean Ye/*
6989e921dKuriakose Kuruvilla * AMD socket types.
70e4b8688Cheng Sean Ye * First index :
71e4b8688Cheng Sean Ye *		0 for family 0xf, revs B thru E
72e4b8688Cheng Sean Ye *		1 for family 0xf, revs F and G
7389e921dKuriakose Kuruvilla *		2 for family 0x10
7489e921dKuriakose Kuruvilla *		3 for family 0x11
757932179Jens Elkner *		4 for family 0x12
767932179Jens Elkner *		5 for family 0x14
777932179Jens Elkner *		6 for family 0x15, models 00 - 0f
787932179Jens Elkner *		7 for family 0x15, models 10 - 1f
792ce06f3Robert Mustacchi *		8 for family 0x15, models 30 - 3f
802ce06f3Robert Mustacchi *		9 for family 0x15, models 60 - 6f
812ce06f3Robert Mustacchi *		10 for family 0x15, models 70 - 7f
822ce06f3Robert Mustacchi *		11 for family 0x16, models 00 - 0f
832ce06f3Robert Mustacchi *		12 for family 0x16, models 30 - 3f
842ce06f3Robert Mustacchi *		13 for family 0x17, models 00 - 0f
85c069210Robert Mustacchi *		14 for family 0x17, models 10 - 1f
86c069210Robert Mustacchi *		15 for family 0x17, models 30 - 3f
87c069210Robert Mustacchi *		16 for family 0x17, models 70 - 7f
887932179Jens Elkner * Second index by (model & 0x3) for family 0fh,
897932179Jens Elkner * CPUID pkg bits (Fn8000_0001_EBX[31:28]) for later families.
90e4b8688Cheng Sean Ye */
91c069210Robert Mustacchistatic uint32_t amd_skts[17][8] = {
92e4b8688Cheng Sean Ye	/*
93e4b8688Cheng Sean Ye	 * Family 0xf revisions B through E
94e4b8688Cheng Sean Ye	 */
95e4b8688Cheng Sean Ye#define	A_SKTS_0			0
96e4b8688Cheng Sean Ye	{
97bd15239Srihari Venkatesan		X86_SOCKET_754,		/* 0b000 */
98bd15239Srihari Venkatesan		X86_SOCKET_940,		/* 0b001 */
99bd15239Srihari Venkatesan		X86_SOCKET_754,		/* 0b010 */
100bd15239Srihari Venkatesan		X86_SOCKET_939,		/* 0b011 */
101bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b100 */
102bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b101 */
103bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
104bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
105e4b8688Cheng Sean Ye	},
106e4b8688Cheng Sean Ye	/*
107e4b8688Cheng Sean Ye	 * Family 0xf revisions F and G
108e4b8688Cheng Sean Ye	 */
109e4b8688Cheng Sean Ye#define	A_SKTS_1			1
110e4b8688Cheng Sean Ye	{
111bd15239Srihari Venkatesan		X86_SOCKET_S1g1,	/* 0b000 */
112bd15239Srihari Venkatesan		X86_SOCKET_F1207,	/* 0b001 */
113bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b010 */
114bd15239Srihari Venkatesan		X86_SOCKET_AM2,		/* 0b011 */
115bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b100 */
116bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b101 */
117bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
118bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
119e4b8688Cheng Sean Ye	},
120e4b8688Cheng Sean Ye	/*
12189e921dKuriakose Kuruvilla	 * Family 0x10
122e4b8688Cheng Sean Ye	 */
123e4b8688Cheng Sean Ye#define	A_SKTS_2			2
124e4b8688Cheng Sean Ye	{
125bd15239Srihari Venkatesan		X86_SOCKET_F1207,	/* 0b000 */
1267932179Jens Elkner		X86_SOCKET_AM2R2,	/* 0b001 */
127bd15239Srihari Venkatesan		X86_SOCKET_S1g3,	/* 0b010 */
128bd15239Srihari Venkatesan		X86_SOCKET_G34,		/* 0b011 */
129bd15239Srihari Venkatesan		X86_SOCKET_ASB2,	/* 0b100 */
130bd15239Srihari Venkatesan		X86_SOCKET_C32,		/* 0b101 */
131bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
132bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
13389e921dKuriakose Kuruvilla	},
13489e921dKuriakose Kuruvilla
13589e921dKuriakose Kuruvilla	/*
13689e921dKuriakose Kuruvilla	 * Family 0x11
13789e921dKuriakose Kuruvilla	 */
13889e921dKuriakose Kuruvilla#define	A_SKTS_3			3
13989e921dKuriakose Kuruvilla	{
140bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b000 */
141bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b001 */
142bd15239Srihari Venkatesan		X86_SOCKET_S1g2,	/* 0b010 */
143bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b011 */
144bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b100 */
145bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b101 */
146bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
147bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
1487932179Jens Elkner	},
1497932179Jens Elkner
1507932179Jens Elkner	/*
1517932179Jens Elkner	 * Family 0x12
1527932179Jens Elkner	 */
1537932179Jens Elkner#define	A_SKTS_4			4
1547932179Jens Elkner	{
1557932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b000 */
1567932179Jens Elkner		X86_SOCKET_FS1,		/* 0b001 */
1577932179Jens Elkner		X86_SOCKET_FM1,		/* 0b010 */
1587932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b011 */
1597932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
1607932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b101 */
1617932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
1627932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
1637932179Jens Elkner	},
1647932179Jens Elkner
1657932179Jens Elkner	/*
1667932179Jens Elkner	 * Family 0x14
1677932179Jens Elkner	 */
1687932179Jens Elkner#define	A_SKTS_5			5
1697932179Jens Elkner	{
1707932179Jens Elkner		X86_SOCKET_FT1,		/* 0b000 */
1717932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b001 */
1727932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b010 */
1737932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b011 */
1747932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
1757932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b101 */
1767932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
1777932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
1787932179Jens Elkner	},
1797932179Jens Elkner
1807932179Jens Elkner	/*
1817932179Jens Elkner	 * Family 0x15 models 00 - 0f
1827932179Jens Elkner	 */
1837932179Jens Elkner#define	A_SKTS_6			6
1847932179Jens Elkner	{
1857932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b000 */
1867932179Jens Elkner		X86_SOCKET_AM3R2,	/* 0b001 */
1877932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b010 */
1887932179Jens Elkner		X86_SOCKET_G34,		/* 0b011 */
1897932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
1907932179Jens Elkner		X86_SOCKET_C32,		/* 0b101 */
1917932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
1927932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
1937932179Jens Elkner	},
1947932179Jens Elkner
1957932179Jens Elkner	/*
1967932179Jens Elkner	 * Family 0x15 models 10 - 1f
1977932179Jens Elkner	 */
1987932179Jens Elkner#define	A_SKTS_7			7
1997932179Jens Elkner	{
2007932179Jens Elkner		X86_SOCKET_FP2,		/* 0b000 */
2017932179Jens Elkner		X86_SOCKET_FS1R2,	/* 0b001 */
2027932179Jens Elkner		X86_SOCKET_FM2,		/* 0b010 */
2037932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b011 */
2047932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
2057932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b101 */
2067932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
2077932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
2087932179Jens Elkner	},
2097932179Jens Elkner
2102ce06f3Robert Mustacchi	/*
2112ce06f3Robert Mustacchi	 * Family 0x15 models 30-3f
2122ce06f3Robert Mustacchi	 */
2132ce06f3Robert Mustacchi#define	A_SKTS_8			8
2142ce06f3Robert Mustacchi	{
2152ce06f3Robert Mustacchi		X86_SOCKET_FP3,		/* 0b000 */
2162ce06f3Robert Mustacchi		X86_SOCKET_FM2R2,	/* 0b001 */
2172ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
2182ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2192ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2202ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2212ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2222ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2232ce06f3Robert Mustacchi	},
2242ce06f3Robert Mustacchi
2252ce06f3Robert Mustacchi	/*
2262ce06f3Robert Mustacchi	 * Family 0x15 models 60-6f
2272ce06f3Robert Mustacchi	 */
2282ce06f3Robert Mustacchi#define	A_SKTS_9			9
2292ce06f3Robert Mustacchi	{
2302ce06f3Robert Mustacchi		X86_SOCKET_FP4,		/* 0b000 */
2312ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2322ce06f3Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
2332ce06f3Robert Mustacchi		X86_SOCKET_FM2R2,	/* 0b011 */
2342ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2352ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2362ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2372ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2382ce06f3Robert Mustacchi	},
2392ce06f3Robert Mustacchi
2402ce06f3Robert Mustacchi	/*
2412ce06f3Robert Mustacchi	 * Family 0x15 models 70-7f
2422ce06f3Robert Mustacchi	 */
2432ce06f3Robert Mustacchi#define	A_SKTS_10			10
2442ce06f3Robert Mustacchi	{
2452ce06f3Robert Mustacchi		X86_SOCKET_FP4,		/* 0b000 */
2462ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2472ce06f3Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
2482ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2492ce06f3Robert Mustacchi		X86_SOCKET_FT4,		/* 0b100 */
2502ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2512ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2522ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2532ce06f3Robert Mustacchi	},
2542ce06f3Robert Mustacchi
2552ce06f3Robert Mustacchi	/*
2562ce06f3Robert Mustacchi	 * Family 0x16 models 00-0f
2572ce06f3Robert Mustacchi	 */
2582ce06f3Robert Mustacchi#define	A_SKTS_11			11
2592ce06f3Robert Mustacchi	{
2602ce06f3Robert Mustacchi		X86_SOCKET_FT3,		/* 0b000 */
2612ce06f3Robert Mustacchi		X86_SOCKET_FS1B,	/* 0b001 */
2622ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
2632ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2642ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2652ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2662ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2672ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2682ce06f3Robert Mustacchi	},
2692ce06f3Robert Mustacchi
2702ce06f3Robert Mustacchi	/*
2712ce06f3Robert Mustacchi	 * Family 0x16 models 30-3f
2722ce06f3Robert Mustacchi	 */
2732ce06f3Robert Mustacchi#define	A_SKTS_12			12
2742ce06f3Robert Mustacchi	{
2752ce06f3Robert Mustacchi		X86_SOCKET_FT3B,	/* 0b000 */
2762ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2772ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
2782ce06f3Robert Mustacchi		X86_SOCKET_FP4,		/* 0b011 */
2792ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2802ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2812ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2822ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2832ce06f3Robert Mustacchi	},
2842ce06f3Robert Mustacchi
2852ce06f3Robert Mustacchi	/*
286c069210Robert Mustacchi	 * Family 0x17 models 00-0f	(Zen 1 - Naples, Ryzen)
2872ce06f3Robert Mustacchi	 */
2882ce06f3Robert Mustacchi#define	A_SKTS_13			13
2892ce06f3Robert Mustacchi	{
2902ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b000 */
2912ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2922ce06f3Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
2932ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2942ce06f3Robert Mustacchi		X86_SOCKET_SP3,		/* 0b100 */
2952ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2962ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2972ce06f3Robert Mustacchi		X86_SOCKET_SP3R2	/* 0b111 */
2982ce06f3Robert Mustacchi	},
2992ce06f3Robert Mustacchi
300c069210Robert Mustacchi	/*
301c069210Robert Mustacchi	 * Family 0x17 models 10-1f	(Zen 1 - APU: Raven Ridge)
302c069210Robert Mustacchi	 */
303c069210Robert Mustacchi#define	A_SKTS_14			14
304c069210Robert Mustacchi	{
305c069210Robert Mustacchi		X86_SOCKET_FP5,		/* 0b000 */
306c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
307c069210Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
308c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
309c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
310c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
311c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
312c069210Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
313c069210Robert Mustacchi	},
314c069210Robert Mustacchi
315c069210Robert Mustacchi	/*
316c069210Robert Mustacchi	 * Family 0x17 models 30-3f	(Zen 2 - Rome)
317c069210Robert Mustacchi	 */
318c069210Robert Mustacchi#define	A_SKTS_15			15
319c069210Robert Mustacchi	{
320c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b000 */
321c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
322c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
323c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
324c069210Robert Mustacchi		X86_SOCKET_SP3,		/* 0b100 */
325c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
326c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
327c069210Robert Mustacchi		X86_SOCKET_SP3R2	/* 0b111 */
328c069210Robert Mustacchi	},
329c069210Robert Mustacchi
330c069210Robert Mustacchi	/*
331c069210Robert Mustacchi	 * Family 0x17 models 70-7f	(Zen 2 - Matisse)
332c069210Robert Mustacchi	 */
333c069210Robert Mustacchi#define	A_SKTS_16			16
334c069210Robert Mustacchi	{
335c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b000 */
336c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
337c069210Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
338c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
339c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
340c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
341c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
342c069210Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
343c069210Robert Mustacchi	},
344e4b8688Cheng Sean Ye};
345e4b8688Cheng Sean Ye
34689e921dKuriakose Kuruvillastruct amd_sktmap_s {
34789e921dKuriakose Kuruvilla	uint32_t	skt_code;
34889e921dKuriakose Kuruvilla	char		sktstr[16];
34989e921dKuriakose Kuruvilla};
3502ce06f3Robert Mustacchistatic struct amd_sktmap_s amd_sktmap[X86_NUM_SOCKETS_AMD + 1] = {
35189e921dKuriakose Kuruvilla	{ X86_SOCKET_754,	"754" },
35289e921dKuriakose Kuruvilla	{ X86_SOCKET_939,	"939" },
35389e921dKuriakose Kuruvilla	{ X86_SOCKET_940,	"940" },
35489e921dKuriakose Kuruvilla	{ X86_SOCKET_S1g1,	"S1g1" },
35589e921dKuriakose Kuruvilla	{ X86_SOCKET_AM2,	"AM2" },
35689e921dKuriakose Kuruvilla	{ X86_SOCKET_F1207,	"F(1207)" },
35789e921dKuriakose Kuruvilla	{ X86_SOCKET_S1g2,	"S1g2" },
35889e921dKuriakose Kuruvilla	{ X86_SOCKET_S1g3,	"S1g3" },
35989e921dKuriakose Kuruvilla	{ X86_SOCKET_AM,	"AM" },
36089e921dKuriakose Kuruvilla	{ X86_SOCKET_AM2R2,	"AM2r2" },
36189e921dKuriakose Kuruvilla	{ X86_SOCKET_AM3,	"AM3" },
36289e921dKuriakose Kuruvilla	{ X86_SOCKET_G34,	"G34" },
363bd15239Srihari Venkatesan	{ X86_SOCKET_ASB2,	"ASB2" },
364bd15239Srihari Venkatesan	{ X86_SOCKET_C32,	"C32" },
3657932179Jens Elkner	{ X86_SOCKET_FT1,	"FT1" },
3667932179Jens Elkner	{ X86_SOCKET_FM1,	"FM1" },
3677932179Jens Elkner	{ X86_SOCKET_FS1,	"FS1" },
3687932179Jens Elkner	{ X86_SOCKET_AM3R2,	"AM3r2" },
3697932179Jens Elkner	{ X86_SOCKET_FP2,	"FP2" },
3707932179Jens Elkner	{ X86_SOCKET_FS1R2,	"FS1r2" },
3717932179Jens Elkner	{ X86_SOCKET_FM2,	"FM2" },
3722ce06f3Robert Mustacchi	{ X86_SOCKET_FP3,	"FP3" },
3732ce06f3Robert Mustacchi	{ X86_SOCKET_FM2R2,	"FM2r2" },
3742ce06f3Robert Mustacchi	{ X86_SOCKET_FP4,	"FP4" },
3752ce06f3Robert Mustacchi	{ X86_SOCKET_AM4,	"AM4" },
3762ce06f3Robert Mustacchi	{ X86_SOCKET_FT3,	"FT3" },
3772ce06f3Robert Mustacchi	{ X86_SOCKET_FT4,	"FT4" },
3782ce06f3Robert Mustacchi	{ X86_SOCKET_FS1B,	"FS1b" },
3792ce06f3Robert Mustacchi	{ X86_SOCKET_FT3B,	"FT3b" },
3802ce06f3Robert Mustacchi	{ X86_SOCKET_SP3,	"SP3" },
3812ce06f3Robert Mustacchi	{ X86_SOCKET_SP3R2,	"SP3r2" },
382c069210Robert Mustacchi	{ X86_SOCKET_FP5,	"FP5" },
38389e921dKuriakose Kuruvilla	{ X86_SOCKET_UNKNOWN,	"Unknown" }
38489e921dKuriakose Kuruvilla};
38589e921dKuriakose Kuruvilla
386e4b8688Cheng Sean Ye/*
387e4b8688Cheng Sean Ye * Table for mapping AMD Family 0xf and AMD Family 0x10 model/stepping
388e4b8688Cheng Sean Ye * combination to chip "revision" and socket type.
389e4b8688Cheng Sean Ye *
390e4b8688Cheng Sean Ye * The first member of this array that matches a given family, extended model
391e4b8688Cheng Sean Ye * plus model range, and stepping range will be considered a match.
392e4b8688Cheng Sean Ye */
393e4b8688Cheng Sean Yestatic const struct amd_rev_mapent {
394e4b8688Cheng Sean Ye	uint_t rm_family;
395e4b8688Cheng Sean Ye	uint_t rm_modello;
396e4b8688Cheng Sean Ye	uint_t rm_modelhi;
397e4b8688Cheng Sean Ye	uint_t rm_steplo;
398e4b8688Cheng Sean Ye	uint_t rm_stephi;
399