public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: evan.lloyd@arm.com
To: edk2-devel@lists.01.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Matteo Carlini <Matteo.Carlini@arm.com>,
	nd@arm.com
Subject: [PATCH 4/4] ArmPkg/GenericWatchdogDxe: Set Watchdog interrupt type
Date: Thu, 21 Sep 2017 17:23:44 +0100	[thread overview]
Message-ID: <20170921162345.11724-5-evan.lloyd@arm.com> (raw)
In-Reply-To: <20170921162345.11724-1-evan.lloyd@arm.com>

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Utilise the new HardwareInterrupt2 protocol to adjust the
Edge/Level characteristics of the Watchdog interrupt.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Tested-by: Girish Pathak <girish.pathak@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf |  6 ++--
 ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c   | 29 ++++++++++++--------
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
index fece14cc18315cd15510680c438288687b60c018..ba0403d7fdc3589803c643c27a44918e73afa97e 100644
--- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
+++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2013-2014, ARM Limited. All rights reserved.
+#  Copyright (c) 2013-2017, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -47,7 +47,7 @@ [Pcd.common]
 
 [Protocols]
   gEfiWatchdogTimerArchProtocolGuid
-  gHardwareInterruptProtocolGuid
+  gHardwareInterrupt2ProtocolGuid
 
 [Depex]
-  gHardwareInterruptProtocolGuid
+  gHardwareInterrupt2ProtocolGuid
diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
index c5372056f3ea080c350ff67ce8f78f0a77663343..252ba5bf321e379ef440830cab468af7c55905b3 100644
--- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
+++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c
@@ -24,8 +24,8 @@
 #include <Library/UefiLib.h>
 #include <Library/ArmGenericTimerCounterLib.h>
 
+#include <Protocol/HardwareInterrupt2.h>
 #include <Protocol/WatchdogTimer.h>
-#include <Protocol/HardwareInterrupt.h>
 
 #include "GenericWatchdog.h"
 
@@ -41,7 +41,7 @@ UINTN mTimerFrequencyHz = 0;
    It is therefore stored here. 0 means the timer is not running. */
 UINT64 mNumTimerTicks = 0;
 
-EFI_HARDWARE_INTERRUPT_PROTOCOL *mInterruptProtocol;
+EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol;
 
 EFI_STATUS
 WatchdogWriteOffsetRegister (
@@ -311,7 +311,7 @@ GenericWatchdogEntry (
   if (!EFI_ERROR (Status)) {
     // Install interrupt handler
     Status = gBS->LocateProtocol (
-                    &gHardwareInterruptProtocolGuid,
+                    &gHardwareInterrupt2ProtocolGuid,
                     NULL,
                     (VOID **)&mInterruptProtocol
                     );
@@ -322,14 +322,21 @@ GenericWatchdogEntry (
                  WatchdogInterruptHandler
                  );
       if (!EFI_ERROR (Status)) {
-        // Install the Timer Architectural Protocol onto a new handle
-        Handle = NULL;
-        Status = gBS->InstallMultipleProtocolInterfaces (
-                        &Handle,
-                        &gEfiWatchdogTimerArchProtocolGuid,
-                        &gWatchdogTimer,
-                        NULL
-                        );
+        Status = mInterruptProtocol->SetTriggerType (
+                   mInterruptProtocol,
+                   FixedPcdGet32 (PcdGenericWatchdogEl2IntrNum),
+                   EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING
+                   );
+        if (!EFI_ERROR (Status)) {
+          // Install the Timer Architectural Protocol onto a new handle
+          Handle = NULL;
+          Status = gBS->InstallMultipleProtocolInterfaces (
+                          &Handle,
+                          &gEfiWatchdogTimerArchProtocolGuid,
+                          &gWatchdogTimer,
+                          NULL
+                          );
+        }
       }
     }
   }
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")



  parent reply	other threads:[~2017-09-21 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21 16:23 [PATCH 0/4] [PATCH 0/5] Add HardwareInterrupt2 for ARM evan.lloyd
2017-09-21 16:23 ` [PATCH 1/4] ArmPkg: Tidy GIC code before changes evan.lloyd
2017-09-21 16:23 ` [PATCH 2/4] EmbeddedPkg: Introduce HardwareInterrupt2 protocol evan.lloyd
2017-09-21 16:23 ` [PATCH 3/4] ArmPkg/ArmGicDxe: Expose " evan.lloyd
2017-10-05 20:15   ` Leif Lindholm
2017-10-05 20:15     ` Ard Biesheuvel
2017-10-05 20:25       ` Leif Lindholm
2017-09-21 16:23 ` evan.lloyd [this message]
2017-09-21 17:56 ` [PATCH 0/4] [PATCH 0/5] Add HardwareInterrupt2 for ARM Leif Lindholm
2017-09-21 18:39   ` Evan Lloyd
2017-09-21 19:15     ` Andrew Fish
2017-09-21 20:53       ` Evan Lloyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170921162345.11724-5-evan.lloyd@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox