annotate usr/src/uts/i86pc/os/cpuid.c @ 6691:f8848c7acc9e

6671130 Shanghai provides better TLB management for 1GB pages 6679225 erratum 298 detection needed 6692442 errata updates needed for griffin processors (family 0x11)
author kchow
date Thu, 22 May 2008 13:30:16 -0700
parents bb854dac18c7
children 3eb8a0c8b90a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2 * CDDL HEADER START
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
4 * The contents of this file are subject to the terms of the
1582
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
5 * Common Development and Distribution License (the "License").
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
6 * You may not use this file except in compliance with the License.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
7 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
9 * or http://www.opensolaris.org/os/licensing.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
10 * See the License for the specific language governing permissions
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
11 * and limitations under the License.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
12 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
13 * When distributing Covered Code, include this CDDL HEADER in each
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
15 * If applicable, add the following below this CDDL HEADER, with the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
16 * fields enclosed by brackets "[]" replaced with your own identifying
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
17 * information: Portions Copyright [yyyy] [name of copyright owner]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
18 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
19 * CDDL HEADER END
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
20 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
21 /*
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
23 * Use is subject to license terms.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
24 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
25
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
26 #pragma ident "%Z%%M% %I% %E% SMI"
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
27
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
28 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
29 * Various routines to handle identification
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
30 * and classification of x86 processors.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
31 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
32
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
33 #include <sys/types.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
34 #include <sys/archsystm.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
35 #include <sys/x86_archext.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
36 #include <sys/kmem.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
37 #include <sys/systm.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
38 #include <sys/cmn_err.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
39 #include <sys/sunddi.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
40 #include <sys/sunndi.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
41 #include <sys/cpuvar.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
42 #include <sys/processor.h>
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
43 #include <sys/sysmacros.h>
3434
5142e1d7d0bc 6461311 multi-level CMT scheduling optimizations
esaxe
parents: 2869
diff changeset
44 #include <sys/pg.h>
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
45 #include <sys/fp.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
46 #include <sys/controlregs.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
47 #include <sys/auxv_386.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
48 #include <sys/bitmap.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
49 #include <sys/memnode.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
50
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
51 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
52 * Pass 0 of cpuid feature analysis happens in locore. It contains special code
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
53 * to recognize Cyrix processors that are not cpuid-compliant, and to deal with
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
54 * them accordingly. For most modern processors, feature detection occurs here
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
55 * in pass 1.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
56 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
57 * Pass 1 of cpuid feature analysis happens just at the beginning of mlsetup()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
58 * for the boot CPU and does the basic analysis that the early kernel needs.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
59 * x86_feature is set based on the return value of cpuid_pass1() of the boot
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
60 * CPU.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
61 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
62 * Pass 1 includes:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
63 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
64 * o Determining vendor/model/family/stepping and setting x86_type and
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
65 * x86_vendor accordingly.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
66 * o Processing the feature flags returned by the cpuid instruction while
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
67 * applying any workarounds or tricks for the specific processor.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
68 * o Mapping the feature flags into Solaris feature bits (X86_*).
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
69 * o Processing extended feature flags if supported by the processor,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
70 * again while applying specific processor knowledge.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
71 * o Determining the CMT characteristics of the system.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
72 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
73 * Pass 1 is done on non-boot CPUs during their initialization and the results
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
74 * are used only as a meager attempt at ensuring that all processors within the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
75 * system support the same features.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
76 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
77 * Pass 2 of cpuid feature analysis happens just at the beginning
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
78 * of startup(). It just copies in and corrects the remainder
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
79 * of the cpuid data we depend on: standard cpuid functions that we didn't
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
80 * need for pass1 feature analysis, and extended cpuid functions beyond the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
81 * simple feature processing done in pass1.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
82 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
83 * Pass 3 of cpuid analysis is invoked after basic kernel services; in
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
84 * particular kernel memory allocation has been made available. It creates a
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
85 * readable brand string based on the data collected in the first two passes.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
86 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
87 * Pass 4 of cpuid analysis is invoked after post_startup() when all
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
88 * the support infrastructure for various hardware features has been
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
89 * initialized. It determines which processor features will be reported
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
90 * to userland via the aux vector.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
91 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
92 * All passes are executed on all CPUs, but only the boot CPU determines what
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
93 * features the kernel will use.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
94 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
95 * Much of the worst junk in this file is for the support of processors
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
96 * that didn't really implement the cpuid instruction properly.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
97 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
98 * NOTE: The accessor functions (cpuid_get*) are aware of, and ASSERT upon,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
99 * the pass numbers. Accordingly, changes to the pass code may require changes
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
100 * to the accessor code.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
101 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
102
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
103 uint_t x86_feature = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
104 uint_t x86_vendor = X86_VENDOR_IntelClone;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
105 uint_t x86_type = X86_TYPE_OTHER;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
106
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
107 uint_t pentiumpro_bug4046376;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
108 uint_t pentiumpro_bug4064495;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
109
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
110 uint_t enable486;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
111
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
112 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
113 * This set of strings are for processors rumored to support the cpuid
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
114 * instruction, and is used by locore.s to figure out how to set x86_vendor
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
115 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
116 const char CyrixInstead[] = "CyrixInstead";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
117
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
118 /*
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
119 * monitor/mwait info.
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
120 *
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
121 * size_actual and buf_actual are the real address and size allocated to get
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
122 * proper mwait_buf alignement. buf_actual and size_actual should be passed
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
123 * to kmem_free(). Currently kmem_alloc() and mwait happen to both use
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
124 * processor cache-line alignment, but this is not guarantied in the furture.
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
125 */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
126 struct mwait_info {
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
127 size_t mon_min; /* min size to avoid missed wakeups */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
128 size_t mon_max; /* size to avoid false wakeups */
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
129 size_t size_actual; /* size actually allocated */
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
130 void *buf_actual; /* memory actually allocated */
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
131 uint32_t support; /* processor support of monitor/mwait */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
132 };
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
133
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
134 /*
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
135 * These constants determine how many of the elements of the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
136 * cpuid we cache in the cpuid_info data structure; the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
137 * remaining elements are accessible via the cpuid instruction.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
138 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
139
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
140 #define NMAX_CPI_STD 6 /* eax = 0 .. 5 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
141 #define NMAX_CPI_EXTD 9 /* eax = 0x80000000 .. 0x80000008 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
142
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
143 struct cpuid_info {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
144 uint_t cpi_pass; /* last pass completed */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
145 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
146 * standard function information
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
147 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
148 uint_t cpi_maxeax; /* fn 0: %eax */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
149 char cpi_vendorstr[13]; /* fn 0: %ebx:%ecx:%edx */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
150 uint_t cpi_vendor; /* enum of cpi_vendorstr */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
151
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
152 uint_t cpi_family; /* fn 1: extended family */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
153 uint_t cpi_model; /* fn 1: extended model */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
154 uint_t cpi_step; /* fn 1: stepping */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
155 chipid_t cpi_chipid; /* fn 1: %ebx: chip # on ht cpus */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
156 uint_t cpi_brandid; /* fn 1: %ebx: brand ID */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
157 int cpi_clogid; /* fn 1: %ebx: thread # */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
158 uint_t cpi_ncpu_per_chip; /* fn 1: %ebx: logical cpu count */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
159 uint8_t cpi_cacheinfo[16]; /* fn 2: intel-style cache desc */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
160 uint_t cpi_ncache; /* fn 2: number of elements */
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
161 uint_t cpi_ncpu_shr_last_cache; /* fn 4: %eax: ncpus sharing cache */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
162 id_t cpi_last_lvl_cacheid; /* fn 4: %eax: derived cache id */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
163 uint_t cpi_std_4_size; /* fn 4: number of fn 4 elements */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
164 struct cpuid_regs **cpi_std_4; /* fn 4: %ecx == 0 .. fn4_size */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
165 struct cpuid_regs cpi_std[NMAX_CPI_STD]; /* 0 .. 5 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
166 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
167 * extended function information
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
168 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
169 uint_t cpi_xmaxeax; /* fn 0x80000000: %eax */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
170 char cpi_brandstr[49]; /* fn 0x8000000[234] */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
171 uint8_t cpi_pabits; /* fn 0x80000006: %eax */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
172 uint8_t cpi_vabits; /* fn 0x80000006: %eax */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
173 struct cpuid_regs cpi_extd[NMAX_CPI_EXTD]; /* 0x8000000[0-8] */
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
174 id_t cpi_coreid; /* same coreid => strands share core */
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
175 int cpi_pkgcoreid; /* core number within single package */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
176 uint_t cpi_ncore_per_chip; /* AMD: fn 0x80000008: %ecx[7-0] */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
177 /* Intel: fn 4: %eax[31-26] */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
178 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
179 * supported feature information
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
180 */
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
181 uint32_t cpi_support[5];
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
182 #define STD_EDX_FEATURES 0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
183 #define AMD_EDX_FEATURES 1
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
184 #define TM_EDX_FEATURES 2
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
185 #define STD_ECX_FEATURES 3
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
186 #define AMD_ECX_FEATURES 4
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
187 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
188 * Synthesized information, where known.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
189 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
190 uint32_t cpi_chiprev; /* See X86_CHIPREV_* in x86_archext.h */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
191 const char *cpi_chiprevstr; /* May be NULL if chiprev unknown */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
192 uint32_t cpi_socket; /* Chip package/socket type */
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
193
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
194 struct mwait_info cpi_mwait; /* fn 5: monitor/mwait info */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
195 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
196
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
197
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
198 static struct cpuid_info cpuid_info0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
199
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
200 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
201 * These bit fields are defined by the Intel Application Note AP-485
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
202 * "Intel Processor Identification and the CPUID Instruction"
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
203 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
204 #define CPI_FAMILY_XTD(cpi) BITX((cpi)->cpi_std[1].cp_eax, 27, 20)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
205 #define CPI_MODEL_XTD(cpi) BITX((cpi)->cpi_std[1].cp_eax, 19, 16)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
206 #define CPI_TYPE(cpi) BITX((cpi)->cpi_std[1].cp_eax, 13, 12)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
207 #define CPI_FAMILY(cpi) BITX((cpi)->cpi_std[1].cp_eax, 11, 8)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
208 #define CPI_STEP(cpi) BITX((cpi)->cpi_std[1].cp_eax, 3, 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
209 #define CPI_MODEL(cpi) BITX((cpi)->cpi_std[1].cp_eax, 7, 4)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
210
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
211 #define CPI_FEATURES_EDX(cpi) ((cpi)->cpi_std[1].cp_edx)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
212 #define CPI_FEATURES_ECX(cpi) ((cpi)->cpi_std[1].cp_ecx)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
213 #define CPI_FEATURES_XTD_EDX(cpi) ((cpi)->cpi_extd[1].cp_edx)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
214 #define CPI_FEATURES_XTD_ECX(cpi) ((cpi)->cpi_extd[1].cp_ecx)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
215
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
216 #define CPI_BRANDID(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 7, 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
217 #define CPI_CHUNKS(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 15, 7)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
218 #define CPI_CPU_COUNT(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 23, 16)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
219 #define CPI_APIC_ID(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 31, 24)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
220
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
221 #define CPI_MAXEAX_MAX 0x100 /* sanity control */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
222 #define CPI_XMAXEAX_MAX 0x80000100
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
223 #define CPI_FN4_ECX_MAX 0x20 /* sanity: max fn 4 levels */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
224
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
225 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
226 * Function 4 (Deterministic Cache Parameters) macros
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
227 * Defined by Intel Application Note AP-485
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
228 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
229 #define CPI_NUM_CORES(regs) BITX((regs)->cp_eax, 31, 26)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
230 #define CPI_NTHR_SHR_CACHE(regs) BITX((regs)->cp_eax, 25, 14)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
231 #define CPI_FULL_ASSOC_CACHE(regs) BITX((regs)->cp_eax, 9, 9)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
232 #define CPI_SELF_INIT_CACHE(regs) BITX((regs)->cp_eax, 8, 8)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
233 #define CPI_CACHE_LVL(regs) BITX((regs)->cp_eax, 7, 5)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
234 #define CPI_CACHE_TYPE(regs) BITX((regs)->cp_eax, 4, 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
235
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
236 #define CPI_CACHE_WAYS(regs) BITX((regs)->cp_ebx, 31, 22)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
237 #define CPI_CACHE_PARTS(regs) BITX((regs)->cp_ebx, 21, 12)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
238 #define CPI_CACHE_COH_LN_SZ(regs) BITX((regs)->cp_ebx, 11, 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
239
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
240 #define CPI_CACHE_SETS(regs) BITX((regs)->cp_ecx, 31, 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
241
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
242 #define CPI_PREFCH_STRIDE(regs) BITX((regs)->cp_edx, 9, 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
243
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
244
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
245 /*
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
246 * A couple of shorthand macros to identify "later" P6-family chips
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
247 * like the Pentium M and Core. First, the "older" P6-based stuff
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
248 * (loosely defined as "pre-Pentium-4"):
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
249 * P6, PII, Mobile PII, PII Xeon, PIII, Mobile PIII, PIII Xeon
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
250 */
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
251
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
252 #define IS_LEGACY_P6(cpi) ( \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
253 cpi->cpi_family == 6 && \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
254 (cpi->cpi_model == 1 || \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
255 cpi->cpi_model == 3 || \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
256 cpi->cpi_model == 5 || \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
257 cpi->cpi_model == 6 || \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
258 cpi->cpi_model == 7 || \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
259 cpi->cpi_model == 8 || \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
260 cpi->cpi_model == 0xA || \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
261 cpi->cpi_model == 0xB) \
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
262 )
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
263
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
264 /* A "new F6" is everything with family 6 that's not the above */
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
265 #define IS_NEW_F6(cpi) ((cpi->cpi_family == 6) && !IS_LEGACY_P6(cpi))
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
266
4855
3319ad80f260 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents: 4797
diff changeset
267 /* Extended family/model support */
3319ad80f260 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents: 4797
diff changeset
268 #define IS_EXTENDED_MODEL_INTEL(cpi) (cpi->cpi_family == 0x6 || \
3319ad80f260 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents: 4797
diff changeset
269 cpi->cpi_family >= 0xf)
3319ad80f260 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents: 4797
diff changeset
270
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
271 /*
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
272 * AMD family 0xf and family 0x10 socket types.
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
273 * First index :
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
274 * 0 for family 0xf, revs B thru E
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
275 * 1 for family 0xf, revs F and G
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
276 * 2 for family 0x10, rev B
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
277 * Second index by (model & 0x3)
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
278 */
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
279 static uint32_t amd_skts[3][4] = {
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
280 /*
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
281 * Family 0xf revisions B through E
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
282 */
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
283 #define A_SKTS_0 0
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
284 {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
285 X86_SOCKET_754, /* 0b00 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
286 X86_SOCKET_940, /* 0b01 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
287 X86_SOCKET_754, /* 0b10 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
288 X86_SOCKET_939 /* 0b11 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
289 },
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
290 /*
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
291 * Family 0xf revisions F and G
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
292 */
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
293 #define A_SKTS_1 1
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
294 {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
295 X86_SOCKET_S1g1, /* 0b00 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
296 X86_SOCKET_F1207, /* 0b01 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
297 X86_SOCKET_UNKNOWN, /* 0b10 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
298 X86_SOCKET_AM2 /* 0b11 */
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
299 },
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
300 /*
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
301 * Family 0x10 revisions A and B
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
302 * It is not clear whether, as new sockets release, that
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
303 * model & 0x3 will id socket for this family
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
304 */
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
305 #define A_SKTS_2 2
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
306 {
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
307 X86_SOCKET_F1207, /* 0b00 */
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
308 X86_SOCKET_F1207, /* 0b01 */
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
309 X86_SOCKET_F1207, /* 0b10 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
310 X86_SOCKET_F1207, /* 0b11 */
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
311 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
312 };
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
313
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
314 /*
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
315 * Table for mapping AMD Family 0xf and AMD Family 0x10 model/stepping
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
316 * combination to chip "revision" and socket type.
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
317 *
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
318 * The first member of this array that matches a given family, extended model
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
319 * plus model range, and stepping range will be considered a match.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
320 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
321 static const struct amd_rev_mapent {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
322 uint_t rm_family;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
323 uint_t rm_modello;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
324 uint_t rm_modelhi;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
325 uint_t rm_steplo;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
326 uint_t rm_stephi;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
327 uint32_t rm_chiprev;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
328 const char *rm_chiprevstr;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
329 int rm_sktidx;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
330 } amd_revmap[] = {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
331 /*
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
332 * =============== AuthenticAMD Family 0xf ===============
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
333 */
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
334
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
335 /*
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
336 * Rev B includes model 0x4 stepping 0 and model 0x5 stepping 0 and 1.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
337 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
338 { 0xf, 0x04, 0x04, 0x0, 0x0, X86_CHIPREV_AMD_F_REV_B, "B", A_SKTS_0 },
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
339 { 0xf, 0x05, 0x05, 0x0, 0x1, X86_CHIPREV_AMD_F_REV_B, "B", A_SKTS_0 },
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
340 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
341 * Rev C0 includes model 0x4 stepping 8 and model 0x5 stepping 8
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
342 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
343 { 0xf, 0x04, 0x05, 0x8, 0x8, X86_CHIPREV_AMD_F_REV_C0, "C0", A_SKTS_0 },
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
344 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
345 * Rev CG is the rest of extended model 0x0 - i.e., everything
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
346 * but the rev B and C0 combinations covered above.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
347 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
348 { 0xf, 0x00, 0x0f, 0x0, 0xf, X86_CHIPREV_AMD_F_REV_CG, "CG", A_SKTS_0 },
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
349 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
350 * Rev D has extended model 0x1.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
351 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
352 { 0xf, 0x10, 0x1f, 0x0, 0xf, X86_CHIPREV_AMD_F_REV_D, "D", A_SKTS_0 },
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
353 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
354 * Rev E has extended model 0x2.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
355 * Extended model 0x3 is unused but available to grow into.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
356 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
357 { 0xf, 0x20, 0x3f, 0x0, 0xf, X86_CHIPREV_AMD_F_REV_E, "E", A_SKTS_0 },
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
358 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
359 * Rev F has extended models 0x4 and 0x5.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
360 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
361 { 0xf, 0x40, 0x5f, 0x0, 0xf, X86_CHIPREV_AMD_F_REV_F, "F", A_SKTS_1 },
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
362 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
363 * Rev G has extended model 0x6.
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
364 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
365 { 0xf, 0x60, 0x6f, 0x0, 0xf, X86_CHIPREV_AMD_F_REV_G, "G", A_SKTS_1 },
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
366
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
367 /*
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
368 * =============== AuthenticAMD Family 0x10 ===============
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
369 */
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
370
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
371 /*
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
372 * Rev A has model 0 and stepping 0/1/2 for DR-{A0,A1,A2}.
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
373 * Give all of model 0 stepping range to rev A.
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
374 */
5254
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
375 { 0x10, 0x00, 0x00, 0x0, 0x2, X86_CHIPREV_AMD_10_REV_A, "A", A_SKTS_2 },
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
376
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
377 /*
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
378 * Rev B has model 2 and steppings 0/1/0xa/2 for DR-{B0,B1,BA,B2}.
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
379 * Give all of model 2 stepping range to rev B.
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
380 */
38162db71c7d PSARC 2007/591 Generic x86 Machine Check Architecture
gavinm
parents: 5248
diff changeset
381 { 0x10, 0x02, 0x02, 0x0, 0xf, X86_CHIPREV_AMD_10_REV_B, "B", A_SKTS_2 },
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
382 };
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
383
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
384 /*
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
385 * Info for monitor/mwait idle loop.
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
386 *
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
387 * See cpuid section of "Intel 64 and IA-32 Architectures Software Developer's
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
388 * Manual Volume 2A: Instruction Set Reference, A-M" #25366-022US, November
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
389 * 2006.
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
390 * See MONITOR/MWAIT section of "AMD64 Architecture Programmer's Manual
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
391 * Documentation Updates" #33633, Rev 2.05, December 2006.
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
392 */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
393 #define MWAIT_SUPPORT (0x00000001) /* mwait supported */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
394 #define MWAIT_EXTENSIONS (0x00000002) /* extenstion supported */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
395 #define MWAIT_ECX_INT_ENABLE (0x00000004) /* ecx 1 extension supported */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
396 #define MWAIT_SUPPORTED(cpi) ((cpi)->cpi_std[1].cp_ecx & CPUID_INTC_ECX_MON)
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
397 #define MWAIT_INT_ENABLE(cpi) ((cpi)->cpi_std[5].cp_ecx & 0x2)
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
398 #define MWAIT_EXTENSION(cpi) ((cpi)->cpi_std[5].cp_ecx & 0x1)
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
399 #define MWAIT_SIZE_MIN(cpi) BITX((cpi)->cpi_std[5].cp_eax, 15, 0)
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
400 #define MWAIT_SIZE_MAX(cpi) BITX((cpi)->cpi_std[5].cp_ebx, 15, 0)
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
401 /*
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
402 * Number of sub-cstates for a given c-state.
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
403 */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
404 #define MWAIT_NUM_SUBC_STATES(cpi, c_state) \
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
405 BITX((cpi)->cpi_std[5].cp_edx, c_state + 3, c_state)
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
406
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
407 static void
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
408 synth_amd_info(struct cpuid_info *cpi)
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
409 {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
410 const struct amd_rev_mapent *rmp;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
411 uint_t family, model, step;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
412 int i;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
413
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
414 /*
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
415 * Currently only AMD family 0xf and family 0x10 use these fields.
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
416 */
5248
d7358c93caa7 6567332 Support for CPC on greyhound/barcelona processors
ksadhukh
parents: 5084
diff changeset
417 if (cpi->cpi_family != 0xf && cpi->cpi_family != 0x10)
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
418 return;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
419
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
420 family = cpi->cpi_family;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
421 model = cpi->cpi_model;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
422 step = cpi->cpi_step;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
423
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
424 for (i = 0, rmp = amd_revmap; i < sizeof (amd_revmap) / sizeof (*rmp);
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
425 i++, rmp++) {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
426 if (family == rmp->rm_family &&
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
427 model >= rmp->rm_modello && model <= rmp->rm_modelhi &&
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
428 step >= rmp->rm_steplo && step <= rmp->rm_stephi) {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
429 cpi->cpi_chiprev = rmp->rm_chiprev;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
430 cpi->cpi_chiprevstr = rmp->rm_chiprevstr;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
431 cpi->cpi_socket = amd_skts[rmp->rm_sktidx][model & 0x3];
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
432 return;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
433 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
434 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
435 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
436
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
437 static void
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
438 synth_info(struct cpuid_info *cpi)
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
439 {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
440 cpi->cpi_chiprev = X86_CHIPREV_UNKNOWN;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
441 cpi->cpi_chiprevstr = "Unknown";
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
442 cpi->cpi_socket = X86_SOCKET_UNKNOWN;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
443
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
444 switch (cpi->cpi_vendor) {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
445 case X86_VENDOR_AMD:
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
446 synth_amd_info(cpi);
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
447 break;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
448
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
449 default:
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
450 break;
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
451
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
452 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
453 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
454
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
455 /*
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
456 * Apply up various platform-dependent restrictions where the
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
457 * underlying platform restrictions mean the CPU can be marked
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
458 * as less capable than its cpuid instruction would imply.
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
459 */
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
460 #if defined(__xpv)
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
461 static void
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
462 platform_cpuid_mangle(uint_t vendor, uint32_t eax, struct cpuid_regs *cp)
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
463 {
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
464 switch (eax) {
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
465 case 1:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
466 cp->cp_edx &=
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
467 ~(CPUID_INTC_EDX_PSE |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
468 CPUID_INTC_EDX_VME | CPUID_INTC_EDX_DE |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
469 CPUID_INTC_EDX_MCA | /* XXPV true on dom0? */
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
470 CPUID_INTC_EDX_SEP | CPUID_INTC_EDX_MTRR |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
471 CPUID_INTC_EDX_PGE | CPUID_INTC_EDX_PAT |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
472 CPUID_AMD_EDX_SYSC | CPUID_INTC_EDX_SEP |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
473 CPUID_INTC_EDX_PSE36 | CPUID_INTC_EDX_HTT);
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
474 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
475
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
476 case 0x80000001:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
477 cp->cp_edx &=
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
478 ~(CPUID_AMD_EDX_PSE |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
479 CPUID_INTC_EDX_VME | CPUID_INTC_EDX_DE |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
480 CPUID_AMD_EDX_MTRR | CPUID_AMD_EDX_PGE |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
481 CPUID_AMD_EDX_PAT | CPUID_AMD_EDX_PSE36 |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
482 CPUID_AMD_EDX_SYSC | CPUID_INTC_EDX_SEP |
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
483 CPUID_AMD_EDX_TSCP);
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
484 cp->cp_ecx &= ~CPUID_AMD_ECX_CMP_LGCY;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
485 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
486 default:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
487 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
488 }
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
489
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
490 switch (vendor) {
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
491 case X86_VENDOR_Intel:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
492 switch (eax) {
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
493 case 4:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
494 /*
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
495 * Zero out the (ncores-per-chip - 1) field
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
496 */
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
497 cp->cp_eax &= 0x03fffffff;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
498 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
499 default:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
500 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
501 }
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
502 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
503 case X86_VENDOR_AMD:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
504 switch (eax) {
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
505 case 0x80000008:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
506 /*
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
507 * Zero out the (ncores-per-chip - 1) field
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
508 */
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
509 cp->cp_ecx &= 0xffffff00;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
510 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
511 default:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
512 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
513 }
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
514 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
515 default:
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
516 break;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
517 }
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
518 }
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
519 #else
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
520 #define platform_cpuid_mangle(vendor, eax, cp) /* nothing */
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
521 #endif
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
522
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
523 /*
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
524 * Some undocumented ways of patching the results of the cpuid
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
525 * instruction to permit running Solaris 10 on future cpus that
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
526 * we don't currently support. Could be set to non-zero values
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
527 * via settings in eeprom.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
528 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
529
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
530 uint32_t cpuid_feature_ecx_include;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
531 uint32_t cpuid_feature_ecx_exclude;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
532 uint32_t cpuid_feature_edx_include;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
533 uint32_t cpuid_feature_edx_exclude;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
534
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
535 void
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
536 cpuid_alloc_space(cpu_t *cpu)
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
537 {
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
538 /*
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
539 * By convention, cpu0 is the boot cpu, which is set up
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
540 * before memory allocation is available. All other cpus get
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
541 * their cpuid_info struct allocated here.
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
542 */
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
543 ASSERT(cpu->cpu_id != 0);
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
544 cpu->cpu_m.mcpu_cpi =
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
545 kmem_zalloc(sizeof (*cpu->cpu_m.mcpu_cpi), KM_SLEEP);
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
546 }
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
547
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
548 void
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
549 cpuid_free_space(cpu_t *cpu)
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
550 {
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
551 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
552 int i;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
553
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
554 ASSERT(cpu->cpu_id != 0);
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
555
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
556 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
557 * Free up any function 4 related dynamic storage
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
558 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
559 for (i = 1; i < cpi->cpi_std_4_size; i++)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
560 kmem_free(cpi->cpi_std_4[i], sizeof (struct cpuid_regs));
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
561 if (cpi->cpi_std_4_size > 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
562 kmem_free(cpi->cpi_std_4,
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
563 cpi->cpi_std_4_size * sizeof (struct cpuid_regs *));
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
564
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
565 kmem_free(cpu->cpu_m.mcpu_cpi, sizeof (*cpu->cpu_m.mcpu_cpi));
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
566 }
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
567
5741
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
568 #if !defined(__xpv)
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
569
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
570 static void
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
571 check_for_hvm()
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
572 {
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
573 struct cpuid_regs cp;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
574 char *xen_str;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
575 uint32_t xen_signature[4];
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
576 extern int xpv_is_hvm;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
577
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
578 /*
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
579 * In a fully virtualized domain, Xen's pseudo-cpuid function
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
580 * 0x40000000 returns a string representing the Xen signature in
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
581 * %ebx, %ecx, and %edx. %eax contains the maximum supported cpuid
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
582 * function.
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
583 */
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
584 cp.cp_eax = 0x40000000;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
585 (void) __cpuid_insn(&cp);
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
586 xen_signature[0] = cp.cp_ebx;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
587 xen_signature[1] = cp.cp_ecx;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
588 xen_signature[2] = cp.cp_edx;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
589 xen_signature[3] = 0;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
590 xen_str = (char *)xen_signature;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
591 if (strcmp("XenVMMXenVMM", xen_str) == 0 && cp.cp_eax <= 0x40000002)
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
592 xpv_is_hvm = 1;
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
593 }
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
594 #endif /* __xpv */
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
595
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
596 uint_t
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
597 cpuid_pass1(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
598 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
599 uint32_t mask_ecx, mask_edx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
600 uint_t feature = X86_CPUID;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
601 struct cpuid_info *cpi;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
602 struct cpuid_regs *cp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
603 int xcpuid;
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
604 #if !defined(__xpv)
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
605 extern int idle_cpu_prefer_mwait;
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
606 #endif
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
607
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
608 /*
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
609 * Space statically allocated for cpu0, ensure pointer is set
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
610 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
611 if (cpu->cpu_id == 0)
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
612 cpu->cpu_m.mcpu_cpi = &cpuid_info0;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
613 cpi = cpu->cpu_m.mcpu_cpi;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
614 ASSERT(cpi != NULL);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
615 cp = &cpi->cpi_std[0];
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
616 cp->cp_eax = 0;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
617 cpi->cpi_maxeax = __cpuid_insn(cp);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
618 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
619 uint32_t *iptr = (uint32_t *)cpi->cpi_vendorstr;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
620 *iptr++ = cp->cp_ebx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
621 *iptr++ = cp->cp_edx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
622 *iptr++ = cp->cp_ecx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
623 *(char *)&cpi->cpi_vendorstr[12] = '\0';
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
624 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
625
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
626 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
627 * Map the vendor string to a type code
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
628 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
629 if (strcmp(cpi->cpi_vendorstr, "GenuineIntel") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
630 cpi->cpi_vendor = X86_VENDOR_Intel;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
631 else if (strcmp(cpi->cpi_vendorstr, "AuthenticAMD") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
632 cpi->cpi_vendor = X86_VENDOR_AMD;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
633 else if (strcmp(cpi->cpi_vendorstr, "GenuineTMx86") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
634 cpi->cpi_vendor = X86_VENDOR_TM;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
635 else if (strcmp(cpi->cpi_vendorstr, CyrixInstead) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
636 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
637 * CyrixInstead is a variable used by the Cyrix detection code
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
638 * in locore.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
639 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
640 cpi->cpi_vendor = X86_VENDOR_Cyrix;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
641 else if (strcmp(cpi->cpi_vendorstr, "UMC UMC UMC ") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
642 cpi->cpi_vendor = X86_VENDOR_UMC;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
643 else if (strcmp(cpi->cpi_vendorstr, "NexGenDriven") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
644 cpi->cpi_vendor = X86_VENDOR_NexGen;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
645 else if (strcmp(cpi->cpi_vendorstr, "CentaurHauls") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
646 cpi->cpi_vendor = X86_VENDOR_Centaur;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
647 else if (strcmp(cpi->cpi_vendorstr, "RiseRiseRise") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
648 cpi->cpi_vendor = X86_VENDOR_Rise;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
649 else if (strcmp(cpi->cpi_vendorstr, "SiS SiS SiS ") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
650 cpi->cpi_vendor = X86_VENDOR_SiS;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
651 else if (strcmp(cpi->cpi_vendorstr, "Geode by NSC") == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
652 cpi->cpi_vendor = X86_VENDOR_NSC;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
653 else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
654 cpi->cpi_vendor = X86_VENDOR_IntelClone;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
655
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
656 x86_vendor = cpi->cpi_vendor; /* for compatibility */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
657
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
658 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
659 * Limit the range in case of weird hardware
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
660 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
661 if (cpi->cpi_maxeax > CPI_MAXEAX_MAX)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
662 cpi->cpi_maxeax = CPI_MAXEAX_MAX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
663 if (cpi->cpi_maxeax < 1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
664 goto pass1_done;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
665
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
666 cp = &cpi->cpi_std[1];
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
667 cp->cp_eax = 1;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
668 (void) __cpuid_insn(cp);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
669
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
670 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
671 * Extract identifying constants for easy access.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
672 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
673 cpi->cpi_model = CPI_MODEL(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
674 cpi->cpi_family = CPI_FAMILY(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
675
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
676 if (cpi->cpi_family == 0xf)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
677 cpi->cpi_family += CPI_FAMILY_XTD(cpi);
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
678
2001
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
679 /*
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
680 * Beware: AMD uses "extended model" iff base *FAMILY* == 0xf.
2001
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
681 * Intel, and presumably everyone else, uses model == 0xf, as
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
682 * one would expect (max value means possible overflow). Sigh.
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
683 */
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
684
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
685 switch (cpi->cpi_vendor) {
4855
3319ad80f260 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents: 4797
diff changeset
686 case X86_VENDOR_Intel:
3319ad80f260 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents: 4797
diff changeset
687 if (IS_EXTENDED_MODEL_INTEL(cpi))
3319ad80f260 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents: 4797
diff changeset
688 cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4;
4858
08409e2eed12 6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors (fix lint)
ksadhukh
parents: 4855
diff changeset
689 break;
2001
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
690 case X86_VENDOR_AMD:
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
691 if (CPI_FAMILY(cpi) == 0xf)
2001
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
692 cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4;
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
693 break;
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
694 default:
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
695 if (cpi->cpi_model == 0xf)
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
696 cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4;
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
697 break;
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
698 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
699
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
700 cpi->cpi_step = CPI_STEP(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
701 cpi->cpi_brandid = CPI_BRANDID(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
702
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
703 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
704 * *default* assumptions:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
705 * - believe %edx feature word
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
706 * - ignore %ecx feature word
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
707 * - 32-bit virtual and physical addressing
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
708 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
709 mask_edx = 0xffffffff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
710 mask_ecx = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
711
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
712 cpi->cpi_pabits = cpi->cpi_vabits = 32;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
713
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
714 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
715 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
716 if (cpi->cpi_family == 5)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
717 x86_type = X86_TYPE_P5;
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
718 else if (IS_LEGACY_P6(cpi)) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
719 x86_type = X86_TYPE_P6;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
720 pentiumpro_bug4046376 = 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
721 pentiumpro_bug4064495 = 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
722 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
723 * Clear the SEP bit when it was set erroneously
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
724 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
725 if (cpi->cpi_model < 3 && cpi->cpi_step < 3)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
726 cp->cp_edx &= ~CPUID_INTC_EDX_SEP;
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
727 } else if (IS_NEW_F6(cpi) || cpi->cpi_family == 0xf) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
728 x86_type = X86_TYPE_P4;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
729 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
730 * We don't currently depend on any of the %ecx
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
731 * features until Prescott, so we'll only check
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
732 * this from P4 onwards. We might want to revisit
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
733 * that idea later.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
734 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
735 mask_ecx = 0xffffffff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
736 } else if (cpi->cpi_family > 0xf)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
737 mask_ecx = 0xffffffff;
4636
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
738 /*
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
739 * We don't support MONITOR/MWAIT if leaf 5 is not available
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
740 * to obtain the monitor linesize.
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
741 */
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
742 if (cpi->cpi_maxeax < 5)
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
743 mask_ecx &= ~CPUID_INTC_ECX_MON;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
744 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
745 case X86_VENDOR_IntelClone:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
746 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
747 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
748 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
749 #if defined(OPTERON_ERRATUM_108)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
750 if (cpi->cpi_family == 0xf && cpi->cpi_model == 0xe) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
751 cp->cp_eax = (0xf0f & cp->cp_eax) | 0xc0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
752 cpi->cpi_model = 0xc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
753 } else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
754 #endif
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
755 if (cpi->cpi_family == 5) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
756 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
757 * AMD K5 and K6
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
758 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
759 * These CPUs have an incomplete implementation
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
760 * of MCA/MCE which we mask away.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
761 */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
762 mask_edx &= ~(CPUID_INTC_EDX_MCE | CPUID_INTC_EDX_MCA);
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
763
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
764 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
765 * Model 0 uses the wrong (APIC) bit
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
766 * to indicate PGE. Fix it here.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
767 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
768 if (cpi->cpi_model == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
769 if (cp->cp_edx & 0x200) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
770 cp->cp_edx &= ~0x200;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
771 cp->cp_edx |= CPUID_INTC_EDX_PGE;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
772 }
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
773 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
774
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
775 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
776 * Early models had problems w/ MMX; disable.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
777 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
778 if (cpi->cpi_model < 6)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
779 mask_edx &= ~CPUID_INTC_EDX_MMX;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
780 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
781
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
782 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
783 * For newer families, SSE3 and CX16, at least, are valid;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
784 * enable all
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
785 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
786 if (cpi->cpi_family >= 0xf)
771
1c25a2120ec0 6327969 cpuid sse3 feature bit not noted on any AMD processor
dmick
parents: 359
diff changeset
787 mask_ecx = 0xffffffff;
4636
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
788 /*
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
789 * We don't support MONITOR/MWAIT if leaf 5 is not available
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
790 * to obtain the monitor linesize.
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
791 */
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
792 if (cpi->cpi_maxeax < 5)
f7779128d972 6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents: 4628
diff changeset
793 mask_ecx &= ~CPUID_INTC_ECX_MON;
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
794
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
795 #if !defined(__xpv)
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
796 /*
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
797 * Do not use MONITOR/MWAIT to halt in the idle loop on any AMD
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
798 * processors. AMD does not intend MWAIT to be used in the cpu
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
799 * idle loop on current and future processors. 10h and future
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
800 * AMD processors use more power in MWAIT than HLT.
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
801 * Pre-family-10h Opterons do not have the MWAIT instruction.
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
802 */
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
803 idle_cpu_prefer_mwait = 0;
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
804 #endif
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
805
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
806 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
807 case X86_VENDOR_TM:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
808 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
809 * workaround the NT workaround in CMS 4.1
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
810 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
811 if (cpi->cpi_family == 5 && cpi->cpi_model == 4 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
812 (cpi->cpi_step == 2 || cpi->cpi_step == 3))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
813 cp->cp_edx |= CPUID_INTC_EDX_CX8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
814 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
815 case X86_VENDOR_Centaur:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
816 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
817 * workaround the NT workarounds again
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
818 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
819 if (cpi->cpi_family == 6)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
820 cp->cp_edx |= CPUID_INTC_EDX_CX8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
821 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
822 case X86_VENDOR_Cyrix:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
823 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
824 * We rely heavily on the probing in locore
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
825 * to actually figure out what parts, if any,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
826 * of the Cyrix cpuid instruction to believe.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
827 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
828 switch (x86_type) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
829 case X86_TYPE_CYRIX_486:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
830 mask_edx = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
831 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
832 case X86_TYPE_CYRIX_6x86:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
833 mask_edx = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
834 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
835 case X86_TYPE_CYRIX_6x86L:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
836 mask_edx =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
837 CPUID_INTC_EDX_DE |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
838 CPUID_INTC_EDX_CX8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
839 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
840 case X86_TYPE_CYRIX_6x86MX:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
841 mask_edx =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
842 CPUID_INTC_EDX_DE |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
843 CPUID_INTC_EDX_MSR |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
844 CPUID_INTC_EDX_CX8 |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
845 CPUID_INTC_EDX_PGE |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
846 CPUID_INTC_EDX_CMOV |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
847 CPUID_INTC_EDX_MMX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
848 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
849 case X86_TYPE_CYRIX_GXm:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
850 mask_edx =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
851 CPUID_INTC_EDX_MSR |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
852 CPUID_INTC_EDX_CX8 |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
853 CPUID_INTC_EDX_CMOV |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
854 CPUID_INTC_EDX_MMX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
855 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
856 case X86_TYPE_CYRIX_MediaGX:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
857 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
858 case X86_TYPE_CYRIX_MII:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
859 case X86_TYPE_VIA_CYRIX_III:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
860 mask_edx =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
861 CPUID_INTC_EDX_DE |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
862 CPUID_INTC_EDX_TSC |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
863 CPUID_INTC_EDX_MSR |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
864 CPUID_INTC_EDX_CX8 |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
865 CPUID_INTC_EDX_PGE |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
866 CPUID_INTC_EDX_CMOV |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
867 CPUID_INTC_EDX_MMX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
868 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
869 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
870 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
871 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
872 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
873 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
874
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
875 #if defined(__xpv)
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
876 /*
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
877 * Do not support MONITOR/MWAIT under a hypervisor
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
878 */
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
879 mask_ecx &= ~CPUID_INTC_ECX_MON;
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
880 #endif /* __xpv */
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
881
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
882 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
883 * Now we've figured out the masks that determine
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
884 * which bits we choose to believe, apply the masks
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
885 * to the feature words, then map the kernel's view
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
886 * of these feature words into its feature word.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
887 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
888 cp->cp_edx &= mask_edx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
889 cp->cp_ecx &= mask_ecx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
890
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
891 /*
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
892 * apply any platform restrictions (we don't call this
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
893 * immediately after __cpuid_insn here, because we need the
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
894 * workarounds applied above first)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
895 */
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
896 platform_cpuid_mangle(cpi->cpi_vendor, 1, cp);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
897
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
898 /*
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
899 * fold in overrides from the "eeprom" mechanism
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
900 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
901 cp->cp_edx |= cpuid_feature_edx_include;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
902 cp->cp_edx &= ~cpuid_feature_edx_exclude;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
903
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
904 cp->cp_ecx |= cpuid_feature_ecx_include;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
905 cp->cp_ecx &= ~cpuid_feature_ecx_exclude;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
906
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
907 if (cp->cp_edx & CPUID_INTC_EDX_PSE)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
908 feature |= X86_LARGEPAGE;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
909 if (cp->cp_edx & CPUID_INTC_EDX_TSC)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
910 feature |= X86_TSC;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
911 if (cp->cp_edx & CPUID_INTC_EDX_MSR)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
912 feature |= X86_MSR;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
913 if (cp->cp_edx & CPUID_INTC_EDX_MTRR)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
914 feature |= X86_MTRR;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
915 if (cp->cp_edx & CPUID_INTC_EDX_PGE)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
916 feature |= X86_PGE;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
917 if (cp->cp_edx & CPUID_INTC_EDX_CMOV)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
918 feature |= X86_CMOV;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
919 if (cp->cp_edx & CPUID_INTC_EDX_MMX)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
920 feature |= X86_MMX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
921 if ((cp->cp_edx & CPUID_INTC_EDX_MCE) != 0 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
922 (cp->cp_edx & CPUID_INTC_EDX_MCA) != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
923 feature |= X86_MCA;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
924 if (cp->cp_edx & CPUID_INTC_EDX_PAE)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
925 feature |= X86_PAE;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
926 if (cp->cp_edx & CPUID_INTC_EDX_CX8)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
927 feature |= X86_CX8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
928 if (cp->cp_ecx & CPUID_INTC_ECX_CX16)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
929 feature |= X86_CX16;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
930 if (cp->cp_edx & CPUID_INTC_EDX_PAT)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
931 feature |= X86_PAT;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
932 if (cp->cp_edx & CPUID_INTC_EDX_SEP)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
933 feature |= X86_SEP;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
934 if (cp->cp_edx & CPUID_INTC_EDX_FXSR) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
935 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
936 * In our implementation, fxsave/fxrstor
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
937 * are prerequisites before we'll even
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
938 * try and do SSE things.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
939 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
940 if (cp->cp_edx & CPUID_INTC_EDX_SSE)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
941 feature |= X86_SSE;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
942 if (cp->cp_edx & CPUID_INTC_EDX_SSE2)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
943 feature |= X86_SSE2;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
944 if (cp->cp_ecx & CPUID_INTC_ECX_SSE3)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
945 feature |= X86_SSE3;
5269
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
946 if (cpi->cpi_vendor == X86_VENDOR_Intel) {
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
947 if (cp->cp_ecx & CPUID_INTC_ECX_SSSE3)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
948 feature |= X86_SSSE3;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
949 if (cp->cp_ecx & CPUID_INTC_ECX_SSE4_1)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
950 feature |= X86_SSE4_1;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
951 if (cp->cp_ecx & CPUID_INTC_ECX_SSE4_2)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
952 feature |= X86_SSE4_2;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
953 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
954 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
955 if (cp->cp_edx & CPUID_INTC_EDX_DE)
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
956 feature |= X86_DE;
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
957 if (cp->cp_ecx & CPUID_INTC_ECX_MON) {
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
958 cpi->cpi_mwait.support |= MWAIT_SUPPORT;
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
959 feature |= X86_MWAIT;
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
960 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
961
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
962 if (feature & X86_PAE)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
963 cpi->cpi_pabits = 36;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
964
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
965 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
966 * Hyperthreading configuration is slightly tricky on Intel
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
967 * and pure clones, and even trickier on AMD.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
968 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
969 * (AMD chose to set the HTT bit on their CMP processors,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
970 * even though they're not actually hyperthreaded. Thus it
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
971 * takes a bit more work to figure out what's really going
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
972 * on ... see the handling of the CMP_LGCY bit below)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
973 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
974 if (cp->cp_edx & CPUID_INTC_EDX_HTT) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
975 cpi->cpi_ncpu_per_chip = CPI_CPU_COUNT(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
976 if (cpi->cpi_ncpu_per_chip > 1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
977 feature |= X86_HTT;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
978 } else {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
979 cpi->cpi_ncpu_per_chip = 1;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
980 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
981
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
982 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
983 * Work on the "extended" feature information, doing
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
984 * some basic initialization for cpuid_pass2()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
985 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
986 xcpuid = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
987 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
988 case X86_VENDOR_Intel:
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
989 if (IS_NEW_F6(cpi) || cpi->cpi_family >= 0xf)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
990 xcpuid++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
991 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
992 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
993 if (cpi->cpi_family > 5 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
994 (cpi->cpi_family == 5 && cpi->cpi_model >= 1))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
995 xcpuid++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
996 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
997 case X86_VENDOR_Cyrix:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
998 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
999 * Only these Cyrix CPUs are -known- to support
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1000 * extended cpuid operations.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1001 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1002 if (x86_type == X86_TYPE_VIA_CYRIX_III ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1003 x86_type == X86_TYPE_CYRIX_GXm)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1004 xcpuid++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1005 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1006 case X86_VENDOR_Centaur:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1007 case X86_VENDOR_TM:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1008 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1009 xcpuid++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1010 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1011 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1012
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1013 if (xcpuid) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1014 cp = &cpi->cpi_extd[0];
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1015 cp->cp_eax = 0x80000000;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1016 cpi->cpi_xmaxeax = __cpuid_insn(cp);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1017 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1018
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1019 if (cpi->cpi_xmaxeax & 0x80000000) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1020
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1021 if (cpi->cpi_xmaxeax > CPI_XMAXEAX_MAX)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1022 cpi->cpi_xmaxeax = CPI_XMAXEAX_MAX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1023
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1024 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1025 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1026 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1027 if (cpi->cpi_xmaxeax < 0x80000001)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1028 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1029 cp = &cpi->cpi_extd[1];
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1030 cp->cp_eax = 0x80000001;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1031 (void) __cpuid_insn(cp);
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1032
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1033 if (cpi->cpi_vendor == X86_VENDOR_AMD &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1034 cpi->cpi_family == 5 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1035 cpi->cpi_model == 6 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1036 cpi->cpi_step == 6) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1037 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1038 * K6 model 6 uses bit 10 to indicate SYSC
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1039 * Later models use bit 11. Fix it here.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1040 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1041 if (cp->cp_edx & 0x400) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1042 cp->cp_edx &= ~0x400;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1043 cp->cp_edx |= CPUID_AMD_EDX_SYSC;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1044 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1045 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1046
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1047 platform_cpuid_mangle(cpi->cpi_vendor, 0x80000001, cp);
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1048
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1049 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1050 * Compute the additions to the kernel's feature word.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1051 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1052 if (cp->cp_edx & CPUID_AMD_EDX_NX)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1053 feature |= X86_NX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1054
5349
01422ec04372 6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents: 5338
diff changeset
1055 #if defined(__amd64)
01422ec04372 6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents: 5338
diff changeset
1056 /* 1 GB large page - enable only for 64 bit kernel */
01422ec04372 6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents: 5338
diff changeset
1057 if (cp->cp_edx & CPUID_AMD_EDX_1GPG)
01422ec04372 6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents: 5338
diff changeset
1058 feature |= X86_1GPG;
01422ec04372 6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents: 5338
diff changeset
1059 #endif
01422ec04372 6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents: 5338
diff changeset
1060
4628
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
1061 if ((cpi->cpi_vendor == X86_VENDOR_AMD) &&
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
1062 (cpi->cpi_std[1].cp_edx & CPUID_INTC_EDX_FXSR) &&
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
1063 (cp->cp_ecx & CPUID_AMD_ECX_SSE4A))
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
1064 feature |= X86_SSE4A;
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
1065
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1066 /*
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1067 * If both the HTT and CMP_LGCY bits are set,
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1068 * then we're not actually HyperThreaded. Read
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1069 * "AMD CPUID Specification" for more details.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1070 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1071 if (cpi->cpi_vendor == X86_VENDOR_AMD &&
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1072 (feature & X86_HTT) &&
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1073 (cp->cp_ecx & CPUID_AMD_ECX_CMP_LGCY)) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1074 feature &= ~X86_HTT;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1075 feature |= X86_CMP;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1076 }
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1077 #if defined(__amd64)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1078 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1079 * It's really tricky to support syscall/sysret in
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1080 * the i386 kernel; we rely on sysenter/sysexit
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1081 * instead. In the amd64 kernel, things are -way-
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1082 * better.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1083 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1084 if (cp->cp_edx & CPUID_AMD_EDX_SYSC)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1085 feature |= X86_ASYSC;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1086
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1087 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1088 * While we're thinking about system calls, note
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1089 * that AMD processors don't support sysenter
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1090 * in long mode at all, so don't try to program them.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1091 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1092 if (x86_vendor == X86_VENDOR_AMD)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1093 feature &= ~X86_SEP;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1094 #endif
6657
a55676c65ac7 6628773 Need to support rdtscp for Intel
sudheer
parents: 6642
diff changeset
1095 if (cp->cp_edx & CPUID_AMD_EDX_TSCP)
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1096 feature |= X86_TSCP;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1097 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1098 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1099 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1100 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1101
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1102 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1103 * Get CPUID data about processor cores and hyperthreads.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1104 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1105 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1106 case X86_VENDOR_Intel:
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1107 if (cpi->cpi_maxeax >= 4) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1108 cp = &cpi->cpi_std[4];
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1109 cp->cp_eax = 4;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1110 cp->cp_ecx = 0;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1111 (void) __cpuid_insn(cp);
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1112 platform_cpuid_mangle(cpi->cpi_vendor, 4, cp);
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1113 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1114 /*FALLTHROUGH*/
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1115 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1116 if (cpi->cpi_xmaxeax < 0x80000008)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1117 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1118 cp = &cpi->cpi_extd[8];
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1119 cp->cp_eax = 0x80000008;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1120 (void) __cpuid_insn(cp);
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1121 platform_cpuid_mangle(cpi->cpi_vendor, 0x80000008, cp);
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1122
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1123 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1124 * Virtual and physical address limits from
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1125 * cpuid override previously guessed values.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1126 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1127 cpi->cpi_pabits = BITX(cp->cp_eax, 7, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1128 cpi->cpi_vabits = BITX(cp->cp_eax, 15, 8);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1129 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1130 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1131 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1132 }
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1133
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1134 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1135 * Derive the number of cores per chip
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1136 */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1137 switch (cpi->cpi_vendor) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1138 case X86_VENDOR_Intel:
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1139 if (cpi->cpi_maxeax < 4) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1140 cpi->cpi_ncore_per_chip = 1;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1141 break;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1142 } else {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1143 cpi->cpi_ncore_per_chip =
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1144 BITX((cpi)->cpi_std[4].cp_eax, 31, 26) + 1;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1145 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1146 break;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1147 case X86_VENDOR_AMD:
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1148 if (cpi->cpi_xmaxeax < 0x80000008) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1149 cpi->cpi_ncore_per_chip = 1;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1150 break;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1151 } else {
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1152 /*
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1153 * On family 0xf cpuid fn 2 ECX[7:0] "NC" is
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1154 * 1 less than the number of physical cores on
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1155 * the chip. In family 0x10 this value can
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1156 * be affected by "downcoring" - it reflects
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1157 * 1 less than the number of cores actually
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1158 * enabled on this node.
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1159 */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1160 cpi->cpi_ncore_per_chip =
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1161 BITX((cpi)->cpi_extd[8].cp_ecx, 7, 0) + 1;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1162 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1163 break;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1164 default:
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1165 cpi->cpi_ncore_per_chip = 1;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1166 break;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1167 }
5284
2f7098179999 6617465 Pentium IIIs die with divide error trap
gavinm
parents: 5269
diff changeset
1168 } else {
2f7098179999 6617465 Pentium IIIs die with divide error trap
gavinm
parents: 5269
diff changeset
1169 cpi->cpi_ncore_per_chip = 1;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1170 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1171
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1172 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1173 * If more than one core, then this processor is CMP.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1174 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1175 if (cpi->cpi_ncore_per_chip > 1)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1176 feature |= X86_CMP;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1177
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1178 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1179 * If the number of cores is the same as the number
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1180 * of CPUs, then we cannot have HyperThreading.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1181 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1182 if (cpi->cpi_ncpu_per_chip == cpi->cpi_ncore_per_chip)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1183 feature &= ~X86_HTT;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1184
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1185 if ((feature & (X86_HTT | X86_CMP)) == 0) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1186 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1187 * Single-core single-threaded processors.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1188 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1189 cpi->cpi_chipid = -1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1190 cpi->cpi_clogid = 0;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1191 cpi->cpi_coreid = cpu->cpu_id;
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1192 cpi->cpi_pkgcoreid = 0;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1193 } else if (cpi->cpi_ncpu_per_chip > 1) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1194 uint_t i;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1195 uint_t chipid_shift = 0;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1196 uint_t coreid_shift = 0;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1197 uint_t apic_id = CPI_APIC_ID(cpi);
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1198
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1199 for (i = 1; i < cpi->cpi_ncpu_per_chip; i <<= 1)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1200 chipid_shift++;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1201 cpi->cpi_chipid = apic_id >> chipid_shift;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1202 cpi->cpi_clogid = apic_id & ((1 << chipid_shift) - 1);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1203
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1204 if (cpi->cpi_vendor == X86_VENDOR_Intel) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1205 if (feature & X86_CMP) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1206 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1207 * Multi-core (and possibly multi-threaded)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1208 * processors.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1209 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1210 uint_t ncpu_per_core;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1211 if (cpi->cpi_ncore_per_chip == 1)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1212 ncpu_per_core = cpi->cpi_ncpu_per_chip;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1213 else if (cpi->cpi_ncore_per_chip > 1)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1214 ncpu_per_core = cpi->cpi_ncpu_per_chip /
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1215 cpi->cpi_ncore_per_chip;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1216 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1217 * 8bit APIC IDs on dual core Pentiums
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1218 * look like this:
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1219 *
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1220 * +-----------------------+------+------+
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1221 * | Physical Package ID | MC | HT |
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1222 * +-----------------------+------+------+
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1223 * <------- chipid -------->
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1224 * <------- coreid --------------->
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1225 * <--- clogid -->
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1226 * <------>
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1227 * pkgcoreid
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1228 *
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1229 * Where the number of bits necessary to
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1230 * represent MC and HT fields together equals
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1231 * to the minimum number of bits necessary to
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1232 * store the value of cpi->cpi_ncpu_per_chip.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1233 * Of those bits, the MC part uses the number
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1234 * of bits necessary to store the value of
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1235 * cpi->cpi_ncore_per_chip.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1236 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1237 for (i = 1; i < ncpu_per_core; i <<= 1)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1238 coreid_shift++;
1727
592b097f02d0 6406224 CPU core detection is broken on multi-core Pentium D
andrei
parents: 1582
diff changeset
1239 cpi->cpi_coreid = apic_id >> coreid_shift;
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1240 cpi->cpi_pkgcoreid = cpi->cpi_clogid >>
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1241 coreid_shift;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1242 } else if (feature & X86_HTT) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1243 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1244 * Single-core multi-threaded processors.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1245 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1246 cpi->cpi_coreid = cpi->cpi_chipid;
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1247 cpi->cpi_pkgcoreid = 0;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1248 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1249 } else if (cpi->cpi_vendor == X86_VENDOR_AMD) {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1250 /*
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1251 * AMD CMP chips currently have a single thread per
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1252 * core, with 2 cores on family 0xf and 2, 3 or 4
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1253 * cores on family 0x10.
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1254 *
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1255 * Since no two cpus share a core we must assign a
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1256 * distinct coreid per cpu, and we do this by using
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1257 * the cpu_id. This scheme does not, however,
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1258 * guarantee that sibling cores of a chip will have
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1259 * sequential coreids starting at a multiple of the
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1260 * number of cores per chip - that is usually the
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1261 * case, but if the ACPI MADT table is presented
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1262 * in a different order then we need to perform a
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1263 * few more gymnastics for the pkgcoreid.
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1264 *
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1265 * In family 0xf CMPs there are 2 cores on all nodes
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1266 * present - no mixing of single and dual core parts.
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1267 *
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1268 * In family 0x10 CMPs cpuid fn 2 ECX[15:12]
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1269 * "ApicIdCoreIdSize[3:0]" tells us how
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1270 * many least-significant bits in the ApicId
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1271 * are used to represent the core number
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1272 * within the node. Cores are always
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1273 * numbered sequentially from 0 regardless
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1274 * of how many or which are disabled, and
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1275 * there seems to be no way to discover the
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1276 * real core id when some are disabled.
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1277 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1278 cpi->cpi_coreid = cpu->cpu_id;
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1279
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1280 if (cpi->cpi_family == 0x10 &&
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1281 cpi->cpi_xmaxeax >= 0x80000008) {
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1282 int coreidsz =
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1283 BITX((cpi)->cpi_extd[8].cp_ecx, 15, 12);
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1284
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1285 cpi->cpi_pkgcoreid =
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1286 apic_id & ((1 << coreidsz) - 1);
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1287 } else {
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1288 cpi->cpi_pkgcoreid = cpi->cpi_clogid;
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1289 }
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1290 } else {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1291 /*
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1292 * All other processors are currently
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1293 * assumed to have single cores.
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1294 */
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1295 cpi->cpi_coreid = cpi->cpi_chipid;
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
1296 cpi->cpi_pkgcoreid = 0;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1297 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1298 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1299
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
1300 /*
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
1301 * Synthesize chip "revision" and socket type
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
1302 */
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
1303 synth_info(cpi);
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
1304
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1305 pass1_done:
5741
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
1306 #if !defined(__xpv)
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
1307 check_for_hvm();
58423876d513 PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents: 5438
diff changeset
1308 #endif
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1309 cpi->cpi_pass = 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1310 return (feature);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1311 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1312
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1313 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1314 * Make copies of the cpuid table entries we depend on, in
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1315 * part for ease of parsing now, in part so that we have only
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1316 * one place to correct any of it, in part for ease of
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1317 * later export to userland, and in part so we can look at
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1318 * this stuff in a crash dump.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1319 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1320
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1321 /*ARGSUSED*/
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1322 void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1323 cpuid_pass2(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1324 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1325 uint_t n, nmax;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1326 int i;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1327 struct cpuid_regs *cp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1328 uint8_t *dp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1329 uint32_t *iptr;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1330 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1331
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1332 ASSERT(cpi->cpi_pass == 1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1333
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1334 if (cpi->cpi_maxeax < 1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1335 goto pass2_done;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1336
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1337 if ((nmax = cpi->cpi_maxeax + 1) > NMAX_CPI_STD)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1338 nmax = NMAX_CPI_STD;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1339 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1340 * (We already handled n == 0 and n == 1 in pass 1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1341 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1342 for (n = 2, cp = &cpi->cpi_std[2]; n < nmax; n++, cp++) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1343 cp->cp_eax = n;
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1344
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1345 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1346 * CPUID function 4 expects %ecx to be initialized
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1347 * with an index which indicates which cache to return
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1348 * information about. The OS is expected to call function 4
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1349 * with %ecx set to 0, 1, 2, ... until it returns with
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1350 * EAX[4:0] set to 0, which indicates there are no more
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1351 * caches.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1352 *
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1353 * Here, populate cpi_std[4] with the information returned by
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1354 * function 4 when %ecx == 0, and do the rest in cpuid_pass3()
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1355 * when dynamic memory allocation becomes available.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1356 *
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1357 * Note: we need to explicitly initialize %ecx here, since
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1358 * function 4 may have been previously invoked.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1359 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1360 if (n == 4)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1361 cp->cp_ecx = 0;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1362
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1363 (void) __cpuid_insn(cp);
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1364 platform_cpuid_mangle(cpi->cpi_vendor, n, cp);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1365 switch (n) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1366 case 2:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1367 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1368 * "the lower 8 bits of the %eax register
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1369 * contain a value that identifies the number
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1370 * of times the cpuid [instruction] has to be
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1371 * executed to obtain a complete image of the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1372 * processor's caching systems."
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1373 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1374 * How *do* they make this stuff up?
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1375 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1376 cpi->cpi_ncache = sizeof (*cp) *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1377 BITX(cp->cp_eax, 7, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1378 if (cpi->cpi_ncache == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1379 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1380 cpi->cpi_ncache--; /* skip count byte */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1381
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1382 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1383 * Well, for now, rather than attempt to implement
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1384 * this slightly dubious algorithm, we just look
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1385 * at the first 15 ..
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1386 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1387 if (cpi->cpi_ncache > (sizeof (*cp) - 1))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1388 cpi->cpi_ncache = sizeof (*cp) - 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1389
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1390 dp = cpi->cpi_cacheinfo;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1391 if (BITX(cp->cp_eax, 31, 31) == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1392 uint8_t *p = (void *)&cp->cp_eax;
6317
8afb524fc268 6667600 Incomplete initialization of cpi_cacheinfo field of struct cpuid_info
kk208521
parents: 5870
diff changeset
1393 for (i = 1; i < 4; i++)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1394 if (p[i] != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1395 *dp++ = p[i];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1396 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1397 if (BITX(cp->cp_ebx, 31, 31) == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1398 uint8_t *p = (void *)&cp->cp_ebx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1399 for (i = 0; i < 4; i++)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1400 if (p[i] != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1401 *dp++ = p[i];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1402 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1403 if (BITX(cp->cp_ecx, 31, 31) == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1404 uint8_t *p = (void *)&cp->cp_ecx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1405 for (i = 0; i < 4; i++)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1406 if (p[i] != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1407 *dp++ = p[i];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1408 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1409 if (BITX(cp->cp_edx, 31, 31) == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1410 uint8_t *p = (void *)&cp->cp_edx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1411 for (i = 0; i < 4; i++)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1412 if (p[i] != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1413 *dp++ = p[i];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1414 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1415 break;
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1416
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1417 case 3: /* Processor serial number, if PSN supported */
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1418 break;
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1419
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1420 case 4: /* Deterministic cache parameters */
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1421 break;
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1422
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1423 case 5: /* Monitor/Mwait parameters */
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1424 {
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1425 size_t mwait_size;
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1426
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1427 /*
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1428 * check cpi_mwait.support which was set in cpuid_pass1
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1429 */
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1430 if (!(cpi->cpi_mwait.support & MWAIT_SUPPORT))
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1431 break;
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1432
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1433 /*
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1434 * Protect ourself from insane mwait line size.
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1435 * Workaround for incomplete hardware emulator(s).
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1436 */
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1437 mwait_size = (size_t)MWAIT_SIZE_MAX(cpi);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1438 if (mwait_size < sizeof (uint32_t) ||
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1439 !ISP2(mwait_size)) {
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1440 #if DEBUG
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1441 cmn_err(CE_NOTE, "Cannot handle cpu %d mwait "
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1442 "size %ld",
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1443 cpu->cpu_id, (long)mwait_size);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1444 #endif
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1445 break;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1446 }
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1447
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1448 cpi->cpi_mwait.mon_min = (size_t)MWAIT_SIZE_MIN(cpi);
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1449 cpi->cpi_mwait.mon_max = mwait_size;
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1450 if (MWAIT_EXTENSION(cpi)) {
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1451 cpi->cpi_mwait.support |= MWAIT_EXTENSIONS;
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1452 if (MWAIT_INT_ENABLE(cpi))
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1453 cpi->cpi_mwait.support |=
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1454 MWAIT_ECX_INT_ENABLE;
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1455 }
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
1456 break;
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
1457 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1458 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1459 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1460 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1461 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1462
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1463 if ((cpi->cpi_xmaxeax & 0x80000000) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1464 goto pass2_done;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1465
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1466 if ((nmax = cpi->cpi_xmaxeax - 0x80000000 + 1) > NMAX_CPI_EXTD)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1467 nmax = NMAX_CPI_EXTD;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1468 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1469 * Copy the extended properties, fixing them as we go.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1470 * (We already handled n == 0 and n == 1 in pass 1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1471 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1472 iptr = (void *)cpi->cpi_brandstr;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1473 for (n = 2, cp = &cpi->cpi_extd[2]; n < nmax; cp++, n++) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1474 cp->cp_eax = 0x80000000 + n;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1475 (void) __cpuid_insn(cp);
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
1476 platform_cpuid_mangle(cpi->cpi_vendor, 0x80000000 + n, cp);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1477 switch (n) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1478 case 2:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1479 case 3:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1480 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1481 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1482 * Extract the brand string
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1483 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1484 *iptr++ = cp->cp_eax;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1485 *iptr++ = cp->cp_ebx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1486 *iptr++ = cp->cp_ecx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1487 *iptr++ = cp->cp_edx;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1488 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1489 case 5:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1490 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1491 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1492 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1493 * The Athlon and Duron were the first
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1494 * parts to report the sizes of the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1495 * TLB for large pages. Before then,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1496 * we don't trust the data.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1497 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1498 if (cpi->cpi_family < 6 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1499 (cpi->cpi_family == 6 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1500 cpi->cpi_model < 1))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1501 cp->cp_eax = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1502 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1503 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1504 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1505 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1506 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1507 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1508 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1509 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1510 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1511 * The Athlon and Duron were the first
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1512 * AMD parts with L2 TLB's.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1513 * Before then, don't trust the data.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1514 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1515 if (cpi->cpi_family < 6 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1516 cpi->cpi_family == 6 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1517 cpi->cpi_model < 1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1518 cp->cp_eax = cp->cp_ebx = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1519 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1520 * AMD Duron rev A0 reports L2
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1521 * cache size incorrectly as 1K
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1522 * when it is really 64K
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1523 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1524 if (cpi->cpi_family == 6 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1525 cpi->cpi_model == 3 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1526 cpi->cpi_step == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1527 cp->cp_ecx &= 0xffff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1528 cp->cp_ecx |= 0x400000;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1529 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1530 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1531 case X86_VENDOR_Cyrix: /* VIA C3 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1532 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1533 * VIA C3 processors are a bit messed
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1534 * up w.r.t. encoding cache sizes in %ecx
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1535 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1536 if (cpi->cpi_family != 6)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1537 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1538 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1539 * model 7 and 8 were incorrectly encoded
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1540 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1541 * xxx is model 8 really broken?
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1542 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1543 if (cpi->cpi_model == 7 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1544 cpi->cpi_model == 8)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1545 cp->cp_ecx =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1546 BITX(cp->cp_ecx, 31, 24) << 16 |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1547 BITX(cp->cp_ecx, 23, 16) << 12 |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1548 BITX(cp->cp_ecx, 15, 8) << 8 |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1549 BITX(cp->cp_ecx, 7, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1550 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1551 * model 9 stepping 1 has wrong associativity
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1552 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1553 if (cpi->cpi_model == 9 && cpi->cpi_step == 1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1554 cp->cp_ecx |= 8 << 12;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1555 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1556 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1557 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1558 * Extended L2 Cache features function.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1559 * First appeared on Prescott.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1560 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1561 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1562 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1563 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1564 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1565 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1566 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1567 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1568 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1569
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1570 pass2_done:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1571 cpi->cpi_pass = 2;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1572 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1573
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1574 static const char *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1575 intel_cpubrand(const struct cpuid_info *cpi)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1576 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1577 int i;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1578
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1579 if ((x86_feature & X86_CPUID) == 0 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1580 cpi->cpi_maxeax < 1 || cpi->cpi_family < 5)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1581 return ("i486");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1582
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1583 switch (cpi->cpi_family) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1584 case 5:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1585 return ("Intel Pentium(r)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1586 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1587 switch (cpi->cpi_model) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1588 uint_t celeron, xeon;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
1589 const struct cpuid_regs *cp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1590 case 0:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1591 case 1:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1592 case 2:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1593 return ("Intel Pentium(r) Pro");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1594 case 3:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1595 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1596 return ("Intel Pentium(r) II");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1597 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1598 return ("Intel Celeron(r)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1599 case 5:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1600 case 7:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1601 celeron = xeon = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1602 cp = &cpi->cpi_std[2]; /* cache info */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1603
6317
8afb524fc268 6667600 Incomplete initialization of cpi_cacheinfo field of struct cpuid_info
kk208521
parents: 5870
diff changeset
1604 for (i = 1; i < 4; i++) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1605 uint_t tmp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1606
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1607 tmp = (cp->cp_eax >> (8 * i)) & 0xff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1608 if (tmp == 0x40)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1609 celeron++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1610 if (tmp >= 0x44 && tmp <= 0x45)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1611 xeon++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1612 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1613
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1614 for (i = 0; i < 2; i++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1615 uint_t tmp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1616
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1617 tmp = (cp->cp_ebx >> (8 * i)) & 0xff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1618 if (tmp == 0x40)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1619 celeron++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1620 else if (tmp >= 0x44 && tmp <= 0x45)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1621 xeon++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1622 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1623
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1624 for (i = 0; i < 4; i++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1625 uint_t tmp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1626
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1627 tmp = (cp->cp_ecx >> (8 * i)) & 0xff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1628 if (tmp == 0x40)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1629 celeron++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1630 else if (tmp >= 0x44 && tmp <= 0x45)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1631 xeon++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1632 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1633
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1634 for (i = 0; i < 4; i++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1635 uint_t tmp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1636
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1637 tmp = (cp->cp_edx >> (8 * i)) & 0xff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1638 if (tmp == 0x40)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1639 celeron++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1640 else if (tmp >= 0x44 && tmp <= 0x45)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1641 xeon++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1642 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1643
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1644 if (celeron)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1645 return ("Intel Celeron(r)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1646 if (xeon)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1647 return (cpi->cpi_model == 5 ?
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1648 "Intel Pentium(r) II Xeon(tm)" :
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1649 "Intel Pentium(r) III Xeon(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1650 return (cpi->cpi_model == 5 ?
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1651 "Intel Pentium(r) II or Pentium(r) II Xeon(tm)" :
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1652 "Intel Pentium(r) III or Pentium(r) III Xeon(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1653 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1654 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1655 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1656 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1657 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1658 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1659
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1660 /* BrandID is present if the field is nonzero */
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1661 if (cpi->cpi_brandid != 0) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1662 static const struct {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1663 uint_t bt_bid;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1664 const char *bt_str;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1665 } brand_tbl[] = {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1666 { 0x1, "Intel(r) Celeron(r)" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1667 { 0x2, "Intel(r) Pentium(r) III" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1668 { 0x3, "Intel(r) Pentium(r) III Xeon(tm)" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1669 { 0x4, "Intel(r) Pentium(r) III" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1670 { 0x6, "Mobile Intel(r) Pentium(r) III" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1671 { 0x7, "Mobile Intel(r) Celeron(r)" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1672 { 0x8, "Intel(r) Pentium(r) 4" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1673 { 0x9, "Intel(r) Pentium(r) 4" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1674 { 0xa, "Intel(r) Celeron(r)" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1675 { 0xb, "Intel(r) Xeon(tm)" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1676 { 0xc, "Intel(r) Xeon(tm) MP" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1677 { 0xe, "Mobile Intel(r) Pentium(r) 4" },
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1678 { 0xf, "Mobile Intel(r) Celeron(r)" },
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1679 { 0x11, "Mobile Genuine Intel(r)" },
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1680 { 0x12, "Intel(r) Celeron(r) M" },
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1681 { 0x13, "Mobile Intel(r) Celeron(r)" },
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1682 { 0x14, "Intel(r) Celeron(r)" },
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1683 { 0x15, "Mobile Genuine Intel(r)" },
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1684 { 0x16, "Intel(r) Pentium(r) M" },
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
1685 { 0x17, "Mobile Intel(r) Celeron(r)" }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1686 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1687 uint_t btblmax = sizeof (brand_tbl) / sizeof (brand_tbl[0]);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1688 uint_t sgn;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1689
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1690 sgn = (cpi->cpi_family << 8) |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1691 (cpi->cpi_model << 4) | cpi->cpi_step;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1692
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1693 for (i = 0; i < btblmax; i++)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1694 if (brand_tbl[i].bt_bid == cpi->cpi_brandid)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1695 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1696 if (i < btblmax) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1697 if (sgn == 0x6b1 && cpi->cpi_brandid == 3)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1698 return ("Intel(r) Celeron(r)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1699 if (sgn < 0xf13 && cpi->cpi_brandid == 0xb)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1700 return ("Intel(r) Xeon(tm) MP");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1701 if (sgn < 0xf13 && cpi->cpi_brandid == 0xe)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1702 return ("Intel(r) Xeon(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1703 return (brand_tbl[i].bt_str);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1704 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1705 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1706
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1707 return (NULL);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1708 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1709
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1710 static const char *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1711 amd_cpubrand(const struct cpuid_info *cpi)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1712 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1713 if ((x86_feature & X86_CPUID) == 0 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1714 cpi->cpi_maxeax < 1 || cpi->cpi_family < 5)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1715 return ("i486 compatible");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1716
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1717 switch (cpi->cpi_family) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1718 case 5:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1719 switch (cpi->cpi_model) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1720 case 0:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1721 case 1:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1722 case 2:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1723 case 3:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1724 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1725 case 5:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1726 return ("AMD-K5(r)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1727 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1728 case 7:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1729 return ("AMD-K6(r)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1730 case 8:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1731 return ("AMD-K6(r)-2");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1732 case 9:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1733 return ("AMD-K6(r)-III");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1734 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1735 return ("AMD (family 5)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1736 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1737 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1738 switch (cpi->cpi_model) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1739 case 1:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1740 return ("AMD-K7(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1741 case 0:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1742 case 2:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1743 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1744 return ("AMD Athlon(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1745 case 3:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1746 case 7:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1747 return ("AMD Duron(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1748 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1749 case 8:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1750 case 10:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1751 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1752 * Use the L2 cache size to distinguish
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1753 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1754 return ((cpi->cpi_extd[6].cp_ecx >> 16) >= 256 ?
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1755 "AMD Athlon(tm)" : "AMD Duron(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1756 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1757 return ("AMD (family 6)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1758 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1759 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1760 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1761 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1762
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1763 if (cpi->cpi_family == 0xf && cpi->cpi_model == 5 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1764 cpi->cpi_brandid != 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1765 switch (BITX(cpi->cpi_brandid, 7, 5)) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1766 case 3:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1767 return ("AMD Opteron(tm) UP 1xx");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1768 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1769 return ("AMD Opteron(tm) DP 2xx");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1770 case 5:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1771 return ("AMD Opteron(tm) MP 8xx");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1772 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1773 return ("AMD Opteron(tm)");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1774 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1775 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1776
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1777 return (NULL);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1778 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1779
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1780 static const char *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1781 cyrix_cpubrand(struct cpuid_info *cpi, uint_t type)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1782 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1783 if ((x86_feature & X86_CPUID) == 0 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1784 cpi->cpi_maxeax < 1 || cpi->cpi_family < 5 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1785 type == X86_TYPE_CYRIX_486)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1786 return ("i486 compatible");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1787
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1788 switch (type) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1789 case X86_TYPE_CYRIX_6x86:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1790 return ("Cyrix 6x86");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1791 case X86_TYPE_CYRIX_6x86L:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1792 return ("Cyrix 6x86L");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1793 case X86_TYPE_CYRIX_6x86MX:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1794 return ("Cyrix 6x86MX");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1795 case X86_TYPE_CYRIX_GXm:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1796 return ("Cyrix GXm");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1797 case X86_TYPE_CYRIX_MediaGX:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1798 return ("Cyrix MediaGX");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1799 case X86_TYPE_CYRIX_MII:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1800 return ("Cyrix M2");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1801 case X86_TYPE_VIA_CYRIX_III:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1802 return ("VIA Cyrix M3");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1803 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1804 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1805 * Have another wild guess ..
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1806 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1807 if (cpi->cpi_family == 4 && cpi->cpi_model == 9)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1808 return ("Cyrix 5x86");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1809 else if (cpi->cpi_family == 5) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1810 switch (cpi->cpi_model) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1811 case 2:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1812 return ("Cyrix 6x86"); /* Cyrix M1 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1813 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1814 return ("Cyrix MediaGX");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1815 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1816 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1817 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1818 } else if (cpi->cpi_family == 6) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1819 switch (cpi->cpi_model) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1820 case 0:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1821 return ("Cyrix 6x86MX"); /* Cyrix M2? */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1822 case 5:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1823 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1824 case 7:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1825 case 8:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1826 case 9:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1827 return ("VIA C3");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1828 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1829 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1830 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1831 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1832 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1833 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1834 return (NULL);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1835 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1836
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1837 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1838 * This only gets called in the case that the CPU extended
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1839 * feature brand string (0x80000002, 0x80000003, 0x80000004)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1840 * aren't available, or contain null bytes for some reason.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1841 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1842 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1843 fabricate_brandstr(struct cpuid_info *cpi)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1844 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1845 const char *brand = NULL;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1846
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1847 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1848 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1849 brand = intel_cpubrand(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1850 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1851 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1852 brand = amd_cpubrand(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1853 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1854 case X86_VENDOR_Cyrix:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1855 brand = cyrix_cpubrand(cpi, x86_type);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1856 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1857 case X86_VENDOR_NexGen:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1858 if (cpi->cpi_family == 5 && cpi->cpi_model == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1859 brand = "NexGen Nx586";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1860 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1861 case X86_VENDOR_Centaur:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1862 if (cpi->cpi_family == 5)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1863 switch (cpi->cpi_model) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1864 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1865 brand = "Centaur C6";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1866 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1867 case 8:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1868 brand = "Centaur C2";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1869 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1870 case 9:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1871 brand = "Centaur C3";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1872 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1873 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1874 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1875 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1876 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1877 case X86_VENDOR_Rise:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1878 if (cpi->cpi_family == 5 &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1879 (cpi->cpi_model == 0 || cpi->cpi_model == 2))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1880 brand = "Rise mP6";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1881 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1882 case X86_VENDOR_SiS:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1883 if (cpi->cpi_family == 5 && cpi->cpi_model == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1884 brand = "SiS 55x";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1885 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1886 case X86_VENDOR_TM:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1887 if (cpi->cpi_family == 5 && cpi->cpi_model == 4)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1888 brand = "Transmeta Crusoe TM3x00 or TM5x00";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1889 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1890 case X86_VENDOR_NSC:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1891 case X86_VENDOR_UMC:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1892 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1893 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1894 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1895 if (brand) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1896 (void) strcpy((char *)cpi->cpi_brandstr, brand);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1897 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1898 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1899
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1900 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1901 * If all else fails ...
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1902 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1903 (void) snprintf(cpi->cpi_brandstr, sizeof (cpi->cpi_brandstr),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1904 "%s %d.%d.%d", cpi->cpi_vendorstr, cpi->cpi_family,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1905 cpi->cpi_model, cpi->cpi_step);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1906 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1907
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1908 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1909 * This routine is called just after kernel memory allocation
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1910 * becomes available on cpu0, and as part of mp_startup() on
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1911 * the other cpus.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1912 *
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1913 * Fixup the brand string, and collect any information from cpuid
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1914 * that requires dynamicically allocated storage to represent.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1915 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1916 /*ARGSUSED*/
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1917 void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1918 cpuid_pass3(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1919 {
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1920 int i, max, shft, level, size;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1921 struct cpuid_regs regs;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1922 struct cpuid_regs *cp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1923 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1924
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1925 ASSERT(cpi->cpi_pass == 2);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1926
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1927 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1928 * Function 4: Deterministic cache parameters
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1929 *
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1930 * Take this opportunity to detect the number of threads
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1931 * sharing the last level cache, and construct a corresponding
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1932 * cache id. The respective cpuid_info members are initialized
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1933 * to the default case of "no last level cache sharing".
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1934 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1935 cpi->cpi_ncpu_shr_last_cache = 1;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1936 cpi->cpi_last_lvl_cacheid = cpu->cpu_id;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1937
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1938 if (cpi->cpi_maxeax >= 4 && cpi->cpi_vendor == X86_VENDOR_Intel) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1939
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1940 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1941 * Find the # of elements (size) returned by fn 4, and along
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1942 * the way detect last level cache sharing details.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1943 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1944 bzero(&regs, sizeof (regs));
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1945 cp = &regs;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1946 for (i = 0, max = 0; i < CPI_FN4_ECX_MAX; i++) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1947 cp->cp_eax = 4;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1948 cp->cp_ecx = i;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1949
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1950 (void) __cpuid_insn(cp);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1951
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1952 if (CPI_CACHE_TYPE(cp) == 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1953 break;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1954 level = CPI_CACHE_LVL(cp);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1955 if (level > max) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1956 max = level;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1957 cpi->cpi_ncpu_shr_last_cache =
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1958 CPI_NTHR_SHR_CACHE(cp) + 1;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1959 }
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1960 }
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1961 cpi->cpi_std_4_size = size = i;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1962
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1963 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1964 * Allocate the cpi_std_4 array. The first element
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1965 * references the regs for fn 4, %ecx == 0, which
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1966 * cpuid_pass2() stashed in cpi->cpi_std[4].
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1967 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1968 if (size > 0) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1969 cpi->cpi_std_4 =
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1970 kmem_alloc(size * sizeof (cp), KM_SLEEP);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1971 cpi->cpi_std_4[0] = &cpi->cpi_std[4];
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1972
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1973 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1974 * Allocate storage to hold the additional regs
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1975 * for function 4, %ecx == 1 .. cpi_std_4_size.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1976 *
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1977 * The regs for fn 4, %ecx == 0 has already
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1978 * been allocated as indicated above.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1979 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1980 for (i = 1; i < size; i++) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1981 cp = cpi->cpi_std_4[i] =
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1982 kmem_zalloc(sizeof (regs), KM_SLEEP);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1983 cp->cp_eax = 4;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1984 cp->cp_ecx = i;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1985
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1986 (void) __cpuid_insn(cp);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1987 }
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1988 }
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1989 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1990 * Determine the number of bits needed to represent
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1991 * the number of CPUs sharing the last level cache.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1992 *
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1993 * Shift off that number of bits from the APIC id to
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1994 * derive the cache id.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1995 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1996 shft = 0;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1997 for (i = 1; i < cpi->cpi_ncpu_shr_last_cache; i <<= 1)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1998 shft++;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
1999 cpi->cpi_last_lvl_cacheid = CPI_APIC_ID(cpi) >> shft;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2000 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2001
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2002 /*
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2003 * Now fixup the brand string
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2004 */
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2005 if ((cpi->cpi_xmaxeax & 0x80000000) == 0) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2006 fabricate_brandstr(cpi);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2007 } else {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2008
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2009 /*
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2010 * If we successfully extracted a brand string from the cpuid
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2011 * instruction, clean it up by removing leading spaces and
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2012 * similar junk.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2013 */
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2014 if (cpi->cpi_brandstr[0]) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2015 size_t maxlen = sizeof (cpi->cpi_brandstr);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2016 char *src, *dst;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2017
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2018 dst = src = (char *)cpi->cpi_brandstr;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2019 src[maxlen - 1] = '\0';
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2020 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2021 * strip leading spaces
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2022 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2023 while (*src == ' ')
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2024 src++;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2025 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2026 * Remove any 'Genuine' or "Authentic" prefixes
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2027 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2028 if (strncmp(src, "Genuine ", 8) == 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2029 src += 8;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2030 if (strncmp(src, "Authentic ", 10) == 0)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2031 src += 10;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2032
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2033 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2034 * Now do an in-place copy.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2035 * Map (R) to (r) and (TM) to (tm).
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2036 * The era of teletypes is long gone, and there's
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2037 * -really- no need to shout.
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2038 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2039 while (*src != '\0') {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2040 if (src[0] == '(') {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2041 if (strncmp(src + 1, "R)", 2) == 0) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2042 (void) strncpy(dst, "(r)", 3);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2043 src += 3;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2044 dst += 3;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2045 continue;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2046 }
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2047 if (strncmp(src + 1, "TM)", 3) == 0) {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2048 (void) strncpy(dst, "(tm)", 4);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2049 src += 4;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2050 dst += 4;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2051 continue;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2052 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2053 }
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2054 *dst++ = *src++;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2055 }
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2056 *dst = '\0';
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2057
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2058 /*
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2059 * Finally, remove any trailing spaces
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2060 */
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2061 while (--dst > cpi->cpi_brandstr)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2062 if (*dst == ' ')
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2063 *dst = '\0';
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2064 else
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2065 break;
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2066 } else
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2067 fabricate_brandstr(cpi);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2068 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2069 cpi->cpi_pass = 3;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2070 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2071
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2072 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2073 * This routine is called out of bind_hwcap() much later in the life
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2074 * of the kernel (post_startup()). The job of this routine is to resolve
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2075 * the hardware feature support and kernel support for those features into
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2076 * what we're actually going to tell applications via the aux vector.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2077 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2078 uint_t
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2079 cpuid_pass4(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2080 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2081 struct cpuid_info *cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2082 uint_t hwcap_flags = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2083
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2084 if (cpu == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2085 cpu = CPU;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2086 cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2087
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2088 ASSERT(cpi->cpi_pass == 3);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2089
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2090 if (cpi->cpi_maxeax >= 1) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2091 uint32_t *edx = &cpi->cpi_support[STD_EDX_FEATURES];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2092 uint32_t *ecx = &cpi->cpi_support[STD_ECX_FEATURES];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2093
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2094 *edx = CPI_FEATURES_EDX(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2095 *ecx = CPI_FEATURES_ECX(cpi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2096
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2097 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2098 * [these require explicit kernel support]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2099 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2100 if ((x86_feature & X86_SEP) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2101 *edx &= ~CPUID_INTC_EDX_SEP;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2102
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2103 if ((x86_feature & X86_SSE) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2104 *edx &= ~(CPUID_INTC_EDX_FXSR|CPUID_INTC_EDX_SSE);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2105 if ((x86_feature & X86_SSE2) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2106 *edx &= ~CPUID_INTC_EDX_SSE2;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2107
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2108 if ((x86_feature & X86_HTT) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2109 *edx &= ~CPUID_INTC_EDX_HTT;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2110
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2111 if ((x86_feature & X86_SSE3) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2112 *ecx &= ~CPUID_INTC_ECX_SSE3;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2113
5269
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2114 if (cpi->cpi_vendor == X86_VENDOR_Intel) {
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2115 if ((x86_feature & X86_SSSE3) == 0)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2116 *ecx &= ~CPUID_INTC_ECX_SSSE3;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2117 if ((x86_feature & X86_SSE4_1) == 0)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2118 *ecx &= ~CPUID_INTC_ECX_SSE4_1;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2119 if ((x86_feature & X86_SSE4_2) == 0)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2120 *ecx &= ~CPUID_INTC_ECX_SSE4_2;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2121 }
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2122
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2123 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2124 * [no explicit support required beyond x87 fp context]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2125 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2126 if (!fpu_exists)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2127 *edx &= ~(CPUID_INTC_EDX_FPU | CPUID_INTC_EDX_MMX);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2128
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2129 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2130 * Now map the supported feature vector to things that we
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2131 * think userland will care about.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2132 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2133 if (*edx & CPUID_INTC_EDX_SEP)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2134 hwcap_flags |= AV_386_SEP;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2135 if (*edx & CPUID_INTC_EDX_SSE)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2136 hwcap_flags |= AV_386_FXSR | AV_386_SSE;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2137 if (*edx & CPUID_INTC_EDX_SSE2)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2138 hwcap_flags |= AV_386_SSE2;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2139 if (*ecx & CPUID_INTC_ECX_SSE3)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2140 hwcap_flags |= AV_386_SSE3;
5269
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2141 if (cpi->cpi_vendor == X86_VENDOR_Intel) {
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2142 if (*ecx & CPUID_INTC_ECX_SSSE3)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2143 hwcap_flags |= AV_386_SSSE3;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2144 if (*ecx & CPUID_INTC_ECX_SSE4_1)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2145 hwcap_flags |= AV_386_SSE4_1;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2146 if (*ecx & CPUID_INTC_ECX_SSE4_2)
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2147 hwcap_flags |= AV_386_SSE4_2;
395a95dbfd17 6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents: 5254
diff changeset
2148 }
4628
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2149 if (*ecx & CPUID_INTC_ECX_POPCNT)
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2150 hwcap_flags |= AV_386_POPCNT;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2151 if (*edx & CPUID_INTC_EDX_FPU)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2152 hwcap_flags |= AV_386_FPU;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2153 if (*edx & CPUID_INTC_EDX_MMX)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2154 hwcap_flags |= AV_386_MMX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2155
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2156 if (*edx & CPUID_INTC_EDX_TSC)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2157 hwcap_flags |= AV_386_TSC;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2158 if (*edx & CPUID_INTC_EDX_CX8)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2159 hwcap_flags |= AV_386_CX8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2160 if (*edx & CPUID_INTC_EDX_CMOV)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2161 hwcap_flags |= AV_386_CMOV;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2162 if (*ecx & CPUID_INTC_ECX_MON)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2163 hwcap_flags |= AV_386_MON;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2164 if (*ecx & CPUID_INTC_ECX_CX16)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2165 hwcap_flags |= AV_386_CX16;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2166 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2167
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2168 if (x86_feature & X86_HTT)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2169 hwcap_flags |= AV_386_PAUSE;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2170
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2171 if (cpi->cpi_xmaxeax < 0x80000001)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2172 goto pass4_done;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2173
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2174 switch (cpi->cpi_vendor) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2175 struct cpuid_regs cp;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2176 uint32_t *edx, *ecx;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2177
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2178 case X86_VENDOR_Intel:
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2179 /*
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2180 * Seems like Intel duplicated what we necessary
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2181 * here to make the initial crop of 64-bit OS's work.
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2182 * Hopefully, those are the only "extended" bits
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2183 * they'll add.
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2184 */
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2185 /*FALLTHROUGH*/
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2186
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2187 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2188 edx = &cpi->cpi_support[AMD_EDX_FEATURES];
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2189 ecx = &cpi->cpi_support[AMD_ECX_FEATURES];
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2190
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2191 *edx = CPI_FEATURES_XTD_EDX(cpi);
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2192 *ecx = CPI_FEATURES_XTD_ECX(cpi);
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2193
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2194 /*
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2195 * [these features require explicit kernel support]
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2196 */
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2197 switch (cpi->cpi_vendor) {
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2198 case X86_VENDOR_Intel:
6657
a55676c65ac7 6628773 Need to support rdtscp for Intel
sudheer
parents: 6642
diff changeset
2199 if ((x86_feature & X86_TSCP) == 0)
a55676c65ac7 6628773 Need to support rdtscp for Intel
sudheer
parents: 6642
diff changeset
2200 *edx &= ~CPUID_AMD_EDX_TSCP;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2201 break;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2202
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2203 case X86_VENDOR_AMD:
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2204 if ((x86_feature & X86_TSCP) == 0)
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2205 *edx &= ~CPUID_AMD_EDX_TSCP;
4628
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2206 if ((x86_feature & X86_SSE4A) == 0)
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2207 *ecx &= ~CPUID_AMD_ECX_SSE4A;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2208 break;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2209
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2210 default:
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2211 break;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2212 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2213
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2214 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2215 * [no explicit support required beyond
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2216 * x87 fp context and exception handlers]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2217 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2218 if (!fpu_exists)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2219 *edx &= ~(CPUID_AMD_EDX_MMXamd |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2220 CPUID_AMD_EDX_3DNow | CPUID_AMD_EDX_3DNowx);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2221
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2222 if ((x86_feature & X86_NX) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2223 *edx &= ~CPUID_AMD_EDX_NX;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2224 #if !defined(__amd64)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2225 *edx &= ~CPUID_AMD_EDX_LM;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2226 #endif
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2227 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2228 * Now map the supported feature vector to
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2229 * things that we think userland will care about.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2230 */
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2231 #if defined(__amd64)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2232 if (*edx & CPUID_AMD_EDX_SYSC)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2233 hwcap_flags |= AV_386_AMD_SYSC;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2234 #endif
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2235 if (*edx & CPUID_AMD_EDX_MMXamd)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2236 hwcap_flags |= AV_386_AMD_MMX;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2237 if (*edx & CPUID_AMD_EDX_3DNow)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2238 hwcap_flags |= AV_386_AMD_3DNow;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2239 if (*edx & CPUID_AMD_EDX_3DNowx)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2240 hwcap_flags |= AV_386_AMD_3DNowx;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2241
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2242 switch (cpi->cpi_vendor) {
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2243 case X86_VENDOR_AMD:
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2244 if (*edx & CPUID_AMD_EDX_TSCP)
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2245 hwcap_flags |= AV_386_TSCP;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2246 if (*ecx & CPUID_AMD_ECX_AHF64)
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2247 hwcap_flags |= AV_386_AHF;
4628
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2248 if (*ecx & CPUID_AMD_ECX_SSE4A)
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2249 hwcap_flags |= AV_386_AMD_SSE4A;
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2250 if (*ecx & CPUID_AMD_ECX_LZCNT)
f90cf8fd4710 6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents: 4606
diff changeset
2251 hwcap_flags |= AV_386_AMD_LZCNT;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2252 break;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2253
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2254 case X86_VENDOR_Intel:
6657
a55676c65ac7 6628773 Need to support rdtscp for Intel
sudheer
parents: 6642
diff changeset
2255 if (*edx & CPUID_AMD_EDX_TSCP)
a55676c65ac7 6628773 Need to support rdtscp for Intel
sudheer
parents: 6642
diff changeset
2256 hwcap_flags |= AV_386_TSCP;
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2257 /*
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2258 * Aarrgh.
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2259 * Intel uses a different bit in the same word.
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2260 */
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2261 if (*ecx & CPUID_INTC_ECX_AHF64)
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2262 hwcap_flags |= AV_386_AHF;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2263 break;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2264
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2265 default:
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2266 break;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2267 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2268 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2269
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2270 case X86_VENDOR_TM:
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2271 cp.cp_eax = 0x80860001;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2272 (void) __cpuid_insn(&cp);
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2273 cpi->cpi_support[TM_EDX_FEATURES] = cp.cp_edx;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2274 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2275
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2276 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2277 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2278 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2279
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2280 pass4_done:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2281 cpi->cpi_pass = 4;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2282 return (hwcap_flags);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2283 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2284
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2285
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2286 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2287 * Simulate the cpuid instruction using the data we previously
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2288 * captured about this CPU. We try our best to return the truth
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2289 * about the hardware, independently of kernel support.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2290 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2291 uint32_t
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2292 cpuid_insn(cpu_t *cpu, struct cpuid_regs *cp)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2293 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2294 struct cpuid_info *cpi;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2295 struct cpuid_regs *xcp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2296
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2297 if (cpu == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2298 cpu = CPU;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2299 cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2300
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2301 ASSERT(cpuid_checkpass(cpu, 3));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2302
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2303 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2304 * CPUID data is cached in two separate places: cpi_std for standard
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2305 * CPUID functions, and cpi_extd for extended CPUID functions.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2306 */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2307 if (cp->cp_eax <= cpi->cpi_maxeax && cp->cp_eax < NMAX_CPI_STD)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2308 xcp = &cpi->cpi_std[cp->cp_eax];
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2309 else if (cp->cp_eax >= 0x80000000 && cp->cp_eax <= cpi->cpi_xmaxeax &&
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2310 cp->cp_eax < 0x80000000 + NMAX_CPI_EXTD)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2311 xcp = &cpi->cpi_extd[cp->cp_eax - 0x80000000];
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2312 else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2313 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2314 * The caller is asking for data from an input parameter which
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2315 * the kernel has not cached. In this case we go fetch from
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2316 * the hardware and return the data directly to the user.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2317 */
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2318 return (__cpuid_insn(cp));
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2319
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2320 cp->cp_eax = xcp->cp_eax;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2321 cp->cp_ebx = xcp->cp_ebx;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2322 cp->cp_ecx = xcp->cp_ecx;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2323 cp->cp_edx = xcp->cp_edx;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2324 return (cp->cp_eax);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2325 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2326
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2327 int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2328 cpuid_checkpass(cpu_t *cpu, int pass)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2329 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2330 return (cpu != NULL && cpu->cpu_m.mcpu_cpi != NULL &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2331 cpu->cpu_m.mcpu_cpi->cpi_pass >= pass);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2332 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2333
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2334 int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2335 cpuid_getbrandstr(cpu_t *cpu, char *s, size_t n)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2336 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2337 ASSERT(cpuid_checkpass(cpu, 3));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2338
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2339 return (snprintf(s, n, "%s", cpu->cpu_m.mcpu_cpi->cpi_brandstr));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2340 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2341
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2342 int
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2343 cpuid_is_cmt(cpu_t *cpu)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2344 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2345 if (cpu == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2346 cpu = CPU;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2347
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2348 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2349
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2350 return (cpu->cpu_m.mcpu_cpi->cpi_chipid >= 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2351 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2352
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2353 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2354 * AMD and Intel both implement the 64-bit variant of the syscall
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2355 * instruction (syscallq), so if there's -any- support for syscall,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2356 * cpuid currently says "yes, we support this".
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2357 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2358 * However, Intel decided to -not- implement the 32-bit variant of the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2359 * syscall instruction, so we provide a predicate to allow our caller
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2360 * to test that subtlety here.
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
2361 *
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
2362 * XXPV Currently, 32-bit syscall instructions don't work via the hypervisor,
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
2363 * even in the case where the hardware would in fact support it.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2364 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2365 /*ARGSUSED*/
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2366 int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2367 cpuid_syscall32_insn(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2368 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2369 ASSERT(cpuid_checkpass((cpu == NULL ? CPU : cpu), 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2370
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
2371 #if !defined(__xpv)
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2372 if (cpu == NULL)
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2373 cpu = CPU;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2374
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2375 /*CSTYLED*/
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2376 {
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2377 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi;
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2378
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2379 if (cpi->cpi_vendor == X86_VENDOR_AMD &&
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2380 cpi->cpi_xmaxeax >= 0x80000001 &&
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2381 (CPI_FEATURES_XTD_EDX(cpi) & CPUID_AMD_EDX_SYSC))
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2382 return (1);
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2383 }
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
2384 #endif
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2385 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2386 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2387
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2388 int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2389 cpuid_getidstr(cpu_t *cpu, char *s, size_t n)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2390 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2391 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2392
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2393 static const char fmt[] =
3779
f34a44686f8b 6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents: 3446
diff changeset
2394 "x86 (%s %X family %d model %d step %d clock %d MHz)";
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2395 static const char fmt_ht[] =
3779
f34a44686f8b 6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents: 3446
diff changeset
2396 "x86 (chipid 0x%x %s %X family %d model %d step %d clock %d MHz)";
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2397
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2398 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2399
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2400 if (cpuid_is_cmt(cpu))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2401 return (snprintf(s, n, fmt_ht, cpi->cpi_chipid,
3779
f34a44686f8b 6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents: 3446
diff changeset
2402 cpi->cpi_vendorstr, cpi->cpi_std[1].cp_eax,
f34a44686f8b 6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents: 3446
diff changeset
2403 cpi->cpi_family, cpi->cpi_model,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2404 cpi->cpi_step, cpu->cpu_type_info.pi_clock));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2405 return (snprintf(s, n, fmt,
3779
f34a44686f8b 6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents: 3446
diff changeset
2406 cpi->cpi_vendorstr, cpi->cpi_std[1].cp_eax,
f34a44686f8b 6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents: 3446
diff changeset
2407 cpi->cpi_family, cpi->cpi_model,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2408 cpi->cpi_step, cpu->cpu_type_info.pi_clock));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2409 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2410
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2411 const char *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2412 cpuid_getvendorstr(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2413 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2414 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2415 return ((const char *)cpu->cpu_m.mcpu_cpi->cpi_vendorstr);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2416 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2417
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2418 uint_t
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2419 cpuid_getvendor(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2420 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2421 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2422 return (cpu->cpu_m.mcpu_cpi->cpi_vendor);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2423 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2424
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2425 uint_t
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2426 cpuid_getfamily(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2427 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2428 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2429 return (cpu->cpu_m.mcpu_cpi->cpi_family);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2430 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2431
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2432 uint_t
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2433 cpuid_getmodel(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2434 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2435 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2436 return (cpu->cpu_m.mcpu_cpi->cpi_model);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2437 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2438
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2439 uint_t
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2440 cpuid_get_ncpu_per_chip(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2441 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2442 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2443 return (cpu->cpu_m.mcpu_cpi->cpi_ncpu_per_chip);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2444 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2445
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2446 uint_t
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2447 cpuid_get_ncore_per_chip(cpu_t *cpu)
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2448 {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2449 ASSERT(cpuid_checkpass(cpu, 1));
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2450 return (cpu->cpu_m.mcpu_cpi->cpi_ncore_per_chip);
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2451 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2452
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2453 uint_t
4606
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2454 cpuid_get_ncpu_sharing_last_cache(cpu_t *cpu)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2455 {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2456 ASSERT(cpuid_checkpass(cpu, 2));
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2457 return (cpu->cpu_m.mcpu_cpi->cpi_ncpu_shr_last_cache);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2458 }
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2459
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2460 id_t
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2461 cpuid_get_last_lvl_cacheid(cpu_t *cpu)
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2462 {
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2463 ASSERT(cpuid_checkpass(cpu, 2));
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2464 return (cpu->cpu_m.mcpu_cpi->cpi_last_lvl_cacheid);
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2465 }
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2466
ffcd05844ec5 6495401 cpuid based cache hierarchy awareness
esaxe
parents: 4581
diff changeset
2467 uint_t
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2468 cpuid_getstep(cpu_t *cpu)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2469 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2470 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2471 return (cpu->cpu_m.mcpu_cpi->cpi_step);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2472 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2473
4581
b6104e41b06c PSARC/2007/349 Intel Microcode Update Support
sherrym
parents: 4481
diff changeset
2474 uint_t
b6104e41b06c PSARC/2007/349 Intel Microcode Update Support
sherrym
parents: 4481
diff changeset
2475 cpuid_getsig(struct cpu *cpu)
b6104e41b06c PSARC/2007/349 Intel Microcode Update Support
sherrym
parents: 4481
diff changeset
2476 {
b6104e41b06c PSARC/2007/349 Intel Microcode Update Support
sherrym
parents: 4481
diff changeset
2477 ASSERT(cpuid_checkpass(cpu, 1));
b6104e41b06c PSARC/2007/349 Intel Microcode Update Support
sherrym
parents: 4481
diff changeset
2478 return (cpu->cpu_m.mcpu_cpi->cpi_std[1].cp_eax);
b6104e41b06c PSARC/2007/349 Intel Microcode Update Support
sherrym
parents: 4481
diff changeset
2479 }
b6104e41b06c PSARC/2007/349 Intel Microcode Update Support
sherrym
parents: 4481
diff changeset
2480
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2481 uint32_t
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2482 cpuid_getchiprev(struct cpu *cpu)
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2483 {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2484 ASSERT(cpuid_checkpass(cpu, 1));
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2485 return (cpu->cpu_m.mcpu_cpi->cpi_chiprev);
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2486 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2487
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2488 const char *
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2489 cpuid_getchiprevstr(struct cpu *cpu)
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2490 {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2491 ASSERT(cpuid_checkpass(cpu, 1));
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2492 return (cpu->cpu_m.mcpu_cpi->cpi_chiprevstr);
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2493 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2494
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2495 uint32_t
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2496 cpuid_getsockettype(struct cpu *cpu)
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2497 {
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2498 ASSERT(cpuid_checkpass(cpu, 1));
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2499 return (cpu->cpu_m.mcpu_cpi->cpi_socket);
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2500 }
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2501
3434
5142e1d7d0bc 6461311 multi-level CMT scheduling optimizations
esaxe
parents: 2869
diff changeset
2502 int
5142e1d7d0bc 6461311 multi-level CMT scheduling optimizations
esaxe
parents: 2869
diff changeset
2503 cpuid_get_chipid(cpu_t *cpu)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2504 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2505 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2506
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2507 if (cpuid_is_cmt(cpu))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2508 return (cpu->cpu_m.mcpu_cpi->cpi_chipid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2509 return (cpu->cpu_id);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2510 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2511
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2512 id_t
3434
5142e1d7d0bc 6461311 multi-level CMT scheduling optimizations
esaxe
parents: 2869
diff changeset
2513 cpuid_get_coreid(cpu_t *cpu)
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2514 {
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2515 ASSERT(cpuid_checkpass(cpu, 1));
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2516 return (cpu->cpu_m.mcpu_cpi->cpi_coreid);
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2517 }
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2518
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2519 int
5870
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
2520 cpuid_get_pkgcoreid(cpu_t *cpu)
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
2521 {
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
2522 ASSERT(cpuid_checkpass(cpu, 1));
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
2523 return (cpu->cpu_m.mcpu_cpi->cpi_pkgcoreid);
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
2524 }
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
2525
2513339ac53a 6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents: 5741
diff changeset
2526 int
3434
5142e1d7d0bc 6461311 multi-level CMT scheduling optimizations
esaxe
parents: 2869
diff changeset
2527 cpuid_get_clogid(cpu_t *cpu)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2528 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2529 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2530 return (cpu->cpu_m.mcpu_cpi->cpi_clogid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2531 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2532
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2533 void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2534 cpuid_get_addrsize(cpu_t *cpu, uint_t *pabits, uint_t *vabits)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2535 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2536 struct cpuid_info *cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2537
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2538 if (cpu == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2539 cpu = CPU;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2540 cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2541
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2542 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2543
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2544 if (pabits)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2545 *pabits = cpi->cpi_pabits;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2546 if (vabits)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2547 *vabits = cpi->cpi_vabits;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2548 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2549
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2550 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2551 * Returns the number of data TLB entries for a corresponding
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2552 * pagesize. If it can't be computed, or isn't known, the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2553 * routine returns zero. If you ask about an architecturally
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2554 * impossible pagesize, the routine will panic (so that the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2555 * hat implementor knows that things are inconsistent.)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2556 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2557 uint_t
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2558 cpuid_get_dtlb_nent(cpu_t *cpu, size_t pagesize)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2559 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2560 struct cpuid_info *cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2561 uint_t dtlb_nent = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2562
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2563 if (cpu == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2564 cpu = CPU;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2565 cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2566
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2567 ASSERT(cpuid_checkpass(cpu, 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2568
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2569 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2570 * Check the L2 TLB info
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2571 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2572 if (cpi->cpi_xmaxeax >= 0x80000006) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2573 struct cpuid_regs *cp = &cpi->cpi_extd[6];
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2574
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2575 switch (pagesize) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2576
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2577 case 4 * 1024:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2578 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2579 * All zero in the top 16 bits of the register
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2580 * indicates a unified TLB. Size is in low 16 bits.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2581 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2582 if ((cp->cp_ebx & 0xffff0000) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2583 dtlb_nent = cp->cp_ebx & 0x0000ffff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2584 else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2585 dtlb_nent = BITX(cp->cp_ebx, 27, 16);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2586 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2587
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2588 case 2 * 1024 * 1024:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2589 if ((cp->cp_eax & 0xffff0000) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2590 dtlb_nent = cp->cp_eax & 0x0000ffff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2591 else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2592 dtlb_nent = BITX(cp->cp_eax, 27, 16);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2593 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2594
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2595 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2596 panic("unknown L2 pagesize");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2597 /*NOTREACHED*/
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2598 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2599 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2600
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2601 if (dtlb_nent != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2602 return (dtlb_nent);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2603
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2604 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2605 * No L2 TLB support for this size, try L1.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2606 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2607 if (cpi->cpi_xmaxeax >= 0x80000005) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2608 struct cpuid_regs *cp = &cpi->cpi_extd[5];
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2609
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2610 switch (pagesize) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2611 case 4 * 1024:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2612 dtlb_nent = BITX(cp->cp_ebx, 23, 16);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2613 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2614 case 2 * 1024 * 1024:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2615 dtlb_nent = BITX(cp->cp_eax, 23, 16);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2616 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2617 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2618 panic("unknown L1 d-TLB pagesize");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2619 /*NOTREACHED*/
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2620 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2621 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2622
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2623 return (dtlb_nent);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2624 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2625
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2626 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2627 * Return 0 if the erratum is not present or not applicable, positive
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2628 * if it is, and negative if the status of the erratum is unknown.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2629 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2630 * See "Revision Guide for AMD Athlon(tm) 64 and AMD Opteron(tm)
359
a88cb999e7ec 6288246 amd64 kernel needs to detect AMD Opteron erratum 131
kucharsk
parents: 0
diff changeset
2631 * Processors" #25759, Rev 3.57, August 2005
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2632 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2633 int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2634 cpuid_opteron_erratum(cpu_t *cpu, uint_t erratum)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2635 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2636 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi;
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2637 uint_t eax;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2638
2584
c8f937287646 6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents: 2519
diff changeset
2639 /*
c8f937287646 6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents: 2519
diff changeset
2640 * Bail out if this CPU isn't an AMD CPU, or if it's
c8f937287646 6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents: 2519
diff changeset
2641 * a legacy (32-bit) AMD CPU.
c8f937287646 6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents: 2519
diff changeset
2642 */
c8f937287646 6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents: 2519
diff changeset
2643 if (cpi->cpi_vendor != X86_VENDOR_AMD ||
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2644 cpi->cpi_family == 4 || cpi->cpi_family == 5 ||
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2645 cpi->cpi_family == 6)
2869
324151eecd58 PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents: 2584
diff changeset
2646
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2647 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2648
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2649 eax = cpi->cpi_std[1].cp_eax;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2650
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2651 #define SH_B0(eax) (eax == 0xf40 || eax == 0xf50)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2652 #define SH_B3(eax) (eax == 0xf51)
1582
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2653 #define B(eax) (SH_B0(eax) || SH_B3(eax))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2654
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2655 #define SH_C0(eax) (eax == 0xf48 || eax == 0xf58)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2656
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2657 #define SH_CG(eax) (eax == 0xf4a || eax == 0xf5a || eax == 0xf7a)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2658 #define DH_CG(eax) (eax == 0xfc0 || eax == 0xfe0 || eax == 0xff0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2659 #define CH_CG(eax) (eax == 0xf82 || eax == 0xfb2)
1582
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2660 #define CG(eax) (SH_CG(eax) || DH_CG(eax) || CH_CG(eax))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2661
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2662 #define SH_D0(eax) (eax == 0x10f40 || eax == 0x10f50 || eax == 0x10f70)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2663 #define DH_D0(eax) (eax == 0x10fc0 || eax == 0x10ff0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2664 #define CH_D0(eax) (eax == 0x10f80 || eax == 0x10fb0)
1582
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2665 #define D0(eax) (SH_D0(eax) || DH_D0(eax) || CH_D0(eax))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2666
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2667 #define SH_E0(eax) (eax == 0x20f50 || eax == 0x20f40 || eax == 0x20f70)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2668 #define JH_E1(eax) (eax == 0x20f10) /* JH8_E0 had 0x20f30 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2669 #define DH_E3(eax) (eax == 0x20fc0 || eax == 0x20ff0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2670 #define SH_E4(eax) (eax == 0x20f51 || eax == 0x20f71)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2671 #define BH_E4(eax) (eax == 0x20fb1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2672 #define SH_E5(eax) (eax == 0x20f42)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2673 #define DH_E6(eax) (eax == 0x20ff2 || eax == 0x20fc2)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2674 #define JH_E6(eax) (eax == 0x20f12 || eax == 0x20f32)
1582
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2675 #define EX(eax) (SH_E0(eax) || JH_E1(eax) || DH_E3(eax) || \
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2676 SH_E4(eax) || BH_E4(eax) || SH_E5(eax) || \
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2677 DH_E6(eax) || JH_E6(eax))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2678
6691
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2679 #define DR_AX(eax) (eax == 0x100f00 || eax == 0x100f01 || eax == 0x100f02)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2680 #define DR_B0(eax) (eax == 0x100f20)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2681 #define DR_B1(eax) (eax == 0x100f21)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2682 #define DR_BA(eax) (eax == 0x100f2a)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2683 #define DR_B2(eax) (eax == 0x100f22)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2684 #define DR_B3(eax) (eax == 0x100f23)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2685 #define RB_C0(eax) (eax == 0x100f40)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2686
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2687 switch (erratum) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2688 case 1:
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2689 return (cpi->cpi_family < 0x10);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2690 case 51: /* what does the asterisk mean? */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2691 return (B(eax) || SH_C0(eax) || CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2692 case 52:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2693 return (B(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2694 case 57:
6691
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2695 return (cpi->cpi_family <= 0x11);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2696 case 58:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2697 return (B(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2698 case 60:
6691
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2699 return (cpi->cpi_family <= 0x11);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2700 case 61:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2701 case 62:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2702 case 63:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2703 case 64:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2704 case 65:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2705 case 66:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2706 case 68:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2707 case 69:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2708 case 70:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2709 case 71:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2710 return (B(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2711 case 72:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2712 return (SH_B0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2713 case 74:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2714 return (B(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2715 case 75:
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2716 return (cpi->cpi_family < 0x10);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2717 case 76:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2718 return (B(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2719 case 77:
6691
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2720 return (cpi->cpi_family <= 0x11);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2721 case 78:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2722 return (B(eax) || SH_C0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2723 case 79:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2724 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax) || EX(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2725 case 80:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2726 case 81:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2727 case 82:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2728 return (B(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2729 case 83:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2730 return (B(eax) || SH_C0(eax) || CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2731 case 85:
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2732 return (cpi->cpi_family < 0x10);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2733 case 86:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2734 return (SH_C0(eax) || CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2735 case 88:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2736 #if !defined(__amd64)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2737 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2738 #else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2739 return (B(eax) || SH_C0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2740 #endif
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2741 case 89:
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2742 return (cpi->cpi_family < 0x10);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2743 case 90:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2744 return (B(eax) || SH_C0(eax) || CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2745 case 91:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2746 case 92:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2747 return (B(eax) || SH_C0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2748 case 93:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2749 return (SH_C0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2750 case 94:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2751 return (B(eax) || SH_C0(eax) || CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2752 case 95:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2753 #if !defined(__amd64)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2754 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2755 #else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2756 return (B(eax) || SH_C0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2757 #endif
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2758 case 96:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2759 return (B(eax) || SH_C0(eax) || CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2760 case 97:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2761 case 98:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2762 return (SH_C0(eax) || CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2763 case 99:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2764 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2765 case 100:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2766 return (B(eax) || SH_C0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2767 case 101:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2768 case 103:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2769 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2770 case 104:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2771 return (SH_C0(eax) || CG(eax) || D0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2772 case 105:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2773 case 106:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2774 case 107:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2775 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2776 case 108:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2777 return (DH_CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2778 case 109:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2779 return (SH_C0(eax) || CG(eax) || D0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2780 case 110:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2781 return (D0(eax) || EX(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2782 case 111:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2783 return (CG(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2784 case 112:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2785 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax) || EX(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2786 case 113:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2787 return (eax == 0x20fc0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2788 case 114:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2789 return (SH_E0(eax) || JH_E1(eax) || DH_E3(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2790 case 115:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2791 return (SH_E0(eax) || JH_E1(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2792 case 116:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2793 return (SH_E0(eax) || JH_E1(eax) || DH_E3(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2794 case 117:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2795 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2796 case 118:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2797 return (SH_E0(eax) || JH_E1(eax) || SH_E4(eax) || BH_E4(eax) ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2798 JH_E6(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2799 case 121:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2800 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax) || EX(eax));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2801 case 122:
6691
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2802 return (cpi->cpi_family < 0x10 || cpi->cpi_family == 0x11);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2803 case 123:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2804 return (JH_E1(eax) || BH_E4(eax) || JH_E6(eax));
359
a88cb999e7ec 6288246 amd64 kernel needs to detect AMD Opteron erratum 131
kucharsk
parents: 0
diff changeset
2805 case 131:
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2806 return (cpi->cpi_family < 0x10);
938
2d438f28c673 6336786 time doesn't fly when CPUs are not having fun
esaxe
parents: 789
diff changeset
2807 case 6336786:
2d438f28c673 6336786 time doesn't fly when CPUs are not having fun
esaxe
parents: 789
diff changeset
2808 /*
2d438f28c673 6336786 time doesn't fly when CPUs are not having fun
esaxe
parents: 789
diff changeset
2809 * Test for AdvPowerMgmtInfo.TscPStateInvariant
4265
6be078c4d3b4 6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents: 3779
diff changeset
2810 * if this is a K8 family or newer processor
938
2d438f28c673 6336786 time doesn't fly when CPUs are not having fun
esaxe
parents: 789
diff changeset
2811 */
2d438f28c673 6336786 time doesn't fly when CPUs are not having fun
esaxe
parents: 789
diff changeset
2812 if (CPI_FAMILY(cpi) == 0xf) {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2813 struct cpuid_regs regs;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2814 regs.cp_eax = 0x80000007;
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2815 (void) __cpuid_insn(&regs);
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
2816 return (!(regs.cp_edx & 0x100));
938
2d438f28c673 6336786 time doesn't fly when CPUs are not having fun
esaxe
parents: 789
diff changeset
2817 }
2d438f28c673 6336786 time doesn't fly when CPUs are not having fun
esaxe
parents: 789
diff changeset
2818 return (0);
1582
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2819 case 6323525:
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2820 return (((((eax >> 12) & 0xff00) + (eax & 0xf00)) |
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2821 (((eax >> 4) & 0xf) | ((eax >> 12) & 0xf0))) < 0xf40);
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
2822
6691
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2823 case 6671130:
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2824 /*
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2825 * check for processors (pre-Shanghai) that do not provide
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2826 * optimal management of 1gb ptes in its tlb.
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2827 */
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2828 return (cpi->cpi_family == 0x10 && cpi->cpi_model < 4);
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2829
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2830 case 298:
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2831 return (DR_AX(eax) || DR_B0(eax) || DR_B1(eax) || DR_BA(eax) ||
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2832 DR_B2(eax) || RB_C0(eax));
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2833
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2834 default:
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2835 return (-1);
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2836
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2837 }
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2838 }
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2839
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2840 /*
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2841 * Determine if specified erratum is present via OSVW (OS Visible Workaround).
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2842 * Return 1 if erratum is present, 0 if not present and -1 if indeterminate.
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2843 */
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2844 int
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2845 osvw_opteron_erratum(cpu_t *cpu, uint_t erratum)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2846 {
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2847 struct cpuid_info *cpi;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2848 uint_t osvwid;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2849 static int osvwfeature = -1;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2850 uint64_t osvwlength;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2851
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2852
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2853 cpi = cpu->cpu_m.mcpu_cpi;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2854
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2855 /* confirm OSVW supported */
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2856 if (osvwfeature == -1) {
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2857 osvwfeature = cpi->cpi_extd[1].cp_ecx & CPUID_AMD_ECX_OSVW;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2858 } else {
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2859 /* assert that osvw feature setting is consistent on all cpus */
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2860 ASSERT(osvwfeature ==
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2861 (cpi->cpi_extd[1].cp_ecx & CPUID_AMD_ECX_OSVW));
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2862 }
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2863 if (!osvwfeature)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2864 return (-1);
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2865
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2866 osvwlength = rdmsr(MSR_AMD_OSVW_ID_LEN) & OSVW_ID_LEN_MASK;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2867
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2868 switch (erratum) {
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2869 case 298: /* osvwid is 0 */
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2870 osvwid = 0;
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2871 if (osvwlength <= (uint64_t)osvwid) {
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2872 /* osvwid 0 is unknown */
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2873 return (-1);
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2874 }
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2875
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2876 /*
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2877 * Check the OSVW STATUS MSR to determine the state
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2878 * of the erratum where:
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2879 * 0 - fixed by HW
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2880 * 1 - BIOS has applied the workaround when BIOS
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2881 * workaround is available. (Or for other errata,
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2882 * OS workaround is required.)
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2883 * For a value of 1, caller will confirm that the
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2884 * erratum 298 workaround has indeed been applied by BIOS.
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2885 *
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2886 * A 1 may be set in cpus that have a HW fix
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2887 * in a mixed cpu system. Regarding erratum 298:
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2888 * In a multiprocessor platform, the workaround above
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2889 * should be applied to all processors regardless of
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2890 * silicon revision when an affected processor is
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2891 * present.
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2892 */
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2893
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2894 return (rdmsr(MSR_AMD_OSVW_STATUS +
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2895 (osvwid / OSVW_ID_CNT_PER_MSR)) &
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2896 (1ULL << (osvwid % OSVW_ID_CNT_PER_MSR)));
f8848c7acc9e 6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents: 6671
diff changeset
2897
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2898 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2899 return (-1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2900 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2901 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2902
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2903 static const char assoc_str[] = "associativity";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2904 static const char line_str[] = "line-size";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2905 static const char size_str[] = "size";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2906
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2907 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2908 add_cache_prop(dev_info_t *devi, const char *label, const char *type,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2909 uint32_t val)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2910 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2911 char buf[128];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2912
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2913 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2914 * ndi_prop_update_int() is used because it is desirable for
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2915 * DDI_PROP_HW_DEF and DDI_PROP_DONTSLEEP to be set.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2916 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2917 if (snprintf(buf, sizeof (buf), "%s-%s", label, type) < sizeof (buf))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2918 (void) ndi_prop_update_int(DDI_DEV_T_NONE, devi, buf, val);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2919 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2920
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2921 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2922 * Intel-style cache/tlb description
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2923 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2924 * Standard cpuid level 2 gives a randomly ordered
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2925 * selection of tags that index into a table that describes
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2926 * cache and tlb properties.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2927 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2928
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2929 static const char l1_icache_str[] = "l1-icache";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2930 static const char l1_dcache_str[] = "l1-dcache";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2931 static const char l2_cache_str[] = "l2-cache";
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2932 static const char l3_cache_str[] = "l3-cache";
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2933 static const char itlb4k_str[] = "itlb-4K";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2934 static const char dtlb4k_str[] = "dtlb-4K";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2935 static const char itlb4M_str[] = "itlb-4M";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2936 static const char dtlb4M_str[] = "dtlb-4M";
6334
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2937 static const char dtlb24_str[] = "dtlb0-2M-4M";
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2938 static const char itlb424_str[] = "itlb-4K-2M-4M";
6334
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2939 static const char itlb24_str[] = "itlb-2M-4M";
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2940 static const char dtlb44_str[] = "dtlb-4K-4M";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2941 static const char sl1_dcache_str[] = "sectored-l1-dcache";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2942 static const char sl2_cache_str[] = "sectored-l2-cache";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2943 static const char itrace_str[] = "itrace-cache";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2944 static const char sl3_cache_str[] = "sectored-l3-cache";
6334
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2945 static const char sh_l2_tlb4k_str[] = "shared-l2-tlb-4k";
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2946
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2947 static const struct cachetab {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2948 uint8_t ct_code;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2949 uint8_t ct_assoc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2950 uint16_t ct_line_size;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2951 size_t ct_size;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2952 const char *ct_label;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2953 } intel_ctab[] = {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2954 /* maintain descending order! */
6334
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2955 { 0xe4, 16, 64, 8*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2956 { 0xe3, 16, 64, 4*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2957 { 0xe2, 16, 64, 2*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2958 { 0xde, 12, 64, 6*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2959 { 0xdd, 12, 64, 3*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2960 { 0xdc, 12, 64, ((1*1024*1024)+(512*1024)), l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2961 { 0xd8, 8, 64, 4*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2962 { 0xd7, 8, 64, 2*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2963 { 0xd6, 8, 64, 1*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2964 { 0xd2, 4, 64, 2*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2965 { 0xd1, 4, 64, 1*1024*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2966 { 0xd0, 4, 64, 512*1024, l3_cache_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2967 { 0xca, 4, 0, 512, sh_l2_tlb4k_str},
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2968 { 0xb4, 4, 0, 256, dtlb4k_str },
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2969 { 0xb3, 4, 0, 128, dtlb4k_str },
6334
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2970 { 0xb2, 4, 0, 64, itlb4k_str },
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2971 { 0xb0, 4, 0, 128, itlb4k_str },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2972 { 0x87, 8, 64, 1024*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2973 { 0x86, 4, 64, 512*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2974 { 0x85, 8, 32, 2*1024*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2975 { 0x84, 8, 32, 1024*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2976 { 0x83, 8, 32, 512*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2977 { 0x82, 8, 32, 256*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2978 { 0x7f, 2, 64, 512*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2979 { 0x7d, 8, 64, 2*1024*1024, sl2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2980 { 0x7c, 8, 64, 1024*1024, sl2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2981 { 0x7b, 8, 64, 512*1024, sl2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2982 { 0x7a, 8, 64, 256*1024, sl2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2983 { 0x79, 8, 64, 128*1024, sl2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2984 { 0x78, 8, 64, 1024*1024, l2_cache_str},
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
2985 { 0x73, 8, 0, 64*1024, itrace_str},
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2986 { 0x72, 8, 0, 32*1024, itrace_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2987 { 0x71, 8, 0, 16*1024, itrace_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2988 { 0x70, 8, 0, 12*1024, itrace_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2989 { 0x68, 4, 64, 32*1024, sl1_dcache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2990 { 0x67, 4, 64, 16*1024, sl1_dcache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2991 { 0x66, 4, 64, 8*1024, sl1_dcache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2992 { 0x60, 8, 64, 16*1024, sl1_dcache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2993 { 0x5d, 0, 0, 256, dtlb44_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2994 { 0x5c, 0, 0, 128, dtlb44_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2995 { 0x5b, 0, 0, 64, dtlb44_str},
6334
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2996 { 0x5a, 4, 0, 32, dtlb24_str},
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
2997 { 0x55, 0, 0, 7, itlb24_str},
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2998 { 0x52, 0, 0, 256, itlb424_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2999 { 0x51, 0, 0, 128, itlb424_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3000 { 0x50, 0, 0, 64, itlb424_str},
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3001 { 0x4d, 16, 64, 16*1024*1024, l3_cache_str},
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3002 { 0x4c, 12, 64, 12*1024*1024, l3_cache_str},
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3003 { 0x4b, 16, 64, 8*1024*1024, l3_cache_str},
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3004 { 0x4a, 12, 64, 6*1024*1024, l3_cache_str},
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3005 { 0x49, 16, 64, 4*1024*1024, l3_cache_str},
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3006 { 0x47, 8, 64, 8*1024*1024, l3_cache_str},
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3007 { 0x46, 4, 64, 4*1024*1024, l3_cache_str},
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3008 { 0x45, 4, 32, 2*1024*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3009 { 0x44, 4, 32, 1024*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3010 { 0x43, 4, 32, 512*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3011 { 0x42, 4, 32, 256*1024, l2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3012 { 0x41, 4, 32, 128*1024, l2_cache_str},
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3013 { 0x3e, 4, 64, 512*1024, sl2_cache_str},
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3014 { 0x3d, 6, 64, 384*1024, sl2_cache_str},
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3015 { 0x3c, 4, 64, 256*1024, sl2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3016 { 0x3b, 2, 64, 128*1024, sl2_cache_str},
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3017 { 0x3a, 6, 64, 192*1024, sl2_cache_str},
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3018 { 0x39, 4, 64, 128*1024, sl2_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3019 { 0x30, 8, 64, 32*1024, l1_icache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3020 { 0x2c, 8, 64, 32*1024, l1_dcache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3021 { 0x29, 8, 64, 4096*1024, sl3_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3022 { 0x25, 8, 64, 2048*1024, sl3_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3023 { 0x23, 8, 64, 1024*1024, sl3_cache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3024 { 0x22, 4, 64, 512*1024, sl3_cache_str},
6334
950d3f34a725 6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents: 6317
diff changeset
3025 { 0x0d, 4, 32, 16*1024, l1_dcache_str},
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3026 { 0x0c, 4, 32, 16*1024, l1_dcache_str},
3446
5903aece022d PSARC 2006/469 EOF and removal of eeprom -I
mrj
parents: 3434
diff changeset
3027 { 0x0b, 4, 0, 4, itlb4M_str},
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3028 { 0x0a, 2, 32, 8*1024, l1_dcache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3029 { 0x08, 4, 32, 16*1024, l1_icache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3030 { 0x06, 4, 32, 8*1024, l1_icache_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3031 { 0x04, 4, 0, 8, dtlb4M_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3032 { 0x03, 4, 0, 64, dtlb4k_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3033 { 0x02, 4, 0, 2, itlb4M_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3034 { 0x01, 4, 0, 32, itlb4k_str},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3035 { 0 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3036 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3037
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3038 static const struct cachetab cyrix_ctab[] = {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3039 { 0x70, 4, 0, 32, "tlb-4K" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3040 { 0x80, 4, 16, 16*1024, "l1-cache" },
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3041 { 0 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3042 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3043
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3044 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3045 * Search a cache table for a matching entry
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3046 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3047 static const struct cachetab *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3048 find_cacheent(const struct cachetab *ct, uint_t code)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3049 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3050 if (code != 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3051 for (; ct->ct_code != 0; ct++)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3052 if (ct->ct_code <= code)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3053 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3054 if (ct->ct_code == code)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3055 return (ct);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3056 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3057 return (NULL);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3058 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3059
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3060 /*
5438
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3061 * Populate cachetab entry with L2 or L3 cache-information using
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3062 * cpuid function 4. This function is called from intel_walk_cacheinfo()
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3063 * when descriptor 0x49 is encountered. It returns 0 if no such cache
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3064 * information is found.
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3065 */
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3066 static int
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3067 intel_cpuid_4_cache_info(struct cachetab *ct, struct cpuid_info *cpi)
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3068 {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3069 uint32_t level, i;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3070 int ret = 0;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3071
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3072 for (i = 0; i < cpi->cpi_std_4_size; i++) {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3073 level = CPI_CACHE_LVL(cpi->cpi_std_4[i]);
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3074
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3075 if (level == 2 || level == 3) {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3076 ct->ct_assoc = CPI_CACHE_WAYS(cpi->cpi_std_4[i]) + 1;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3077 ct->ct_line_size =
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3078 CPI_CACHE_COH_LN_SZ(cpi->cpi_std_4[i]) + 1;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3079 ct->ct_size = ct->ct_assoc *
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3080 (CPI_CACHE_PARTS(cpi->cpi_std_4[i]) + 1) *
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3081 ct->ct_line_size *
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3082 (cpi->cpi_std_4[i]->cp_ecx + 1);
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3083
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3084 if (level == 2) {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3085 ct->ct_label = l2_cache_str;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3086 } else if (level == 3) {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3087 ct->ct_label = l3_cache_str;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3088 }
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3089 ret = 1;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3090 }
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3091 }
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3092
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3093 return (ret);
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3094 }
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3095
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3096 /*
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3097 * Walk the cacheinfo descriptor, applying 'func' to every valid element
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3098 * The walk is terminated if the walker returns non-zero.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3099 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3100 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3101 intel_walk_cacheinfo(struct cpuid_info *cpi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3102 void *arg, int (*func)(void *, const struct cachetab *))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3103 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3104 const struct cachetab *ct;
5438
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3105 struct cachetab des_49_ct;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3106 uint8_t *dp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3107 int i;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3108
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3109 if ((dp = cpi->cpi_cacheinfo) == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3110 return;
4797
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3111 for (i = 0; i < cpi->cpi_ncache; i++, dp++) {
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3112 /*
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3113 * For overloaded descriptor 0x49 we use cpuid function 4
5438
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3114 * if supported by the current processor, to create
4797
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3115 * cache information.
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3116 */
5438
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3117 if (*dp == 0x49 && cpi->cpi_maxeax >= 0x4 &&
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3118 intel_cpuid_4_cache_info(&des_49_ct, cpi) == 1) {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3119 ct = &des_49_ct;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3120 } else {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3121 if ((ct = find_cacheent(intel_ctab, *dp)) == NULL) {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3122 continue;
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3123 }
4797
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3124 }
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3125
5438
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3126 if (func(arg, ct) != 0) {
41d8edfa90d7 6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents: 5349
diff changeset
3127 break;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3128 }
4797
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3129 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3130 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3131
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3132 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3133 * (Like the Intel one, except for Cyrix CPUs)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3134 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3135 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3136 cyrix_walk_cacheinfo(struct cpuid_info *cpi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3137 void *arg, int (*func)(void *, const struct cachetab *))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3138 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3139 const struct cachetab *ct;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3140 uint8_t *dp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3141 int i;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3142
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3143 if ((dp = cpi->cpi_cacheinfo) == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3144 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3145 for (i = 0; i < cpi->cpi_ncache; i++, dp++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3146 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3147 * Search Cyrix-specific descriptor table first ..
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3148 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3149 if ((ct = find_cacheent(cyrix_ctab, *dp)) != NULL) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3150 if (func(arg, ct) != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3151 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3152 continue;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3153 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3154 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3155 * .. else fall back to the Intel one
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3156 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3157 if ((ct = find_cacheent(intel_ctab, *dp)) != NULL) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3158 if (func(arg, ct) != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3159 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3160 continue;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3161 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3162 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3163 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3164
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3165 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3166 * A cacheinfo walker that adds associativity, line-size, and size properties
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3167 * to the devinfo node it is passed as an argument.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3168 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3169 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3170 add_cacheent_props(void *arg, const struct cachetab *ct)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3171 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3172 dev_info_t *devi = arg;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3173
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3174 add_cache_prop(devi, ct->ct_label, assoc_str, ct->ct_assoc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3175 if (ct->ct_line_size != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3176 add_cache_prop(devi, ct->ct_label, line_str,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3177 ct->ct_line_size);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3178 add_cache_prop(devi, ct->ct_label, size_str, ct->ct_size);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3179 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3180 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3181
4797
2ebe22df4dfc 6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents: 4636
diff changeset
3182
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3183 static const char fully_assoc[] = "fully-associative?";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3184
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3185 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3186 * AMD style cache/tlb description
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3187 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3188 * Extended functions 5 and 6 directly describe properties of
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3189 * tlbs and various cache levels.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3190 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3191 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3192 add_amd_assoc(dev_info_t *devi, const char *label, uint_t assoc)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3193 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3194 switch (assoc) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3195 case 0: /* reserved; ignore */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3196 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3197 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3198 add_cache_prop(devi, label, assoc_str, assoc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3199 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3200 case 0xff:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3201 add_cache_prop(devi, label, fully_assoc, 1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3202 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3203 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3204 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3205
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3206 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3207 add_amd_tlb(dev_info_t *devi, const char *label, uint_t assoc, uint_t size)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3208 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3209 if (size == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3210 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3211 add_cache_prop(devi, label, size_str, size);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3212 add_amd_assoc(devi, label, assoc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3213 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3214
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3215 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3216 add_amd_cache(dev_info_t *devi, const char *label,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3217 uint_t size, uint_t assoc, uint_t lines_per_tag, uint_t line_size)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3218 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3219 if (size == 0 || line_size == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3220 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3221 add_amd_assoc(devi, label, assoc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3222 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3223 * Most AMD parts have a sectored cache. Multiple cache lines are
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3224 * associated with each tag. A sector consists of all cache lines
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3225 * associated with a tag. For example, the AMD K6-III has a sector
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3226 * size of 2 cache lines per tag.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3227 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3228 if (lines_per_tag != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3229 add_cache_prop(devi, label, "lines-per-tag", lines_per_tag);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3230 add_cache_prop(devi, label, line_str, line_size);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3231 add_cache_prop(devi, label, size_str, size * 1024);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3232 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3233
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3234 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3235 add_amd_l2_assoc(dev_info_t *devi, const char *label, uint_t assoc)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3236 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3237 switch (assoc) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3238 case 0: /* off */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3239 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3240 case 1:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3241 case 2:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3242 case 4:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3243 add_cache_prop(devi, label, assoc_str, assoc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3244 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3245 case 6:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3246 add_cache_prop(devi, label, assoc_str, 8);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3247 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3248 case 8:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3249 add_cache_prop(devi, label, assoc_str, 16);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3250 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3251 case 0xf:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3252 add_cache_prop(devi, label, fully_assoc, 1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3253 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3254 default: /* reserved; ignore */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3255 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3256 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3257 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3258
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3259 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3260 add_amd_l2_tlb(dev_info_t *devi, const char *label, uint_t assoc, uint_t size)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3261 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3262 if (size == 0 || assoc == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3263 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3264 add_amd_l2_assoc(devi, label, assoc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3265 add_cache_prop(devi, label, size_str, size);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3266 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3267
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3268 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3269 add_amd_l2_cache(dev_info_t *devi, const char *label,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3270 uint_t size, uint_t assoc, uint_t lines_per_tag, uint_t line_size)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3271 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3272 if (size == 0 || assoc == 0 || line_size == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3273 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3274 add_amd_l2_assoc(devi, label, assoc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3275 if (lines_per_tag != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3276 add_cache_prop(devi, label, "lines-per-tag", lines_per_tag);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3277 add_cache_prop(devi, label, line_str, line_size);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3278 add_cache_prop(devi, label, size_str, size * 1024);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3279 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3280
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3281 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3282 amd_cache_info(struct cpuid_info *cpi, dev_info_t *devi)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3283 {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
3284 struct cpuid_regs *cp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3285
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3286 if (cpi->cpi_xmaxeax < 0x80000005)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3287 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3288 cp = &cpi->cpi_extd[5];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3289
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3290 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3291 * 4M/2M L1 TLB configuration
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3292 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3293 * We report the size for 2M pages because AMD uses two
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3294 * TLB entries for one 4M page.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3295 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3296 add_amd_tlb(devi, "dtlb-2M",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3297 BITX(cp->cp_eax, 31, 24), BITX(cp->cp_eax, 23, 16));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3298 add_amd_tlb(devi, "itlb-2M",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3299 BITX(cp->cp_eax, 15, 8), BITX(cp->cp_eax, 7, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3300
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3301 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3302 * 4K L1 TLB configuration
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3303 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3304
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3305 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3306 uint_t nentries;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3307 case X86_VENDOR_TM:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3308 if (cpi->cpi_family >= 5) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3309 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3310 * Crusoe processors have 256 TLB entries, but
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3311 * cpuid data format constrains them to only
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3312 * reporting 255 of them.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3313 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3314 if ((nentries = BITX(cp->cp_ebx, 23, 16)) == 255)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3315 nentries = 256;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3316 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3317 * Crusoe processors also have a unified TLB
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3318 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3319 add_amd_tlb(devi, "tlb-4K", BITX(cp->cp_ebx, 31, 24),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3320 nentries);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3321 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3322 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3323 /*FALLTHROUGH*/
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3324 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3325 add_amd_tlb(devi, itlb4k_str,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3326 BITX(cp->cp_ebx, 31, 24), BITX(cp->cp_ebx, 23, 16));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3327 add_amd_tlb(devi, dtlb4k_str,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3328 BITX(cp->cp_ebx, 15, 8), BITX(cp->cp_ebx, 7, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3329 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3330 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3331
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3332 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3333 * data L1 cache configuration
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3334 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3335
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3336 add_amd_cache(devi, l1_dcache_str,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3337 BITX(cp->cp_ecx, 31, 24), BITX(cp->cp_ecx, 23, 16),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3338 BITX(cp->cp_ecx, 15, 8), BITX(cp->cp_ecx, 7, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3339
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3340 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3341 * code L1 cache configuration
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3342 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3343
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3344 add_amd_cache(devi, l1_icache_str,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3345 BITX(cp->cp_edx, 31, 24), BITX(cp->cp_edx, 23, 16),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3346 BITX(cp->cp_edx, 15, 8), BITX(cp->cp_edx, 7, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3347
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3348 if (cpi->cpi_xmaxeax < 0x80000006)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3349 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3350 cp = &cpi->cpi_extd[6];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3351
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3352 /* Check for a unified L2 TLB for large pages */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3353
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3354 if (BITX(cp->cp_eax, 31, 16) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3355 add_amd_l2_tlb(devi, "l2-tlb-2M",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3356 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3357 else {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3358 add_amd_l2_tlb(devi, "l2-dtlb-2M",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3359 BITX(cp->cp_eax, 31, 28), BITX(cp->cp_eax, 27, 16));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3360 add_amd_l2_tlb(devi, "l2-itlb-2M",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3361 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3362 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3363
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3364 /* Check for a unified L2 TLB for 4K pages */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3365
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3366 if (BITX(cp->cp_ebx, 31, 16) == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3367 add_amd_l2_tlb(devi, "l2-tlb-4K",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3368 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3369 } else {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3370 add_amd_l2_tlb(devi, "l2-dtlb-4K",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3371 BITX(cp->cp_eax, 31, 28), BITX(cp->cp_eax, 27, 16));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3372 add_amd_l2_tlb(devi, "l2-itlb-4K",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3373 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3374 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3375
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3376 add_amd_l2_cache(devi, l2_cache_str,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3377 BITX(cp->cp_ecx, 31, 16), BITX(cp->cp_ecx, 15, 12),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3378 BITX(cp->cp_ecx, 11, 8), BITX(cp->cp_ecx, 7, 0));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3379 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3380
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3381 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3382 * There are two basic ways that the x86 world describes it cache
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3383 * and tlb architecture - Intel's way and AMD's way.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3384 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3385 * Return which flavor of cache architecture we should use
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3386 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3387 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3388 x86_which_cacheinfo(struct cpuid_info *cpi)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3389 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3390 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3391 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3392 if (cpi->cpi_maxeax >= 2)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3393 return (X86_VENDOR_Intel);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3394 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3395 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3396 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3397 * The K5 model 1 was the first part from AMD that reported
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3398 * cache sizes via extended cpuid functions.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3399 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3400 if (cpi->cpi_family > 5 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3401 (cpi->cpi_family == 5 && cpi->cpi_model >= 1))
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3402 return (X86_VENDOR_AMD);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3403 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3404 case X86_VENDOR_TM:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3405 if (cpi->cpi_family >= 5)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3406 return (X86_VENDOR_AMD);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3407 /*FALLTHROUGH*/
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3408 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3409 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3410 * If they have extended CPU data for 0x80000005
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3411 * then we assume they have AMD-format cache
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3412 * information.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3413 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3414 * If not, and the vendor happens to be Cyrix,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3415 * then try our-Cyrix specific handler.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3416 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3417 * If we're not Cyrix, then assume we're using Intel's
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3418 * table-driven format instead.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3419 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3420 if (cpi->cpi_xmaxeax >= 0x80000005)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3421 return (X86_VENDOR_AMD);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3422 else if (cpi->cpi_vendor == X86_VENDOR_Cyrix)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3423 return (X86_VENDOR_Cyrix);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3424 else if (cpi->cpi_maxeax >= 2)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3425 return (X86_VENDOR_Intel);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3426 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3427 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3428 return (-1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3429 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3430
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3431 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3432 * create a node for the given cpu under the prom root node.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3433 * Also, create a cpu node in the device tree.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3434 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3435 static dev_info_t *cpu_nex_devi = NULL;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3436 static kmutex_t cpu_node_lock;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3437
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3438 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3439 * Called from post_startup() and mp_startup()
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3440 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3441 void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3442 add_cpunode2devtree(processorid_t cpu_id, struct cpuid_info *cpi)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3443 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3444 dev_info_t *cpu_devi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3445 int create;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3446
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3447 mutex_enter(&cpu_node_lock);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3448
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3449 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3450 * create a nexus node for all cpus identified as 'cpu_id' under
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3451 * the root node.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3452 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3453 if (cpu_nex_devi == NULL) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3454 if (ndi_devi_alloc(ddi_root_node(), "cpus",
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents: 771
diff changeset
3455 (pnode_t)DEVI_SID_NODEID, &cpu_nex_devi) != NDI_SUCCESS) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3456 mutex_exit(&cpu_node_lock);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3457 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3458 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3459 (void) ndi_devi_online(cpu_nex_devi, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3460 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3461
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3462 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3463 * create a child node for cpu identified as 'cpu_id'
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3464 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3465 cpu_devi = ddi_add_child(cpu_nex_devi, "cpu", DEVI_SID_NODEID,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3466 cpu_id);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3467 if (cpu_devi == NULL) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3468 mutex_exit(&cpu_node_lock);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3469 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3470 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3471
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3472 /* device_type */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3473
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3474 (void) ndi_prop_update_string(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3475 "device_type", "cpu");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3476
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3477 /* reg */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3478
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3479 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3480 "reg", cpu_id);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3481
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3482 /* cpu-mhz, and clock-frequency */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3483
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3484 if (cpu_freq > 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3485 long long mul;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3486
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3487 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3488 "cpu-mhz", cpu_freq);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3489
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3490 if ((mul = cpu_freq * 1000000LL) <= INT_MAX)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3491 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3492 "clock-frequency", (int)mul);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3493 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3494
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3495 (void) ndi_devi_online(cpu_devi, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3496
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3497 if ((x86_feature & X86_CPUID) == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3498 mutex_exit(&cpu_node_lock);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3499 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3500 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3501
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3502 /* vendor-id */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3503
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3504 (void) ndi_prop_update_string(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3505 "vendor-id", cpi->cpi_vendorstr);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3506
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3507 if (cpi->cpi_maxeax == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3508 mutex_exit(&cpu_node_lock);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3509 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3510 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3511
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3512 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3513 * family, model, and step
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3514 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3515 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3516 "family", CPI_FAMILY(cpi));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3517 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3518 "cpu-model", CPI_MODEL(cpi));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3519 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3520 "stepping-id", CPI_STEP(cpi));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3521
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3522 /* type */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3523
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3524 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3525 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3526 create = 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3527 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3528 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3529 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3530 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3531 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3532 if (create)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3533 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3534 "type", CPI_TYPE(cpi));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3535
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3536 /* ext-family */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3537
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3538 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3539 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3540 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3541 create = cpi->cpi_family >= 0xf;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3542 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3543 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3544 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3545 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3546 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3547 if (create)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3548 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3549 "ext-family", CPI_FAMILY_XTD(cpi));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3550
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3551 /* ext-model */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3552
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3553 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3554 case X86_VENDOR_Intel:
6317
8afb524fc268 6667600 Incomplete initialization of cpi_cacheinfo field of struct cpuid_info
kk208521
parents: 5870
diff changeset
3555 create = IS_EXTENDED_MODEL_INTEL(cpi);
2001
427a702b03e2 6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents: 1975
diff changeset
3556 break;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3557 case X86_VENDOR_AMD:
1582
eb879d43ab47 6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents: 1414
diff changeset
3558 create = CPI_FAMILY(cpi) == 0xf;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3559 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3560 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3561 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3562 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3563 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3564 if (create)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3565 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3566 "ext-model", CPI_MODEL_XTD(cpi));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3567
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3568 /* generation */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3569
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3570 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3571 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3572 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3573 * AMD K5 model 1 was the first part to support this
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3574 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3575 create = cpi->cpi_xmaxeax >= 0x80000001;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3576 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3577 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3578 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3579 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3580 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3581 if (create)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3582 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3583 "generation", BITX((cpi)->cpi_extd[1].cp_eax, 11, 8));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3584
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3585 /* brand-id */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3586
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3587 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3588 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3589 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3590 * brand id first appeared on Pentium III Xeon model 8,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3591 * and Celeron model 8 processors and Opteron
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3592 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3593 create = cpi->cpi_family > 6 ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3594 (cpi->cpi_family == 6 && cpi->cpi_model >= 8);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3595 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3596 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3597 create = cpi->cpi_family >= 0xf;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3598 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3599 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3600 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3601 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3602 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3603 if (create && cpi->cpi_brandid != 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3604 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3605 "brand-id", cpi->cpi_brandid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3606 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3607
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3608 /* chunks, and apic-id */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3609
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3610 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3611 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3612 * first available on Pentium IV and Opteron (K8)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3613 */
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3614 case X86_VENDOR_Intel:
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3615 create = IS_NEW_F6(cpi) || cpi->cpi_family >= 0xf;
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3616 break;
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3617 case X86_VENDOR_AMD:
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3618 create = cpi->cpi_family >= 0xf;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3619 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3620 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3621 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3622 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3623 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3624 if (create) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3625 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3626 "chunks", CPI_CHUNKS(cpi));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3627 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3628 "apic-id", CPI_APIC_ID(cpi));
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents: 1228
diff changeset
3629 if (cpi->cpi_chipid >= 0) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3630 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3631 "chip#", cpi->cpi_chipid);
1414
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents: 1228
diff changeset
3632 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents: 1228
diff changeset
3633 "clog#", cpi->cpi_clogid);
b4126407ac5b PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents: 1228
diff changeset
3634 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3635 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3636
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3637 /* cpuid-features */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3638
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3639 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3640 "cpuid-features", CPI_FEATURES_EDX(cpi));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3641
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3642
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3643 /* cpuid-features-ecx */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3644
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3645 switch (cpi->cpi_vendor) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3646 case X86_VENDOR_Intel:
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3647 create = IS_NEW_F6(cpi) || cpi->cpi_family >= 0xf;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3648 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3649 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3650 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3651 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3652 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3653 if (create)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3654 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3655 "cpuid-features-ecx", CPI_FEATURES_ECX(cpi));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3656
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3657 /* ext-cpuid-features */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3658
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3659 switch (cpi->cpi_vendor) {
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3660 case X86_VENDOR_Intel:
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3661 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3662 case X86_VENDOR_Cyrix:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3663 case X86_VENDOR_TM:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3664 case X86_VENDOR_Centaur:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3665 create = cpi->cpi_xmaxeax >= 0x80000001;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3666 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3667 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3668 create = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3669 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3670 }
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3671 if (create) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3672 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3673 "ext-cpuid-features", CPI_FEATURES_XTD_EDX(cpi));
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3674 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi,
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3675 "ext-cpuid-features-ecx", CPI_FEATURES_XTD_ECX(cpi));
1975
7490b056500b 6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents: 1727
diff changeset
3676 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3677
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3678 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3679 * Brand String first appeared in Intel Pentium IV, AMD K5
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3680 * model 1, and Cyrix GXm. On earlier models we try and
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3681 * simulate something similar .. so this string should always
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3682 * same -something- about the processor, however lame.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3683 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3684 (void) ndi_prop_update_string(DDI_DEV_T_NONE, cpu_devi,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3685 "brand-string", cpi->cpi_brandstr);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3686
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3687 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3688 * Finally, cache and tlb information
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3689 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3690 switch (x86_which_cacheinfo(cpi)) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3691 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3692 intel_walk_cacheinfo(cpi, cpu_devi, add_cacheent_props);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3693 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3694 case X86_VENDOR_Cyrix:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3695 cyrix_walk_cacheinfo(cpi, cpu_devi, add_cacheent_props);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3696 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3697 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3698 amd_cache_info(cpi, cpu_devi);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3699 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3700 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3701 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3702 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3703
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3704 mutex_exit(&cpu_node_lock);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3705 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3706
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3707 struct l2info {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3708 int *l2i_csz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3709 int *l2i_lsz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3710 int *l2i_assoc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3711 int l2i_ret;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3712 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3713
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3714 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3715 * A cacheinfo walker that fetches the size, line-size and associativity
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3716 * of the L2 cache
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3717 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3718 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3719 intel_l2cinfo(void *arg, const struct cachetab *ct)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3720 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3721 struct l2info *l2i = arg;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3722 int *ip;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3723
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3724 if (ct->ct_label != l2_cache_str &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3725 ct->ct_label != sl2_cache_str)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3726 return (0); /* not an L2 -- keep walking */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3727
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3728 if ((ip = l2i->l2i_csz) != NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3729 *ip = ct->ct_size;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3730 if ((ip = l2i->l2i_lsz) != NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3731 *ip = ct->ct_line_size;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3732 if ((ip = l2i->l2i_assoc) != NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3733 *ip = ct->ct_assoc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3734 l2i->l2i_ret = ct->ct_size;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3735 return (1); /* was an L2 -- terminate walk */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3736 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3737
5070
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3738 /*
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3739 * AMD L2/L3 Cache and TLB Associativity Field Definition:
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3740 *
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3741 * Unlike the associativity for the L1 cache and tlb where the 8 bit
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3742 * value is the associativity, the associativity for the L2 cache and
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3743 * tlb is encoded in the following table. The 4 bit L2 value serves as
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3744 * an index into the amd_afd[] array to determine the associativity.
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3745 * -1 is undefined. 0 is fully associative.
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3746 */
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3747
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3748 static int amd_afd[] =
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3749 {-1, 1, 2, -1, 4, -1, 8, -1, 16, -1, 32, 48, 64, 96, 128, 0};
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3750
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3751 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3752 amd_l2cacheinfo(struct cpuid_info *cpi, struct l2info *l2i)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3753 {
1228
9e051e1a3f68 6282049 CMT update needed for x86 CPU detection
andrei
parents: 938
diff changeset
3754 struct cpuid_regs *cp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3755 uint_t size, assoc;
5070
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3756 int i;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3757 int *ip;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3758
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3759 if (cpi->cpi_xmaxeax < 0x80000006)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3760 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3761 cp = &cpi->cpi_extd[6];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3762
5070
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3763 if ((i = BITX(cp->cp_ecx, 15, 12)) != 0 &&
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3764 (size = BITX(cp->cp_ecx, 31, 16)) != 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3765 uint_t cachesz = size * 1024;
5070
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3766 assoc = amd_afd[i];
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3767
f1c8fa0cbaca 6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents: 5045
diff changeset
3768 ASSERT(assoc != -1);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3769
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3770 if ((ip = l2i->l2i_csz) != NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3771 *ip = cachesz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3772 if ((ip = l2i->l2i_lsz) != NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3773 *ip = BITX(cp->cp_ecx, 7, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3774 if ((ip = l2i->l2i_assoc) != NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3775 *ip = assoc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3776 l2i->l2i_ret = cachesz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3777 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3778 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3779
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3780 int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3781 getl2cacheinfo(cpu_t *cpu, int *csz, int *lsz, int *assoc)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3782 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3783 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3784 struct l2info __l2info, *l2i = &__l2info;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3785
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3786 l2i->l2i_csz = csz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3787 l2i->l2i_lsz = lsz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3788 l2i->l2i_assoc = assoc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3789 l2i->l2i_ret = -1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3790
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3791 switch (x86_which_cacheinfo(cpi)) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3792 case X86_VENDOR_Intel:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3793 intel_walk_cacheinfo(cpi, l2i, intel_l2cinfo);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3794 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3795 case X86_VENDOR_Cyrix:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3796 cyrix_walk_cacheinfo(cpi, l2i, intel_l2cinfo);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3797 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3798 case X86_VENDOR_AMD:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3799 amd_l2cacheinfo(cpi, l2i);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3800 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3801 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3802 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3803 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3804 return (l2i->l2i_ret);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3805 }
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3806
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
3807 #if !defined(__xpv)
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
3808
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3809 uint32_t *
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3810 cpuid_mwait_alloc(cpu_t *cpu)
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3811 {
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3812 uint32_t *ret;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3813 size_t mwait_size;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3814
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3815 ASSERT(cpuid_checkpass(cpu, 2));
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3816
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3817 mwait_size = cpu->cpu_m.mcpu_cpi->cpi_mwait.mon_max;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3818 if (mwait_size == 0)
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3819 return (NULL);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3820
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3821 /*
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3822 * kmem_alloc() returns cache line size aligned data for mwait_size
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3823 * allocations. mwait_size is currently cache line sized. Neither
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3824 * of these implementation details are guarantied to be true in the
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3825 * future.
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3826 *
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3827 * First try allocating mwait_size as kmem_alloc() currently returns
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3828 * correctly aligned memory. If kmem_alloc() does not return
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3829 * mwait_size aligned memory, then use mwait_size ROUNDUP.
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3830 *
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3831 * Set cpi_mwait.buf_actual and cpi_mwait.size_actual in case we
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3832 * decide to free this memory.
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3833 */
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3834 ret = kmem_zalloc(mwait_size, KM_SLEEP);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3835 if (ret == (uint32_t *)P2ROUNDUP((uintptr_t)ret, mwait_size)) {
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3836 cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual = ret;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3837 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual = mwait_size;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3838 *ret = MWAIT_RUNNING;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3839 return (ret);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3840 } else {
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3841 kmem_free(ret, mwait_size);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3842 ret = kmem_zalloc(mwait_size * 2, KM_SLEEP);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3843 cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual = ret;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3844 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual = mwait_size * 2;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3845 ret = (uint32_t *)P2ROUNDUP((uintptr_t)ret, mwait_size);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3846 *ret = MWAIT_RUNNING;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3847 return (ret);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3848 }
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3849 }
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3850
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3851 void
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3852 cpuid_mwait_free(cpu_t *cpu)
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3853 {
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3854 ASSERT(cpuid_checkpass(cpu, 2));
5045
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3855
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3856 if (cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual != NULL &&
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3857 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual > 0) {
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3858 kmem_free(cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual,
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3859 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual);
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3860 }
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3861
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3862 cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual = NULL;
75a798a98460 6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents: 4858
diff changeset
3863 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual = 0;
4481
2bb321aaf3c3 6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents: 4265
diff changeset
3864 }
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
3865
5322
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3866 void
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3867 patch_tsc_read(int flag)
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3868 {
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3869 size_t cnt;
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3870 switch (flag) {
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3871 case X86_NO_TSC:
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3872 cnt = &_no_rdtsc_end - &_no_rdtsc_start;
5338
fd7cad8433cf 6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents: 5322
diff changeset
3873 (void) memcpy((void *)tsc_read, (void *)&_no_rdtsc_start, cnt);
5322
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3874 break;
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3875 case X86_HAVE_TSCP:
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3876 cnt = &_tscp_end - &_tscp_start;
5338
fd7cad8433cf 6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents: 5322
diff changeset
3877 (void) memcpy((void *)tsc_read, (void *)&_tscp_start, cnt);
5322
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3878 break;
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3879 case X86_TSC_MFENCE:
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3880 cnt = &_tsc_mfence_end - &_tsc_mfence_start;
5338
fd7cad8433cf 6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents: 5322
diff changeset
3881 (void) memcpy((void *)tsc_read,
fd7cad8433cf 6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents: 5322
diff changeset
3882 (void *)&_tsc_mfence_start, cnt);
5322
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3883 break;
6642
c41a8f6eba0e 6671782 rdtsc synchronization change for Intel processors
sudheer
parents: 6445
diff changeset
3884 case X86_TSC_LFENCE:
c41a8f6eba0e 6671782 rdtsc synchronization change for Intel processors
sudheer
parents: 6445
diff changeset
3885 cnt = &_tsc_lfence_end - &_tsc_lfence_start;
c41a8f6eba0e 6671782 rdtsc synchronization change for Intel processors
sudheer
parents: 6445
diff changeset
3886 (void) memcpy((void *)tsc_read,
c41a8f6eba0e 6671782 rdtsc synchronization change for Intel processors
sudheer
parents: 6445
diff changeset
3887 (void *)&_tsc_lfence_start, cnt);
c41a8f6eba0e 6671782 rdtsc synchronization change for Intel processors
sudheer
parents: 6445
diff changeset
3888 break;
5322
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3889 default:
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3890 break;
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3891 }
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3892 }
010e79fdab36 6600939 gethrtime sometimes return a large time value into the future
sudheer
parents: 5284
diff changeset
3893
5084
7d838c5c0eed PSARC 2006/260 Solaris on Xen
johnlev
parents: 5070
diff changeset
3894 #endif /* !__xpv */