]> git.saurik.com Git - apple/xnu.git/blame - bsd/kern/kern_mib.c
xnu-792.1.5.tar.gz
[apple/xnu.git] / bsd / kern / kern_mib.c
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
e5568f75
A
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
1c79356b 11 *
e5568f75
A
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*-
23 * Copyright (c) 1982, 1986, 1989, 1993
24 * The Regents of the University of California. All rights reserved.
25 *
26 * This code is derived from software contributed to Berkeley by
27 * Mike Karels at Berkeley Software Design, Inc.
28 *
29 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD
30 * project, to make these variables more userfriendly.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
61 */
62
63#include <sys/param.h>
64#include <sys/kernel.h>
65#include <sys/systm.h>
66#include <sys/sysctl.h>
91447636 67#include <sys/proc_internal.h>
1c79356b
A
68#include <sys/unistd.h>
69
70#if defined(SMP)
71#include <machine/smp.h>
72#endif
73
43866e37
A
74#include <sys/param.h> /* XXX prune includes */
75#include <sys/systm.h>
76#include <sys/kernel.h>
77#include <sys/malloc.h>
78#include <sys/proc.h>
91447636 79#include <sys/file_internal.h>
43866e37
A
80#include <sys/vnode.h>
81#include <sys/unistd.h>
43866e37
A
82#include <sys/ioctl.h>
83#include <sys/namei.h>
84#include <sys/tty.h>
85#include <sys/disklabel.h>
86#include <sys/vm.h>
87#include <sys/sysctl.h>
88#include <sys/user.h>
89#include <mach/machine.h>
90#include <mach/mach_types.h>
91#include <mach/vm_param.h>
92#include <kern/task.h>
93#include <vm/vm_kern.h>
94#include <mach/host_info.h>
95
96extern vm_map_t bsd_pageable_map;
97
91447636 98#include <sys/mount_internal.h>
43866e37
A
99#include <sys/kdebug.h>
100
101#include <IOKit/IOPlatformExpert.h>
102#include <pexpert/pexpert.h>
103
104#include <machine/machine_routines.h>
105#include <machine/cpu_capabilities.h>
106
91447636 107static int cputype, cpusubtype, cputhreadtype;
43866e37 108
1c79356b
A
109SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0,
110 "Sysctl internal magic");
111SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0,
112 "High kernel, proc, limits &c");
113SYSCTL_NODE(, CTL_VM, vm, CTLFLAG_RW, 0,
114 "Virtual memory");
115SYSCTL_NODE(, CTL_VFS, vfs, CTLFLAG_RW, 0,
116 "File system");
117SYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0,
118 "Network, (see socket.h)");
119SYSCTL_NODE(, CTL_DEBUG, debug, CTLFLAG_RW, 0,
120 "Debugging");
121SYSCTL_NODE(, CTL_HW, hw, CTLFLAG_RW, 0,
122 "hardware");
123SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0,
124 "machine dependent");
125SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0,
126 "user-level");
127
43866e37
A
128#define SYSCTL_RETURN(r, x) SYSCTL_OUT(r, &x, sizeof(x))
129
130/******************************************************************************
131 * hw.* MIB
132 */
133
134#define CTLHW_RETQUAD (1 << 31)
91447636
A
135#define CTLHW_LOCAL (1 << 30)
136
137#define HW_LOCAL_CPUTHREADTYPE (1 | CTLHW_LOCAL)
138#define HW_LOCAL_PHYSICALCPU (2 | CTLHW_LOCAL)
139#define HW_LOCAL_PHYSICALCPUMAX (3 | CTLHW_LOCAL)
140#define HW_LOCAL_LOGICALCPU (4 | CTLHW_LOCAL)
141#define HW_LOCAL_LOGICALCPUMAX (5 | CTLHW_LOCAL)
142
43866e37
A
143
144/*
145 * Supporting some variables requires us to do "real" work. We
146 * gather some of that here.
147 */
148static int
149sysctl_hw_generic SYSCTL_HANDLER_ARGS
150{
151 char dummy[65];
152 int epochTemp;
153 extern int vm_page_wire_count;
154 ml_cpu_info_t cpu_info;
155 int val, doquad;
156 long long qval;
91447636
A
157 host_basic_info_data_t hinfo;
158 kern_return_t kret;
159 int count = HOST_BASIC_INFO_COUNT;
43866e37
A
160
161 /*
162 * Test and mask off the 'return quad' flag.
163 * Note that only some things here support it.
164 */
165 doquad = arg2 & CTLHW_RETQUAD;
166 arg2 &= ~CTLHW_RETQUAD;
167
168 ml_cpu_get_info(&cpu_info);
169
91447636
A
170#define BSD_HOST 1
171 kret = host_info(BSD_HOST, HOST_BASIC_INFO, &hinfo, &count);
172
43866e37
A
173 /*
174 * Handle various OIDs.
175 *
176 * OIDs that can return int or quad set val and qval and then break.
177 * Errors and int-only values return inline.
178 */
179 switch (arg2) {
180 case HW_NCPU:
91447636
A
181 if (kret == KERN_SUCCESS) {
182 return(SYSCTL_RETURN(req, hinfo.max_cpus));
183 } else {
184 return(EINVAL);
43866e37
A
185 }
186 case HW_AVAILCPU:
91447636
A
187 if (kret == KERN_SUCCESS) {
188 return(SYSCTL_RETURN(req, hinfo.avail_cpus));
189 } else {
190 return(EINVAL);
191 }
192 case HW_LOCAL_PHYSICALCPU:
193 if (kret == KERN_SUCCESS) {
194 return(SYSCTL_RETURN(req, hinfo.physical_cpu));
195 } else {
196 return(EINVAL);
197 }
198 case HW_LOCAL_PHYSICALCPUMAX:
199 if (kret == KERN_SUCCESS) {
200 return(SYSCTL_RETURN(req, hinfo.physical_cpu_max));
201 } else {
202 return(EINVAL);
203 }
204 case HW_LOCAL_LOGICALCPU:
205 if (kret == KERN_SUCCESS) {
206 return(SYSCTL_RETURN(req, hinfo.logical_cpu));
207 } else {
208 return(EINVAL);
209 }
210 case HW_LOCAL_LOGICALCPUMAX:
211 if (kret == KERN_SUCCESS) {
212 return(SYSCTL_RETURN(req, hinfo.logical_cpu_max));
213 } else {
214 return(EINVAL);
43866e37
A
215 }
216 case HW_CACHELINE:
217 val = cpu_info.cache_line_size;
218 qval = (long long)val;
219 break;
220 case HW_L1ICACHESIZE:
221 val = cpu_info.l1_icache_size;
222 qval = (long long)val;
223 break;
224 case HW_L1DCACHESIZE:
225 val = cpu_info.l1_dcache_size;
226 qval = (long long)val;
227 break;
228 case HW_L2CACHESIZE:
229 if (cpu_info.l2_cache_size == 0xFFFFFFFF)
230 return(EINVAL);
231 val = cpu_info.l2_cache_size;
232 qval = (long long)val;
233 break;
234 case HW_L3CACHESIZE:
235 if (cpu_info.l3_cache_size == 0xFFFFFFFF)
236 return(EINVAL);
237 val = cpu_info.l3_cache_size;
238 qval = (long long)val;
239 break;
240
241 /*
242 * Deprecated variables. We still support these for
243 * backwards compatibility purposes only.
244 */
245 case HW_MACHINE:
246 bzero(dummy, sizeof(dummy));
247 if(!PEGetMachineName(dummy,64))
248 return(EINVAL);
249 dummy[64] = 0;
250 return(SYSCTL_OUT(req, dummy, strlen(dummy) + 1));
251 case HW_MODEL:
252 bzero(dummy, sizeof(dummy));
253 if(!PEGetModelName(dummy,64))
254 return(EINVAL);
255 dummy[64] = 0;
256 return(SYSCTL_OUT(req, dummy, strlen(dummy) + 1));
257 case HW_USERMEM:
258 {
259 int usermem = mem_size - vm_page_wire_count * page_size;
260
261 return(SYSCTL_RETURN(req, usermem));
262 }
263 case HW_EPOCH:
264 epochTemp = PEGetPlatformEpoch();
265 if (epochTemp == -1)
266 return(EINVAL);
267 return(SYSCTL_RETURN(req, epochTemp));
268 case HW_VECTORUNIT:
269 return(SYSCTL_RETURN(req, cpu_info.vector_unit));
270 case HW_L2SETTINGS:
271 if (cpu_info.l2_cache_size == 0xFFFFFFFF)
272 return(EINVAL);
273 return(SYSCTL_RETURN(req, cpu_info.l2_settings));
274 case HW_L3SETTINGS:
275 if (cpu_info.l3_cache_size == 0xFFFFFFFF)
276 return(EINVAL);
277 return(SYSCTL_RETURN(req, cpu_info.l3_settings));
278 default:
279 return(ENOTSUP);
280 }
281 /*
282 * Callers may come to us with either int or quad buffers.
283 */
284 if (doquad) {
285 return(SYSCTL_RETURN(req, qval));
286 }
287 return(SYSCTL_RETURN(req, val));
288}
289
290/*
291 * hw.* MIB variables.
292 */
91447636 293SYSCTL_PROC (_hw, HW_NCPU, ncpu, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_NCPU, sysctl_hw_generic, "I", "");
43866e37 294SYSCTL_PROC (_hw, HW_AVAILCPU, activecpu, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_AVAILCPU, sysctl_hw_generic, "I", "");
91447636
A
295SYSCTL_PROC (_hw, OID_AUTO, physicalcpu, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_LOCAL_PHYSICALCPU, sysctl_hw_generic, "I", "");
296SYSCTL_PROC (_hw, OID_AUTO, physicalcpu_max, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_LOCAL_PHYSICALCPUMAX, sysctl_hw_generic, "I", "");
297SYSCTL_PROC (_hw, OID_AUTO, logicalcpu, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_LOCAL_LOGICALCPU, sysctl_hw_generic, "I", "");
298SYSCTL_PROC (_hw, OID_AUTO, logicalcpu_max, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_LOCAL_LOGICALCPUMAX, sysctl_hw_generic, "I", "");
43866e37 299SYSCTL_INT (_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD | CTLFLAG_KERN, NULL, BYTE_ORDER, "");
91447636
A
300SYSCTL_INT (_hw, OID_AUTO, cputype, CTLFLAG_RD | CTLFLAG_KERN, &cputype, 0, "");
301SYSCTL_INT (_hw, OID_AUTO, cpusubtype, CTLFLAG_RD | CTLFLAG_KERN, &cpusubtype, 0, "");
43866e37
A
302SYSCTL_INT2QUAD(_hw, OID_AUTO, pagesize, CTLFLAG_RD | CTLFLAG_KERN, &page_size, "");
303SYSCTL_QUAD (_hw, OID_AUTO, busfrequency, CTLFLAG_RD | CTLFLAG_KERN, &gPEClockFrequencyInfo.bus_frequency_hz, "");
304SYSCTL_QUAD (_hw, OID_AUTO, busfrequency_min, CTLFLAG_RD | CTLFLAG_KERN, &gPEClockFrequencyInfo.bus_frequency_min_hz, "");
305SYSCTL_QUAD (_hw, OID_AUTO, busfrequency_max, CTLFLAG_RD | CTLFLAG_KERN, &gPEClockFrequencyInfo.bus_frequency_max_hz, "");
306SYSCTL_QUAD (_hw, OID_AUTO, cpufrequency, CTLFLAG_RD | CTLFLAG_KERN, &gPEClockFrequencyInfo.cpu_frequency_hz, "");
307SYSCTL_QUAD (_hw, OID_AUTO, cpufrequency_min, CTLFLAG_RD | CTLFLAG_KERN, &gPEClockFrequencyInfo.cpu_frequency_min_hz, "");
308SYSCTL_QUAD (_hw, OID_AUTO, cpufrequency_max, CTLFLAG_RD | CTLFLAG_KERN, &gPEClockFrequencyInfo.cpu_frequency_max_hz, "");
309SYSCTL_PROC (_hw, OID_AUTO, cachelinesize, CTLTYPE_QUAD | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_CACHELINE | CTLHW_RETQUAD, sysctl_hw_generic, "Q", "");
310SYSCTL_PROC (_hw, OID_AUTO, l1icachesize, CTLTYPE_QUAD | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_L1ICACHESIZE | CTLHW_RETQUAD, sysctl_hw_generic, "Q", "");
311SYSCTL_PROC (_hw, OID_AUTO, l1dcachesize, CTLTYPE_QUAD | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_L1DCACHESIZE | CTLHW_RETQUAD, sysctl_hw_generic, "Q", "");
312SYSCTL_PROC (_hw, OID_AUTO, l2cachesize, CTLTYPE_QUAD | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_L2CACHESIZE | CTLHW_RETQUAD, sysctl_hw_generic, "Q", "");
313SYSCTL_PROC (_hw, OID_AUTO, l3cachesize, CTLTYPE_QUAD | CTLFLAG_RD | CTLFLAG_KERN, 0, HW_L3CACHESIZE | CTLHW_RETQUAD, sysctl_hw_generic, "Q", "");
314SYSCTL_INT2QUAD(_hw, OID_AUTO, tbfrequency, CTLFLAG_RD | CTLFLAG_KERN, &gPEClockFrequencyInfo.timebase_frequency_hz, "");
315SYSCTL_QUAD (_hw, HW_MEMSIZE, memsize, CTLFLAG_RD | CTLFLAG_KERN, &max_mem, "");
316
317/*
318 * Optional features can register nodes below hw.optional.
319 *
320 * If the feature is not present, the node should either not be registered,
321 * or it should return -1. If the feature is present, the node should return
322 * 0. If the feature is present and its use is advised, the node should
323 * return 1.
324 */
325SYSCTL_NODE(_hw, OID_AUTO, optional, CTLFLAG_RW, NULL, "optional features");
326
327SYSCTL_INT(_hw_optional, OID_AUTO, floatingpoint, CTLFLAG_RD | CTLFLAG_KERN, 0, 1, ""); /* always set */
328
43866e37
A
329/*
330 * Deprecated variables. These are supported for backwards compatibility
331 * purposes only. The MASKED flag requests that the variables not be
332 * printed by sysctl(8) and similar utilities.
333 *
334 * The variables named *_compat here are int-sized versions of variables
335 * that are now exported as quads. The int-sized versions are normally
336 * looked up only by number, wheras the quad-sized versions should be
337 * looked up by name.
338 *
339 * The *_compat nodes are *NOT* visible within the kernel.
340 */
341SYSCTL_INT (_hw, HW_PAGESIZE, pagesize_compat, CTLFLAG_RD | CTLFLAG_MASKED, &page_size, 0, "");
342SYSCTL_INT (_hw, HW_BUS_FREQ, busfrequency_compat, CTLFLAG_RD | CTLFLAG_MASKED, &gPEClockFrequencyInfo.bus_clock_rate_hz, 0, "");
343SYSCTL_INT (_hw, HW_CPU_FREQ, cpufrequency_compat, CTLFLAG_RD | CTLFLAG_MASKED, &gPEClockFrequencyInfo.cpu_clock_rate_hz, 0, "");
344SYSCTL_PROC(_hw, HW_CACHELINE, cachelinesize_compat, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_CACHELINE, sysctl_hw_generic, "I", "");
345SYSCTL_PROC(_hw, HW_L1ICACHESIZE, l1icachesize_compat, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_L1ICACHESIZE, sysctl_hw_generic, "I", "");
346SYSCTL_PROC(_hw, HW_L1DCACHESIZE, l1dcachesize_compat, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_L1DCACHESIZE, sysctl_hw_generic, "I", "");
347SYSCTL_PROC(_hw, HW_L2CACHESIZE, l2cachesize_compat, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_L2CACHESIZE, sysctl_hw_generic, "I", "");
348SYSCTL_PROC(_hw, HW_L3CACHESIZE, l3cachesize_compat, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_L3CACHESIZE, sysctl_hw_generic, "I", "");
349SYSCTL_INT (_hw, HW_TB_FREQ, tbfrequency_compat, CTLFLAG_RD | CTLFLAG_MASKED, &gPEClockFrequencyInfo.timebase_frequency_hz, 0, "");
350SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_MACHINE, sysctl_hw_generic, "A", "");
351SYSCTL_PROC(_hw, HW_MODEL, model, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_MODEL, sysctl_hw_generic, "A", "");
55e303ae 352SYSCTL_UINT(_hw, HW_PHYSMEM, physmem, CTLFLAG_RD | CTLFLAG_MASKED, &mem_size, 0, "");
43866e37
A
353SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_USERMEM, sysctl_hw_generic, "I", "");
354SYSCTL_PROC(_hw, HW_EPOCH, epoch, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_EPOCH, sysctl_hw_generic, "I", "");
355SYSCTL_PROC(_hw, HW_VECTORUNIT, vectorunit, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_VECTORUNIT, sysctl_hw_generic, "I", "");
356SYSCTL_PROC(_hw, HW_L2SETTINGS, l2settings, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_L2SETTINGS, sysctl_hw_generic, "I", "");
357SYSCTL_PROC(_hw, HW_L3SETTINGS, l3settings, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MASKED, 0, HW_L3SETTINGS, sysctl_hw_generic, "I", "");
358
359/******************************************************************************
360 * Generic MIB initialisation.
361 *
362 * This is a hack, and should be replaced with SYSINITs
363 * at some point.
364 */
365void
366sysctl_mib_init(void)
367{
91447636
A
368 cputype = cpu_type();
369 cpusubtype = cpu_subtype();
370 cputhreadtype = cpu_threadtype();
371
43866e37
A
372 /*
373 * Populate the optional portion of the hw.* MIB.
374 *
375 * XXX This could be broken out into parts of the code
376 * that actually directly relate to the functions in
377 * question.
378 */
91447636
A
379
380 if (cputhreadtype != CPU_THREADTYPE_NONE) {
381 static SYSCTL_INT(_hw, OID_AUTO, cputhreadtype, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &cputhreadtype, 0, "");
382 sysctl_register_oid(&sysctl__hw_cputhreadtype);
383 }
384
43866e37
A
385#ifdef __ppc__
386 {
387 static int altivec_flag = -1;
388 static SYSCTL_INT(_hw_optional, OID_AUTO, altivec, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &altivec_flag, 0, "");
389
390 if (_cpu_capabilities & kHasAltivec) {
391 altivec_flag = 1;
392 sysctl_register_oid(&sysctl__hw_optional_altivec);
393 }
394 }
395 {
396 static int graphicsops_flag = -1;
397 static SYSCTL_INT(_hw_optional, OID_AUTO, graphicsops, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &graphicsops_flag, 0, "");
398
399 if (_cpu_capabilities & kHasGraphicsOps) {
400 graphicsops_flag = 1;
401 sysctl_register_oid(&sysctl__hw_optional_graphicsops);
402 }
403 }
404 {
405 static int x64bitops_flag = -1;
406 static SYSCTL_INT(_hw_optional, OID_AUTO, 64bitops, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &x64bitops_flag, 0, "");
407
408 if (_cpu_capabilities & k64Bit) {
409 x64bitops_flag = 1;
410 sysctl_register_oid(&sysctl__hw_optional_64bitops);
411 }
412 }
413 {
414 static int fsqrt_flag = -1;
415 static SYSCTL_INT(_hw_optional, OID_AUTO, fsqrt, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &fsqrt_flag, 0, "");
416
417 if (_cpu_capabilities & kHasFsqrt) {
418 fsqrt_flag = 1;
419 sysctl_register_oid(&sysctl__hw_optional_fsqrt);
420 }
421 }
422 {
423 static int stfiwx_flag = -1;
424 static SYSCTL_INT(_hw_optional, OID_AUTO, stfiwx, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &stfiwx_flag, 0, "");
425
426 if (_cpu_capabilities & kHasStfiwx) {
427 stfiwx_flag = 1;
428 sysctl_register_oid(&sysctl__hw_optional_stfiwx);
429 }
430 }
431 {
432 static int dcba_flag = -1;
433 static SYSCTL_INT(_hw_optional, OID_AUTO, dcba, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &dcba_flag, 0, "");
434
435 if (_cpu_capabilities & kDcbaAvailable)
436 dcba_flag = 0;
437 if (_cpu_capabilities & kDcbaRecommended)
438 dcba_flag = 1;
439 if (dcba_flag >= 0)
440 sysctl_register_oid(&sysctl__hw_optional_dcba);
441 }
442 {
443 static int datastreams_flag = -1;
444 static SYSCTL_INT(_hw_optional, OID_AUTO, datastreams, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &datastreams_flag, 0, "");
445
446 if (_cpu_capabilities & kDataStreamsAvailable)
447 datastreams_flag = 0;
448 if (_cpu_capabilities & kDataStreamsRecommended)
449 datastreams_flag = 1;
450 if (datastreams_flag >= 0)
451 sysctl_register_oid(&sysctl__hw_optional_datastreams);
452 }
453 {
454 static int dcbtstreams_flag = -1;
455 static SYSCTL_INT(_hw_optional, OID_AUTO, dcbtstreams, CTLFLAG_RD | CTLFLAG_NOAUTO | CTLFLAG_KERN, &dcbtstreams_flag, 0, "");
456
457 if (_cpu_capabilities & kDcbtStreamsAvailable)
458 dcbtstreams_flag = 0;
459 if (_cpu_capabilities & kDcbtStreamsRecommended)
460 dcbtstreams_flag = 1;
461 if (dcbtstreams_flag >= 0)
462 sysctl_register_oid(&sysctl__hw_optional_dcbtstreams);
463 }
464#else
465# warning we do not support this platform yet
466#endif /* __ppc__ */
467
468
469}