ArmPkg/GenericWatchdogDxe: Set Watchdog interrupt type

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>
This commit is contained in:
Ard Biesheuvel 2016-09-01 17:21:57 +01:00 committed by Leif Lindholm
parent 8659306a2e
commit baee8efb36
2 changed files with 21 additions and 14 deletions

View File

@ -24,8 +24,8 @@
#include <Library/UefiLib.h> #include <Library/UefiLib.h>
#include <Library/ArmGenericTimerCounterLib.h> #include <Library/ArmGenericTimerCounterLib.h>
#include <Protocol/HardwareInterrupt2.h>
#include <Protocol/WatchdogTimer.h> #include <Protocol/WatchdogTimer.h>
#include <Protocol/HardwareInterrupt.h>
#include "GenericWatchdog.h" #include "GenericWatchdog.h"
@ -41,7 +41,7 @@ UINTN mTimerFrequencyHz = 0;
It is therefore stored here. 0 means the timer is not running. */ It is therefore stored here. 0 means the timer is not running. */
UINT64 mNumTimerTicks = 0; UINT64 mNumTimerTicks = 0;
EFI_HARDWARE_INTERRUPT_PROTOCOL *mInterruptProtocol; EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol;
EFI_STATUS EFI_STATUS
WatchdogWriteOffsetRegister ( WatchdogWriteOffsetRegister (
@ -311,7 +311,7 @@ GenericWatchdogEntry (
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
// Install interrupt handler // Install interrupt handler
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
&gHardwareInterruptProtocolGuid, &gHardwareInterrupt2ProtocolGuid,
NULL, NULL,
(VOID **)&mInterruptProtocol (VOID **)&mInterruptProtocol
); );
@ -322,14 +322,21 @@ GenericWatchdogEntry (
WatchdogInterruptHandler WatchdogInterruptHandler
); );
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
// Install the Timer Architectural Protocol onto a new handle Status = mInterruptProtocol->SetTriggerType (
Handle = NULL; mInterruptProtocol,
Status = gBS->InstallMultipleProtocolInterfaces ( FixedPcdGet32 (PcdGenericWatchdogEl2IntrNum),
&Handle, EFI_HARDWARE_INTERRUPT2_TRIGGER_EDGE_RISING
&gEfiWatchdogTimerArchProtocolGuid, );
&gWatchdogTimer, if (!EFI_ERROR (Status)) {
NULL // Install the Timer Architectural Protocol onto a new handle
); Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiWatchdogTimerArchProtocolGuid,
&gWatchdogTimer,
NULL
);
}
} }
} }
} }

View File

@ -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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -47,7 +47,7 @@
[Protocols] [Protocols]
gEfiWatchdogTimerArchProtocolGuid gEfiWatchdogTimerArchProtocolGuid
gHardwareInterruptProtocolGuid gHardwareInterrupt2ProtocolGuid
[Depex] [Depex]
gHardwareInterruptProtocolGuid gHardwareInterrupt2ProtocolGuid