]>
Commit | Line | Data |
---|---|---|
4851f244 | 1 | /** @file\r |
2 | Header file to define SMM S3 Save State Protocol as in PI1.2 Specification VOLUME 5 Standard.\r | |
3 | \r | |
4 | The thunk implementation for SmmScriptLib will ultilize the SmmSaveState Protocol to save SMM\r | |
5 | runtime s3 boot Script. This header file is to definiedSMM S3 Save State Protocol \r | |
6 | \r | |
7 | Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r | |
8 | \r | |
9 | This program and the accompanying materials\r | |
10 | are licensed and made available under the terms and conditions\r | |
11 | of the BSD License which accompanies this distribution. The\r | |
12 | full text of the license may be found at\r | |
13 | http://opensource.org/licenses/bsd-license.php\r | |
14 | \r | |
15 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
16 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
17 | \r | |
18 | **/\r | |
19 | #ifndef __PI_SMM_S3_SAVE_STATE_H__\r | |
20 | #define __PI_SMM_S3_SAVE_STATE_H__\r | |
21 | \r | |
22 | #define EFI_S3_SMM_SAVE_STATE_PROTOCOL_GUID \\r | |
23 | {0x320afe62, 0xe593, 0x49cb, { 0xa9, 0xf1, 0xd4, 0xc2, 0xf4, 0xaf, 0x1, 0x4c }}\r | |
24 | \r | |
25 | typedef VOID *EFI_S3_BOOT_SCRIPT_POSITION;\r | |
26 | \r | |
27 | typedef struct _EFI_S3_SMM_SAVE_STATE_PROTOCOL EFI_S3_SAVE_STATE_PROTOCOL;\r | |
28 | \r | |
29 | /**\r | |
30 | Record operations that need to be replayed during an S3 resume.\r | |
31 | \r | |
32 | This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r | |
33 | assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r | |
34 | during the S3 resume.\r | |
35 | \r | |
36 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
37 | @param[in] OpCode The operation code (opcode) number.\r | |
38 | @param[in] ... Argument list that is specific to each opcode. See the following subsections for the\r | |
39 | definition of each opcode.\r | |
40 | \r | |
41 | @retval EFI_SUCCESS The operation succeeded. A record was added into the specified\r | |
42 | script table. \r | |
43 | @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r | |
44 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script. \r | |
45 | **/\r | |
46 | typedef\r | |
47 | EFI_STATUS\r | |
48 | (EFIAPI *EFI_S3_SAVE_STATE_WRITE)(\r | |
49 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
50 | IN UINT16 OpCode,\r | |
51 | ...\r | |
52 | );\r | |
53 | \r | |
54 | /**\r | |
55 | Record operations that need to be replayed during an S3 resume.\r | |
56 | \r | |
57 | This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r | |
58 | assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r | |
59 | during the S3 resume.\r | |
60 | The opcode is inserted before or after the specified position in the boot script table. If Position is\r | |
61 | NULL then that position is after the last opcode in the table (BeforeOrAfter is TRUE) or before\r | |
62 | the first opcode in the table (BeforeOrAfter is FALSE). The position which is pointed to by\r | |
63 | Position upon return can be used for subsequent insertions.\r | |
64 | \r | |
65 | This function has a variable parameter list. The exact parameter list depends on the OpCode that is\r | |
66 | passed into the function. If an unsupported OpCode or illegal parameter list is passed in, this\r | |
67 | function returns EFI_INVALID_PARAMETER.\r | |
68 | If there are not enough resources available for storing more scripts, this function returns\r | |
69 | EFI_OUT_OF_RESOURCES.\r | |
70 | OpCode values of 0x80 - 0xFE are reserved for implementation specific functions.\r | |
71 | \r | |
72 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
73 | @param[in] BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r | |
74 | in the boot script table specified by Position. If Position is NULL or points to\r | |
75 | NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r | |
76 | of the table (if FALSE).\r | |
77 | @param[in, out] Position On entry, specifies the position in the boot script table where the opcode will be\r | |
78 | inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r | |
79 | the position of the inserted opcode in the boot script table.\r | |
80 | @param[in] OpCode The operation code (opcode) number. See "Related Definitions" in Write() for the\r | |
81 | defined opcode types.\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. An opcode was added into the script.\r | |
86 | @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value.\r | |
87 | @retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r | |
88 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script table. \r | |
89 | **/\r | |
90 | typedef\r | |
91 | EFI_STATUS\r | |
92 | (EFIAPI *EFI_S3_SAVE_STATE_INSERT)(\r | |
93 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
94 | IN BOOLEAN BeforeOrAfter,\r | |
95 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
96 | IN UINT16 OpCode,\r | |
97 | ...\r | |
98 | );\r | |
99 | \r | |
100 | /**\r | |
101 | Find a label within the boot script table and, if not present, optionally create it.\r | |
102 | \r | |
103 | If the label Label is already exists in the boot script table, then no new label is created, the\r | |
104 | position of the Label is returned in *Position and EFI_SUCCESS is returned.\r | |
105 | If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r | |
106 | created before or after the specified position and EFI_SUCCESS is returned.\r | |
107 | If the label Label does not already exist and CreateIfNotFound is FALSE, then\r | |
108 | EFI_NOT_FOUND is returned.\r | |
109 | \r | |
110 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
111 | @param[in] BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r | |
112 | the boot script table specified by Position. If Position is NULL or points to\r | |
113 | NULL then the new label is inserted at the beginning of the table (if TRUE) or end of\r | |
114 | the table (if FALSE).\r | |
115 | @param[in] CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not (FALSE).\r | |
116 | @param[in, out] Position On entry, specifies the position in the boot script table where the label will be inserted,\r | |
117 | either before or after, depending on BeforeOrAfter. On exit, specifies the position\r | |
118 | of the inserted label in the boot script table.\r | |
119 | @param[in] Label Points to the label which will be inserted in the boot script table.\r | |
120 | \r | |
121 | @retval EFI_SUCCESS The label already exists or was inserted.\r | |
122 | @retval EFI_NOT_FOUND The label did not already exist and CreateifNotFound was FALSE.\r | |
123 | @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value.\r | |
124 | @retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r | |
125 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
126 | **/\r | |
127 | typedef\r | |
128 | EFI_STATUS\r | |
129 | (EFIAPI *EFI_S3_SAVE_STATE_LABEL)(\r | |
130 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
131 | IN BOOLEAN BeforeOrAfter,\r | |
132 | IN BOOLEAN CreateIfNotFound,\r | |
133 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
134 | IN CONST CHAR8 *Label\r | |
135 | );\r | |
136 | \r | |
137 | /**\r | |
138 | Compare two positions in the boot script table and return their relative position.\r | |
139 | \r | |
140 | This function compares two positions in the boot script table and returns their relative positions. If\r | |
141 | Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r | |
142 | then 0 is returned. If Position1 is after Position2, then 1 is returned.\r | |
143 | \r | |
144 | @param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
145 | @param[in] Position1 The positions in the boot script table to compare.\r | |
146 | @param[in] Position2 The positions in the boot script table to compare.\r | |
147 | @param[out] RelativePosition On return, points to the result of the comparison.\r | |
148 | \r | |
149 | @retval EFI_SUCCESS The label already exists or was inserted.\r | |
150 | @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r | |
151 | **/\r | |
152 | typedef\r | |
153 | EFI_STATUS\r | |
154 | (EFIAPI *EFI_S3_SAVE_STATE_COMPARE)(\r | |
155 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
156 | IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r | |
157 | IN EFI_S3_BOOT_SCRIPT_POSITION Position2,\r | |
158 | OUT UINTN *RelativePosition\r | |
159 | );\r | |
160 | \r | |
161 | typedef struct _EFI_S3_SMM_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 | } EFI_S3_SMM_SAVE_STATE_PROTOCOL; \r | |
167 | \r | |
168 | \r | |
169 | #endif // __S3_SAVE_STATE_H__\r |