]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/commpage/commpage.c
907ae701d00dd40b5e2453eaf84b77d3767e1c3b
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
23 * @APPLE_LICENSE_HEADER_END@
27 * This is a simplifed version of the commpage support from 10.3.
28 * The supported feature is the tuning of _cpu_capabilities.
29 * There is no shared page for user processes.
32 #include <mach/mach_types.h>
33 #include <mach/machine.h>
34 #include <ppc/exception.h>
35 #include <ppc/machine_routines.h>
36 #include <machine/cpu_capabilities.h>
37 #include <machine/commpage.h>
39 int _cpu_capabilities
= 0; // define the capability vector
41 /* Determine number of CPUs on this system. We cannot rely on
42 * machine_info.max_cpus this early in the boot.
49 cpus
= ml_get_max_cpus(); // NB: this call can block
52 panic("commpage cpus==0");
60 /* Initialize kernel version of _cpu_capabilities vector (used by KEXTs.) */
63 commpage_init_cpu_capabilities( void )
65 struct per_proc_info
*pp
;
70 pp
= per_proc_info
; // use CPU 0's per-proc
71 pfp
= &pp
->pf
; // point to features in per-proc
72 available
= pfp
->Available
;
74 // If AltiVec is disabled make sure it is not reported as available.
75 if ((available
& pfAltivec
) == 0) {
76 _cpu_capabilities
&= ~kHasAltivec
;
79 if (_cpu_capabilities
& kDcbaAvailable
) { // if this processor has DCBA, time it...
80 _cpu_capabilities
|= commpage_time_dcba(); // ...and set kDcbaRecomended if it helps.
83 cpus
= commpage_cpus(); // how many CPUs do we have
84 if (cpus
== 1) _cpu_capabilities
|= kUP
;
85 _cpu_capabilities
|= (cpus
<< kNumCPUsShift
);
89 /* Fill in commpage: called once, during kernel initialization, from the
90 * startup thread before user-mode code is running.
91 * See the top of this file for a list of what you have to do to add
92 * a new routine to the commpage.
95 commpage_populate( void )
97 commpage_init_cpu_capabilities();