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.
37a41862fRobert Mustacchi * Copyright 2020 Oxide Computer Company
387932179Jens Elkner */
397932179Jens Elkner
407932179Jens Elkner/*
41e4b8688Cheng Sean Ye * Support functions that interpret CPUID and similar information.
42e4b8688Cheng Sean Ye * These should not be used from anywhere other than cpuid.c and
43e4b8688Cheng Sean Ye * cmi_hw.c - as such we will not list them in any header file
44e4b8688Cheng Sean Ye * such as x86_archext.h.
45e4b8688Cheng Sean Ye *
46e4b8688Cheng Sean Ye * In cpuid.c we process CPUID information for each cpu_t instance
47e4b8688Cheng Sean Ye * we're presented with, and stash this raw information and material
48e4b8688Cheng Sean Ye * derived from it in per-cpu_t structures.
49e4b8688Cheng Sean Ye *
50e4b8688Cheng Sean Ye * If we are virtualized then the CPUID information derived from CPUID
51e4b8688Cheng Sean Ye * instructions executed in the guest is based on whatever the hypervisor
52e4b8688Cheng Sean Ye * wanted to make things look like, and the cpu_t are not necessarily in 1:1
53e4b8688Cheng Sean Ye * or fixed correspondence with real processor execution resources.  In cmi_hw.c
54e4b8688Cheng Sean Ye * we are interested in the native properties of a processor - for fault
55e4b8688Cheng Sean Ye * management (and potentially other, such as power management) purposes;
56e4b8688Cheng Sean Ye * it will tunnel through to real hardware information, and use the
57e4b8688Cheng Sean Ye * functionality provided in this file to process it.
58e4b8688Cheng Sean Ye */
59e4b8688Cheng Sean Ye
60e4b8688Cheng Sean Ye#include <sys/types.h>
61e4b8688Cheng Sean Ye#include <sys/systm.h>
6289e921dKuriakose Kuruvilla#include <sys/bitmap.h>
63e4b8688Cheng Sean Ye#include <sys/x86_archext.h>
6489e921dKuriakose Kuruvilla#include <sys/pci_cfgspace.h>
65a41862fRobert Mustacchi#include <sys/sysmacros.h>
6689e921dKuriakose Kuruvilla#ifdef __xpv
6789e921dKuriakose Kuruvilla#include <sys/hypervisor.h>
6889e921dKuriakose Kuruvilla#endif
69e4b8688Cheng Sean Ye
70e4b8688Cheng Sean Ye/*
7189e921dKuriakose Kuruvilla * AMD socket types.
72e4b8688Cheng Sean Ye * First index :
73e4b8688Cheng Sean Ye *		0 for family 0xf, revs B thru E
74e4b8688Cheng Sean Ye *		1 for family 0xf, revs F and G
7589e921dKuriakose Kuruvilla *		2 for family 0x10
7689e921dKuriakose Kuruvilla *		3 for family 0x11
777932179Jens Elkner *		4 for family 0x12
787932179Jens Elkner *		5 for family 0x14
797932179Jens Elkner *		6 for family 0x15, models 00 - 0f
807932179Jens Elkner *		7 for family 0x15, models 10 - 1f
812ce06f3Robert Mustacchi *		8 for family 0x15, models 30 - 3f
822ce06f3Robert Mustacchi *		9 for family 0x15, models 60 - 6f
832ce06f3Robert Mustacchi *		10 for family 0x15, models 70 - 7f
842ce06f3Robert Mustacchi *		11 for family 0x16, models 00 - 0f
852ce06f3Robert Mustacchi *		12 for family 0x16, models 30 - 3f
862ce06f3Robert Mustacchi *		13 for family 0x17, models 00 - 0f
87a41862fRobert Mustacchi *		14 for family 0x17, models 10 - 2f
88c069210Robert Mustacchi *		15 for family 0x17, models 30 - 3f
89a41862fRobert Mustacchi *		16 for family 0x17, models 60 - 6f
90a41862fRobert Mustacchi *		17 for family 0x17, models 70 - 7f
917932179Jens Elkner * Second index by (model & 0x3) for family 0fh,
927932179Jens Elkner * CPUID pkg bits (Fn8000_0001_EBX[31:28]) for later families.
93e4b8688Cheng Sean Ye */
94a41862fRobert Mustacchistatic uint32_t amd_skts[18][8] = {
95e4b8688Cheng Sean Ye	/*
96e4b8688Cheng Sean Ye	 * Family 0xf revisions B through E
97e4b8688Cheng Sean Ye	 */
98e4b8688Cheng Sean Ye#define	A_SKTS_0			0
99e4b8688Cheng Sean Ye	{
100bd15239Srihari Venkatesan		X86_SOCKET_754,		/* 0b000 */
101bd15239Srihari Venkatesan		X86_SOCKET_940,		/* 0b001 */
102bd15239Srihari Venkatesan		X86_SOCKET_754,		/* 0b010 */
103bd15239Srihari Venkatesan		X86_SOCKET_939,		/* 0b011 */
104bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b100 */
105bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b101 */
106bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
107bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
108e4b8688Cheng Sean Ye	},
109e4b8688Cheng Sean Ye	/*
110e4b8688Cheng Sean Ye	 * Family 0xf revisions F and G
111e4b8688Cheng Sean Ye	 */
112e4b8688Cheng Sean Ye#define	A_SKTS_1			1
113e4b8688Cheng Sean Ye	{
114bd15239Srihari Venkatesan		X86_SOCKET_S1g1,	/* 0b000 */
115bd15239Srihari Venkatesan		X86_SOCKET_F1207,	/* 0b001 */
116bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b010 */
117bd15239Srihari Venkatesan		X86_SOCKET_AM2,		/* 0b011 */
118bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b100 */
119bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b101 */
120bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
121bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
122e4b8688Cheng Sean Ye	},
123e4b8688Cheng Sean Ye	/*
12489e921dKuriakose Kuruvilla	 * Family 0x10
125e4b8688Cheng Sean Ye	 */
126e4b8688Cheng Sean Ye#define	A_SKTS_2			2
127e4b8688Cheng Sean Ye	{
128bd15239Srihari Venkatesan		X86_SOCKET_F1207,	/* 0b000 */
1297932179Jens Elkner		X86_SOCKET_AM2R2,	/* 0b001 */
130bd15239Srihari Venkatesan		X86_SOCKET_S1g3,	/* 0b010 */
131bd15239Srihari Venkatesan		X86_SOCKET_G34,		/* 0b011 */
132bd15239Srihari Venkatesan		X86_SOCKET_ASB2,	/* 0b100 */
133bd15239Srihari Venkatesan		X86_SOCKET_C32,		/* 0b101 */
134bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
135bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
13689e921dKuriakose Kuruvilla	},
13789e921dKuriakose Kuruvilla
13889e921dKuriakose Kuruvilla	/*
13989e921dKuriakose Kuruvilla	 * Family 0x11
14089e921dKuriakose Kuruvilla	 */
14189e921dKuriakose Kuruvilla#define	A_SKTS_3			3
14289e921dKuriakose Kuruvilla	{
143bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b000 */
144bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b001 */
145bd15239Srihari Venkatesan		X86_SOCKET_S1g2,	/* 0b010 */
146bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b011 */
147bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b100 */
148bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b101 */
149bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN,	/* 0b110 */
150bd15239Srihari Venkatesan		X86_SOCKET_UNKNOWN	/* 0b111 */
1517932179Jens Elkner	},
1527932179Jens Elkner
1537932179Jens Elkner	/*
1547932179Jens Elkner	 * Family 0x12
1557932179Jens Elkner	 */
1567932179Jens Elkner#define	A_SKTS_4			4
1577932179Jens Elkner	{
1587932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b000 */
1597932179Jens Elkner		X86_SOCKET_FS1,		/* 0b001 */
1607932179Jens Elkner		X86_SOCKET_FM1,		/* 0b010 */
1617932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b011 */
1627932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
1637932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b101 */
1647932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
1657932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
1667932179Jens Elkner	},
1677932179Jens Elkner
1687932179Jens Elkner	/*
1697932179Jens Elkner	 * Family 0x14
1707932179Jens Elkner	 */
1717932179Jens Elkner#define	A_SKTS_5			5
1727932179Jens Elkner	{
1737932179Jens Elkner		X86_SOCKET_FT1,		/* 0b000 */
1747932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b001 */
1757932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b010 */
1767932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b011 */
1777932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
1787932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b101 */
1797932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
1807932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
1817932179Jens Elkner	},
1827932179Jens Elkner
1837932179Jens Elkner	/*
1847932179Jens Elkner	 * Family 0x15 models 00 - 0f
1857932179Jens Elkner	 */
1867932179Jens Elkner#define	A_SKTS_6			6
1877932179Jens Elkner	{
1887932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b000 */
1897932179Jens Elkner		X86_SOCKET_AM3R2,	/* 0b001 */
1907932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b010 */
1917932179Jens Elkner		X86_SOCKET_G34,		/* 0b011 */
1927932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
1937932179Jens Elkner		X86_SOCKET_C32,		/* 0b101 */
1947932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
1957932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
1967932179Jens Elkner	},
1977932179Jens Elkner
1987932179Jens Elkner	/*
1997932179Jens Elkner	 * Family 0x15 models 10 - 1f
2007932179Jens Elkner	 */
2017932179Jens Elkner#define	A_SKTS_7			7
2027932179Jens Elkner	{
2037932179Jens Elkner		X86_SOCKET_FP2,		/* 0b000 */
2047932179Jens Elkner		X86_SOCKET_FS1R2,	/* 0b001 */
2057932179Jens Elkner		X86_SOCKET_FM2,		/* 0b010 */
2067932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b011 */
2077932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b100 */
2087932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b101 */
2097932179Jens Elkner		X86_SOCKET_UNKNOWN,	/* 0b110 */
2107932179Jens Elkner		X86_SOCKET_UNKNOWN	/* 0b111 */
2117932179Jens Elkner	},
2127932179Jens Elkner
2132ce06f3Robert Mustacchi	/*
2142ce06f3Robert Mustacchi	 * Family 0x15 models 30-3f
2152ce06f3Robert Mustacchi	 */
2162ce06f3Robert Mustacchi#define	A_SKTS_8			8
2172ce06f3Robert Mustacchi	{
2182ce06f3Robert Mustacchi		X86_SOCKET_FP3,		/* 0b000 */
2192ce06f3Robert Mustacchi		X86_SOCKET_FM2R2,	/* 0b001 */
2202ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
2212ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2222ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2232ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2242ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2252ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2262ce06f3Robert Mustacchi	},
2272ce06f3Robert Mustacchi
2282ce06f3Robert Mustacchi	/*
2292ce06f3Robert Mustacchi	 * Family 0x15 models 60-6f
2302ce06f3Robert Mustacchi	 */
2312ce06f3Robert Mustacchi#define	A_SKTS_9			9
2322ce06f3Robert Mustacchi	{
2332ce06f3Robert Mustacchi		X86_SOCKET_FP4,		/* 0b000 */
2342ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2352ce06f3Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
2362ce06f3Robert Mustacchi		X86_SOCKET_FM2R2,	/* 0b011 */
2372ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2382ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2392ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2402ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2412ce06f3Robert Mustacchi	},
2422ce06f3Robert Mustacchi
2432ce06f3Robert Mustacchi	/*
2442ce06f3Robert Mustacchi	 * Family 0x15 models 70-7f
2452ce06f3Robert Mustacchi	 */
2462ce06f3Robert Mustacchi#define	A_SKTS_10			10
2472ce06f3Robert Mustacchi	{
2482ce06f3Robert Mustacchi		X86_SOCKET_FP4,		/* 0b000 */
2492ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2502ce06f3Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
2512ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2522ce06f3Robert Mustacchi		X86_SOCKET_FT4,		/* 0b100 */
2532ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2542ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2552ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2562ce06f3Robert Mustacchi	},
2572ce06f3Robert Mustacchi
2582ce06f3Robert Mustacchi	/*
2592ce06f3Robert Mustacchi	 * Family 0x16 models 00-0f
2602ce06f3Robert Mustacchi	 */
2612ce06f3Robert Mustacchi#define	A_SKTS_11			11
2622ce06f3Robert Mustacchi	{
2632ce06f3Robert Mustacchi		X86_SOCKET_FT3,		/* 0b000 */
2642ce06f3Robert Mustacchi		X86_SOCKET_FS1B,	/* 0b001 */
2652ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
2662ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2672ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2682ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2692ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2702ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2712ce06f3Robert Mustacchi	},
2722ce06f3Robert Mustacchi
2732ce06f3Robert Mustacchi	/*
2742ce06f3Robert Mustacchi	 * Family 0x16 models 30-3f
2752ce06f3Robert Mustacchi	 */
2762ce06f3Robert Mustacchi#define	A_SKTS_12			12
2772ce06f3Robert Mustacchi	{
2782ce06f3Robert Mustacchi		X86_SOCKET_FT3B,	/* 0b000 */
2792ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2802ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
2812ce06f3Robert Mustacchi		X86_SOCKET_FP4,		/* 0b011 */
2822ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
2832ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2842ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
2852ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
2862ce06f3Robert Mustacchi	},
2872ce06f3Robert Mustacchi
2882ce06f3Robert Mustacchi	/*
289c069210Robert Mustacchi	 * Family 0x17 models 00-0f	(Zen 1 - Naples, Ryzen)
2902ce06f3Robert Mustacchi	 */
2912ce06f3Robert Mustacchi#define	A_SKTS_13			13
2922ce06f3Robert Mustacchi	{
2932ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b000 */
2942ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
2952ce06f3Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
2962ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
2972ce06f3Robert Mustacchi		X86_SOCKET_SP3,		/* 0b100 */
2982ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
2992ce06f3Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
3002ce06f3Robert Mustacchi		X86_SOCKET_SP3R2	/* 0b111 */
3012ce06f3Robert Mustacchi	},
3022ce06f3Robert Mustacchi
303c069210Robert Mustacchi	/*
304a41862fRobert Mustacchi	 * Family 0x17 models 10-2f	(Zen 1 - APU: Raven Ridge)
305a41862fRobert Mustacchi	 *				(Zen 1 - APU: Banded Kestrel)
306a41862fRobert Mustacchi	 *				(Zen 1 - APU: Dali)
307c069210Robert Mustacchi	 */
308c069210Robert Mustacchi#define	A_SKTS_14			14
309c069210Robert Mustacchi	{
310c069210Robert Mustacchi		X86_SOCKET_FP5,		/* 0b000 */
311c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
312c069210Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
313c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
314c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
315c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
316c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
317c069210Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
318c069210Robert Mustacchi	},
319c069210Robert Mustacchi
320c069210Robert Mustacchi	/*
321c069210Robert Mustacchi	 * Family 0x17 models 30-3f	(Zen 2 - Rome)
322c069210Robert Mustacchi	 */
323c069210Robert Mustacchi#define	A_SKTS_15			15
324c069210Robert Mustacchi	{
325c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b000 */
326c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
327c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b010 */
328c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
329c069210Robert Mustacchi		X86_SOCKET_SP3,		/* 0b100 */
330c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
331c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
332c069210Robert Mustacchi		X86_SOCKET_SP3R2	/* 0b111 */
333c069210Robert Mustacchi	},
334c069210Robert Mustacchi
335c069210Robert Mustacchi	/*
336a41862fRobert Mustacchi	 * Family 0x17 models 60-6f	(Zen 2 - Renoir)
337c069210Robert Mustacchi	 */
338c069210Robert Mustacchi#define	A_SKTS_16			16
339c069210Robert Mustacchi	{
340a41862fRobert Mustacchi		X86_SOCKET_FP6,		/* 0b000 */
341a41862fRobert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
342a41862fRobert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
343a41862fRobert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
344a41862fRobert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
345a41862fRobert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
346a41862fRobert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
347a41862fRobert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
348a41862fRobert Mustacchi	},
349a41862fRobert Mustacchi
350a41862fRobert Mustacchi	/*
351a41862fRobert Mustacchi	 * Family 0x17 models 70-7f	(Zen 2 - Matisse)
352a41862fRobert Mustacchi	 */
353a41862fRobert Mustacchi#define	A_SKTS_17			17
354a41862fRobert Mustacchi	{
355c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b000 */
356c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b001 */
357c069210Robert Mustacchi		X86_SOCKET_AM4,		/* 0b010 */
358c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b011 */
359c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b100 */
360c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b101 */
361c069210Robert Mustacchi		X86_SOCKET_UNKNOWN,	/* 0b110 */
362c069210Robert Mustacchi		X86_SOCKET_UNKNOWN	/* 0b111 */
363c069210Robert Mustacchi	},
364e4b8688Cheng Sean Ye};
365e4b8688Cheng Sean Ye
36689e921dKuriakose Kuruvillastruct amd_sktmap_s {
36789e921dKuriakose Kuruvilla	uint32_t	skt_code;
36889e921dKuriakose Kuruvilla	char		sktstr[16];
36989e921dKuriakose Kuruvilla};
370a41862fRobert Mustacchistatic struct amd_sktmap_s amd_sktmap_strs[X86_NUM_SOCKETS_AMD + 1] = {
37189e921dKuriakose Kuruvilla	{ X86_SOCKET_754,	"754" },
37289e921dKuriakose Kuruvilla	{ X86_SOCKET_939,	"939" },
37389e921dKuriakose Kuruvilla	{ X86_SOCKET_940,	"940" },
37489e921dKuriakose Kuruvilla	{ X86_SOCKET_S1g1,	"S1g1" },
37589e921dKuriakose Kuruvilla	{ X86_SOCKET_AM2,	"AM2" },
37689e921dKuriakose Kuruvilla	{ X86_SOCKET_F1207,	"F(1207)" },
37789e921dKuriakose Kuruvilla	{ X86_SOCKET_S1g2,	"S1g2" },
37889e921dKuriakose Kuruvilla	{ X86_SOCKET_S1g3,	"S1g3" },
37989e921dKuriakose Kuruvilla	{ X86_SOCKET_AM,	"AM" },
38089e921dKuriakose Kuruvilla	{ X86_SOCKET_AM2R2,	"AM2r2" },
38189e921dKuriakose Kuruvilla	{ X86_SOCKET_AM3,	"AM3" },
38289e921dKuriakose Kuruvilla	{ X86_SOCKET_G34,	"G34" },
383bd15239Srihari Venkatesan	{ X86_SOCKET_ASB2,	"ASB2" },
384bd15239Srihari Venkatesan	{ X86_SOCKET_C32,	"C32" },
3857932179Jens Elkner	{ X86_SOCKET_FT1,	"FT1" },
3867932179Jens Elkner	{ X86_SOCKET_FM1,	"FM1" },
3877932179Jens Elkner	{ X86_SOCKET_FS1,	"FS1" },
3887932179Jens Elkner	{ X86_SOCKET_AM3R2,	"AM3r2" },
3897932179Jens Elkner	{ X86_SOCKET_FP2,	"FP2" },
3907932179Jens Elkner	{ X86_SOCKET_FS1R2,	"FS1r2" },
3917932179Jens Elkner	{ X86_SOCKET_FM2,	"FM2" },
3922ce06f3Robert Mustacchi	{ X86_SOCKET_FP3,	"FP3" },
3932ce06f3Robert Mustacchi	{ X86_SOCKET_FM2R2,	"FM2r2" },
3942ce06f3Robert Mustacchi	{ X86_SOCKET_FP4,	"FP4" },
3952ce06f3Robert Mustacchi	{ X86_SOCKET_AM4,	"AM4" },
3962ce06f3Robert Mustacchi	{ X86_SOCKET_FT3,	"FT3" },
3972ce06f3Robert Mustacchi	{ X86_SOCKET_FT4,	"FT4" },
3982ce06f3Robert Mustacchi	{ X86_SOCKET_FS1B,	"FS1b" },
3992ce06f3Robert Mustacchi	{ X86_SOCKET_FT3B,	"FT3b" },
4002ce06f3Robert Mustacchi	{ X86_SOCKET_SP3,	"SP3" },
4012ce06f3Robert Mustacchi	{ X86_SOCKET_SP3R2,	"SP3r2" },
402c069210Robert Mustacchi	{ X86_SOCKET_FP5,	"FP5" },
403a41862fRobert Mustacchi	{ X86_SOCKET_FP6,	"FP6" },
40489e921dKuriakose Kuruvilla	{ X86_SOCKET_UNKNOWN,	"Unknown" }
40589e921dKuriakose Kuruvilla};
40689e921dKuriakose Kuruvilla
407a41862fRobert Mustacchistatic const struct amd_skt_mapent {
408a41862fRobert Mustacchi	uint_t sm_family;
409a41862fRobert Mustacchi	uint_t sm_modello;
410a41862fRobert Mustacchi	uint_t sm_modelhi;
411a41862fRobert Mustacchi	uint_t sm_sktidx;
412a41862fRobert Mustacchi} amd_sktmap[] = {
413a41862fRobert Mustacchi	{ 0x10, 0x00, 0xff, A_SKTS_2 },
414a41862fRobert Mustacchi	{ 0x11, 0x00, 0xff, A_SKTS_3 },
415a41862fRobert Mustacchi	{ 0x12, 0x00, 0xff, A_SKTS_4 },
416a41862fRobert Mustacchi	{ 0x14, 0x00, 0x0f, A_SKTS_5 },
417a41862fRobert Mustacchi	{ 0x15, 0x00, 0x0f, A_SKTS_6 },
418a41862fRobert Mustacchi	{ 0x15, 0x10, 0x1f, A_SKTS_7 },
419a41862fRobert Mustacchi	{ 0x15, 0x30, 0x3f, A_SKTS_8 },
420a41862fRobert Mustacchi	{ 0x15, 0x60, 0x6f, A_SKTS_9 },
421a41862fRobert Mustacchi	{ 0x15, 0x70, 0x7f, A_SKTS_10 },
422a41862fRobert Mustacchi	{ 0x16, 0x00, 0x0f, A_SKTS_11 },
423a41862fRobert Mustacchi	{ 0x16, 0x30, 0x3f, A_SKTS_12 },
424a41862fRobert Mustacchi	{ 0x17, 0x00, 0x0f, A_SKTS_13 },
425a41862fRobert Mustacchi	{ 0x17, 0x10, 0x2f, A_SKTS_14 },
426a41862fRobert Mustacchi	{ 0x17, 0x30, 0x3f, A_SKTS_15 },
427a41862fRobert Mustacchi	{ 0x17, 0x60, 0x6f, A_SKTS_16 },
428a41862fRobert Mustacchi	{ 0x17, 0x70, 0x7f, A_SKTS_17 }
429a41862fRobert Mustacchi};
430a41862fRobert Mustacchi
431e4b8688Cheng Sean Ye/*
432e4b8688Cheng Sean Ye * Table for mapping AMD Family 0xf and AMD Family 0x10 model/stepping
433e4b8688Cheng Sean Ye * combination to chip "revision" and socket type.
434e4b8688Cheng Sean Ye *
435e4b8688Cheng Sean Ye * The first member of this array that matches a given family, extended model
436e4b8688Cheng Sean Ye * plus model range, and stepping range will be considered a match.
437e4b8688Cheng Sean Ye */
438