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