Remove BSS section access by 'plat_print_gic' during crash reporting

This patch avoids the problem of crash reporting mechanism accessing
global data in BSS by 'plat_print_gic_regs' for FVP platforms. Earlier
it depended on the global 'plat_config' object for the GIC Base address
in FVP platforms which would have caused exception if it were accessed
before the BSS was initialized. It is now fixed by dynamically
querying the V2M_SYS_ID to find the FVP model type and accordingly
selecting the appropriate GIC Base address.

This patch also fixes the 'plat_print_gic_regs' to use the correct GIC
Distributor base address for printing GICD_IS_PENDR register values
for both Juno and FVP platforms.

Fixes ARM-Software/tf-issues#236

Change-Id: I545c7b908b3111419bf27db0575ce86acf86784b
diff --git a/plat/juno/include/plat_macros.S b/plat/juno/include/plat_macros.S
index 0e08834..a9d2466 100644
--- a/plat/juno/include/plat_macros.S
+++ b/plat/juno/include/plat_macros.S
@@ -34,8 +34,8 @@
 #include "../juno_def.h"
 
 .section .rodata.gic_reg_name, "aS"
-gic_regs:
-	.asciz "gic_hppir", "gic_ahppir", "gic_ctlr", ""
+gicc_regs:
+	.asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", ""
 gicd_pend_reg:
 	.asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n"
 newline:
@@ -52,13 +52,14 @@
 	 * ---------------------------------------------
 	 */
 	.macro plat_print_gic_regs
-	ldr	x16, =GICC_BASE
-	/* Load the gic reg list to x6 */
-	adr	x6, gic_regs
-	/* Load the gic regs to gp regs used by str_in_crash_buf_print */
-	ldr	w8, [x16, #GICC_HPPIR]
-	ldr	w9, [x16, #GICC_AHPPIR]
-	ldr	w10, [x16, #GICC_CTLR]
+	mov_imm	x16, GICD_BASE
+	mov_imm	x17, GICC_BASE
+	/* Load the gicc reg list to x6 */
+	adr	x6, gicc_regs
+	/* Load the gicc regs to gp regs used by str_in_crash_buf_print */
+	ldr	w8, [x17, #GICC_HPPIR]
+	ldr	w9, [x17, #GICC_AHPPIR]
+	ldr	w10, [x17, #GICC_CTLR]
 	/* Store to the crash buf and print to console */
 	bl	str_in_crash_buf_print