gicv3_helpers.c 15.2 KB
Newer Older
1
/*
2
 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

7
8
#include <assert.h>

9
10
#include <arch.h>
#include <arch_helpers.h>
11
12
13
14
#include <common/debug.h>
#include <common/interrupt_props.h>
#include <drivers/arm/gic_common.h>

15
#include "../common/gic_common_private.h"
16
17
18
19
20
21
22
23
#include "gicv3_private.h"

/*
 * Accessor to read the GIC Distributor IGRPMODR corresponding to the
 * interrupt `id`, 32 interrupt IDs at a time.
 */
unsigned int gicd_read_igrpmodr(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
24
25
	unsigned int n = id >> IGRPMODR_SHIFT;

26
27
28
29
30
31
32
33
34
	return mmio_read_32(base + GICD_IGRPMODR + (n << 2));
}

/*
 * Accessor to write the GIC Distributor IGRPMODR corresponding to the
 * interrupt `id`, 32 interrupt IDs at a time.
 */
void gicd_write_igrpmodr(uintptr_t base, unsigned int id, unsigned int val)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
35
36
	unsigned int n = id >> IGRPMODR_SHIFT;

37
38
39
40
41
42
43
44
45
	mmio_write_32(base + GICD_IGRPMODR + (n << 2), val);
}

/*
 * Accessor to get the bit corresponding to interrupt ID
 * in GIC Distributor IGRPMODR.
 */
unsigned int gicd_get_igrpmodr(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
46
	unsigned int bit_num = id & ((1U << IGRPMODR_SHIFT) - 1U);
47
48
	unsigned int reg_val = gicd_read_igrpmodr(base, id);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
49
	return (reg_val >> bit_num) & 0x1U;
50
51
52
53
54
55
56
57
}

/*
 * Accessor to set the bit corresponding to interrupt ID
 * in GIC Distributor IGRPMODR.
 */
void gicd_set_igrpmodr(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
58
	unsigned int bit_num = id & ((1U << IGRPMODR_SHIFT) - 1U);
59
60
	unsigned int reg_val = gicd_read_igrpmodr(base, id);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
61
	gicd_write_igrpmodr(base, id, reg_val | (1U << bit_num));
62
63
64
65
66
67
68
69
}

/*
 * Accessor to clear the bit corresponding to interrupt ID
 * in GIC Distributor IGRPMODR.
 */
void gicd_clr_igrpmodr(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
70
	unsigned int bit_num = id & ((1U << IGRPMODR_SHIFT) - 1U);
71
72
	unsigned int reg_val = gicd_read_igrpmodr(base, id);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
73
	gicd_write_igrpmodr(base, id, reg_val & ~(1U << bit_num));
74
75
76
77
78
79
80
81
}

/*
 * Accessor to read the GIC Re-distributor IPRIORITYR corresponding to the
 * interrupt `id`, 4 interrupts IDs at a time.
 */
unsigned int gicr_read_ipriorityr(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
82
83
	unsigned int n = id >> IPRIORITYR_SHIFT;

84
85
86
87
88
89
90
91
92
	return mmio_read_32(base + GICR_IPRIORITYR + (n << 2));
}

/*
 * Accessor to write the GIC Re-distributor IPRIORITYR corresponding to the
 * interrupt `id`, 4 interrupts IDs at a time.
 */
void gicr_write_ipriorityr(uintptr_t base, unsigned int id, unsigned int val)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
93
94
	unsigned int n = id >> IPRIORITYR_SHIFT;

95
96
97
98
99
100
101
102
103
	mmio_write_32(base + GICR_IPRIORITYR + (n << 2), val);
}

/*
 * Accessor to get the bit corresponding to interrupt ID
 * from GIC Re-distributor IGROUPR0.
 */
unsigned int gicr_get_igroupr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
104
	unsigned int bit_num = id & ((1U << IGROUPR_SHIFT) - 1U);
105
106
	unsigned int reg_val = gicr_read_igroupr0(base);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
107
	return (reg_val >> bit_num) & 0x1U;
108
109
110
111
112
113
114
115
}

/*
 * Accessor to set the bit corresponding to interrupt ID
 * in GIC Re-distributor IGROUPR0.
 */
void gicr_set_igroupr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
116
	unsigned int bit_num = id & ((1U << IGROUPR_SHIFT) - 1U);
117
118
	unsigned int reg_val = gicr_read_igroupr0(base);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
119
	gicr_write_igroupr0(base, reg_val | (1U << bit_num));
120
121
122
123
124
125
126
127
}

/*
 * Accessor to clear the bit corresponding to interrupt ID
 * in GIC Re-distributor IGROUPR0.
 */
void gicr_clr_igroupr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
128
	unsigned int bit_num = id & ((1U << IGROUPR_SHIFT) - 1U);
129
130
	unsigned int reg_val = gicr_read_igroupr0(base);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
131
	gicr_write_igroupr0(base, reg_val & ~(1U << bit_num));
132
133
134
135
136
137
138
139
}

/*
 * Accessor to get the bit corresponding to interrupt ID
 * from GIC Re-distributor IGRPMODR0.
 */
unsigned int gicr_get_igrpmodr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
140
	unsigned int bit_num = id & ((1U << IGRPMODR_SHIFT) - 1U);
141
142
	unsigned int reg_val = gicr_read_igrpmodr0(base);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
143
	return (reg_val >> bit_num) & 0x1U;
144
145
146
147
148
149
150
151
}

/*
 * Accessor to set the bit corresponding to interrupt ID
 * in GIC Re-distributor IGRPMODR0.
 */
void gicr_set_igrpmodr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
152
	unsigned int bit_num = id & ((1U << IGRPMODR_SHIFT) - 1U);
153
154
	unsigned int reg_val = gicr_read_igrpmodr0(base);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
155
	gicr_write_igrpmodr0(base, reg_val | (1U << bit_num));
156
157
158
159
160
161
162
163
}

/*
 * Accessor to clear the bit corresponding to interrupt ID
 * in GIC Re-distributor IGRPMODR0.
 */
void gicr_clr_igrpmodr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
164
	unsigned int bit_num = id & ((1U << IGRPMODR_SHIFT) - 1U);
165
166
	unsigned int reg_val = gicr_read_igrpmodr0(base);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
167
	gicr_write_igrpmodr0(base, reg_val & ~(1U << bit_num));
168
169
170
171
172
173
174
175
}

/*
 * Accessor to set the bit corresponding to interrupt ID
 * in GIC Re-distributor ISENABLER0.
 */
void gicr_set_isenabler0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
176
	unsigned int bit_num = id & ((1U << ISENABLER_SHIFT) - 1U);
177

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
178
	gicr_write_isenabler0(base, (1U << bit_num));
179
180
}

181
182
183
184
185
186
/*
 * Accessor to set the bit corresponding to interrupt ID in GIC Re-distributor
 * ICENABLER0.
 */
void gicr_set_icenabler0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
187
	unsigned int bit_num = id & ((1U << ICENABLER_SHIFT) - 1U);
188

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
189
	gicr_write_icenabler0(base, (1U << bit_num));
190
191
}

192
193
194
195
196
197
/*
 * Accessor to set the bit corresponding to interrupt ID in GIC Re-distributor
 * ISACTIVER0.
 */
unsigned int gicr_get_isactiver0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
198
	unsigned int bit_num = id & ((1U << ISACTIVER_SHIFT) - 1U);
199
200
	unsigned int reg_val = gicr_read_isactiver0(base);

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
201
	return (reg_val >> bit_num) & 0x1U;
202
203
}

204
205
206
207
208
209
/*
 * Accessor to clear the bit corresponding to interrupt ID in GIC Re-distributor
 * ICPENDRR0.
 */
void gicr_set_icpendr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
210
	unsigned int bit_num = id & ((1U << ICPENDR_SHIFT) - 1U);
211

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
212
	gicr_write_icpendr0(base, (1U << bit_num));
213
214
215
216
217
218
219
220
}

/*
 * Accessor to set the bit corresponding to interrupt ID in GIC Re-distributor
 * ISPENDR0.
 */
void gicr_set_ispendr0(uintptr_t base, unsigned int id)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
221
	unsigned int bit_num = id & ((1U << ISPENDR_SHIFT) - 1U);
222

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
223
	gicr_write_ispendr0(base, (1U << bit_num));
224
225
}

226
227
228
229
230
231
/*
 * Accessor to set the byte corresponding to interrupt ID
 * in GIC Re-distributor IPRIORITYR.
 */
void gicr_set_ipriorityr(uintptr_t base, unsigned int id, unsigned int pri)
{
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
232
233
234
	uint8_t val = pri & GIC_PRI_MASK;

	mmio_write_8(base + GICR_IPRIORITYR + id, val);
235
236
}

237
238
239
240
241
242
/*
 * Accessor to set the bit fields corresponding to interrupt ID
 * in GIC Re-distributor ICFGR0.
 */
void gicr_set_icfgr0(uintptr_t base, unsigned int id, unsigned int cfg)
{
243
	/* Interrupt configuration is a 2-bit field */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
244
245
	unsigned int bit_num = id & ((1U << ICFGR_SHIFT) - 1U);
	unsigned int bit_shift = bit_num << 1U;
246

247
248
249
	uint32_t reg_val = gicr_read_icfgr0(base);

	/* Clear the field, and insert required configuration */
250
251
	reg_val &= ~(GIC_CFG_MASK << bit_shift);
	reg_val |= ((cfg & GIC_CFG_MASK) << bit_shift);
252
253
254
255
256
257
258
259
260
261

	gicr_write_icfgr0(base, reg_val);
}

/*
 * Accessor to set the bit fields corresponding to interrupt ID
 * in GIC Re-distributor ICFGR1.
 */
void gicr_set_icfgr1(uintptr_t base, unsigned int id, unsigned int cfg)
{
262
	/* Interrupt configuration is a 2-bit field */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
263
264
	unsigned int bit_num = id & ((1U << ICFGR_SHIFT) - 1U);
	unsigned int bit_shift = bit_num << 1U;
265

266
267
268
	uint32_t reg_val = gicr_read_icfgr1(base);

	/* Clear the field, and insert required configuration */
269
270
	reg_val &= ~(GIC_CFG_MASK << bit_shift);
	reg_val |= ((cfg & GIC_CFG_MASK) << bit_shift);
271
272
273
274

	gicr_write_icfgr1(base, reg_val);
}

275
276
277
278
279
280
281
282
283
284
/******************************************************************************
 * This function marks the core as awake in the re-distributor and
 * ensures that the interface is active.
 *****************************************************************************/
void gicv3_rdistif_mark_core_awake(uintptr_t gicr_base)
{
	/*
	 * The WAKER_PS_BIT should be changed to 0
	 * only when WAKER_CA_BIT is 1.
	 */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
285
	assert((gicr_read_waker(gicr_base) & WAKER_CA_BIT) != 0U);
286
287
288
289
290

	/* Mark the connected core as awake */
	gicr_write_waker(gicr_base, gicr_read_waker(gicr_base) & ~WAKER_PS_BIT);

	/* Wait till the WAKER_CA_BIT changes to 0 */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
291
	while ((gicr_read_waker(gicr_base) & WAKER_CA_BIT) != 0U)
292
293
294
295
296
297
298
299
300
301
302
303
304
305
		;
}


/******************************************************************************
 * This function marks the core as asleep in the re-distributor and ensures
 * that the interface is quiescent.
 *****************************************************************************/
void gicv3_rdistif_mark_core_asleep(uintptr_t gicr_base)
{
	/* Mark the connected core as asleep */
	gicr_write_waker(gicr_base, gicr_read_waker(gicr_base) | WAKER_PS_BIT);

	/* Wait till the WAKER_CA_BIT changes to 1 */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
306
	while ((gicr_read_waker(gicr_base) & WAKER_CA_BIT) == 0U)
307
308
309
310
311
312
313
314
315
316
317
318
319
320
		;
}


/*******************************************************************************
 * This function probes the Redistributor frames when the driver is initialised
 * and saves their base addresses. These base addresses are used later to
 * initialise each Redistributor interface.
 ******************************************************************************/
void gicv3_rdistif_base_addrs_probe(uintptr_t *rdistif_base_addrs,
					unsigned int rdistif_num,
					uintptr_t gicr_base,
					mpidr_hash_fn mpidr_to_core_pos)
{
321
	u_register_t mpidr;
322
	unsigned int proc_num;
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
323
	uint64_t typer_val;
324
325
	uintptr_t rdistif_base = gicr_base;

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
326
	assert(rdistif_base_addrs != NULL);
327
328
329
330
331
332
333
334
335
336

	/*
	 * Iterate over the Redistributor frames. Store the base address of each
	 * frame in the platform provided array. Use the "Processor Number"
	 * field to index into the array if the platform has not provided a hash
	 * function to convert an MPIDR (obtained from the "Affinity Value"
	 * field into a linear index.
	 */
	do {
		typer_val = gicr_read_typer(rdistif_base);
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
337
		if (mpidr_to_core_pos != NULL) {
338
339
340
341
342
343
344
345
			mpidr = mpidr_from_gicr_typer(typer_val);
			proc_num = mpidr_to_core_pos(mpidr);
		} else {
			proc_num = (typer_val >> TYPER_PROC_NUM_SHIFT) &
				TYPER_PROC_NUM_MASK;
		}
		assert(proc_num < rdistif_num);
		rdistif_base_addrs[proc_num] = rdistif_base;
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
346
347
		rdistif_base += (1U << GICR_PCPUBASE_SHIFT);
	} while ((typer_val & TYPER_LAST_BIT) == 0U);
348
349
350
351
352
}

/*******************************************************************************
 * Helper function to configure the default attributes of SPIs.
 ******************************************************************************/
Daniel Boulby's avatar
Daniel Boulby committed
353
void gicv3_spis_config_defaults(uintptr_t gicd_base)
354
355
356
357
358
{
	unsigned int index, num_ints;

	num_ints = gicd_read_typer(gicd_base);
	num_ints &= TYPER_IT_LINES_NO_MASK;
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
359
	num_ints = (num_ints + 1U) << 5;
360
361
362
363
364

	/*
	 * Treat all SPIs as G1NS by default. The number of interrupts is
	 * calculated as 32 * (IT_LINES + 1). We do 32 at a time.
	 */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
365
	for (index = MIN_SPI_ID; index < num_ints; index += 32U)
366
367
368
		gicd_write_igroupr(gicd_base, index, ~0U);

	/* Setup the default SPI priorities doing four at a time */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
369
	for (index = MIN_SPI_ID; index < num_ints; index += 4U)
370
371
372
373
374
375
376
377
		gicd_write_ipriorityr(gicd_base,
				      index,
				      GICD_IPRIORITYR_DEF_VAL);

	/*
	 * Treat all SPIs as level triggered by default, write 16 at
	 * a time
	 */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
378
379
	for (index = MIN_SPI_ID; index < num_ints; index += 16U)
		gicd_write_icfgr(gicd_base, index, 0U);
380
381
}

382
383
384
/*******************************************************************************
 * Helper function to configure properties of secure SPIs
 ******************************************************************************/
Daniel Boulby's avatar
Daniel Boulby committed
385
unsigned int gicv3_secure_spis_config_props(uintptr_t gicd_base,
386
387
388
389
390
391
		const interrupt_prop_t *interrupt_props,
		unsigned int interrupt_props_num)
{
	unsigned int i;
	const interrupt_prop_t *current_prop;
	unsigned long long gic_affinity_val;
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
392
	unsigned int ctlr_enable = 0U;
393
394

	/* Make sure there's a valid property array */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
395
396
	if (interrupt_props_num > 0U)
		assert(interrupt_props != NULL);
397

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
398
	for (i = 0U; i < interrupt_props_num; i++) {
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
		current_prop = &interrupt_props[i];

		if (current_prop->intr_num < MIN_SPI_ID)
			continue;

		/* Configure this interrupt as a secure interrupt */
		gicd_clr_igroupr(gicd_base, current_prop->intr_num);

		/* Configure this interrupt as G0 or a G1S interrupt */
		assert((current_prop->intr_grp == INTR_GROUP0) ||
				(current_prop->intr_grp == INTR_GROUP1S));
		if (current_prop->intr_grp == INTR_GROUP1S) {
			gicd_set_igrpmodr(gicd_base, current_prop->intr_num);
			ctlr_enable |= CTLR_ENABLE_G1S_BIT;
		} else {
			gicd_clr_igrpmodr(gicd_base, current_prop->intr_num);
			ctlr_enable |= CTLR_ENABLE_G0_BIT;
		}

		/* Set interrupt configuration */
		gicd_set_icfgr(gicd_base, current_prop->intr_num,
				current_prop->intr_cfg);

		/* Set the priority of this interrupt */
		gicd_set_ipriorityr(gicd_base, current_prop->intr_num,
				current_prop->intr_pri);

		/* Target SPIs to the primary CPU */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
427
428
		gic_affinity_val =
			gicd_irouter_val_from_mpidr(read_mpidr(), 0U);
429
430
431
432
433
434
435
436
437
		gicd_write_irouter(gicd_base, current_prop->intr_num,
				gic_affinity_val);

		/* Enable this interrupt */
		gicd_set_isenabler(gicd_base, current_prop->intr_num);
	}

	return ctlr_enable;
}
438
439
440
441

/*******************************************************************************
 * Helper function to configure the default attributes of SPIs.
 ******************************************************************************/
Daniel Boulby's avatar
Daniel Boulby committed
442
void gicv3_ppi_sgi_config_defaults(uintptr_t gicr_base)
443
444
445
446
447
448
449
450
{
	unsigned int index;

	/*
	 * Disable all SGIs (imp. def.)/PPIs before configuring them. This is a
	 * more scalable approach as it avoids clearing the enable bits in the
	 * GICD_CTLR
	 */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
451
	gicr_write_icenabler0(gicr_base, ~0U);
452
453
454
455
456
457
	gicr_wait_for_pending_write(gicr_base);

	/* Treat all SGIs/PPIs as G1NS by default. */
	gicr_write_igroupr0(gicr_base, ~0U);

	/* Setup the default PPI/SGI priorities doing four at a time */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
458
	for (index = 0U; index < MIN_SPI_ID; index += 4U)
459
460
461
462
463
		gicr_write_ipriorityr(gicr_base,
				      index,
				      GICD_IPRIORITYR_DEF_VAL);

	/* Configure all PPIs as level triggered by default */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
464
	gicr_write_icfgr1(gicr_base, 0U);
465
466
}

467
468
469
/*******************************************************************************
 * Helper function to configure properties of secure G0 and G1S PPIs and SGIs.
 ******************************************************************************/
Daniel Boulby's avatar
Daniel Boulby committed
470
unsigned int gicv3_secure_ppi_sgi_config_props(uintptr_t gicr_base,
471
472
473
474
475
		const interrupt_prop_t *interrupt_props,
		unsigned int interrupt_props_num)
{
	unsigned int i;
	const interrupt_prop_t *current_prop;
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
476
	unsigned int ctlr_enable = 0U;
477
478

	/* Make sure there's a valid property array */
Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
479
480
	if (interrupt_props_num > 0U)
		assert(interrupt_props != NULL);
481

Antonio Nino Diaz's avatar
Antonio Nino Diaz committed
482
	for (i = 0U; i < interrupt_props_num; i++) {
483
484
485
486
487
488
489
490
491
492
493
		current_prop = &interrupt_props[i];

		if (current_prop->intr_num >= MIN_SPI_ID)
			continue;

		/* Configure this interrupt as a secure interrupt */
		gicr_clr_igroupr0(gicr_base, current_prop->intr_num);

		/* Configure this interrupt as G0 or a G1S interrupt */
		assert((current_prop->intr_grp == INTR_GROUP0) ||
				(current_prop->intr_grp == INTR_GROUP1S));
Jeenu Viswambharan's avatar
Jeenu Viswambharan committed
494
		if (current_prop->intr_grp == INTR_GROUP1S) {
495
			gicr_set_igrpmodr0(gicr_base, current_prop->intr_num);
Jeenu Viswambharan's avatar
Jeenu Viswambharan committed
496
497
			ctlr_enable |= CTLR_ENABLE_G1S_BIT;
		} else {
498
			gicr_clr_igrpmodr0(gicr_base, current_prop->intr_num);
Jeenu Viswambharan's avatar
Jeenu Viswambharan committed
499
500
			ctlr_enable |= CTLR_ENABLE_G0_BIT;
		}
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518

		/* Set the priority of this interrupt */
		gicr_set_ipriorityr(gicr_base, current_prop->intr_num,
				current_prop->intr_pri);

		/*
		 * Set interrupt configuration for PPIs. Configuration for SGIs
		 * are ignored.
		 */
		if ((current_prop->intr_num >= MIN_PPI_ID) &&
				(current_prop->intr_num < MIN_SPI_ID)) {
			gicr_set_icfgr1(gicr_base, current_prop->intr_num,
					current_prop->intr_cfg);
		}

		/* Enable this interrupt */
		gicr_set_isenabler0(gicr_base, current_prop->intr_num);
	}
Jeenu Viswambharan's avatar
Jeenu Viswambharan committed
519
520

	return ctlr_enable;
521
}