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");
443 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, xsave
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
446 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state
,
447 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
448 (void *)offsetof(cpuid_xsave_leaf_t
, extended_state
),
449 sizeof(cpuid_xsave_leaf_t
),
450 cpu_xsave
, "IU", "XSAVE Extended State");
453 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, arch_perf
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
456 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, version
,
457 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
458 (void *)offsetof(cpuid_arch_perf_leaf_t
, version
),
460 cpu_arch_perf
, "I", "Architectural Performance Version Number");
462 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, number
,
463 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
464 (void *)offsetof(cpuid_arch_perf_leaf_t
, number
),
466 cpu_arch_perf
, "I", "Number of counters per logical cpu");
468 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, width
,
469 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
470 (void *)offsetof(cpuid_arch_perf_leaf_t
, width
),
472 cpu_arch_perf
, "I", "Bit width of counters");
474 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events_number
,
475 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
476 (void *)offsetof(cpuid_arch_perf_leaf_t
, events_number
),
478 cpu_arch_perf
, "I", "Number of monitoring events");
480 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events
,
481 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
482 (void *)offsetof(cpuid_arch_perf_leaf_t
, events
),
484 cpu_arch_perf
, "I", "Bit vector of events");
486 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_number
,
487 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
488 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_number
),
490 cpu_arch_perf
, "I", "Number of fixed-function counters");
492 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_width
,
493 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
494 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_width
),
496 cpu_arch_perf
, "I", "Bit-width of fixed-function counters");
499 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, cache
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
502 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, linesize
,
503 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
504 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_linesize
),
506 i386_cpu_info
, "I", "Cacheline size");
508 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, L2_associativity
,
509 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
510 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_L2_associativity
),
512 i386_cpu_info
, "I", "L2 cache associativity");
514 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, size
,
515 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
516 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_size
),
518 i386_cpu_info
, "I", "Cache size (in Kbytes)");
521 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tlb
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
523 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, inst
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
525 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, data
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
528 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, small
,
529 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
530 (void *)offsetof(i386_cpu_info_t
,
531 cpuid_tlb
[TLB_INST
][TLB_SMALL
][0]),
533 i386_cpu_info_nonzero
, "I",
534 "Number of small page instruction TLBs");
536 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small
,
537 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
538 (void *)offsetof(i386_cpu_info_t
,
539 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][0]),
541 i386_cpu_info_nonzero
, "I",
542 "Number of small page data TLBs (1st level)");
544 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small_level1
,
545 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
546 (void *)offsetof(i386_cpu_info_t
,
547 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][1]),
549 i386_cpu_info_nonzero
, "I",
550 "Number of small page data TLBs (2nd level)");
552 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, large
,
553 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
554 (void *)offsetof(i386_cpu_info_t
,
555 cpuid_tlb
[TLB_INST
][TLB_LARGE
][0]),
557 i386_cpu_info_nonzero
, "I",
558 "Number of large page instruction TLBs");
560 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large
,
561 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
562 (void *)offsetof(i386_cpu_info_t
,
563 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][0]),
565 i386_cpu_info_nonzero
, "I",
566 "Number of large page data TLBs (1st level)");
568 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large_level1
,
569 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
570 (void *)offsetof(i386_cpu_info_t
,
571 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][1]),
573 i386_cpu_info_nonzero
, "I",
574 "Number of large page data TLBs (2nd level)");
576 SYSCTL_PROC(_machdep_cpu_tlb
, OID_AUTO
, shared
,
577 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
578 (void *)offsetof(i386_cpu_info_t
, cpuid_stlb
),
580 i386_cpu_info_nonzero
, "I",
581 "Number of shared TLBs");
584 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, address_bits
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
587 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, physical
,
588 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
589 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_physical
),
591 i386_cpu_info
, "I", "Number of physical address bits");
593 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, virtual,
594 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
595 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_virtual
),
597 i386_cpu_info
, "I", "Number of virtual address bits");
600 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, core_count
,
601 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
602 (void *)offsetof(i386_cpu_info_t
, core_count
),
604 i386_cpu_info
, "I", "Number of enabled cores per package");
606 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, thread_count
,
607 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
608 (void *)offsetof(i386_cpu_info_t
, thread_count
),
610 i386_cpu_info
, "I", "Number of enabled threads per package");
612 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, flex_ratio
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
615 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, desired
,
616 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
618 cpu_flex_ratio_desired
, "I", "Flex ratio desired (0 disabled)");
620 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, min
,
621 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
623 cpu_flex_ratio_min
, "I", "Flex ratio min (efficiency)");
625 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, max
,
626 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
628 cpu_flex_ratio_max
, "I", "Flex ratio max (non-turbo)");
630 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, ucupdate
,
631 CTLTYPE_INT
| CTLFLAG_WR
| CTLFLAG_LOCKED
, 0, 0,
632 cpu_ucode_update
, "S", "Microcode update interface");
634 uint64_t pmap_pv_hashlist_walks
;
635 uint64_t pmap_pv_hashlist_cnts
;
636 uint32_t pmap_pv_hashlist_max
;
637 uint32_t pmap_kernel_text_ps
= PAGE_SIZE
;
638 extern uint32_t pv_hashed_kern_low_water_mark
;
640 /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/
642 SYSCTL_NODE(_machdep
, OID_AUTO
, pmap
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
645 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashwalks
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_walks
, "");
646 SYSCTL_QUAD (_machdep_pmap
, OID_AUTO
, hashcnts
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_cnts
, "");
647 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, hashmax
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_max
, 0, "");
648 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kernel_text_ps
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_kernel_text_ps
, 0, "");
649 SYSCTL_INT (_machdep_pmap
, OID_AUTO
, kern_pv_reserve
, CTLFLAG_RW
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pv_hashed_kern_low_water_mark
, 0, "");
651 SYSCTL_NODE(_machdep
, OID_AUTO
, memmap
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "physical memory map");
653 uint64_t firmware_Conventional_bytes
= 0;
654 uint64_t firmware_RuntimeServices_bytes
= 0;
655 uint64_t firmware_ACPIReclaim_bytes
= 0;
656 uint64_t firmware_ACPINVS_bytes
= 0;
657 uint64_t firmware_PalCode_bytes
= 0;
658 uint64_t firmware_Reserved_bytes
= 0;
659 uint64_t firmware_Unusable_bytes
= 0;
660 uint64_t firmware_other_bytes
= 0;
662 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Conventional
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Conventional_bytes
, "");
663 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, RuntimeServices
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_RuntimeServices_bytes
, "");
664 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPIReclaim
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPIReclaim_bytes
, "");
665 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPINVS
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_ACPINVS_bytes
, "");
666 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, PalCode
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_PalCode_bytes
, "");
667 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Reserved
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Reserved_bytes
, "");
668 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Unusable
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_Unusable_bytes
, "");
669 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Other
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &firmware_other_bytes
, "");
671 SYSCTL_NODE(_machdep
, OID_AUTO
, tsc
, CTLFLAG_RD
|CTLFLAG_LOCKED
, NULL
, "Timestamp counter parameters");
673 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, frequency
, CTLFLAG_RD
|CTLFLAG_LOCKED
, &tscFreq
, "");
675 SYSCTL_NODE(_machdep
, OID_AUTO
, misc
, CTLFLAG_RW
|CTLFLAG_LOCKED
, 0,
676 "Miscellaneous x86 kernel parameters");
678 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, panic_restart_timeout
,
679 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
681 panic_set_restart_timeout
, "I", "Panic restart timeout in seconds");
683 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, interrupt_latency_max
, CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
685 misc_interrupt_latency_max
, "A", "Maximum Interrupt latency");