\r
Copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR>\r
Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>\r
-Portions copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR> \r
+Portions copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>\r
\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
Module Name:\r
\r
- Gic.c\r
+ ArmGicDxe.c\r
\r
Abstract:\r
\r
IN HARDWARE_INTERRUPT_SOURCE Source\r
)\r
{\r
- UINT32 RegOffset;\r
- UINTN RegShift;\r
- \r
if (Source > mGicNumInterrupts) {\r
ASSERT(FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
- \r
- // Calculate enable register offset and bit position\r
- RegOffset = Source / 32;\r
- RegShift = Source % 32;\r
\r
- // Write set-enable register\r
- MmioWrite32 (PcdGet32(PcdGicDistributorBase) + ARM_GIC_ICDISER + (4*RegOffset), 1 << RegShift);\r
- \r
+ ArmGicEnableInterrupt (FixedPcdGet32 (PcdGicDistributorBase), Source);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
IN HARDWARE_INTERRUPT_SOURCE Source\r
)\r
{\r
- UINT32 RegOffset;\r
- UINTN RegShift;\r
- \r
if (Source > mGicNumInterrupts) {\r
ASSERT(FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
- \r
- // Calculate enable register offset and bit position\r
- RegOffset = Source / 32;\r
- RegShift = Source % 32;\r
\r
- // Write set-enable register\r
- MmioWrite32 (PcdGet32(PcdGicDistributorBase) + ARM_GIC_ICDICER + (4*RegOffset), 1 << RegShift);\r
- \r
+ ArmGicDisableInterrupt (PcdGet32(PcdGicDistributorBase), Source);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
IN BOOLEAN *InterruptState\r
)\r
{\r
- UINT32 RegOffset;\r
- UINTN RegShift;\r
- \r
if (Source > mGicNumInterrupts) {\r
ASSERT(FALSE);\r
return EFI_UNSUPPORTED;\r
}\r
- \r
- // calculate enable register offset and bit position\r
- RegOffset = Source / 32;\r
- RegShift = Source % 32;\r
- \r
- if ((MmioRead32 (PcdGet32(PcdGicDistributorBase) + ARM_GIC_ICDISER + (4*RegOffset)) & (1<<RegShift)) == 0) {\r
- *InterruptState = FALSE;\r
- } else {\r
- *InterruptState = TRUE;\r
- }\r
- \r
+\r
+ *InterruptState = ArmGicIsInterruptEnabled (PcdGet32(PcdGicDistributorBase), Source);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
}\r
\r
// Disable Gic Interface\r
- MmioWrite32 (PcdGet32(PcdGicInterruptInterfaceBase) + ARM_GIC_ICCICR, 0x0);\r
- MmioWrite32 (PcdGet32(PcdGicInterruptInterfaceBase) + ARM_GIC_ICCPMR, 0x0);\r
+ ArmGicDisableInterruptInterface (PcdGet32(PcdGicInterruptInterfaceBase));\r
\r
// Disable Gic Distributor\r
- MmioWrite32 (PcdGet32(PcdGicDistributorBase) + ARM_GIC_ICDDCR, 0x0);\r
+ ArmGicDisableDistributor (PcdGet32(PcdGicDistributorBase));\r
}\r
\r
/**\r
\r
// Set priority mask reg to 0xff to allow all priorities through\r
MmioWrite32 (PcdGet32(PcdGicInterruptInterfaceBase) + ARM_GIC_ICCPMR, 0xff);\r
- \r
+\r
// Enable gic cpu interface\r
- MmioWrite32 (PcdGet32(PcdGicInterruptInterfaceBase) + ARM_GIC_ICCICR, 0x1);\r
+ ArmGicEnableInterruptInterface (PcdGet32(PcdGicInterruptInterfaceBase));\r
\r
// Enable gic distributor\r
- MmioWrite32 (PcdGet32(PcdGicDistributorBase) + ARM_GIC_ICDDCR, 0x1);\r
- \r
+ ArmGicEnableDistributor (PcdGet32(PcdGicDistributorBase));\r
+\r
// Initialize the array for the Interrupt Handlers\r
gRegisteredInterruptHandlers = (HARDWARE_INTERRUPT_HANDLER*)AllocateZeroPool (sizeof(HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);\r
- \r
+\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
&gHardwareInterruptHandle,\r
&gHardwareInterruptProtocolGuid, &gHardwareInterruptProtocol,\r
NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r
- \r
+\r
//\r
// Get the CPU protocol that this driver requires.\r
//\r
/** @file\r
*\r
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+* Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
#define ARM_GIC_ICCRPR 0x14 // Running Priority Register\r
#define ARM_GIC_ICCPIR 0x18 // Highest Pending Interrupt Register\r
#define ARM_GIC_ICCABPR 0x1C // Aliased Binary Point Register\r
-#define ARM_GIC_ICCIDR 0xFC // Identification Register\r
+#define ARM_GIC_ICCIIDR 0xFC // Identification Register\r
\r
#define ARM_GIC_ICDSGIR_FILTER_TARGETLIST 0x0\r
#define ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE 0x1\r
#define ARM_GIC_ICCICR_USE_SBPR 0x10\r
\r
// Bit Mask for GICC_IIDR\r
-#define ARM_GIC_ICCIDR_GET_PRODUCT_ID(IccIdr) (((IccIdr) >> 20) & 0xFFF)\r
-#define ARM_GIC_ICCIDR_GET_ARCH_VERSION(IccIdr) (((IccIdr) >> 16) & 0xF)\r
-#define ARM_GIC_ICCIDR_GET_REVISION(IccIdr) (((IccIdr) >> 12) & 0xF)\r
-#define ARM_GIC_ICCIDR_GET_IMPLEMENTER(IccIdr) ((IccIdr) & 0xFFF)\r
+#define ARM_GIC_ICCIIDR_GET_PRODUCT_ID(IccIidr) (((IccIidr) >> 20) & 0xFFF)\r
+#define ARM_GIC_ICCIIDR_GET_ARCH_VERSION(IccIidr) (((IccIidr) >> 16) & 0xF)\r
+#define ARM_GIC_ICCIIDR_GET_REVISION(IccIidr) (((IccIidr) >> 12) & 0xF)\r
+#define ARM_GIC_ICCIIDR_GET_IMPLEMENTER(IccIidr) ((IccIidr) & 0xFFF)\r
\r
// Bit Mask for\r
#define ARM_GIC_ICCIAR_ACKINTID 0x3FF\r
\r
+UINTN\r
+EFIAPI\r
+ArmGicGetInterfaceIdentification (\r
+ IN INTN GicInterruptInterfaceBase\r
+ );\r
+\r
//\r
// GIC Secure interfaces\r
//\r
IN INTN GicDistributorBase\r
);\r
\r
+VOID\r
+EFIAPI\r
+ArmGicDisableDistributor (\r
+ IN INTN GicDistributorBase\r
+ );\r
+\r
UINTN\r
EFIAPI\r
ArmGicGetMaxNumInterrupts (\r
IN INTN PriorityMask\r
);\r
\r
+VOID\r
+EFIAPI\r
+ArmGicEnableInterrupt (\r
+ IN UINTN GicDistributorBase,\r
+ IN UINTN Source\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+ArmGicDisableInterrupt (\r
+ IN UINTN GicDistributorBase,\r
+ IN UINTN Source\r
+ );\r
+\r
+BOOLEAN\r
+EFIAPI\r
+ArmGicIsInterruptEnabled (\r
+ IN UINTN GicDistributorBase,\r
+ IN UINTN Source\r
+ );\r
+\r
#endif\r