]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/S3BootScriptLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Library / S3BootScriptLib.h
CommitLineData
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
2f88bd3a 33#define S3_BOOT_SCRIPT_LIB_PCI_ADDRESS(Bus, Device, Function, Register) \\r
fe69ac84 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
43typedef 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
72RETURN_STATUS\r
73EFIAPI\r
74S3BootScriptSaveIoWrite (\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
95RETURN_STATUS\r
96EFIAPI\r
97S3BootScriptSaveIoReadWrite (\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
116RETURN_STATUS\r
117EFIAPI\r
118S3BootScriptSaveMemWrite (\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
139RETURN_STATUS\r
140EFIAPI\r
141S3BootScriptSaveMemReadWrite (\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
160RETURN_STATUS\r
161EFIAPI\r
162S3BootScriptSavePciCfgWrite (\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
181RETURN_STATUS\r
182EFIAPI\r
183S3BootScriptSavePciCfgReadWrite (\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
203RETURN_STATUS\r
204EFIAPI\r
205S3BootScriptSavePciCfg2Write (\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
226RETURN_STATUS\r
227EFIAPI\r
228S3BootScriptSavePciCfg2ReadWrite (\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
252RETURN_STATUS\r
253EFIAPI\r
254S3BootScriptSaveSmbusExecute (\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
270RETURN_STATUS\r
271EFIAPI\r
272S3BootScriptSaveStall (\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
287RETURN_STATUS\r
288EFIAPI\r
289S3BootScriptSaveDispatch2 (\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
303RETURN_STATUS\r
304EFIAPI\r
305S3BootScriptSaveDispatch (\r
2f88bd3a 306 IN VOID *EntryPoint\r
fe69ac84 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
331RETURN_STATUS\r
332EFIAPI\r
333S3BootScriptSaveMemPoll (\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
354RETURN_STATUS\r
355EFIAPI\r
356S3BootScriptSaveInformation (\r
9095d37b 357 IN UINT32 InformationLength,\r
fe69ac84 358 IN VOID *Information\r
359 );\r
2f88bd3a 360\r
fe69ac84 361/**\r
362 Adds a record for I/O reads the I/O location and continues when the exit criteria\r
363 is satisfied, or after a defined duration.\r
9095d37b
LG
364\r
365 @param Width The width of the I/O operations.\r
fe69ac84 366 @param Address The base address of the I/O operations.\r
367 @param Data The comparison value used for the polling exit criteria.\r
9095d37b
LG
368 @param DataMask The mask used for the polling criteria. The bits in\r
369 the bytes below Width which are zero in Data are\r
fe69ac84 370 ignored when polling the memory address.\r
9095d37b
LG
371 @param Delay The number of 100ns units to poll. Note that timer\r
372 available may be of insufficient granularity, so the\r
fe69ac84 373 delay may be longer.\r
374\r
9095d37b 375 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform the\r
fe69ac84 376 operation.\r
377 @retval RETURN_SUCCESS The opcode was added.\r
9095d37b 378 @note The FRAMEWORK version implementation does not support this API\r
fe69ac84 379**/\r
380RETURN_STATUS\r
381EFIAPI\r
382S3BootScriptSaveIoPoll (\r
2f88bd3a
MK
383 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
384 IN UINT64 Address,\r
fe69ac84 385 IN VOID *Data,\r
9095d37b 386 IN VOID *DataMask,\r
2f88bd3a 387 IN UINT64 Delay\r
fe69ac84 388 );\r
389\r
390/**\r
9095d37b 391 Adds a record for PCI configuration space reads and continues when the exit\r
fe69ac84 392 criteria is satisfied ,or after a defined duration.\r
393\r
9095d37b 394 @param Width The width of the I/O operations.\r
fe69ac84 395 @param Address The address within the PCI configuration space.\r
9095d37b 396 @param Data The comparison value used for the polling exit\r
fe69ac84 397 criteria.\r
9095d37b 398 @param DataMask Mask used for the polling criteria. The bits in\r
fe69ac84 399 the bytes below Width which are zero in Data are\r
400 ignored when polling the memory address.\r
9095d37b
LG
401 @param Delay The number of 100ns units to poll. Note that timer\r
402 available may be of insufficient granularity, so the\r
fe69ac84 403 delay may be longer.\r
404\r
9095d37b 405 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform the\r
fe69ac84 406 operation.\r
407 @retval RETURN_SUCCESS The opcode was added.\r
9095d37b 408 @note The FRAMEWORK version implementation does not support this API\r
fe69ac84 409**/\r
410RETURN_STATUS\r
411EFIAPI\r
412S3BootScriptSavePciPoll (\r
2f88bd3a
MK
413 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
414 IN UINT64 Address,\r
415 IN VOID *Data,\r
416 IN VOID *DataMask,\r
417 IN UINT64 Delay\r
fe69ac84 418 );\r
2f88bd3a 419\r
fe69ac84 420/**\r
9095d37b 421 Adds a record for PCI configuration space reads and continues when the exit criteria\r
fe69ac84 422 is satisfied, or after a defined duration.\r
423\r
9095d37b 424 @param Width The width of the I/O operations.\r
fe69ac84 425 @param Segment The PCI segment number for Address.\r
426 @param Address The address within the PCI configuration space.\r
9095d37b 427 @param Data The comparison value used for the polling exit\r
fe69ac84 428 criteria.\r
9095d37b 429 @param DataMask Mask used for the polling criteria. The bits in\r
fe69ac84 430 the bytes below Width which are zero\r
431 in Data are ignored when polling the memory address\r
9095d37b
LG
432 @param Delay The number of 100ns units to poll. Note that timer\r
433 available may be of insufficient granularity so the delay\r
fe69ac84 434 may be longer.\r
435\r
9095d37b 436 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform the\r
fe69ac84 437 operation.\r
438 @retval RETURN_SUCCESS The opcode was added.\r
9095d37b 439 @note A known Limitations in the implementation: When interpreting the opcode\r
fe69ac84 440 EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE, EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE\r
9095d37b 441 and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as\r
fe69ac84 442 Zero, or else, assert.\r
443 The FRAMEWORK version implementation does not support this API.\r
444\r
445**/\r
446RETURN_STATUS\r
447EFIAPI\r
448S3BootScriptSavePci2Poll (\r
2f88bd3a
MK
449 IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
450 IN UINT16 Segment,\r
451 IN UINT64 Address,\r
452 IN VOID *Data,\r
453 IN VOID *DataMask,\r
454 IN UINT64 Delay\r
fe69ac84 455 );\r
2f88bd3a 456\r
fe69ac84 457/**\r
9095d37b 458 Save ASCII string information specified by Buffer to boot script with opcode\r
fe69ac84 459 EFI_BOOT_SCRIPT_INFORMATION_OPCODE.\r
460\r
9095d37b 461 @param[in] String The Null-terminated ASCII string to store into the S3 boot\r
fe69ac84 462 script table.\r
463\r
9095d37b 464 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table to perform\r
fe69ac84 465 the operation.\r
466 @retval RETURN_SUCCESS The opcode was added.\r
467\r
468**/\r
469RETURN_STATUS\r
470EFIAPI\r
471S3BootScriptSaveInformationAsciiString (\r
472 IN CONST CHAR8 *String\r
473 );\r
474\r
475/**\r
9095d37b
LG
476 This is an function to close the S3 boot script table. The function could only\r
477 be called in BOOT time phase. To comply with the Framework spec definition on\r
fe69ac84 478 EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:\r
479 1. Closes the specified boot script table\r
9095d37b
LG
480 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table.\r
481 Once this function is called, the table maintained by the library will be destroyed\r
fe69ac84 482 after it is copied into the allocated pool.\r
9095d37b 483 3. Any attempts to add a script record after calling this function will cause a\r
fe69ac84 484 new table to be created by the library.\r
9095d37b
LG
485 4. The base address of the allocated pool will be returned in Address. Note that\r
486 after using the boot script table, the CALLER is responsible for freeing the\r
487 pool that is allocated by this function.\r
fe69ac84 488\r
9095d37b 489 In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. This\r
fe69ac84 490 API is supplied here to meet the requirements of the Framework Spec.\r
9095d37b 491\r
fe69ac84 492 If anyone does call CloseTable() on a real platform, then the caller is responsible\r
9095d37b 493 for figuring out how to get the script to run on an S3 resume because the boot script\r
fe69ac84 494 maintained by the lib will be destroyed.\r
9095d37b
LG
495\r
496 @return the base address of the new copy of the boot script table.\r
fe69ac84 497\r
498**/\r
2f88bd3a 499UINT8 *\r
fe69ac84 500EFIAPI\r
501S3BootScriptCloseTable (\r
502 VOID\r
503 );\r
504\r
505/**\r
506 Executes the S3 boot script table.\r
507\r
508 @retval RETURN_SUCCESS The boot script table was executed successfully.\r
9095d37b 509 @retval RETURN_UNSUPPORTED Invalid script table or opcode.\r
fe69ac84 510\r
511**/\r
512RETURN_STATUS\r
513EFIAPI\r
514S3BootScriptExecute (\r
515 VOID\r
516 );\r
2f88bd3a 517\r
fe69ac84 518/**\r
9095d37b 519 Move the last boot script entry to the position\r
fe69ac84 520\r
9095d37b
LG
521 @param BeforeOrAfter Specifies whether the opcode is stored before\r
522 (TRUE) or after (FALSE) the positionin the boot\r
523 script table specified by Position. If Position\r
524 is NULL or points to NULL then the new opcode is\r
525 inserted at the beginning of the table (if TRUE)\r
fe69ac84 526 or end of the table (if FALSE).\r
9095d37b
LG
527 @param Position On entry, specifies the position in the boot script\r
528 table where the opcode will be inserted, either\r
529 before or after, depending on BeforeOrAfter. On\r
530 exit, specifies the position of the inserted opcode\r
fe69ac84 531 in the boot script table.\r
532\r
533 @retval RETURN_OUT_OF_RESOURCES The table is not available.\r
9095d37b 534 @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the\r
fe69ac84 535 boot script table.\r
536 @retval RETURN_SUCCESS The opcode was inserted.\r
9095d37b 537 @note The FRAMEWORK version implementation does not support this API.\r
fe69ac84 538**/\r
539RETURN_STATUS\r
540EFIAPI\r
541S3BootScriptMoveLastOpcode (\r
2f88bd3a
MK
542 IN BOOLEAN BeforeOrAfter,\r
543 IN OUT VOID **Position OPTIONAL\r
fe69ac84 544 );\r
2f88bd3a 545\r
fe69ac84 546/**\r
547 Find a label within the boot script table and, if not present, optionally create it.\r
548\r
549 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)\r
9095d37b 550 or after (FALSE) the position in the boot script table\r
fe69ac84 551 specified by Position.\r
9095d37b 552 @param CreateIfNotFound Specifies whether the label will be created if the\r
fe69ac84 553 label does not exists (TRUE) or not (FALSE).\r
9095d37b
LG
554 @param Position On entry, specifies the position in the boot script\r
555 table where the opcode will be inserted, either\r
556 before or after, depending on BeforeOrAfter. On exit,\r
557 specifies the positionof the inserted opcode in\r
fe69ac84 558 the boot script table.\r
9095d37b 559 @param Label Points to the label which will be inserted in the\r
fe69ac84 560 boot script table.\r
9095d37b 561 @retval EFI_SUCCESS The operation succeeded. A record was added into\r
fe69ac84 562 the specified script table.\r
9095d37b
LG
563 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script\r
564 is not supported. If the opcode is unknow or not\r
fe69ac84 565 supported because of the PCD Feature Flags.\r
566 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
9095d37b 567 @note The FRAMEWORK version implementation does not support this API\r
fe69ac84 568\r
569**/\r
570RETURN_STATUS\r
9095d37b 571EFIAPI\r
fe69ac84 572S3BootScriptLabel (\r
2f88bd3a
MK
573 IN BOOLEAN BeforeOrAfter,\r
574 IN BOOLEAN CreateIfNotFound,\r
575 IN OUT VOID **Position OPTIONAL,\r
576 IN CONST CHAR8 *Label\r
fe69ac84 577 );\r
2f88bd3a 578\r
fe69ac84 579/**\r
580 Compare two positions in the boot script table and return their relative position.\r
581 @param Position1 The positions in the boot script table to compare\r
582 @param Position2 The positions in the boot script table to compare\r
583 @param RelativePosition On return, points to the result of the comparison\r
584\r
585 @retval EFI_SUCCESS The operation succeeded. A record was added into the\r
586 specified script table.\r
9095d37b 587 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script\r
fe69ac84 588 is not supported. If the opcode is unknow or not s\r
589 upported because of the PCD Feature Flags.\r
590 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
9095d37b 591 @note The FRAMEWORK version implementation does not support this API\r
fe69ac84 592**/\r
593RETURN_STATUS\r
9095d37b 594EFIAPI\r
fe69ac84 595S3BootScriptCompare (\r
2f88bd3a
MK
596 IN UINT8 *Position1,\r
597 IN UINT8 *Position2,\r
598 OUT UINTN *RelativePosition\r
fe69ac84 599 );\r
600\r
601#endif\r