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_logical_per_package SYSCTL_HANDLER_ARGS
153 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
154 __unused
void *unused_arg1
= arg1
;
155 __unused
int unused_arg2
= arg2
;
156 i386_cpu_info_t
*cpu_info
= cpuid_info();
158 if (!(cpuid_features() & CPUID_FEATURE_HTT
))
161 return SYSCTL_OUT(req
, &cpu_info
->cpuid_logical_per_package
,
162 sizeof(cpu_info
->cpuid_logical_per_package
));
166 cpu_flex_ratio_desired SYSCTL_HANDLER_ARGS
168 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
169 __unused
void *unused_arg1
= arg1
;
170 __unused
int unused_arg2
= arg2
;
171 i386_cpu_info_t
*cpu_info
= cpuid_info();
173 if (cpu_info
->cpuid_model
!= 26)
176 return SYSCTL_OUT(req
, &flex_ratio
, sizeof(flex_ratio
));
180 cpu_flex_ratio_min SYSCTL_HANDLER_ARGS
182 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
183 __unused
void *unused_arg1
= arg1
;
184 __unused
int unused_arg2
= arg2
;
185 i386_cpu_info_t
*cpu_info
= cpuid_info();
187 if (cpu_info
->cpuid_model
!= 26)
190 return SYSCTL_OUT(req
, &flex_ratio_min
, sizeof(flex_ratio_min
));
194 cpu_flex_ratio_max SYSCTL_HANDLER_ARGS
196 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
197 __unused
void *unused_arg1
= arg1
;
198 __unused
int unused_arg2
= arg2
;
199 i386_cpu_info_t
*cpu_info
= cpuid_info();
201 if (cpu_info
->cpuid_model
!= 26)
204 return SYSCTL_OUT(req
, &flex_ratio_max
, sizeof(flex_ratio_max
));
208 cpu_ucode_update SYSCTL_HANDLER_ARGS
210 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
211 __unused
void *unused_arg1
= arg1
;
212 __unused
int unused_arg2
= arg2
;
216 error
= SYSCTL_IN(req
, &addr
, sizeof(addr
));
220 int ret
= ucode_interface(addr
);
224 extern uint64_t panic_restart_timeout
;
226 panic_set_restart_timeout(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
228 int new_value
= 0, old_value
= 0, changed
= 0, error
;
231 if (panic_restart_timeout
) {
232 absolutetime_to_nanoseconds(panic_restart_timeout
, &nstime
);
233 old_value
= nstime
/ NSEC_PER_SEC
;
236 error
= sysctl_io_number(req
, old_value
, sizeof(int), &new_value
, &changed
);
237 if (error
== 0 && changed
) {
238 nanoseconds_to_absolutetime(((uint64_t)new_value
) * NSEC_PER_SEC
, &panic_restart_timeout
);
244 * Populates the {CPU, vector, latency} triple for the maximum observed primary
248 misc_interrupt_latency_max(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
250 int changed
= 0, error
;
254 interrupt_populate_latency_stats(buf
, sizeof(buf
));
256 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
258 if (error
== 0 && changed
) {
259 interrupt_reset_latency_stats();
265 SYSCTL_NODE(_machdep
, OID_AUTO
, cpu
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
268 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_basic
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
269 (void *)offsetof(i386_cpu_info_t
, cpuid_max_basic
),sizeof(uint32_t),
270 i386_cpu_info
, "IU", "Max Basic Information value");
272 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_ext
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
273 (void *)offsetof(i386_cpu_info_t
, cpuid_max_ext
), sizeof(uint32_t),
274 i386_cpu_info
, "IU", "Max Extended Function Information value");
276 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, vendor
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
277 (void *)offsetof(i386_cpu_info_t
, cpuid_vendor
), 0,
278 i386_cpu_info
, "A", "CPU vendor");
280 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand_string
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
281 (void *)offsetof(i386_cpu_info_t
, cpuid_brand_string
), 0,
282 i386_cpu_info
, "A", "CPU brand string");
284 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, family
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
285 (void *)offsetof(i386_cpu_info_t
, cpuid_family
), sizeof(uint8_t),
286 i386_cpu_info
, "I", "CPU family");
288 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, model
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
289 (void *)offsetof(i386_cpu_info_t
, cpuid_model
), sizeof(uint8_t),
290 i386_cpu_info
, "I", "CPU model");
292 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extmodel
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
293 (void *)offsetof(i386_cpu_info_t
, cpuid_extmodel
), sizeof(uint8_t),
294 i386_cpu_info
, "I", "CPU extended model");
296 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfamily
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
297 (void *)offsetof(i386_cpu_info_t
, cpuid_extfamily
), sizeof(uint8_t),
298 i386_cpu_info
, "I", "CPU extended family");
300 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, stepping
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
301 (void *)offsetof(i386_cpu_info_t
, cpuid_stepping
), sizeof(uint8_t),
302 i386_cpu_info
, "I", "CPU stepping");
304 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, feature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
305 (void *)offsetof(i386_cpu_info_t
, cpuid_features
), sizeof(uint64_t),
306 i386_cpu_info
, "IU", "CPU features");
308 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
309 (void *)offsetof(i386_cpu_info_t
, cpuid_extfeatures
), sizeof(uint64_t),
310 i386_cpu_info
, "IU", "CPU extended features");
312 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, signature
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
313 (void *)offsetof(i386_cpu_info_t
, cpuid_signature
), sizeof(uint32_t),
314 i386_cpu_info
, "I", "CPU signature");
316 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
317 (void *)offsetof(i386_cpu_info_t
, cpuid_brand
), sizeof(uint8_t),
318 i386_cpu_info
, "I", "CPU brand");
320 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, features
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
322 cpu_features
, "A", "CPU feature names");
324 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeatures
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
326 cpu_extfeatures
, "A", "CPU extended feature names");
328 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, logical_per_package
,
329 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
331 cpu_logical_per_package
, "I", "CPU logical cpus per package");
333 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, cores_per_package
,
334 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
335 (void *)offsetof(i386_cpu_info_t
, cpuid_cores_per_package
),
337 i386_cpu_info
, "I", "CPU cores per package");
339 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, microcode_version
,
340 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
341 (void *)offsetof(i386_cpu_info_t
, cpuid_microcode_version
),
343 i386_cpu_info
, "I", "Microcode version number");
345 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, processor_flag
,
346 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
347 (void *)offsetof(i386_cpu_info_t
, cpuid_processor_flag
),
349 i386_cpu_info
, "I", "CPU processor flag");
352 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, mwait
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
355 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_min
,
356 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
357 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_min
),
359 cpu_mwait
, "I", "Monitor/mwait minimum line size");
361 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_max
,
362 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
363 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_max
),
365 cpu_mwait
, "I", "Monitor/mwait maximum line size");
367 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, extensions
,
368 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
369 (void *)offsetof(cpuid_mwait_leaf_t
, extensions
),
371 cpu_mwait
, "I", "Monitor/mwait extensions");
373 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, sub_Cstates
,
374 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
375 (void *)offsetof(cpuid_mwait_leaf_t
, sub_Cstates
),
377 cpu_mwait
, "I", "Monitor/mwait sub C-states");
380 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, thermal
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
383 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, sensor
,
384 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
385 (void *)offsetof(cpuid_thermal_leaf_t
, sensor
),
387 cpu_thermal
, "I", "Thermal sensor present");
389 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, dynamic_acceleration
,
390 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
391 (void *)offsetof(cpuid_thermal_leaf_t
, dynamic_acceleration
),
393 cpu_thermal
, "I", "Dynamic Acceleration Technology (Turbo Mode)");
395 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, invariant_APIC_timer
,
396 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
397 (void *)offsetof(cpuid_thermal_leaf_t
, invariant_APIC_timer
),
399 cpu_thermal
, "I", "Invariant APIC Timer");
401 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, thresholds
,
402 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
403 (void *)offsetof(cpuid_thermal_leaf_t
, thresholds
),
405 cpu_thermal
, "I", "Number of interrupt thresholds");
407 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, ACNT_MCNT
,
408 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
409 (void *)offsetof(cpuid_thermal_leaf_t
, ACNT_MCNT
),
411 cpu_thermal
, "I", "ACNT_MCNT capability");
413 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, core_power_limits
,
414 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
415 (void *)offsetof(cpuid_thermal_leaf_t
, core_power_limits
),
417 cpu_thermal
, "I", "Power Limit Notifications at a Core Level");
419 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, fine_grain_clock_mod
,
420 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
421 (void *)offsetof(cpuid_thermal_leaf_t
, fine_grain_clock_mod
),
423 cpu_thermal
, "I", "Fine Grain Clock Modulation");
425 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, package_thermal_intr
,
426 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
427 (void *)offsetof(cpuid_thermal_leaf_t
, package_thermal_intr
),
429 cpu_thermal
, "I", "Packge Thermal interrupt and Status");
431 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, hardware_feedback
,
432 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
433 (void *)offsetof(cpuid_thermal_leaf_t
, hardware_feedback
),
435 cpu_thermal
, "I", "Hardware Coordination Feedback");
437 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, energy_policy
,
438 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
439 (void *)offsetof(cpuid_thermal_leaf_t
, energy_policy
),
441 cpu_thermal
, "I", "Energy Efficient Policy Support");
444 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, xsave
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
447 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state
,
448 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
449 (void *)offsetof(cpuid_xsave_leaf_t
, extended_state
),
450 sizeof(cpuid_xsave_leaf_t
),
451 cpu_xsave
, "IU", "XSAVE Extended State");
454 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, arch_perf
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
457 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, version
,
458 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
459 (void *)offsetof(cpuid_arch_perf_leaf_t
, version
),
461 cpu_arch_perf
, "I", "Architectural Performance Version Number");
463 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, number
,
464 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
465 (void *)offsetof(cpuid_arch_perf_leaf_t
, number
),
467 cpu_arch_perf
, "I", "Number of counters per logical cpu");
469 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, width
,
470 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
471 (void *)offsetof(cpuid_arch_perf_leaf_t
, width
),
473 cpu_arch_perf
, "I", "Bit width of counters");
475 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events_number
,
476 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
477 (void *)offsetof(cpuid_arch_perf_leaf_t
, events_number
),
479 cpu_arch_perf
, "I", "Number of monitoring events");
481 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events
,
482 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
483 (void *)offsetof(cpuid_arch_perf_leaf_t
, events
),
485 cpu_arch_perf
, "I", "Bit vector of events");
487 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_number
,
488 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
489 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_number
),
491 cpu_arch_perf
, "I", "Number of fixed-function counters");
493 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_width
,
494 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
495 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_width
),
497 cpu_arch_perf
, "I", "Bit-width of fixed-function counters");
500 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, cache
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
503 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, linesize
,
504 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
505 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_linesize
),
507 i386_cpu_info
, "I", "Cacheline size");
509 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, L2_associativity
,
510 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
511 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_L2_associativity
),
513 i386_cpu_info
, "I", "L2 cache associativity");
515 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, size
,
516 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
517 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_size
),
519 i386_cpu_info
, "I", "Cache size (in Kbytes)");
522 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tlb
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
524 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, inst
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
526 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, data
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
529 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, small
,
530 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
531 (void *)offsetof(i386_cpu_info_t
,
532 cpuid_tlb
[TLB_INST
][TLB_SMALL
][0]),
534 i386_cpu_info_nonzero
, "I",
535 "Number of small page instruction TLBs");
537 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small
,
538 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
539 (void *)offsetof(i386_cpu_info_t
,
540 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][0]),
542 i386_cpu_info_nonzero
, "I",
543 "Number of small page data TLBs (1st level)");
545 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small_level1
,
546 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
547 (void *)offsetof(i386_cpu_info_t
,
548 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][1]),
550 i386_cpu_info_nonzero
, "I",
551 "Number of small page data TLBs (2nd level)");
553 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, large
,
554 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
555 (void *)offsetof(i386_cpu_info_t
,
556 cpuid_tlb
[TLB_INST
][TLB_LARGE
][0]),
558 i386_cpu_info_nonzero
, "I",
559 "Number of large page instruction TLBs");
561 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large
,
562 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
563 (void *)offsetof(i386_cpu_info_t
,
564 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][0]),
566 i386_cpu_info_nonzero
, "I",
567 "Number of large page data TLBs (1st level)");
569 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large_level1
,
570 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
571 (void *)offsetof(i386_cpu_info_t
,
572 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][1]),
574 i386_cpu_info_nonzero
, "I",
575 "Number of large page data TLBs (2nd level)");
577 SYSCTL_PROC(_machdep_cpu_tlb
, OID_AUTO
, shared
,
578 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
579 (void *)offsetof(i386_cpu_info_t
, cpuid_stlb
),
581 i386_cpu_info_nonzero
, "I",
582 "Number of shared TLBs");
585 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, address_bits
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
588 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, physical
,
589 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
590 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_physical
),
592 i386_cpu_info
, "I", "Number of physical address bits");
594 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, virtual,
595 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
596 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_virtual
),
598 i386_cpu_info
, "I", "Number of virtual address bits");
601 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, core_count
,
602 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
603 (void *)offsetof(i386_cpu_info_t
, core_count
),
605 i386_cpu_info
, "I", "Number of enabled cores per package");
607 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, thread_count
,
608 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
609 (void *)offsetof(i386_cpu_info_t
, thread_count
),
611 i386_cpu_info
, "I", "Number of enabled threads per package");
613 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, flex_ratio
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
616 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, desired
,
617 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
619 cpu_flex_ratio_desired
, "I", "Flex ratio desired (0 disabled)");
621 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, min
,
622 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
624 cpu_flex_ratio_min
, "I", "Flex ratio min (efficiency)");
626 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, max
,
627 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
629 cpu_flex_ratio_max
, "I", "Flex ratio max (non-turbo)");
631 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, ucupdate
,
632 CTLTYPE_INT
| CTLFLAG_WR
| CTLFLAG_LOCKED
, 0, 0,
633 cpu_ucode_update
, "S", "Microcode update interface");
635 uint64_t pmap_pv_hashlist_walks
;
636 uint64_t pmap_pv_hashlist_cnts
;
637 uint32_t pmap_pv_hashlist_max
;
638 uint32_t pmap_kernel_text_ps
= PAGE_SIZE
;
639 extern uint32_t pv_hashed_kern_low_water_mark
;
641 /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/
643 SYSCTL_NODE(_machdep
, OID_AUTO
, pmap
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
646 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashwalks
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_walks
, "");
647 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashcnts
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_cnts
, "");
648 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, hashmax
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_max
, 0, "");
649 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kernel_text_ps
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_kernel_text_ps
, 0, "");
650 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kern_pv_reserve
, CTLFLAG_RW
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pv_hashed_kern_low_water_mark
, 0, "");
652 SYSCTL_NODE(_machdep
, OID_AUTO
, memmap
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "physical memory map");
654 uint64_t firmware_Conventional_bytes
= 0;
655 uint64_t firmware_RuntimeServices_bytes
= 0;
656 uint64_t firmware_ACPIReclaim_bytes
= 0;
657 uint64_t firmware_ACPINVS_bytes
= 0;
658 uint64_t firmware_PalCode_bytes
= 0;
659 uint64_t firmware_Reserved_bytes
= 0;
660 uint64_t firmware_Unusable_bytes
= 0;
661 uint64_t firmware_other_bytes
= 0;
663 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Conventional
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Conventional_bytes
, "");
664 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, RuntimeServices
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_RuntimeServices_bytes
, "");
665 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPIReclaim
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPIReclaim_bytes
, "");
666 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPINVS
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPINVS_bytes
, "");
667 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, PalCode
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_PalCode_bytes
, "");
668 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Reserved
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Reserved_bytes
, "");
669 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Unusable
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Unusable_bytes
, "");
670 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Other
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_other_bytes
, "");
672 SYSCTL_NODE(_machdep
, OID_AUTO
, tsc
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "Timestamp counter parameters");
674 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, frequency
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &tscFreq
, "");
676 SYSCTL_NODE(_machdep
, OID_AUTO
, misc
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
677 "Miscellaneous x86 kernel parameters");
679 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, panic_restart_timeout
,
680 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
682 panic_set_restart_timeout
, "I", "Panic restart timeout in seconds");
684 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, interrupt_latency_max
, CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
686 misc_interrupt_latency_max
, "A", "Maximum Interrupt latency");