blob: 1a574186873a115bed2556baa78fcd57e522c2bc [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>
9#include <pl011.h>
10#include <platform_def.h>
11
12 .weak platform_get_core_pos
13 .weak plat_crash_console_init
14 .weak plat_crash_console_putc
15 .weak plat_crash_console_flush
16
17 /* -----------------------------------------------------
18 * int platform_get_core_pos(u_register_t mpidr);
19 * With this function: CorePos = (ClusterId * 4) +
20 * CoreId
21 * -----------------------------------------------------
22 */
23func platform_get_core_pos
24 and r1, r0, #MPIDR_CPU_MASK
25 and r0, r0, #MPIDR_CLUSTER_MASK
26 add r0, r1, r0, LSR #6
27 bx lr
28endfunc platform_get_core_pos
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 */
37func plat_crash_console_init
38 ldr r0, =PLAT_ARM_UART_BASE
39 ldr r1, =PLAT_ARM_UART_CLK_IN_HZ
40 ldr r2, =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 ldr r1, =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 ldr r1, =PLAT_ARM_UART_BASE
66 b console_core_flush
67endfunc plat_crash_console_flush