1 /*++
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 
24 Module Name:
25 
26   HwWatchdogTimerHob.h
27 
28 Abstract:
29 
30   GUID used for Watchdog Timer status in the HOB list.
31 
32 --*/
33 
34 #ifndef _EFI_WATCHDOG_TIMER_HOB_GUID_H_
35 #define _EFI_WATCHDOG_TIMER_HOB_GUID_H_
36 
37 #define EFI_WATCHDOG_TIMER_HOB_GUID \
38   { 0x226cd3f, 0x69b5, 0x4150, 0xac, 0xbe, 0xbf, 0xbf, 0x18, 0xe3, 0x3, 0xd5 }
39 
40 #define EFI_WATCHDOG_TIMER_DEFINITION_HOB_GUID \
41   { 0xd29302b0, 0x11ba, 0x4073, 0xa2, 0x27, 0x53, 0x8d, 0x25, 0x42, 0x70, 0x9f }
42 
43 typedef enum {
44   HWWD_NONE,
45   HWWD_TIMER_EXPIRED,
46   HWWD_SPONTANEOUS_REBOOT,
47   HWWD_FORCED_TIMEOUT
48 } HW_WATCHDOG_TIMEOUT;
49 
50 typedef struct {
51   HW_WATCHDOG_TIMEOUT         TimeoutStatus;
52 } HW_WATCHDOG_INFO;
53 
54 //
55 // Watchdog timer action values.
56 //
57 #define WDT_ACTION_RESET                    0x01    // reload/reset timer
58 #define WDT_ACTION_QUERY_CURRENT_VALUE      0x04    // get current value                     // DON'T NEED FOR OVERCLOCK UTILITY
59 #define WDT_ACTION_QUERY_COUNTDOWN_PERIOD   0x05    // get countdown period
60 #define WDT_ACTION_SET_COUNTDOWN_PERIOD     0x06    // set countdown period
61 #define WDT_ACTION_QUERY_RUNNING_STATE      0x08    // query if running
62 #define WDT_ACTION_SET_RUNNING_STATE        0x09    // start timer
63 #define WDT_ACTION_QUERY_STOPPED_STATE      0x0A    // query if stopped
64 #define WDT_ACTION_SET_STOPPED_STATE        0x0B    // stop timer
65 #define WDT_ACTION_QUERY_STATUS             0x20    // is current boot cause by wdt timeout?
66 #define WDT_ACTION_SET_STATUS               0x21    // resets wdt status bit
67 
68 //
69 // Watchdog timer instruction values.
70 //
71 #define WDT_INSTR_VALUE_MASK                0x03    // Mask for just the value
72 #define WDT_INSTR_READ_CMP_VALUE            0x00    // Read / compare value
73 #define WDT_INSTR_READ_COUNTDOWN            0x01    // read countdown value
74 #define WDT_INSTR_WRITE_VALUE               0x02    // Write value
75 #define WDT_INSTR_WRITE_COUNTDOWN           0x03    // write countdown value
76 #define WDT_INSTR_PRESERVE_REG              0x80    // preserve reg; used in Write Value / Write Countdown
77 #define WDT_INSTR_WRITE_VALUE_PRES         (0x02 | WDT_INSTR_PRESERVE_REG)   // Write value with preserve
78 #define WDT_INSTR_WRITE_COUNTDOWN_PRES     (0x03 | WDT_INSTR_PRESERVE_REG)   // write countdown value with preserve
79 
80 //
81 // The Generic Address Structure is defined in the ACPI Specification and should only be
82 // changed to match updated revisions of that specification.  The GAS_ADDRESS_SPACE and
83 // GAS_ACCESS_SIZE enumerations are also defined by the ACPI Specification.
84 //
85 typedef enum {
86   GAS_SYSTEM_MEMORY,
87   GAS_SYSTEM_IO,
88   GAS_PCI_CONFIG_SPACE,
89   GAS_EMBEDDED_CONTROLLER,
90   GAS_SMBUS
91 } GAS_ADDRESS_SPACE;
92 
93 typedef enum {
94   GAS_UNDEFINED,
95   GAS_BYTE_ACCESS,
96   GAS_WORD_ACCESS,
97   GAS_DWORD_ACCESS,
98   GAS_QWORD_ACCESS
99 } GAS_ACCESS_SIZE;
100 
101 #pragma pack(1)
102 
103 typedef struct {
104   UINT8                       AddressSpaceId;
105   UINT8                       RegisterBitWidth;
106   UINT8                       RegisterBitOffset;
107   UINT8                       AccessSize;
108   UINT64                      Address;
109 } GENERIC_ADDRESS_STRUCTURE;
110 
111 //
112 // GAS_SYSTEM_MEMORY -    When used as the AddressSpaceId, the 64-bit physical memory address
113 //                        of the register.  32-bit platforms must have the high DWORD set to 0.
114 // GAS_SYSTEM_IO -        The 64-bit I/O address of the register.  32-bit platforms must have
115 //                        the high DWORD set to 0.
116 // GAS_PCI_CONFIG_SPACE - PCI Configuration space addresses must be confined to devices on PCI
117 //                        Sepment Group 0, Bus 0.  This restriction exists to accommodate access
118 //                        to fixed hardware prior to PCI bus enumeration.  The format of addresses
119 //                        are defined as follows:
120 //                            Highest WORD: Reserved and must be -0-
121 //                            ...           PCI Device number on bus 0
122 //                            ...           PCI Function number
123 //                            Lowest WORD:  Offset in the configuration space header.
124 //
125 
126 typedef struct {
127   UINT8                       WdAction;
128   UINT8                       Flag;
129   UINT16                      Res;
130   GENERIC_ADDRESS_STRUCTURE   GenericAddressStructures;
131   UINT32                      Value;
132   UINT32                      Mask;
133 } WD_INSTRUCTION;
134 
135 typedef struct {
136   UINT32                      TimerPeriod;
137   UINT32                      MaxTimerCount;
138   UINT32                      MinTimerCount;
139   UINT16                      InstructionCount;
140   WD_INSTRUCTION              ActionDefinitions[1];
141 } WD_HOB_DEFINITION;
142 
143 #pragma pack()
144 
145 extern EFI_GUID gWatchdogTimerHobGuid;
146 extern EFI_GUID gWatchdogTimerDefinitionHobGuid;
147 
148 #endif // _EFI_WATCHDOG_TIMER_HOB_GUID_H_
149