1/* 2 * Copyright 2024-2025 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7#include <asm_macros.S> 8#include <platform_def.h> 9#include <s32cc-ncore.h> 10 11.globl plat_crash_console_flush 12.globl plat_crash_console_init 13.globl plat_crash_console_putc 14.globl plat_is_my_cpu_primary 15.globl plat_my_core_pos 16.globl plat_reset_handler 17.globl plat_secondary_cold_boot_setup 18.globl platform_mem_init 19.globl s32g2_core_pos_by_mpidr 20 21/* int plat_crash_console_init(void); */ 22func plat_crash_console_init 23 mov_imm x0, UART_BASE 24 mov_imm x1, UART_CLOCK_HZ 25 mov_imm x2, UART_BAUDRATE 26 b console_linflex_core_init 27endfunc plat_crash_console_init 28 29/* int plat_crash_console_putc(int); */ 30func plat_crash_console_putc 31 mov_imm x1, UART_BASE 32 b console_linflex_core_putc 33 ret 34endfunc plat_crash_console_putc 35 36/* void plat_crash_console_flush(void); */ 37func plat_crash_console_flush 38 mov_imm x0, UART_BASE 39 b console_linflex_core_flush 40 ret 41endfunc plat_crash_console_flush 42 43/** 44 * unsigned int s32g2_core_pos_by_mpidr(u_register_t mpidr); 45 * 46 * In: x0 - MPIDR_EL1 47 * Out: x0 48 * Clobber list: x0, x1 49 */ 50func s32g2_core_pos_by_mpidr 51 and x1, x0, #MPIDR_CPU_MASK 52 and x0, x0, #MPIDR_CLUSTER_MASK 53 lsr x0, x0, #MPIDR_AFF1_SHIFT 54 add x0, x1, x0, lsl #PLATFORM_MPIDR_CPU_MASK_BITS 55 ret 56endfunc s32g2_core_pos_by_mpidr 57 58/** 59 * unsigned int plat_my_core_pos(void); 60 * 61 * Out: x0 62 * Clobber list: x0, x1, x8 63 */ 64func plat_my_core_pos 65 mov x8, x30 66 mrs x0, mpidr_el1 67 bl s32g2_core_pos_by_mpidr 68 mov x30, x8 69 ret 70endfunc plat_my_core_pos 71 72/** 73 * unsigned int plat_is_my_cpu_primary(void); 74 * 75 * Clobber list: x0, x1, x7, x8 76 */ 77func plat_is_my_cpu_primary 78 mov x7, x30 79 bl plat_my_core_pos 80 cmp x0, #PLATFORM_PRIMARY_CPU 81 cset x0, eq 82 mov x30, x7 83 ret 84endfunc plat_is_my_cpu_primary 85 86 87/** 88 * void plat_secondary_cold_boot_setup (void); 89 */ 90func plat_secondary_cold_boot_setup 91 ret 92endfunc plat_secondary_cold_boot_setup 93 94/** 95 * void plat_reset_handler(void); 96 * 97 * Set the CAIUTC[IsolEn] bit for the primary A53 cluster. 98 * This is so cache invalidate operations from the early TF-A boot code 99 * won't cause Ncore to crash. 100 * 101 * Clobber list: x0, x1, x2 102 */ 103func plat_reset_handler 104 mov x0, #NCORE_CAIU0_BASE_ADDR 105 ldr w1, [x0, #NCORE_CAIUTC_OFF] 106 movz w2, #1 107 lsl w2, w2, #NCORE_CAIUTC_ISOLEN_SHIFT 108 orr w1, w1, w2 109 str w1, [x0, #NCORE_CAIUTC_OFF] 110 ret 111endfunc plat_reset_handler 112 113/* void platform_mem_init(void); */ 114func platform_mem_init 115 mov x10, x30 116 mov_imm x0, BL31_BASE 117 mov_imm x1, BL31_LIMIT 118 sub x1, x1, x0 119 bl zeromem 120 mov_imm x0, BL33_BASE 121 mov_imm x1, BL33_LIMIT 122 sub x1, x1, x0 123 bl zeromem 124 mov_imm x0, IO_BUFFER_BASE 125 mov_imm x1, IO_BUFFER_SIZE 126 bl zeromem 127 mov x30, x10 128 ret 129endfunc platform_mem_init 130 131