blob: 728ee1eb850ce5675e5a5376dc65565274588fe1 [file] [log] [blame]
Soby Mathewa43d4312014-04-07 15:28:55 +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 */
30
31#include <gic_v2.h>
Dan Handley6f3b1952014-06-20 12:02:01 +010032#include <plat_config.h>
Soby Mathewa43d4312014-04-07 15:28:55 +010033
34.section .rodata.gic_reg_name, "aS"
Soby Mathew626ed512014-06-25 10:07:40 +010035gic_regs:
36 .asciz "gic_hppir", "gic_ahppir", "gic_ctlr", ""
37gicd_pend_reg:
38 .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n"
39newline:
40 .asciz "\n"
41spacer:
42 .asciz ":\t\t0x"
Soby Mathewa43d4312014-04-07 15:28:55 +010043
Soby Mathewa43d4312014-04-07 15:28:55 +010044 /* ---------------------------------------------
45 * The below macro prints out relevant GIC
46 * registers whenever an unhandled exception is
47 * taken in BL31.
Soby Mathew626ed512014-06-25 10:07:40 +010048 * Clobbers: x0 - x10, x16, sp
Soby Mathewa43d4312014-04-07 15:28:55 +010049 * ---------------------------------------------
50 */
51 .macro plat_print_gic_regs
Soby Mathew626ed512014-06-25 10:07:40 +010052 adr x0, plat_config
53 ldr w16, [x0, #CONFIG_GICC_BASE_OFFSET]
54 cbz x16, 1f
55 /* gic base address is now in x16 */
56 adr x6, gic_regs /* Load the gic reg list to x6 */
57 /* Load the gic regs to gp regs used by str_in_crash_buf_print */
58 ldr w8, [x16, #GICC_HPPIR]
59 ldr w9, [x16, #GICC_AHPPIR]
60 ldr w10, [x16, #GICC_CTLR]
61 /* Store to the crash buf and print to cosole */
62 bl str_in_crash_buf_print
63
64 /* Print the GICD_ISPENDR regs */
65 add x7, x16, #GICD_ISPENDR
66 adr x4, gicd_pend_reg
67 bl asm_print_str
682:
69 sub x4, x7, x16
70 cmp x4, #0x280
71 b.eq 1f
72 bl asm_print_hex
73 adr x4, spacer
74 bl asm_print_str
75 ldr x4, [x7], #8
76 bl asm_print_hex
77 adr x4, newline
78 bl asm_print_str
79 b 2b
801:
Soby Mathewa43d4312014-04-07 15:28:55 +010081 .endm