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