blob: 8b96b37bb3d90a301e01c5ff843d5ee8cd095c31 [file] [log] [blame]
Soby Mathew50f6fe42016-02-01 17:59:22 +00001/*
Jeenu Viswambharan24e70292017-09-22 08:32:09 +01002 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
Soby Mathew50f6fe42016-02-01 17:59:22 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathew50f6fe42016-02-01 17:59:22 +00005 */
6
7#ifndef GIC_COMMON_PRIVATE_H_
8#define GIC_COMMON_PRIVATE_H_
9
10#include <gic_common.h>
11#include <mmio.h>
12#include <stdint.h>
13
14/*******************************************************************************
15 * GIC Distributor interface register accessors that are common to GICv3 & GICv2
16 ******************************************************************************/
17static inline unsigned int gicd_read_ctlr(uintptr_t base)
18{
19 return mmio_read_32(base + GICD_CTLR);
20}
21
22static inline unsigned int gicd_read_typer(uintptr_t base)
23{
24 return mmio_read_32(base + GICD_TYPER);
25}
26
27static inline unsigned int gicd_read_iidr(uintptr_t base)
28{
29 return mmio_read_32(base + GICD_IIDR);
30}
31
32static inline void gicd_write_ctlr(uintptr_t base, unsigned int val)
33{
34 mmio_write_32(base + GICD_CTLR, val);
35}
36
37/*******************************************************************************
38 * GIC Distributor function prototypes for accessing entire registers.
39 * Note: The raw register values correspond to multiple interrupt IDs and
40 * the number of interrupt IDs involved depends on the register accessed.
41 ******************************************************************************/
42unsigned int gicd_read_igroupr(uintptr_t base, unsigned int id);
43unsigned int gicd_read_isenabler(uintptr_t base, unsigned int id);
44unsigned int gicd_read_icenabler(uintptr_t base, unsigned int id);
45unsigned int gicd_read_ispendr(uintptr_t base, unsigned int id);
46unsigned int gicd_read_icpendr(uintptr_t base, unsigned int id);
47unsigned int gicd_read_isactiver(uintptr_t base, unsigned int id);
48unsigned int gicd_read_icactiver(uintptr_t base, unsigned int id);
49unsigned int gicd_read_ipriorityr(uintptr_t base, unsigned int id);
50unsigned int gicd_read_icfgr(uintptr_t base, unsigned int id);
51unsigned int gicd_read_nsacr(uintptr_t base, unsigned int id);
52void gicd_write_igroupr(uintptr_t base, unsigned int id, unsigned int val);
53void gicd_write_isenabler(uintptr_t base, unsigned int id, unsigned int val);
54void gicd_write_icenabler(uintptr_t base, unsigned int id, unsigned int val);
55void gicd_write_ispendr(uintptr_t base, unsigned int id, unsigned int val);
56void gicd_write_icpendr(uintptr_t base, unsigned int id, unsigned int val);
57void gicd_write_isactiver(uintptr_t base, unsigned int id, unsigned int val);
58void gicd_write_icactiver(uintptr_t base, unsigned int id, unsigned int val);
59void gicd_write_ipriorityr(uintptr_t base, unsigned int id, unsigned int val);
60void gicd_write_icfgr(uintptr_t base, unsigned int id, unsigned int val);
61void gicd_write_nsacr(uintptr_t base, unsigned int id, unsigned int val);
62
63/*******************************************************************************
64 * GIC Distributor function prototypes for accessing the GIC registers
65 * corresponding to a single interrupt ID. These functions use bitwise
66 * operations or appropriate register accesses to modify or return
67 * the bit-field corresponding the single interrupt ID.
68 ******************************************************************************/
69unsigned int gicd_get_igroupr(uintptr_t base, unsigned int id);
70void gicd_set_igroupr(uintptr_t base, unsigned int id);
71void gicd_clr_igroupr(uintptr_t base, unsigned int id);
72void gicd_set_isenabler(uintptr_t base, unsigned int id);
73void gicd_set_icenabler(uintptr_t base, unsigned int id);
74void gicd_set_ispendr(uintptr_t base, unsigned int id);
75void gicd_set_icpendr(uintptr_t base, unsigned int id);
Jeenu Viswambharan24e70292017-09-22 08:32:09 +010076unsigned int gicd_get_isactiver(uintptr_t base, unsigned int id);
Soby Mathew50f6fe42016-02-01 17:59:22 +000077void gicd_set_isactiver(uintptr_t base, unsigned int id);
78void gicd_set_icactiver(uintptr_t base, unsigned int id);
79void gicd_set_ipriorityr(uintptr_t base, unsigned int id, unsigned int pri);
80
81#endif /* GIC_COMMON_PRIVATE_H_ */