25
25
#include <nuttx/config.h>
26
26
27
27
#include <stdint.h>
28
+ #include <syslog.h>
28
29
#include <debug.h>
29
30
30
31
#include "arm_internal.h"
31
32
#include "gic.h"
32
33
33
- #if defined(CONFIG_ARMV7A_HAVE_GICv2 ) && defined(CONFIG_DEBUG_IRQ_INFO )
34
+ #if defined(CONFIG_ARMV7A_HAVE_GICv2 ) && defined(CONFIG_ARMV7A_GICv2_DUMP )
35
+
36
+ /****************************************************************************
37
+ * Pre-processor Definitions
38
+ ****************************************************************************/
39
+
40
+ #ifdef CONFIG_CPP_HAVE_VARARGS
41
+ # define gicdump (fmt , ...) syslog(LOG_ALERT, fmt, ##__VA_ARGS__)
42
+ #else
43
+ # define gicdump (fmt , ...)
44
+ #endif
34
45
35
46
/****************************************************************************
36
47
* Private Functions
54
65
55
66
static inline void arm_gic_dump_cpu (bool all , int irq , int nlines )
56
67
{
57
- irqinfo (" CPU Interface Registers:\n" );
58
- irqinfo (" ICR: %08x PMR: %08x BPR: %08x IAR: %08x \n" ,
68
+ gicdump (" CPU Interface Registers:\n" );
69
+ gicdump (" ICR: %08lx PMR: %08lx BPR: %08lx IAR: %08lx \n" ,
59
70
getreg32 (GIC_ICCICR ), getreg32 (GIC_ICCPMR ),
60
71
getreg32 (GIC_ICCBPR ), getreg32 (GIC_ICCIAR ));
61
- irqinfo (" RPR: %08x HPIR: %08x ABPR: %08x \n" ,
72
+ gicdump (" RPR: %08lx HPIR: %08lx ABPR: %08lx \n" ,
62
73
getreg32 (GIC_ICCRPR ), getreg32 (GIC_ICCHPIR ),
63
74
getreg32 (GIC_ICCABPR ));
64
- irqinfo (" AIAR: %08x AHPIR: %08x IDR: %08x \n" ,
75
+ gicdump (" AIAR: %08lx AHPIR: %08lx IDR: %08lx \n" ,
65
76
getreg32 (GIC_ICCAIAR ), getreg32 (GIC_ICCAHPIR ),
66
77
getreg32 (GIC_ICCIDR ));
67
- irqinfo (" APR1: %08x APR2: %08x APR3: %08x APR4: %08x \n" ,
78
+ gicdump (" APR1: %08lx APR2: %08lx APR3: %08lx APR4: %08lx \n" ,
68
79
getreg32 (GIC_ICCAPR1 ), getreg32 (GIC_ICCAPR2 ),
69
80
getreg32 (GIC_ICCAPR3 ), getreg32 (GIC_ICCAPR4 ));
70
- irqinfo (" NSAPR1: %08x NSAPR2: %08x NSAPR3: %08x NSAPR4: %08x \n" ,
81
+ gicdump (" NSAPR1: %08lx NSAPR2: %08lx NSAPR3: %08lx NSAPR4: %08lx \n" ,
71
82
getreg32 (GIC_ICCNSAPR1 ), getreg32 (GIC_ICCNSAPR2 ),
72
83
getreg32 (GIC_ICCNSAPR3 ), getreg32 (GIC_ICCNSAPR4 ));
73
84
}
@@ -95,7 +106,7 @@ static void arm_gic_dumpregs(uintptr_t regaddr, int nlines, int incr)
95
106
incr <<= 2 ;
96
107
for (i = 0 ; i < nlines ; i += incr , regaddr += 16 )
97
108
{
98
- irqinfo (" %08x %08x %08x %08x \n" ,
109
+ gicdump (" %08lx %08lx %08lx %08lx \n" ,
99
110
getreg32 (regaddr ), getreg32 (regaddr + 4 ),
100
111
getreg32 (regaddr + 8 ), getreg32 (regaddr + 12 ));
101
112
}
@@ -120,7 +131,7 @@ static void arm_gic_dumpregs(uintptr_t regaddr, int nlines, int incr)
120
131
static inline void arm_gic_dump4 (const char * name , uintptr_t regaddr ,
121
132
int nlines )
122
133
{
123
- irqinfo (" %s[%08lx]\n" , name , (unsigned long )regaddr );
134
+ gicdump (" %s[%08lx]\n" , name , (unsigned long )regaddr );
124
135
arm_gic_dumpregs (regaddr , nlines , 4 );
125
136
}
126
137
@@ -143,7 +154,7 @@ static inline void arm_gic_dump4(const char *name, uintptr_t regaddr,
143
154
static inline void arm_gic_dump8 (const char * name , uintptr_t regaddr ,
144
155
int nlines )
145
156
{
146
- irqinfo (" %s[%08lx]\n" , name , (unsigned long )regaddr );
157
+ gicdump (" %s[%08lx]\n" , name , (unsigned long )regaddr );
147
158
arm_gic_dumpregs (regaddr , nlines , 8 );
148
159
}
149
160
@@ -166,7 +177,7 @@ static inline void arm_gic_dump8(const char *name, uintptr_t regaddr,
166
177
static inline void arm_gic_dump16 (const char * name , uintptr_t regaddr ,
167
178
int nlines )
168
179
{
169
- irqinfo (" %s[%08lx]\n" , name , (unsigned long )regaddr );
180
+ gicdump (" %s[%08lx]\n" , name , (unsigned long )regaddr );
170
181
arm_gic_dumpregs (regaddr , nlines , 16 );
171
182
}
172
183
@@ -189,7 +200,7 @@ static inline void arm_gic_dump16(const char *name, uintptr_t regaddr,
189
200
static inline void arm_gic_dump32 (const char * name , uintptr_t regaddr ,
190
201
int nlines )
191
202
{
192
- irqinfo (" %s[%08lx]\n" , name , (unsigned long )regaddr );
203
+ gicdump (" %s[%08lx]\n" , name , (unsigned long )regaddr );
193
204
arm_gic_dumpregs (regaddr , nlines , 32 );
194
205
}
195
206
@@ -211,8 +222,8 @@ static inline void arm_gic_dump32(const char *name, uintptr_t regaddr,
211
222
212
223
static inline void arm_gic_dump_distributor (bool all , int irq , int nlines )
213
224
{
214
- irqinfo (" Distributor Registers:\n" );
215
- irqinfo (" DCR: %08x ICTR: %08x IIDR: %08x \n" ,
225
+ gicdump (" Distributor Registers:\n" );
226
+ gicdump (" DCR: %08lx ICTR: %08lx IIDR: %08lx \n" ,
216
227
getreg32 (GIC_ICDDCR ), getreg32 (GIC_ICDICTR ),
217
228
getreg32 (GIC_ICDIIDR ));
218
229
@@ -231,25 +242,27 @@ static inline void arm_gic_dump_distributor(bool all, int irq, int nlines)
231
242
}
232
243
else
233
244
{
234
- irqinfo (" ISR: %08x ISER: %08x ISPR: %08x SAR: %08x\n" ,
245
+ gicdump (" ISR: %08lx ISER: %08lx ISPR: %08lx"
246
+ " SAR: %08lx\n" ,
235
247
getreg32 (GIC_ICDISR (irq )), getreg32 (GIC_ICDISER (irq )),
236
248
getreg32 (GIC_ICDISPR (irq )), getreg32 (GIC_ICDSAR (irq )));
237
- irqinfo (" IPR: %08x IPTR: %08x ICFR: %08x SPISR: %08x\n" ,
249
+ gicdump (" IPR: %08lx IPTR: %08lx ICFR: %08lx"
250
+ " SPISR: %08lx\n" ,
238
251
getreg32 (GIC_ICDIPR (irq )), getreg32 (GIC_ICDIPTR (irq )),
239
252
getreg32 (GIC_ICDICFR (irq )), getreg32 (GIC_ICDSPISR (irq )));
240
- irqinfo (" NSACR: %08x SCPR: %08x \n" ,
253
+ gicdump (" NSACR: %08lx SCPR: %08lx \n" ,
241
254
getreg32 (GIC_ICDNSACR (irq )), getreg32 (GIC_ICDSCPR (irq )));
242
255
}
243
256
244
- irqinfo (" PIDR[%08lx]:\n" , (unsigned long )GIC_ICDPIDR (0 ));
245
- irqinfo (" %08x %08x %08x %08x \n" ,
257
+ gicdump (" PIDR[%08lx]:\n" , (unsigned long )GIC_ICDPIDR (0 ));
258
+ gicdump (" %08lx %08lx %08lx %08lx \n" ,
246
259
getreg32 (GIC_ICDPIDR (0 )), getreg32 (GIC_ICDPIDR (1 )),
247
260
getreg32 (GIC_ICDPIDR (2 )), getreg32 (GIC_ICDPIDR (3 )));
248
- irqinfo (" %08x %08x %08x %08x \n" ,
261
+ gicdump (" %08lx %08lx %08lx \n" ,
249
262
getreg32 (GIC_ICDPIDR (4 )), getreg32 (GIC_ICDPIDR (5 )),
250
263
getreg32 (GIC_ICDPIDR (6 )));
251
- irqinfo (" CIDR[%08lx]:\n" , (unsigned long )GIC_ICDCIDR (0 ));
252
- irqinfo (" %08x %08x %08x %08x \n" ,
264
+ gicdump (" CIDR[%08lx]:\n" , (unsigned long )GIC_ICDCIDR (0 ));
265
+ gicdump (" %08lx %08lx %08lx %08lx \n" ,
253
266
getreg32 (GIC_ICDCIDR (0 )), getreg32 (GIC_ICDCIDR (1 )),
254
267
getreg32 (GIC_ICDCIDR (2 )), getreg32 (GIC_ICDCIDR (3 )));
255
268
}
@@ -280,15 +293,15 @@ void arm_gic_dump(const char *msg, bool all, int irq)
280
293
281
294
if (all )
282
295
{
283
- irqinfo ("GIC: %s NLINES=%u\n" , msg , nlines );
296
+ gicdump ("GIC: %s NLINES=%u\n" , msg , nlines );
284
297
}
285
298
else
286
299
{
287
- irqinfo ("GIC: %s IRQ=%d\n" , msg , irq );
300
+ gicdump ("GIC: %s IRQ=%d\n" , msg , irq );
288
301
}
289
302
290
303
arm_gic_dump_cpu (all , irq , nlines );
291
304
arm_gic_dump_distributor (all , irq , nlines );
292
305
}
293
306
294
- #endif /* CONFIG_ARMV7A_HAVE_GICv2 && CONFIG_DEBUG_IRQ_INFO */
307
+ #endif /* CONFIG_ARMV7A_HAVE_GICv2 && CONFIG_ARMV7A_GICv2_DUMP */
0 commit comments