xref: /haiku/headers/private/kernel/boot/platform/efi/arch_smp.h (revision 46b7da1f4f40f7157d74fc7fb26ff9ec7f2416f2)
17c32619cSAlexander von Gluck IV /*
2*fdb45913SDavid Karoly  * Copyright 2013-2022 Haiku, Inc. All rights reserved.
37c32619cSAlexander von Gluck IV  * Distributed under the terms of the MIT License.
47c32619cSAlexander von Gluck IV  */
57c32619cSAlexander von Gluck IV #ifndef KERNEL_BOOT_PLATFORM_EFI_ARCH_SMP_H
67c32619cSAlexander von Gluck IV #define KERNEL_BOOT_PLATFORM_EFI_ARCH_SMP_H
77c32619cSAlexander von Gluck IV 
8a0368755SAlexander von Gluck IV 
97c32619cSAlexander von Gluck IV #include <boot/menu.h>
107c32619cSAlexander von Gluck IV 
117c32619cSAlexander von Gluck IV 
125185ccdeSFredrik Holmqvist #if defined(__riscv) || defined(__ARM__) || defined(__aarch64__)
13a0368755SAlexander von Gluck IV // These platforms take inventory of cpu cores from fdt
14d031c09cSX512 
15a0368755SAlexander von Gluck IV struct platform_cpu_info {
168ca0f03dSX512 	uint32 id; // hart id on riscv
178ca0f03dSX512 #if defined(__riscv)
188ca0f03dSX512 	uint32 phandle;
198ca0f03dSX512 	uint32 plicContext;
208ca0f03dSX512 #endif
21d031c09cSX512 };
22d031c09cSX512 
238ca0f03dSX512 #if defined(__riscv)
248ca0f03dSX512 extern uint32 gBootHart;
258ca0f03dSX512 #endif
268ca0f03dSX512 
27a0368755SAlexander von Gluck IV void arch_smp_register_cpu(platform_cpu_info** cpu);
28d031c09cSX512 #endif
29d031c09cSX512 
30d031c09cSX512 
317c32619cSAlexander von Gluck IV int arch_smp_get_current_cpu(void);
327c32619cSAlexander von Gluck IV void arch_smp_init_other_cpus(void);
33d031c09cSX512 #ifdef __riscv
348ca0f03dSX512 platform_cpu_info* arch_smp_find_cpu(uint32 phandle);
35*fdb45913SDavid Karoly void arch_smp_boot_other_cpus(uint64 satp, uint64 kernelEntry, addr_t virtKernelArgs);
36d031c09cSX512 #else
37*fdb45913SDavid Karoly void arch_smp_boot_other_cpus(uint32 pml4, uint64 kernelEntry, addr_t virtKernelArgs);
38d031c09cSX512 #endif
397c32619cSAlexander von Gluck IV void arch_smp_add_safemode_menus(Menu *menu);
407c32619cSAlexander von Gluck IV void arch_smp_init(void);
417c32619cSAlexander von Gluck IV 
427c32619cSAlexander von Gluck IV 
437c32619cSAlexander von Gluck IV #endif /* KERNEL_BOOT_PLATFORM_EFI_ARCH_SMP_H */
44