]>
Commit | Line | Data |
---|---|---|
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 | |
96072947 | 8 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 | 9 | This program and the accompanying materials \r |
938e1821 | 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 | |
938e1821 | 29 | \r |
30 | typedef VOID *EFI_S3_BOOT_SCRIPT_POSITION;\r | |
31 | \r | |
32 | typedef struct _EFI_S3_SAVE_STATE_PROTOCOL EFI_S3_SAVE_STATE_PROTOCOL;\r | |
33 | \r | |
34 | /**\r | |
35 | Record operations that need to be replayed during an S3 resume.\r | |
36 | \r | |
37 | This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r | |
38 | assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r | |
39 | during the S3 resume.\r | |
40 | \r | |
41 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
42 | @param[in] OpCode The operation code (opcode) number.\r | |
43 | @param[in] ... Argument list that is specific to each opcode. See the following subsections for the\r | |
44 | definition of each opcode.\r | |
45 | \r | |
46 | @retval EFI_SUCCESS The operation succeeded. A record was added into the specified\r | |
47 | script table. \r | |
48 | @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r | |
49 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script. \r | |
50 | **/\r | |
51 | typedef\r | |
52 | EFI_STATUS\r | |
53 | (EFIAPI *EFI_S3_SAVE_STATE_WRITE)(\r | |
ea6898b9 | 54 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r |
55 | IN UINT16 OpCode,\r | |
938e1821 | 56 | ...\r |
57 | );\r | |
58 | \r | |
59 | /**\r | |
60 | Record operations that need to be replayed during an S3 resume.\r | |
61 | \r | |
62 | This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r | |
63 | assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r | |
64 | during the S3 resume.\r | |
65 | The opcode is inserted before or after the specified position in the boot script table. If Position is\r | |
66 | NULL then that position is after the last opcode in the table (BeforeOrAfter is TRUE) or before\r | |
67 | the first opcode in the table (BeforeOrAfter is FALSE). The position which is pointed to by\r | |
68 | Position upon return can be used for subsequent insertions.\r | |
69 | \r | |
70 | This function has a variable parameter list. The exact parameter list depends on the OpCode that is\r | |
71 | passed into the function. If an unsupported OpCode or illegal parameter list is passed in, this\r | |
72 | function returns EFI_INVALID_PARAMETER.\r | |
73 | If there are not enough resources available for storing more scripts, this function returns\r | |
74 | EFI_OUT_OF_RESOURCES.\r | |
75 | OpCode values of 0x80 - 0xFE are reserved for implementation specific functions.\r | |
76 | \r | |
77 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
78 | @param[in] BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r | |
79 | in the boot script table specified by Position. If Position is NULL or points to\r | |
80 | NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r | |
81 | of the table (if FALSE).\r | |
82 | @param[in, out] Position On entry, specifies the position in the boot script table where the opcode will be\r | |
83 | inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r | |
84 | the position of the inserted opcode in the boot script table.\r | |
85 | @param[in] OpCode The operation code (opcode) number. See "Related Definitions" in Write() for the\r | |
86 | defined opcode types.\r | |
87 | @param[in] ... Argument list that is specific to each opcode. See the following subsections for the\r | |
88 | definition of each opcode. \r | |
89 | \r | |
90 | @retval EFI_SUCCESS The operation succeeded. An opcode was added into the script.\r | |
91 | @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value.\r | |
92 | @retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r | |
93 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script table. \r | |
94 | **/\r | |
95 | typedef\r | |
96 | EFI_STATUS\r | |
97 | (EFIAPI *EFI_S3_SAVE_STATE_INSERT)(\r | |
ea6898b9 | 98 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r |
99 | IN BOOLEAN BeforeOrAfter,\r | |
100 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
101 | IN UINT16 OpCode,\r | |
938e1821 | 102 | ...\r |
103 | );\r | |
104 | \r | |
105 | /**\r | |
106 | Find a label within the boot script table and, if not present, optionally create it.\r | |
107 | \r | |
108 | If the label Label is already exists in the boot script table, then no new label is created, the\r | |
109 | position of the Label is returned in *Position and EFI_SUCCESS is returned.\r | |
110 | If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r | |
111 | created before or after the specified position and EFI_SUCCESS is returned.\r | |
112 | If the label Label does not already exist and CreateIfNotFound is FALSE, then\r | |
113 | EFI_NOT_FOUND is returned.\r | |
114 | \r | |
115 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
116 | @param[in] BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r | |
117 | the boot script table specified by Position. If Position is NULL or points to\r | |
118 | NULL then the new label is inserted at the beginning of the table (if TRUE) or end of\r | |
119 | the table (if FALSE).\r | |
120 | @param[in] CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not (FALSE).\r | |
121 | @param[in, out] Position On entry, specifies the position in the boot script table where the label will be inserted,\r | |
122 | either before or after, depending on BeforeOrAfter. On exit, specifies the position\r | |
123 | of the inserted label in the boot script table.\r | |
124 | @param[in] Label Points to the label which will be inserted in the boot script table.\r | |
125 | \r | |
126 | @retval EFI_SUCCESS The label already exists or was inserted.\r | |
127 | @retval EFI_NOT_FOUND The label did not already exist and CreateifNotFound was FALSE.\r | |
96072947 | 128 | @retval EFI_INVALID_PARAMETER The Label is NULL or points to an empty string.\r |
938e1821 | 129 | @retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r |
130 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
131 | **/\r | |
132 | typedef\r | |
133 | EFI_STATUS\r | |
134 | (EFIAPI *EFI_S3_SAVE_STATE_LABEL)(\r | |
ea6898b9 | 135 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r |
136 | IN BOOLEAN BeforeOrAfter,\r | |
137 | IN BOOLEAN CreateIfNotFound,\r | |
138 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
11f4ce06 | 139 | IN CONST CHAR8 *Label\r |
938e1821 | 140 | );\r |
141 | \r | |
142 | /**\r | |
143 | Compare two positions in the boot script table and return their relative position.\r | |
144 | \r | |
145 | This function compares two positions in the boot script table and returns their relative positions. If\r | |
146 | Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r | |
147 | then 0 is returned. If Position1 is after Position2, then 1 is returned.\r | |
148 | \r | |
149 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
150 | @param[in] Position1 The positions in the boot script table to compare.\r | |
151 | @param[in] Position2 The positions in the boot script table to compare.\r | |
152 | @param[out] RelativePosition On return, points to the result of the comparison.\r | |
153 | \r | |
96072947 | 154 | @retval EFI_SUCCESS The operation succeeded.\r |
938e1821 | 155 | @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r |
96072947 | 156 | @retval EFI_INVALID_PARAMETER The RelativePosition is NULL.\r |
938e1821 | 157 | **/\r |
158 | typedef\r | |
159 | EFI_STATUS\r | |
160 | (EFIAPI *EFI_S3_SAVE_STATE_COMPARE)(\r | |
ea6898b9 | 161 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r |
11f4ce06 | 162 | IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r |
163 | IN EFI_S3_BOOT_SCRIPT_POSITION Position2,\r | |
164 | OUT UINTN *RelativePosition\r | |
938e1821 | 165 | );\r |
166 | \r | |
167 | struct _EFI_S3_SAVE_STATE_PROTOCOL {\r | |
168 | EFI_S3_SAVE_STATE_WRITE Write;\r | |
169 | EFI_S3_SAVE_STATE_INSERT Insert;\r | |
170 | EFI_S3_SAVE_STATE_LABEL Label;\r | |
171 | EFI_S3_SAVE_STATE_COMPARE Compare;\r | |
172 | };\r | |
173 | \r | |
174 | extern EFI_GUID gEfiS3SaveStateProtocolGuid;\r | |
175 | \r | |
176 | #endif // __S3_SAVE_STATE_H__\r |