xref: /illumos-gate/usr/src/uts/intel/sys/x86_archext.h (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ee88d2b9Skchow  * Common Development and Distribution License (the "License").
6ee88d2b9Skchow  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22fb2f18f8Sesaxe  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_X86_ARCHEXT_H
277c478bd9Sstevel@tonic-gate #define	_SYS_X86_ARCHEXT_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #if !defined(_ASM)
327c478bd9Sstevel@tonic-gate #include <sys/regset.h>
337c478bd9Sstevel@tonic-gate #include <sys/processor.h>
347c478bd9Sstevel@tonic-gate #include <vm/seg_enum.h>
357c478bd9Sstevel@tonic-gate #include <vm/page.h>
367c478bd9Sstevel@tonic-gate #endif	/* _ASM */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * cpuid instruction feature flags in %edx (standard function 1)
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_FPU	0x00000001	/* x87 fpu present */
477c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_VME	0x00000002	/* virtual-8086 extension */
487c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_DE	0x00000004	/* debugging extensions */
497c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_PSE	0x00000008	/* page size extension */
507c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_TSC	0x00000010	/* time stamp counter */
517c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_MSR	0x00000020	/* rdmsr and wrmsr */
527c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_PAE	0x00000040	/* physical addr extension */
537c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_MCE	0x00000080	/* machine check exception */
547c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_CX8	0x00000100	/* cmpxchg8b instruction */
557c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_APIC	0x00000200	/* local APIC */
567c478bd9Sstevel@tonic-gate 						/* 0x400 - reserved */
577c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_SEP	0x00000800	/* sysenter and sysexit */
587c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_MTRR	0x00001000	/* memory type range reg */
597c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_PGE	0x00002000	/* page global enable */
607c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_MCA	0x00004000	/* machine check arch */
617c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_CMOV	0x00008000	/* conditional move insns */
627c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_PAT	0x00010000	/* page attribute table */
637c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_PSE36	0x00020000	/* 36-bit pagesize extension */
647c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_PSN	0x00040000	/* processor serial number */
657c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_CLFSH	0x00080000	/* clflush instruction */
667c478bd9Sstevel@tonic-gate 						/* 0x100000 - reserved */
677c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_DS	0x00200000	/* debug store exists */
687c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_ACPI	0x00400000	/* monitoring + clock ctrl */
697c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_MMX	0x00800000	/* MMX instructions */
707c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_FXSR	0x01000000	/* fxsave and fxrstor */
717c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_SSE	0x02000000	/* streaming SIMD extensions */
727c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_SSE2	0x04000000	/* SSE extensions */
737c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_SS	0x08000000	/* self-snoop */
747c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_HTT	0x10000000	/* Hyper Thread Technology */
757c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_TM	0x20000000	/* thermal monitoring */
76*ae115bc7Smrj #define	CPUID_INTC_EDX_IA64	0x40000000	/* Itanium emulating IA32 */
777c478bd9Sstevel@tonic-gate #define	CPUID_INTC_EDX_PBE	0x80000000	/* Pending Break Enable */
787c478bd9Sstevel@tonic-gate 
79*ae115bc7Smrj #define	FMT_CPUID_INTC_EDX					\
80*ae115bc7Smrj 	"\20"							\
81*ae115bc7Smrj 	"\40pbe\37ia64\36tm\35htt\34ss\33sse2\32sse\31fxsr"	\
82*ae115bc7Smrj 	"\30mmx\27acpi\26ds\24clfsh\23psn\22pse36\21pat"	\
83*ae115bc7Smrj 	"\20cmov\17mca\16pge\15mtrr\14sep\12apic\11cx8"		\
847c478bd9Sstevel@tonic-gate 	"\10mce\7pae\6msr\5tsc\4pse\3de\2vme\1fpu"
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * cpuid instruction feature flags in %ecx (standard function 1)
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #define	CPUID_INTC_ECX_SSE3	0x00000001	/* Yet more SSE extensions */
917c478bd9Sstevel@tonic-gate 						/* 0x00000002 - reserved */
927c478bd9Sstevel@tonic-gate 						/* 0x00000004 - reserved */
937c478bd9Sstevel@tonic-gate #define	CPUID_INTC_ECX_MON	0x00000008	/* MONITOR/MWAIT */
947c478bd9Sstevel@tonic-gate #define	CPUID_INTC_ECX_DSCPL	0x00000010	/* CPL-qualified debug store */
95*ae115bc7Smrj #define	CPUID_INTC_ECX_VMX	0x00000020	/* Hardware VM extensions */
96*ae115bc7Smrj #define	CPUID_INTC_ECX_SMX	0x00000040	/* Secure mode extensions */
977c478bd9Sstevel@tonic-gate #define	CPUID_INTC_ECX_EST	0x00000080	/* enhanced SpeedStep */
987c478bd9Sstevel@tonic-gate #define	CPUID_INTC_ECX_TM2	0x00000100	/* thermal monitoring */
99*ae115bc7Smrj #define	CPUID_INTC_ECX_SSSE3	0x00000200	/* Supplemental SSE3 insns */
1007c478bd9Sstevel@tonic-gate #define	CPUID_INTC_ECX_CID	0x00000400	/* L1 context ID */
1017c478bd9Sstevel@tonic-gate 						/* 0x00000800 - reserved */
1027c478bd9Sstevel@tonic-gate 						/* 0x00001000 - reserved */
103*ae115bc7Smrj #define	CPUID_INTC_ECX_CX16	0x00002000	/* cmpxchg16 */
104*ae115bc7Smrj #define	CPUID_INTC_ECX_ETPRD	0x00004000	/* extended task pri messages */
105*ae115bc7Smrj 						/* 0x00008000 - reserved */
106*ae115bc7Smrj 						/* 0x00010000 - reserved */
107*ae115bc7Smrj 						/* 0x00020000 - reserved */
108*ae115bc7Smrj #define	CPUID_INTC_ECX_DCA	0x00040000	/* direct cache access */
109*ae115bc7Smrj 
110*ae115bc7Smrj #define	FMT_CPUID_INTC_ECX					\
111*ae115bc7Smrj 	"\20"							\
112*ae115bc7Smrj 	"\30\23dca"						\
113*ae115bc7Smrj 	"\20\17etprd\16cx16\13cid\12ssse3\11tm2"		\
114*ae115bc7Smrj 	"\10est\7smx\6vmx\5dscpl\4mon\1sse3"
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * cpuid instruction feature flags in %edx (extended function 0x80000001)
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_FPU	0x00000001	/* x87 fpu present */
1217c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_VME	0x00000002	/* virtual-8086 extension */
1227c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_DE	0x00000004	/* debugging extensions */
1237c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_PSE	0x00000008	/* page size extensions */
1247c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_TSC	0x00000010	/* time stamp counter */
1257c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_MSR	0x00000020	/* rdmsr and wrmsr */
1267c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_PAE	0x00000040	/* physical addr extension */
1277c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_MCE	0x00000080	/* machine check exception */
1287c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_CX8	0x00000100	/* cmpxchg8b instruction */
1297c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_APIC	0x00000200	/* local APIC */
1307c478bd9Sstevel@tonic-gate 						/* 0x00000400 - sysc on K6m6 */
1317c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_SYSC	0x00000800	/* AMD: syscall and sysret */
1327c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_MTRR	0x00001000	/* memory type and range reg */
1337c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_PGE	0x00002000	/* page global enable */
1347c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_MCA	0x00004000	/* machine check arch */
1357c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_CMOV	0x00008000	/* conditional move insns */
136*ae115bc7Smrj #define	CPUID_AMD_EDX_PAT	0x00010000	/* K7: page attribute table */
137*ae115bc7Smrj #define	CPUID_AMD_EDX_FCMOV	0x00010000	/* FCMOVcc etc. */
1387c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_PSE36	0x00020000	/* 36-bit pagesize extension */
1397c478bd9Sstevel@tonic-gate 				/* 0x00040000 - reserved */
1407c478bd9Sstevel@tonic-gate 				/* 0x00080000 - reserved */
1417c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_NX	0x00100000	/* AMD: no-execute page prot */
1427c478bd9Sstevel@tonic-gate 				/* 0x00200000 - reserved */
1437c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_MMXamd	0x00400000	/* AMD: MMX extensions */
1447c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_MMX	0x00800000	/* MMX instructions */
1457c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_FXSR	0x01000000	/* fxsave and fxrstor */
146*ae115bc7Smrj #define	CPUID_AMD_EDX_FFXSR	0x02000000	/* fast fxsave/fxrstor */
1477c478bd9Sstevel@tonic-gate 				/* 0x04000000 - reserved */
148*ae115bc7Smrj #define	CPUID_AMD_EDX_TSCP	0x08000000	/* rdtscp instruction */
1497c478bd9Sstevel@tonic-gate 				/* 0x10000000 - reserved */
1507c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_LM	0x20000000	/* AMD: long mode */
1517c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_3DNowx	0x40000000	/* AMD: extensions to 3DNow! */
1527c478bd9Sstevel@tonic-gate #define	CPUID_AMD_EDX_3DNow	0x80000000	/* AMD: 3DNow! instructions */
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #define	FMT_CPUID_AMD_EDX					\
1557c478bd9Sstevel@tonic-gate 	"\20"							\
156*ae115bc7Smrj 	"\40a3d\37a3d+\36lm\34tscp\32ffxsr\31fxsr"		\
1577c478bd9Sstevel@tonic-gate 	"\30mmx\27mmxext\25nx\22pse\21pat"			\
1587c478bd9Sstevel@tonic-gate 	"\20cmov\17mca\16pge\15mtrr\14syscall\12apic\11cx8"	\
1597c478bd9Sstevel@tonic-gate 	"\10mce\7pae\6msr\5tsc\4pse\3de\2vme\1fpu"
1607c478bd9Sstevel@tonic-gate 
161*ae115bc7Smrj #define	CPUID_AMD_ECX_AHF64	0x00000001	/* LAHF and SAHF in long mode */
162*ae115bc7Smrj #define	CPUID_AMD_ECX_CMP_LGCY	0x00000002	/* AMD: multicore chip */
163*ae115bc7Smrj #define	CPUID_AMD_ECX_SVM	0x00000004	/* AMD: secure VM */
164*ae115bc7Smrj #define	CPUID_AMD_ECX_EAS	0x00000008	/* extended apic space */
165*ae115bc7Smrj #define	CPUID_AMD_ECX_CR8D	0x00000010	/* AMD: 32-bit mov %cr8 */
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate #define	FMT_CPUID_AMD_ECX					\
1687c478bd9Sstevel@tonic-gate 	"\20"							\
169*ae115bc7Smrj 	"\5cr8d\3svm\2lcmplgcy\1ahf64"
170*ae115bc7Smrj 
171*ae115bc7Smrj /*
172*ae115bc7Smrj  * Intel now seems to have claimed part of the "extended" function
173*ae115bc7Smrj  * space that we previously for non-Intel implementors to use.
174*ae115bc7Smrj  * More excitingly still, they've claimed bit 20 to mean LAHF/SAHF
175*ae115bc7Smrj  * is available in long mode i.e. what AMD indicate using bit 0.
176*ae115bc7Smrj  * On the other hand, everything else is labelled as reserved.
177*ae115bc7Smrj  */
178*ae115bc7Smrj #define	CPUID_INTC_ECX_AHF64	0x00100000	/* LAHF and SAHF in long mode */
179*ae115bc7Smrj 
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate #define	P5_MCHADDR	0x0
1827c478bd9Sstevel@tonic-gate #define	P5_CESR		0x11
1837c478bd9Sstevel@tonic-gate #define	P5_CTR0		0x12
1847c478bd9Sstevel@tonic-gate #define	P5_CTR1		0x13
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate #define	K5_MCHADDR	0x0
1877c478bd9Sstevel@tonic-gate #define	K5_MCHTYPE	0x01
1887c478bd9Sstevel@tonic-gate #define	K5_TSC		0x10
1897c478bd9Sstevel@tonic-gate #define	K5_TR12		0x12
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate #define	REG_MTRRCAP		0xfe
1927c478bd9Sstevel@tonic-gate #define	REG_MTRRDEF		0x2ff
1937c478bd9Sstevel@tonic-gate #define	REG_MTRR64K		0x250
1947c478bd9Sstevel@tonic-gate #define	REG_MTRR16K1		0x258
1957c478bd9Sstevel@tonic-gate #define	REG_MTRR16K2		0x259
1967c478bd9Sstevel@tonic-gate #define	REG_MTRR4K1		0x268
1977c478bd9Sstevel@tonic-gate #define	REG_MTRR4K2		0x269
1987c478bd9Sstevel@tonic-gate #define	REG_MTRR4K3		0x26a
1997c478bd9Sstevel@tonic-gate #define	REG_MTRR4K4		0x26b
2007c478bd9Sstevel@tonic-gate #define	REG_MTRR4K5		0x26c
2017c478bd9Sstevel@tonic-gate #define	REG_MTRR4K6		0x26d
2027c478bd9Sstevel@tonic-gate #define	REG_MTRR4K7		0x26e
2037c478bd9Sstevel@tonic-gate #define	REG_MTRR4K8		0x26f
2047c478bd9Sstevel@tonic-gate #define	REG_MTRRPAT		0x277
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate #define	REG_MTRRPHYSBASE0	0x200
2077c478bd9Sstevel@tonic-gate #define	REG_MTRRPHYSMASK7	0x20f
2087c478bd9Sstevel@tonic-gate #define	REG_MC0_CTL		0x400
2097c478bd9Sstevel@tonic-gate #define	REG_MC5_MISC		0x417
2107c478bd9Sstevel@tonic-gate #define	REG_PERFCTR0		0xc1
2117c478bd9Sstevel@tonic-gate #define	REG_PERFCTR1		0xc2
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate #define	REG_PERFEVNT0		0x186
2147c478bd9Sstevel@tonic-gate #define	REG_PERFEVNT1		0x187
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate #define	REG_TSC			0x10	/* timestamp counter */
2177c478bd9Sstevel@tonic-gate #define	REG_APIC_BASE_MSR	0x1b
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate #define	MSR_DEBUGCTL		0x1d9
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate #define	DEBUGCTL_LBR		0x01
2227c478bd9Sstevel@tonic-gate #define	DEBUGCTL_BTF		0x02
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate /* Intel P6, AMD */
2257c478bd9Sstevel@tonic-gate #define	MSR_LBR_FROM		0x1db
2267c478bd9Sstevel@tonic-gate #define	MSR_LBR_TO		0x1dc
2277c478bd9Sstevel@tonic-gate #define	MSR_LEX_FROM		0x1dd
2287c478bd9Sstevel@tonic-gate #define	MSR_LEX_TO		0x1de
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate /* Intel P4 (pre-Prescott, non P4 M) */
2317c478bd9Sstevel@tonic-gate #define	MSR_P4_LBSTK_TOS	0x1da
2327c478bd9Sstevel@tonic-gate #define	MSR_P4_LBSTK_0		0x1db
2337c478bd9Sstevel@tonic-gate #define	MSR_P4_LBSTK_1		0x1dc
2347c478bd9Sstevel@tonic-gate #define	MSR_P4_LBSTK_2		0x1dd
2357c478bd9Sstevel@tonic-gate #define	MSR_P4_LBSTK_3		0x1de
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate /* Intel Pentium M */
2387c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_TOS	0x1c9
2397c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_0		0x040
2407c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_1		0x041
2417c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_2		0x042
2427c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_3		0x043
2437c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_4		0x044
2447c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_5		0x045
2457c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_6		0x046
2467c478bd9Sstevel@tonic-gate #define	MSR_P6M_LBSTK_7		0x047
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate /* Intel P4 (Prescott) */
2497c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TOS	0x1da
2507c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_0	0x680
2517c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_1	0x681
2527c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_2	0x682
2537c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_3	0x683
2547c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_4	0x684
2557c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_5	0x685
2567c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_6	0x686
2577c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_7	0x687
2587c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_8 	0x688
2597c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_9	0x689
2607c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_10	0x68a
2617c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_11 	0x68b
2627c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_12	0x68c
2637c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_13	0x68d
2647c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_14	0x68e
2657c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_FROM_15	0x68f
2667c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_0	0x6c0
2677c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_1	0x6c1
2687c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_2	0x6c2
2697c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_3	0x6c3
2707c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_4	0x6c4
2717c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_5	0x6c5
2727c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_6	0x6c6
2737c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_7	0x6c7
2747c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_8	0x6c8
2757c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_9 	0x6c9
2767c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_10	0x6ca
2777c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_11	0x6cb
2787c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_12	0x6cc
2797c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_13	0x6cd
2807c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_14	0x6ce
2817c478bd9Sstevel@tonic-gate #define	MSR_PRP4_LBSTK_TO_15	0x6cf
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate #define	MCI_CTL_VALUE		0xffffffff
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate #define	MTRRTYPE_MASK		0xff
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate #define	MTRRCAP_FIX		0x100
2897c478bd9Sstevel@tonic-gate #define	MTRRCAP_VCNTMASK	0xff
2907c478bd9Sstevel@tonic-gate #define	MTRRCAP_USWC		0x400
2917c478bd9Sstevel@tonic-gate 
2927c478bd9Sstevel@tonic-gate #define	MTRRDEF_E		0x800
2937c478bd9Sstevel@tonic-gate #define	MTRRDEF_FE		0x400
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate #define	MTRRPHYSMASK_V		0x800
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate #define	MTRR_TYPE_UC		0
2987c478bd9Sstevel@tonic-gate #define	MTRR_TYPE_WC		1
2997c478bd9Sstevel@tonic-gate #define	MTRR_TYPE_WT		4
3007c478bd9Sstevel@tonic-gate #define	MTRR_TYPE_WP		5
3017c478bd9Sstevel@tonic-gate #define	MTRR_TYPE_WB		6
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate /*
3047c478bd9Sstevel@tonic-gate  * Page attribute table is setup in the following way
3057c478bd9Sstevel@tonic-gate  * PAT0	Write-BACK
3067c478bd9Sstevel@tonic-gate  * PAT1	Write-Through
3077c478bd9Sstevel@tonic-gate  * PAT2	Unchacheable
3087c478bd9Sstevel@tonic-gate  * PAT3	Uncacheable
3097c478bd9Sstevel@tonic-gate  * PAT4 Uncacheable
3107c478bd9Sstevel@tonic-gate  * PAT5	Write-Protect
3117c478bd9Sstevel@tonic-gate  * PAT6	Write-Combine
3127c478bd9Sstevel@tonic-gate  * PAT7 Uncacheable
3137c478bd9Sstevel@tonic-gate  */
3147c478bd9Sstevel@tonic-gate #define	PAT_DEFAULT_ATTRIBUTE \
3157c478bd9Sstevel@tonic-gate 	((uint64_t)MTRR_TYPE_WC << 48)|((uint64_t)MTRR_TYPE_WP << 40)| \
3167c478bd9Sstevel@tonic-gate 	(MTRR_TYPE_WT << 8)|(MTRR_TYPE_WB)
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate #define	MTRR_SETTYPE(a, t)	((a &= (uint64_t)~0xff),\
3207c478bd9Sstevel@tonic-gate 				    (a |= ((t) & 0xff)))
3217c478bd9Sstevel@tonic-gate #define	MTRR_SETVINVALID(a)	((a) &= ~MTRRPHYSMASK_V)
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate #define	MTRR_SETVBASE(a, b, t)	((a) =\
3257c478bd9Sstevel@tonic-gate 					((((uint64_t)(b)) & 0xffffff000)|\
3267c478bd9Sstevel@tonic-gate 					(((uint32_t)(t)) & 0xff)))
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate #define	MTRR_SETVMASK(a, s, v) ((a) =\
3297c478bd9Sstevel@tonic-gate 				((~(((uint64_t)(s)) - 1) & 0xffffff000)|\
3307c478bd9Sstevel@tonic-gate 					(((uint32_t)(v)) << 11)))
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate #define	MTRR_GETVBASE(a)	(((uint64_t)(a)) & 0xffffff000)
3337c478bd9Sstevel@tonic-gate #define	MTRR_GETVTYPE(a)	(((uint64_t)(a)) & 0xff)
3347c478bd9Sstevel@tonic-gate #define	MTRR_GETVSIZE(a)	((~((uint64_t)(a)) + 1) & 0xffffff000)
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate #define	MAX_MTRRVAR	8
3387c478bd9Sstevel@tonic-gate 
3397c478bd9Sstevel@tonic-gate #if !defined(_ASM)
3407c478bd9Sstevel@tonic-gate typedef	struct	mtrrvar {
3417c478bd9Sstevel@tonic-gate 	uint64_t	mtrrphys_base;
3427c478bd9Sstevel@tonic-gate 	uint64_t	mtrrphys_mask;
3437c478bd9Sstevel@tonic-gate } mtrrvar_t;
3447c478bd9Sstevel@tonic-gate #endif	/* _ASM */
3457c478bd9Sstevel@tonic-gate 
3467c478bd9Sstevel@tonic-gate #define	X86_LARGEPAGE	0x00000001
3477c478bd9Sstevel@tonic-gate #define	X86_TSC		0x00000002
3487c478bd9Sstevel@tonic-gate #define	X86_MSR		0x00000004
3497c478bd9Sstevel@tonic-gate #define	X86_MTRR	0x00000008
3507c478bd9Sstevel@tonic-gate #define	X86_PGE		0x00000010
351*ae115bc7Smrj #define	X86_DE		0x00000020
3527c478bd9Sstevel@tonic-gate #define	X86_CMOV	0x00000040
3537c478bd9Sstevel@tonic-gate #define	X86_MMX 	0x00000080
3547c478bd9Sstevel@tonic-gate #define	X86_MCA		0x00000100
3557c478bd9Sstevel@tonic-gate #define	X86_PAE		0x00000200
3567c478bd9Sstevel@tonic-gate #define	X86_CX8		0x00000400
3577c478bd9Sstevel@tonic-gate #define	X86_PAT		0x00000800
3587c478bd9Sstevel@tonic-gate #define	X86_SEP		0x00001000
3597c478bd9Sstevel@tonic-gate #define	X86_SSE		0x00002000
3607c478bd9Sstevel@tonic-gate #define	X86_SSE2	0x00004000
3617c478bd9Sstevel@tonic-gate #define	X86_HTT		0x00008000
3627c478bd9Sstevel@tonic-gate #define	X86_ASYSC	0x00010000
3637c478bd9Sstevel@tonic-gate #define	X86_NX		0x00020000
3647c478bd9Sstevel@tonic-gate #define	X86_SSE3	0x00040000
3657c478bd9Sstevel@tonic-gate #define	X86_CX16	0x00080000
3667c478bd9Sstevel@tonic-gate #define	X86_CMP		0x00100000
367*ae115bc7Smrj #define	X86_TSCP	0x00200000
3687c478bd9Sstevel@tonic-gate #define	X86_CPUID	0x01000000
3697c478bd9Sstevel@tonic-gate 
3707c478bd9Sstevel@tonic-gate #define	FMT_X86_FEATURE						\
3717c478bd9Sstevel@tonic-gate 	"\20"							\
3727c478bd9Sstevel@tonic-gate 	"\31cpuid"						\
373*ae115bc7Smrj 	"\26tscp\25cmp\24cx16\23sse3\22nx\21asysc"		\
3747c478bd9Sstevel@tonic-gate 	"\20htt\17sse2\16sse\15sep\14pat\13cx8\12pae\11mca"	\
375*ae115bc7Smrj 	"\10mmx\7cmov\6de\5pge\4mtrr\3msr\2tsc\1lgpg"
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate /*
3787c478bd9Sstevel@tonic-gate  * x86_type is a legacy concept; this is supplanted
3797c478bd9Sstevel@tonic-gate  * for most purposes by x86_feature; modern CPUs
3807c478bd9Sstevel@tonic-gate  * should be X86_TYPE_OTHER
3817c478bd9Sstevel@tonic-gate  */
3827c478bd9Sstevel@tonic-gate #define	X86_TYPE_OTHER		0
3837c478bd9Sstevel@tonic-gate #define	X86_TYPE_486		1
3847c478bd9Sstevel@tonic-gate #define	X86_TYPE_P5		2
3857c478bd9Sstevel@tonic-gate #define	X86_TYPE_P6		3
3867c478bd9Sstevel@tonic-gate #define	X86_TYPE_CYRIX_486	4
3877c478bd9Sstevel@tonic-gate #define	X86_TYPE_CYRIX_6x86L	5
3887c478bd9Sstevel@tonic-gate #define	X86_TYPE_CYRIX_6x86	6
3897c478bd9Sstevel@tonic-gate #define	X86_TYPE_CYRIX_GXm	7
3907c478bd9Sstevel@tonic-gate #define	X86_TYPE_CYRIX_6x86MX	8
3917c478bd9Sstevel@tonic-gate #define	X86_TYPE_CYRIX_MediaGX	9
3927c478bd9Sstevel@tonic-gate #define	X86_TYPE_CYRIX_MII	10
3937c478bd9Sstevel@tonic-gate #define	X86_TYPE_VIA_CYRIX_III	11
3947c478bd9Sstevel@tonic-gate #define	X86_TYPE_P4		12
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate /*
3977c478bd9Sstevel@tonic-gate  * x86_vendor allows us to select between
3987c478bd9Sstevel@tonic-gate  * implementation features and helps guide
3997c478bd9Sstevel@tonic-gate  * the interpretation of the cpuid instruction.
4007c478bd9Sstevel@tonic-gate  */
4017c478bd9Sstevel@tonic-gate #define	X86_VENDOR_Intel	0	/* GenuineIntel */
4027c478bd9Sstevel@tonic-gate #define	X86_VENDOR_IntelClone	1	/* (an Intel clone) */
4037c478bd9Sstevel@tonic-gate #define	X86_VENDOR_AMD		2	/* AuthenticAMD */
4047c478bd9Sstevel@tonic-gate #define	X86_VENDOR_Cyrix	3	/* CyrixInstead */
4057c478bd9Sstevel@tonic-gate #define	X86_VENDOR_UMC		4	/* UMC UMC UMC  */
4067c478bd9Sstevel@tonic-gate #define	X86_VENDOR_NexGen	5	/* NexGenDriven */
4077c478bd9Sstevel@tonic-gate #define	X86_VENDOR_Centaur	6	/* CentaurHauls */
4087c478bd9Sstevel@tonic-gate #define	X86_VENDOR_Rise		7	/* RiseRiseRise */
4097c478bd9Sstevel@tonic-gate #define	X86_VENDOR_SiS		8	/* SiS SiS SiS  */
4107c478bd9Sstevel@tonic-gate #define	X86_VENDOR_TM		9	/* GenuineTMx86 */
4117c478bd9Sstevel@tonic-gate #define	X86_VENDOR_NSC		10	/* Geode by NSC */
4127c478bd9Sstevel@tonic-gate 
4137aec1d6eScindi #define	X86_VENDOR_STRLEN	13	/* vendor string max len + \0 */
4147aec1d6eScindi 
4158a40a695Sgavinm /*
4168a40a695Sgavinm  * Some vendor/family/model/stepping ranges are commonly grouped under
4178a40a695Sgavinm  * a single identifying banner by the vendor.  The following encode
4188a40a695Sgavinm  * that "revision" in a uint32_t with the 8 most significant bits
4198a40a695Sgavinm  * identifying the vendor with X86_VENDOR_*, the next 8 identifying the
4208a40a695Sgavinm  * family, and the remaining 16 typically forming a bitmask of revisions
4218a40a695Sgavinm  * within that family with more significant bits indicating "later" revisions.
4228a40a695Sgavinm  */
4238a40a695Sgavinm 
4248a40a695Sgavinm #define	_X86_CHIPREV_VENDOR_MASK	0xff000000u
4258a40a695Sgavinm #define	_X86_CHIPREV_VENDOR_SHIFT	24
4268a40a695Sgavinm #define	_X86_CHIPREV_FAMILY_MASK	0x00ff0000u
4278a40a695Sgavinm #define	_X86_CHIPREV_FAMILY_SHIFT	16
4288a40a695Sgavinm #define	_X86_CHIPREV_REV_MASK		0x0000ffffu
4298a40a695Sgavinm 
4308a40a695Sgavinm #define	_X86_CHIPREV_VENDOR(x) \
4318a40a695Sgavinm 	(((x) & _X86_CHIPREV_VENDOR_MASK) >> _X86_CHIPREV_VENDOR_SHIFT)
4328a40a695Sgavinm #define	_X86_CHIPREV_FAMILY(x) \
4338a40a695Sgavinm 	(((x) & _X86_CHIPREV_FAMILY_MASK) >> _X86_CHIPREV_FAMILY_SHIFT)
4348a40a695Sgavinm #define	_X86_CHIPREV_REV(x) \
4358a40a695Sgavinm 	((x) & _X86_CHIPREV_REV_MASK)
4368a40a695Sgavinm 
4378a40a695Sgavinm /* True if x matches in vendor and family and if x matches the given rev mask */
4388a40a695Sgavinm #define	X86_CHIPREV_MATCH(x, mask) \
4398a40a695Sgavinm 	(_X86_CHIPREV_VENDOR(x) == _X86_CHIPREV_VENDOR(mask) && \
4408a40a695Sgavinm 	_X86_CHIPREV_FAMILY(x) == _X86_CHIPREV_FAMILY(mask) && \
4418a40a695Sgavinm 	((_X86_CHIPREV_REV(x) & _X86_CHIPREV_REV(mask)) != 0))
4428a40a695Sgavinm 
4438a40a695Sgavinm /* True if x matches in vendor and family and rev is at least minx */
4448a40a695Sgavinm #define	X86_CHIPREV_ATLEAST(x, minx) \
4458a40a695Sgavinm 	(_X86_CHIPREV_VENDOR(x) == _X86_CHIPREV_VENDOR(minx) && \
4468a40a695Sgavinm 	_X86_CHIPREV_FAMILY(x) == _X86_CHIPREV_FAMILY(minx) && \
4478a40a695Sgavinm 	_X86_CHIPREV_REV(x) >= _X86_CHIPREV_REV(minx))
4488a40a695Sgavinm 
4498a40a695Sgavinm #define	_X86_CHIPREV_MKREV(vendor, family, rev) \
4508a40a695Sgavinm 	((uint32_t)(vendor) << _X86_CHIPREV_VENDOR_SHIFT | \
4518a40a695Sgavinm 	(family) << _X86_CHIPREV_FAMILY_SHIFT | (rev))
4528a40a695Sgavinm 
4538a40a695Sgavinm /* Revision default */
4548a40a695Sgavinm #define	X86_CHIPREV_UNKNOWN	0x0
4558a40a695Sgavinm 
4568a40a695Sgavinm /*
4578a40a695Sgavinm  * Definitions for AMD Family 0xf.  Minor revisions C0 and CG are
4588a40a695Sgavinm  * sufficiently different that we will distinguish them; in all other
4598a40a695Sgavinm  * case we will identify the major revision.
4608a40a695Sgavinm  */
4618a40a695Sgavinm #define	X86_CHIPREV_AMD_F_REV_B _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0001)
4628a40a695Sgavinm #define	X86_CHIPREV_AMD_F_REV_C0 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0002)
4638a40a695Sgavinm #define	X86_CHIPREV_AMD_F_REV_CG _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0004)
4648a40a695Sgavinm #define	X86_CHIPREV_AMD_F_REV_D _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0008)
4658a40a695Sgavinm #define	X86_CHIPREV_AMD_F_REV_E _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0010)
4668a40a695Sgavinm #define	X86_CHIPREV_AMD_F_REV_F _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0020)
4678a40a695Sgavinm #define	X86_CHIPREV_AMD_F_REV_G _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0040)
4688a40a695Sgavinm 
4698a40a695Sgavinm /*
4708a40a695Sgavinm  * Various socket/package types, extended as the need to distinguish
4718a40a695Sgavinm  * a new type arises.  The top 8 byte identfies the vendor and the
4728a40a695Sgavinm  * remaining 24 bits describe 24 socket types.
4738a40a695Sgavinm  */
4748a40a695Sgavinm 
4758a40a695Sgavinm #define	_X86_SOCKET_VENDOR_SHIFT	24
4768a40a695Sgavinm #define	_X86_SOCKET_VENDOR(x)	((x) >> _X86_SOCKET_VENDOR_SHIFT)
4778a40a695Sgavinm #define	_X86_SOCKET_TYPE_MASK	0x00ffffff
4788a40a695Sgavinm #define	_X86_SOCKET_TYPE(x)		((x) & _X86_SOCKET_TYPE_MASK)
4798a40a695Sgavinm 
4808a40a695Sgavinm #define	_X86_SOCKET_MKVAL(vendor, bitval) \
4818a40a695Sgavinm 	((uint32_t)(vendor) << _X86_SOCKET_VENDOR_SHIFT | (bitval))
4828a40a695Sgavinm 
4838a40a695Sgavinm #define	X86_SOCKET_MATCH(s, mask) \
4848a40a695Sgavinm 	(_X86_SOCKET_VENDOR(s) == _X86_SOCKET_VENDOR(mask) && \
4858a40a695Sgavinm 	(_X86_SOCKET_TYPE(s) & _X86_SOCKET_TYPE(mask)) != 0)
4868a40a695Sgavinm 
4878a40a695Sgavinm #define	X86_SOCKET_UNKNOWN 0x0
4888a40a695Sgavinm 	/*
4898a40a695Sgavinm 	 * AMD socket types
4908a40a695Sgavinm 	 */
4918a40a695Sgavinm #define	X86_SOCKET_754		_X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x000001)
4928a40a695Sgavinm #define	X86_SOCKET_939		_X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x000002)
4938a40a695Sgavinm #define	X86_SOCKET_940		_X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x000004)
4948a40a695Sgavinm #define	X86_SOCKET_S1g1		_X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x000008)
4958a40a695Sgavinm #define	X86_SOCKET_AM2		_X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x000010)
4968a40a695Sgavinm #define	X86_SOCKET_F1207	_X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x000020)
4978a40a695Sgavinm 
4987c478bd9Sstevel@tonic-gate #if !defined(_ASM)
4997c478bd9Sstevel@tonic-gate 
5007c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_KMEMUSER)
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate extern uint_t x86_feature;
5037c478bd9Sstevel@tonic-gate extern uint_t x86_type;
5047c478bd9Sstevel@tonic-gate extern uint_t x86_vendor;
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate extern uint_t pentiumpro_bug4046376;
5077c478bd9Sstevel@tonic-gate extern uint_t pentiumpro_bug4064495;
5087c478bd9Sstevel@tonic-gate 
5097c478bd9Sstevel@tonic-gate extern uint_t enable486;
5107c478bd9Sstevel@tonic-gate 
5117c478bd9Sstevel@tonic-gate extern const char CyrixInstead[];
5127c478bd9Sstevel@tonic-gate 
5137c478bd9Sstevel@tonic-gate #endif
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
5167c478bd9Sstevel@tonic-gate 
5178949bcd6Sandrei /*
5188949bcd6Sandrei  * This structure is used to pass arguments and get return values back
5198949bcd6Sandrei  * from the CPUID instruction in __cpuid_insn() routine.
5208949bcd6Sandrei  */
5218949bcd6Sandrei struct cpuid_regs {
5228949bcd6Sandrei 	uint32_t	cp_eax;
5238949bcd6Sandrei 	uint32_t	cp_ebx;
5248949bcd6Sandrei 	uint32_t	cp_ecx;
5258949bcd6Sandrei 	uint32_t	cp_edx;
5268949bcd6Sandrei };
5277c478bd9Sstevel@tonic-gate 
5280ac7d7d8Skucharsk extern uint64_t rdmsr(uint_t);
5290ac7d7d8Skucharsk extern void wrmsr(uint_t, const uint64_t);
530ee88d2b9Skchow extern uint64_t xrdmsr(uint_t);
531ee88d2b9Skchow extern void xwrmsr(uint_t, const uint64_t);
532*ae115bc7Smrj extern int checked_rdmsr(uint_t, uint64_t *);
533*ae115bc7Smrj extern int checked_wrmsr(uint_t, uint64_t);
534*ae115bc7Smrj 
5357c478bd9Sstevel@tonic-gate extern void invalidate_cache(void);
5367c478bd9Sstevel@tonic-gate extern ulong_t getcr4(void);
5377c478bd9Sstevel@tonic-gate extern void setcr4(ulong_t);
538*ae115bc7Smrj 
5397c478bd9Sstevel@tonic-gate extern void mtrr_sync(void);
5407c478bd9Sstevel@tonic-gate 
5417c478bd9Sstevel@tonic-gate extern void cpu_fast_syscall_enable(void *);
5427c478bd9Sstevel@tonic-gate extern void cpu_fast_syscall_disable(void *);
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate struct cpu;
5457c478bd9Sstevel@tonic-gate 
5467c478bd9Sstevel@tonic-gate extern int cpuid_checkpass(struct cpu *, int);
5478949bcd6Sandrei extern uint32_t cpuid_insn(struct cpu *, struct cpuid_regs *);
5488949bcd6Sandrei extern uint32_t __cpuid_insn(struct cpuid_regs *);
5497c478bd9Sstevel@tonic-gate extern int cpuid_getbrandstr(struct cpu *, char *, size_t);
5507c478bd9Sstevel@tonic-gate extern int cpuid_getidstr(struct cpu *, char *, size_t);
5517c478bd9Sstevel@tonic-gate extern const char *cpuid_getvendorstr(struct cpu *);
5527c478bd9Sstevel@tonic-gate extern uint_t cpuid_getvendor(struct cpu *);
5537c478bd9Sstevel@tonic-gate extern uint_t cpuid_getfamily(struct cpu *);
5547c478bd9Sstevel@tonic-gate extern uint_t cpuid_getmodel(struct cpu *);
5557c478bd9Sstevel@tonic-gate extern uint_t cpuid_getstep(struct cpu *);
5567c478bd9Sstevel@tonic-gate extern uint_t cpuid_get_ncpu_per_chip(struct cpu *);
5578949bcd6Sandrei extern uint_t cpuid_get_ncore_per_chip(struct cpu *);
558fb2f18f8Sesaxe extern int cpuid_get_chipid(struct cpu *);
559fb2f18f8Sesaxe extern id_t cpuid_get_coreid(struct cpu *);
560fb2f18f8Sesaxe extern int cpuid_get_clogid(struct cpu *);
5618949bcd6Sandrei extern int cpuid_is_cmt(struct cpu *);
5627c478bd9Sstevel@tonic-gate extern int cpuid_syscall32_insn(struct cpu *);
5637c478bd9Sstevel@tonic-gate extern int getl2cacheinfo(struct cpu *, int *, int *, int *);
5648a40a695Sgavinm 
5658a40a695Sgavinm extern uint32_t cpuid_getchiprev(struct cpu *);
5668a40a695Sgavinm extern const char *cpuid_getchiprevstr(struct cpu *);
5678a40a695Sgavinm extern uint32_t cpuid_getsockettype(struct cpu *);
5687c478bd9Sstevel@tonic-gate 
5697c478bd9Sstevel@tonic-gate extern int cpuid_opteron_erratum(struct cpu *, uint_t);
5707c478bd9Sstevel@tonic-gate 
5717c478bd9Sstevel@tonic-gate struct cpuid_info;
5727c478bd9Sstevel@tonic-gate 
5737c478bd9Sstevel@tonic-gate extern void setx86isalist(void);
574*ae115bc7Smrj extern void cpuid_alloc_space(struct cpu *);
575*ae115bc7Smrj extern void cpuid_free_space(struct cpu *);
5767c478bd9Sstevel@tonic-gate extern uint_t cpuid_pass1(struct cpu *);
5777c478bd9Sstevel@tonic-gate extern void cpuid_pass2(struct cpu *);
5787c478bd9Sstevel@tonic-gate extern void cpuid_pass3(struct cpu *);
5797c478bd9Sstevel@tonic-gate extern uint_t cpuid_pass4(struct cpu *);
5807c478bd9Sstevel@tonic-gate extern void add_cpunode2devtree(processorid_t, struct cpuid_info *);
5817c478bd9Sstevel@tonic-gate 
5827c478bd9Sstevel@tonic-gate extern void cpuid_get_addrsize(struct cpu *, uint_t *, uint_t *);
5837c478bd9Sstevel@tonic-gate extern uint_t cpuid_get_dtlb_nent(struct cpu *, size_t);
5847c478bd9Sstevel@tonic-gate 
5857c478bd9Sstevel@tonic-gate extern uint_t workaround_errata(struct cpu *);
5867c478bd9Sstevel@tonic-gate 
5877c478bd9Sstevel@tonic-gate #if defined(OPTERON_ERRATUM_93)
5887c478bd9Sstevel@tonic-gate extern int opteron_erratum_93;
5897c478bd9Sstevel@tonic-gate #endif
5907c478bd9Sstevel@tonic-gate 
5917c478bd9Sstevel@tonic-gate #if defined(OPTERON_ERRATUM_91)
5927c478bd9Sstevel@tonic-gate extern int opteron_erratum_91;
5937c478bd9Sstevel@tonic-gate #endif
5947c478bd9Sstevel@tonic-gate 
5957c478bd9Sstevel@tonic-gate #if defined(OPTERON_ERRATUM_100)
5967c478bd9Sstevel@tonic-gate extern int opteron_erratum_100;
5977c478bd9Sstevel@tonic-gate #endif
5987c478bd9Sstevel@tonic-gate 
5997c478bd9Sstevel@tonic-gate #if defined(OPTERON_ERRATUM_121)
6007c478bd9Sstevel@tonic-gate extern int opteron_erratum_121;
6017c478bd9Sstevel@tonic-gate #endif
6027c478bd9Sstevel@tonic-gate 
603ee88d2b9Skchow #if defined(OPTERON_WORKAROUND_6323525)
604ee88d2b9Skchow extern int opteron_workaround_6323525;
605ee88d2b9Skchow extern void patch_workaround_6323525(void);
606ee88d2b9Skchow #endif
607ee88d2b9Skchow 
6087c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
6097c478bd9Sstevel@tonic-gate 
6107c478bd9Sstevel@tonic-gate #endif
6117c478bd9Sstevel@tonic-gate 
6127c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
6137c478bd9Sstevel@tonic-gate }
6147c478bd9Sstevel@tonic-gate #endif
6157c478bd9Sstevel@tonic-gate 
6167c478bd9Sstevel@tonic-gate #endif	/* _SYS_X86_ARCHEXT_H */
617