2 Null function implementation for EFI S3 boot script.
4 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/S3BootScriptLib.h>
14 Save I/O write to boot script
16 @param Width the width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
17 @param Address The base address of the I/O operations.
18 @param Count The number of I/O operations to perform.
19 @param Buffer The source buffer from which to write data.
21 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
22 @retval RETURN_SUCCESS Opcode is added.
26 S3BootScriptSaveIoWrite (
27 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
33 return RETURN_SUCCESS
;
37 Adds a record for an I/O modify operation into a S3 boot script table
39 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
40 @param Address The base address of the I/O operations.
41 @param Data A pointer to the data to be OR-ed.
42 @param DataMask A pointer to the data mask to be AND-ed with the data read from the register
44 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
45 @retval RETURN_SUCCESS Opcode is added.
49 S3BootScriptSaveIoReadWrite (
50 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
56 return RETURN_SUCCESS
;
60 Adds a record for a memory write operation into a specified boot script table.
62 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
63 @param Address The base address of the memory operations
64 @param Count The number of memory operations to perform.
65 @param Buffer The source buffer from which to write the data.
67 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
68 @retval RETURN_SUCCESS Opcode is added.
72 S3BootScriptSaveMemWrite (
73 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
79 return RETURN_SUCCESS
;
83 Adds a record for a memory modify operation into a specified boot script table.
85 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
86 @param Address The base address of the memory operations. Address needs alignment if required
87 @param Data A pointer to the data to be OR-ed.
88 @param DataMask A pointer to the data mask to be AND-ed with the data read from the register.
90 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
91 @retval RETURN_SUCCESS Opcode is added.
95 S3BootScriptSaveMemReadWrite (
96 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
102 return RETURN_SUCCESS
;
106 Adds a record for a PCI configuration space write operation into a specified boot script table.
108 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
109 @param Address The address within the PCI configuration space.
110 @param Count The number of PCI operations to perform.
111 @param Buffer The source buffer from which to write the data.
113 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
114 @retval RETURN_SUCCESS Opcode is added.
118 S3BootScriptSavePciCfgWrite (
119 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
125 return RETURN_SUCCESS
;
129 Adds a record for a PCI configuration space modify operation into a specified boot script table.
131 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
132 @param Address The address within the PCI configuration space.
133 @param Data A pointer to the data to be OR-ed.The size depends on Width.
134 @param DataMask A pointer to the data mask to be AND-ed.
136 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
137 @retval RETURN__SUCCESS Opcode is added.
141 S3BootScriptSavePciCfgReadWrite (
142 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
148 return RETURN_SUCCESS
;
152 Adds a record for a PCI configuration space modify operation into a specified boot script table.
154 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
155 @param Segment The PCI segment number for Address.
156 @param Address The address within the PCI configuration space.
157 @param Count The number of PCI operations to perform.
158 @param Buffer The source buffer from which to write the data.
160 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
161 @retval RETURN_SUCCESS Opcode is added.
165 S3BootScriptSavePciCfg2Write (
166 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
173 return RETURN_SUCCESS
;
177 Adds a record for a PCI configuration space modify operation into a specified boot script table.
179 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
180 @param Segment The PCI segment number for Address.
181 @param Address The address within the PCI configuration space.
182 @param Data A pointer to the data to be OR-ed. The size depends on Width.
183 @param DataMask A pointer to the data mask to be AND-ed.
185 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
186 @retval RETURN_SUCCESS Opcode is added.
190 S3BootScriptSavePciCfg2ReadWrite (
191 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
198 return RETURN_SUCCESS
;
202 Adds a record for an SMBus command execution into a specified boot script table.
204 @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC.
205 @param Operation Indicates which particular SMBus protocol it will use to execute the SMBus
207 @param Length A pointer to signify the number of bytes that this operation will do.
208 @param Buffer Contains the value of data to execute to the SMBUS slave device.
210 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
211 @retval RETURN_SUCCESS Opcode is added.
215 S3BootScriptSaveSmbusExecute (
216 IN UINTN SmBusAddress
,
217 IN EFI_SMBUS_OPERATION Operation
,
222 return RETURN_SUCCESS
;
226 Adds a record for an execution stall on the processor into a specified boot script table.
228 @param Duration Duration in microseconds of the stall
230 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
231 @retval RETURN_SUCCESS Opcode is added.
235 S3BootScriptSaveStall (
239 return RETURN_SUCCESS
;
243 Adds a record for dispatching specified arbitrary code into a specified boot script table.
245 @param EntryPoint Entry point of the code to be dispatched.
247 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
248 @retval RETURN_SUCCESS Opcode is added.
252 S3BootScriptSaveDispatch (
256 return RETURN_SUCCESS
;
260 Adds a record for dispatching specified arbitrary code into a specified boot script table.
262 @param EntryPoint Entry point of the code to be dispatched.
263 @param Context Argument to be passed into the EntryPoint of the code to be dispatched.
265 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
266 @retval RETURN_SUCCESS Opcode is added.
270 S3BootScriptSaveDispatch2 (
275 return RETURN_SUCCESS
;
279 Adds a record for memory reads of the memory location and continues when the exit criteria is
280 satisfied or after a defined duration.
282 Please aware, below interface is different with PI specification, Vol 5:
283 EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE.
284 "Duration" below is microseconds, while "Delay" in PI specification means
285 the number of 100ns units to poll.
287 @param Width The width of the memory operations.
288 @param Address The base address of the memory operations.
289 @param BitMask A pointer to the bit mask to be AND-ed with the data read from the register.
290 @param BitValue A pointer to the data value after to be Masked.
291 @param Duration Duration in microseconds of the stall.
292 @param LoopTimes The times of the register polling.
294 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
295 @retval RETURN_SUCCESS Opcode is added.
300 S3BootScriptSaveMemPoll (
301 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
309 return RETURN_SUCCESS
;
313 Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only
314 used for debugging script issues.
316 @param InformationLength Length of the data in bytes
317 @param Information Information to be logged in the boot scrpit
319 @retval RETURN_UNSUPPORTED If entering runtime, this method will not support.
320 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
321 @retval RETURN_SUCCESS Opcode is added.
326 S3BootScriptSaveInformation (
327 IN UINT32 InformationLength
,
331 return RETURN_SUCCESS
;
335 Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a
338 @param Width The width of the I/O operations.
339 @param Address The base address of the I/O operations.
340 @param Data The comparison value used for the polling exit criteria.
341 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
342 in Data are ignored when polling the memory address.
343 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
344 granularity so the delay may be longer.
346 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
347 @retval RETURN_SUCCESS Opcode is added.
352 S3BootScriptSaveIoPoll (
353 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
360 return RETURN_SUCCESS
;
364 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
365 after a defined duration.
367 @param Width The width of the I/O operations.
368 @param Address The address within the PCI configuration space.
369 @param Data The comparison value used for the polling exit criteria.
370 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
371 in Data are ignored when polling the memory address
372 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
373 granularity so the delay may be longer.
375 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
376 @retval RETURN_SUCCESS Opcode is added.
381 S3BootScriptSavePciPoll (
382 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
389 return RETURN_SUCCESS
;
393 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
394 after a defined duration.
396 @param Width The width of the I/O operations.
397 @param Segment The PCI segment number for Address.
398 @param Address The address within the PCI configuration space.
399 @param Data The comparison value used for the polling exit criteria.
400 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
401 in Data are ignored when polling the memory address
402 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
403 granularity so the delay may be longer.
405 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
406 @retval RETURN_SUCCESS Opcode is added.
407 @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
408 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as
409 Zero, or else, assert.
414 S3BootScriptSavePci2Poll (
415 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
423 return RETURN_SUCCESS
;
427 Save ASCII string information specified by Buffer to
428 boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE
430 @param String the ascii string to store into the S3 boot script table
432 @retval RETURN_NOT_FOUND BootScriptSave Protocol not exist.
433 @retval RETURN_SUCCESS BootScriptSave Protocol exist, always returns RETURN_SUCCESS
438 S3BootScriptSaveInformationAsciiString (
439 IN CONST CHAR8
*String
442 return RETURN_SUCCESS
;
446 This is an function to close the S3 boot script table. The function could only be called in
447 BOOT time phase. To comply with the Framework spec definition on
448 EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:
449 1. Closes the specified boot script table
450 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table.
451 Once this function is called, the table maintained by the library will be destroyed
452 after it is copied into the allocated pool.
453 3. Any attempts to add a script record after calling this function will cause a new table
454 to be created by the library.
455 4. The base address of the allocated pool will be returned in Address. Note that after
456 using the boot script table, the CALLER is responsible for freeing the pool that is allocated
459 In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. By then it is not
460 necessary to provide this API in BootScriptLib. To provides this API for now is only to meet
461 the requirement from Framework Spec.
463 If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out
464 how to get the script to run on an S3 resume because the boot script maintained by the lib will be
467 @return the base address of the new copy of the boot script table.
472 S3BootScriptCloseTable (
480 Executes the S3 boot script table.
482 @param RETURN_SUCCESS The boot script table was executed successfully.
483 @param RETURN_UNSUPPORTED Invalid script table or opcode.
487 S3BootScriptExecute (
491 return RETURN_SUCCESS
;
495 Move the last boot script entry to the position
497 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position
498 in the boot script table specified by Position. If Position is NULL or points to
499 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end
500 of the table (if FALSE).
501 @param Position On entry, specifies the position in the boot script table where the opcode will be
502 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies
503 the position of the inserted opcode in the boot script table.
505 @retval RETURN_OUT_OF_RESOURCES The table is not available.
506 @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.
507 @retval RETURN_SUCCESS Opcode is inserted.
511 S3BootScriptMoveLastOpcode (
512 IN BOOLEAN BeforeOrAfter
,
513 IN OUT VOID
**Position OPTIONAL
516 return RETURN_SUCCESS
;
520 Find a label within the boot script table and, if not present, optionally create it.
522 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)
523 or after (FALSE) the position in the boot script table
524 specified by Position.
525 @param CreateIfNotFound Specifies whether the label will be created if the label
526 does not exists (TRUE) or not (FALSE).
527 @param Position On entry, specifies the position in the boot script table
528 where the opcode will be inserted, either before or after,
529 depending on BeforeOrAfter. On exit, specifies the position
530 of the inserted opcode in the boot script table.
531 @param Label Points to the label which will be inserted in the boot script table.
533 @retval EFI_SUCCESS The operation succeeded. A record was added into the
534 specified script table.
535 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
536 If the opcode is unknow or not supported because of the PCD
538 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
544 IN BOOLEAN BeforeOrAfter
,
545 IN BOOLEAN CreateIfNotFound
,
546 IN OUT VOID
**Position OPTIONAL
,
547 IN CONST CHAR8
*Label
550 return RETURN_SUCCESS
;
554 Compare two positions in the boot script table and return their relative position.
555 @param Position1 The positions in the boot script table to compare
556 @param Position2 The positions in the boot script table to compare
557 @param RelativePosition On return, points to the result of the comparison
559 @retval EFI_SUCCESS The operation succeeded. A record was added into the
560 specified script table.
561 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
562 If the opcode is unknow or not supported because of the PCD
564 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
569 S3BootScriptCompare (
572 OUT UINTN
*RelativePosition
575 return RETURN_SUCCESS
;