diff options
Diffstat (limited to 'ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c')
-rw-r--r-- | ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c | 83 |
1 files changed, 46 insertions, 37 deletions
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c b/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c index 5fb33c5..cd12fcd 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c @@ -11,8 +11,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent VOID
EFIAPI
IrqInterruptHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
);
VOID
@@ -26,14 +26,13 @@ ExitBootServicesEvent ( EFI_HANDLE gHardwareInterruptHandle = NULL;
// Notifications
-EFI_EVENT EfiExitBootServicesEvent = (EFI_EVENT)NULL;
+EFI_EVENT EfiExitBootServicesEvent = (EFI_EVENT)NULL;
// Maximum Number of Interrupts
-UINTN mGicNumInterrupts = 0;
+UINTN mGicNumInterrupts = 0;
HARDWARE_INTERRUPT_HANDLER *gRegisteredInterruptHandlers = NULL;
-
/**
Calculate GICD_ICFGRn base address and corresponding bit
field Int_config[1] of the GIC distributor register.
@@ -47,21 +46,21 @@ HARDWARE_INTERRUPT_HANDLER *gRegisteredInterruptHandlers = NULL; **/
EFI_STATUS
GicGetDistributorIcfgBaseAndBit (
- IN HARDWARE_INTERRUPT_SOURCE Source,
- OUT UINTN *RegAddress,
- OUT UINTN *Config1Bit
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ OUT UINTN *RegAddress,
+ OUT UINTN *Config1Bit
)
{
- UINTN RegIndex;
- UINTN Field;
+ UINTN RegIndex;
+ UINTN Field;
if (Source >= mGicNumInterrupts) {
- ASSERT(Source < mGicNumInterrupts);
+ ASSERT (Source < mGicNumInterrupts);
return EFI_UNSUPPORTED;
}
- RegIndex = Source / ARM_GIC_ICDICFR_F_STRIDE; // NOTE: truncation is significant
- Field = Source % ARM_GIC_ICDICFR_F_STRIDE;
+ RegIndex = Source / ARM_GIC_ICDICFR_F_STRIDE; // NOTE: truncation is significant
+ Field = Source % ARM_GIC_ICDICFR_F_STRIDE;
*RegAddress = PcdGet64 (PcdGicDistributorBase)
+ ARM_GIC_ICDICFR
+ (ARM_GIC_ICDICFR_BYTES * RegIndex);
@@ -71,8 +70,6 @@ GicGetDistributorIcfgBaseAndBit ( return EFI_SUCCESS;
}
-
-
/**
Register Handler for the specified interrupt source.
@@ -87,13 +84,13 @@ GicGetDistributorIcfgBaseAndBit ( EFI_STATUS
EFIAPI
RegisterInterruptSource (
- IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
- IN HARDWARE_INTERRUPT_SOURCE Source,
- IN HARDWARE_INTERRUPT_HANDLER Handler
+ IN EFI_HARDWARE_INTERRUPT_PROTOCOL *This,
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN HARDWARE_INTERRUPT_HANDLER Handler
)
{
if (Source >= mGicNumInterrupts) {
- ASSERT(FALSE);
+ ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
@@ -108,25 +105,25 @@ RegisterInterruptSource ( gRegisteredInterruptHandlers[Source] = Handler;
// If the interrupt handler is unregistered then disable the interrupt
- if (NULL == Handler){
+ if (NULL == Handler) {
return This->DisableInterruptSource (This, Source);
} else {
return This->EnableInterruptSource (This, Source);
}
}
-STATIC VOID *mCpuArchProtocolNotifyEventRegistration;
+STATIC VOID *mCpuArchProtocolNotifyEventRegistration;
STATIC
VOID
EFIAPI
CpuArchEventProtocolNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_CPU_ARCH_PROTOCOL *Cpu;
- EFI_STATUS Status;
+ EFI_CPU_ARCH_PROTOCOL *Cpu;
+ EFI_STATUS Status;
// Get the CPU protocol that this driver requires.
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);
@@ -137,17 +134,28 @@ CpuArchEventProtocolNotify ( // Unregister the default exception handler.
Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ, NULL);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",
- __FUNCTION__, Status));
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Cpu->RegisterInterruptHandler() - %r\n",
+ __FUNCTION__,
+ Status
+ ));
return;
}
// Register to receive interrupts
- Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ,
- Context);
+ Status = Cpu->RegisterInterruptHandler (
+ Cpu,
+ ARM_ARCH_EXCEPTION_IRQ,
+ Context
+ );
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",
- __FUNCTION__, Status));
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Cpu->RegisterInterruptHandler() - %r\n",
+ __FUNCTION__,
+ Status
+ ));
}
gBS->CloseEvent (Event);
@@ -157,13 +165,13 @@ EFI_STATUS InstallAndRegisterInterruptService (
IN EFI_HARDWARE_INTERRUPT_PROTOCOL *InterruptProtocol,
IN EFI_HARDWARE_INTERRUPT2_PROTOCOL *Interrupt2Protocol,
- IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler,
- IN EFI_EVENT_NOTIFY ExitBootServicesEvent
+ IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler,
+ IN EFI_EVENT_NOTIFY ExitBootServicesEvent
)
{
- EFI_STATUS Status;
- CONST UINTN RihArraySize =
- (sizeof(HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);
+ EFI_STATUS Status;
+ CONST UINTN RihArraySize =
+ (sizeof (HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);
// Initialize the array for the Interrupt Handlers
gRegisteredInterruptHandlers = AllocateZeroPool (RihArraySize);
@@ -191,7 +199,8 @@ InstallAndRegisterInterruptService ( TPL_CALLBACK,
CpuArchEventProtocolNotify,
InterruptHandler,
- &mCpuArchProtocolNotifyEventRegistration);
+ &mCpuArchProtocolNotifyEventRegistration
+ );
// Register for an ExitBootServicesEvent
Status = gBS->CreateEvent (
|