1/*
2 * Copyright 2021-2022, Haiku, Inc. All rights reserved.
3 * Released under the terms of the MIT License.
4*/
5
6
7#include "arch_smp.h"
8
9#include <string.h>
10
11#include <KernelExport.h>
12
13#include <kernel.h>
14#include <safemode.h>
15#include <boot/platform.h>
16#include <boot/stage2.h>
17#include <boot/menu.h>
18
19
20//#define TRACE_SMP
21#ifdef TRACE_SMP
22#	define TRACE(x) dprintf x
23#else
24#	define TRACE(x) ;
25#endif
26
27
28void
29arch_smp_register_cpu(platform_cpu_info** cpu)
30{
31        dprintf("TODO: arch_smp_register_cpu()\n");
32}
33
34
35int
36arch_smp_get_current_cpu(void)
37{
38	// One cpu for now.
39	return 0;
40}
41
42
43void
44arch_smp_init_other_cpus(void)
45{
46	// One cpu for now.
47	gKernelArgs.num_cpus = 1;
48	return;
49}
50
51
52void
53arch_smp_boot_other_cpus(uint32 pml4, uint64 kernelEntry, addr_t virtKernelArgs)
54{
55	// One cpu for now.
56}
57
58
59void
60arch_smp_add_safemode_menus(Menu *menu)
61{
62	MenuItem *item;
63
64	if (gKernelArgs.num_cpus < 2)
65		return;
66
67	item = new(nothrow) MenuItem("Disable SMP");
68	menu->AddItem(item);
69	item->SetData(B_SAFEMODE_DISABLE_SMP);
70	item->SetType(MENU_ITEM_MARKABLE);
71	item->SetHelpText("Disables all but one CPU core.");
72}
73
74
75void
76arch_smp_init(void)
77{
78	// One cpu for now.
79}
80