2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
30 #include <sys/param.h>
31 #include <sys/kernel.h>
32 #include <sys/sysctl.h>
33 #include <i386/cpuid.h>
35 #include <i386/machine_routines.h>
36 #include <i386/ucode.h>
37 #include <kern/clock.h>
38 #include <libkern/libkern.h>
41 _i386_cpu_info SYSCTL_HANDLER_ARGS
43 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
52 if (arg2
== 0 && ((char *)ptr
)[0] == '\0') {
56 if (arg2
== sizeof(uint8_t)) {
57 value
= (uint32_t) *(uint8_t *)ptr
;
59 arg2
= sizeof(uint32_t);
61 return SYSCTL_OUT(req
, ptr
, arg2
? (size_t) arg2
: strlen((char *)ptr
)+1);
65 i386_cpu_info SYSCTL_HANDLER_ARGS
67 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
68 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
72 i386_cpu_info_nonzero SYSCTL_HANDLER_ARGS
74 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
75 int value
= *(uint32_t *)ptr
;
80 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
83 cpu_mwait SYSCTL_HANDLER_ARGS
85 i386_cpu_info_t
*cpu_info
= cpuid_info();
86 void *ptr
= (uint8_t *)cpu_info
->cpuid_mwait_leafp
+ (uintptr_t)arg1
;
87 if (cpu_info
->cpuid_mwait_leafp
== NULL
)
89 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
93 cpu_thermal SYSCTL_HANDLER_ARGS
95 i386_cpu_info_t
*cpu_info
= cpuid_info();
96 void *ptr
= (uint8_t *)cpu_info
->cpuid_thermal_leafp
+ (uintptr_t)arg1
;
97 if (cpu_info
->cpuid_thermal_leafp
== NULL
)
99 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
103 cpu_arch_perf SYSCTL_HANDLER_ARGS
105 i386_cpu_info_t
*cpu_info
= cpuid_info();
106 void *ptr
= (uint8_t *)cpu_info
->cpuid_arch_perf_leafp
+ (uintptr_t)arg1
;
107 if (cpu_info
->cpuid_arch_perf_leafp
== NULL
)
109 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
113 cpu_xsave SYSCTL_HANDLER_ARGS
115 i386_cpu_info_t
*cpu_info
= cpuid_info();
116 void *ptr
= (uint8_t *)cpu_info
->cpuid_xsave_leafp
+ (uintptr_t)arg1
;
117 if (cpu_info
->cpuid_xsave_leafp
== NULL
)
119 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
123 cpu_features SYSCTL_HANDLER_ARGS
125 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
126 __unused
void *unused_arg1
= arg1
;
127 __unused
int unused_arg2
= arg2
;
131 cpuid_get_feature_names(cpuid_features(), buf
, sizeof(buf
));
133 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
137 cpu_extfeatures SYSCTL_HANDLER_ARGS
139 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
140 __unused
void *unused_arg1
= arg1
;
141 __unused
int unused_arg2
= arg2
;
145 cpuid_get_extfeature_names(cpuid_extfeatures(), buf
, sizeof(buf
));
147 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
151 cpu_leaf7_features SYSCTL_HANDLER_ARGS
153 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
154 __unused
void *unused_arg1
= arg1
;
155 __unused
int unused_arg2
= arg2
;
158 uint32_t leaf7_features
= cpuid_info()->cpuid_leaf7_features
;
159 if (leaf7_features
== 0)
163 cpuid_get_leaf7_feature_names(leaf7_features
, buf
, sizeof(buf
));
165 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
169 cpu_logical_per_package SYSCTL_HANDLER_ARGS
171 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
172 __unused
void *unused_arg1
= arg1
;
173 __unused
int unused_arg2
= arg2
;
174 i386_cpu_info_t
*cpu_info
= cpuid_info();
176 if (!(cpuid_features() & CPUID_FEATURE_HTT
))
179 return SYSCTL_OUT(req
, &cpu_info
->cpuid_logical_per_package
,
180 sizeof(cpu_info
->cpuid_logical_per_package
));
184 cpu_flex_ratio_desired SYSCTL_HANDLER_ARGS
186 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
187 __unused
void *unused_arg1
= arg1
;
188 __unused
int unused_arg2
= arg2
;
189 i386_cpu_info_t
*cpu_info
= cpuid_info();
191 if (cpu_info
->cpuid_model
!= 26)
194 return SYSCTL_OUT(req
, &flex_ratio
, sizeof(flex_ratio
));
198 cpu_flex_ratio_min SYSCTL_HANDLER_ARGS
200 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
201 __unused
void *unused_arg1
= arg1
;
202 __unused
int unused_arg2
= arg2
;
203 i386_cpu_info_t
*cpu_info
= cpuid_info();
205 if (cpu_info
->cpuid_model
!= 26)
208 return SYSCTL_OUT(req
, &flex_ratio_min
, sizeof(flex_ratio_min
));
212 cpu_flex_ratio_max SYSCTL_HANDLER_ARGS
214 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
215 __unused
void *unused_arg1
= arg1
;
216 __unused
int unused_arg2
= arg2
;
217 i386_cpu_info_t
*cpu_info
= cpuid_info();
219 if (cpu_info
->cpuid_model
!= 26)
222 return SYSCTL_OUT(req
, &flex_ratio_max
, sizeof(flex_ratio_max
));
226 cpu_ucode_update SYSCTL_HANDLER_ARGS
228 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
229 __unused
void *unused_arg1
= arg1
;
230 __unused
int unused_arg2
= arg2
;
234 error
= SYSCTL_IN(req
, &addr
, sizeof(addr
));
238 int ret
= ucode_interface(addr
);
242 extern uint64_t panic_restart_timeout
;
244 panic_set_restart_timeout(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
246 int new_value
= 0, old_value
= 0, changed
= 0, error
;
249 if (panic_restart_timeout
) {
250 absolutetime_to_nanoseconds(panic_restart_timeout
, &nstime
);
251 old_value
= nstime
/ NSEC_PER_SEC
;
254 error
= sysctl_io_number(req
, old_value
, sizeof(int), &new_value
, &changed
);
255 if (error
== 0 && changed
) {
256 nanoseconds_to_absolutetime(((uint64_t)new_value
) * NSEC_PER_SEC
, &panic_restart_timeout
);
262 * Populates the {CPU, vector, latency} triple for the maximum observed primary
266 misc_interrupt_latency_max(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
268 int changed
= 0, error
;
272 interrupt_populate_latency_stats(buf
, sizeof(buf
));
274 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
276 if (error
== 0 && changed
) {
277 interrupt_reset_latency_stats();
283 SYSCTL_NODE(_machdep
, OID_AUTO
, cpu
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
286 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_basic
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
287 (void *)offsetof(i386_cpu_info_t
, cpuid_max_basic
),sizeof(uint32_t),
288 i386_cpu_info
, "IU", "Max Basic Information value");
290 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_ext
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
291 (void *)offsetof(i386_cpu_info_t
, cpuid_max_ext
), sizeof(uint32_t),
292 i386_cpu_info
, "IU", "Max Extended Function Information value");
294 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, vendor
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
295 (void *)offsetof(i386_cpu_info_t
, cpuid_vendor
), 0,
296 i386_cpu_info
, "A", "CPU vendor");
298 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand_string
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
299 (void *)offsetof(i386_cpu_info_t
, cpuid_brand_string
), 0,
300 i386_cpu_info
, "A", "CPU brand string");
302 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, family
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
303 (void *)offsetof(i386_cpu_info_t
, cpuid_family
), sizeof(uint8_t),
304 i386_cpu_info
, "I", "CPU family");
306 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, model
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
307 (void *)offsetof(i386_cpu_info_t
, cpuid_model
), sizeof(uint8_t),
308 i386_cpu_info
, "I", "CPU model");
310 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extmodel
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
311 (void *)offsetof(i386_cpu_info_t
, cpuid_extmodel
), sizeof(uint8_t),
312 i386_cpu_info
, "I", "CPU extended model");
314 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfamily
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
315 (void *)offsetof(i386_cpu_info_t
, cpuid_extfamily
), sizeof(uint8_t),
316 i386_cpu_info
, "I", "CPU extended family");
318 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, stepping
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
319 (void *)offsetof(i386_cpu_info_t
, cpuid_stepping
), sizeof(uint8_t),
320 i386_cpu_info
, "I", "CPU stepping");
322 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, feature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
323 (void *)offsetof(i386_cpu_info_t
, cpuid_features
), sizeof(uint64_t),
324 i386_cpu_info
, "IU", "CPU features");
326 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_feature_bits
,
327 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
328 (void *)offsetof(i386_cpu_info_t
, cpuid_leaf7_features
),
330 i386_cpu_info_nonzero
, "IU", "CPU Leaf7 features");
332 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
333 (void *)offsetof(i386_cpu_info_t
, cpuid_extfeatures
), sizeof(uint64_t),
334 i386_cpu_info
, "IU", "CPU extended features");
336 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, signature
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
337 (void *)offsetof(i386_cpu_info_t
, cpuid_signature
), sizeof(uint32_t),
338 i386_cpu_info
, "I", "CPU signature");
340 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
341 (void *)offsetof(i386_cpu_info_t
, cpuid_brand
), sizeof(uint8_t),
342 i386_cpu_info
, "I", "CPU brand");
344 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, features
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
346 cpu_features
, "A", "CPU feature names");
348 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_features
,
349 CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
351 cpu_leaf7_features
, "A", "CPU Leaf7 feature names");
353 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeatures
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
355 cpu_extfeatures
, "A", "CPU extended feature names");
357 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, logical_per_package
,
358 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
360 cpu_logical_per_package
, "I", "CPU logical cpus per package");
362 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, cores_per_package
,
363 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
364 (void *)offsetof(i386_cpu_info_t
, cpuid_cores_per_package
),
366 i386_cpu_info
, "I", "CPU cores per package");
368 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, microcode_version
,
369 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
370 (void *)offsetof(i386_cpu_info_t
, cpuid_microcode_version
),
372 i386_cpu_info
, "I", "Microcode version number");
374 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, processor_flag
,
375 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
376 (void *)offsetof(i386_cpu_info_t
, cpuid_processor_flag
),
378 i386_cpu_info
, "I", "CPU processor flag");
381 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, mwait
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
384 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_min
,
385 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
386 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_min
),
388 cpu_mwait
, "I", "Monitor/mwait minimum line size");
390 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_max
,
391 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
392 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_max
),
394 cpu_mwait
, "I", "Monitor/mwait maximum line size");
396 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, extensions
,
397 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
398 (void *)offsetof(cpuid_mwait_leaf_t
, extensions
),
400 cpu_mwait
, "I", "Monitor/mwait extensions");
402 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, sub_Cstates
,
403 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
404 (void *)offsetof(cpuid_mwait_leaf_t
, sub_Cstates
),
406 cpu_mwait
, "I", "Monitor/mwait sub C-states");
409 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, thermal
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
412 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, sensor
,
413 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
414 (void *)offsetof(cpuid_thermal_leaf_t
, sensor
),
416 cpu_thermal
, "I", "Thermal sensor present");
418 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, dynamic_acceleration
,
419 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
420 (void *)offsetof(cpuid_thermal_leaf_t
, dynamic_acceleration
),
422 cpu_thermal
, "I", "Dynamic Acceleration Technology (Turbo Mode)");
424 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, invariant_APIC_timer
,
425 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
426 (void *)offsetof(cpuid_thermal_leaf_t
, invariant_APIC_timer
),
428 cpu_thermal
, "I", "Invariant APIC Timer");
430 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, thresholds
,
431 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
432 (void *)offsetof(cpuid_thermal_leaf_t
, thresholds
),
434 cpu_thermal
, "I", "Number of interrupt thresholds");
436 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, ACNT_MCNT
,
437 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
438 (void *)offsetof(cpuid_thermal_leaf_t
, ACNT_MCNT
),
440 cpu_thermal
, "I", "ACNT_MCNT capability");
442 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, core_power_limits
,
443 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
444 (void *)offsetof(cpuid_thermal_leaf_t
, core_power_limits
),
446 cpu_thermal
, "I", "Power Limit Notifications at a Core Level");
448 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, fine_grain_clock_mod
,
449 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
450 (void *)offsetof(cpuid_thermal_leaf_t
, fine_grain_clock_mod
),
452 cpu_thermal
, "I", "Fine Grain Clock Modulation");
454 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, package_thermal_intr
,
455 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
456 (void *)offsetof(cpuid_thermal_leaf_t
, package_thermal_intr
),
458 cpu_thermal
, "I", "Packge Thermal interrupt and Status");
460 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, hardware_feedback
,
461 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
462 (void *)offsetof(cpuid_thermal_leaf_t
, hardware_feedback
),
464 cpu_thermal
, "I", "Hardware Coordination Feedback");
466 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, energy_policy
,
467 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
468 (void *)offsetof(cpuid_thermal_leaf_t
, energy_policy
),
470 cpu_thermal
, "I", "Energy Efficient Policy Support");
472 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, xsave
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
475 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state
,
476 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
477 (void *)offsetof(cpuid_xsave_leaf_t
, extended_state
),
478 sizeof(cpuid_xsave_leaf_t
),
479 cpu_xsave
, "IU", "XSAVE Extended State");
482 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, arch_perf
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
485 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, version
,
486 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
487 (void *)offsetof(cpuid_arch_perf_leaf_t
, version
),
489 cpu_arch_perf
, "I", "Architectural Performance Version Number");
491 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, number
,
492 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
493 (void *)offsetof(cpuid_arch_perf_leaf_t
, number
),
495 cpu_arch_perf
, "I", "Number of counters per logical cpu");
497 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, width
,
498 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
499 (void *)offsetof(cpuid_arch_perf_leaf_t
, width
),
501 cpu_arch_perf
, "I", "Bit width of counters");
503 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events_number
,
504 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
505 (void *)offsetof(cpuid_arch_perf_leaf_t
, events_number
),
507 cpu_arch_perf
, "I", "Number of monitoring events");
509 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events
,
510 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
511 (void *)offsetof(cpuid_arch_perf_leaf_t
, events
),
513 cpu_arch_perf
, "I", "Bit vector of events");
515 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_number
,
516 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
517 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_number
),
519 cpu_arch_perf
, "I", "Number of fixed-function counters");
521 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_width
,
522 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
523 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_width
),
525 cpu_arch_perf
, "I", "Bit-width of fixed-function counters");
528 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, cache
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
531 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, linesize
,
532 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
533 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_linesize
),
535 i386_cpu_info
, "I", "Cacheline size");
537 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, L2_associativity
,
538 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
539 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_L2_associativity
),
541 i386_cpu_info
, "I", "L2 cache associativity");
543 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, size
,
544 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
545 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_size
),
547 i386_cpu_info
, "I", "Cache size (in Kbytes)");
550 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tlb
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
552 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, inst
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
554 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, data
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
557 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, small
,
558 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
559 (void *)offsetof(i386_cpu_info_t
,
560 cpuid_tlb
[TLB_INST
][TLB_SMALL
][0]),
562 i386_cpu_info_nonzero
, "I",
563 "Number of small page instruction TLBs");
565 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small
,
566 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
567 (void *)offsetof(i386_cpu_info_t
,
568 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][0]),
570 i386_cpu_info_nonzero
, "I",
571 "Number of small page data TLBs (1st level)");
573 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small_level1
,
574 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
575 (void *)offsetof(i386_cpu_info_t
,
576 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][1]),
578 i386_cpu_info_nonzero
, "I",
579 "Number of small page data TLBs (2nd level)");
581 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, large
,
582 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
583 (void *)offsetof(i386_cpu_info_t
,
584 cpuid_tlb
[TLB_INST
][TLB_LARGE
][0]),
586 i386_cpu_info_nonzero
, "I",
587 "Number of large page instruction TLBs");
589 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large
,
590 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
591 (void *)offsetof(i386_cpu_info_t
,
592 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][0]),
594 i386_cpu_info_nonzero
, "I",
595 "Number of large page data TLBs (1st level)");
597 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large_level1
,
598 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
599 (void *)offsetof(i386_cpu_info_t
,
600 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][1]),
602 i386_cpu_info_nonzero
, "I",
603 "Number of large page data TLBs (2nd level)");
605 SYSCTL_PROC(_machdep_cpu_tlb
, OID_AUTO
, shared
,
606 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
607 (void *)offsetof(i386_cpu_info_t
, cpuid_stlb
),
609 i386_cpu_info_nonzero
, "I",
610 "Number of shared TLBs");
613 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, address_bits
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
616 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, physical
,
617 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
618 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_physical
),
620 i386_cpu_info
, "I", "Number of physical address bits");
622 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, virtual,
623 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
624 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_virtual
),
626 i386_cpu_info
, "I", "Number of virtual address bits");
629 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, core_count
,
630 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
631 (void *)offsetof(i386_cpu_info_t
, core_count
),
633 i386_cpu_info
, "I", "Number of enabled cores per package");
635 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, thread_count
,
636 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
637 (void *)offsetof(i386_cpu_info_t
, thread_count
),
639 i386_cpu_info
, "I", "Number of enabled threads per package");
641 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, flex_ratio
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
644 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, desired
,
645 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
647 cpu_flex_ratio_desired
, "I", "Flex ratio desired (0 disabled)");
649 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, min
,
650 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
652 cpu_flex_ratio_min
, "I", "Flex ratio min (efficiency)");
654 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, max
,
655 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
657 cpu_flex_ratio_max
, "I", "Flex ratio max (non-turbo)");
659 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, ucupdate
,
660 CTLTYPE_INT
| CTLFLAG_WR
| CTLFLAG_LOCKED
, 0, 0,
661 cpu_ucode_update
, "S", "Microcode update interface");
663 uint64_t pmap_pv_hashlist_walks
;
664 uint64_t pmap_pv_hashlist_cnts
;
665 uint32_t pmap_pv_hashlist_max
;
666 uint32_t pmap_kernel_text_ps
= PAGE_SIZE
;
667 extern uint32_t pv_hashed_kern_low_water_mark
;
669 /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/
671 SYSCTL_NODE(_machdep
, OID_AUTO
, pmap
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
674 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashwalks
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_walks
, "");
675 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashcnts
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_cnts
, "");
676 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, hashmax
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_max
, 0, "");
677 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kernel_text_ps
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_kernel_text_ps
, 0, "");
678 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kern_pv_reserve
, CTLFLAG_RW
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pv_hashed_kern_low_water_mark
, 0, "");
680 SYSCTL_NODE(_machdep
, OID_AUTO
, memmap
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "physical memory map");
682 uint64_t firmware_Conventional_bytes
= 0;
683 uint64_t firmware_RuntimeServices_bytes
= 0;
684 uint64_t firmware_ACPIReclaim_bytes
= 0;
685 uint64_t firmware_ACPINVS_bytes
= 0;
686 uint64_t firmware_PalCode_bytes
= 0;
687 uint64_t firmware_Reserved_bytes
= 0;
688 uint64_t firmware_Unusable_bytes
= 0;
689 uint64_t firmware_other_bytes
= 0;
691 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Conventional
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Conventional_bytes
, "");
692 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, RuntimeServices
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_RuntimeServices_bytes
, "");
693 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPIReclaim
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPIReclaim_bytes
, "");
694 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPINVS
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPINVS_bytes
, "");
695 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, PalCode
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_PalCode_bytes
, "");
696 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Reserved
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Reserved_bytes
, "");
697 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Unusable
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Unusable_bytes
, "");
698 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Other
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_other_bytes
, "");
700 SYSCTL_NODE(_machdep
, OID_AUTO
, tsc
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "Timestamp counter parameters");
702 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, frequency
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &tscFreq
, "");
704 SYSCTL_NODE(_machdep
, OID_AUTO
, misc
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
705 "Miscellaneous x86 kernel parameters");
707 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, panic_restart_timeout
,
708 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
710 panic_set_restart_timeout
, "I", "Panic restart timeout in seconds");
712 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, interrupt_latency_max
, CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
714 misc_interrupt_latency_max
, "A", "Maximum Interrupt latency");