]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
ArmPkg/GenericWatchdogDxe: Set Watchdog interrupt type
[mirror_edk2.git] / ArmPkg / Drivers / GenericWatchdogDxe / GenericWatchdogDxe.c
index c5372056f3ea080c350ff67ce8f78f0a77663343..252ba5bf321e379ef440830cab468af7c55905b3 100644 (file)
@@ -24,8 +24,8 @@
 #include <Library/UefiLib.h>\r
 #include <Library/ArmGenericTimerCounterLib.h>\r
 \r
+#include <Protocol/HardwareInterrupt2.h>\r
 #include <Protocol/WatchdogTimer.h>\r
-#include <Protocol/HardwareInterrupt.h>\r
 \r
 #include "GenericWatchdog.h"\r
 \r
@@ -41,7 +41,7 @@ UINTN mTimerFrequencyHz = 0;
    It is therefore stored here. 0 means the timer is not running. */\r
 UINT64 mNumTimerTicks = 0;\r
 \r
-EFI_HARDWARE_INTERRUPT_PROTOCOL *mInterruptProtocol;\r
+EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol;\r
 \r
 EFI_STATUS\r
 WatchdogWriteOffsetRegister (\r
@@ -311,7 +311,7 @@ GenericWatchdogEntry (
   if (!EFI_ERROR (Status)) {\r
     // Install interrupt handler\r
     Status = gBS->LocateProtocol (\r
-                    &gHardwareInterruptProtocolGuid,\r
+                    &gHardwareInterrupt2ProtocolGuid,\r
                     NULL,\r
                     (VOID **)&mInterruptProtocol\r
                     );\r
@@ -322,14 +322,21 @@ GenericWatchdogEntry (
                  WatchdogInterruptHandler\r
                  );\r
       if (!EFI_ERROR (Status)) {\r
-        // Install the Timer Architectural Protocol onto a new handle\r
-        Handle = NULL;\r
-        Status = gBS->InstallMultipleProtocolInterfaces (\r
-                        &Handle,\r
-                        &gEfiWatchdogTimerArchProtocolGuid,\r
-                        &gWatchdogTimer,\r
-                        NULL\r
-                        );\r
+        Status = mInterruptProtocol->SetTriggerType (\r
+                   mInterruptProtocol,\r
+                   FixedPcdGet32 (PcdGenericWatchdogEl2IntrNum),\r
+                   EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING\r
+                   );\r
+        if (!EFI_ERROR (Status)) {\r
+          // Install the Timer Architectural Protocol onto a new handle\r
+          Handle = NULL;\r
+          Status = gBS->InstallMultipleProtocolInterfaces (\r
+                          &Handle,\r
+                          &gEfiWatchdogTimerArchProtocolGuid,\r
+                          &gWatchdogTimer,\r
+                          NULL\r
+                          );\r
+        }\r
       }\r
     }\r
   }\r