Deleted Added
full compact
mp_machdep.c (122940) mp_machdep.c (122947)
1/*-
2 * Copyright (c) 1996, by Steve Passe
3 * Copyright (c) 2003, by Peter Wemm
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1996, by Steve Passe
3 * Copyright (c) 2003, by Peter Wemm
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/amd64/amd64/mp_machdep.c 122940 2003-11-21 03:02:00Z peter $");
28__FBSDID("$FreeBSD: head/sys/amd64/amd64/mp_machdep.c 122947 2003-11-21 22:23:26Z jhb $");
29
30#include "opt_cpu.h"
31#include "opt_kstack_pages.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/bus.h>
36#ifdef GPROF

--- 145 unchanged lines hidden (view full) ---

182 if (apic_id > mp_maxid)
183 mp_maxid = apic_id;
184 if (bootverbose)
185 printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" :
186 "AP");
187
188}
189
29
30#include "opt_cpu.h"
31#include "opt_kstack_pages.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/bus.h>
36#ifdef GPROF

--- 145 unchanged lines hidden (view full) ---

182 if (apic_id > mp_maxid)
183 mp_maxid = apic_id;
184 if (bootverbose)
185 printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" :
186 "AP");
187
188}
189
190void
191cpu_mp_setmaxid(void)
192{
193
194 /*
195 * mp_maxid should be already set by calls to cpu_add().
196 * Just sanity check its value here.
197 */
198 if (mp_ncpus == 0)
199 KASSERT(mp_maxid == 0,
200 ("%s: mp_ncpus is zero, but mp_maxid is not", __func__));
201 else if (mp_ncpus == 1)
202 mp_maxid = 0;
203 else
204 KASSERT(mp_maxid >= mp_ncpus - 1,
205 ("%s: counters out of sync: max %d, count %d", __func__,
206 mp_maxid, mp_ncpus));
207
208}
209
190int
191cpu_mp_probe(void)
192{
193
194 /*
195 * Always record BSP in CPU map so that the mbuf init code works
196 * correctly.
197 */
198 all_cpus = 1;
199 if (mp_ncpus == 0) {
200 /*
201 * No CPUs were found, so this must be a UP system. Setup
202 * the variables to represent a system with a single CPU
203 * with an id of 0.
204 */
210int
211cpu_mp_probe(void)
212{
213
214 /*
215 * Always record BSP in CPU map so that the mbuf init code works
216 * correctly.
217 */
218 all_cpus = 1;
219 if (mp_ncpus == 0) {
220 /*
221 * No CPUs were found, so this must be a UP system. Setup
222 * the variables to represent a system with a single CPU
223 * with an id of 0.
224 */
205 KASSERT(mp_maxid == 0,
206 ("%s: mp_ncpus is zero, but mp_maxid is not", __func__));
207 mp_ncpus = 1;
208 return (0);
209 }
210
211 /* At least one CPU was found. */
212 if (mp_ncpus == 1) {
213 /*
214 * One CPU was found, so this must be a UP system with
215 * an I/O APIC.
216 */
217 mp_maxid = 0;
218 return (0);
219 }
220
221 /* At least two CPUs were found. */
225 mp_ncpus = 1;
226 return (0);
227 }
228
229 /* At least one CPU was found. */
230 if (mp_ncpus == 1) {
231 /*
232 * One CPU was found, so this must be a UP system with
233 * an I/O APIC.
234 */
235 mp_maxid = 0;
236 return (0);
237 }
238
239 /* At least two CPUs were found. */
222 KASSERT(mp_maxid >= mp_ncpus - 1,
223 ("%s: counters out of sync: max %d, count %d", __func__, mp_maxid,
224 mp_ncpus));
225 return (1);
226}
227
228/*
229 * Initialize the IPI handlers and start up the AP's.
230 */
231void
232cpu_mp_start(void)

--- 789 unchanged lines hidden ---
240 return (1);
241}
242
243/*
244 * Initialize the IPI handlers and start up the AP's.
245 */
246void
247cpu_mp_start(void)

--- 789 unchanged lines hidden ---