TianoCore EDK2 master
Loading...
Searching...
No Matches
BootScriptExecute.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS InternalSmbusExecute (IN UINTN SmbusAddress, IN EFI_SMBUS_OPERATION Operation, IN OUT UINTN *Length, IN OUT VOID *Buffer)
 
EFI_STATUS BuildLoopData (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, OUT UINTN *AddressStride, OUT UINTN *BufferStride)
 
EFI_STATUS ScriptIoRead (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
 
EFI_STATUS ScriptIoWrite (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
 
EFI_STATUS BootScriptExecuteIoWrite (IN UINT8 *Script)
 
EFI_STATUS ScriptMemoryRead (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS ScriptMemoryWrite (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS BootScriptExecuteMemoryWrite (IN UINT8 *Script)
 
EFI_STATUS ScriptPciCfg2Read (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
 
EFI_STATUS ScriptPciCfg2Write (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
 
EFI_STATUS ScriptPciCfgRead (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI ScriptPciCfgWrite (IN S3_BOOT_SCRIPT_LIB_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
 
EFI_STATUS BootScriptExecutePciCfgWrite (IN UINT8 *Script)
 
EFI_STATUS BootScriptExecuteIoReadWrite (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
EFI_STATUS BootScriptExecuteMemoryReadWrite (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
EFI_STATUS BootScriptExecutePciCfgReadWrite (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
EFI_STATUS BootScriptExecuteSmbusExecute (IN UINT8 *Script)
 
EFI_STATUS BootScriptExecuteStall (IN UINT8 *Script)
 
EFI_STATUS BootScriptExecuteDispatch (IN UINT8 *Script)
 
EFI_STATUS BootScriptExecuteDispatch2 (IN UINT8 *Script)
 
EFI_STATUS BootScriptExecuteMemPoll (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
VOID BootScriptExecuteInformation (IN UINT8 *Script)
 
VOID BootScriptExecuteLabel (IN UINT8 *Script)
 
VOID CheckAndOrMask (IN EFI_BOOT_SCRIPT_COMMON_HEADER *ScriptHeader, OUT UINT64 *AndMask, OUT UINT64 *OrMask, IN UINT8 *Script)
 
EFI_STATUS BootScriptExecuteIoPoll (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
EFI_STATUS BootScriptExecutePciCfg2Write (IN UINT8 *Script)
 
EFI_STATUS BootScriptExecutePciCfg2ReadWrite (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
EFI_STATUS BootScriptPciCfgPoll (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
EFI_STATUS BootScriptPciCfg2Poll (IN UINT8 *Script, IN UINT64 AndMask, IN UINT64 OrMask)
 
RETURN_STATUS EFIAPI S3BootScriptExecute (VOID)
 

Detailed Description

Interpret and execute the S3 data in S3 boot script.

Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file BootScriptExecute.c.

Function Documentation

◆ BootScriptExecuteDispatch()

EFI_STATUS BootScriptExecuteDispatch ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_DISPATCH OP code.

Parameters
ScriptThe pointer of typed node in boot script table
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 1106 of file BootScriptExecute.c.

◆ BootScriptExecuteDispatch2()

EFI_STATUS BootScriptExecuteDispatch2 ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_DISPATCH_2 OP code.

Parameters
ScriptThe pointer of typed node in boot script table
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 1131 of file BootScriptExecute.c.

◆ BootScriptExecuteInformation()

VOID BootScriptExecuteInformation ( IN UINT8 *  Script)

Execute the boot script to interpret the Store arbitrary information. This opcode is a no-op on dispatch and is only used for debugging script issues.

Parameters
ScriptThe pointer of node in boot script table

Definition at line 1218 of file BootScriptExecute.c.

◆ BootScriptExecuteIoPoll()

EFI_STATUS BootScriptExecuteIoPoll ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_IO_POLL OP code.

Parameters
ScriptThe pointer of typed node in boot script table
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_DEVICE_ERRORData polled from memory does not equal to the epecting data within the Loop Times.
EFI_SUCCESSThe operation was executed successfully

Definition at line 1366 of file BootScriptExecute.c.

◆ BootScriptExecuteIoReadWrite()

EFI_STATUS BootScriptExecuteIoReadWrite ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_IO_READ_WRITE OP code.

Parameters
ScriptThe pointer of typed node in boot script table
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 914 of file BootScriptExecute.c.

◆ BootScriptExecuteIoWrite()

EFI_STATUS BootScriptExecuteIoWrite ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_IO_WRITE OP code.

Parameters
ScriptPointer to the node which is to be interpreted.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. Address is outside the legal range of I/O ports.

Definition at line 385 of file BootScriptExecute.c.

◆ BootScriptExecuteLabel()

VOID BootScriptExecuteLabel ( IN UINT8 *  Script)

Execute the boot script to interpret the Label information.

Parameters
ScriptThe pointer of node in boot script table

Definition at line 1247 of file BootScriptExecute.c.

◆ BootScriptExecuteMemoryReadWrite()

EFI_STATUS BootScriptExecuteMemoryReadWrite ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_MEM_READ_WRITE OP code.

Parameters
ScriptThe pointer of typed node in boot script table
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 960 of file BootScriptExecute.c.

◆ BootScriptExecuteMemoryWrite()

EFI_STATUS BootScriptExecuteMemoryWrite ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_MEM_WRITE OP code.

Parameters
[in]ScriptPointer to the node which is to be interpreted.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width.
EFI_UNSUPPORTEDThe address range specified by Address, Width, and Count is not valid for this EFI System.

Definition at line 621 of file BootScriptExecute.c.

◆ BootScriptExecuteMemPoll()

EFI_STATUS BootScriptExecuteMemPoll ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_MEM_POLL OP code.

Parameters
ScriptThe pointer of typed node in boot script table
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_DEVICE_ERRORData polled from memory does not equal to the epecting data within the Loop Times.
EFI_SUCCESSThe operation was executed successfully

Definition at line 1162 of file BootScriptExecute.c.

◆ BootScriptExecutePciCfg2ReadWrite()

EFI_STATUS BootScriptExecutePciCfg2ReadWrite ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code.

Parameters
ScriptThe pointer of S3 boot script
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 1456 of file BootScriptExecute.c.

◆ BootScriptExecutePciCfg2Write()

EFI_STATUS BootScriptExecutePciCfg2Write ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE OP code.

Parameters
ScriptThe pointer of S3 boot script
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 1422 of file BootScriptExecute.c.

◆ BootScriptExecutePciCfgReadWrite()

EFI_STATUS BootScriptExecutePciCfgReadWrite ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CFG_READ_WRITE OP code.

Parameters
ScriptThe pointer of typed node in boot script table
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 1006 of file BootScriptExecute.c.

◆ BootScriptExecutePciCfgWrite()

EFI_STATUS BootScriptExecutePciCfgWrite ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE OP code.

Parameters
ScriptThe pointer of typed node in boot script table
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 883 of file BootScriptExecute.c.

◆ BootScriptExecuteSmbusExecute()

EFI_STATUS BootScriptExecuteSmbusExecute ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_SMBUS_EXECUTE OP code.

Parameters
ScriptThe pointer of typed node in boot script table
Return values
EFI_SUCCESSThe operation was executed successfully
EFI_UNSUPPORTEDCannot locate smbus ppi or occur error of script execution
OthersResult of script execution

Definition at line 1055 of file BootScriptExecute.c.

◆ BootScriptExecuteStall()

EFI_STATUS BootScriptExecuteStall ( IN UINT8 *  Script)

Interpret the boot script node with EFI_BOOT_SCRIPT_STALL OP code.

Parameters
ScriptThe pointer of typed node in boot script table
Return values
EFI_SUCCESSThe operation was executed successfully

Definition at line 1085 of file BootScriptExecute.c.

◆ BootScriptPciCfg2Poll()

EFI_STATUS BootScriptPciCfg2Poll ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL OP code.

Parameters
ScriptThe pointer of S3 Boot Script
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_SUCCESSThe operation was executed successfully
EFI_DEVICE_ERRORData polled from Pci configuration space does not equal to epecting data within the Loop Times.

Definition at line 1568 of file BootScriptExecute.c.

◆ BootScriptPciCfgPoll()

EFI_STATUS BootScriptPciCfgPoll ( IN UINT8 *  Script,
IN UINT64  AndMask,
IN UINT64  OrMask 
)

Interpret the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code.

Parameters
ScriptThe pointer of S3 boot script
AndMaskMask value for 'and' operation
OrMaskMask value for 'or' operation
Return values
EFI_SUCCESSThe operation was executed successfully
EFI_DEVICE_ERRORData polled from Pci configuration space does not equal to epecting data within the Loop Times.

Definition at line 1506 of file BootScriptExecute.c.

◆ BuildLoopData()

EFI_STATUS BuildLoopData ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT64  Address,
OUT UINTN AddressStride,
OUT UINTN BufferStride 
)

Translates boot script width and address stride to MDE library interface.

Parameters
WidthWidth of the operation.
AddressAddress of the operation.
AddressStrideInstride for stepping input buffer.
BufferStrideOutstride for stepping output buffer.
Return values
EFI_SUCCESSSuccessful translation.
EFI_INVALID_PARAMETERWidth or Address is invalid.

Definition at line 132 of file BootScriptExecute.c.

◆ CheckAndOrMask()

VOID CheckAndOrMask ( IN EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader,
OUT UINT64 *  AndMask,
OUT UINT64 *  OrMask,
IN UINT8 *  Script 
)

calculate the mask value for 'and' and 'or' operation

Parameters
ScriptHeaderThe pointer of header of node in boot script table
AndMaskThe Mask value for 'and' operation
OrMaskThe Mask value for 'or' operation
ScriptPointer to the entry.

Definition at line 1278 of file BootScriptExecute.c.

◆ InternalSmbusExecute()

EFI_STATUS InternalSmbusExecute ( IN UINTN  SmbusAddress,
IN EFI_SMBUS_OPERATION  Operation,
IN OUT UINTN Length,
IN OUT VOID *  Buffer 
)

Executes an SMBus operation to an SMBus controller. Returns when either the command has been executed or an error is encountered in doing the operation.

The SmbusExecute() function provides a standard way to execute an operation as defined in the System Management Bus (SMBus) Specification. The resulting transaction will be either that the SMBus slave devices accept this transaction or that this function returns with error.

Parameters
SmbusAddressAddress that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC.
OperationSignifies which particular SMBus hardware protocol instance that it will use to execute the SMBus transactions. This SMBus hardware protocol is defined by the SMBus Specification and is not related to EFI.
LengthSignifies the number of bytes that this operation will do. The maximum number of bytes can be revision specific and operation specific. This field will contain the actual number of bytes that are executed for this operation. Not all operations require this argument.
BufferContains the value of data to execute to the SMBus slave device. Not all operations require this argument. The length of this buffer is identified by Length.
Return values
EFI_SUCCESSThe last data that was returned from the access matched the poll exit criteria.
EFI_CRC_ERRORChecksum is not correct (PEC is incorrect).
EFI_TIMEOUTTimeout expired before the operation was completed. Timeout is determined by the SMBus host controller device.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_DEVICE_ERRORThe request was not completed because a failure that was reflected in the Host Status Register bit. Device errors are a result of a transaction collision, illegal command field, unclaimed cycle (host initiated), or bus errors (collisions).
EFI_INVALID_PARAMETEROperation is not defined in EFI_SMBUS_OPERATION.
EFI_INVALID_PARAMETERLength/Buffer is NULL for operations except for EfiSmbusQuickRead and EfiSmbusQuickWrite. Length is outside the range of valid values.
EFI_UNSUPPORTEDThe SMBus operation or PEC is not supported.
EFI_BUFFER_TOO_SMALLBuffer is not sufficient for this operation.

Definition at line 53 of file BootScriptExecute.c.

◆ S3BootScriptExecute()

RETURN_STATUS EFIAPI S3BootScriptExecute ( VOID  )

Executes the S3 boot script table.

Return values
RETURN_SUCCESSThe boot script table was executed successfully.
RETURN_UNSUPPORTEDInvalid script table or opcode.

Definition at line 1627 of file BootScriptExecute.c.

◆ ScriptIoRead()

EFI_STATUS ScriptIoRead ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Perform IO read operation

Parameters
[in]WidthWidth of the operation.
[in]AddressAddress of the operation.
[in]CountCount of the number of accesses to perform.
[out]BufferPointer to the buffer to read from I/O space.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. Address is outside the legal range of I/O ports.

Definition at line 180 of file BootScriptExecute.c.

◆ ScriptIoWrite()

EFI_STATUS ScriptIoWrite ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN VOID *  Buffer 
)

Perform IO write operation

Parameters
[in]WidthWidth of the operation.
[in]AddressAddress of the operation.
[in]CountCount of the number of accesses to perform.
[in]BufferPointer to the buffer to write to I/O space.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. Address is outside the legal range of I/O ports.

Definition at line 284 of file BootScriptExecute.c.

◆ ScriptMemoryRead()

EFI_STATUS ScriptMemoryRead ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Perform memory read operation

Parameters
WidthWidth of the operation.
AddressAddress of the operation.
CountCount of the number of accesses to perform.
BufferPointer to the buffer read from memory.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width.
EFI_UNSUPPORTEDThe address range specified by Address, Width, and Count is not valid for this EFI System.

Definition at line 422 of file BootScriptExecute.c.

◆ ScriptMemoryWrite()

EFI_STATUS ScriptMemoryWrite ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Perform memory write operation

Parameters
WidthWidth of the operation.
AddressAddress of the operation.
CountCount of the number of accesses to perform.
BufferPointer to the buffer write to memory.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width.
EFI_UNSUPPORTEDThe address range specified by Address, Width, and Count is not valid for this EFI System.

Definition at line 523 of file BootScriptExecute.c.

◆ ScriptPciCfg2Read()

EFI_STATUS ScriptPciCfg2Read ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT16  Segment,
IN UINT64  Address,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Performance PCI configuration 2 read operation

Parameters
WidthWidth of the operation.
SegmentPci segment number
AddressAddress of the operation.
CountCount of the number of accesses to perform.
BufferPointer to the buffer read from PCI config space
Return values
EFI_SUCCESSThe read succeed.
EFI_INVALID_PARAMETERif Width is not defined
Note
A known Limitations in the implementation which is 64bits operations are not supported.

Definition at line 656 of file BootScriptExecute.c.

◆ ScriptPciCfg2Write()

EFI_STATUS ScriptPciCfg2Write ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT16  Segment,
IN UINT64  Address,
IN UINTN  Count,
IN VOID *  Buffer 
)

Performance PCI configuration 2 write operation

Parameters
WidthWidth of the operation.
SegmentPci segment number
AddressAddress of the operation.
CountCount of the number of accesses to perform.
BufferPointer to the buffer write to PCI config space
Return values
EFI_SUCCESSThe write succeed.
EFI_INVALID_PARAMETERif Width is not defined
Note
A known Limitations in the implementation which is 64bits operations are not supported.

Definition at line 746 of file BootScriptExecute.c.

◆ ScriptPciCfgRead()

EFI_STATUS ScriptPciCfgRead ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Performance PCI configuration read operation

Parameters
WidthWidth of the operation.
AddressAddress of the operation.
CountCount of the number of accesses to perform.
BufferPointer to the buffer to read from PCI config space.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. Address is outside the legal range of I/O ports.

Definition at line 838 of file BootScriptExecute.c.

◆ ScriptPciCfgWrite()

EFI_STATUS EFIAPI ScriptPciCfgWrite ( IN S3_BOOT_SCRIPT_LIB_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN VOID *  Buffer 
)

Performance PCI configuration write operation

Parameters
WidthWidth of the operation.
AddressAddress of the operation.
CountCount of the number of accesses to perform.
BufferPointer to the buffer to write to PCI config space.
Return values
EFI_SUCCESSThe data was written to the EFI System.
EFI_INVALID_PARAMETERWidth is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. Address is outside the legal range of I/O ports.

Definition at line 865 of file BootScriptExecute.c.