blob: 96b672ad2df264fc2e1880d01d35af111492f4fd [file] [log] [blame]
Sandrine Bailleux798140d2014-07-17 16:06:39 +01001/*
2 * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
Dan Handleyea596682015-04-01 17:34:24 +010030#ifndef __PLAT_MACROS_S__
31#define __PLAT_MACROS_S__
Sandrine Bailleux798140d2014-07-17 16:06:39 +010032
Vikram Kanigiri4e97e542015-02-26 15:25:58 +000033#include <cci.h>
Sandrine Bailleux798140d2014-07-17 16:06:39 +010034#include <gic_v2.h>
35#include "platform_def.h"
36#include "../juno_def.h"
37
38.section .rodata.gic_reg_name, "aS"
Soby Mathew383c4772014-09-01 12:29:27 +010039gicc_regs:
40 .asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", ""
Sandrine Bailleux798140d2014-07-17 16:06:39 +010041gicd_pend_reg:
42 .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n"
43newline:
44 .asciz "\n"
45spacer:
46 .asciz ":\t\t0x"
47
48
49 /* ---------------------------------------------
50 * The below macro prints out relevant GIC
51 * registers whenever an unhandled exception is
52 * taken in BL3-1.
53 * Clobbers: x0 - x10, x16, sp
54 * ---------------------------------------------
55 */
56 .macro plat_print_gic_regs
Soby Mathew383c4772014-09-01 12:29:27 +010057 mov_imm x16, GICD_BASE
58 mov_imm x17, GICC_BASE
59 /* Load the gicc reg list to x6 */
60 adr x6, gicc_regs
61 /* Load the gicc regs to gp regs used by str_in_crash_buf_print */
62 ldr w8, [x17, #GICC_HPPIR]
63 ldr w9, [x17, #GICC_AHPPIR]
64 ldr w10, [x17, #GICC_CTLR]
Sandrine Bailleux798140d2014-07-17 16:06:39 +010065 /* Store to the crash buf and print to console */
66 bl str_in_crash_buf_print
67
68 /* Print the GICD_ISPENDR regs */
69 add x7, x16, #GICD_ISPENDR
70 adr x4, gicd_pend_reg
71 bl asm_print_str
72gicd_ispendr_loop:
73 sub x4, x7, x16
74 cmp x4, #0x280
75 b.eq exit_print_gic_regs
76 bl asm_print_hex
77
78 adr x4, spacer
79 bl asm_print_str
80
81 ldr x4, [x7], #8
82 bl asm_print_hex
83
84 adr x4, newline
85 bl asm_print_str
86 b gicd_ispendr_loop
87exit_print_gic_regs:
88 .endm
89
90.section .rodata.cci_reg_name, "aS"
91cci_iface_regs:
92 .asciz "cci_snoop_ctrl_cluster0", "cci_snoop_ctrl_cluster1" , ""
93
94 /* ------------------------------------------------
95 * The below macro prints out relevant interconnect
96 * registers whenever an unhandled exception is
97 * taken in BL3-1.
98 * Clobbers: x0 - x9, sp
99 * ------------------------------------------------
100 */
101 .macro plat_print_interconnect_regs
102 adr x6, cci_iface_regs
103 /* Store in x7 the base address of the first interface */
104 mov_imm x7, (CCI400_BASE + SLAVE_IFACE3_OFFSET)
105 ldr w8, [x7, #SNOOP_CTRL_REG]
106 /* Store in x7 the base address of the second interface */
107 mov_imm x7, (CCI400_BASE + SLAVE_IFACE4_OFFSET)
108 ldr w9, [x7, #SNOOP_CTRL_REG]
109 /* Store to the crash buf and print to console */
110 bl str_in_crash_buf_print
111 .endm
Dan Handleyea596682015-04-01 17:34:24 +0100112
113
114#endif /* __PLAT_MACROS_S__ */