]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/AT386/mp/mp.c
xnu-123.5.tar.gz
[apple/xnu.git] / osfmk / i386 / AT386 / mp / mp.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1991,1990 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50
51 /*
52 */
53
54 #include <cpus.h>
55 #include <mp_v1_1.h>
56
57 #if NCPUS > 1
58
59 #include <types.h>
60 #include <mach/machine.h>
61 #include <kern/lock.h>
62 #include <kern/cpu_data.h>
63 #include <kern/processor.h>
64 #include <kern/misc_protos.h>
65 #include <kern/machine.h>
66 #include <i386/db_machdep.h>
67 #include <ddb/db_run.h>
68 #include <i386/AT386/mp/mp.h>
69 #include <i386/setjmp.h>
70 #include <i386/misc_protos.h>
71
72 int cpu_int_word[NCPUS];
73
74 extern void cpu_interrupt(int cpu);
75 extern int get_ncpus(void);
76
77 /*
78 * Generate a clock interrupt on next running cpu
79 *
80 * Instead of having the master processor interrupt
81 * all active processors, each processor in turn interrupts
82 * the next active one. This avoids all slave processors
83 * accessing the same R/W data simultaneously.
84 */
85
86 void
87 slave_clock(void)
88 {
89 }
90
91 void
92 i386_signal_cpus(int event)
93 {
94 }
95
96 /*ARGSUSED*/
97 void
98 init_ast_check(
99 processor_t processor)
100 {
101 }
102
103 void
104 cause_ast_check(
105 processor_t processor)
106 {
107 }
108
109 /*ARGSUSED*/
110 kern_return_t
111 cpu_start(
112 int slot_num)
113 {
114 printf("cpu_start not implemented\n");
115 return (KERN_FAILURE);
116 }
117
118
119 int real_ncpus;
120 int wncpu = -1;
121
122 /*
123 * Find out how many cpus will run
124 */
125
126 void
127 mp_probe_cpus(void)
128 {
129 int i;
130
131 /*
132 * get real number of cpus
133 */
134
135 real_ncpus = get_ncpus();
136
137 if (wncpu <= 0)
138 wncpu = NCPUS;
139
140 /*
141 * Ignore real number of cpus it if number of requested cpus
142 * is smaller.
143 * Keep it if number of requested cpu is null or larger.
144 */
145
146 if (real_ncpus < wncpu)
147 wncpu = real_ncpus;
148 #if MP_V1_1
149 {
150 extern void validate_cpus(int);
151
152 /*
153 * We do NOT have CPUS numbered contiguously.
154 */
155
156 validate_cpus(wncpu);
157 }
158 #else
159 for (i=0; i < wncpu; i++)
160 machine_slot[i].is_cpu = TRUE;
161 #endif
162 }
163
164 /*
165 * invoke kdb on slave processors
166 */
167
168 void
169 remote_kdb(void)
170 {
171 }
172
173 /*
174 * Clear kdb interrupt
175 */
176
177 void
178 clear_kdb_intr(void)
179 {
180 }
181 #else /* NCPUS > 1 */
182 int cpu_int_word[NCPUS];
183 #endif /* NCPUS > 1 */