summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c')
-rw-r--r--ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c67
1 files changed, 42 insertions, 25 deletions
diff --git a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c
index 00238ee659..5821dc1958 100644
--- a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c
+++ b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c
@@ -7,7 +7,6 @@
**/
-
#include <PiDxe.h>
#include <Library/BaseLib.h>
@@ -68,8 +67,8 @@ STATIC
VOID
EFIAPI
SP805InterruptHandler (
- IN HARDWARE_INTERRUPT_SOURCE Source,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN HARDWARE_INTERRUPT_SOURCE Source,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
SP805Unlock ();
@@ -171,15 +170,15 @@ STATIC
EFI_STATUS
EFIAPI
SP805RegisterHandler (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
+ IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
+ IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
)
{
- if (mWatchdogNotify == NULL && NotifyFunction == NULL) {
+ if ((mWatchdogNotify == NULL) && (NotifyFunction == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (mWatchdogNotify != NULL && NotifyFunction != NULL) {
+ if ((mWatchdogNotify != NULL) && (NotifyFunction != NULL)) {
return EFI_ALREADY_STARTED;
}
@@ -219,8 +218,8 @@ STATIC
EFI_STATUS
EFIAPI
SP805SetTimerPeriod (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod // In 100ns units
+ IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
+ IN UINT64 TimerPeriod // In 100ns units
)
{
EFI_STATUS Status;
@@ -291,8 +290,8 @@ STATIC
EFI_STATUS
EFIAPI
SP805GetTimerPeriod (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
+ IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
)
{
if (TimerPeriod == NULL) {
@@ -335,7 +334,7 @@ SP805GetTimerPeriod (
Retrieves the period of the timer interrupt in 100 nS units.
**/
-STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer = {
+STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer = {
SP805RegisterHandler,
SP805SetTimerPeriod,
SP805GetTimerPeriod
@@ -355,16 +354,19 @@ STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer = {
EFI_STATUS
EFIAPI
SP805Initialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HANDLE Handle;
// Find the interrupt controller protocol. ASSERT if not found.
- Status = gBS->LocateProtocol (&gHardwareInterruptProtocolGuid, NULL,
- (VOID **)&mInterrupt);
+ Status = gBS->LocateProtocol (
+ &gHardwareInterruptProtocolGuid,
+ NULL,
+ (VOID **)&mInterrupt
+ );
ASSERT_EFI_ERROR (Status);
// Unlock access to the SP805 registers
@@ -386,17 +388,26 @@ SP805Initialize (
SP805Lock ();
if (PcdGet32 (PcdSP805WatchdogInterrupt) > 0) {
- Status = mInterrupt->RegisterInterruptSource (mInterrupt,
+ Status = mInterrupt->RegisterInterruptSource (
+ mInterrupt,
PcdGet32 (PcdSP805WatchdogInterrupt),
- SP805InterruptHandler);
+ SP805InterruptHandler
+ );
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: failed to register watchdog interrupt - %r\n",
- __FUNCTION__, Status));
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: failed to register watchdog interrupt - %r\n",
+ __FUNCTION__,
+ Status
+ ));
return Status;
}
} else {
- DEBUG ((DEBUG_WARN, "%a: no interrupt specified, running in RESET mode only\n",
- __FUNCTION__));
+ DEBUG ((
+ DEBUG_WARN,
+ "%a: no interrupt specified, running in RESET mode only\n",
+ __FUNCTION__
+ ));
}
//
@@ -406,8 +417,13 @@ SP805Initialize (
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid);
// Register for an ExitBootServicesEvent
- Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY,
- ExitBootServicesEvent, NULL, &mEfiExitBootServicesEvent);
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ ExitBootServicesEvent,
+ NULL,
+ &mEfiExitBootServicesEvent
+ );
if (EFI_ERROR (Status)) {
Status = EFI_OUT_OF_RESOURCES;
goto EXIT;
@@ -417,7 +433,8 @@ SP805Initialize (
Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
- &gEfiWatchdogTimerArchProtocolGuid, &mWatchdogTimer,
+ &gEfiWatchdogTimerArchProtocolGuid,
+ &mWatchdogTimer,
NULL
);
if (EFI_ERROR (Status)) {