1/*
2 * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved.
3 * Copyright 2004-2010, Axel D��rfler, axeld@pinc-software.de.
4 * Distributed under the terms of the MIT License.
5 *
6 * Copyright 2001, Travis Geiselbrecht. All rights reserved.
7 * Distributed under the terms of the NewOS License.
8*/
9
10
11#include "smp.h"
12
13#include <string.h>
14
15#include <KernelExport.h>
16
17#include <kernel.h>
18#include <safemode.h>
19#include <boot/platform.h>
20#include <boot/stage2.h>
21#include <boot/menu.h>
22
23#include "arch_smp.h"
24
25
26#define NO_SMP 0
27
28//#define TRACE_SMP
29#ifdef TRACE_SMP
30#	define TRACE(x) dprintf x
31#else
32#	define TRACE(x) ;
33#endif
34
35
36int
37smp_get_current_cpu(void)
38{
39	return arch_smp_get_current_cpu();
40}
41
42
43void
44smp_init_other_cpus(void)
45{
46	arch_smp_init_other_cpus();
47}
48
49
50void
51smp_boot_other_cpus(addr_t pageTable,
52	addr_t kernelEntry, addr_t virtKernelArgs)
53{
54	if (gKernelArgs.num_cpus < 2)
55		return;
56
57	arch_smp_boot_other_cpus(pageTable,
58		kernelEntry, virtKernelArgs);
59}
60
61
62void
63smp_add_safemode_menus(Menu *menu)
64{
65	arch_smp_add_safemode_menus(menu);
66}
67
68
69void
70smp_init(void)
71{
72#if NO_SMP
73	gKernelArgs.num_cpus = 1;
74	return;
75#endif
76
77	arch_smp_init();
78}
79