]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c
ArmPkg: Tidy GIC code before changes.
[mirror_edk2.git] / ArmPkg / Drivers / ArmGic / ArmGicCommonDxe.c
index be77b8361c5af033fd2889cdb48902af867f321d..7ca3ca8f52afe52c827ca82b749b665184813fc1 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>\r
+Copyright (c) 2013-2017, 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
@@ -28,14 +28,10 @@ ExitBootServicesEvent (
   IN VOID       *Context\r
   );\r
 \r
-//\r
 // Making this global saves a few bytes in image size\r
-//\r
 EFI_HANDLE  gHardwareInterruptHandle = NULL;\r
 \r
-//\r
 // Notifications\r
-//\r
 EFI_EVENT EfiExitBootServicesEvent      = (EFI_EVENT)NULL;\r
 \r
 // Maximum Number of Interrupts\r
@@ -94,48 +90,55 @@ InstallAndRegisterInterruptService (
 {\r
   EFI_STATUS               Status;\r
   EFI_CPU_ARCH_PROTOCOL   *Cpu;\r
+  CONST UINTN              RihArraySize =\r
+    (sizeof(HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);\r
 \r
   // Initialize the array for the Interrupt Handlers\r
-  gRegisteredInterruptHandlers = (HARDWARE_INTERRUPT_HANDLER*)AllocateZeroPool (sizeof(HARDWARE_INTERRUPT_HANDLER) * mGicNumInterrupts);\r
+  gRegisteredInterruptHandlers = AllocateZeroPool (RihArraySize);\r
   if (gRegisteredInterruptHandlers == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &gHardwareInterruptHandle,\r
-                  &gHardwareInterruptProtocolGuid, InterruptProtocol,\r
+                  &gHardwareInterruptProtocolGuid,\r
+                  InterruptProtocol,\r
                   NULL\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  //\r
   // Get the CPU protocol that this driver requires.\r
-  //\r
   Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  //\r
   // Unregister the default exception handler.\r
-  //\r
   Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ, NULL);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  //\r
   // Register to receive interrupts\r
-  //\r
-  Status = Cpu->RegisterInterruptHandler (Cpu, ARM_ARCH_EXCEPTION_IRQ, InterruptHandler);\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
   // Register for an ExitBootServicesEvent\r
-  Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent);\r
+  Status = gBS->CreateEvent (\r
+                  EVT_SIGNAL_EXIT_BOOT_SERVICES,\r
+                  TPL_NOTIFY,\r
+                  ExitBootServicesEvent,\r
+                  NULL,\r
+                  &EfiExitBootServicesEvent\r
+                  );\r
 \r
   return Status;\r
 }\r