1/* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: GPL-2.0-only 5 */ 6 7#include <autoconf.h> 8#include <elfloader/gen_config.h> 9 10#if CONFIG_MAX_NUM_NODES > 1 11#include <types.h> 12#include <elfloader.h> 13#include <armv/machine.h> 14#include <armv/smp.h> 15#include <printf.h> 16 17unsigned long core_stacks[CONFIG_MAX_NUM_NODES][STACK_SIZE / sizeof(unsigned long)] ALIGN(BIT(12)); 18volatile int core_up[CONFIG_MAX_NUM_NODES]; 19 20extern void core_entry_head(void); 21extern void non_boot_main(void); 22 23void core_entry(uint32_t sp) 24{ 25 int id; 26 // get the logic ID 27 id = (sp - (unsigned long)&core_stacks[0][0]) / STACK_SIZE; 28 29 core_up[id] = id; 30 dsb(); 31 non_boot_main(); 32} 33 34int is_core_up(int i) 35{ 36 return core_up[i] == i; 37} 38 39#endif 40