]>
Commit | Line | Data |
---|---|---|
bdfde462 | 1 | /** @file\r |
2 | Internal header file for S3 Boot Script Saver state driver.\r | |
3 | \r | |
125e0938 | 4 | Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r |
bdfde462 | 5 | \r |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions\r | |
8 | of the BSD License which accompanies this distribution. The\r | |
9 | full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | #ifndef _INTERNAL_S3_SAVE_STATE_H_\r | |
17 | #define _INTERNAL_S3_SAVE_STATE_H_\r | |
18 | #include <PiDxe.h>\r | |
19 | \r | |
20 | #include <Protocol/S3SaveState.h>\r | |
21 | \r | |
22 | #include <Library/BaseLib.h>\r | |
23 | #include <Library/DebugLib.h>\r | |
24 | #include <Library/UefiDriverEntryPoint.h>\r | |
25 | #include <Library/UefiBootServicesTableLib.h>\r | |
26 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
27 | #include <Library/S3BootScriptLib.h>\r | |
bdfde462 | 28 | #include <Library/SmbusLib.h>\r |
125e0938 | 29 | #include <Library/PcdLib.h>\r |
bdfde462 | 30 | #include <IndustryStandard/SmBus.h>\r |
bd890a73 SZ |
31 | #include <Guid/EventGroup.h>\r |
32 | \r | |
33 | /**\r | |
34 | Callback function executed when the EndOfDxe event group is signaled.\r | |
35 | \r | |
36 | @param[in] Event Event whose notification function is being invoked.\r | |
37 | @param[in] Context The pointer to the notification function's context, which\r | |
38 | is implementation-dependent.\r | |
39 | **/\r | |
40 | VOID\r | |
41 | EFIAPI\r | |
42 | AcpiS3ContextSaveOnEndOfDxe (\r | |
43 | IN EFI_EVENT Event,\r | |
44 | IN VOID *Context\r | |
45 | );\r | |
46 | \r | |
bdfde462 | 47 | /**\r |
48 | Adds a record into S3 boot script table.\r | |
49 | \r | |
50 | This function is used to store a boot script record into a given boot\r | |
51 | script table. If the table specified by TableName is nonexistent in the \r | |
52 | system, a new table will automatically be created and then the script record \r | |
53 | will be added into the new table. This function is responsible for allocating \r | |
54 | necessary memory for the script.\r | |
55 | \r | |
56 | This function has a variable parameter list. The exact parameter list depends on \r | |
57 | the OpCode that is passed into the function. If an unsupported OpCode or illegal \r | |
58 | parameter list is passed in, this function returns EFI_INVALID_PARAMETER.\r | |
59 | If there are not enough resources available for storing more scripts, this function returns\r | |
60 | EFI_OUT_OF_RESOURCES.\r | |
61 | \r | |
62 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
63 | @param OpCode The operation code (opcode) number.\r | |
64 | @param ... Argument list that is specific to each opcode. \r | |
65 | \r | |
66 | @retval EFI_SUCCESS The operation succeeded. A record was added into the\r | |
67 | specified script table.\r | |
68 | @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r | |
69 | If the opcode is unknow or not supported because of the PCD \r | |
70 | Feature Flags.\r | |
71 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
72 | \r | |
73 | **/\r | |
74 | EFI_STATUS\r | |
75 | EFIAPI\r | |
76 | BootScriptWrite (\r | |
77 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
78 | IN UINT16 OpCode,\r | |
79 | ...\r | |
80 | );\r | |
81 | /**\r | |
82 | Insert a record into a specified Framework boot script table.\r | |
83 | \r | |
84 | This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is\r | |
85 | assumed this protocol has platform specific mechanism to store the OpCode set and replay them\r | |
86 | during the S3 resume.\r | |
87 | The opcode is inserted before or after the specified position in the boot script table. If Position is\r | |
88 | NULL then that position is after the last opcode in the table (BeforeOrAfter is FALSE) or before\r | |
89 | the first opcode in the table (BeforeOrAfter is TRUE). The position which is pointed to by\r | |
90 | Position upon return can be used for subsequent insertions.\r | |
91 | \r | |
92 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
93 | @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r | |
94 | in the boot script table specified by Position. If Position is NULL or points to\r | |
95 | NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r | |
96 | of the table (if FALSE).\r | |
97 | @param Position On entry, specifies the position in the boot script table where the opcode will be\r | |
98 | inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r | |
99 | the position of the inserted opcode in the boot script table.\r | |
100 | @param OpCode The operation code (opcode) number.\r | |
101 | @param ... Argument list that is specific to each opcode. \r | |
102 | \r | |
103 | @retval EFI_SUCCESS The operation succeeded. A record was added into the\r | |
104 | specified script table.\r | |
105 | @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value or the Position is not a valid position in the boot script table..\r | |
106 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
107 | \r | |
108 | **/\r | |
109 | EFI_STATUS\r | |
110 | EFIAPI\r | |
111 | BootScriptInsert (\r | |
112 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
113 | IN BOOLEAN BeforeOrAfter,\r | |
114 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
115 | IN UINT16 OpCode,\r | |
116 | ...\r | |
117 | );\r | |
118 | /**\r | |
119 | Find a label within the boot script table and, if not present, optionally create it.\r | |
120 | \r | |
121 | If the label Label is already exists in the boot script table, then no new label is created, the\r | |
122 | position of the Label is returned in *Position and EFI_SUCCESS is returned.\r | |
123 | If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be\r | |
124 | created before or after the specified position and EFI_SUCCESS is returned.\r | |
125 | If the label Label does not already exist and CreateIfNotFound is FALSE, then\r | |
126 | EFI_NOT_FOUND is returned.\r | |
127 | \r | |
128 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
129 | @param BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in\r | |
130 | the boot script table specified by Position. If Position is NULL or points to\r | |
131 | NULL then the new label is inserted at the beginning of the table (if TRUE) or end of\r | |
132 | the table (if FALSE).\r | |
133 | @param CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not\r | |
134 | (FALSE).\r | |
135 | @param Position On entry, specifies the position in the boot script table where the label will be inserted,\r | |
136 | either before or after, depending on BeforeOrAfter. On exit, specifies the position\r | |
137 | of the inserted label in the boot script table.\r | |
138 | @param Label Points to the label which will be inserted in the boot script table.\r | |
139 | \r | |
140 | @retval EFI_SUCCESS The label already exists or was inserted.\r | |
141 | @retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value or the Position is not a valid position in the boot script table..\r | |
142 | \r | |
143 | **/\r | |
144 | EFI_STATUS\r | |
145 | EFIAPI\r | |
146 | BootScriptLabel (\r | |
147 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
148 | IN BOOLEAN BeforeOrAfter,\r | |
149 | IN BOOLEAN CreateIfNotFound,\r | |
150 | IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,\r | |
151 | IN CONST CHAR8 *Label\r | |
152 | );\r | |
153 | /**\r | |
154 | Compare two positions in the boot script table and return their relative position.\r | |
155 | \r | |
156 | This function compares two positions in the boot script table and returns their relative positions. If\r | |
157 | Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,\r | |
158 | then 0 is returned. If Position1 is after Position2, then 1 is returned.\r | |
159 | \r | |
160 | @param This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.\r | |
161 | @param Position1 The positions in the boot script table to compare\r | |
162 | @param Position2 The positions in the boot script table to compare\r | |
163 | @param RelativePosition On return, points to the result of the comparison\r | |
164 | \r | |
165 | @retval EFI_SUCCESS The operation succeeded. \r | |
166 | @retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.\r | |
167 | \r | |
168 | **/\r | |
169 | EFI_STATUS\r | |
170 | EFIAPI \r | |
171 | BootScriptCompare (\r | |
172 | IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,\r | |
173 | IN EFI_S3_BOOT_SCRIPT_POSITION Position1,\r | |
174 | IN EFI_S3_BOOT_SCRIPT_POSITION Position2,\r | |
175 | OUT UINTN *RelativePosition\r | |
176 | );\r | |
177 | \r | |
178 | #endif //_INTERNAL_S3_SAVE_STATE_H_\r |