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(uint32 pml4, uint64 kernel_entry)
52{
53	if (gKernelArgs.num_cpus < 2)
54		return;
55
56	arch_smp_boot_other_cpus(pml4, kernel_entry);
57}
58
59
60void
61smp_add_safemode_menus(Menu *menu)
62{
63	arch_smp_add_safemode_menus(menu);
64}
65
66
67void
68smp_init(void)
69{
70#if NO_SMP
71	gKernelArgs.num_cpus = 1;
72	return;
73#endif
74
75	arch_smp_init();
76}
77