]>
Commit | Line | Data |
---|---|---|
9095d37b LG |
1 | /** @file\r |
2 | Defines library APIs used by modules to save EFI Boot Script Opcodes.\r | |
3 | These OpCode will be restored by S3 related modules.\r | |
4 | Note that some of the API defined in the Library class may not\r | |
5 | be provided in the Framework version library instance, which means some of these\r | |
fe69ac84 | 6 | APIs cannot be used if the underlying firmware is Framework and not PI.\r |
7 | \r | |
9095d37b | 8 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
fe69ac84 | 9 | \r |
9344f092 | 10 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
fe69ac84 | 11 | \r |
12 | **/\r | |
13 | \r | |
14 | #ifndef _S3_BOOT_SCRIPT_LIB_H_\r | |
15 | #define _S3_BOOT_SCRIPT_LIB_H_\r | |
16 | \r | |
17 | #include <Library/BaseLib.h>\r | |
18 | #include <IndustryStandard/SmBus.h>\r | |
19 | \r | |
20 | /**\r | |
21 | Macro that converts PCI Bus, PCI Device, PCI Function and PCI Register to an\r | |
22 | address that can be passed to the S3 Boot Script Library PCI functions.\r | |
23 | \r | |
24 | @param Bus PCI Bus number. Range 0..255.\r | |
25 | @param Device PCI Device number. Range 0..31.\r | |
26 | @param Function PCI Function number. Range 0..7.\r | |
27 | @param Register PCI Register number. Range 0..255 for PCI. Range 0..4095\r | |
28 | for PCI Express.\r | |
29 | \r | |
30 | @return The encoded PCI address.\r | |
31 | \r | |
32 | **/\r | |
33 | #define S3_BOOT_SCRIPT_LIB_PCI_ADDRESS(Bus,Device,Function,Register) \\r | |
34 | (UINT64) ( \\r | |
35 | (((UINTN) Bus) << 24) | \\r | |
36 | (((UINTN) Device) << 16) | \\r | |
37 | (((UINTN) Function) << 8) | \\r | |
38 | (((UINTN) (Register)) < 256 ? ((UINTN) (Register)) : (UINT64) (LShiftU64 ((UINT64) (Register), 32))))\r | |
9095d37b | 39 | \r |
fe69ac84 | 40 | ///\r |
41 | /// S3 Boot Script Width.\r | |
42 | ///\r | |
43 | typedef enum {\r | |
44 | S3BootScriptWidthUint8, ///< 8-bit operation.\r | |
45 | S3BootScriptWidthUint16, ///< 16-bit operation.\r | |
9095d37b | 46 | S3BootScriptWidthUint32, ///< 32-bit operation.\r |
fe69ac84 | 47 | S3BootScriptWidthUint64, ///< 64-bit operation.\r |
48 | S3BootScriptWidthFifoUint8, ///< 8-bit FIFO operation.\r | |
49 | S3BootScriptWidthFifoUint16, ///< 16-bit FIFO operation.\r | |
50 | S3BootScriptWidthFifoUint32, ///< 32-bit FIFO operation.\r | |
51 | S3BootScriptWidthFifoUint64, ///< 64-bit FIFO operation.\r | |
52 | S3BootScriptWidthFillUint8, ///< 8-bit Fill operation.\r | |
53 | S3BootScriptWidthFillUint16, ///< 16-bit Fill operation.\r | |
54 | S3BootScriptWidthFillUint32, ///< 32-bit Fill operation.\r | |
55 | S3BootScriptWidthFillUint64, ///< 64-bit Fill operation.\r | |
56 | S3BootScriptWidthMaximum\r | |
57 | } S3_BOOT_SCRIPT_LIB_WIDTH;\r | |
58 | \r | |
59 | /**\r | |
60 | Save I/O write to boot script.\r | |
61 | \r | |
62 | @param[in] Width The width of the I/O operations.\r | |
63 | @param[in] Address The base address of the I/O operations.\r | |
64 | @param[in] Count The number of I/O operations to perform.\r | |
65 | @param[in] Buffer The source buffer from which to write data.\r | |
66 | \r | |
9095d37b | 67 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 68 | the operation.\r |
69 | @retval RETURN_SUCCESS The opcode was added.\r | |
70 | \r | |
71 | **/\r | |
72 | RETURN_STATUS\r | |
73 | EFIAPI\r | |
74 | S3BootScriptSaveIoWrite (\r | |
75 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
76 | IN UINT64 Address,\r | |
77 | IN UINTN Count,\r | |
78 | IN VOID *Buffer\r | |
79 | );\r | |
80 | \r | |
81 | /**\r | |
82 | Adds a record for an I/O modify operation into a S3 boot script table.\r | |
83 | \r | |
84 | @param[in] Width The width of the I/O operations.\r | |
85 | @param[in] Address The base address of the I/O operations.\r | |
86 | @param[in] Data A pointer to the data to be OR-ed.\r | |
87 | @param[in] DataMask A pointer to the data mask to be AND-ed with the data\r | |
88 | read from the register.\r | |
89 | \r | |
9095d37b | 90 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 91 | the operation.\r |
92 | @retval RETURN_SUCCESS The opcode was added.\r | |
93 | \r | |
94 | **/\r | |
95 | RETURN_STATUS\r | |
96 | EFIAPI\r | |
97 | S3BootScriptSaveIoReadWrite (\r | |
98 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
99 | IN UINT64 Address,\r | |
100 | IN VOID *Data,\r | |
101 | IN VOID *DataMask\r | |
102 | );\r | |
103 | \r | |
104 | /**\r | |
105 | Adds a record for a memory write operation into a specified boot script table.\r | |
106 | \r | |
107 | @param[in] Width The width of the I/O operations.\r | |
108 | @param[in] Address The base address of the memory operations\r | |
109 | @param[in] Count The number of memory operations to perform.\r | |
110 | @param[in] Buffer The source buffer from which to write the data.\r | |
111 | \r | |
9095d37b | 112 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 113 | the operation.\r |
114 | @retval RETURN_SUCCESS The opcode was added.\r | |
115 | **/\r | |
116 | RETURN_STATUS\r | |
117 | EFIAPI\r | |
118 | S3BootScriptSaveMemWrite (\r | |
119 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
120 | IN UINT64 Address,\r | |
121 | IN UINTN Count,\r | |
122 | IN VOID *Buffer\r | |
123 | );\r | |
124 | \r | |
125 | /**\r | |
126 | Adds a record for a memory modify operation into a specified boot script table.\r | |
127 | \r | |
128 | @param[in] Width The width of the I/O operations.\r | |
9095d37b | 129 | @param[in] Address The base address of the memory operations. Address needs\r |
fe69ac84 | 130 | alignment, if required\r |
131 | @param[in] Data A pointer to the data to be OR-ed.\r | |
9095d37b | 132 | @param[in] DataMask A pointer to the data mask to be AND-ed with the data\r |
fe69ac84 | 133 | read from the register.\r |
134 | \r | |
9095d37b | 135 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 136 | the operation.\r |
137 | @retval RETURN_SUCCESS The opcode was added.\r | |
138 | **/\r | |
139 | RETURN_STATUS\r | |
140 | EFIAPI\r | |
141 | S3BootScriptSaveMemReadWrite (\r | |
142 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
143 | IN UINT64 Address,\r | |
144 | IN VOID *Data,\r | |
145 | IN VOID *DataMask\r | |
146 | );\r | |
147 | \r | |
148 | /**\r | |
149 | Adds a record for a PCI configuration space write operation into a specified boot script table.\r | |
150 | \r | |
151 | @param[in] Width The width of the I/O operations.\r | |
152 | @param[in] Address The address within the PCI configuration space.\r | |
153 | @param[in] Count The number of PCI operations to perform.\r | |
154 | @param[in] Buffer The source buffer from which to write the data.\r | |
155 | \r | |
9095d37b | 156 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 157 | the operation.\r |
158 | @retval RETURN_SUCCESS The opcode was added.\r | |
159 | **/\r | |
160 | RETURN_STATUS\r | |
161 | EFIAPI\r | |
162 | S3BootScriptSavePciCfgWrite (\r | |
163 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
164 | IN UINT64 Address,\r | |
165 | IN UINTN Count,\r | |
166 | IN VOID *Buffer\r | |
167 | );\r | |
168 | \r | |
169 | /**\r | |
170 | Adds a record for a PCI configuration space modify operation into a specified boot script table.\r | |
171 | \r | |
172 | @param[in] Width The width of the I/O operations.\r | |
173 | @param[in] Address The address within the PCI configuration space.\r | |
174 | @param[in] Data A pointer to the data to be OR-ed.The size depends on Width.\r | |
175 | @param[in] DataMask A pointer to the data mask to be AND-ed.\r | |
176 | \r | |
9095d37b | 177 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 178 | the operation.\r |
179 | @retval RETURN__SUCCESS The opcode was added.\r | |
180 | **/\r | |
181 | RETURN_STATUS\r | |
182 | EFIAPI\r | |
183 | S3BootScriptSavePciCfgReadWrite (\r | |
184 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
185 | IN UINT64 Address,\r | |
186 | IN VOID *Data,\r | |
187 | IN VOID *DataMask\r | |
188 | );\r | |
189 | \r | |
190 | /**\r | |
191 | Adds a record for a PCI configuration space modify operation into a specified boot script table.\r | |
192 | \r | |
193 | @param[in] Width The width of the I/O operations.\r | |
194 | @param[in] Segment The PCI segment number for Address.\r | |
195 | @param[in] Address The address within the PCI configuration space.\r | |
196 | @param[in] Count The number of PCI operations to perform.\r | |
197 | @param[in] Buffer The source buffer from which to write the data.\r | |
198 | \r | |
9095d37b | 199 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 200 | the operation.\r |
201 | @retval RETURN_SUCCESS The opcode was added.\r | |
202 | **/\r | |
203 | RETURN_STATUS\r | |
204 | EFIAPI\r | |
205 | S3BootScriptSavePciCfg2Write (\r | |
206 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
207 | IN UINT16 Segment,\r | |
208 | IN UINT64 Address,\r | |
209 | IN UINTN Count,\r | |
210 | IN VOID *Buffer\r | |
211 | );\r | |
212 | \r | |
213 | /**\r | |
214 | Adds a record for a PCI configuration space modify operation into a specified boot script table.\r | |
215 | \r | |
216 | @param[in] Width The width of the I/O operations.\r | |
217 | @param[in] Segment The PCI segment number for Address.\r | |
218 | @param[in] Address The address within the PCI configuration space.\r | |
219 | @param[in] Data A pointer to the data to be OR-ed. The size depends on Width.\r | |
220 | @param[in] DataMask A pointer to the data mask to be AND-ed.\r | |
221 | \r | |
9095d37b | 222 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 223 | the operation.\r |
224 | @retval RETURN_SUCCESS The opcode was added.\r | |
225 | **/\r | |
226 | RETURN_STATUS\r | |
227 | EFIAPI\r | |
228 | S3BootScriptSavePciCfg2ReadWrite (\r | |
229 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
230 | IN UINT16 Segment,\r | |
231 | IN UINT64 Address,\r | |
232 | IN VOID *Data,\r | |
233 | IN VOID *DataMask\r | |
234 | );\r | |
235 | \r | |
236 | /**\r | |
237 | Adds a record for an SMBus command execution into a specified boot script table.\r | |
238 | \r | |
9095d37b | 239 | @param[in] SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS\r |
fe69ac84 | 240 | Command, SMBUS Data Length, and PEC.\r |
9095d37b | 241 | @param[in] Operation Indicates which particular SMBus protocol it will use\r |
fe69ac84 | 242 | to execute the SMBus transactions.\r |
9095d37b | 243 | @param[in] Length A pointer to signify the number of bytes that this\r |
fe69ac84 | 244 | operation will do.\r |
9095d37b | 245 | @param[in] Buffer Contains the value of data to execute to the SMBUS\r |
fe69ac84 | 246 | slave device.\r |
9095d37b LG |
247 | \r |
248 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r | |
fe69ac84 | 249 | the operation.\r |
250 | @retval RETURN_SUCCESS The opcode was added.\r | |
251 | **/\r | |
252 | RETURN_STATUS\r | |
253 | EFIAPI\r | |
254 | S3BootScriptSaveSmbusExecute (\r | |
9095d37b | 255 | IN UINTN SmBusAddress,\r |
fe69ac84 | 256 | IN EFI_SMBUS_OPERATION Operation,\r |
257 | IN UINTN *Length,\r | |
258 | IN VOID *Buffer\r | |
259 | );\r | |
260 | \r | |
261 | /**\r | |
262 | Adds a record for an execution stall on the processor into a specified boot script table.\r | |
263 | \r | |
264 | @param[in] Duration The duration in microseconds of the stall.\r | |
9095d37b LG |
265 | \r |
266 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r | |
fe69ac84 | 267 | the operation.\r |
268 | @retval RETURN_SUCCESS The opcode was added.\r | |
269 | **/\r | |
270 | RETURN_STATUS\r | |
271 | EFIAPI\r | |
272 | S3BootScriptSaveStall (\r | |
273 | IN UINTN Duration\r | |
274 | );\r | |
275 | \r | |
276 | /**\r | |
300f2c6a | 277 | Adds a record for dispatching specified arbitrary code into a specified boot script table.\r |
fe69ac84 | 278 | \r |
279 | @param[in] EntryPoint The entry point of the code to be dispatched.\r | |
9095d37b | 280 | @param[in] Context The argument to be passed into the EntryPoint of the code\r |
fe69ac84 | 281 | to be dispatched.\r |
9095d37b LG |
282 | \r |
283 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r | |
fe69ac84 | 284 | the operation.\r |
285 | @retval RETURN_SUCCESS The opcode was added.\r | |
286 | **/\r | |
287 | RETURN_STATUS\r | |
288 | EFIAPI\r | |
289 | S3BootScriptSaveDispatch2 (\r | |
290 | IN VOID *EntryPoint,\r | |
291 | IN VOID *Context\r | |
292 | );\r | |
293 | \r | |
294 | /**\r | |
295 | Adds a record for dispatching specified arbitrary code into a specified boot script table.\r | |
296 | \r | |
297 | @param[in] EntryPoint The entry point of the code to be dispatched.\r | |
9095d37b LG |
298 | \r |
299 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r | |
fe69ac84 | 300 | the operation.\r |
301 | @retval RETURN_SUCCESS The opcode was added.\r | |
302 | **/\r | |
303 | RETURN_STATUS\r | |
304 | EFIAPI\r | |
305 | S3BootScriptSaveDispatch (\r | |
306 | IN VOID *EntryPoint\r | |
307 | );\r | |
308 | \r | |
309 | /**\r | |
9095d37b | 310 | Adds a record for memory reads of the memory location and continues when the exit\r |
fe69ac84 | 311 | criteria is satisfied, or after a defined duration.\r |
57a1b9c4 JY |
312 | \r |
313 | Please aware, below interface is different with PI specification, Vol 5:\r | |
314 | EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE.\r | |
315 | "Duration" below is microseconds, while "Delay" in PI specification means\r | |
316 | the number of 100ns units to poll.\r | |
317 | \r | |
fe69ac84 | 318 | @param[in] Width The width of the memory operations.\r |
319 | @param[in] Address The base address of the memory operations.\r | |
9095d37b | 320 | @param[in] BitMask A pointer to the bit mask to be AND-ed with the data read\r |
fe69ac84 | 321 | from the register.\r |
322 | @param[in] BitValue A pointer to the data value after to be Masked.\r | |
323 | @param[in] Duration The duration in microseconds of the stall.\r | |
324 | @param[in] LoopTimes The times of the register polling.\r | |
325 | \r | |
9095d37b | 326 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 327 | the operation.\r |
328 | @retval RETURN_SUCCESS The opcode was added.\r | |
329 | \r | |
330 | **/\r | |
331 | RETURN_STATUS\r | |
332 | EFIAPI\r | |
333 | S3BootScriptSaveMemPoll (\r | |
334 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
335 | IN UINT64 Address,\r | |
336 | IN VOID *BitMask,\r | |
337 | IN VOID *BitValue,\r | |
338 | IN UINTN Duration,\r | |
63042a71 | 339 | IN UINT64 LoopTimes\r |
fe69ac84 | 340 | );\r |
341 | \r | |
342 | /**\r | |
9095d37b | 343 | Store arbitrary information in the boot script table. This opcode is a no-op on\r |
fe69ac84 | 344 | dispatch and is only used for debugging script issues.\r |
9095d37b | 345 | \r |
fe69ac84 | 346 | @param[in] InformationLength Length of the data in bytes\r |
347 | @param[in] Information Information to be logged in the boot scrpit\r | |
9095d37b LG |
348 | \r |
349 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r | |
fe69ac84 | 350 | the operation.\r |
351 | @retval RETURN_SUCCESS The opcode was added.\r | |
352 | \r | |
353 | **/\r | |
354 | RETURN_STATUS\r | |
355 | EFIAPI\r | |
356 | S3BootScriptSaveInformation (\r | |
9095d37b | 357 | IN UINT32 InformationLength,\r |
fe69ac84 | 358 | IN VOID *Information\r |
359 | );\r | |
360 | /**\r | |
361 | Adds a record for I/O reads the I/O location and continues when the exit criteria\r | |
362 | is satisfied, or after a defined duration.\r | |
9095d37b LG |
363 | \r |
364 | @param Width The width of the I/O operations.\r | |
fe69ac84 | 365 | @param Address The base address of the I/O operations.\r |
366 | @param Data The comparison value used for the polling exit criteria.\r | |
9095d37b LG |
367 | @param DataMask The mask used for the polling criteria. The bits in\r |
368 | the bytes below Width which are zero in Data are\r | |
fe69ac84 | 369 | ignored when polling the memory address.\r |
9095d37b LG |
370 | @param Delay The number of 100ns units to poll. Note that timer\r |
371 | available may be of insufficient granularity, so the\r | |
fe69ac84 | 372 | delay may be longer.\r |
373 | \r | |
9095d37b | 374 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform the\r |
fe69ac84 | 375 | operation.\r |
376 | @retval RETURN_SUCCESS The opcode was added.\r | |
9095d37b | 377 | @note The FRAMEWORK version implementation does not support this API\r |
fe69ac84 | 378 | **/\r |
379 | RETURN_STATUS\r | |
380 | EFIAPI\r | |
381 | S3BootScriptSaveIoPoll (\r | |
382 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
383 | IN UINT64 Address,\r | |
384 | IN VOID *Data,\r | |
9095d37b LG |
385 | IN VOID *DataMask,\r |
386 | IN UINT64 Delay\r | |
fe69ac84 | 387 | );\r |
388 | \r | |
389 | /**\r | |
9095d37b | 390 | Adds a record for PCI configuration space reads and continues when the exit\r |
fe69ac84 | 391 | criteria is satisfied ,or after a defined duration.\r |
392 | \r | |
9095d37b | 393 | @param Width The width of the I/O operations.\r |
fe69ac84 | 394 | @param Address The address within the PCI configuration space.\r |
9095d37b | 395 | @param Data The comparison value used for the polling exit\r |
fe69ac84 | 396 | criteria.\r |
9095d37b | 397 | @param DataMask Mask used for the polling criteria. The bits in\r |
fe69ac84 | 398 | the bytes below Width which are zero in Data are\r |
399 | ignored when polling the memory address.\r | |
9095d37b LG |
400 | @param Delay The number of 100ns units to poll. Note that timer\r |
401 | available may be of insufficient granularity, so the\r | |
fe69ac84 | 402 | delay may be longer.\r |
403 | \r | |
9095d37b | 404 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform the\r |
fe69ac84 | 405 | operation.\r |
406 | @retval RETURN_SUCCESS The opcode was added.\r | |
9095d37b | 407 | @note The FRAMEWORK version implementation does not support this API\r |
fe69ac84 | 408 | **/\r |
409 | RETURN_STATUS\r | |
410 | EFIAPI\r | |
411 | S3BootScriptSavePciPoll (\r | |
412 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
413 | IN UINT64 Address,\r | |
414 | IN VOID *Data,\r | |
415 | IN VOID *DataMask,\r | |
416 | IN UINT64 Delay\r | |
417 | );\r | |
418 | /**\r | |
9095d37b | 419 | Adds a record for PCI configuration space reads and continues when the exit criteria\r |
fe69ac84 | 420 | is satisfied, or after a defined duration.\r |
421 | \r | |
9095d37b | 422 | @param Width The width of the I/O operations.\r |
fe69ac84 | 423 | @param Segment The PCI segment number for Address.\r |
424 | @param Address The address within the PCI configuration space.\r | |
9095d37b | 425 | @param Data The comparison value used for the polling exit\r |
fe69ac84 | 426 | criteria.\r |
9095d37b | 427 | @param DataMask Mask used for the polling criteria. The bits in\r |
fe69ac84 | 428 | the bytes below Width which are zero\r |
429 | in Data are ignored when polling the memory address\r | |
9095d37b LG |
430 | @param Delay The number of 100ns units to poll. Note that timer\r |
431 | available may be of insufficient granularity so the delay\r | |
fe69ac84 | 432 | may be longer.\r |
433 | \r | |
9095d37b | 434 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform the\r |
fe69ac84 | 435 | operation.\r |
436 | @retval RETURN_SUCCESS The opcode was added.\r | |
9095d37b | 437 | @note A known Limitations in the implementation: When interpreting the opcode\r |
fe69ac84 | 438 | EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE, EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE\r |
9095d37b | 439 | and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as\r |
fe69ac84 | 440 | Zero, or else, assert.\r |
441 | The FRAMEWORK version implementation does not support this API.\r | |
442 | \r | |
443 | **/\r | |
444 | RETURN_STATUS\r | |
445 | EFIAPI\r | |
446 | S3BootScriptSavePci2Poll (\r | |
447 | IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r | |
448 | IN UINT16 Segment,\r | |
449 | IN UINT64 Address,\r | |
450 | IN VOID *Data,\r | |
451 | IN VOID *DataMask,\r | |
452 | IN UINT64 Delay\r | |
453 | );\r | |
454 | /**\r | |
9095d37b | 455 | Save ASCII string information specified by Buffer to boot script with opcode\r |
fe69ac84 | 456 | EFI_BOOT_SCRIPT_INFORMATION_OPCODE.\r |
457 | \r | |
9095d37b | 458 | @param[in] String The Null-terminated ASCII string to store into the S3 boot\r |
fe69ac84 | 459 | script table.\r |
460 | \r | |
9095d37b | 461 | @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r |
fe69ac84 | 462 | the operation.\r |
463 | @retval RETURN_SUCCESS The opcode was added.\r | |
464 | \r | |
465 | **/\r | |
466 | RETURN_STATUS\r | |
467 | EFIAPI\r | |
468 | S3BootScriptSaveInformationAsciiString (\r | |
469 | IN CONST CHAR8 *String\r | |
470 | );\r | |
471 | \r | |
472 | /**\r | |
9095d37b LG |
473 | This is an function to close the S3 boot script table. The function could only\r |
474 | be called in BOOT time phase. To comply with the Framework spec definition on\r | |
fe69ac84 | 475 | EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:\r |
476 | 1. Closes the specified boot script table\r | |
9095d37b LG |
477 | 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table.\r |
478 | Once this function is called, the table maintained by the library will be destroyed\r | |
fe69ac84 | 479 | after it is copied into the allocated pool.\r |
9095d37b | 480 | 3. Any attempts to add a script record after calling this function will cause a\r |
fe69ac84 | 481 | new table to be created by the library.\r |
9095d37b LG |
482 | 4. The base address of the allocated pool will be returned in Address. Note that\r |
483 | after using the boot script table, the CALLER is responsible for freeing the\r | |
484 | pool that is allocated by this function.\r | |
fe69ac84 | 485 | \r |
9095d37b | 486 | In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. This\r |
fe69ac84 | 487 | API is supplied here to meet the requirements of the Framework Spec.\r |
9095d37b | 488 | \r |
fe69ac84 | 489 | If anyone does call CloseTable() on a real platform, then the caller is responsible\r |
9095d37b | 490 | for figuring out how to get the script to run on an S3 resume because the boot script\r |
fe69ac84 | 491 | maintained by the lib will be destroyed.\r |
9095d37b LG |
492 | \r |
493 | @return the base address of the new copy of the boot script table.\r | |
fe69ac84 | 494 | \r |
495 | **/\r | |
496 | UINT8*\r | |
497 | EFIAPI\r | |
498 | S3BootScriptCloseTable (\r | |
499 | VOID\r | |
500 | );\r | |
501 | \r | |
502 | /**\r | |
503 | Executes the S3 boot script table.\r | |
504 | \r | |
505 | @retval RETURN_SUCCESS The boot script table was executed successfully.\r | |
9095d37b | 506 | @retval RETURN_UNSUPPORTED Invalid script table or opcode.\r |
fe69ac84 | 507 | \r |
508 | **/\r | |
509 | RETURN_STATUS\r | |
510 | EFIAPI\r | |
511 | S3BootScriptExecute (\r | |
512 | VOID\r | |
513 | );\r | |
514 | /**\r | |
9095d37b | 515 | Move the last boot script entry to the position\r |
fe69ac84 | 516 | \r |
9095d37b LG |
517 | @param BeforeOrAfter Specifies whether the opcode is stored before\r |
518 | (TRUE) or after (FALSE) the positionin the boot\r | |
519 | script table specified by Position. If Position\r | |
520 | is NULL or points to NULL then the new opcode is\r | |
521 | inserted at the beginning of the table (if TRUE)\r | |
fe69ac84 | 522 | or end of the table (if FALSE).\r |
9095d37b LG |
523 | @param Position On entry, specifies the position in the boot script\r |
524 | table where the opcode will be inserted, either\r | |
525 | before or after, depending on BeforeOrAfter. On\r | |
526 | exit, specifies the position of the inserted opcode\r | |
fe69ac84 | 527 | in the boot script table.\r |
528 | \r | |
529 | @retval RETURN_OUT_OF_RESOURCES The table is not available.\r | |
9095d37b | 530 | @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the\r |
fe69ac84 | 531 | boot script table.\r |
532 | @retval RETURN_SUCCESS The opcode was inserted.\r | |
9095d37b | 533 | @note The FRAMEWORK version implementation does not support this API.\r |
fe69ac84 | 534 | **/\r |
535 | RETURN_STATUS\r | |
536 | EFIAPI\r | |
537 | S3BootScriptMoveLastOpcode (\r | |
538 | IN BOOLEAN BeforeOrAfter,\r | |
539 | IN OUT VOID **Position OPTIONAL\r | |
540 | );\r | |
541 | /**\r | |
542 | Find a label within the boot script table and, if not present, optionally create it.\r | |
543 | \r | |
544 | @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)\r | |
9095d37b | 545 | or after (FALSE) the position in the boot script table\r |
fe69ac84 | 546 | specified by Position.\r |
9095d37b | 547 | @param CreateIfNotFound Specifies whether the label will be created if the\r |
fe69ac84 | 548 | label does not exists (TRUE) or not (FALSE).\r |
9095d37b LG |
549 | @param Position On entry, specifies the position in the boot script\r |
550 | table where the opcode will be inserted, either\r | |
551 | before or after, depending on BeforeOrAfter. On exit,\r | |
552 | specifies the positionof the inserted opcode in\r | |
fe69ac84 | 553 | the boot script table.\r |
9095d37b | 554 | @param Label Points to the label which will be inserted in the\r |
fe69ac84 | 555 | boot script table.\r |
9095d37b | 556 | @retval EFI_SUCCESS The operation succeeded. A record was added into\r |
fe69ac84 | 557 | the specified script table.\r |
9095d37b LG |
558 | @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script\r |
559 | is not supported. If the opcode is unknow or not\r | |
fe69ac84 | 560 | supported because of the PCD Feature Flags.\r |
561 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
9095d37b | 562 | @note The FRAMEWORK version implementation does not support this API\r |
fe69ac84 | 563 | \r |
564 | **/\r | |
565 | RETURN_STATUS\r | |
9095d37b | 566 | EFIAPI\r |
fe69ac84 | 567 | S3BootScriptLabel (\r |
568 | IN BOOLEAN BeforeOrAfter,\r | |
569 | IN BOOLEAN CreateIfNotFound,\r | |
570 | IN OUT VOID **Position OPTIONAL,\r | |
571 | IN CONST CHAR8 *Label\r | |
572 | );\r | |
573 | /**\r | |
574 | Compare two positions in the boot script table and return their relative position.\r | |
575 | @param Position1 The positions in the boot script table to compare\r | |
576 | @param Position2 The positions in the boot script table to compare\r | |
577 | @param RelativePosition On return, points to the result of the comparison\r | |
578 | \r | |
579 | @retval EFI_SUCCESS The operation succeeded. A record was added into the\r | |
580 | specified script table.\r | |
9095d37b | 581 | @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script\r |
fe69ac84 | 582 | is not supported. If the opcode is unknow or not s\r |
583 | upported because of the PCD Feature Flags.\r | |
584 | @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r | |
9095d37b | 585 | @note The FRAMEWORK version implementation does not support this API\r |
fe69ac84 | 586 | **/\r |
587 | RETURN_STATUS\r | |
9095d37b | 588 | EFIAPI\r |
fe69ac84 | 589 | S3BootScriptCompare (\r |
590 | IN UINT8 *Position1,\r | |
591 | IN UINT8 *Position2,\r | |
592 | OUT UINTN *RelativePosition\r | |
593 | );\r | |
594 | \r | |
595 | #endif\r |