xref: /rk3399_ARM-atf/drivers/arm/gic/v3/gicdv3_helpers.c (revision 0a0a7a9ac82cb79af91f098cedc69cc67bca3978)
1 /*
2  * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <stdint.h>
8 
9 #include "gicv3_private.h"
10 
11 /*******************************************************************************
12  * GIC Distributor interface accessors for bit operations
13  ******************************************************************************/
14 
15 /*
16  * Accessor to read the GIC Distributor IGRPMODR corresponding to the
17  * interrupt `id`, 32 interrupt IDs at a time.
18  */
19 uint32_t gicd_read_igrpmodr(uintptr_t base, unsigned int id)
20 {
21 	return GICD_READ(IGRPMODR, base, id);
22 }
23 
24 /*
25  * Accessor to write the GIC Distributor IGRPMODR corresponding to the
26  * interrupt `id`, 32 interrupt IDs at a time.
27  */
28 void gicd_write_igrpmodr(uintptr_t base, unsigned int id, uint32_t val)
29 {
30 	GICD_WRITE(IGRPMODR, base, id, val);
31 }
32 
33 /*
34  * Accessor to get the bit corresponding to interrupt ID
35  * in GIC Distributor IGRPMODR.
36  */
37 unsigned int gicd_get_igrpmodr(uintptr_t base, unsigned int id)
38 {
39 	return GICD_GET_BIT(IGRPMODR, base, id);
40 }
41 
42 /*
43  * Accessor to set the bit corresponding to interrupt ID
44  * in GIC Distributor IGRPMODR.
45  */
46 void gicd_set_igrpmodr(uintptr_t base, unsigned int id)
47 {
48 	GICD_SET_BIT(IGRPMODR, base, id);
49 }
50 
51 /*
52  * Accessor to clear the bit corresponding to interrupt ID
53  * in GIC Distributor IGRPMODR.
54  */
55 void gicd_clr_igrpmodr(uintptr_t base, unsigned int id)
56 {
57 	GICD_CLR_BIT(IGRPMODR, base, id);
58 }
59