1/*
2 * Copyright 2013-2022 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef KERNEL_BOOT_PLATFORM_EFI_ARCH_SMP_H
6#define KERNEL_BOOT_PLATFORM_EFI_ARCH_SMP_H
7
8
9#include <boot/menu.h>
10
11
12#if defined(__riscv) || defined(__ARM__) || defined(__aarch64__)
13// These platforms take inventory of cpu cores from fdt
14
15struct platform_cpu_info {
16	uint32 id; // hart id on riscv
17#if defined(__riscv)
18	uint32 phandle;
19	uint32 plicContext;
20#endif
21};
22
23#if defined(__riscv)
24extern uint32 gBootHart;
25#endif
26
27void arch_smp_register_cpu(platform_cpu_info** cpu);
28#endif
29
30
31int arch_smp_get_current_cpu(void);
32void arch_smp_init_other_cpus(void);
33#ifdef __riscv
34platform_cpu_info* arch_smp_find_cpu(uint32 phandle);
35void arch_smp_boot_other_cpus(uint64 satp, uint64 kernelEntry, addr_t virtKernelArgs);
36#else
37void arch_smp_boot_other_cpus(uint32 pml4, uint64 kernelEntry, addr_t virtKernelArgs);
38#endif
39void arch_smp_add_safemode_menus(Menu *menu);
40void arch_smp_init(void);
41
42
43#endif /* KERNEL_BOOT_PLATFORM_EFI_ARCH_SMP_H */
44