18UINTN mGicNumInterrupts = 0;
34GicGetDistributorIcfgBaseAndBit (
35 IN HARDWARE_INTERRUPT_SOURCE Source,
43 if (Source >= mGicNumInterrupts) {
44 ASSERT (Source < mGicNumInterrupts);
45 return EFI_UNSUPPORTED;
48 RegIndex = Source / ARM_GIC_ICDICFR_F_STRIDE;
49 Field = Source % ARM_GIC_ICDICFR_F_STRIDE;
52 + (ARM_GIC_ICDICFR_BYTES * RegIndex);
53 *Config1Bit = ((Field * ARM_GIC_ICDICFR_F_WIDTH)
54 + ARM_GIC_ICDICFR_F_CONFIG1_BIT);
72RegisterInterruptSource (
74 IN HARDWARE_INTERRUPT_SOURCE Source,
78 if (Source >= mGicNumInterrupts) {
80 return EFI_UNSUPPORTED;
83 if ((Handler ==
NULL) && (gRegisteredInterruptHandlers[Source] ==
NULL)) {
84 return EFI_INVALID_PARAMETER;
87 if ((Handler !=
NULL) && (gRegisteredInterruptHandlers[Source] !=
NULL)) {
88 return EFI_ALREADY_STARTED;
91 gRegisteredInterruptHandlers[Source] = Handler;
94 if (
NULL == Handler) {
95 return This->DisableInterruptSource (This, Source);
97 return This->EnableInterruptSource (This, Source);
101STATIC VOID *mCpuArchProtocolNotifyEventRegistration;
106CpuArchEventProtocolNotify (
115 Status =
gBS->LocateProtocol (&gEfiCpuArchProtocolGuid,
NULL, (VOID **)&Cpu);
116 if (EFI_ERROR (Status)) {
121 Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ,
NULL);
122 if (EFI_ERROR (Status)) {
125 "%a: Cpu->RegisterInterruptHandler() - %r\n",
133 Status = Cpu->RegisterInterruptHandler (
135 ARM_ARCH_EXCEPTION_IRQ,
138 if (EFI_ERROR (Status)) {
141 "%a: Cpu->RegisterInterruptHandler() - %r\n",
147 gBS->CloseEvent (Event);
151InstallAndRegisterInterruptService (
164 if (gRegisteredInterruptHandlers ==
NULL) {
165 return EFI_OUT_OF_RESOURCES;
168 Status =
gBS->InstallMultipleProtocolInterfaces (
169 &gHardwareInterruptHandle,
170 &gHardwareInterruptProtocolGuid,
172 &gHardwareInterrupt2ProtocolGuid,
176 if (EFI_ERROR (Status)) {
184 &gEfiCpuArchProtocolGuid,
186 CpuArchEventProtocolNotify,
188 &mCpuArchProtocolNotifyEventRegistration
192 Status =
gBS->CreateEvent (
193 EVT_SIGNAL_EXIT_BOOT_SERVICES,
197 &EfiExitBootServicesEvent
VOID(EFIAPI * EFI_CPU_INTERRUPT_HANDLER)(IN CONST EFI_EXCEPTION_TYPE InterruptType, IN CONST EFI_SYSTEM_CONTEXT SystemContext)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID(EFIAPI * HARDWARE_INTERRUPT_HANDLER)(IN HARDWARE_INTERRUPT_SOURCE Source, IN EFI_SYSTEM_CONTEXT SystemContext)
#define DEBUG(Expression)
#define PcdGet64(TokenName)
VOID EFIAPI ExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
VOID(EFIAPI * EFI_EVENT_NOTIFY)(IN EFI_EVENT Event, IN VOID *Context)