From 4f71689996e086fec18b81d5df72d68232c9954a Mon Sep 17 00:00:00 2001 From: Aurel Feer Date: Tue, 26 Apr 2022 20:55:03 +0200 Subject: [PATCH] fix booting second core on toradex --- .vscode/c_cpp_properties.json | 2 +- lib/aos/coreboot.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 5f914ad..cacbda5 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -11,7 +11,7 @@ "${workspaceFolder}/kernel/include/arch/aarch64/", "${workspaceFolder}/kernel/include/arch/armv8/", "${workspaceFolder}/lib/aos/include/arch/aarch64/", - "${BFBUILD}/armv8/include/" + "${workspaceFolder}/build/armv8/include/" ], "compilerPath": "", "intelliSenseMode": "gcc-arm64", diff --git a/lib/aos/coreboot.c b/lib/aos/coreboot.c index f493232..dda6215 100644 --- a/lib/aos/coreboot.c +++ b/lib/aos/coreboot.c @@ -313,7 +313,7 @@ errval_t coreboot(coreid_t mpid, // - Relocate the boot and CPU driver. The boot driver runs with a 1:1 // VA->PA mapping. The CPU driver is expected to be loaded at the // high virtual address space, at offset ARMV8_KERNEL_OFFSET. - err = relocate_elf((genvaddr_t) bootdriver_elf_addr, &bootdriver_mem_info, remote_bootdriver_elf_frame_id.base); + err = relocate_elf((genvaddr_t) bootdriver_elf_addr, &bootdriver_mem_info, 0); if(err_is_fail(err)) return err; err = relocate_elf((genvaddr_t) cpudriver_elf_addr, &cpudriver_mem_info, ARMv8_KERNEL_OFFSET); @@ -348,7 +348,8 @@ errval_t coreboot(coreid_t mpid, // - Fill in the core data struct, for a description, see the definition // in include/target/aarch64/barrelfish_kpi/arm_core_data.h struct armv8_core_data *core_data; - paging_map_frame(get_current_paging_state(), (void**) &core_data, PAGE_SIZE, core_data_frame); + err = paging_map_frame(get_current_paging_state(), (void**) &core_data, PAGE_SIZE, core_data_frame); + if (err_is_fail(err)) return err_push(err, LIB_ERR_PMAP_MAP); core_data->boot_magic = ARMV8_BOOTMAGIC_PSCI; core_data->cpu_driver_stack = cpu_driver_stack_frame_id.base + 16 * BASE_PAGE_SIZE; @@ -373,6 +374,9 @@ errval_t coreboot(coreid_t mpid, core_data->dst_arch_id = mpid; // find cpu driver entry point + // debug_printf("[coreboot]: arch_init_sym->st_value = %p\n", arch_init_sym->st_value); + // debug_printf("[coreboot]: reloc_cpudriver_entry = %p\n", reloc_cpudriver_entry); + // debug_printf("[coreboot]: ARMv8_KERNEL_OFFSET = %p\n", ARMv8_KERNEL_OFFSET); core_data->cpu_driver_entry = reloc_cpudriver_entry + ARMv8_KERNEL_OFFSET; debug_printf("[coreboot] Flush the cache\n");