summaryrefslogtreecommitdiff
path: root/Platform/BroxtonPlatformPkg/Common/Include/Guid/HwWatchdogTimerHob.h
blob: 7ee63fb51d62c3740a8eadb8d0d214422329ed12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/** @file
  GUID used for Watchdog Timer status in the HOB list.

  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>

  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php.

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef _EFI_WATCHDOG_TIMER_HOB_GUID_H_
#define _EFI_WATCHDOG_TIMER_HOB_GUID_H_

#define EFI_WATCHDOG_TIMER_HOB_GUID \
  { 0x226cd3f, 0x69b5, 0x4150, 0xac, 0xbe, 0xbf, 0xbf, 0x18, 0xe3, 0x3, 0xd5 }

#define EFI_WATCHDOG_TIMER_DEFINITION_HOB_GUID \
  { 0xd29302b0, 0x11ba, 0x4073, 0xa2, 0x27, 0x53, 0x8d, 0x25, 0x42, 0x70, 0x9f }

typedef enum {
  HWWD_NONE,
  HWWD_TIMER_EXPIRED,
  HWWD_SPONTANEOUS_REBOOT,
  HWWD_FORCED_TIMEOUT
} HW_WATCHDOG_TIMEOUT;

typedef struct {
  HW_WATCHDOG_TIMEOUT         TimeoutStatus;
} HW_WATCHDOG_INFO;

//
// Watchdog timer action values
//
#define WDT_ACTION_RESET                    0x01    // reload/reset timer
#define WDT_ACTION_QUERY_CURRENT_VALUE      0x04    // get current value                     // DON'T NEED FOR OVERCLOCK UTILITY
#define WDT_ACTION_QUERY_COUNTDOWN_PERIOD   0x05    // get countdown period
#define WDT_ACTION_SET_COUNTDOWN_PERIOD     0x06    // set countdown period
#define WDT_ACTION_QUERY_RUNNING_STATE      0x08    // query if running
#define WDT_ACTION_SET_RUNNING_STATE        0x09    // start timer
#define WDT_ACTION_QUERY_STOPPED_STATE      0x0A    // query if stopped
#define WDT_ACTION_SET_STOPPED_STATE        0x0B    // stop timer
#define WDT_ACTION_QUERY_STATUS             0x20    // is current boot cause by wdt timeout?
#define WDT_ACTION_SET_STATUS               0x21    // resets wdt status bit

//
// Watchdog timer instruction values
//
#define WDT_INSTR_VALUE_MASK                0x03    // Mask for just the value
#define WDT_INSTR_READ_CMP_VALUE            0x00    // Read / compare value
#define WDT_INSTR_READ_COUNTDOWN            0x01    // read countdown value
#define WDT_INSTR_WRITE_VALUE               0x02    // Write value
#define WDT_INSTR_WRITE_COUNTDOWN           0x03    // write countdown value
#define WDT_INSTR_PRESERVE_REG              0x80    // preserve reg; used in Write Value / Write Countdown
#define WDT_INSTR_WRITE_VALUE_PRES         (0x02 | WDT_INSTR_PRESERVE_REG)   // Write value with preserve
#define WDT_INSTR_WRITE_COUNTDOWN_PRES     (0x03 | WDT_INSTR_PRESERVE_REG)   // write countdown value with preserve

//
// The Generic Address Structure is defined in the ACPI Specification and should only be
// changed to match updated revisions of that specification.  The GAS_ADDRESS_SPACE and
// GAS_ACCESS_SIZE enumerations are also defined by the ACPI Specification.
//

typedef enum {
  GAS_SYSTEM_MEMORY,
  GAS_SYSTEM_IO,
  GAS_PCI_CONFIG_SPACE,
  GAS_EMBEDDED_CONTROLLER,
  GAS_SMBUS
} GAS_ADDRESS_SPACE;

typedef enum {
  GAS_UNDEFINED,
  GAS_BYTE_ACCESS,
  GAS_WORD_ACCESS,
  GAS_DWORD_ACCESS,
  GAS_QWORD_ACCESS
} GAS_ACCESS_SIZE;

#pragma pack(1)

typedef struct {
  UINT8                       AddressSpaceId;
  UINT8                       RegisterBitWidth;
  UINT8                       RegisterBitOffset;
  UINT8                       AccessSize;
  UINT64                      Address;
} GENERIC_ADDRESS_STRUCTURE;

//
// GAS_SYSTEM_MEMORY -    When used as the AddressSpaceId, the 64-bit physical memory address
//                        of the register.  32-bit platforms must have the high DWORD set to 0.
// GAS_SYSTEM_IO -        The 64-bit I/O address of the register.  32-bit platforms must have
//                        the high DWORD set to 0.
// GAS_PCI_CONFIG_SPACE - PCI Configuration space addresses must be confined to devices on PCI
//                        Sepment Group 0, Bus 0.  This restriction exists to accommodate access
//                        to fixed hardware prior to PCI bus enumeration.  The format of addresses
//                        are defined as follows:
//                            Highest WORD: Reserved and must be -0-
//                            ...           PCI Device number on bus 0
//                            ...           PCI Function number
//                            Lowest WORD:  Offset in the configuration space header
//


typedef struct {
  UINT8                       WdAction;
  UINT8                       Flag;
  UINT16                      Res;
  GENERIC_ADDRESS_STRUCTURE   GenericAddressStructures;
  UINT32                      Value;
  UINT32                      Mask;
} WD_INSTRUCTION;

typedef struct {
  UINT32                      TimerPeriod;
  UINT32                      MaxTimerCount;
  UINT32                      MinTimerCount;
  UINT16                      InstructionCount;
  WD_INSTRUCTION              ActionDefinitions[1];
} WD_HOB_DEFINITION;

#pragma pack()

extern EFI_GUID gWatchdogTimerHobGuid;
extern EFI_GUID gWatchdogTimerDefinitionHobGuid;

#endif // _EFI_WATCHDOG_TIMER_HOB_GUID_H_