# Include/Guid/ArmMpCoreInfo.h\r
gArmMpCoreInfoGuid = { 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} }\r
\r
+ gArmGicDxeFileGuid = { 0xde371f7c, 0xdec4, 0x4d21, { 0xad, 0xf1, 0x59, 0x3a, 0xbc, 0xc1, 0x58, 0x82 } }\r
+\r
[Ppis]\r
## Include/Ppi/ArmMpCoreInfo.h\r
gArmMpCoreInfoPpiGuid = { 0x6847cc74, 0xe9ec, 0x4f8f, {0xa2, 0x9d, 0xab, 0x44, 0xe7, 0x54, 0xa8, 0xfc} }\r
}\r
}\r
\r
+STATIC VOID *mCpuArchProtocolNotifyEventRegistration;\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+CpuArchEventProtocolNotify (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ EFI_CPU_ARCH_PROTOCOL *Cpu;\r
+ EFI_STATUS Status;\r
+\r
+ // Get the CPU protocol that this driver requires.\r
+ Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);\r
+ if (EFI_ERROR (Status)) {\r
+ return;\r
+ }\r
+\r
+ // Unregister the default exception handler.\r
+ Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ, NULL);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",\r
+ __FUNCTION__, Status));\r
+ return;\r
+ }\r
+\r
+ // Register to receive interrupts\r
+ Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ,\r
+ Context);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR, "%a: Cpu->RegisterInterruptHandler() - %r\n",\r
+ __FUNCTION__, Status));\r
+ }\r
+\r
+ gBS->CloseEvent (Event);\r
+}\r
+\r
EFI_STATUS\r
InstallAndRegisterInterruptService (\r
IN EFI_HARDWARE_INTERRUPT_PROTOCOL *InterruptProtocol,\r
)\r
{\r
EFI_STATUS Status;\r
- EFI_CPU_ARCH_PROTOCOL *Cpu;\r
CONST UINTN RihArraySize =\r
(sizeof(HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);\r
\r
return Status;\r
}\r
\r
- // Get the CPU protocol that this driver requires.\r
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- // Unregister the default exception handler.\r
- Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ, NULL);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- // Register to receive interrupts\r
- Status = Cpu->RegisterInterruptHandler (\r
- Cpu,\r
- ARM_ARCH_EXCEPTION_IRQ,\r
- InterruptHandler\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
+ //\r
+ // Install the interrupt handler as soon as the CPU arch protocol appears.\r
+ //\r
+ EfiCreateProtocolNotifyEvent (\r
+ &gEfiCpuArchProtocolGuid,\r
+ TPL_CALLBACK,\r
+ CpuArchEventProtocolNotify,\r
+ InterruptHandler,\r
+ &mCpuArchProtocolNotifyEventRegistration);\r
\r
// Register for an ExitBootServicesEvent\r
Status = gBS->CreateEvent (\r