Loh Tien Hock | 59400a4 | 2019-02-04 16:17:24 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
| 9 | #include <cpu_macros.S> |
| 10 | #include <platform_def.h> |
| 11 | |
| 12 | .globl plat_secondary_cold_boot_setup |
| 13 | .globl platform_is_primary_cpu |
| 14 | .globl plat_is_my_cpu_primary |
| 15 | .globl plat_my_core_pos |
| 16 | .globl plat_crash_console_init |
| 17 | .globl plat_crash_console_putc |
| 18 | .globl plat_crash_console_flush |
| 19 | .globl platform_mem_init |
| 20 | |
| 21 | .globl plat_get_my_entrypoint |
Loh Tien Hock | 59400a4 | 2019-02-04 16:17:24 +0800 | [diff] [blame] | 22 | |
| 23 | /* ----------------------------------------------------- |
| 24 | * void plat_secondary_cold_boot_setup (void); |
| 25 | * |
| 26 | * This function performs any platform specific actions |
| 27 | * needed for a secondary cpu after a cold reset e.g |
| 28 | * mark the cpu's presence, mechanism to place it in a |
| 29 | * holding pen etc. |
| 30 | * ----------------------------------------------------- |
| 31 | */ |
| 32 | func plat_secondary_cold_boot_setup |
| 33 | /* Wait until the it gets reset signal from rstmgr gets populated */ |
| 34 | poll_mailbox: |
Tien Hock, Loh | ab34f74 | 2019-02-26 09:25:14 +0800 | [diff] [blame] | 35 | wfi |
Loh Tien Hock | 59400a4 | 2019-02-04 16:17:24 +0800 | [diff] [blame] | 36 | |
Tien Hock, Loh | ab34f74 | 2019-02-26 09:25:14 +0800 | [diff] [blame] | 37 | mov_imm x0, PLAT_S10_SEC_ENTRY |
Loh Tien Hock | 59400a4 | 2019-02-04 16:17:24 +0800 | [diff] [blame] | 38 | ldr x1, [x0] |
Tien Hock, Loh | ab34f74 | 2019-02-26 09:25:14 +0800 | [diff] [blame] | 39 | mov_imm x2, PLAT_CPUID_RELEASE |
Loh Tien Hock | 59400a4 | 2019-02-04 16:17:24 +0800 | [diff] [blame] | 40 | ldr x3, [x2] |
| 41 | mrs x4, mpidr_el1 |
| 42 | and x4, x4, #0xff |
| 43 | cmp x3, x4 |
| 44 | b.ne poll_mailbox |
| 45 | br x1 |
| 46 | endfunc plat_secondary_cold_boot_setup |
| 47 | |
| 48 | func platform_is_primary_cpu |
| 49 | and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK) |
| 50 | cmp x0, #PLAT_PRIMARY_CPU |
| 51 | cset x0, eq |
| 52 | ret |
| 53 | endfunc platform_is_primary_cpu |
| 54 | |
| 55 | func plat_is_my_cpu_primary |
| 56 | mrs x0, mpidr_el1 |
| 57 | b platform_is_primary_cpu |
| 58 | endfunc plat_is_my_cpu_primary |
| 59 | |
| 60 | func plat_my_core_pos |
| 61 | mrs x0, mpidr_el1 |
| 62 | and x1, x0, #MPIDR_CPU_MASK |
| 63 | and x0, x0, #MPIDR_CLUSTER_MASK |
| 64 | add x0, x1, x0, LSR #6 |
| 65 | ret |
| 66 | endfunc plat_my_core_pos |
| 67 | |
| 68 | func plat_get_my_entrypoint |
Tien Hock, Loh | ab34f74 | 2019-02-26 09:25:14 +0800 | [diff] [blame] | 69 | mov_imm x1, PLAT_S10_SEC_ENTRY |
Loh Tien Hock | 59400a4 | 2019-02-04 16:17:24 +0800 | [diff] [blame] | 70 | ldr x0, [x1] |
| 71 | ret |
| 72 | endfunc plat_get_my_entrypoint |
| 73 | |
| 74 | /* --------------------------------------------- |
| 75 | * int plat_crash_console_init(void) |
| 76 | * Function to initialize the crash console |
| 77 | * without a C Runtime to print crash report. |
| 78 | * Clobber list : x0, x1, x2 |
| 79 | * --------------------------------------------- |
| 80 | */ |
| 81 | func plat_crash_console_init |
| 82 | mov_imm x0, PLAT_UART0_BASE |
| 83 | mov_imm x1, PLAT_UART_CLOCK |
| 84 | mov_imm x2, PLAT_BAUDRATE |
| 85 | b console_16550_core_init |
| 86 | endfunc plat_crash_console_init |
| 87 | |
| 88 | /* --------------------------------------------- |
| 89 | * int plat_crash_console_putc(void) |
| 90 | * Function to print a character on the crash |
| 91 | * console without a C Runtime. |
| 92 | * Clobber list : x1, x2 |
| 93 | * --------------------------------------------- |
| 94 | */ |
| 95 | func plat_crash_console_putc |
| 96 | mov_imm x1, PLAT_UART0_BASE |
| 97 | b console_16550_core_putc |
| 98 | endfunc plat_crash_console_putc |
| 99 | |
| 100 | func plat_crash_console_flush |
| 101 | mov_imm x0, CRASH_CONSOLE_BASE |
| 102 | b console_16550_core_flush |
| 103 | endfunc plat_crash_console_flush |
| 104 | |
| 105 | |
| 106 | /* -------------------------------------------------------- |
| 107 | * void platform_mem_init (void); |
| 108 | * |
| 109 | * Any memory init, relocation to be done before the |
| 110 | * platform boots. Called very early in the boot process. |
| 111 | * -------------------------------------------------------- |
| 112 | */ |
| 113 | func platform_mem_init |
| 114 | mov x0, #0 |
| 115 | ret |
| 116 | endfunc platform_mem_init |
| 117 | |
| 118 | |
| 119 | .data |
| 120 | .align 3 |
| 121 | |