| Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
| Antonio Nino Diaz | 1cf45c9 | 2018-10-15 09:03:43 +0100 | [diff] [blame^] | 9 | #include <pl011.h> |
| 10 | #include "../juno_def.h" |
| Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 11 | |
| 12 | .globl platform_get_core_pos |
| Antonio Nino Diaz | 1cf45c9 | 2018-10-15 09:03:43 +0100 | [diff] [blame^] | 13 | .globl plat_crash_console_init |
| 14 | .globl plat_crash_console_putc |
| 15 | .globl plat_crash_console_flush |
| Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 16 | |
| 17 | /* |
| 18 | * Return 0 to 3 for the Cortex-A53 cores and 4 to 5 for the Cortex-A57 |
| 19 | * cores. |
| 20 | */ |
| 21 | func platform_get_core_pos |
| 22 | and x1, x0, #MPIDR_CPU_MASK |
| 23 | and x0, x0, #MPIDR_CLUSTER_MASK |
| 24 | /* Swap Cortex-A53/Cortex-A57 order. */ |
| 25 | eor x0, x0, #(1 << MPIDR_AFF1_SHIFT) |
| 26 | add x0, x1, x0, LSR #6 |
| 27 | ret |
| 28 | endfunc platform_get_core_pos |
| Antonio Nino Diaz | 1cf45c9 | 2018-10-15 09:03:43 +0100 | [diff] [blame^] | 29 | |
| 30 | /* --------------------------------------------- |
| 31 | * int plat_crash_console_init(void) |
| 32 | * Function to initialize the crash console |
| 33 | * without a C Runtime to print crash report. |
| 34 | * Clobber list : x0 - x4 |
| 35 | * --------------------------------------------- |
| 36 | */ |
| 37 | func plat_crash_console_init |
| 38 | mov_imm x0, PLAT_ARM_UART_BASE |
| 39 | mov_imm x1, PLAT_ARM_UART_CLK_IN_HZ |
| 40 | mov_imm x2, PL011_BAUDRATE |
| 41 | b console_core_init |
| 42 | endfunc plat_crash_console_init |
| 43 | |
| 44 | /* --------------------------------------------- |
| 45 | * int plat_crash_console_putc(int c) |
| 46 | * Function to print a character on the crash |
| 47 | * console without a C Runtime. |
| 48 | * Clobber list : x1, x2 |
| 49 | * --------------------------------------------- |
| 50 | */ |
| 51 | func plat_crash_console_putc |
| 52 | mov_imm x1, PLAT_ARM_UART_BASE |
| 53 | b console_core_putc |
| 54 | endfunc plat_crash_console_putc |
| 55 | |
| 56 | /* --------------------------------------------- |
| 57 | * int plat_crash_console_flush() |
| 58 | * Function to force a write of all buffered |
| 59 | * data that hasn't been output. |
| 60 | * Out : return -1 on error else return 0. |
| 61 | * Clobber list : r0 - r1 |
| 62 | * --------------------------------------------- |
| 63 | */ |
| 64 | func plat_crash_console_flush |
| 65 | mov_imm x1, PLAT_ARM_UART_BASE |
| 66 | b console_core_flush |
| 67 | endfunc plat_crash_console_flush |