From 82a7c7395cb83b01af25931504f540bcb29e29fd Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sat, 22 Feb 2020 16:49:27 -0600 Subject: [PATCH] efi/arm: Begin stubbing out the essentials, add fdt library * We *might* no longer need FDT knowledge in the bootloader? * For now though, arm sources reference gFDT, so we need it. * Need to move away from lazy gFDT and store in arch_kernel_args. (which is next and will be a larger commit) Change-Id: I77cce0fc645143b78a7fd9f50ac8b96c97b5c862 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2268 Reviewed-by: Adrien Destugues --- src/system/boot/platform/efi/Jamfile | 13 +++- src/system/boot/platform/efi/arch/arm/Jamfile | 5 +- .../boot/platform/efi/arch/arm/arch_mmu.cpp | 10 +++ .../boot/platform/efi/arch/arm/arch_smp.cpp | 72 +++++++++++++++++++ .../boot/platform/efi/arch/arm/arch_start.cpp | 16 +++++ 5 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 src/system/boot/platform/efi/arch/arm/arch_mmu.cpp create mode 100644 src/system/boot/platform/efi/arch/arm/arch_smp.cpp create mode 100644 src/system/boot/platform/efi/arch/arm/arch_start.cpp diff --git a/src/system/boot/platform/efi/Jamfile b/src/system/boot/platform/efi/Jamfile index 860943b4fd..2a92d9ceed 100644 --- a/src/system/boot/platform/efi/Jamfile +++ b/src/system/boot/platform/efi/Jamfile @@ -8,7 +8,7 @@ UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] ; SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ; { - local defines = _BOOT_MODE GNU_EFI_USE_MS_ABI _BOOT_PLATFORM_EFI ; + local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ; defines = [ FDefines $(defines) ] ; SubDirCcFlags $(defines) ; SubDirC++Flags $(defines) -fno-rtti ; @@ -31,14 +31,21 @@ local platform_src = serial.cpp ; +local support_libs ; + +if $(TARGET_KERNEL_ARCH) in arm arm64 { + support_libs += boot_fdt.a ; +} + local platform ; for platform in [ MultiBootSubDirSetup efi ] { on $(platform) { BootMergeObject boot_platform_efi_common.o : $(platform_src) - : - : boot_platform_generic_efi.a + : : + $(support_libs) + boot_platform_generic_efi.a ; BootMergeObject boot_platform_efi.o : diff --git a/src/system/boot/platform/efi/arch/arm/Jamfile b/src/system/boot/platform/efi/arch/arm/Jamfile index c4940fa88b..1862f117e3 100644 --- a/src/system/boot/platform/efi/arch/arm/Jamfile +++ b/src/system/boot/platform/efi/arch/arm/Jamfile @@ -6,10 +6,11 @@ UsePrivateHeaders [ FDirName kernel platform ] ; UsePrivateHeaders [ FDirName kernel boot platform efi ] ; local arch_src = + crt0-efi-$(TARGET_ARCH).S #entry.S relocation_func.cpp - #arch_smp.cpp - #arch_mmu.cpp + arch_smp.cpp + arch_mmu.cpp arch_timer.cpp ; diff --git a/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp b/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp new file mode 100644 index 0000000000..9a86a8590b --- /dev/null +++ b/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp @@ -0,0 +1,10 @@ +/* + * Copyright 2019-2020 Haiku, Inc. All rights reserved. + * Released under the terms of the MIT License. + */ + +void +arch_mmu_init() +{ + // Stub +} diff --git a/src/system/boot/platform/efi/arch/arm/arch_smp.cpp b/src/system/boot/platform/efi/arch/arm/arch_smp.cpp new file mode 100644 index 0000000000..84e25b57ac --- /dev/null +++ b/src/system/boot/platform/efi/arch/arm/arch_smp.cpp @@ -0,0 +1,72 @@ +/* + * Copyright 2019-2020, Haiku, Inc. All rights reserved. + * Released under the terms of the MIT License. +*/ + + +#include "arch_smp.h" + +#include + +#include + +#include +#include +#include +#include +#include + + +//#define TRACE_SMP +#ifdef TRACE_SMP +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +int +arch_smp_get_current_cpu(void) +{ + // One cpu for now. + return 0; +} + + +void +arch_smp_init_other_cpus(void) +{ + // One cpu for now. + gKernelArgs.num_cpus = 1; + return; +} + + +void +arch_smp_boot_other_cpus(uint32 pml4, uint64 kernel_entry) +{ + // One cpu for now. +} + + +void +arch_smp_add_safemode_menus(Menu *menu) +{ + MenuItem *item; + + if (gKernelArgs.num_cpus < 2) + return; + + item = new(nothrow) MenuItem("Disable SMP"); + menu->AddItem(item); + item->SetData(B_SAFEMODE_DISABLE_SMP); + item->SetType(MENU_ITEM_MARKABLE); + item->SetHelpText("Disables all but one CPU core."); +} + + +void +arch_smp_init(void) +{ + // One cpu for now. +} diff --git a/src/system/boot/platform/efi/arch/arm/arch_start.cpp b/src/system/boot/platform/efi/arch/arm/arch_start.cpp new file mode 100644 index 0000000000..17ac58a838 --- /dev/null +++ b/src/system/boot/platform/efi/arch/arm/arch_start.cpp @@ -0,0 +1,16 @@ +/* + * Copyright 2019-2020 Haiku, Inc. All rights reserved. + * Released under the terms of the MIT License. + */ + + +#include +#include +#include + + +void +arch_start_kernel(addr_t kernelEntry) +{ + // Kernel Entry! +}