]>
Commit | Line | Data |
---|---|---|
55e303ae | 1 | /* |
316670eb | 2 | * Copyright (c) 2003-2011 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
55e303ae | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
55e303ae A |
27 | */ |
28 | ||
91447636 | 29 | #include <string.h> |
55e303ae A |
30 | #include <sys/param.h> |
31 | #include <sys/kernel.h> | |
32 | #include <sys/sysctl.h> | |
33 | #include <i386/cpuid.h> | |
593a1d5f | 34 | #include <i386/tsc.h> |
060df5ea | 35 | #include <i386/machine_routines.h> |
bd504ef0 | 36 | #include <i386/pal_routines.h> |
6d2010ae A |
37 | #include <i386/ucode.h> |
38 | #include <kern/clock.h> | |
39 | #include <libkern/libkern.h> | |
316670eb | 40 | #include <i386/lapic.h> |
bd504ef0 | 41 | |
55e303ae A |
42 | |
43 | static int | |
7e4a7d39 | 44 | _i386_cpu_info SYSCTL_HANDLER_ARGS |
55e303ae | 45 | { |
91447636 | 46 | __unused struct sysctl_oid *unused_oidp = oidp; |
7e4a7d39 | 47 | void *ptr = arg1; |
55e303ae A |
48 | int value; |
49 | ||
91447636 | 50 | if (arg2 == -1) { |
b0d623f7 | 51 | ptr = *(void **)ptr; |
91447636 A |
52 | arg2 = 0; |
53 | } | |
54 | ||
55 | if (arg2 == 0 && ((char *)ptr)[0] == '\0') { | |
56 | return ENOENT; | |
57 | } | |
55e303ae A |
58 | |
59 | if (arg2 == sizeof(uint8_t)) { | |
60 | value = (uint32_t) *(uint8_t *)ptr; | |
61 | ptr = &value; | |
62 | arg2 = sizeof(uint32_t); | |
63 | } | |
91447636 | 64 | return SYSCTL_OUT(req, ptr, arg2 ? (size_t) arg2 : strlen((char *)ptr)+1); |
55e303ae A |
65 | } |
66 | ||
b0d623f7 | 67 | static int |
7e4a7d39 | 68 | i386_cpu_info SYSCTL_HANDLER_ARGS |
b0d623f7 | 69 | { |
7e4a7d39 A |
70 | void *ptr = (uint8_t *)cpuid_info() + (uintptr_t)arg1; |
71 | return _i386_cpu_info(oidp, ptr, arg2, req); | |
72 | } | |
73 | ||
74 | static int | |
75 | i386_cpu_info_nonzero SYSCTL_HANDLER_ARGS | |
76 | { | |
77 | void *ptr = (uint8_t *)cpuid_info() + (uintptr_t)arg1; | |
b0d623f7 A |
78 | int value = *(uint32_t *)ptr; |
79 | ||
80 | if (value == 0) | |
81 | return ENOENT; | |
82 | ||
7e4a7d39 A |
83 | return _i386_cpu_info(oidp, ptr, arg2, req); |
84 | } | |
85 | static int | |
86 | cpu_mwait SYSCTL_HANDLER_ARGS | |
87 | { | |
88 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
89 | void *ptr = (uint8_t *)cpu_info->cpuid_mwait_leafp + (uintptr_t)arg1; | |
90 | if (cpu_info->cpuid_mwait_leafp == NULL) | |
91 | return ENOENT; | |
92 | return _i386_cpu_info(oidp, ptr, arg2, req); | |
93 | } | |
94 | ||
95 | static int | |
96 | cpu_thermal SYSCTL_HANDLER_ARGS | |
97 | { | |
98 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
99 | void *ptr = (uint8_t *)cpu_info->cpuid_thermal_leafp + (uintptr_t)arg1; | |
100 | if (cpu_info->cpuid_thermal_leafp == NULL) | |
101 | return ENOENT; | |
102 | return _i386_cpu_info(oidp, ptr, arg2, req); | |
103 | } | |
104 | ||
105 | static int | |
106 | cpu_arch_perf SYSCTL_HANDLER_ARGS | |
107 | { | |
108 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
109 | void *ptr = (uint8_t *)cpu_info->cpuid_arch_perf_leafp + (uintptr_t)arg1; | |
110 | if (cpu_info->cpuid_arch_perf_leafp == NULL) | |
111 | return ENOENT; | |
112 | return _i386_cpu_info(oidp, ptr, arg2, req); | |
b0d623f7 A |
113 | } |
114 | ||
060df5ea A |
115 | static int |
116 | cpu_xsave SYSCTL_HANDLER_ARGS | |
117 | { | |
118 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
119 | void *ptr = (uint8_t *)cpu_info->cpuid_xsave_leafp + (uintptr_t)arg1; | |
120 | if (cpu_info->cpuid_xsave_leafp == NULL) | |
121 | return ENOENT; | |
122 | return _i386_cpu_info(oidp, ptr, arg2, req); | |
123 | } | |
124 | ||
316670eb | 125 | |
55e303ae | 126 | static int |
7e4a7d39 | 127 | cpu_features SYSCTL_HANDLER_ARGS |
55e303ae | 128 | { |
91447636 A |
129 | __unused struct sysctl_oid *unused_oidp = oidp; |
130 | __unused void *unused_arg1 = arg1; | |
131 | __unused int unused_arg2 = arg2; | |
060df5ea | 132 | char buf[512]; |
55e303ae | 133 | |
55e303ae | 134 | buf[0] = '\0'; |
91447636 | 135 | cpuid_get_feature_names(cpuid_features(), buf, sizeof(buf)); |
55e303ae A |
136 | |
137 | return SYSCTL_OUT(req, buf, strlen(buf) + 1); | |
138 | } | |
139 | ||
0c530ab8 | 140 | static int |
7e4a7d39 | 141 | cpu_extfeatures SYSCTL_HANDLER_ARGS |
0c530ab8 A |
142 | { |
143 | __unused struct sysctl_oid *unused_oidp = oidp; | |
144 | __unused void *unused_arg1 = arg1; | |
145 | __unused int unused_arg2 = arg2; | |
060df5ea | 146 | char buf[512]; |
0c530ab8 A |
147 | |
148 | buf[0] = '\0'; | |
149 | cpuid_get_extfeature_names(cpuid_extfeatures(), buf, sizeof(buf)); | |
150 | ||
151 | return SYSCTL_OUT(req, buf, strlen(buf) + 1); | |
152 | } | |
153 | ||
13f56ec4 A |
154 | static int |
155 | cpu_leaf7_features SYSCTL_HANDLER_ARGS | |
156 | { | |
157 | __unused struct sysctl_oid *unused_oidp = oidp; | |
158 | __unused void *unused_arg1 = arg1; | |
159 | __unused int unused_arg2 = arg2; | |
160 | char buf[512]; | |
161 | ||
162 | uint32_t leaf7_features = cpuid_info()->cpuid_leaf7_features; | |
163 | if (leaf7_features == 0) | |
164 | return ENOENT; | |
165 | ||
166 | buf[0] = '\0'; | |
167 | cpuid_get_leaf7_feature_names(leaf7_features, buf, sizeof(buf)); | |
168 | ||
169 | return SYSCTL_OUT(req, buf, strlen(buf) + 1); | |
170 | } | |
171 | ||
2d21ac55 | 172 | static int |
7e4a7d39 | 173 | cpu_logical_per_package SYSCTL_HANDLER_ARGS |
2d21ac55 A |
174 | { |
175 | __unused struct sysctl_oid *unused_oidp = oidp; | |
176 | __unused void *unused_arg1 = arg1; | |
177 | __unused int unused_arg2 = arg2; | |
178 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
179 | ||
180 | if (!(cpuid_features() & CPUID_FEATURE_HTT)) | |
181 | return ENOENT; | |
182 | ||
183 | return SYSCTL_OUT(req, &cpu_info->cpuid_logical_per_package, | |
184 | sizeof(cpu_info->cpuid_logical_per_package)); | |
185 | } | |
186 | ||
c910b4d9 | 187 | static int |
7e4a7d39 | 188 | cpu_flex_ratio_desired SYSCTL_HANDLER_ARGS |
c910b4d9 A |
189 | { |
190 | __unused struct sysctl_oid *unused_oidp = oidp; | |
191 | __unused void *unused_arg1 = arg1; | |
192 | __unused int unused_arg2 = arg2; | |
193 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
194 | ||
195 | if (cpu_info->cpuid_model != 26) | |
196 | return ENOENT; | |
197 | ||
198 | return SYSCTL_OUT(req, &flex_ratio, sizeof(flex_ratio)); | |
199 | } | |
200 | ||
201 | static int | |
7e4a7d39 | 202 | cpu_flex_ratio_min SYSCTL_HANDLER_ARGS |
c910b4d9 A |
203 | { |
204 | __unused struct sysctl_oid *unused_oidp = oidp; | |
205 | __unused void *unused_arg1 = arg1; | |
206 | __unused int unused_arg2 = arg2; | |
207 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
208 | ||
209 | if (cpu_info->cpuid_model != 26) | |
210 | return ENOENT; | |
211 | ||
212 | return SYSCTL_OUT(req, &flex_ratio_min, sizeof(flex_ratio_min)); | |
213 | } | |
214 | ||
215 | static int | |
7e4a7d39 | 216 | cpu_flex_ratio_max SYSCTL_HANDLER_ARGS |
c910b4d9 A |
217 | { |
218 | __unused struct sysctl_oid *unused_oidp = oidp; | |
219 | __unused void *unused_arg1 = arg1; | |
220 | __unused int unused_arg2 = arg2; | |
221 | i386_cpu_info_t *cpu_info = cpuid_info(); | |
222 | ||
223 | if (cpu_info->cpuid_model != 26) | |
224 | return ENOENT; | |
225 | ||
226 | return SYSCTL_OUT(req, &flex_ratio_max, sizeof(flex_ratio_max)); | |
227 | } | |
228 | ||
6d2010ae A |
229 | static int |
230 | cpu_ucode_update SYSCTL_HANDLER_ARGS | |
231 | { | |
232 | __unused struct sysctl_oid *unused_oidp = oidp; | |
233 | __unused void *unused_arg1 = arg1; | |
234 | __unused int unused_arg2 = arg2; | |
235 | uint64_t addr; | |
236 | int error; | |
237 | ||
238 | error = SYSCTL_IN(req, &addr, sizeof(addr)); | |
239 | if (error) | |
240 | return error; | |
241 | ||
242 | int ret = ucode_interface(addr); | |
243 | return ret; | |
244 | } | |
245 | ||
246 | extern uint64_t panic_restart_timeout; | |
247 | static int | |
248 | panic_set_restart_timeout(__unused struct sysctl_oid *oidp, __unused void *arg1, __unused int arg2, struct sysctl_req *req) | |
249 | { | |
250 | int new_value = 0, old_value = 0, changed = 0, error; | |
251 | uint64_t nstime; | |
252 | ||
253 | if (panic_restart_timeout) { | |
254 | absolutetime_to_nanoseconds(panic_restart_timeout, &nstime); | |
255 | old_value = nstime / NSEC_PER_SEC; | |
256 | } | |
257 | ||
258 | error = sysctl_io_number(req, old_value, sizeof(int), &new_value, &changed); | |
259 | if (error == 0 && changed) { | |
260 | nanoseconds_to_absolutetime(((uint64_t)new_value) * NSEC_PER_SEC, &panic_restart_timeout); | |
261 | } | |
262 | return error; | |
263 | } | |
264 | ||
060df5ea A |
265 | /* |
266 | * Populates the {CPU, vector, latency} triple for the maximum observed primary | |
267 | * interrupt latency | |
268 | */ | |
269 | static int | |
270 | misc_interrupt_latency_max(__unused struct sysctl_oid *oidp, __unused void *arg1, __unused int arg2, struct sysctl_req *req) | |
271 | { | |
272 | int changed = 0, error; | |
273 | char buf[128]; | |
274 | buf[0] = '\0'; | |
275 | ||
276 | interrupt_populate_latency_stats(buf, sizeof(buf)); | |
277 | ||
278 | error = sysctl_io_string(req, buf, sizeof(buf), 0, &changed); | |
279 | ||
280 | if (error == 0 && changed) { | |
281 | interrupt_reset_latency_stats(); | |
282 | } | |
283 | ||
284 | return error; | |
285 | } | |
286 | ||
316670eb A |
287 | /* |
288 | * Triggers a machine-check exception - for a suitably configured kernel only. | |
289 | */ | |
290 | extern void mca_exception_panic(void); | |
291 | static int | |
292 | misc_machine_check_panic(__unused struct sysctl_oid *oidp, __unused void *arg1, __unused int arg2, struct sysctl_req *req) | |
293 | { | |
294 | int changed = 0, error; | |
295 | char buf[128]; | |
296 | buf[0] = '\0'; | |
297 | ||
298 | error = sysctl_io_string(req, buf, sizeof(buf), 0, &changed); | |
299 | ||
300 | if (error == 0 && changed) { | |
301 | mca_exception_panic(); | |
302 | } | |
303 | return error; | |
304 | } | |
305 | ||
306 | ||
2d21ac55 | 307 | SYSCTL_NODE(_machdep, OID_AUTO, cpu, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
55e303ae A |
308 | "CPU info"); |
309 | ||
6d2010ae | 310 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, max_basic, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 | 311 | (void *)offsetof(i386_cpu_info_t, cpuid_max_basic),sizeof(uint32_t), |
7e4a7d39 | 312 | i386_cpu_info, "IU", "Max Basic Information value"); |
b0d623f7 | 313 | |
6d2010ae | 314 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, max_ext, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 | 315 | (void *)offsetof(i386_cpu_info_t, cpuid_max_ext), sizeof(uint32_t), |
7e4a7d39 | 316 | i386_cpu_info, "IU", "Max Extended Function Information value"); |
b0d623f7 | 317 | |
6d2010ae | 318 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, vendor, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 319 | (void *)offsetof(i386_cpu_info_t, cpuid_vendor), 0, |
7e4a7d39 | 320 | i386_cpu_info, "A", "CPU vendor"); |
55e303ae | 321 | |
6d2010ae | 322 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, brand_string, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 323 | (void *)offsetof(i386_cpu_info_t, cpuid_brand_string), 0, |
7e4a7d39 | 324 | i386_cpu_info, "A", "CPU brand string"); |
55e303ae | 325 | |
6d2010ae | 326 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, family, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 327 | (void *)offsetof(i386_cpu_info_t, cpuid_family), sizeof(uint8_t), |
7e4a7d39 | 328 | i386_cpu_info, "I", "CPU family"); |
55e303ae | 329 | |
6d2010ae | 330 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, model, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 331 | (void *)offsetof(i386_cpu_info_t, cpuid_model), sizeof(uint8_t), |
7e4a7d39 | 332 | i386_cpu_info, "I", "CPU model"); |
55e303ae | 333 | |
6d2010ae | 334 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, extmodel, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 335 | (void *)offsetof(i386_cpu_info_t, cpuid_extmodel), sizeof(uint8_t), |
7e4a7d39 | 336 | i386_cpu_info, "I", "CPU extended model"); |
55e303ae | 337 | |
6d2010ae | 338 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, extfamily, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 339 | (void *)offsetof(i386_cpu_info_t, cpuid_extfamily), sizeof(uint8_t), |
7e4a7d39 | 340 | i386_cpu_info, "I", "CPU extended family"); |
55e303ae | 341 | |
6d2010ae | 342 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, stepping, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 343 | (void *)offsetof(i386_cpu_info_t, cpuid_stepping), sizeof(uint8_t), |
7e4a7d39 | 344 | i386_cpu_info, "I", "CPU stepping"); |
55e303ae | 345 | |
6d2010ae | 346 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, feature_bits, CTLTYPE_QUAD | CTLFLAG_RD | CTLFLAG_LOCKED, |
0c530ab8 | 347 | (void *)offsetof(i386_cpu_info_t, cpuid_features), sizeof(uint64_t), |
7e4a7d39 | 348 | i386_cpu_info, "IU", "CPU features"); |
55e303ae | 349 | |
13f56ec4 A |
350 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, leaf7_feature_bits, |
351 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
352 | (void *)offsetof(i386_cpu_info_t, cpuid_leaf7_features), | |
353 | sizeof(uint32_t), | |
354 | i386_cpu_info_nonzero, "IU", "CPU Leaf7 features"); | |
355 | ||
6d2010ae | 356 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, extfeature_bits, CTLTYPE_QUAD | CTLFLAG_RD | CTLFLAG_LOCKED, |
0c530ab8 | 357 | (void *)offsetof(i386_cpu_info_t, cpuid_extfeatures), sizeof(uint64_t), |
7e4a7d39 | 358 | i386_cpu_info, "IU", "CPU extended features"); |
0c530ab8 | 359 | |
6d2010ae | 360 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, signature, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 361 | (void *)offsetof(i386_cpu_info_t, cpuid_signature), sizeof(uint32_t), |
7e4a7d39 | 362 | i386_cpu_info, "I", "CPU signature"); |
55e303ae | 363 | |
6d2010ae | 364 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, brand, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 365 | (void *)offsetof(i386_cpu_info_t, cpuid_brand), sizeof(uint8_t), |
7e4a7d39 | 366 | i386_cpu_info, "I", "CPU brand"); |
55e303ae | 367 | |
6d2010ae | 368 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, features, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_LOCKED, |
55e303ae | 369 | 0, 0, |
7e4a7d39 | 370 | cpu_features, "A", "CPU feature names"); |
55e303ae | 371 | |
13f56ec4 A |
372 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, leaf7_features, |
373 | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_LOCKED, | |
374 | 0, 0, | |
375 | cpu_leaf7_features, "A", "CPU Leaf7 feature names"); | |
376 | ||
6d2010ae | 377 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, extfeatures, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_LOCKED, |
0c530ab8 | 378 | 0, 0, |
7e4a7d39 | 379 | cpu_extfeatures, "A", "CPU extended feature names"); |
0c530ab8 A |
380 | |
381 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, logical_per_package, | |
6d2010ae | 382 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
2d21ac55 | 383 | 0, 0, |
7e4a7d39 | 384 | cpu_logical_per_package, "I", "CPU logical cpus per package"); |
0c530ab8 A |
385 | |
386 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, cores_per_package, | |
6d2010ae | 387 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
0c530ab8 A |
388 | (void *)offsetof(i386_cpu_info_t, cpuid_cores_per_package), |
389 | sizeof(uint32_t), | |
7e4a7d39 | 390 | i386_cpu_info, "I", "CPU cores per package"); |
0c530ab8 | 391 | |
593a1d5f | 392 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, microcode_version, |
6d2010ae | 393 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
593a1d5f A |
394 | (void *)offsetof(i386_cpu_info_t, cpuid_microcode_version), |
395 | sizeof(uint32_t), | |
7e4a7d39 | 396 | i386_cpu_info, "I", "Microcode version number"); |
593a1d5f | 397 | |
6d2010ae A |
398 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, processor_flag, |
399 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
400 | (void *)offsetof(i386_cpu_info_t, cpuid_processor_flag), | |
401 | sizeof(uint32_t), | |
402 | i386_cpu_info, "I", "CPU processor flag"); | |
403 | ||
55e303ae | 404 | |
2d21ac55 A |
405 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, mwait, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
406 | "mwait"); | |
407 | ||
408 | SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, linesize_min, | |
6d2010ae | 409 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 410 | (void *)offsetof(cpuid_mwait_leaf_t, linesize_min), |
2d21ac55 | 411 | sizeof(uint32_t), |
7e4a7d39 | 412 | cpu_mwait, "I", "Monitor/mwait minimum line size"); |
2d21ac55 A |
413 | |
414 | SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, linesize_max, | |
6d2010ae | 415 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 416 | (void *)offsetof(cpuid_mwait_leaf_t, linesize_max), |
2d21ac55 | 417 | sizeof(uint32_t), |
7e4a7d39 | 418 | cpu_mwait, "I", "Monitor/mwait maximum line size"); |
2d21ac55 A |
419 | |
420 | SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, extensions, | |
6d2010ae | 421 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 422 | (void *)offsetof(cpuid_mwait_leaf_t, extensions), |
2d21ac55 | 423 | sizeof(uint32_t), |
7e4a7d39 | 424 | cpu_mwait, "I", "Monitor/mwait extensions"); |
2d21ac55 A |
425 | |
426 | SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, sub_Cstates, | |
6d2010ae | 427 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 428 | (void *)offsetof(cpuid_mwait_leaf_t, sub_Cstates), |
2d21ac55 | 429 | sizeof(uint32_t), |
7e4a7d39 | 430 | cpu_mwait, "I", "Monitor/mwait sub C-states"); |
2d21ac55 A |
431 | |
432 | ||
433 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, thermal, CTLFLAG_RW|CTLFLAG_LOCKED, 0, | |
434 | "thermal"); | |
435 | ||
436 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, sensor, | |
6d2010ae | 437 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 438 | (void *)offsetof(cpuid_thermal_leaf_t, sensor), |
2d21ac55 | 439 | sizeof(boolean_t), |
7e4a7d39 | 440 | cpu_thermal, "I", "Thermal sensor present"); |
2d21ac55 A |
441 | |
442 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, dynamic_acceleration, | |
6d2010ae | 443 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 444 | (void *)offsetof(cpuid_thermal_leaf_t, dynamic_acceleration), |
2d21ac55 | 445 | sizeof(boolean_t), |
7e4a7d39 | 446 | cpu_thermal, "I", "Dynamic Acceleration Technology (Turbo Mode)"); |
2d21ac55 | 447 | |
b7266188 | 448 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, invariant_APIC_timer, |
6d2010ae | 449 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b7266188 A |
450 | (void *)offsetof(cpuid_thermal_leaf_t, invariant_APIC_timer), |
451 | sizeof(boolean_t), | |
452 | cpu_thermal, "I", "Invariant APIC Timer"); | |
453 | ||
2d21ac55 | 454 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, thresholds, |
6d2010ae | 455 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 456 | (void *)offsetof(cpuid_thermal_leaf_t, thresholds), |
2d21ac55 | 457 | sizeof(uint32_t), |
7e4a7d39 | 458 | cpu_thermal, "I", "Number of interrupt thresholds"); |
2d21ac55 A |
459 | |
460 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, ACNT_MCNT, | |
6d2010ae | 461 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 462 | (void *)offsetof(cpuid_thermal_leaf_t, ACNT_MCNT), |
2d21ac55 | 463 | sizeof(boolean_t), |
7e4a7d39 | 464 | cpu_thermal, "I", "ACNT_MCNT capability"); |
2d21ac55 | 465 | |
060df5ea A |
466 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, core_power_limits, |
467 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
468 | (void *)offsetof(cpuid_thermal_leaf_t, core_power_limits), | |
469 | sizeof(boolean_t), | |
470 | cpu_thermal, "I", "Power Limit Notifications at a Core Level"); | |
471 | ||
472 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, fine_grain_clock_mod, | |
473 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
474 | (void *)offsetof(cpuid_thermal_leaf_t, fine_grain_clock_mod), | |
475 | sizeof(boolean_t), | |
476 | cpu_thermal, "I", "Fine Grain Clock Modulation"); | |
477 | ||
478 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, package_thermal_intr, | |
479 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
480 | (void *)offsetof(cpuid_thermal_leaf_t, package_thermal_intr), | |
481 | sizeof(boolean_t), | |
db609669 | 482 | cpu_thermal, "I", "Package Thermal interrupt and Status"); |
060df5ea A |
483 | |
484 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, hardware_feedback, | |
485 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
486 | (void *)offsetof(cpuid_thermal_leaf_t, hardware_feedback), | |
487 | sizeof(boolean_t), | |
488 | cpu_thermal, "I", "Hardware Coordination Feedback"); | |
489 | ||
490 | SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, energy_policy, | |
491 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
492 | (void *)offsetof(cpuid_thermal_leaf_t, energy_policy), | |
493 | sizeof(boolean_t), | |
494 | cpu_thermal, "I", "Energy Efficient Policy Support"); | |
495 | ||
060df5ea A |
496 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, xsave, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
497 | "xsave"); | |
498 | ||
499 | SYSCTL_PROC(_machdep_cpu_xsave, OID_AUTO, extended_state, | |
500 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, | |
501 | (void *)offsetof(cpuid_xsave_leaf_t, extended_state), | |
502 | sizeof(cpuid_xsave_leaf_t), | |
503 | cpu_xsave, "IU", "XSAVE Extended State"); | |
504 | ||
2d21ac55 A |
505 | |
506 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, arch_perf, CTLFLAG_RW|CTLFLAG_LOCKED, 0, | |
507 | "arch_perf"); | |
508 | ||
509 | SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, version, | |
6d2010ae | 510 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 511 | (void *)offsetof(cpuid_arch_perf_leaf_t, version), |
2d21ac55 | 512 | sizeof(uint8_t), |
7e4a7d39 | 513 | cpu_arch_perf, "I", "Architectural Performance Version Number"); |
2d21ac55 A |
514 | |
515 | SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, number, | |
6d2010ae | 516 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 517 | (void *)offsetof(cpuid_arch_perf_leaf_t, number), |
2d21ac55 | 518 | sizeof(uint8_t), |
7e4a7d39 | 519 | cpu_arch_perf, "I", "Number of counters per logical cpu"); |
2d21ac55 A |
520 | |
521 | SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, width, | |
6d2010ae | 522 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 523 | (void *)offsetof(cpuid_arch_perf_leaf_t, width), |
2d21ac55 | 524 | sizeof(uint8_t), |
7e4a7d39 | 525 | cpu_arch_perf, "I", "Bit width of counters"); |
2d21ac55 A |
526 | |
527 | SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, events_number, | |
6d2010ae | 528 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 529 | (void *)offsetof(cpuid_arch_perf_leaf_t, events_number), |
2d21ac55 | 530 | sizeof(uint8_t), |
7e4a7d39 | 531 | cpu_arch_perf, "I", "Number of monitoring events"); |
2d21ac55 A |
532 | |
533 | SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, events, | |
6d2010ae | 534 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 535 | (void *)offsetof(cpuid_arch_perf_leaf_t, events), |
2d21ac55 | 536 | sizeof(uint32_t), |
7e4a7d39 | 537 | cpu_arch_perf, "I", "Bit vector of events"); |
2d21ac55 A |
538 | |
539 | SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, fixed_number, | |
6d2010ae | 540 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 541 | (void *)offsetof(cpuid_arch_perf_leaf_t, fixed_number), |
2d21ac55 | 542 | sizeof(uint8_t), |
7e4a7d39 | 543 | cpu_arch_perf, "I", "Number of fixed-function counters"); |
2d21ac55 A |
544 | |
545 | SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, fixed_width, | |
6d2010ae | 546 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
7e4a7d39 | 547 | (void *)offsetof(cpuid_arch_perf_leaf_t, fixed_width), |
2d21ac55 | 548 | sizeof(uint8_t), |
7e4a7d39 | 549 | cpu_arch_perf, "I", "Bit-width of fixed-function counters"); |
2d21ac55 A |
550 | |
551 | ||
552 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, cache, CTLFLAG_RW|CTLFLAG_LOCKED, 0, | |
553 | "cache"); | |
554 | ||
555 | SYSCTL_PROC(_machdep_cpu_cache, OID_AUTO, linesize, | |
6d2010ae | 556 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
2d21ac55 A |
557 | (void *)offsetof(i386_cpu_info_t, cpuid_cache_linesize), |
558 | sizeof(uint32_t), | |
7e4a7d39 | 559 | i386_cpu_info, "I", "Cacheline size"); |
2d21ac55 A |
560 | |
561 | SYSCTL_PROC(_machdep_cpu_cache, OID_AUTO, L2_associativity, | |
6d2010ae | 562 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
2d21ac55 A |
563 | (void *)offsetof(i386_cpu_info_t, cpuid_cache_L2_associativity), |
564 | sizeof(uint32_t), | |
7e4a7d39 | 565 | i386_cpu_info, "I", "L2 cache associativity"); |
2d21ac55 A |
566 | |
567 | SYSCTL_PROC(_machdep_cpu_cache, OID_AUTO, size, | |
6d2010ae | 568 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
2d21ac55 A |
569 | (void *)offsetof(i386_cpu_info_t, cpuid_cache_size), |
570 | sizeof(uint32_t), | |
7e4a7d39 | 571 | i386_cpu_info, "I", "Cache size (in Kbytes)"); |
2d21ac55 A |
572 | |
573 | ||
593a1d5f A |
574 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, tlb, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
575 | "tlb"); | |
b0d623f7 A |
576 | SYSCTL_NODE(_machdep_cpu_tlb, OID_AUTO, inst, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
577 | "inst"); | |
578 | SYSCTL_NODE(_machdep_cpu_tlb, OID_AUTO, data, CTLFLAG_RW|CTLFLAG_LOCKED, 0, | |
579 | "data"); | |
580 | ||
581 | SYSCTL_PROC(_machdep_cpu_tlb_inst, OID_AUTO, small, | |
6d2010ae | 582 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 A |
583 | (void *)offsetof(i386_cpu_info_t, |
584 | cpuid_tlb[TLB_INST][TLB_SMALL][0]), | |
585 | sizeof(uint32_t), | |
7e4a7d39 | 586 | i386_cpu_info_nonzero, "I", |
b0d623f7 | 587 | "Number of small page instruction TLBs"); |
593a1d5f | 588 | |
b0d623f7 | 589 | SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, small, |
6d2010ae | 590 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 A |
591 | (void *)offsetof(i386_cpu_info_t, |
592 | cpuid_tlb[TLB_DATA][TLB_SMALL][0]), | |
593a1d5f | 593 | sizeof(uint32_t), |
7e4a7d39 | 594 | i386_cpu_info_nonzero, "I", |
b0d623f7 | 595 | "Number of small page data TLBs (1st level)"); |
593a1d5f | 596 | |
b0d623f7 | 597 | SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, small_level1, |
6d2010ae | 598 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 A |
599 | (void *)offsetof(i386_cpu_info_t, |
600 | cpuid_tlb[TLB_DATA][TLB_SMALL][1]), | |
593a1d5f | 601 | sizeof(uint32_t), |
7e4a7d39 | 602 | i386_cpu_info_nonzero, "I", |
b0d623f7 | 603 | "Number of small page data TLBs (2nd level)"); |
593a1d5f | 604 | |
b0d623f7 | 605 | SYSCTL_PROC(_machdep_cpu_tlb_inst, OID_AUTO, large, |
6d2010ae | 606 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 A |
607 | (void *)offsetof(i386_cpu_info_t, |
608 | cpuid_tlb[TLB_INST][TLB_LARGE][0]), | |
593a1d5f | 609 | sizeof(uint32_t), |
7e4a7d39 | 610 | i386_cpu_info_nonzero, "I", |
b0d623f7 | 611 | "Number of large page instruction TLBs"); |
593a1d5f | 612 | |
b0d623f7 | 613 | SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, large, |
6d2010ae | 614 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 A |
615 | (void *)offsetof(i386_cpu_info_t, |
616 | cpuid_tlb[TLB_DATA][TLB_LARGE][0]), | |
593a1d5f | 617 | sizeof(uint32_t), |
7e4a7d39 | 618 | i386_cpu_info_nonzero, "I", |
b0d623f7 A |
619 | "Number of large page data TLBs (1st level)"); |
620 | ||
621 | SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, large_level1, | |
6d2010ae | 622 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 A |
623 | (void *)offsetof(i386_cpu_info_t, |
624 | cpuid_tlb[TLB_DATA][TLB_LARGE][1]), | |
625 | sizeof(uint32_t), | |
7e4a7d39 | 626 | i386_cpu_info_nonzero, "I", |
b0d623f7 A |
627 | "Number of large page data TLBs (2nd level)"); |
628 | ||
629 | SYSCTL_PROC(_machdep_cpu_tlb, OID_AUTO, shared, | |
6d2010ae | 630 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
b0d623f7 A |
631 | (void *)offsetof(i386_cpu_info_t, cpuid_stlb), |
632 | sizeof(uint32_t), | |
7e4a7d39 | 633 | i386_cpu_info_nonzero, "I", |
b0d623f7 | 634 | "Number of shared TLBs"); |
593a1d5f A |
635 | |
636 | ||
2d21ac55 A |
637 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, address_bits, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
638 | "address_bits"); | |
639 | ||
640 | SYSCTL_PROC(_machdep_cpu_address_bits, OID_AUTO, physical, | |
6d2010ae | 641 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
2d21ac55 A |
642 | (void *)offsetof(i386_cpu_info_t, cpuid_address_bits_physical), |
643 | sizeof(uint32_t), | |
7e4a7d39 | 644 | i386_cpu_info, "I", "Number of physical address bits"); |
2d21ac55 A |
645 | |
646 | SYSCTL_PROC(_machdep_cpu_address_bits, OID_AUTO, virtual, | |
6d2010ae | 647 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
2d21ac55 A |
648 | (void *)offsetof(i386_cpu_info_t, cpuid_address_bits_virtual), |
649 | sizeof(uint32_t), | |
7e4a7d39 | 650 | i386_cpu_info, "I", "Number of virtual address bits"); |
2d21ac55 | 651 | |
b0d623f7 | 652 | |
593a1d5f | 653 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, core_count, |
6d2010ae | 654 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
593a1d5f A |
655 | (void *)offsetof(i386_cpu_info_t, core_count), |
656 | sizeof(uint32_t), | |
7e4a7d39 | 657 | i386_cpu_info, "I", "Number of enabled cores per package"); |
593a1d5f A |
658 | |
659 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, thread_count, | |
6d2010ae | 660 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
593a1d5f A |
661 | (void *)offsetof(i386_cpu_info_t, thread_count), |
662 | sizeof(uint32_t), | |
7e4a7d39 | 663 | i386_cpu_info, "I", "Number of enabled threads per package"); |
593a1d5f | 664 | |
c910b4d9 A |
665 | SYSCTL_NODE(_machdep_cpu, OID_AUTO, flex_ratio, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
666 | "Flex ratio"); | |
667 | ||
668 | SYSCTL_PROC(_machdep_cpu_flex_ratio, OID_AUTO, desired, | |
6d2010ae | 669 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
c910b4d9 | 670 | 0, 0, |
7e4a7d39 | 671 | cpu_flex_ratio_desired, "I", "Flex ratio desired (0 disabled)"); |
c910b4d9 A |
672 | |
673 | SYSCTL_PROC(_machdep_cpu_flex_ratio, OID_AUTO, min, | |
6d2010ae | 674 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
c910b4d9 | 675 | 0, 0, |
7e4a7d39 | 676 | cpu_flex_ratio_min, "I", "Flex ratio min (efficiency)"); |
c910b4d9 A |
677 | |
678 | SYSCTL_PROC(_machdep_cpu_flex_ratio, OID_AUTO, max, | |
6d2010ae | 679 | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_LOCKED, |
c910b4d9 | 680 | 0, 0, |
7e4a7d39 | 681 | cpu_flex_ratio_max, "I", "Flex ratio max (non-turbo)"); |
593a1d5f | 682 | |
6d2010ae A |
683 | SYSCTL_PROC(_machdep_cpu, OID_AUTO, ucupdate, |
684 | CTLTYPE_INT | CTLFLAG_WR | CTLFLAG_LOCKED, 0, 0, | |
685 | cpu_ucode_update, "S", "Microcode update interface"); | |
686 | ||
316670eb A |
687 | static const uint32_t apic_timer_vector = (LAPIC_DEFAULT_INTERRUPT_BASE + LAPIC_TIMER_INTERRUPT); |
688 | static const uint32_t apic_IPI_vector = (LAPIC_DEFAULT_INTERRUPT_BASE + LAPIC_INTERPROCESSOR_INTERRUPT); | |
689 | ||
690 | SYSCTL_NODE(_machdep, OID_AUTO, vectors, CTLFLAG_RD | CTLFLAG_LOCKED, 0, | |
691 | "Interrupt vector assignments"); | |
692 | ||
693 | SYSCTL_UINT (_machdep_vectors, OID_AUTO, timer, CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED, (uint32_t *)&apic_timer_vector, 0, ""); | |
694 | SYSCTL_UINT (_machdep_vectors, OID_AUTO, IPI, CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED, (uint32_t *)&apic_IPI_vector, 0, ""); | |
695 | ||
2d21ac55 A |
696 | uint64_t pmap_pv_hashlist_walks; |
697 | uint64_t pmap_pv_hashlist_cnts; | |
698 | uint32_t pmap_pv_hashlist_max; | |
b0d623f7 | 699 | uint32_t pmap_kernel_text_ps = PAGE_SIZE; |
6d2010ae | 700 | extern uint32_t pv_hashed_kern_low_water_mark; |
2d21ac55 A |
701 | |
702 | /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/ | |
703 | ||
704 | SYSCTL_NODE(_machdep, OID_AUTO, pmap, CTLFLAG_RW|CTLFLAG_LOCKED, 0, | |
705 | "PMAP info"); | |
55e303ae | 706 | |
6d2010ae A |
707 | SYSCTL_QUAD (_machdep_pmap, OID_AUTO, hashwalks, CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED, &pmap_pv_hashlist_walks, ""); |
708 | SYSCTL_QUAD (_machdep_pmap, OID_AUTO, hashcnts, CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED, &pmap_pv_hashlist_cnts, ""); | |
709 | SYSCTL_INT (_machdep_pmap, OID_AUTO, hashmax, CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED, &pmap_pv_hashlist_max, 0, ""); | |
710 | SYSCTL_INT (_machdep_pmap, OID_AUTO, kernel_text_ps, CTLFLAG_RD | CTLFLAG_KERN | CTLFLAG_LOCKED, &pmap_kernel_text_ps, 0, ""); | |
711 | SYSCTL_INT (_machdep_pmap, OID_AUTO, kern_pv_reserve, CTLFLAG_RW | CTLFLAG_KERN | CTLFLAG_LOCKED, &pv_hashed_kern_low_water_mark, 0, ""); | |
b0d623f7 A |
712 | |
713 | SYSCTL_NODE(_machdep, OID_AUTO, memmap, CTLFLAG_RD|CTLFLAG_LOCKED, NULL, "physical memory map"); | |
714 | ||
715 | uint64_t firmware_Conventional_bytes = 0; | |
716 | uint64_t firmware_RuntimeServices_bytes = 0; | |
717 | uint64_t firmware_ACPIReclaim_bytes = 0; | |
718 | uint64_t firmware_ACPINVS_bytes = 0; | |
719 | uint64_t firmware_PalCode_bytes = 0; | |
720 | uint64_t firmware_Reserved_bytes = 0; | |
721 | uint64_t firmware_Unusable_bytes = 0; | |
722 | uint64_t firmware_other_bytes = 0; | |
723 | ||
724 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Conventional, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_Conventional_bytes, ""); | |
725 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, RuntimeServices, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_RuntimeServices_bytes, ""); | |
726 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, ACPIReclaim, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_ACPIReclaim_bytes, ""); | |
727 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, ACPINVS, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_ACPINVS_bytes, ""); | |
728 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, PalCode, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_PalCode_bytes, ""); | |
729 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Reserved, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_Reserved_bytes, ""); | |
730 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Unusable, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_Unusable_bytes, ""); | |
731 | SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Other, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_other_bytes, ""); | |
060df5ea A |
732 | |
733 | SYSCTL_NODE(_machdep, OID_AUTO, tsc, CTLFLAG_RD|CTLFLAG_LOCKED, NULL, "Timestamp counter parameters"); | |
734 | ||
bd504ef0 A |
735 | SYSCTL_QUAD(_machdep_tsc, OID_AUTO, frequency, |
736 | CTLFLAG_RD|CTLFLAG_LOCKED, &tscFreq, ""); | |
737 | ||
738 | extern uint32_t deep_idle_rebase; | |
739 | SYSCTL_UINT(_machdep_tsc, OID_AUTO, deep_idle_rebase, | |
740 | CTLFLAG_RW|CTLFLAG_KERN|CTLFLAG_LOCKED, &deep_idle_rebase, 0, ""); | |
741 | ||
742 | SYSCTL_NODE(_machdep_tsc, OID_AUTO, nanotime, | |
743 | CTLFLAG_RD|CTLFLAG_LOCKED, NULL, "TSC to ns conversion"); | |
744 | SYSCTL_QUAD(_machdep_tsc_nanotime, OID_AUTO, tsc_base, | |
745 | CTLFLAG_RD | CTLFLAG_LOCKED, | |
746 | (uint64_t *) &pal_rtc_nanotime_info.tsc_base, ""); | |
747 | SYSCTL_QUAD(_machdep_tsc_nanotime, OID_AUTO, ns_base, | |
748 | CTLFLAG_RD | CTLFLAG_LOCKED, | |
749 | (uint64_t *)&pal_rtc_nanotime_info.ns_base, ""); | |
750 | SYSCTL_UINT(_machdep_tsc_nanotime, OID_AUTO, scale, | |
751 | CTLFLAG_RD | CTLFLAG_LOCKED, | |
752 | (uint32_t *)&pal_rtc_nanotime_info.scale, 0, ""); | |
753 | SYSCTL_UINT(_machdep_tsc_nanotime, OID_AUTO, shift, | |
754 | CTLFLAG_RD | CTLFLAG_LOCKED, | |
755 | (uint32_t *)&pal_rtc_nanotime_info.shift, 0, ""); | |
756 | SYSCTL_UINT(_machdep_tsc_nanotime, OID_AUTO, generation, | |
757 | CTLFLAG_RD | CTLFLAG_LOCKED, | |
758 | (uint32_t *)&pal_rtc_nanotime_info.generation, 0, ""); | |
6d2010ae | 759 | |
060df5ea A |
760 | SYSCTL_NODE(_machdep, OID_AUTO, misc, CTLFLAG_RW|CTLFLAG_LOCKED, 0, |
761 | "Miscellaneous x86 kernel parameters"); | |
762 | ||
6d2010ae A |
763 | SYSCTL_PROC(_machdep_misc, OID_AUTO, panic_restart_timeout, |
764 | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_LOCKED, | |
765 | 0, 0, | |
766 | panic_set_restart_timeout, "I", "Panic restart timeout in seconds"); | |
767 | ||
316670eb A |
768 | SYSCTL_PROC(_machdep_misc, OID_AUTO, interrupt_latency_max, |
769 | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_LOCKED, | |
060df5ea A |
770 | 0, 0, |
771 | misc_interrupt_latency_max, "A", "Maximum Interrupt latency"); | |
316670eb A |
772 | |
773 | SYSCTL_PROC(_machdep_misc, OID_AUTO, machine_check_panic, | |
774 | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_LOCKED, | |
775 | 0, 0, | |
776 | misc_machine_check_panic, "A", "Machine-check exception test"); | |
777 | ||
39236c6e A |
778 | |
779 | ||
780 | extern void timer_queue_trace_cpu(int); | |
781 | static int | |
782 | misc_timer_queue_trace(__unused struct sysctl_oid *oidp, __unused void *arg1, __unused int arg2, struct sysctl_req *req) | |
783 | { | |
784 | int changed = 0, error; | |
785 | char buf[128]; | |
786 | buf[0] = '\0'; | |
787 | ||
788 | error = sysctl_io_string(req, buf, sizeof(buf), 0, &changed); | |
789 | ||
790 | if (error == 0 && changed) { | |
791 | timer_queue_trace_cpu(0); | |
792 | } | |
793 | return error; | |
794 | } | |
795 | ||
796 | SYSCTL_PROC(_machdep_misc, OID_AUTO, timer_queue_trace, | |
797 | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_LOCKED, | |
798 | 0, 0, | |
799 | misc_timer_queue_trace, "A", "Cut timer queue tracepoint"); | |
800 | ||
801 | extern long NMI_count; | |
802 | extern void NMI_cpus(void); | |
803 | static int | |
804 | misc_nmis(__unused struct sysctl_oid *oidp, __unused void *arg1, __unused int arg2, struct sysctl_req *req) | |
805 | { | |
806 | int new = 0, old = 0, changed = 0, error; | |
807 | ||
808 | old = NMI_count; | |
809 | ||
810 | error = sysctl_io_number(req, old, sizeof(int), &new, &changed); | |
811 | if (error == 0 && changed) { | |
812 | NMI_cpus(); | |
813 | } | |
814 | ||
815 | return error; | |
816 | } | |
817 | ||
818 | SYSCTL_PROC(_machdep_misc, OID_AUTO, nmis, | |
819 | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_LOCKED, | |
820 | 0, 0, | |
821 | misc_nmis, "I", "Report/increment NMI count"); | |
822 | ||
823 | /* Parameters related to timer coalescing tuning, to be replaced | |
824 | * with a dedicated systemcall in the future. | |
825 | */ | |
826 | /* Enable processing pending timers in the context of any other interrupt */ | |
827 | SYSCTL_INT(_kern, OID_AUTO, interrupt_timer_coalescing_enabled, | |
828 | CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED, | |
829 | &interrupt_timer_coalescing_enabled, 0, ""); | |
830 | /* Upon entering idle, process pending timers with HW deadlines | |
831 | * this far in the future. | |
832 | */ | |
833 | SYSCTL_INT(_kern, OID_AUTO, timer_coalesce_idle_entry_hard_deadline_max, | |
834 | CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED, | |
835 | &idle_entry_timer_processing_hdeadline_threshold, 0, ""); | |
39236c6e A |
836 | |
837 | /* Track potentially expensive eager timer evaluations on QoS tier | |
838 | * switches. | |
839 | */ | |
840 | extern uint32_t ml_timer_eager_evaluations; | |
841 | ||
842 | SYSCTL_INT(_machdep, OID_AUTO, eager_timer_evaluations, | |
843 | CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED, | |
844 | &ml_timer_eager_evaluations, 0, ""); | |
845 | ||
846 | extern uint64_t ml_timer_eager_evaluation_max; | |
847 | ||
848 | SYSCTL_QUAD(_machdep, OID_AUTO, eager_timer_evaluation_max, | |
849 | CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED, | |
850 | &ml_timer_eager_evaluation_max, ""); |