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