iPXE
Macros | Functions | Variables
efi_watchdog.c File Reference

EFI watchdog holdoff timer. More...

#include <errno.h>
#include <string.h>
#include <ipxe/retry.h>
#include <ipxe/timer.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_watchdog.h>

Go to the source code of this file.

Macros

#define WATCHDOG_HOLDOFF_SECS   10
 Watchdog holdoff interval (in seconds) More...
 
#define WATCHDOG_TIMEOUT_SECS   ( 5 * 60 )
 Watchdog timeout (in seconds) More...
 
#define WATCHDOG_CODE   0x6950584544454144ULL
 Watchdog code (to be logged on watchdog timeout) More...
 
#define WATCHDOG_DATA   L"iPXE";
 Watchdog data (to be logged on watchdog timeout) More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static void efi_watchdog_expired (struct retry_timer *timer, int over __unused)
 Hold off watchdog timer. More...
 

Variables

struct retry_timer efi_watchdog = TIMER_INIT ( efi_watchdog_expired )
 Watchdog holdoff timer. More...
 

Detailed Description

EFI watchdog holdoff timer.

Definition in file efi_watchdog.c.

Macro Definition Documentation

◆ WATCHDOG_HOLDOFF_SECS

#define WATCHDOG_HOLDOFF_SECS   10

Watchdog holdoff interval (in seconds)

Definition at line 41 of file efi_watchdog.c.

◆ WATCHDOG_TIMEOUT_SECS

#define WATCHDOG_TIMEOUT_SECS   ( 5 * 60 )

Watchdog timeout (in seconds)

Definition at line 44 of file efi_watchdog.c.

◆ WATCHDOG_CODE

#define WATCHDOG_CODE   0x6950584544454144ULL

Watchdog code (to be logged on watchdog timeout)

Definition at line 47 of file efi_watchdog.c.

◆ WATCHDOG_DATA

#define WATCHDOG_DATA   L"iPXE";

Watchdog data (to be logged on watchdog timeout)

Definition at line 50 of file efi_watchdog.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ efi_watchdog_expired()

static void efi_watchdog_expired ( struct retry_timer timer,
int over  __unused 
)
static

Hold off watchdog timer.

Parameters
retryRetry timer
overFailure indicator

Definition at line 58 of file efi_watchdog.c.

59  {
61  static CHAR16 data[] = WATCHDOG_DATA;
62  EFI_STATUS efirc;
63  int rc;
64 
65  DBGC2 ( timer, "EFI holding off watchdog timer\n" );
66 
67  /* Restart this holdoff timer */
69 
70  /* Reset watchdog timer */
71  if ( ( efirc = bs->SetWatchdogTimer ( WATCHDOG_TIMEOUT_SECS,
72  WATCHDOG_CODE, sizeof ( data ),
73  data ) ) != 0 ) {
74  rc = -EEFI ( efirc );
75  DBGC ( timer, "EFI could not set watchdog timer: %s\n",
76  strerror ( rc ) );
77  return;
78  }
79 }
#define WATCHDOG_CODE
Watchdog code (to be logged on watchdog timeout)
Definition: efi_watchdog.c:47
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
Definition: UefiSpec.h:1894
#define TICKS_PER_SEC
Number of ticks per second.
Definition: timer.h:15
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:157
#define WATCHDOG_TIMEOUT_SECS
Watchdog timeout (in seconds)
Definition: efi_watchdog.c:44
#define DBGC(...)
Definition: compiler.h:505
unsigned short CHAR16
Definition: ProcessorBind.h:59
A timer.
Definition: timer.h:28
#define WATCHDOG_HOLDOFF_SECS
Watchdog holdoff interval (in seconds)
Definition: efi_watchdog.c:41
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1836
#define WATCHDOG_DATA
Watchdog data (to be logged on watchdog timeout)
Definition: efi_watchdog.c:50
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
Definition: retry.c:64
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
EFI_SYSTEM_TABLE * efi_systab
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

References EFI_SYSTEM_TABLE::BootServices, data, DBGC, DBGC2, EEFI, efi_systab, rc, EFI_BOOT_SERVICES::SetWatchdogTimer, start_timer_fixed(), strerror(), TICKS_PER_SEC, WATCHDOG_CODE, WATCHDOG_DATA, WATCHDOG_HOLDOFF_SECS, and WATCHDOG_TIMEOUT_SECS.

Variable Documentation

◆ efi_watchdog

struct retry_timer efi_watchdog = TIMER_INIT ( efi_watchdog_expired )

Watchdog holdoff timer.

Definition at line 82 of file efi_watchdog.c.

Referenced by efi_watchdog_start(), and efi_watchdog_stop().