xref: /haiku/src/system/boot/platform/efi/arch/arm64/arch_smp.cpp (revision 3d4afef9cba2f328e238089d4609d00d4b1524f3)
1 /*
2  * Copyright 2021, 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 
28 void
29 arch_smp_register_cpu(platform_cpu_info** cpu)
30 {
31         dprintf("TODO: arch_smp_register_cpu()\n");
32 }
33 
34 
35 int
36 arch_smp_get_current_cpu(void)
37 {
38 	// One cpu for now.
39 	return 0;
40 }
41 
42 
43 void
44 arch_smp_init_other_cpus(void)
45 {
46 	// One cpu for now.
47 	gKernelArgs.num_cpus = 1;
48 	return;
49 }
50 
51 
52 void
53 arch_smp_boot_other_cpus(uint32 pml4, uint64 kernel_entry)
54 {
55 	// One cpu for now.
56 }
57 
58 
59 void
60 arch_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 
75 void
76 arch_smp_init(void)
77 {
78 	// One cpu for now.
79 }
80