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