42 if (
MmioRead32 (SP805_WDOG_LOCK_REG) == SP805_WDOG_LOCK_IS_LOCKED) {
43 MmioWrite32 (SP805_WDOG_LOCK_REG, SP805_WDOG_SPECIAL_UNLOCK_CODE);
60 if (
MmioRead32 (SP805_WDOG_LOCK_REG) == SP805_WDOG_LOCK_IS_UNLOCKED) {
62 MmioWrite32 (SP805_WDOG_LOCK_REG, SP805_WDOG_LOCK_IS_LOCKED);
69SP805InterruptHandler (
70 IN HARDWARE_INTERRUPT_SOURCE Source,
78 mInterrupt->EndOfInterrupt (mInterrupt, Source);
86 if (mWatchdogNotify !=
NULL) {
87 mWatchdogNotify (mTimerPeriod + 1);
103 if ((
MmioRead32 (SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) != 0) {
104 MmioAnd32 (SP805_WDOG_CONTROL_REG, (UINT32) ~SP805_WDOG_CTRL_INTEN);
120 if ((
MmioRead32 (SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_INTEN) == 0) {
121 MmioOr32 (SP805_WDOG_CONTROL_REG, SP805_WDOG_CTRL_INTEN);
178 return EFI_INVALID_PARAMETER;
182 return EFI_ALREADY_STARTED;
222 IN UINT64 TimerPeriod
232 if (TimerPeriod == 0) {
246 Ticks64bit =
DivU64x32 (Ticks64bit, 10 * 1000 * 1000);
249 if (Ticks64bit > MAX_UINT32) {
254 Status = EFI_DEVICE_ERROR;
259 MmioWrite32 (SP805_WDOG_LOAD_REG, (UINT32)Ticks64bit);
265 mTimerPeriod = TimerPeriod;
294 OUT UINT64 *TimerPeriod
297 if (TimerPeriod ==
NULL) {
298 return EFI_INVALID_PARAMETER;
301 *TimerPeriod = mTimerPeriod;
365 Status =
gBS->LocateProtocol (
366 &gHardwareInterruptProtocolGuid,
380 if ((
MmioRead32 (SP805_WDOG_CONTROL_REG) & SP805_WDOG_CTRL_RESEN) == 0) {
381 MmioOr32 (SP805_WDOG_CONTROL_REG, SP805_WDOG_CTRL_RESEN);
390 if (
PcdGet32 (PcdSP805WatchdogInterrupt) > 0) {
391 Status = mInterrupt->RegisterInterruptSource (
393 PcdGet32 (PcdSP805WatchdogInterrupt),
394 SP805InterruptHandler
396 if (EFI_ERROR (Status)) {
399 "%a: failed to register watchdog interrupt - %r\n",
408 "%a: no interrupt specified, running in RESET mode only\n",
420 Status =
gBS->CreateEvent (
421 EVT_SIGNAL_EXIT_BOOT_SERVICES,
425 &mEfiExitBootServicesEvent
427 if (EFI_ERROR (Status)) {
428 Status = EFI_OUT_OF_RESOURCES;
434 Status =
gBS->InstallMultipleProtocolInterfaces (
436 &gEfiWatchdogTimerArchProtocolGuid,
440 if (EFI_ERROR (Status)) {
441 Status = EFI_OUT_OF_RESOURCES;
UINT64 EFIAPI DivU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
UINT32 EFIAPI MmioAnd32(IN UINTN Address, IN UINT32 AndData)
UINT32 EFIAPI MmioOr32(IN UINTN Address, IN UINT32 OrData)
UINT32 EFIAPI MmioRead32(IN UINTN Address)
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
EFI_RUNTIME_SERVICES * gRT
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)
VOID(EFIAPI * EFI_WATCHDOG_TIMER_NOTIFY)(IN UINT64 Time)
#define PcdGet32(TokenName)
STATIC VOID SP805Start(VOID)
STATIC EFI_STATUS EFIAPI SP805SetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod)
STATIC VOID SP805Lock(VOID)
STATIC EFI_STATUS EFIAPI SP805GetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, OUT UINT64 *TimerPeriod)
STATIC VOID SP805Unlock(VOID)
EFI_STATUS EFIAPI SP805Initialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC VOID SP805Stop(VOID)
STATIC EFI_STATUS EFIAPI SP805RegisterHandler(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction)
STATIC VOID EFIAPI ExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context)
STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer
VOID EFIAPI NotifyFunction(IN EFI_EVENT Event, IN VOID *Context)