2 Null function implementation for EFI S3 boot script.
4 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions
8 of the BSD License which accompanies this distribution. The
9 full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Library/S3BootScriptLib.h>
22 Save I/O write to boot script
24 @param Width the width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
25 @param Address The base address of the I/O operations.
26 @param Count The number of I/O operations to perform.
27 @param Buffer The source buffer from which to write data.
29 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
30 @retval RETURN_SUCCESS Opcode is added.
34 S3BootScriptSaveIoWrite (
35 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
41 return RETURN_SUCCESS
;
45 Adds a record for an I/O modify operation into a S3 boot script table
47 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
48 @param Address The base address of the I/O operations.
49 @param Data A pointer to the data to be OR-ed.
50 @param DataMask A pointer to the data mask to be AND-ed with the data read from the register
52 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
53 @retval RETURN_SUCCESS Opcode is added.
57 S3BootScriptSaveIoReadWrite (
58 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
64 return RETURN_SUCCESS
;
68 Adds a record for a memory write operation into a specified boot script table.
70 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
71 @param Address The base address of the memory operations
72 @param Count The number of memory operations to perform.
73 @param Buffer The source buffer from which to write the data.
75 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
76 @retval RETURN_SUCCESS Opcode is added.
80 S3BootScriptSaveMemWrite (
81 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
87 return RETURN_SUCCESS
;
90 Adds a record for a memory modify operation into a specified boot script table.
92 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
93 @param Address The base address of the memory operations. Address needs alignment if required
94 @param Data A pointer to the data to be OR-ed.
95 @param DataMask A pointer to the data mask to be AND-ed with the data read from the register.
97 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
98 @retval RETURN_SUCCESS Opcode is added.
102 S3BootScriptSaveMemReadWrite (
103 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
109 return RETURN_SUCCESS
;
112 Adds a record for a PCI configuration space write operation into a specified boot script table.
114 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
115 @param Address The address within the PCI configuration space.
116 @param Count The number of PCI operations to perform.
117 @param Buffer The source buffer from which to write the data.
119 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
120 @retval RETURN_SUCCESS Opcode is added.
124 S3BootScriptSavePciCfgWrite (
125 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
131 return RETURN_SUCCESS
;
135 Adds a record for a PCI configuration space modify operation into a specified boot script table.
137 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
138 @param Address The address within the PCI configuration space.
139 @param Data A pointer to the data to be OR-ed.The size depends on Width.
140 @param DataMask A pointer to the data mask to be AND-ed.
142 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
143 @retval RETURN__SUCCESS Opcode is added.
147 S3BootScriptSavePciCfgReadWrite (
148 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
154 return RETURN_SUCCESS
;
157 Adds a record for a PCI configuration space modify operation into a specified boot script table.
159 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
160 @param Segment The PCI segment number for Address.
161 @param Address The address within the PCI configuration space.
162 @param Count The number of PCI operations to perform.
163 @param Buffer The source buffer from which to write the data.
165 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
166 @retval RETURN_SUCCESS Opcode is added.
170 S3BootScriptSavePciCfg2Write (
171 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
178 return RETURN_SUCCESS
;
181 Adds a record for a PCI configuration space modify operation into a specified boot script table.
183 @param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.
184 @param Segment The PCI segment number for Address.
185 @param Address The address within the PCI configuration space.
186 @param Data A pointer to the data to be OR-ed. The size depends on Width.
187 @param DataMask A pointer to the data mask to be AND-ed.
189 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
190 @retval RETURN_SUCCESS Opcode is added.
194 S3BootScriptSavePciCfg2ReadWrite (
195 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
202 return RETURN_SUCCESS
;
205 Adds a record for an SMBus command execution into a specified boot script table.
207 @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC.
208 @param Operation Indicates which particular SMBus protocol it will use to execute the SMBus
210 @param Length A pointer to signify the number of bytes that this operation will do.
211 @param Buffer Contains the value of data to execute to the SMBUS slave device.
213 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
214 @retval RETURN_SUCCESS Opcode is added.
218 S3BootScriptSaveSmbusExecute (
219 IN UINTN SmBusAddress
,
220 IN EFI_SMBUS_OPERATION Operation
,
225 return RETURN_SUCCESS
;
228 Adds a record for an execution stall on the processor into a specified boot script table.
230 @param Duration Duration in microseconds of the stall
232 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
233 @retval RETURN_SUCCESS Opcode is added.
237 S3BootScriptSaveStall (
241 return RETURN_SUCCESS
;
244 Adds a record for dispatching specified arbitrary code into a specified boot script table.
246 @param EntryPoint Entry point of the code to be dispatched.
248 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
249 @retval RETURN_SUCCESS Opcode is added.
253 S3BootScriptSaveDispatch (
257 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 @param Width The width of the memory operations.
283 @param Address The base address of the memory operations.
284 @param BitMask A pointer to the bit mask to be AND-ed with the data read from the register.
285 @param BitValue A pointer to the data value after to be Masked.
286 @param Duration Duration in microseconds of the stall.
287 @param LoopTimes The times of the register polling.
289 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
290 @retval RETURN_SUCCESS Opcode is added.
295 S3BootScriptSaveMemPoll (
296 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
304 return RETURN_SUCCESS
;
308 Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only
309 used for debugging script issues.
311 @param InformationLength Length of the data in bytes
312 @param Information Information to be logged in the boot scrpit
314 @retval RETURN_UNSUPPORTED If entering runtime, this method will not support.
315 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
316 @retval RETURN_SUCCESS Opcode is added.
321 S3BootScriptSaveInformation (
322 IN UINT32 InformationLength
,
326 return RETURN_SUCCESS
;
329 Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a
332 @param Width The width of the I/O operations.
333 @param Address The base address of the I/O operations.
334 @param Data The comparison value used for the polling exit criteria.
335 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
336 in Data are ignored when polling the memory address.
337 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
338 granularity so the delay may be longer.
340 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
341 @retval RETURN_SUCCESS Opcode is added.
346 S3BootScriptSaveIoPoll (
347 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
354 return RETURN_SUCCESS
;
358 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
359 after a defined duration.
361 @param Width The width of the I/O operations.
362 @param Address The address within the PCI configuration space.
363 @param Data The comparison value used for the polling exit criteria.
364 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
365 in Data are ignored when polling the memory address
366 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
367 granularity so the delay may be longer.
369 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
370 @retval RETURN_SUCCESS Opcode is added.
375 S3BootScriptSavePciPoll (
376 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
383 return RETURN_SUCCESS
;
386 Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or
387 after a defined duration.
389 @param Width The width of the I/O operations.
390 @param Segment The PCI segment number for Address.
391 @param Address The address within the PCI configuration space.
392 @param Data The comparison value used for the polling exit criteria.
393 @param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero
394 in Data are ignored when polling the memory address
395 @param Delay The number of 100ns units to poll. Note that timer available may be of poorer
396 granularity so the delay may be longer.
398 @retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
399 @retval RETURN_SUCCESS Opcode is added.
400 @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE
401 EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as
402 Zero, or else, assert.
407 S3BootScriptSavePci2Poll (
408 IN S3_BOOT_SCRIPT_LIB_WIDTH Width
,
416 return RETURN_SUCCESS
;
419 Save ASCII string information specified by Buffer to
420 boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE
422 @param String the ascii string to store into the S3 boot script table
424 @retval RETURN_NOT_FOUND BootScriptSave Protocol not exist.
425 @retval RETURN_SUCCESS BootScriptSave Protocol exist, always returns RETURN_SUCCESS
430 S3BootScriptSaveInformationAsciiString (
431 IN CONST CHAR8
*String
434 return RETURN_SUCCESS
;
437 This is an function to close the S3 boot script table. The function could only be called in
438 BOOT time phase. To comply with the Framework spec definition on
439 EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:
440 1. Closes the specified boot script table
441 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table.
442 Once this function is called, the table maintained by the library will be destroyed
443 after it is copied into the allocated pool.
444 3. Any attempts to add a script record after calling this function will cause a new table
445 to be created by the library.
446 4. The base address of the allocated pool will be returned in Address. Note that after
447 using the boot script table, the CALLER is responsible for freeing the pool that is allocated
450 In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. By then it is not
451 necessary to provide this API in BootScriptLib. To provides this API for now is only to meet
452 the requirement from Framework Spec.
454 If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out
455 how to get the script to run on an S3 resume because the boot script maintained by the lib will be
458 @return the base address of the new copy of the boot script table.
463 S3BootScriptCloseTable (
470 Executes the S3 boot script table.
472 @param RETURN_SUCCESS The boot script table was executed successfully.
473 @param RETURN_UNSUPPORTED Invalid script table or opcode.
477 S3BootScriptExecute (
481 return RETURN_SUCCESS
;
484 Move the last boot script entry to the position
486 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position
487 in the boot script table specified by Position. If Position is NULL or points to
488 NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end
489 of the table (if FALSE).
490 @param Position On entry, specifies the position in the boot script table where the opcode will be
491 inserted, either before or after, depending on BeforeOrAfter. On exit, specifies
492 the position of the inserted opcode in the boot script table.
494 @retval RETURN_OUT_OF_RESOURCES The table is not available.
495 @retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.
496 @retval RETURN_SUCCESS Opcode is inserted.
500 S3BootScriptMoveLastOpcode (
501 IN BOOLEAN BeforeOrAfter
,
502 IN OUT VOID
**Position OPTIONAL
505 return RETURN_SUCCESS
;
508 Find a label within the boot script table and, if not present, optionally create it.
510 @param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)
511 or after (FALSE) the position in the boot script table
512 specified by Position.
513 @param CreateIfNotFound Specifies whether the label will be created if the label
514 does not exists (TRUE) or not (FALSE).
515 @param Position On entry, specifies the position in the boot script table
516 where the opcode will be inserted, either before or after,
517 depending on BeforeOrAfter. On exit, specifies the position
518 of the inserted opcode in the boot script table.
519 @param Label Points to the label which will be inserted in the boot script table.
521 @retval EFI_SUCCESS The operation succeeded. A record was added into the
522 specified script table.
523 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
524 If the opcode is unknow or not supported because of the PCD
526 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
532 IN BOOLEAN BeforeOrAfter
,
533 IN BOOLEAN CreateIfNotFound
,
534 IN OUT VOID
**Position OPTIONAL
,
535 IN CONST CHAR8
*Label
538 return RETURN_SUCCESS
;
541 Compare two positions in the boot script table and return their relative position.
542 @param Position1 The positions in the boot script table to compare
543 @param Position2 The positions in the boot script table to compare
544 @param RelativePosition On return, points to the result of the comparison
546 @retval EFI_SUCCESS The operation succeeded. A record was added into the
547 specified script table.
548 @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
549 If the opcode is unknow or not supported because of the PCD
551 @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
556 S3BootScriptCompare (
559 OUT UINTN
*RelativePosition
562 return RETURN_SUCCESS
;