]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Include/Library/ArmGicLib.h
ArmPkg/ArmGic: Added GicV3 detection
[mirror_edk2.git] / ArmPkg / Include / Library / ArmGicLib.h
CommitLineData
55a0d64b 1/** @file\r
2*\r
e700a1fc 3* Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
55a0d64b 4*\r
1cb13673
OM
5* This program and the accompanying materials\r
6* are licensed and made available under the terms and conditions of the BSD License\r
7* which accompanies this distribution. The full text of the license may be found at\r
8* http://opensource.org/licenses/bsd-license.php\r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
55a0d64b 12*\r
13**/\r
14\r
017baa1c
OM
15#ifndef __ARMGIC_H\r
16#define __ARMGIC_H\r
55a0d64b 17\r
18//\r
19// GIC definitions\r
20//\r
d5c6b7fc 21typedef enum {\r
5f525769
OM
22 ARM_GIC_ARCH_REVISION_2,\r
23 ARM_GIC_ARCH_REVISION_3\r
d5c6b7fc 24} ARM_GIC_ARCH_REVISION;\r
55a0d64b 25\r
26//\r
27// GIC Distributor\r
28//\r
29#define ARM_GIC_ICDDCR 0x000 // Distributor Control Register\r
30#define ARM_GIC_ICDICTR 0x004 // Interrupt Controller Type Register\r
31#define ARM_GIC_ICDIIDR 0x008 // Implementer Identification Register\r
32\r
33// Each reg base below repeats for VE_NUM_ARM_GIC_REG_PER_INT_BITS (see GIC spec)\r
34#define ARM_GIC_ICDISR 0x080 // Interrupt Security Registers\r
35#define ARM_GIC_ICDISER 0x100 // Interrupt Set-Enable Registers\r
36#define ARM_GIC_ICDICER 0x180 // Interrupt Clear-Enable Registers\r
37#define ARM_GIC_ICDSPR 0x200 // Interrupt Set-Pending Registers\r
38#define ARM_GIC_ICDICPR 0x280 // Interrupt Clear-Pending Registers\r
39#define ARM_GIC_ICDABR 0x300 // Active Bit Registers\r
40\r
41// Each reg base below repeats for VE_NUM_ARM_GIC_REG_PER_INT_BYTES\r
42#define ARM_GIC_ICDIPR 0x400 // Interrupt Priority Registers\r
43\r
44// Each reg base below repeats for VE_NUM_ARM_GIC_INTERRUPTS\r
45#define ARM_GIC_ICDIPTR 0x800 // Interrupt Processor Target Registers\r
46#define ARM_GIC_ICDICFR 0xC00 // Interrupt Configuration Registers\r
47\r
48#define ARM_GIC_ICDPPISR 0xD00 // PPI Status register\r
49\r
50// just one of these\r
51#define ARM_GIC_ICDSGIR 0xF00 // Software Generated Interrupt Register\r
52\r
53//\r
54// GIC Cpu interface\r
55//\r
56#define ARM_GIC_ICCICR 0x00 // CPU Interface Control Register\r
57#define ARM_GIC_ICCPMR 0x04 // Interrupt Priority Mask Register\r
58#define ARM_GIC_ICCBPR 0x08 // Binary Point Register\r
59#define ARM_GIC_ICCIAR 0x0C // Interrupt Acknowledge Register\r
60#define ARM_GIC_ICCEIOR 0x10 // End Of Interrupt Register\r
61#define ARM_GIC_ICCRPR 0x14 // Running Priority Register\r
62#define ARM_GIC_ICCPIR 0x18 // Highest Pending Interrupt Register\r
63#define ARM_GIC_ICCABPR 0x1C // Aliased Binary Point Register\r
e700a1fc 64#define ARM_GIC_ICCIIDR 0xFC // Identification Register\r
55a0d64b 65\r
66#define ARM_GIC_ICDSGIR_FILTER_TARGETLIST 0x0\r
67#define ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE 0x1\r
68#define ARM_GIC_ICDSGIR_FILTER_ITSELF 0x2\r
69\r
70// Bit-masks to configure the CPU Interface Control register\r
71#define ARM_GIC_ICCICR_ENABLE_SECURE 0x01\r
72#define ARM_GIC_ICCICR_ENABLE_NS 0x02\r
73#define ARM_GIC_ICCICR_ACK_CTL 0x04\r
74#define ARM_GIC_ICCICR_SIGNAL_SECURE_TO_FIQ 0x08\r
75#define ARM_GIC_ICCICR_USE_SBPR 0x10\r
76\r
1cb13673 77// Bit Mask for GICC_IIDR\r
e700a1fc
OM
78#define ARM_GIC_ICCIIDR_GET_PRODUCT_ID(IccIidr) (((IccIidr) >> 20) & 0xFFF)\r
79#define ARM_GIC_ICCIIDR_GET_ARCH_VERSION(IccIidr) (((IccIidr) >> 16) & 0xF)\r
80#define ARM_GIC_ICCIIDR_GET_REVISION(IccIidr) (((IccIidr) >> 12) & 0xF)\r
81#define ARM_GIC_ICCIIDR_GET_IMPLEMENTER(IccIidr) ((IccIidr) & 0xFFF)\r
55a0d64b 82\r
d5c6b7fc
OM
83ARM_GIC_ARCH_REVISION\r
84EFIAPI\r
85ArmGicGetSupportedArchRevision (\r
86 VOID\r
87 );\r
88\r
e700a1fc
OM
89UINTN\r
90EFIAPI\r
91ArmGicGetInterfaceIdentification (\r
92 IN INTN GicInterruptInterfaceBase\r
93 );\r
94\r
55a0d64b 95//\r
92534106 96// GIC Secure interfaces\r
55a0d64b 97//\r
98VOID\r
99EFIAPI\r
100ArmGicSetupNonSecure (\r
5e773144 101 IN UINTN MpId,\r
55a0d64b 102 IN INTN GicDistributorBase,\r
103 IN INTN GicInterruptInterfaceBase\r
104 );\r
105\r
92534106 106VOID\r
107EFIAPI\r
108ArmGicSetSecureInterrupts (\r
109 IN UINTN GicDistributorBase,\r
110 IN UINTN* GicSecureInterruptMask,\r
111 IN UINTN GicSecureInterruptMaskSize\r
112 );\r
113\r
55a0d64b 114VOID\r
115EFIAPI\r
116ArmGicEnableInterruptInterface (\r
117 IN INTN GicInterruptInterfaceBase\r
118 );\r
119\r
9736c297 120VOID\r
121EFIAPI\r
122ArmGicDisableInterruptInterface (\r
123 IN INTN GicInterruptInterfaceBase\r
124 );\r
125\r
55a0d64b 126VOID\r
127EFIAPI\r
128ArmGicEnableDistributor (\r
129 IN INTN GicDistributorBase\r
130 );\r
131\r
e700a1fc
OM
132VOID\r
133EFIAPI\r
134ArmGicDisableDistributor (\r
135 IN INTN GicDistributorBase\r
136 );\r
137\r
e9f7c58f 138UINTN\r
139EFIAPI\r
140ArmGicGetMaxNumInterrupts (\r
141 IN INTN GicDistributorBase\r
142 );\r
143\r
55a0d64b 144VOID\r
145EFIAPI\r
146ArmGicSendSgiTo (\r
147 IN INTN GicDistributorBase,\r
148 IN INTN TargetListFilter,\r
4c19ece3 149 IN INTN CPUTargetList,\r
150 IN INTN SgiId\r
55a0d64b 151 );\r
152\r
1b0ac0de
OM
153/*\r
154 * Acknowledge and return the value of the Interrupt Acknowledge Register\r
155 *\r
156 * InterruptId is returned separately from the register value because in\r
157 * the GICv2 the register value contains the CpuId and InterruptId while\r
158 * in the GICv3 the register value is only the InterruptId.\r
159 *\r
160 * @param GicInterruptInterfaceBase Base Address of the GIC CPU Interface\r
161 * @param InterruptId InterruptId read from the Interrupt Acknowledge Register\r
162 *\r
163 * @retval value returned by the Interrupt Acknowledge Register\r
164 *\r
165 */\r
2ca815a4 166UINTN\r
55a0d64b 167EFIAPI\r
315649cd 168ArmGicAcknowledgeInterrupt (\r
1b0ac0de
OM
169 IN UINTN GicInterruptInterfaceBase,\r
170 OUT UINTN *InterruptId\r
55a0d64b 171 );\r
172\r
d80401a1
OM
173VOID\r
174EFIAPI\r
175ArmGicEndOfInterrupt (\r
176 IN UINTN GicInterruptInterfaceBase,\r
177 IN UINTN Source\r
178 );\r
179\r
55a0d64b 180UINTN\r
181EFIAPI\r
182ArmGicSetPriorityMask (\r
183 IN INTN GicInterruptInterfaceBase,\r
184 IN INTN PriorityMask\r
185 );\r
186\r
e700a1fc
OM
187VOID\r
188EFIAPI\r
189ArmGicEnableInterrupt (\r
190 IN UINTN GicDistributorBase,\r
191 IN UINTN Source\r
192 );\r
193\r
194VOID\r
195EFIAPI\r
196ArmGicDisableInterrupt (\r
197 IN UINTN GicDistributorBase,\r
198 IN UINTN Source\r
199 );\r
200\r
201BOOLEAN\r
202EFIAPI\r
203ArmGicIsInterruptEnabled (\r
204 IN UINTN GicDistributorBase,\r
205 IN UINTN Source\r
206 );\r
207\r
55a0d64b 208#endif\r