blob: 1efee4fbdbf5313f12f91c12c3bc797b7586ceab [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
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 Diaz1cf45c92018-10-15 09:03:43 +01009#include <pl011.h>
10#include "../juno_def.h"
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020011
12 .globl platform_get_core_pos
Antonio Nino Diaz1cf45c92018-10-15 09:03:43 +010013 .globl plat_crash_console_init
14 .globl plat_crash_console_putc
15 .globl plat_crash_console_flush
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020016
17 /*
18 * Return 0 to 3 for the Cortex-A53 cores and 4 to 5 for the Cortex-A57
19 * cores.
20 */
21func 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
28endfunc platform_get_core_pos
Antonio Nino Diaz1cf45c92018-10-15 09:03:43 +010029
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 */
37func 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
42endfunc 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 */
51func plat_crash_console_putc
52 mov_imm x1, PLAT_ARM_UART_BASE
53 b console_core_putc
54endfunc 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 */
64func plat_crash_console_flush
65 mov_imm x1, PLAT_ARM_UART_BASE
66 b console_core_flush
67endfunc plat_crash_console_flush