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