]>
Commit | Line | Data |
---|---|---|
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 | 21 | typedef 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 |
83 | ARM_GIC_ARCH_REVISION\r |
84 | EFIAPI\r | |
85 | ArmGicGetSupportedArchRevision (\r | |
86 | VOID\r | |
87 | );\r | |
88 | \r | |
e700a1fc OM |
89 | UINTN\r |
90 | EFIAPI\r | |
91 | ArmGicGetInterfaceIdentification (\r | |
92 | IN INTN GicInterruptInterfaceBase\r | |
93 | );\r | |
94 | \r | |
55a0d64b | 95 | //\r |
92534106 | 96 | // GIC Secure interfaces\r |
55a0d64b | 97 | //\r |
98 | VOID\r | |
99 | EFIAPI\r | |
100 | ArmGicSetupNonSecure (\r | |
5e773144 | 101 | IN UINTN MpId,\r |
55a0d64b | 102 | IN INTN GicDistributorBase,\r |
103 | IN INTN GicInterruptInterfaceBase\r | |
104 | );\r | |
105 | \r | |
92534106 | 106 | VOID\r |
107 | EFIAPI\r | |
108 | ArmGicSetSecureInterrupts (\r | |
109 | IN UINTN GicDistributorBase,\r | |
110 | IN UINTN* GicSecureInterruptMask,\r | |
111 | IN UINTN GicSecureInterruptMaskSize\r | |
112 | );\r | |
113 | \r | |
55a0d64b | 114 | VOID\r |
115 | EFIAPI\r | |
116 | ArmGicEnableInterruptInterface (\r | |
117 | IN INTN GicInterruptInterfaceBase\r | |
118 | );\r | |
119 | \r | |
9736c297 | 120 | VOID\r |
121 | EFIAPI\r | |
122 | ArmGicDisableInterruptInterface (\r | |
123 | IN INTN GicInterruptInterfaceBase\r | |
124 | );\r | |
125 | \r | |
55a0d64b | 126 | VOID\r |
127 | EFIAPI\r | |
128 | ArmGicEnableDistributor (\r | |
129 | IN INTN GicDistributorBase\r | |
130 | );\r | |
131 | \r | |
e700a1fc OM |
132 | VOID\r |
133 | EFIAPI\r | |
134 | ArmGicDisableDistributor (\r | |
135 | IN INTN GicDistributorBase\r | |
136 | );\r | |
137 | \r | |
e9f7c58f | 138 | UINTN\r |
139 | EFIAPI\r | |
140 | ArmGicGetMaxNumInterrupts (\r | |
141 | IN INTN GicDistributorBase\r | |
142 | );\r | |
143 | \r | |
55a0d64b | 144 | VOID\r |
145 | EFIAPI\r | |
146 | ArmGicSendSgiTo (\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 | 166 | UINTN\r |
55a0d64b | 167 | EFIAPI\r |
315649cd | 168 | ArmGicAcknowledgeInterrupt (\r |
1b0ac0de OM |
169 | IN UINTN GicInterruptInterfaceBase,\r |
170 | OUT UINTN *InterruptId\r | |
55a0d64b | 171 | );\r |
172 | \r | |
d80401a1 OM |
173 | VOID\r |
174 | EFIAPI\r | |
175 | ArmGicEndOfInterrupt (\r | |
176 | IN UINTN GicInterruptInterfaceBase,\r | |
177 | IN UINTN Source\r | |
178 | );\r | |
179 | \r | |
55a0d64b | 180 | UINTN\r |
181 | EFIAPI\r | |
182 | ArmGicSetPriorityMask (\r | |
183 | IN INTN GicInterruptInterfaceBase,\r | |
184 | IN INTN PriorityMask\r | |
185 | );\r | |
186 | \r | |
e700a1fc OM |
187 | VOID\r |
188 | EFIAPI\r | |
189 | ArmGicEnableInterrupt (\r | |
190 | IN UINTN GicDistributorBase,\r | |
191 | IN UINTN Source\r | |
192 | );\r | |
193 | \r | |
194 | VOID\r | |
195 | EFIAPI\r | |
196 | ArmGicDisableInterrupt (\r | |
197 | IN UINTN GicDistributorBase,\r | |
198 | IN UINTN Source\r | |
199 | );\r | |
200 | \r | |
201 | BOOLEAN\r | |
202 | EFIAPI\r | |
203 | ArmGicIsInterruptEnabled (\r | |
204 | IN UINTN GicDistributorBase,\r | |
205 | IN UINTN Source\r | |
206 | );\r | |
207 | \r | |
55a0d64b | 208 | #endif\r |