]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/S3SaveState.h
Add @par at file header to indicate the specification version.
[mirror_edk2.git] / MdePkg / Include / Protocol / S3SaveState.h
CommitLineData
938e1821 1/** @file\r
2 S3 Save State Protocol as defined in PI1.2 Specification VOLUME 5 Standard.\r
3\r
4 This protocol is used by DXE PI module to store or record various IO operations \r
5 to be replayed during an S3 resume.\r
6 This protocol is not required for all platforms.\r
7 \r
8 Copyright (c) 2009, Intel Corporation \r
9 All rights reserved. This program and the accompanying materials \r
10 are licensed and made available under the terms and conditions of the BSD License \r
11 which accompanies this distribution. The full text of the license may be found at \r
12 http://opensource.org/licenses/bsd-license.php \r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
16\r
fd53905e 17 @par Revision Reference:\r
18 This PPI is defined in UEFI Platform Initialization Specification 1.2 Volume 5: \r
19 Standards\r
20\r
938e1821 21**/\r
22\r
23#ifndef __S3_SAVE_STATE_H__\r
24#define __S3_SAVE_STATE_H__\r
25\r
26#define EFI_S3_SAVE_STATE_PROTOCOL_GUID \\r
27 { 0xe857caf6, 0xc046, 0x45dc, { 0xbe, 0x3f, 0xee, 0x7, 0x65, 0xfb, 0xa8, 0x87 }}\r
28\r
29//*******************************************\r
30// EFI Boot Script Opcode definitions\r
31//*******************************************\r
32#define EFI_BOOT_SCRIPT_IO_WRITE_OPCODE 0x00\r
33#define EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE 0x01\r
34#define EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE 0x02\r
35#define EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE 0x03\r
36#define EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE 0x04\r
37#define EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE 0x05\r
38#define EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE 0x06\r
39#define EFI_BOOT_SCRIPT_STALL_OPCODE 0x07\r
40#define EFI_BOOT_SCRIPT_DISPATCH_OPCODE 0x08\r
41#define EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE 0x09\r
42#define EFI_BOOT_SCRIPT_INFORMATION_OPCODE 0x0A\r
43#define EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE 0x0B\r
44#define EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE 0x0C\r
45#define EFI_BOOT_SCRIPT_IO_POLL_OPCODE 0x0D\r
46#define EFI_BOOT_SCRIPT_MEM_POLL_OPCODE 0x0E\r
47#define EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE 0x0F\r
48#define EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE 0x10\r
49\r
50//*******************************************\r
51// EFI_BOOT_SCRIPT_WIDTH\r
52//*******************************************\r
53typedef enum {\r
54 EfiBootScriptWidthUint8,\r
55 EfiBootScriptWidthUint16,\r
56 EfiBootScriptWidthUint32,\r
57 EfiBootScriptWidthUint64,\r
58 EfiBootScriptWidthFifoUint8,\r
59 EfiBootScriptWidthFifoUint16,\r
60 EfiBootScriptWidthFifoUint32,\r
61 EfiBootScriptWidthFifoUint64,\r
62 EfiBootScriptWidthFillUint8,\r
63 EfiBootScriptWidthFillUint16,\r
64 EfiBootScriptWidthFillUint32,\r
65 EfiBootScriptWidthFillUint64,\r
66 EfiBootScriptWidthMaximum\r
67} EFI_BOOT_SCRIPT_WIDTH;\r
68\r
69typedef VOID *EFI_S3_BOOT_SCRIPT_POSITION;\r
70\r
71typedef struct _EFI_S3_SAVE_STATE_PROTOCOL EFI_S3_SAVE_STATE_PROTOCOL;\r
72\r
73/**\r
74 Record operations that need to be replayed during an S3 resume.\r
75 \r
76 This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r
77 assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r
78 during the S3 resume.\r
79 \r
80 @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
81 @param[in] OpCode The operation code (opcode) number.\r
82 @param[in] ... Argument list that is specific to each opcode. See the following subsections for the\r
83 definition of each opcode.\r
84 \r
85 @retval EFI_SUCCESS The operation succeeded. A record was added into the specified\r
86 script table. \r
87 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
88 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script. \r
89**/\r
90typedef\r
91EFI_STATUS\r
92(EFIAPI *EFI_S3_SAVE_STATE_WRITE)(\r
93 IN CONST struct _EFI_S3_SAVE_STATE_PROTOCOL *This,\r
94 IN UINT16 OpCode,\r
95 ...\r
96);\r
97\r
98/**\r
99 Record operations that need to be replayed during an S3 resume.\r
100 \r
101 This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r
102 assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r
103 during the S3 resume.\r
104 The opcode is inserted before or after the specified position in the boot script table. If Position is\r
105 NULL then that position is after the last opcode in the table (BeforeOrAfter is TRUE) or before\r
106 the first opcode in the table (BeforeOrAfter is FALSE). The position which is pointed to by\r
107 Position upon return can be used for subsequent insertions.\r
108 \r
109 This function has a variable parameter list. The exact parameter list depends on the OpCode that is\r
110 passed into the function. If an unsupported OpCode or illegal parameter list is passed in, this\r
111 function returns EFI_INVALID_PARAMETER.\r
112 If there are not enough resources available for storing more scripts, this function returns\r
113 EFI_OUT_OF_RESOURCES.\r
114 OpCode values of 0x80 - 0xFE are reserved for implementation specific functions.\r
115 \r
116 @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
117 @param[in] BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
118 in the boot script table specified by Position. If Position is NULL or points to\r
119 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r
120 of the table (if FALSE).\r
121 @param[in, out] Position On entry, specifies the position in the boot script table where the opcode will be\r
122 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
123 the position of the inserted opcode in the boot script table.\r
124 @param[in] OpCode The operation code (opcode) number. See "Related Definitions" in Write() for the\r
125 defined opcode types.\r
126 @param[in] ... Argument list that is specific to each opcode. See the following subsections for the\r
127 definition of each opcode. \r
128 \r
129 @retval EFI_SUCCESS The operation succeeded. An opcode was added into the script.\r
130 @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value.\r
131 @retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r
132 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script table. \r
133**/\r
134typedef\r
135EFI_STATUS\r
136(EFIAPI *EFI_S3_SAVE_STATE_INSERT)(\r
137 IN struct _EFI_S3_SAVE_STATE_PROTOCOL *This,\r
138 IN BOOLEAN BeforeOrAfter,\r
139 IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r
140 IN UINT16 OpCode,\r
141 ...\r
142);\r
143\r
144/**\r
145 Find a label within the boot script table and, if not present, optionally create it.\r
146 \r
147 If the label Label is already exists in the boot script table, then no new label is created, the\r
148 position of the Label is returned in *Position and EFI_SUCCESS is returned.\r
149 If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r
150 created before or after the specified position and EFI_SUCCESS is returned.\r
151 If the label Label does not already exist and CreateIfNotFound is FALSE, then\r
152 EFI_NOT_FOUND is returned.\r
153 \r
154 @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
155 @param[in] BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r
156 the boot script table specified by Position. If Position is NULL or points to\r
157 NULL then the new label is inserted at the beginning of the table (if TRUE) or end of\r
158 the table (if FALSE).\r
159 @param[in] CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not (FALSE).\r
160 @param[in, out] Position On entry, specifies the position in the boot script table where the label will be inserted,\r
161 either before or after, depending on BeforeOrAfter. On exit, specifies the position\r
162 of the inserted label in the boot script table.\r
163 @param[in] Label Points to the label which will be inserted in the boot script table.\r
164 \r
165 @retval EFI_SUCCESS The label already exists or was inserted.\r
166 @retval EFI_NOT_FOUND The label did not already exist and CreateifNotFound was FALSE.\r
167 @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value.\r
168 @retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r
169 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
170**/\r
171typedef\r
172EFI_STATUS\r
173(EFIAPI *EFI_S3_SAVE_STATE_LABEL)(\r
174 IN struct _EFI_S3_SAVE_STATE_PROTOCOL *This,\r
175 IN BOOLEAN BeforeOrAfter,\r
176 IN BOOLEAN CreateIfNotFound,\r
177 IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r
178 IN CONST CHAR8 *Label\r
179);\r
180\r
181/**\r
182 Compare two positions in the boot script table and return their relative position.\r
183 \r
184 This function compares two positions in the boot script table and returns their relative positions. If\r
185 Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r
186 then 0 is returned. If Position1 is after Position2, then 1 is returned.\r
187 \r
188 @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r
189 @param[in] Position1 The positions in the boot script table to compare.\r
190 @param[in] Position2 The positions in the boot script table to compare.\r
191 @param[out] RelativePosition On return, points to the result of the comparison.\r
192 \r
193 @retval EFI_SUCCESS The label already exists or was inserted.\r
194 @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r
195**/\r
196typedef\r
197EFI_STATUS\r
198(EFIAPI *EFI_S3_SAVE_STATE_COMPARE)(\r
199 IN struct _EFI_S3_SAVE_STATE_PROTOCOL *This,\r
200 IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r
201 IN EFI_S3_BOOT_SCRIPT_POSITION Position2,\r
202 OUT UINTN *RelativePosition\r
203);\r
204\r
205struct _EFI_S3_SAVE_STATE_PROTOCOL {\r
206 EFI_S3_SAVE_STATE_WRITE Write;\r
207 EFI_S3_SAVE_STATE_INSERT Insert;\r
208 EFI_S3_SAVE_STATE_LABEL Label;\r
209 EFI_S3_SAVE_STATE_COMPARE Compare;\r
210};\r
211\r
212extern EFI_GUID gEfiS3SaveStateProtocolGuid;\r
213\r
214#endif // __S3_SAVE_STATE_H__\r