]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/i386/sysctl.c
xnu-1504.9.37.tar.gz
[apple/xnu.git] / bsd / dev / i386 / sysctl.c
1 /*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
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
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29 #include <string.h>
30 #include <sys/param.h>
31 #include <sys/kernel.h>
32 #include <sys/sysctl.h>
33 #include <i386/cpuid.h>
34 #include <i386/tsc.h>
35
36 static int
37 _i386_cpu_info SYSCTL_HANDLER_ARGS
38 {
39 __unused struct sysctl_oid *unused_oidp = oidp;
40 void *ptr = arg1;
41 int value;
42
43 if (arg2 == -1) {
44 ptr = *(void **)ptr;
45 arg2 = 0;
46 }
47
48 if (arg2 == 0 && ((char *)ptr)[0] == '\0') {
49 return ENOENT;
50 }
51
52 if (arg2 == sizeof(uint8_t)) {
53 value = (uint32_t) *(uint8_t *)ptr;
54 ptr = &value;
55 arg2 = sizeof(uint32_t);
56 }
57 return SYSCTL_OUT(req, ptr, arg2 ? (size_t) arg2 : strlen((char *)ptr)+1);
58 }
59
60 static int
61 i386_cpu_info SYSCTL_HANDLER_ARGS
62 {
63 void *ptr = (uint8_t *)cpuid_info() + (uintptr_t)arg1;
64 return _i386_cpu_info(oidp, ptr, arg2, req);
65 }
66
67 static int
68 i386_cpu_info_nonzero SYSCTL_HANDLER_ARGS
69 {
70 void *ptr = (uint8_t *)cpuid_info() + (uintptr_t)arg1;
71 int value = *(uint32_t *)ptr;
72
73 if (value == 0)
74 return ENOENT;
75
76 return _i386_cpu_info(oidp, ptr, arg2, req);
77 }
78 static int
79 cpu_mwait SYSCTL_HANDLER_ARGS
80 {
81 i386_cpu_info_t *cpu_info = cpuid_info();
82 void *ptr = (uint8_t *)cpu_info->cpuid_mwait_leafp + (uintptr_t)arg1;
83 if (cpu_info->cpuid_mwait_leafp == NULL)
84 return ENOENT;
85 return _i386_cpu_info(oidp, ptr, arg2, req);
86 }
87
88 static int
89 cpu_thermal SYSCTL_HANDLER_ARGS
90 {
91 i386_cpu_info_t *cpu_info = cpuid_info();
92 void *ptr = (uint8_t *)cpu_info->cpuid_thermal_leafp + (uintptr_t)arg1;
93 if (cpu_info->cpuid_thermal_leafp == NULL)
94 return ENOENT;
95 return _i386_cpu_info(oidp, ptr, arg2, req);
96 }
97
98 static int
99 cpu_arch_perf SYSCTL_HANDLER_ARGS
100 {
101 i386_cpu_info_t *cpu_info = cpuid_info();
102 void *ptr = (uint8_t *)cpu_info->cpuid_arch_perf_leafp + (uintptr_t)arg1;
103 if (cpu_info->cpuid_arch_perf_leafp == NULL)
104 return ENOENT;
105 return _i386_cpu_info(oidp, ptr, arg2, req);
106 }
107
108 static int
109 cpu_features SYSCTL_HANDLER_ARGS
110 {
111 __unused struct sysctl_oid *unused_oidp = oidp;
112 __unused void *unused_arg1 = arg1;
113 __unused int unused_arg2 = arg2;
114 char buf[256];
115
116 buf[0] = '\0';
117 cpuid_get_feature_names(cpuid_features(), buf, sizeof(buf));
118
119 return SYSCTL_OUT(req, buf, strlen(buf) + 1);
120 }
121
122 static int
123 cpu_extfeatures SYSCTL_HANDLER_ARGS
124 {
125 __unused struct sysctl_oid *unused_oidp = oidp;
126 __unused void *unused_arg1 = arg1;
127 __unused int unused_arg2 = arg2;
128 char buf[256];
129
130 buf[0] = '\0';
131 cpuid_get_extfeature_names(cpuid_extfeatures(), buf, sizeof(buf));
132
133 return SYSCTL_OUT(req, buf, strlen(buf) + 1);
134 }
135
136 static int
137 cpu_logical_per_package SYSCTL_HANDLER_ARGS
138 {
139 __unused struct sysctl_oid *unused_oidp = oidp;
140 __unused void *unused_arg1 = arg1;
141 __unused int unused_arg2 = arg2;
142 i386_cpu_info_t *cpu_info = cpuid_info();
143
144 if (!(cpuid_features() & CPUID_FEATURE_HTT))
145 return ENOENT;
146
147 return SYSCTL_OUT(req, &cpu_info->cpuid_logical_per_package,
148 sizeof(cpu_info->cpuid_logical_per_package));
149 }
150
151 static int
152 cpu_flex_ratio_desired SYSCTL_HANDLER_ARGS
153 {
154 __unused struct sysctl_oid *unused_oidp = oidp;
155 __unused void *unused_arg1 = arg1;
156 __unused int unused_arg2 = arg2;
157 i386_cpu_info_t *cpu_info = cpuid_info();
158
159 if (cpu_info->cpuid_model != 26)
160 return ENOENT;
161
162 return SYSCTL_OUT(req, &flex_ratio, sizeof(flex_ratio));
163 }
164
165 static int
166 cpu_flex_ratio_min SYSCTL_HANDLER_ARGS
167 {
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();
172
173 if (cpu_info->cpuid_model != 26)
174 return ENOENT;
175
176 return SYSCTL_OUT(req, &flex_ratio_min, sizeof(flex_ratio_min));
177 }
178
179 static int
180 cpu_flex_ratio_max SYSCTL_HANDLER_ARGS
181 {
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();
186
187 if (cpu_info->cpuid_model != 26)
188 return ENOENT;
189
190 return SYSCTL_OUT(req, &flex_ratio_max, sizeof(flex_ratio_max));
191 }
192
193 SYSCTL_NODE(_machdep, OID_AUTO, cpu, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
194 "CPU info");
195
196 SYSCTL_PROC(_machdep_cpu, OID_AUTO, max_basic, CTLTYPE_INT | CTLFLAG_RD,
197 (void *)offsetof(i386_cpu_info_t, cpuid_max_basic),sizeof(uint32_t),
198 i386_cpu_info, "IU", "Max Basic Information value");
199
200 SYSCTL_PROC(_machdep_cpu, OID_AUTO, max_ext, CTLTYPE_INT | CTLFLAG_RD,
201 (void *)offsetof(i386_cpu_info_t, cpuid_max_ext), sizeof(uint32_t),
202 i386_cpu_info, "IU", "Max Extended Function Information value");
203
204 SYSCTL_PROC(_machdep_cpu, OID_AUTO, vendor, CTLTYPE_STRING | CTLFLAG_RD,
205 (void *)offsetof(i386_cpu_info_t, cpuid_vendor), 0,
206 i386_cpu_info, "A", "CPU vendor");
207
208 SYSCTL_PROC(_machdep_cpu, OID_AUTO, brand_string, CTLTYPE_STRING | CTLFLAG_RD,
209 (void *)offsetof(i386_cpu_info_t, cpuid_brand_string), 0,
210 i386_cpu_info, "A", "CPU brand string");
211
212 SYSCTL_PROC(_machdep_cpu, OID_AUTO, family, CTLTYPE_INT | CTLFLAG_RD,
213 (void *)offsetof(i386_cpu_info_t, cpuid_family), sizeof(uint8_t),
214 i386_cpu_info, "I", "CPU family");
215
216 SYSCTL_PROC(_machdep_cpu, OID_AUTO, model, CTLTYPE_INT | CTLFLAG_RD,
217 (void *)offsetof(i386_cpu_info_t, cpuid_model), sizeof(uint8_t),
218 i386_cpu_info, "I", "CPU model");
219
220 SYSCTL_PROC(_machdep_cpu, OID_AUTO, extmodel, CTLTYPE_INT | CTLFLAG_RD,
221 (void *)offsetof(i386_cpu_info_t, cpuid_extmodel), sizeof(uint8_t),
222 i386_cpu_info, "I", "CPU extended model");
223
224 SYSCTL_PROC(_machdep_cpu, OID_AUTO, extfamily, CTLTYPE_INT | CTLFLAG_RD,
225 (void *)offsetof(i386_cpu_info_t, cpuid_extfamily), sizeof(uint8_t),
226 i386_cpu_info, "I", "CPU extended family");
227
228 SYSCTL_PROC(_machdep_cpu, OID_AUTO, stepping, CTLTYPE_INT | CTLFLAG_RD,
229 (void *)offsetof(i386_cpu_info_t, cpuid_stepping), sizeof(uint8_t),
230 i386_cpu_info, "I", "CPU stepping");
231
232 SYSCTL_PROC(_machdep_cpu, OID_AUTO, feature_bits, CTLTYPE_QUAD | CTLFLAG_RD,
233 (void *)offsetof(i386_cpu_info_t, cpuid_features), sizeof(uint64_t),
234 i386_cpu_info, "IU", "CPU features");
235
236 SYSCTL_PROC(_machdep_cpu, OID_AUTO, extfeature_bits, CTLTYPE_QUAD | CTLFLAG_RD,
237 (void *)offsetof(i386_cpu_info_t, cpuid_extfeatures), sizeof(uint64_t),
238 i386_cpu_info, "IU", "CPU extended features");
239
240 SYSCTL_PROC(_machdep_cpu, OID_AUTO, signature, CTLTYPE_INT | CTLFLAG_RD,
241 (void *)offsetof(i386_cpu_info_t, cpuid_signature), sizeof(uint32_t),
242 i386_cpu_info, "I", "CPU signature");
243
244 SYSCTL_PROC(_machdep_cpu, OID_AUTO, brand, CTLTYPE_INT | CTLFLAG_RD,
245 (void *)offsetof(i386_cpu_info_t, cpuid_brand), sizeof(uint8_t),
246 i386_cpu_info, "I", "CPU brand");
247
248 SYSCTL_PROC(_machdep_cpu, OID_AUTO, features, CTLTYPE_STRING | CTLFLAG_RD,
249 0, 0,
250 cpu_features, "A", "CPU feature names");
251
252 SYSCTL_PROC(_machdep_cpu, OID_AUTO, extfeatures, CTLTYPE_STRING | CTLFLAG_RD,
253 0, 0,
254 cpu_extfeatures, "A", "CPU extended feature names");
255
256 SYSCTL_PROC(_machdep_cpu, OID_AUTO, logical_per_package,
257 CTLTYPE_INT | CTLFLAG_RD,
258 0, 0,
259 cpu_logical_per_package, "I", "CPU logical cpus per package");
260
261 SYSCTL_PROC(_machdep_cpu, OID_AUTO, cores_per_package,
262 CTLTYPE_INT | CTLFLAG_RD,
263 (void *)offsetof(i386_cpu_info_t, cpuid_cores_per_package),
264 sizeof(uint32_t),
265 i386_cpu_info, "I", "CPU cores per package");
266
267 SYSCTL_PROC(_machdep_cpu, OID_AUTO, microcode_version,
268 CTLTYPE_INT | CTLFLAG_RD,
269 (void *)offsetof(i386_cpu_info_t, cpuid_microcode_version),
270 sizeof(uint32_t),
271 i386_cpu_info, "I", "Microcode version number");
272
273
274 SYSCTL_NODE(_machdep_cpu, OID_AUTO, mwait, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
275 "mwait");
276
277 SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, linesize_min,
278 CTLTYPE_INT | CTLFLAG_RD,
279 (void *)offsetof(cpuid_mwait_leaf_t, linesize_min),
280 sizeof(uint32_t),
281 cpu_mwait, "I", "Monitor/mwait minimum line size");
282
283 SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, linesize_max,
284 CTLTYPE_INT | CTLFLAG_RD,
285 (void *)offsetof(cpuid_mwait_leaf_t, linesize_max),
286 sizeof(uint32_t),
287 cpu_mwait, "I", "Monitor/mwait maximum line size");
288
289 SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, extensions,
290 CTLTYPE_INT | CTLFLAG_RD,
291 (void *)offsetof(cpuid_mwait_leaf_t, extensions),
292 sizeof(uint32_t),
293 cpu_mwait, "I", "Monitor/mwait extensions");
294
295 SYSCTL_PROC(_machdep_cpu_mwait, OID_AUTO, sub_Cstates,
296 CTLTYPE_INT | CTLFLAG_RD,
297 (void *)offsetof(cpuid_mwait_leaf_t, sub_Cstates),
298 sizeof(uint32_t),
299 cpu_mwait, "I", "Monitor/mwait sub C-states");
300
301
302 SYSCTL_NODE(_machdep_cpu, OID_AUTO, thermal, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
303 "thermal");
304
305 SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, sensor,
306 CTLTYPE_INT | CTLFLAG_RD,
307 (void *)offsetof(cpuid_thermal_leaf_t, sensor),
308 sizeof(boolean_t),
309 cpu_thermal, "I", "Thermal sensor present");
310
311 SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, dynamic_acceleration,
312 CTLTYPE_INT | CTLFLAG_RD,
313 (void *)offsetof(cpuid_thermal_leaf_t, dynamic_acceleration),
314 sizeof(boolean_t),
315 cpu_thermal, "I", "Dynamic Acceleration Technology (Turbo Mode)");
316
317 SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, invariant_APIC_timer,
318 CTLTYPE_INT | CTLFLAG_RD,
319 (void *)offsetof(cpuid_thermal_leaf_t, invariant_APIC_timer),
320 sizeof(boolean_t),
321 cpu_thermal, "I", "Invariant APIC Timer");
322
323 SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, thresholds,
324 CTLTYPE_INT | CTLFLAG_RD,
325 (void *)offsetof(cpuid_thermal_leaf_t, thresholds),
326 sizeof(uint32_t),
327 cpu_thermal, "I", "Number of interrupt thresholds");
328
329 SYSCTL_PROC(_machdep_cpu_thermal, OID_AUTO, ACNT_MCNT,
330 CTLTYPE_INT | CTLFLAG_RD,
331 (void *)offsetof(cpuid_thermal_leaf_t, ACNT_MCNT),
332 sizeof(boolean_t),
333 cpu_thermal, "I", "ACNT_MCNT capability");
334
335
336 SYSCTL_NODE(_machdep_cpu, OID_AUTO, arch_perf, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
337 "arch_perf");
338
339 SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, version,
340 CTLTYPE_INT | CTLFLAG_RD,
341 (void *)offsetof(cpuid_arch_perf_leaf_t, version),
342 sizeof(uint8_t),
343 cpu_arch_perf, "I", "Architectural Performance Version Number");
344
345 SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, number,
346 CTLTYPE_INT | CTLFLAG_RD,
347 (void *)offsetof(cpuid_arch_perf_leaf_t, number),
348 sizeof(uint8_t),
349 cpu_arch_perf, "I", "Number of counters per logical cpu");
350
351 SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, width,
352 CTLTYPE_INT | CTLFLAG_RD,
353 (void *)offsetof(cpuid_arch_perf_leaf_t, width),
354 sizeof(uint8_t),
355 cpu_arch_perf, "I", "Bit width of counters");
356
357 SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, events_number,
358 CTLTYPE_INT | CTLFLAG_RD,
359 (void *)offsetof(cpuid_arch_perf_leaf_t, events_number),
360 sizeof(uint8_t),
361 cpu_arch_perf, "I", "Number of monitoring events");
362
363 SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, events,
364 CTLTYPE_INT | CTLFLAG_RD,
365 (void *)offsetof(cpuid_arch_perf_leaf_t, events),
366 sizeof(uint32_t),
367 cpu_arch_perf, "I", "Bit vector of events");
368
369 SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, fixed_number,
370 CTLTYPE_INT | CTLFLAG_RD,
371 (void *)offsetof(cpuid_arch_perf_leaf_t, fixed_number),
372 sizeof(uint8_t),
373 cpu_arch_perf, "I", "Number of fixed-function counters");
374
375 SYSCTL_PROC(_machdep_cpu_arch_perf, OID_AUTO, fixed_width,
376 CTLTYPE_INT | CTLFLAG_RD,
377 (void *)offsetof(cpuid_arch_perf_leaf_t, fixed_width),
378 sizeof(uint8_t),
379 cpu_arch_perf, "I", "Bit-width of fixed-function counters");
380
381
382 SYSCTL_NODE(_machdep_cpu, OID_AUTO, cache, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
383 "cache");
384
385 SYSCTL_PROC(_machdep_cpu_cache, OID_AUTO, linesize,
386 CTLTYPE_INT | CTLFLAG_RD,
387 (void *)offsetof(i386_cpu_info_t, cpuid_cache_linesize),
388 sizeof(uint32_t),
389 i386_cpu_info, "I", "Cacheline size");
390
391 SYSCTL_PROC(_machdep_cpu_cache, OID_AUTO, L2_associativity,
392 CTLTYPE_INT | CTLFLAG_RD,
393 (void *)offsetof(i386_cpu_info_t, cpuid_cache_L2_associativity),
394 sizeof(uint32_t),
395 i386_cpu_info, "I", "L2 cache associativity");
396
397 SYSCTL_PROC(_machdep_cpu_cache, OID_AUTO, size,
398 CTLTYPE_INT | CTLFLAG_RD,
399 (void *)offsetof(i386_cpu_info_t, cpuid_cache_size),
400 sizeof(uint32_t),
401 i386_cpu_info, "I", "Cache size (in Kbytes)");
402
403
404 SYSCTL_NODE(_machdep_cpu, OID_AUTO, tlb, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
405 "tlb");
406 SYSCTL_NODE(_machdep_cpu_tlb, OID_AUTO, inst, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
407 "inst");
408 SYSCTL_NODE(_machdep_cpu_tlb, OID_AUTO, data, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
409 "data");
410
411 SYSCTL_PROC(_machdep_cpu_tlb_inst, OID_AUTO, small,
412 CTLTYPE_INT | CTLFLAG_RD,
413 (void *)offsetof(i386_cpu_info_t,
414 cpuid_tlb[TLB_INST][TLB_SMALL][0]),
415 sizeof(uint32_t),
416 i386_cpu_info_nonzero, "I",
417 "Number of small page instruction TLBs");
418
419 SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, small,
420 CTLTYPE_INT | CTLFLAG_RD,
421 (void *)offsetof(i386_cpu_info_t,
422 cpuid_tlb[TLB_DATA][TLB_SMALL][0]),
423 sizeof(uint32_t),
424 i386_cpu_info_nonzero, "I",
425 "Number of small page data TLBs (1st level)");
426
427 SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, small_level1,
428 CTLTYPE_INT | CTLFLAG_RD,
429 (void *)offsetof(i386_cpu_info_t,
430 cpuid_tlb[TLB_DATA][TLB_SMALL][1]),
431 sizeof(uint32_t),
432 i386_cpu_info_nonzero, "I",
433 "Number of small page data TLBs (2nd level)");
434
435 SYSCTL_PROC(_machdep_cpu_tlb_inst, OID_AUTO, large,
436 CTLTYPE_INT | CTLFLAG_RD,
437 (void *)offsetof(i386_cpu_info_t,
438 cpuid_tlb[TLB_INST][TLB_LARGE][0]),
439 sizeof(uint32_t),
440 i386_cpu_info_nonzero, "I",
441 "Number of large page instruction TLBs");
442
443 SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, large,
444 CTLTYPE_INT | CTLFLAG_RD,
445 (void *)offsetof(i386_cpu_info_t,
446 cpuid_tlb[TLB_DATA][TLB_LARGE][0]),
447 sizeof(uint32_t),
448 i386_cpu_info_nonzero, "I",
449 "Number of large page data TLBs (1st level)");
450
451 SYSCTL_PROC(_machdep_cpu_tlb_data, OID_AUTO, large_level1,
452 CTLTYPE_INT | CTLFLAG_RD,
453 (void *)offsetof(i386_cpu_info_t,
454 cpuid_tlb[TLB_DATA][TLB_LARGE][1]),
455 sizeof(uint32_t),
456 i386_cpu_info_nonzero, "I",
457 "Number of large page data TLBs (2nd level)");
458
459 SYSCTL_PROC(_machdep_cpu_tlb, OID_AUTO, shared,
460 CTLTYPE_INT | CTLFLAG_RD,
461 (void *)offsetof(i386_cpu_info_t, cpuid_stlb),
462 sizeof(uint32_t),
463 i386_cpu_info_nonzero, "I",
464 "Number of shared TLBs");
465
466
467 SYSCTL_NODE(_machdep_cpu, OID_AUTO, address_bits, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
468 "address_bits");
469
470 SYSCTL_PROC(_machdep_cpu_address_bits, OID_AUTO, physical,
471 CTLTYPE_INT | CTLFLAG_RD,
472 (void *)offsetof(i386_cpu_info_t, cpuid_address_bits_physical),
473 sizeof(uint32_t),
474 i386_cpu_info, "I", "Number of physical address bits");
475
476 SYSCTL_PROC(_machdep_cpu_address_bits, OID_AUTO, virtual,
477 CTLTYPE_INT | CTLFLAG_RD,
478 (void *)offsetof(i386_cpu_info_t, cpuid_address_bits_virtual),
479 sizeof(uint32_t),
480 i386_cpu_info, "I", "Number of virtual address bits");
481
482
483 SYSCTL_PROC(_machdep_cpu, OID_AUTO, core_count,
484 CTLTYPE_INT | CTLFLAG_RD,
485 (void *)offsetof(i386_cpu_info_t, core_count),
486 sizeof(uint32_t),
487 i386_cpu_info, "I", "Number of enabled cores per package");
488
489 SYSCTL_PROC(_machdep_cpu, OID_AUTO, thread_count,
490 CTLTYPE_INT | CTLFLAG_RD,
491 (void *)offsetof(i386_cpu_info_t, thread_count),
492 sizeof(uint32_t),
493 i386_cpu_info, "I", "Number of enabled threads per package");
494
495 SYSCTL_NODE(_machdep_cpu, OID_AUTO, flex_ratio, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
496 "Flex ratio");
497
498 SYSCTL_PROC(_machdep_cpu_flex_ratio, OID_AUTO, desired,
499 CTLTYPE_INT | CTLFLAG_RD,
500 0, 0,
501 cpu_flex_ratio_desired, "I", "Flex ratio desired (0 disabled)");
502
503 SYSCTL_PROC(_machdep_cpu_flex_ratio, OID_AUTO, min,
504 CTLTYPE_INT | CTLFLAG_RD,
505 0, 0,
506 cpu_flex_ratio_min, "I", "Flex ratio min (efficiency)");
507
508 SYSCTL_PROC(_machdep_cpu_flex_ratio, OID_AUTO, max,
509 CTLTYPE_INT | CTLFLAG_RD,
510 0, 0,
511 cpu_flex_ratio_max, "I", "Flex ratio max (non-turbo)");
512
513 uint64_t pmap_pv_hashlist_walks;
514 uint64_t pmap_pv_hashlist_cnts;
515 uint32_t pmap_pv_hashlist_max;
516 uint32_t pmap_kernel_text_ps = PAGE_SIZE;
517
518 /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/
519
520 SYSCTL_NODE(_machdep, OID_AUTO, pmap, CTLFLAG_RW|CTLFLAG_LOCKED, 0,
521 "PMAP info");
522
523 SYSCTL_QUAD (_machdep_pmap, OID_AUTO, hashwalks, CTLFLAG_RD | CTLFLAG_KERN, &pmap_pv_hashlist_walks, "");
524 SYSCTL_QUAD (_machdep_pmap, OID_AUTO, hashcnts, CTLFLAG_RD | CTLFLAG_KERN, &pmap_pv_hashlist_cnts, "");
525 SYSCTL_INT (_machdep_pmap, OID_AUTO, hashmax, CTLFLAG_RD | CTLFLAG_KERN, &pmap_pv_hashlist_max, 0, "");
526 SYSCTL_INT (_machdep_pmap, OID_AUTO, kernel_text_ps, CTLFLAG_RD | CTLFLAG_KERN, &pmap_kernel_text_ps, 0, "");
527
528 SYSCTL_NODE(_machdep, OID_AUTO, memmap, CTLFLAG_RD|CTLFLAG_LOCKED, NULL, "physical memory map");
529
530 uint64_t firmware_Conventional_bytes = 0;
531 uint64_t firmware_RuntimeServices_bytes = 0;
532 uint64_t firmware_ACPIReclaim_bytes = 0;
533 uint64_t firmware_ACPINVS_bytes = 0;
534 uint64_t firmware_PalCode_bytes = 0;
535 uint64_t firmware_Reserved_bytes = 0;
536 uint64_t firmware_Unusable_bytes = 0;
537 uint64_t firmware_other_bytes = 0;
538
539 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Conventional, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_Conventional_bytes, "");
540 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, RuntimeServices, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_RuntimeServices_bytes, "");
541 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, ACPIReclaim, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_ACPIReclaim_bytes, "");
542 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, ACPINVS, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_ACPINVS_bytes, "");
543 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, PalCode, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_PalCode_bytes, "");
544 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Reserved, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_Reserved_bytes, "");
545 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Unusable, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_Unusable_bytes, "");
546 SYSCTL_QUAD(_machdep_memmap, OID_AUTO, Other, CTLFLAG_RD|CTLFLAG_LOCKED, &firmware_other_bytes, "");