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