Skip to content

Commit

Permalink
More fixes for aarch64 platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Nov 14, 2024
1 parent 3830f46 commit e88085c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 5 additions & 1 deletion hal/nxp_ls1028a.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* ls1028a.c
/* nxp_ls1028a.c
*
* Copyright (C) 2024 wolfSSL Inc.
*
Expand All @@ -25,6 +25,8 @@
#include "image.h"
#include "printf.h"

#ifdef TARGET_nxp_ls1028a

#ifndef ARCH_AARCH64
# error "wolfBoot ls1028a HAL: wrong architecture selected. Please compile with ARCH=AARCH64."
#endif
Expand Down Expand Up @@ -877,3 +879,5 @@ void hal_init(void)
wolfBoot_printf("MMU init done\n");
#endif
}

#endif /* TARGET_nxp_ls1028a */
2 changes: 2 additions & 0 deletions hal/nxp_ls1028a.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
#define MMUTCB_COUNT (64)
#define MMUTCB_BASE(_n) (MMUTCB0_BASE + ((_n) % MMUTCB_COUNT) * MMUTCB_STRIDE)
#define GICD_BASE (0x06000000ul) /* GIC-500 GICD */
#define GICR_BASE (0x06100000ul)
#define GICC_BASE (0x01402000ul)
#define GITS_BASE (0x06020000ul) /* GIC-500 GITS Control */
#define GITST_BASE (0x06030000ul) /* GIC-500 GITS Translation */
#define CPU0RD_BASE (0x06040000ul) /* CPU0 control, Locality Perif Int*/
Expand Down
2 changes: 1 addition & 1 deletion src/boot_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void boot_entry_C(void)
/* Copy data section from flash to RAM if necessary */
src = (unsigned int*)&_stored_data;
dst = (unsigned int*)&_start_data;
if(src!=dst) {
if (src != dst) {
while (dst < (unsigned int *)&_end_data) {
*dst = *src;
dst++;
Expand Down
14 changes: 8 additions & 6 deletions src/boot_aarch64_start.S
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,17 @@


/* GICv2 Register Offsets */
#ifndef GICD_BASE
#define GICD_BASE 0xF9010000
#endif
#define GICD_CTLR 0x0000
#define GICD_TYPER 0x0004
#define GICD_SGIR 0x0F00
#define GICD_IGROUPRn 0x0080

#ifndef GICC_BASE
#define GICC_BASE 0xF9020000
#endif
#define GICC_PMR 0x0004

.equ TZPCDECPROT0_SET_BASE, 0x02200804
Expand Down Expand Up @@ -120,7 +124,7 @@ _vector_table:

8: mov sp, x1 // set stack pointer

#ifdef CPU_A72
#ifdef CORTEX_A72
bl init_A72
#endif
bl boot_entry_C // boot_entry_C never returns
Expand Down Expand Up @@ -154,6 +158,7 @@ gicv2_init_secure:
ret


#ifdef CORTEX_A72
.global invalidate_ivac
invalidate_ivac:
ldr x0, =_OCRAM_ADDRESS
Expand Down Expand Up @@ -208,7 +213,6 @@ switch_el3_to_el2:
.global cortex_a72_erratta
cortex_a72_erratta:


/* Initalization code for NXP LS1028a (A72) */
.global init_A72
init_A72:
Expand Down Expand Up @@ -280,7 +284,6 @@ init_stack:
bl invalidate_ivac
b boot_entry_C

#ifdef TARGET_nxp_ls1028a
.global mmu_enable
mmu_enable:
tlbi alle3 /* Invalidate table entries */
Expand Down Expand Up @@ -318,7 +321,6 @@ mmu_enable:
dsb sy
isb
ret
#endif

/* Exception Vector Table EL3 */
.balign 0x800
Expand Down Expand Up @@ -390,7 +392,6 @@ PUT_64BIT_WORD \attr_hi, ((\PA) & 0xc0000000) | \attr_lo | 0x1
PUT_64BIT_WORD \attr_hi, ((\PA) & 0xffe00000) | \attr_lo | 0x1
.endm

#ifdef TARGET_nxp_ls1028a
/* Note: In EL3/2 has direct physical to virutal mapping */
.align 12
.global ttb0_base
Expand All @@ -407,4 +408,5 @@ level1_pagetable:
BLOCK_2MB (ADDR << 20), 0, 0x74c
.set ADDR, ADDR + 2
.endr
#endif

#endif /* CORTEX_A72 */

0 comments on commit e88085c

Please sign in to comment.