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
12 #include <Library/S3BootScriptLib.h>
15 Save I/O write to boot script
17 @param Width the width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
18 @param Address The base address of the I/O operations.
19 @param Count The number of I/O operations to perform.
20 @param Buffer The source buffer from which to write data.
22 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
23 @retval RETURN_SUCCESS Opcode is added.
27 S3BootScriptSaveIoWrite (
28 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
34 return RETURN_SUCCESS
;
38 Adds a record for an I/O modify operation into a S3 boot script table
40 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
41 @param Address The base address of the I/O operations.
42 @param Data A pointer to the data to be OR-ed.
43 @param DataMask A pointer to the data mask to be AND-ed with the data read from the register
45 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
46 @retval RETURN_SUCCESS Opcode is added.
50 S3BootScriptSaveIoReadWrite (
51 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
57 return RETURN_SUCCESS
;
61 Adds a record for a memory write operation into a specified boot script table.
63 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
64 @param Address The base address of the memory operations
65 @param Count The number of memory operations to perform.
66 @param Buffer The source buffer from which to write the data.
68 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
69 @retval RETURN_SUCCESS Opcode is added.
73 S3BootScriptSaveMemWrite (
74 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
80 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
;
105 Adds a record for a PCI configuration space write operation into a specified boot script table.
107 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
108 @param Address The address within the PCI configuration space.
109 @param Count The number of PCI operations to perform.
110 @param Buffer The source buffer from which to write the data.
112 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
113 @retval RETURN_SUCCESS Opcode is added.
117 S3BootScriptSavePciCfgWrite (
118 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
124 return RETURN_SUCCESS
;
128 Adds a record for a PCI configuration space modify operation into a specified boot script table.
130 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
131 @param Address The address within the PCI configuration space.
132 @param Data A pointer to the data to be OR-ed.The size depends on Width.
133 @param DataMask A pointer to the data mask to be AND-ed.
135 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
136 @retval RETURN__SUCCESS Opcode is added.
140 S3BootScriptSavePciCfgReadWrite (
141 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
147 return RETURN_SUCCESS
;
150 Adds a record for a PCI configuration space modify operation into a specified boot script table.
152 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
153 @param Segment The PCI segment number for Address.
154 @param Address The address within the PCI configuration space.
155 @param Count The number of PCI operations to perform.
156 @param Buffer The source buffer from which to write the data.
158 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
159 @retval RETURN_SUCCESS Opcode is added.
163 S3BootScriptSavePciCfg2Write (
164 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
171 return RETURN_SUCCESS
;
174 Adds a record for a PCI configuration space modify operation into a specified boot script table.
176 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
177 @param Segment The PCI segment number for Address.
178 @param Address The address within the PCI configuration space.
179 @param Data A pointer to the data to be OR-ed. The size depends on Width.
180 @param DataMask A pointer to the data mask to be AND-ed.
182 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
183 @retval RETURN_SUCCESS Opcode is added.
187 S3BootScriptSavePciCfg2ReadWrite (
188 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
195 return RETURN_SUCCESS
;
198 Adds a record for an SMBus command execution into a specified boot script table.
200 @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC.
201 @param Operation Indicates which particular SMBus protocol it will use to execute the SMBus
203 @param Length A pointer to signify the number of bytes that this operation will do.
204 @param Buffer Contains the value of data to execute to the SMBUS slave device.
206 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
207 @retval RETURN_SUCCESS Opcode is added.
211 S3BootScriptSaveSmbusExecute (
212 IN UINTN SmBusAddress
,
213 IN EFI_SMBUS_OPERATION Operation
,
218 return RETURN_SUCCESS
;
221 Adds a record for an execution stall on the processor into a specified boot script table.
223 @param Duration Duration in microseconds of the stall
225 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
226 @retval RETURN_SUCCESS Opcode is added.
230 S3BootScriptSaveStall (
234 return RETURN_SUCCESS
;
237 Adds a record for dispatching specified arbitrary code into a specified boot script table.
239 @param EntryPoint Entry point of the code to be dispatched.
241 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
242 @retval RETURN_SUCCESS Opcode is added.
246 S3BootScriptSaveDispatch (
250 return RETURN_SUCCESS
;
253 Adds a record for dispatching specified arbitrary code into a specified boot script table.
255 @param EntryPoint Entry point of the code to be dispatched.
256 @param Context Argument to be passed into the EntryPoint of the code to be dispatched.
258 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
259 @retval RETURN_SUCCESS Opcode is added.
263 S3BootScriptSaveDispatch2 (
268 return RETURN_SUCCESS
;
272 Adds a record for memory reads of the memory location and continues when the exit criteria is
273 satisfied or after a defined duration.
275 Please aware, below interface is different with PI specification, Vol 5:
276 EFI_S3_SAVE_STATE_PROTOCOL.Write() for EFI_BOOT_SCRIPT_MEM_POLL_OPCODE.
277 "Duration" below is microseconds, while "Delay" in PI specification means
278 the number of 100ns units to poll.
280 @param Width The width of the memory operations.
281 @param Address The base address of the memory operations.
282 @param BitMask A pointer to the bit mask to be AND-ed with the data read from the register.
283 @param BitValue A pointer to the data value after to be Masked.
284 @param Duration Duration in microseconds of the stall.
285 @param LoopTimes The times of the register polling.
287 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
288 @retval RETURN_SUCCESS Opcode is added.
293 S3BootScriptSaveMemPoll (
294 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
302 return RETURN_SUCCESS
;
306 Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only
307 used for debugging script issues.
309 @param InformationLength Length of the data in bytes
310 @param Information Information to be logged in the boot scrpit
312 @retval RETURN_UNSUPPORTED If entering runtime, this method will not support.
313 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
314 @retval RETURN_SUCCESS Opcode is added.
319 S3BootScriptSaveInformation (
320 IN UINT32 InformationLength
,
324 return RETURN_SUCCESS
;
327 Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a
330 @param Width The width of the I/O operations.
331 @param Address The base address of the I/O operations.
332 @param Data The comparison value used for the polling exit criteria.
333 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
334 in Data are ignored when polling the memory address.
335 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
336 granularity so the delay may be longer.
338 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
339 @retval RETURN_SUCCESS Opcode is added.
344 S3BootScriptSaveIoPoll (
345 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
352 return RETURN_SUCCESS
;
356 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
357 after a defined duration.
359 @param Width The width of the I/O operations.
360 @param Address The address within the PCI configuration space.
361 @param Data The comparison value used for the polling exit criteria.
362 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
363 in Data are ignored when polling the memory address
364 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
365 granularity so the delay may be longer.
367 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
368 @retval RETURN_SUCCESS Opcode is added.
373 S3BootScriptSavePciPoll (
374 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
381 return RETURN_SUCCESS
;
384 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
385 after a defined duration.
387 @param Width The width of the I/O operations.
388 @param Segment The PCI segment number for Address.
389 @param Address The address within the PCI configuration space.
390 @param Data The comparison value used for the polling exit criteria.
391 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
392 in Data are ignored when polling the memory address
393 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
394 granularity so the delay may be longer.
396 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
397 @retval RETURN_SUCCESS Opcode is added.
398 @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
399 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as
400 Zero, or else, assert.
405 S3BootScriptSavePci2Poll (
406 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
414 return RETURN_SUCCESS
;
417 Save ASCII string information specified by Buffer to
418 boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE
420 @param String the ascii string to store into the S3 boot script table
422 @retval RETURN_NOT_FOUND BootScriptSave Protocol not exist.
423 @retval RETURN_SUCCESS BootScriptSave Protocol exist, always returns RETURN_SUCCESS
428 S3BootScriptSaveInformationAsciiString (
429 IN CONST CHAR8
*String
432 return RETURN_SUCCESS
;
435 This is an function to close the S3 boot script table. The function could only be called in
436 BOOT time phase. To comply with the Framework spec definition on
437 EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:
438 1. Closes the specified boot script table
439 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table.
440 Once this function is called, the table maintained by the library will be destroyed
441 after it is copied into the allocated pool.
442 3. Any attempts to add a script record after calling this function will cause a new table
443 to be created by the library.
444 4. The base address of the allocated pool will be returned in Address. Note that after
445 using the boot script table, the CALLER is responsible for freeing the pool that is allocated
448 In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. By then it is not
449 necessary to provide this API in BootScriptLib. To provides this API for now is only to meet
450 the requirement from Framework Spec.
452 If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out
453 how to get the script to run on an S3 resume because the boot script maintained by the lib will be
456 @return the base address of the new copy of the boot script table.
461 S3BootScriptCloseTable (
468 Executes the S3 boot script table.
470 @param RETURN_SUCCESS The boot script table was executed successfully.
471 @param RETURN_UNSUPPORTED Invalid script table or opcode.
475 S3BootScriptExecute (
479 return RETURN_SUCCESS
;
482 Move the last boot script entry to the position
484 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position
485 in the boot script table specified by Position. If Position is NULL or points to
486 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end
487 of the table (if FALSE).
488 @param Position On entry, specifies the position in the boot script table where the opcode will be
489 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies
490 the position of the inserted opcode in the boot script table.
492 @retval RETURN_OUT_OF_RESOURCES The table is not available.
493 @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.
494 @retval RETURN_SUCCESS Opcode is inserted.
498 S3BootScriptMoveLastOpcode (
499 IN BOOLEAN BeforeOrAfter
,
500 IN OUT VOID
**Position OPTIONAL
503 return RETURN_SUCCESS
;
506 Find a label within the boot script table and, if not present, optionally create it.
508 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)
509 or after (FALSE) the position in the boot script table
510 specified by Position.
511 @param CreateIfNotFound Specifies whether the label will be created if the label
512 does not exists (TRUE) or not (FALSE).
513 @param Position On entry, specifies the position in the boot script table
514 where the opcode will be inserted, either before or after,
515 depending on BeforeOrAfter. On exit, specifies the position
516 of the inserted opcode in the boot script table.
517 @param Label Points to the label which will be inserted in the boot script table.
519 @retval EFI_SUCCESS The operation succeeded. A record was added into the
520 specified script table.
521 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
522 If the opcode is unknow or not supported because of the PCD
524 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
530 IN BOOLEAN BeforeOrAfter
,
531 IN BOOLEAN CreateIfNotFound
,
532 IN OUT VOID
**Position OPTIONAL
,
533 IN CONST CHAR8
*Label
536 return RETURN_SUCCESS
;
539 Compare two positions in the boot script table and return their relative position.
540 @param Position1 The positions in the boot script table to compare
541 @param Position2 The positions in the boot script table to compare
542 @param RelativePosition On return, points to the result of the comparison
544 @retval EFI_SUCCESS The operation succeeded. A record was added into the
545 specified script table.
546 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
547 If the opcode is unknow or not supported because of the PCD
549 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
554 S3BootScriptCompare (
557 OUT UINTN
*RelativePosition
560 return RETURN_SUCCESS
;