Skip to content

Commit

Permalink
elfloader-tool,bcm2711: BCM2711 support
Browse files Browse the repository at this point in the history
Cherry-pick 'smp.c' and 'smp_head.S' from
ARM Research IceCap repository for BCM2711 platform.
Commit ID: b2b92939bf94443e7bf13a15801561ef7caf565d
URL: https://gitlab.com/icecap-project/seL4_tools/-/commit/<SHA>

UART support files are not selected from the commit,
as kernel correctly generates header(s) for the
'bcm2835-aux-uart', which is the same as on RPi3, and
the common 'bcm-uart.c' driver can be used for RPi4 too.

Signed-off-by: Joonas Onatsu <joonasx@ssrc.tii.ae>
  • Loading branch information
JoonasOnatsu committed Nov 23, 2022
1 parent 074a54a commit 63819ac
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
50 changes: 50 additions & 0 deletions elfloader-tool/src/plat/bcm2711/smp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2019, ARM Ltd
*
* SPDX-License-Identifier: BSD-2-Clause
*
*/

#include <autoconf.h>
#include <elfloader/gen_config.h>
#include <types.h>

#if CONFIG_MAX_NUM_NODES > 1
#include <types.h>
#include <elfloader.h>
#include <armv/machine.h>
#include <armv/smp.h>
#include <printf.h>
#include <abort.h>

#define MAX_CORES 4

extern void core_entry_head(unsigned long stack);

unsigned long core_stack;

uint64_t spin_table[4] = { 0xd8, 0xe0, 0xe8, 0xf0 };

void init_cpus(void)
{
int nodes = CONFIG_MAX_NUM_NODES;
if (nodes > MAX_CORES) {
printf("CONFIG_MAX_NUM_NODES %d is greater than max number cores %d, will abort\n",
CONFIG_MAX_NUM_NODES, MAX_CORES);
abort();
}
for (int i = 1; i < nodes; i++) {
/* all cores read the stack pointer from the same place */
core_stack = (unsigned long) &core_stacks[i][0];
*((volatile unsigned long *)(spin_table[i])) = (unsigned long)core_entry_head;
dsb();
asm volatile("sev");
while (!is_core_up(i));
printf("Core %d is up with logic ID %d\n", i, i);
}

/* set the logic id for the booting core */
MSR("tpidr_el1", 0);
}

#endif /* CONFIG_MAX_NUM_NODES > 1 */
27 changes: 27 additions & 0 deletions elfloader-tool/src/plat/bcm2711/smp_head.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2019, ARM Ltd
*
* SPDX-License-Identifier: BSD-2-Clause
*
*/

#include <autoconf.h>
#include <elfloader/gen_config.h>
#include <assembler.h>
#include <armv/assembler.h>

#if CONFIG_MAX_NUM_NODES > 1

.text

.extern core_entry
.extern core_stack
BEGIN_FUNC(core_entry_head)
ldr x0, =core_stack
ldr x3, [x0]
mov x0, x3
mov sp, x3
b core_entry
END_FUNC(core_entry_head)

#endif

0 comments on commit 63819ac

Please sign in to comment.