Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Amy Chan <amy.chan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
- Interpret and execute the S3 data in S3 boot script. \r
+ Interpret and execute the S3 data in S3 boot script.\r
\r
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
\r
\r
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
\r
Management Bus (SMBus) Specification. The resulting transaction will be either that the SMBus\r
slave devices accept this transaction or that this function returns with error.\r
\r
Management Bus (SMBus) Specification. The resulting transaction will be either that the SMBus\r
slave devices accept this transaction or that this function returns with error.\r
\r
- @param SmbusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, \r
+ @param SmbusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length,\r
and PEC.\r
@param Operation Signifies which particular SMBus hardware protocol instance that\r
it will use to execute the SMBus transactions. This SMBus\r
and PEC.\r
@param Operation Signifies which particular SMBus hardware protocol instance that\r
it will use to execute the SMBus transactions. This SMBus\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
@param AddressStride Instride for stepping input buffer.\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
@param AddressStride Instride for stepping input buffer.\r
- @param BufferStride Outstride for stepping output buffer. \r
+ @param BufferStride Outstride for stepping output buffer.\r
\r
@retval EFI_SUCCESS Successful translation.\r
@retval EFI_INVALID_PARAMETER Width or Address is invalid.\r
\r
@retval EFI_SUCCESS Successful translation.\r
@retval EFI_INVALID_PARAMETER Width or Address is invalid.\r
\r
/**\r
Perform IO read operation\r
\r
/**\r
Perform IO read operation\r
@param[in] Width Width of the operation.\r
@param[in] Address Address of the operation.\r
@param[in] Count Count of the number of accesses to perform.\r
@param[in] Width Width of the operation.\r
@param[in] Address Address of the operation.\r
@param[in] Count Count of the number of accesses to perform.\r
- @param[out] Buffer Pointer to the buffer to read from I/O space. \r
+ @param[out] Buffer Pointer to the buffer to read from I/O space.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
- Address is outside the legal range of I/O ports. \r
- \r
+ Address is outside the legal range of I/O ports.\r
+\r
**/\r
EFI_STATUS\r
ScriptIoRead (\r
**/\r
EFI_STATUS\r
ScriptIoRead (\r
\r
/**\r
Perform IO write operation\r
\r
/**\r
Perform IO write operation\r
@param[in] Width Width of the operation.\r
@param[in] Address Address of the operation.\r
@param[in] Count Count of the number of accesses to perform.\r
@param[in] Width Width of the operation.\r
@param[in] Address Address of the operation.\r
@param[in] Count Count of the number of accesses to perform.\r
- @param[in] Buffer Pointer to the buffer to write to I/O space. \r
+ @param[in] Buffer Pointer to the buffer to write to I/O space.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
- Address is outside the legal range of I/O ports. \r
- \r
+ Address is outside the legal range of I/O ports.\r
+\r
**/\r
EFI_STATUS\r
ScriptIoWrite (\r
**/\r
EFI_STATUS\r
ScriptIoWrite (\r
case S3BootScriptWidthUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8));\r
IoWrite8 ((UINTN) Address, *In.Uint8);\r
case S3BootScriptWidthUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8));\r
IoWrite8 ((UINTN) Address, *In.Uint8);\r
case S3BootScriptWidthFifoUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8));\r
IoWrite8 ((UINTN) OriginalAddress, *In.Uint8);\r
case S3BootScriptWidthFifoUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8));\r
IoWrite8 ((UINTN) OriginalAddress, *In.Uint8);\r
case S3BootScriptWidthFillUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8));\r
IoWrite8 ((UINTN) Address, *OriginalIn.Uint8);\r
case S3BootScriptWidthFillUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8));\r
IoWrite8 ((UINTN) Address, *OriginalIn.Uint8);\r
case S3BootScriptWidthUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16));\r
IoWrite16 ((UINTN) Address, *In.Uint16);\r
case S3BootScriptWidthUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16));\r
IoWrite16 ((UINTN) Address, *In.Uint16);\r
case S3BootScriptWidthFifoUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16));\r
IoWrite16 ((UINTN) OriginalAddress, *In.Uint16);\r
case S3BootScriptWidthFifoUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16));\r
IoWrite16 ((UINTN) OriginalAddress, *In.Uint16);\r
case S3BootScriptWidthFillUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16));\r
IoWrite16 ((UINTN) Address, *OriginalIn.Uint16);\r
case S3BootScriptWidthFillUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16));\r
IoWrite16 ((UINTN) Address, *OriginalIn.Uint16);\r
case S3BootScriptWidthUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32));\r
IoWrite32 ((UINTN) Address, *In.Uint32);\r
case S3BootScriptWidthUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32));\r
IoWrite32 ((UINTN) Address, *In.Uint32);\r
case S3BootScriptWidthFifoUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32));\r
IoWrite32 ((UINTN) OriginalAddress, *In.Uint32);\r
case S3BootScriptWidthFifoUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32));\r
IoWrite32 ((UINTN) OriginalAddress, *In.Uint32);\r
case S3BootScriptWidthUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64));\r
IoWrite64 ((UINTN) Address, *In.Uint64);\r
case S3BootScriptWidthUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64));\r
IoWrite64 ((UINTN) Address, *In.Uint64);\r
case S3BootScriptWidthFifoUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64));\r
IoWrite64 ((UINTN) OriginalAddress, *In.Uint64);\r
case S3BootScriptWidthFifoUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64));\r
IoWrite64 ((UINTN) OriginalAddress, *In.Uint64);\r
case S3BootScriptWidthFillUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64));\r
IoWrite64 ((UINTN) Address, *OriginalIn.Uint64);\r
case S3BootScriptWidthFillUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64));\r
IoWrite64 ((UINTN) Address, *OriginalIn.Uint64);\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
\r
return EFI_SUCCESS;\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_IO_WRITE OP code.\r
\r
return EFI_SUCCESS;\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_IO_WRITE OP code.\r
@param Script Pointer to the node which is to be interpreted.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
@param Script Pointer to the node which is to be interpreted.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
- Address is outside the legal range of I/O ports. \r
- \r
+ Address is outside the legal range of I/O ports.\r
+\r
**/\r
EFI_STATUS\r
BootScriptExecuteIoWrite (\r
**/\r
EFI_STATUS\r
BootScriptExecuteIoWrite (\r
)\r
{\r
S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
)\r
{\r
S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
UINTN Count;\r
VOID *Buffer;\r
EFI_BOOT_SCRIPT_IO_WRITE IoWrite;\r
UINTN Count;\r
VOID *Buffer;\r
EFI_BOOT_SCRIPT_IO_WRITE IoWrite;\r
CopyMem ((VOID*)&IoWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_WRITE));\r
Width = (S3_BOOT_SCRIPT_LIB_WIDTH) IoWrite.Width;\r
Address = IoWrite.Address;\r
CopyMem ((VOID*)&IoWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_WRITE));\r
Width = (S3_BOOT_SCRIPT_LIB_WIDTH) IoWrite.Width;\r
Address = IoWrite.Address;\r
}\r
/**\r
Perform memory read operation\r
}\r
/**\r
Perform memory read operation\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
- @param Buffer Pointer to the buffer read from memory. \r
+ @param Buffer Pointer to the buffer read from memory.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count \r
- is not valid for this EFI System. \r
- \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count\r
+ is not valid for this EFI System.\r
+\r
**/\r
EFI_STATUS\r
ScriptMemoryRead (\r
**/\r
EFI_STATUS\r
ScriptMemoryRead (\r
}\r
/**\r
Perform memory write operation\r
}\r
/**\r
Perform memory write operation\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
- @param Buffer Pointer to the buffer write to memory. \r
+ @param Buffer Pointer to the buffer write to memory.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count \r
- is not valid for this EFI System. \r
- \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count\r
+ is not valid for this EFI System.\r
+\r
**/\r
EFI_STATUS\r
ScriptMemoryWrite (\r
**/\r
EFI_STATUS\r
ScriptMemoryWrite (\r
{\r
EFI_STATUS Status;\r
UINTN AddressStride;\r
{\r
EFI_STATUS Status;\r
UINTN AddressStride;\r
- UINT64 OriginalAddress; \r
+ UINT64 OriginalAddress;\r
UINTN BufferStride;\r
PTR In;\r
PTR OriginalIn;\r
UINTN BufferStride;\r
PTR In;\r
PTR OriginalIn;\r
// Loop for each iteration and move the data\r
//\r
OriginalAddress = Address;\r
// Loop for each iteration and move the data\r
//\r
OriginalAddress = Address;\r
- OriginalIn.Buf = In.Buf; \r
+ OriginalIn.Buf = In.Buf;\r
for (; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {\r
switch (Width) {\r
case S3BootScriptWidthUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8));\r
MmioWrite8 ((UINTN) Address, *In.Uint8);\r
for (; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) {\r
switch (Width) {\r
case S3BootScriptWidthUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8));\r
MmioWrite8 ((UINTN) Address, *In.Uint8);\r
case S3BootScriptWidthFifoUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8));\r
MmioWrite8 ((UINTN) OriginalAddress, *In.Uint8);\r
case S3BootScriptWidthFifoUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8));\r
MmioWrite8 ((UINTN) OriginalAddress, *In.Uint8);\r
case S3BootScriptWidthFillUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8));\r
MmioWrite8 ((UINTN) Address, *OriginalIn.Uint8);\r
case S3BootScriptWidthFillUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8));\r
MmioWrite8 ((UINTN) Address, *OriginalIn.Uint8);\r
case S3BootScriptWidthUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16));\r
MmioWrite16 ((UINTN) Address, *In.Uint16);\r
case S3BootScriptWidthUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16));\r
MmioWrite16 ((UINTN) Address, *In.Uint16);\r
case S3BootScriptWidthFifoUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16));\r
MmioWrite16 ((UINTN) OriginalAddress, *In.Uint16);\r
case S3BootScriptWidthFifoUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16));\r
MmioWrite16 ((UINTN) OriginalAddress, *In.Uint16);\r
case S3BootScriptWidthFillUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16));\r
MmioWrite16 ((UINTN) Address, *OriginalIn.Uint16);\r
case S3BootScriptWidthFillUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16));\r
MmioWrite16 ((UINTN) Address, *OriginalIn.Uint16);\r
case S3BootScriptWidthUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32));\r
MmioWrite32 ((UINTN) Address, *In.Uint32);\r
case S3BootScriptWidthUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32));\r
MmioWrite32 ((UINTN) Address, *In.Uint32);\r
case S3BootScriptWidthFifoUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32));\r
MmioWrite32 ((UINTN) OriginalAddress, *In.Uint32);\r
case S3BootScriptWidthFifoUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32));\r
MmioWrite32 ((UINTN) OriginalAddress, *In.Uint32);\r
case S3BootScriptWidthFillUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint32));\r
MmioWrite32 ((UINTN) Address, *OriginalIn.Uint32);\r
case S3BootScriptWidthFillUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint32));\r
MmioWrite32 ((UINTN) Address, *OriginalIn.Uint32);\r
case S3BootScriptWidthUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64));\r
MmioWrite64 ((UINTN) Address, *In.Uint64);\r
case S3BootScriptWidthUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64));\r
MmioWrite64 ((UINTN) Address, *In.Uint64);\r
case S3BootScriptWidthFifoUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64));\r
MmioWrite64 ((UINTN) OriginalAddress, *In.Uint64);\r
case S3BootScriptWidthFifoUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64));\r
MmioWrite64 ((UINTN) OriginalAddress, *In.Uint64);\r
case S3BootScriptWidthFillUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64));\r
MmioWrite64 ((UINTN) Address, *OriginalIn.Uint64);\r
case S3BootScriptWidthFillUint64:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64));\r
MmioWrite64 ((UINTN) Address, *OriginalIn.Uint64);\r
Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_WRITE OP code.\r
\r
@param[in] Script Pointer to the node which is to be interpreted.\r
Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_WRITE OP code.\r
\r
@param[in] Script Pointer to the node which is to be interpreted.\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
@retval EFI_SUCCESS The data was written to the EFI System.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI System.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count \r
- is not valid for this EFI System. \r
- \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count\r
+ is not valid for this EFI System.\r
+\r
**/\r
EFI_STATUS\r
BootScriptExecuteMemoryWrite (\r
**/\r
EFI_STATUS\r
BootScriptExecuteMemoryWrite (\r
UINT64 Address;\r
UINTN Count;\r
EFI_BOOT_SCRIPT_MEM_WRITE MemWrite;\r
UINT64 Address;\r
UINTN Count;\r
EFI_BOOT_SCRIPT_MEM_WRITE MemWrite;\r
CopyMem((VOID*)&MemWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_WRITE));\r
Width = (S3_BOOT_SCRIPT_LIB_WIDTH)MemWrite.Width;\r
Address = MemWrite.Address;\r
CopyMem((VOID*)&MemWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_WRITE));\r
Width = (S3_BOOT_SCRIPT_LIB_WIDTH)MemWrite.Width;\r
Address = MemWrite.Address;\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)Address, Count, (UINTN)Width));\r
return ScriptMemoryWrite (Width,Address, Count, Buffer);\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)Address, Count, (UINTN)Width));\r
return ScriptMemoryWrite (Width,Address, Count, Buffer);\r
/**\r
Performance PCI configuration read operation\r
\r
/**\r
Performance PCI configuration read operation\r
\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
@param Buffer Pointer to the buffer read from PCI config space\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
@param Buffer Pointer to the buffer read from PCI config space\r
@retval EFI_SUCCESS The read succeed.\r
@retval EFI_SUCCESS The read succeed.\r
- @retval EFI_INVALID_PARAMETER if Width is not defined \r
+ @retval EFI_INVALID_PARAMETER if Width is not defined\r
@note A known Limitations in the implementation which is 64bits operations are not supported.\r
\r
**/\r
@note A known Limitations in the implementation which is 64bits operations are not supported.\r
\r
**/\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
@param Buffer Pointer to the buffer write to PCI config space\r
@param Address Address of the operation.\r
@param Count Count of the number of accesses to perform.\r
@param Buffer Pointer to the buffer write to PCI config space\r
@retval EFI_SUCCESS The write succeed.\r
@retval EFI_SUCCESS The write succeed.\r
- @retval EFI_INVALID_PARAMETER if Width is not defined \r
+ @retval EFI_INVALID_PARAMETER if Width is not defined\r
@note A known Limitations in the implementation which is 64bits operations are not supported.\r
\r
**/\r
@note A known Limitations in the implementation which is 64bits operations are not supported.\r
\r
**/\r
case S3BootScriptWidthUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*In.Uint8));\r
PciWrite8 (PciAddress, *In.Uint8);\r
case S3BootScriptWidthUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*In.Uint8));\r
PciWrite8 (PciAddress, *In.Uint8);\r
case S3BootScriptWidthFifoUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", OriginalPciAddress, (UINTN)*In.Uint8));\r
PciWrite8 (OriginalPciAddress, *In.Uint8);\r
case S3BootScriptWidthFifoUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", OriginalPciAddress, (UINTN)*In.Uint8));\r
PciWrite8 (OriginalPciAddress, *In.Uint8);\r
case S3BootScriptWidthFillUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*OriginalIn.Uint8));\r
PciWrite8 (PciAddress, *OriginalIn.Uint8);\r
case S3BootScriptWidthFillUint8:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*OriginalIn.Uint8));\r
PciWrite8 (PciAddress, *OriginalIn.Uint8);\r
case S3BootScriptWidthUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*In.Uint16));\r
PciWrite16 (PciAddress, *In.Uint16);\r
case S3BootScriptWidthUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*In.Uint16));\r
PciWrite16 (PciAddress, *In.Uint16);\r
case S3BootScriptWidthFifoUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", OriginalPciAddress, (UINTN)*In.Uint16));\r
PciWrite16 (OriginalPciAddress, *In.Uint16);\r
case S3BootScriptWidthFifoUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", OriginalPciAddress, (UINTN)*In.Uint16));\r
PciWrite16 (OriginalPciAddress, *In.Uint16);\r
case S3BootScriptWidthFillUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*OriginalIn.Uint16));\r
PciWrite16 (PciAddress, *OriginalIn.Uint16);\r
case S3BootScriptWidthFillUint16:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*OriginalIn.Uint16));\r
PciWrite16 (PciAddress, *OriginalIn.Uint16);\r
case S3BootScriptWidthUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", PciAddress, (UINTN)*In.Uint32));\r
PciWrite32 (PciAddress, *In.Uint32);\r
case S3BootScriptWidthUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", PciAddress, (UINTN)*In.Uint32));\r
PciWrite32 (PciAddress, *In.Uint32);\r
case S3BootScriptWidthFifoUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", OriginalPciAddress, (UINTN)*In.Uint32));\r
PciWrite32 (OriginalPciAddress, *In.Uint32);\r
case S3BootScriptWidthFifoUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", OriginalPciAddress, (UINTN)*In.Uint32));\r
PciWrite32 (OriginalPciAddress, *In.Uint32);\r
case S3BootScriptWidthFillUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)PciAddress, (UINTN)*OriginalIn.Uint32));\r
PciWrite32 (PciAddress, *OriginalIn.Uint32);\r
case S3BootScriptWidthFillUint32:\r
DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)PciAddress, (UINTN)*OriginalIn.Uint32));\r
PciWrite32 (PciAddress, *OriginalIn.Uint32);\r
}\r
/**\r
Performance PCI configuration 2 read operation\r
}\r
/**\r
Performance PCI configuration 2 read operation\r
@param Width Width of the operation.\r
@param Segment Pci segment number\r
@param Address Address of the operation.\r
@param Width Width of the operation.\r
@param Segment Pci segment number\r
@param Address Address of the operation.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
Address is outside the legal range of I/O ports.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
Address is outside the legal range of I/O ports.\r
- @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as \r
+ @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as\r
Zero, or else, assert.\r
**/\r
EFI_STATUS\r
ScriptPciCfg2Read (\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
Zero, or else, assert.\r
**/\r
EFI_STATUS\r
ScriptPciCfg2Read (\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT64 Address,\r
IN UINTN Count,\r
OUT VOID *Buffer\r
)\r
{\r
ASSERT (Segment==0);\r
IN UINT64 Address,\r
IN UINTN Count,\r
OUT VOID *Buffer\r
)\r
{\r
ASSERT (Segment==0);\r
return ScriptPciCfgRead (Width, Address, Count, Buffer);\r
}\r
/**\r
Performance PCI configuration 2 write operation\r
return ScriptPciCfgRead (Width, Address, Count, Buffer);\r
}\r
/**\r
Performance PCI configuration 2 write operation\r
@param Width Width of the operation.\r
@param Segment Pci segment number\r
@param Address Address of the operation.\r
@param Width Width of the operation.\r
@param Segment Pci segment number\r
@param Address Address of the operation.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
Address is outside the legal range of I/O ports.\r
Buffer is NULL.\r
The Buffer is not aligned for the given Width.\r
Address is outside the legal range of I/O ports.\r
- @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as \r
+ @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as\r
**/\r
EFI_STATUS\r
EFIAPI\r
ScriptPciCfg2Write (\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
**/\r
EFI_STATUS\r
EFIAPI\r
ScriptPciCfg2Write (\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT64 Address,\r
IN UINTN Count,\r
IN VOID *Buffer\r
IN UINT64 Address,\r
IN UINTN Count,\r
IN VOID *Buffer\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE OP code.\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE OP code.\r
- \r
- @param Script The pointer of typed node in boot script table \r
- \r
+\r
+ @param Script The pointer of typed node in boot script table\r
+\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_IO_READ_WRITE OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_IO_READ_WRITE OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
+ @param Script The pointer of typed node in boot script table\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
EFI_STATUS Status;\r
UINT64 Data;\r
EFI_BOOT_SCRIPT_IO_READ_WRITE IoReadWrite;\r
EFI_STATUS Status;\r
UINT64 Data;\r
EFI_BOOT_SCRIPT_IO_READ_WRITE IoReadWrite;\r
CopyMem((VOID*)&IoReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteIoReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoReadWrite.Address, AndMask, OrMask));\r
CopyMem((VOID*)&IoReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteIoReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoReadWrite.Address, AndMask, OrMask));\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_READ_WRITE OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_READ_WRITE OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
+ @param Script The pointer of typed node in boot script table\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
EFI_STATUS Status;\r
UINT64 Data;\r
EFI_BOOT_SCRIPT_MEM_READ_WRITE MemReadWrite;\r
EFI_STATUS Status;\r
UINT64 Data;\r
EFI_BOOT_SCRIPT_MEM_READ_WRITE MemReadWrite;\r
CopyMem((VOID*)&MemReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemReadWrite.Address, AndMask, OrMask));\r
CopyMem((VOID*)&MemReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemReadWrite.Address, AndMask, OrMask));\r
Status = ScriptMemoryRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) MemReadWrite.Width,\r
MemReadWrite.Address,\r
Status = ScriptMemoryRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) MemReadWrite.Width,\r
MemReadWrite.Address,\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CFG_READ_WRITE OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CFG_READ_WRITE OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
+ @param Script The pointer of typed node in boot script table\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
CopyMem((VOID*)&PciCfgReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgReadWrite.Address), AndMask, OrMask));\r
CopyMem((VOID*)&PciCfgReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgReadWrite.Address), AndMask, OrMask));\r
Status = ScriptPciCfgRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgReadWrite.Width,\r
PciCfgReadWrite.Address,\r
Status = ScriptPciCfgRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgReadWrite.Width,\r
PciCfgReadWrite.Address,\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_SMBUS_EXECUTE OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_SMBUS_EXECUTE OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
- \r
+ @param Script The pointer of typed node in boot script table\r
+\r
@retval EFI_SUCCESS The operation was executed successfully\r
@retval EFI_UNSUPPORTED Cannot locate smbus ppi or occur error of script execution\r
@retval EFI_SUCCESS The operation was executed successfully\r
@retval EFI_UNSUPPORTED Cannot locate smbus ppi or occur error of script execution\r
- @retval Others Result of script execution \r
+ @retval Others Result of script execution\r
**/\r
EFI_STATUS\r
BootScriptExecuteSmbusExecute (\r
**/\r
EFI_STATUS\r
BootScriptExecuteSmbusExecute (\r
UINTN SmBusAddress;\r
UINTN DataSize;\r
EFI_BOOT_SCRIPT_SMBUS_EXECUTE SmbusExecuteEntry;\r
UINTN SmBusAddress;\r
UINTN DataSize;\r
EFI_BOOT_SCRIPT_SMBUS_EXECUTE SmbusExecuteEntry;\r
CopyMem ((VOID*)&SmbusExecuteEntry, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_SMBUS_EXECUTE ));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteSmbusExecute - 0x%08x, 0x%08x\n", (UINTN)SmbusExecuteEntry.SmBusAddress, (UINTN)SmbusExecuteEntry.Operation));\r
CopyMem ((VOID*)&SmbusExecuteEntry, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_SMBUS_EXECUTE ));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteSmbusExecute - 0x%08x, 0x%08x\n", (UINTN)SmbusExecuteEntry.SmBusAddress, (UINTN)SmbusExecuteEntry.Operation));\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_STALL OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_STALL OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
- \r
+ @param Script The pointer of typed node in boot script table\r
+\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
)\r
{\r
EFI_BOOT_SCRIPT_STALL Stall;\r
)\r
{\r
EFI_BOOT_SCRIPT_STALL Stall;\r
CopyMem ((VOID*)&Stall, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_STALL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteStall - 0x%08x\n", (UINTN)Stall.Duration));\r
CopyMem ((VOID*)&Stall, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_STALL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteStall - 0x%08x\n", (UINTN)Stall.Duration));\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH OP code.\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH OP code.\r
- \r
- @param Script The pointer of typed node in boot script table \r
+\r
+ @param Script The pointer of typed node in boot script table\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
EFI_STATUS Status;\r
DISPATCH_ENTRYPOINT_FUNC EntryFunc;\r
EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch;\r
EFI_STATUS Status;\r
DISPATCH_ENTRYPOINT_FUNC EntryFunc;\r
EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch;\r
CopyMem ((VOID*)&ScriptDispatch, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH));\r
EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch.EntryPoint);\r
\r
CopyMem ((VOID*)&ScriptDispatch, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH));\r
EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch.EntryPoint);\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH_2 OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH_2 OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
+ @param Script The pointer of typed node in boot script table\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
EFI_STATUS\r
EFI_STATUS Status;\r
DISPATCH_ENTRYPOINT_FUNC EntryFunc;\r
EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2;\r
EFI_STATUS Status;\r
DISPATCH_ENTRYPOINT_FUNC EntryFunc;\r
EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2;\r
CopyMem ((VOID*)&ScriptDispatch2, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH_2));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteDispatch2 - 0x%08x(0x%08x)\n", (UINTN)ScriptDispatch2.EntryPoint, (UINTN)ScriptDispatch2.Context));\r
CopyMem ((VOID*)&ScriptDispatch2, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH_2));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteDispatch2 - 0x%08x(0x%08x)\n", (UINTN)ScriptDispatch2.EntryPoint, (UINTN)ScriptDispatch2.Context));\r
EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch2.EntryPoint);\r
\r
Status = EntryFunc (NULL, (VOID *) (UINTN) ScriptDispatch2.Context);\r
EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch2.EntryPoint);\r
\r
Status = EntryFunc (NULL, (VOID *) (UINTN) ScriptDispatch2.Context);\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_POLL OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_POLL OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
+ @param Script The pointer of typed node in boot script table\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
- \r
- @retval EFI_DEVICE_ERROR Data polled from memory does not equal to \r
+\r
+ @retval EFI_DEVICE_ERROR Data polled from memory does not equal to\r
the epecting data within the Loop Times.\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
the epecting data within the Loop Times.\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
BootScriptExecuteMemPoll (\r
IN UINT8 *Script,\r
IN UINT64 AndMask,\r
BootScriptExecuteMemPoll (\r
IN UINT8 *Script,\r
IN UINT64 AndMask,\r
UINT64 Data;\r
UINT64 LoopTimes;\r
EFI_STATUS Status;\r
EFI_BOOT_SCRIPT_MEM_POLL MemPoll;\r
UINT64 Data;\r
UINT64 LoopTimes;\r
EFI_STATUS Status;\r
EFI_BOOT_SCRIPT_MEM_POLL MemPoll;\r
CopyMem ((VOID*)&MemPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemPoll.Address, AndMask, OrMask));\r
CopyMem ((VOID*)&MemPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemPoll.Address, AndMask, OrMask));\r
Execute the boot script to interpret the Store arbitrary information.\r
This opcode is a no-op on dispatch and is only used for debugging script issues.\r
\r
Execute the boot script to interpret the Store arbitrary information.\r
This opcode is a no-op on dispatch and is only used for debugging script issues.\r
\r
- @param Script The pointer of node in boot script table \r
- \r
+ @param Script The pointer of node in boot script table\r
+\r
**/\r
VOID\r
BootScriptExecuteInformation (\r
**/\r
VOID\r
BootScriptExecuteInformation (\r
- Execute the boot script to interpret the Label information. \r
+ Execute the boot script to interpret the Label information.\r
+\r
+ @param Script The pointer of node in boot script table\r
- @param Script The pointer of node in boot script table \r
- \r
**/\r
VOID\r
BootScriptExecuteLabel (\r
**/\r
VOID\r
BootScriptExecuteLabel (\r
\r
/**\r
calculate the mask value for 'and' and 'or' operation\r
\r
/**\r
calculate the mask value for 'and' and 'or' operation\r
- @param ScriptHeader The pointer of header of node in boot script table \r
+ @param ScriptHeader The pointer of header of node in boot script table\r
@param AndMask The Mask value for 'and' operation\r
@param OrMask The Mask value for 'or' operation\r
@param Script Pointer to the entry.\r
@param AndMask The Mask value for 'and' operation\r
@param OrMask The Mask value for 'or' operation\r
@param Script Pointer to the entry.\r
case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_MEM_POLL);\r
break;\r
case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_MEM_POLL);\r
break;\r
case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_IO_POLL);\r
case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_IO_POLL);\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL);\r
break;\r
DataPtr = Script + Size;\r
\r
switch (ScriptHeader->Width) {\r
DataPtr = Script + Size;\r
\r
switch (ScriptHeader->Width) {\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_IO_POLL OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_IO_POLL OP code.\r
\r
- @param Script The pointer of typed node in boot script table \r
+ @param Script The pointer of typed node in boot script table\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
- \r
- @retval EFI_DEVICE_ERROR Data polled from memory does not equal to \r
+\r
+ @retval EFI_DEVICE_ERROR Data polled from memory does not equal to\r
the epecting data within the Loop Times.\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
the epecting data within the Loop Times.\r
@retval EFI_SUCCESS The operation was executed successfully\r
**/\r
UINT64 Data;\r
UINT64 LoopTimes;\r
EFI_BOOT_SCRIPT_IO_POLL IoPoll;\r
UINT64 Data;\r
UINT64 LoopTimes;\r
EFI_BOOT_SCRIPT_IO_POLL IoPoll;\r
CopyMem ((VOID*)&IoPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoPoll.Address, AndMask, OrMask));\r
CopyMem ((VOID*)&IoPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoPoll.Address, AndMask, OrMask));\r
);\r
if ((!EFI_ERROR (Status)) &&(Data & AndMask) == OrMask) {\r
return EFI_SUCCESS;\r
);\r
if ((!EFI_ERROR (Status)) &&(Data & AndMask) == OrMask) {\r
return EFI_SUCCESS;\r
}\r
\r
if (LoopTimes < IoPoll.Delay) {\r
}\r
\r
if (LoopTimes < IoPoll.Delay) {\r
UINT64 Address;\r
UINTN Count;\r
EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write;\r
UINT64 Address;\r
UINTN Count;\r
EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write;\r
CopyMem ((VOID*)&PciCfg2Write, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE));\r
\r
Width = (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2Write.Width;\r
CopyMem ((VOID*)&PciCfg2Write, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE));\r
\r
Width = (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2Write.Width;\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code.\r
@param Script The pointer of S3 boot script\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
@param Script The pointer of S3 boot script\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
CopyMem ((VOID*)&PciCfg2ReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2ReadWrite - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2ReadWrite.Segment, PCI_ADDRESS_ENCODE (PciCfg2ReadWrite.Address), AndMask, OrMask));\r
CopyMem ((VOID*)&PciCfg2ReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2ReadWrite - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2ReadWrite.Segment, PCI_ADDRESS_ENCODE (PciCfg2ReadWrite.Address), AndMask, OrMask));\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2ReadWrite.Width,\r
PciCfg2ReadWrite.Segment,\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2ReadWrite.Width,\r
PciCfg2ReadWrite.Segment,\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code.\r
}\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code.\r
@param Script The pointer of S3 boot script\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
@retval EFI_SUCCESS The operation was executed successfully\r
@param Script The pointer of S3 boot script\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
@retval EFI_SUCCESS The operation was executed successfully\r
- @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to \r
+ @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to\r
epecting data within the Loop Times.\r
**/\r
EFI_STATUS\r
BootScriptPciCfgPoll (\r
IN UINT8 *Script,\r
IN UINT64 AndMask,\r
epecting data within the Loop Times.\r
**/\r
EFI_STATUS\r
BootScriptPciCfgPoll (\r
IN UINT8 *Script,\r
IN UINT64 AndMask,\r
CopyMem ((VOID*)&PciCfgPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptPciCfgPoll - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgPoll.Address), AndMask, OrMask));\r
CopyMem ((VOID*)&PciCfgPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptPciCfgPoll - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgPoll.Address), AndMask, OrMask));\r
Data = 0;\r
Status = ScriptPciCfgRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgPoll.Width,\r
Data = 0;\r
Status = ScriptPciCfgRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgPoll.Width,\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL OP code.\r
\r
/**\r
Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL OP code.\r
@param Script The pointer of S3 Boot Script\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
@retval EFI_SUCCESS The operation was executed successfully\r
@param Script The pointer of S3 Boot Script\r
@param AndMask Mask value for 'and' operation\r
@param OrMask Mask value for 'or' operation\r
\r
@retval EFI_SUCCESS The operation was executed successfully\r
- @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to \r
+ @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to\r
epecting data within the Loop Times.\r
\r
**/\r
epecting data within the Loop Times.\r
\r
**/\r
BootScriptPciCfg2Poll (\r
IN UINT8 *Script,\r
IN UINT64 AndMask,\r
BootScriptPciCfg2Poll (\r
IN UINT8 *Script,\r
IN UINT64 AndMask,\r
)\r
{\r
EFI_STATUS Status;\r
)\r
{\r
EFI_STATUS Status;\r
CopyMem ((VOID*)&PciCfg2Poll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptPciCfg2Poll - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2Poll.Segment, PCI_ADDRESS_ENCODE (PciCfg2Poll.Address), AndMask, OrMask));\r
CopyMem ((VOID*)&PciCfg2Poll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL));\r
\r
DEBUG ((EFI_D_INFO, "BootScriptPciCfg2Poll - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2Poll.Segment, PCI_ADDRESS_ENCODE (PciCfg2Poll.Address), AndMask, OrMask));\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
PciCfg2Poll.Segment,\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
PciCfg2Poll.Segment,\r
Data = 0;\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
Data = 0;\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
- PciCfg2Poll.Segment, \r
PciCfg2Poll.Address,\r
1,\r
&Data\r
PciCfg2Poll.Address,\r
1,\r
&Data\r
} else {\r
return EFI_DEVICE_ERROR;\r
}\r
} else {\r
return EFI_DEVICE_ERROR;\r
}\r
}\r
\r
/**\r
Executes the S3 boot script table.\r
}\r
\r
/**\r
Executes the S3 boot script table.\r
@retval RETURN_SUCCESS The boot script table was executed successfully.\r
@retval RETURN_SUCCESS The boot script table was executed successfully.\r
- @retval RETURN_UNSUPPORTED Invalid script table or opcode. \r
- \r
+ @retval RETURN_UNSUPPORTED Invalid script table or opcode.\r
+\r
@note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\r
@note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE\r
- EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as \r
+ EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as\r
Zero, or else, assert.\r
**/\r
RETURN_STATUS\r
Zero, or else, assert.\r
**/\r
RETURN_STATUS\r
EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader;\r
EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader;\r
Script = mS3BootScriptTablePtr->TableBase;\r
EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader;\r
EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader;\r
Script = mS3BootScriptTablePtr->TableBase;\r
CopyMem ((VOID*)&TableHeader, Script, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER));\r
} else {\r
return EFI_INVALID_PARAMETER;\r
CopyMem ((VOID*)&TableHeader, Script, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER));\r
} else {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
DEBUG ((EFI_D_INFO, "TableHeader - 0x%08x\n", Script));\r
}\r
\r
DEBUG ((EFI_D_INFO, "TableHeader - 0x%08x\n", Script));\r
StartAddress = (UINTN) Script;\r
TableLength = TableHeader.TableLength;\r
Script = Script + TableHeader.Length;\r
StartAddress = (UINTN) Script;\r
TableLength = TableHeader.TableLength;\r
Script = Script + TableHeader.Length;\r
\r
while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) {\r
DEBUG ((EFI_D_INFO, "ExecuteBootScript - %08x\n", (UINTN)Script));\r
\r
while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) {\r
DEBUG ((EFI_D_INFO, "ExecuteBootScript - %08x\n", (UINTN)Script));\r
CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER));\r
switch (ScriptHeader.OpCode) {\r
\r
CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER));\r
switch (ScriptHeader.OpCode) {\r
\r
case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n"));\r
BootScriptExecuteInformation (Script);\r
case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n"));\r
BootScriptExecuteInformation (Script);\r
\r
case S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE:\r
DEBUG ((EFI_D_INFO, "S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n"));\r
\r
case S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE:\r
DEBUG ((EFI_D_INFO, "S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n"));\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
Status = BootScriptExecuteMemPoll (Script, AndMask, OrMask);\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
Status = BootScriptExecuteMemPoll (Script, AndMask, OrMask);\r
case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
Status = BootScriptExecuteIoPoll (Script, AndMask, OrMask);\r
break;\r
case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
Status = BootScriptExecuteIoPoll (Script, AndMask, OrMask);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
Status = BootScriptPciCfgPoll (Script, AndMask, OrMask);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
Status = BootScriptPciCfgPoll (Script, AndMask, OrMask);\r
break;\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:\r
DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n"));\r
CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);\r
UINT8 Length;\r
UINT32 Width;\r
UINT64 Address;\r
UINT8 Length;\r
UINT32 Width;\r
UINT64 Address;\r
UINT64 Delay;\r
} EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL;\r
\r
UINT64 Delay;\r
} EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL;\r
\r
EFI_SMM_SYSTEM_TABLE2 *mBootScriptSmst = NULL;\r
\r
/**\r
EFI_SMM_SYSTEM_TABLE2 *mBootScriptSmst = NULL;\r
\r
/**\r
- This is an internal function to add a terminate node the entry, recalculate the table \r
- length and fill into the table. \r
- \r
- @return the base address of the boot script table. \r
+ This is an internal function to add a terminate node the entry, recalculate the table\r
+ length and fill into the table.\r
+\r
+ @return the base address of the boot script table.\r
**/\r
UINT8*\r
S3BootScriptInternalCloseTable (\r
**/\r
UINT8*\r
S3BootScriptInternalCloseTable (\r
EFI_BOOT_SCRIPT_TERMINATE ScriptTerminate;\r
EFI_BOOT_SCRIPT_TABLE_HEADER *ScriptTableInfo;\r
S3TableBase = mS3BootScriptTablePtr->TableBase;\r
EFI_BOOT_SCRIPT_TERMINATE ScriptTerminate;\r
EFI_BOOT_SCRIPT_TABLE_HEADER *ScriptTableInfo;\r
S3TableBase = mS3BootScriptTablePtr->TableBase;\r
if (S3TableBase == NULL) {\r
//\r
// the table is not exist\r
if (S3TableBase == NULL) {\r
//\r
// the table is not exist\r
//\r
ScriptTableInfo = (EFI_BOOT_SCRIPT_TABLE_HEADER*)(mS3BootScriptTablePtr->TableBase);\r
ScriptTableInfo->TableLength = mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE);\r
//\r
ScriptTableInfo = (EFI_BOOT_SCRIPT_TABLE_HEADER*)(mS3BootScriptTablePtr->TableBase);\r
ScriptTableInfo->TableLength = mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE);\r
return S3TableBase;\r
//\r
return S3TableBase;\r
//\r
- // NOTE: Here we did NOT adjust the mS3BootScriptTablePtr->TableLength to \r
+ // NOTE: Here we did NOT adjust the mS3BootScriptTablePtr->TableLength to\r
// mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE).\r
// Because maybe after SmmReadyToLock, we still need add entries into the table,\r
// and the entry should be added start before this TERMINATE node.\r
//\r
// mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE).\r
// Because maybe after SmmReadyToLock, we still need add entries into the table,\r
// and the entry should be added start before this TERMINATE node.\r
//\r
\r
/**\r
This function save boot script data to LockBox.\r
\r
/**\r
This function save boot script data to LockBox.\r
/**\r
This is the Event call back function to notify the Library the system is entering\r
SmmLocked phase.\r
/**\r
This is the Event call back function to notify the Library the system is entering\r
SmmLocked phase.\r
@param Event Pointer to this event\r
@param Event Pointer to this event\r
- @param Context Event handler private data \r
+ @param Context Event handler private data\r
\r
/**\r
Library Constructor.\r
\r
/**\r
Library Constructor.\r
- this function just identify it is a smm driver or non-smm driver linked against \r
- with the library \r
+ this function just identify it is a smm driver or non-smm driver linked against\r
+ with the library\r
\r
@param ImageHandle The firmware allocated handle for the EFI image.\r
@param SystemTable A pointer to the EFI System Table.\r
\r
@param ImageHandle The firmware allocated handle for the EFI image.\r
@param SystemTable A pointer to the EFI System Table.\r
/**\r
To get the start address from which a new boot time s3 boot script entry will write into.\r
If the table is not exist, the functio will first allocate a buffer for the table\r
/**\r
To get the start address from which a new boot time s3 boot script entry will write into.\r
If the table is not exist, the functio will first allocate a buffer for the table\r
- If the table buffer is not enough for the new entry, in non-smm mode, the funtion will \r
+ If the table buffer is not enough for the new entry, in non-smm mode, the funtion will\r
invoke reallocate to enlarge buffer.\r
invoke reallocate to enlarge buffer.\r
@param EntryLength the new entry length.\r
@param EntryLength the new entry length.\r
- \r
- @retval the address from which the a new s3 boot script entry will write into \r
+\r
+ @retval the address from which the a new s3 boot script entry will write into\r
**/\r
UINT8*\r
S3BootScriptGetBootTimeEntryAddAddress (\r
**/\r
UINT8*\r
S3BootScriptGetBootTimeEntryAddAddress (\r
UINT16 PageNumber;\r
EFI_STATUS Status;\r
EFI_BOOT_SCRIPT_TABLE_HEADER *ScriptTableInfo;\r
UINT16 PageNumber;\r
EFI_STATUS Status;\r
EFI_BOOT_SCRIPT_TABLE_HEADER *ScriptTableInfo;\r
S3TableBase = (EFI_PHYSICAL_ADDRESS)(UINTN)(mS3BootScriptTablePtr->TableBase);\r
if (S3TableBase == 0) {\r
//\r
S3TableBase = (EFI_PHYSICAL_ADDRESS)(UINTN)(mS3BootScriptTablePtr->TableBase);\r
if (S3TableBase == 0) {\r
//\r
- // The table is not exist. This is the first to add entry. \r
+ // The table is not exist. This is the first to add entry.\r
// Allocate ACPI script table space under 4G memory.\r
//\r
S3TableBase = 0xffffffff;\r
// Allocate ACPI script table space under 4G memory.\r
//\r
S3TableBase = 0xffffffff;\r
2 + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber),\r
(EFI_PHYSICAL_ADDRESS*)&S3TableBase\r
);\r
2 + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber),\r
(EFI_PHYSICAL_ADDRESS*)&S3TableBase\r
);\r
if (EFI_ERROR(Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return 0;\r
if (EFI_ERROR(Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return 0;\r
mS3BootScriptTablePtr->TableBase = (UINT8*)(UINTN)S3TableBase;\r
mS3BootScriptTablePtr->TableMemoryPageNumber = (UINT16)(2 + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber));\r
}\r
mS3BootScriptTablePtr->TableBase = (UINT8*)(UINTN)S3TableBase;\r
mS3BootScriptTablePtr->TableMemoryPageNumber = (UINT16)(2 + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber));\r
}\r
// Here we do not count the reserved memory for runtime script table.\r
PageNumber = (UINT16) (mS3BootScriptTablePtr->TableMemoryPageNumber - PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber));\r
TableLength = mS3BootScriptTablePtr->TableLength;\r
if ((UINTN) EFI_PAGES_TO_SIZE ((UINTN) PageNumber) < (UINTN) (TableLength + EntryLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE))) {\r
// Here we do not count the reserved memory for runtime script table.\r
PageNumber = (UINT16) (mS3BootScriptTablePtr->TableMemoryPageNumber - PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber));\r
TableLength = mS3BootScriptTablePtr->TableLength;\r
if ((UINTN) EFI_PAGES_TO_SIZE ((UINTN) PageNumber) < (UINTN) (TableLength + EntryLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE))) {\r
// The buffer is too small to hold the table, Reallocate the buffer\r
//\r
NewS3TableBase = 0xffffffff;\r
// The buffer is too small to hold the table, Reallocate the buffer\r
//\r
NewS3TableBase = 0xffffffff;\r
2 + PageNumber + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber),\r
(EFI_PHYSICAL_ADDRESS*)&NewS3TableBase\r
);\r
2 + PageNumber + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber),\r
(EFI_PHYSICAL_ADDRESS*)&NewS3TableBase\r
);\r
if (EFI_ERROR(Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return 0;\r
}\r
if (EFI_ERROR(Status)) {\r
ASSERT_EFI_ERROR (Status);\r
return 0;\r
}\r
CopyMem ((VOID*)(UINTN)NewS3TableBase, (VOID*)(UINTN)S3TableBase, TableLength);\r
gBS->FreePages (S3TableBase, mS3BootScriptTablePtr->TableMemoryPageNumber);\r
CopyMem ((VOID*)(UINTN)NewS3TableBase, (VOID*)(UINTN)S3TableBase, TableLength);\r
gBS->FreePages (S3TableBase, mS3BootScriptTablePtr->TableMemoryPageNumber);\r
mS3BootScriptTablePtr->TableBase = (UINT8*)(UINTN)NewS3TableBase;\r
mS3BootScriptTablePtr->TableBase = (UINT8*)(UINTN)NewS3TableBase;\r
- mS3BootScriptTablePtr->TableMemoryPageNumber = (UINT16) (2 + PageNumber + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber)); \r
+ mS3BootScriptTablePtr->TableMemoryPageNumber = (UINT16) (2 + PageNumber + PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber));\r
- // calculate the the start address for the new entry. \r
+ // calculate the the start address for the new entry.\r
//\r
NewEntryPtr = mS3BootScriptTablePtr->TableBase + TableLength;\r
//\r
NewEntryPtr = mS3BootScriptTablePtr->TableBase + TableLength;\r
//\r
// update the table lenghth\r
//\r
mS3BootScriptTablePtr->TableLength = TableLength + EntryLength;\r
//\r
// update the table lenghth\r
//\r
mS3BootScriptTablePtr->TableLength = TableLength + EntryLength;\r
//\r
// In the boot time, we will not append the termination entry to the boot script\r
//\r
// In the boot time, we will not append the termination entry to the boot script\r
- // table until the callers think there is no boot time data that should be added and \r
- // it is caller's responsibility to explicit call the CloseTable. \r
+ // table until the callers think there is no boot time data that should be added and\r
+ // it is caller's responsibility to explicit call the CloseTable.\r
- \r
- return NewEntryPtr; \r
+\r
+ return NewEntryPtr;\r
}\r
/**\r
To get the start address from which a new runtime(after SmmReadyToLock) s3 boot script entry will write into.\r
In this case, it should be ensured that there is enough buffer to hold the entry.\r
}\r
/**\r
To get the start address from which a new runtime(after SmmReadyToLock) s3 boot script entry will write into.\r
In this case, it should be ensured that there is enough buffer to hold the entry.\r
@param EntryLength the new entry length.\r
@param EntryLength the new entry length.\r
@retval the address from which the a new s3 runtime(after SmmReadyToLock) script entry will write into\r
**/\r
UINT8*\r
@retval the address from which the a new s3 runtime(after SmmReadyToLock) script entry will write into\r
**/\r
UINT8*\r
)\r
{\r
UINT8 *NewEntryPtr;\r
)\r
{\r
UINT8 *NewEntryPtr;\r
- \r
- NewEntryPtr = NULL; \r
+\r
+ NewEntryPtr = NULL;\r
- // Check if the memory range reserved for S3 Boot Script table is large enough to hold the node. \r
+ // Check if the memory range reserved for S3 Boot Script table is large enough to hold the node.\r
//\r
if ((UINTN) (mS3BootScriptTablePtr->TableLength + EntryLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE)) <= (UINTN) EFI_PAGES_TO_SIZE ((UINTN) (mS3BootScriptTablePtr->TableMemoryPageNumber))) {\r
//\r
if ((UINTN) (mS3BootScriptTablePtr->TableLength + EntryLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE)) <= (UINTN) EFI_PAGES_TO_SIZE ((UINTN) (mS3BootScriptTablePtr->TableMemoryPageNumber))) {\r
- NewEntryPtr = mS3BootScriptTablePtr->TableBase + mS3BootScriptTablePtr->TableLength; \r
+ NewEntryPtr = mS3BootScriptTablePtr->TableBase + mS3BootScriptTablePtr->TableLength;\r
mS3BootScriptTablePtr->TableLength = mS3BootScriptTablePtr->TableLength + EntryLength;\r
//\r
// Append a terminate node on every insert\r
//\r
S3BootScriptInternalCloseTable ();\r
}\r
mS3BootScriptTablePtr->TableLength = mS3BootScriptTablePtr->TableLength + EntryLength;\r
//\r
// Append a terminate node on every insert\r
//\r
S3BootScriptInternalCloseTable ();\r
}\r
- return (UINT8*)NewEntryPtr; \r
+ return (UINT8*)NewEntryPtr;\r
\r
/**\r
To get the start address from which a new s3 boot script entry will write into.\r
\r
/**\r
To get the start address from which a new s3 boot script entry will write into.\r
@param EntryLength the new entry length.\r
@param EntryLength the new entry length.\r
- \r
- @retval the address from which the a new s3 boot script entry will write into \r
- **/ \r
-UINT8* \r
+\r
+ @retval the address from which the a new s3 boot script entry will write into\r
+ **/\r
+UINT8*\r
S3BootScriptGetEntryAddAddress (\r
UINT8 EntryLength\r
)\r
S3BootScriptGetEntryAddAddress (\r
UINT8 EntryLength\r
)\r
NewEntryPtr = S3BootScriptGetRuntimeEntryAddAddress (EntryLength);\r
} else {\r
NewEntryPtr = S3BootScriptGetBootTimeEntryAddAddress (EntryLength);\r
NewEntryPtr = S3BootScriptGetRuntimeEntryAddAddress (EntryLength);\r
} else {\r
NewEntryPtr = S3BootScriptGetBootTimeEntryAddAddress (EntryLength);\r
\r
/**\r
Sync BootScript LockBox data.\r
\r
/**\r
Sync BootScript LockBox data.\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
ASSERT_EFI_ERROR (Status);\r
}\r
\r
-/** \r
- This is an function to close the S3 boot script table. The function could only be called in \r
- BOOT time phase. To comply with the Framework spec definition on \r
+/**\r
+ This is an function to close the S3 boot script table. The function could only be called in\r
+ BOOT time phase. To comply with the Framework spec definition on\r
EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:\r
1. Closes the specified boot script table\r
EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable(), this function will fulfill following things:\r
1. Closes the specified boot script table\r
- 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table. \r
- Once this function is called, the table maintained by the library will be destroyed \r
+ 2. It allocates a new memory pool to duplicate all the boot scripts in the specified table.\r
+ Once this function is called, the table maintained by the library will be destroyed\r
after it is copied into the allocated pool.\r
after it is copied into the allocated pool.\r
- 3. Any attempts to add a script record after calling this function will cause a new table \r
+ 3. Any attempts to add a script record after calling this function will cause a new table\r
to be created by the library.\r
to be created by the library.\r
- 4. The base address of the allocated pool will be returned in Address. Note that after \r
+ 4. The base address of the allocated pool will be returned in Address. Note that after\r
using the boot script table, the CALLER is responsible for freeing the pool that is allocated\r
using the boot script table, the CALLER is responsible for freeing the pool that is allocated\r
- In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. To provides this API for now is \r
+ In Spec PI1.1, this EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is retired. To provides this API for now is\r
for Framework Spec compatibility.\r
for Framework Spec compatibility.\r
- \r
- If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out \r
- how to get the script to run at S3 resume because the boot script maintained by the lib will be \r
+\r
+ If anyone does call CloseTable() on a real platform, then the caller is responsible for figuring out\r
+ how to get the script to run at S3 resume because the boot script maintained by the lib will be\r
- \r
- @return the base address of the new copy of the boot script table. \r
+\r
+ @return the base address of the new copy of the boot script table.\r
@note this function could only called in boot time phase\r
\r
**/\r
@note this function could only called in boot time phase\r
\r
**/\r
UINT8 *Buffer;\r
EFI_STATUS Status;\r
EFI_BOOT_SCRIPT_TABLE_HEADER *ScriptTableInfo;\r
UINT8 *Buffer;\r
EFI_STATUS Status;\r
EFI_BOOT_SCRIPT_TABLE_HEADER *ScriptTableInfo;\r
- \r
- S3TableBase = mS3BootScriptTablePtr->TableBase; \r
+\r
+ S3TableBase = mS3BootScriptTablePtr->TableBase;\r
if (S3TableBase == 0) {\r
if (S3TableBase == 0) {\r
}\r
//\r
// Append the termination record the S3 boot script table\r
}\r
//\r
// Append the termination record the S3 boot script table\r
S3BootScriptInternalCloseTable();\r
TableLength = mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE);\r
//\r
S3BootScriptInternalCloseTable();\r
TableLength = mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE);\r
//\r
- // Allocate the buffer and copy the boot script to the buffer. \r
+ // Allocate the buffer and copy the boot script to the buffer.\r
//\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
//\r
Status = gBS->AllocatePool (\r
EfiBootServicesData,\r
(VOID **) &Buffer\r
);\r
if (EFI_ERROR (Status)) {\r
(VOID **) &Buffer\r
);\r
if (EFI_ERROR (Status)) {\r
}\r
CopyMem (Buffer, S3TableBase, TableLength);\r
}\r
CopyMem (Buffer, S3TableBase, TableLength);\r
- // Destroy the table maintained by the library so that the next write operation \r
+ // Destroy the table maintained by the library so that the next write operation\r
// will write the record to the first entry of the table.\r
//\r
// Fill the table header.\r
// will write the record to the first entry of the table.\r
//\r
// Fill the table header.\r
ScriptTableInfo->OpCode = S3_BOOT_SCRIPT_LIB_TABLE_OPCODE;\r
ScriptTableInfo->Length = (UINT8) sizeof (EFI_BOOT_SCRIPT_TABLE_HEADER);\r
ScriptTableInfo->TableLength = 0; // will be calculate at close the table\r
ScriptTableInfo->OpCode = S3_BOOT_SCRIPT_LIB_TABLE_OPCODE;\r
ScriptTableInfo->Length = (UINT8) sizeof (EFI_BOOT_SCRIPT_TABLE_HEADER);\r
ScriptTableInfo->TableLength = 0; // will be calculate at close the table\r
mS3BootScriptTablePtr->TableLength = sizeof (EFI_BOOT_SCRIPT_TABLE_HEADER);\r
return Buffer;\r
}\r
/**\r
mS3BootScriptTablePtr->TableLength = sizeof (EFI_BOOT_SCRIPT_TABLE_HEADER);\r
return Buffer;\r
}\r
/**\r
- Save I/O write to boot script \r
+ Save I/O write to boot script\r
\r
@param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
@param Address The base address of the I/O operations.\r
\r
@param Width The width of the I/O operations.Enumerated in S3_BOOT_SCRIPT_LIB_WIDTH.\r
@param Address The base address of the I/O operations.\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_WRITE) + (WidthInByte * Count));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_WRITE) + (WidthInByte * Count));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + (WidthInByte * 2));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
ScriptIoReadWrite.Length = Length;\r
ScriptIoReadWrite.Width = Width;\r
ScriptIoReadWrite.Address = Address;\r
ScriptIoReadWrite.Length = Length;\r
ScriptIoReadWrite.Width = Width;\r
ScriptIoReadWrite.Address = Address;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptIoReadWrite, sizeof(EFI_BOOT_SCRIPT_IO_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE)), Data, WidthInByte);\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + WidthInByte), DataMask, WidthInByte);\r
CopyMem ((VOID*)Script, (VOID*)&ScriptIoReadWrite, sizeof(EFI_BOOT_SCRIPT_IO_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE)), Data, WidthInByte);\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + WidthInByte), DataMask, WidthInByte);\r
UINT8 *Script;\r
UINT8 WidthInByte;\r
EFI_BOOT_SCRIPT_MEM_WRITE ScriptMemWrite;\r
UINT8 *Script;\r
UINT8 WidthInByte;\r
EFI_BOOT_SCRIPT_MEM_WRITE ScriptMemWrite;\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_WRITE) + (WidthInByte * Count));\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_WRITE) + (WidthInByte * Count));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
//\r
// Build script data\r
//\r
ScriptMemWrite.Width = Width;\r
ScriptMemWrite.Address = Address;\r
ScriptMemWrite.Count = (UINT32) Count;\r
ScriptMemWrite.Width = Width;\r
ScriptMemWrite.Address = Address;\r
ScriptMemWrite.Count = (UINT32) Count;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptMemWrite, sizeof(EFI_BOOT_SCRIPT_MEM_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_MEM_WRITE)), Buffer, WidthInByte * Count);\r
CopyMem ((VOID*)Script, (VOID*)&ScriptMemWrite, sizeof(EFI_BOOT_SCRIPT_MEM_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_MEM_WRITE)), Buffer, WidthInByte * Count);\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
UINT8 *Script;\r
UINT8 WidthInByte;\r
EFI_BOOT_SCRIPT_MEM_READ_WRITE ScriptMemReadWrite;\r
UINT8 *Script;\r
UINT8 WidthInByte;\r
EFI_BOOT_SCRIPT_MEM_READ_WRITE ScriptMemReadWrite;\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + (WidthInByte * 2));\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
// Build script data\r
ScriptMemReadWrite.OpCode = EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE;\r
ScriptMemReadWrite.Length = Length;\r
ScriptMemReadWrite.Width = Width;\r
ScriptMemReadWrite.Address = Address;\r
ScriptMemReadWrite.OpCode = EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE;\r
ScriptMemReadWrite.Length = Length;\r
ScriptMemReadWrite.Width = Width;\r
ScriptMemReadWrite.Address = Address;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptMemReadWrite , sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE)), Data, WidthInByte);\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + WidthInByte), DataMask, WidthInByte);\r
CopyMem ((VOID*)Script, (VOID*)&ScriptMemReadWrite , sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE)), Data, WidthInByte);\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + WidthInByte), DataMask, WidthInByte);\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE) + (WidthInByte * Count));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE) + (WidthInByte * Count));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
//\r
// Build script data\r
//\r
ScriptPciWrite.Width = Width;\r
ScriptPciWrite.Address = Address;\r
ScriptPciWrite.Count = (UINT32) Count;\r
ScriptPciWrite.Width = Width;\r
ScriptPciWrite.Address = Address;\r
ScriptPciWrite.Count = (UINT32) Count;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciWrite, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE)), Buffer, WidthInByte * Count);\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciWrite, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE)), Buffer, WidthInByte * Count);\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE) + (WidthInByte * 2));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
// Build script data\r
ScriptPciReadWrite.OpCode = EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE;\r
ScriptPciReadWrite.Length = Length;\r
ScriptPciReadWrite.Width = Width;\r
ScriptPciReadWrite.Address = Address;\r
ScriptPciReadWrite.OpCode = EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE;\r
ScriptPciReadWrite.Length = Length;\r
ScriptPciReadWrite.Width = Width;\r
ScriptPciReadWrite.Address = Address;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciReadWrite, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE)), Data, WidthInByte);\r
CopyMem (\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciReadWrite, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE)), Data, WidthInByte);\r
CopyMem (\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE) + (WidthInByte * Count));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE) + (WidthInByte * Count));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
//\r
// Build script data\r
//\r
ScriptPciWrite2.Address = Address;\r
ScriptPciWrite2.Segment = Segment;\r
ScriptPciWrite2.Count = (UINT32)Count;\r
ScriptPciWrite2.Address = Address;\r
ScriptPciWrite2.Segment = Segment;\r
ScriptPciWrite2.Count = (UINT32)Count;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciWrite2, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE)), Buffer, WidthInByte * Count);\r
\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciWrite2, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE)), Buffer, WidthInByte * Count);\r
\r
Width == S3BootScriptWidthFillUint64) {\r
return EFI_INVALID_PARAMETER;\r
}\r
Width == S3BootScriptWidthFillUint64) {\r
return EFI_INVALID_PARAMETER;\r
}\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE) + (WidthInByte * 2));\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
//\r
// Build script data\r
//\r
ScriptPciReadWrite2.Width = Width;\r
ScriptPciReadWrite2.Segment = Segment;\r
ScriptPciReadWrite2.Address = Address;\r
ScriptPciReadWrite2.Width = Width;\r
ScriptPciReadWrite2.Segment = Segment;\r
ScriptPciReadWrite2.Address = Address;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciReadWrite2, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE)), Data, WidthInByte);\r
CopyMem (\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciReadWrite2, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE)), Data, WidthInByte);\r
CopyMem (\r
DataMask,\r
WidthInByte\r
);\r
DataMask,\r
WidthInByte\r
);\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
for certain SMBus bus protocol, it will return EFI_SUCCESS; otherwise, it will return certain\r
error code based on the input SMBus bus protocol.\r
\r
for certain SMBus bus protocol, it will return EFI_SUCCESS; otherwise, it will return certain\r
error code based on the input SMBus bus protocol.\r
\r
- @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, \r
+ @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length,\r
and PEC.\r
@param Operation Signifies which particular SMBus hardware protocol instance that\r
it will use to execute the SMBus transactions. This SMBus\r
and PEC.\r
@param Operation Signifies which particular SMBus hardware protocol instance that\r
it will use to execute the SMBus transactions. This SMBus\r
buffer is identified by Length.\r
\r
@retval EFI_SUCCESS All the parameters are valid for the corresponding SMBus bus\r
buffer is identified by Length.\r
\r
@retval EFI_SUCCESS All the parameters are valid for the corresponding SMBus bus\r
@retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
@retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead\r
and EfiSmbusQuickWrite. Length is outside the range of valid\r
@retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
@retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead\r
and EfiSmbusQuickWrite. Length is outside the range of valid\r
UINTN RequiredLen;\r
EFI_SMBUS_DEVICE_COMMAND Command;\r
BOOLEAN PecCheck;\r
UINTN RequiredLen;\r
EFI_SMBUS_DEVICE_COMMAND Command;\r
BOOLEAN PecCheck;\r
Command = SMBUS_LIB_COMMAND (SmBusAddress);\r
PecCheck = SMBUS_LIB_PEC (SmBusAddress);\r
//\r
// Set default value to be 2:\r
Command = SMBUS_LIB_COMMAND (SmBusAddress);\r
PecCheck = SMBUS_LIB_PEC (SmBusAddress);\r
//\r
// Set default value to be 2:\r
- // for SmbusReadWord, SmbusWriteWord and SmbusProcessCall. \r
+ // for SmbusReadWord, SmbusWriteWord and SmbusProcessCall.\r
//\r
RequiredLen = 2;\r
Status = EFI_SUCCESS;\r
//\r
RequiredLen = 2;\r
Status = EFI_SUCCESS;\r
case EfiSmbusReadBlock:\r
case EfiSmbusWriteBlock:\r
case EfiSmbusBWBRProcessCall:\r
case EfiSmbusReadBlock:\r
case EfiSmbusWriteBlock:\r
case EfiSmbusBWBRProcessCall:\r
- if ((Buffer == NULL) || \r
- (Length == NULL) || \r
+ if ((Buffer == NULL) ||\r
+ (Length == NULL) ||\r
(*Length < MIN_SMBUS_BLOCK_LEN) ||\r
(*Length > MAX_SMBUS_BLOCK_LEN)) {\r
return EFI_INVALID_PARAMETER;\r
(*Length < MIN_SMBUS_BLOCK_LEN) ||\r
(*Length > MAX_SMBUS_BLOCK_LEN)) {\r
return EFI_INVALID_PARAMETER;\r
transactions.\r
@param Length A pointer to signify the number of bytes that this operation will do.\r
@param Buffer Contains the value of data to execute to the SMBUS slave device.\r
transactions.\r
@param Length A pointer to signify the number of bytes that this operation will do.\r
@param Buffer Contains the value of data to execute to the SMBUS slave device.\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
RETURN_STATUS\r
EFIAPI\r
S3BootScriptSaveSmbusExecute (\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
RETURN_STATUS\r
EFIAPI\r
S3BootScriptSaveSmbusExecute (\r
- IN UINTN SmBusAddress, \r
+ IN UINTN SmBusAddress,\r
IN EFI_SMBUS_OPERATION Operation,\r
IN UINTN *Length,\r
IN VOID *Buffer\r
IN EFI_SMBUS_OPERATION Operation,\r
IN UINTN *Length,\r
IN VOID *Buffer\r
}\r
\r
DataSize = (UINT8)(sizeof (EFI_BOOT_SCRIPT_SMBUS_EXECUTE) + BufferLength);\r
}\r
\r
DataSize = (UINT8)(sizeof (EFI_BOOT_SCRIPT_SMBUS_EXECUTE) + BufferLength);\r
Script = S3BootScriptGetEntryAddAddress (DataSize);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (DataSize);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Adds a record for an execution stall on the processor into a specified boot script table.\r
\r
@param Duration Duration in microseconds of the stall\r
Adds a record for an execution stall on the processor into a specified boot script table.\r
\r
@param Duration Duration in microseconds of the stall\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
EFI_BOOT_SCRIPT_STALL ScriptStall;\r
\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_STALL));\r
EFI_BOOT_SCRIPT_STALL ScriptStall;\r
\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_STALL));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
ScriptStall.OpCode = EFI_BOOT_SCRIPT_STALL_OPCODE;\r
ScriptStall.Length = Length;\r
ScriptStall.Duration = Duration;\r
//\r
// Build script data\r
//\r
ScriptStall.OpCode = EFI_BOOT_SCRIPT_STALL_OPCODE;\r
ScriptStall.Length = Length;\r
ScriptStall.Duration = Duration;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptStall, sizeof (EFI_BOOT_SCRIPT_STALL));\r
CopyMem ((VOID*)Script, (VOID*)&ScriptStall, sizeof (EFI_BOOT_SCRIPT_STALL));\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
\r
@param EntryPoint Entry point of the code to be dispatched.\r
@param Context Argument to be passed into the EntryPoint of the code to be dispatched.\r
\r
@param EntryPoint Entry point of the code to be dispatched.\r
@param Context Argument to be passed into the EntryPoint of the code to be dispatched.\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
UINT8 *Script;\r
EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2;\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH_2));\r
UINT8 *Script;\r
EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2;\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH_2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
//\r
// Build script data\r
//\r
ScriptDispatch2.Length = Length;\r
ScriptDispatch2.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;\r
ScriptDispatch2.Context = (EFI_PHYSICAL_ADDRESS)(UINTN)Context;\r
ScriptDispatch2.Length = Length;\r
ScriptDispatch2.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;\r
ScriptDispatch2.Context = (EFI_PHYSICAL_ADDRESS)(UINTN)Context;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptDispatch2, sizeof (EFI_BOOT_SCRIPT_DISPATCH_2));\r
CopyMem ((VOID*)Script, (VOID*)&ScriptDispatch2, sizeof (EFI_BOOT_SCRIPT_DISPATCH_2));\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
{\r
UINT8 Length;\r
UINT8 *Script;\r
{\r
UINT8 Length;\r
UINT8 *Script;\r
- UINT8 WidthInByte; \r
- EFI_BOOT_SCRIPT_MEM_POLL ScriptMemPoll; \r
+ UINT8 WidthInByte;\r
+ EFI_BOOT_SCRIPT_MEM_POLL ScriptMemPoll;\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + (WidthInByte * 2));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
ScriptMemPoll.OpCode = EFI_BOOT_SCRIPT_MEM_POLL_OPCODE;\r
ScriptMemPoll.Length = Length;\r
//\r
ScriptMemPoll.OpCode = EFI_BOOT_SCRIPT_MEM_POLL_OPCODE;\r
ScriptMemPoll.Length = Length;\r
- ScriptMemPoll.Width = Width; \r
+ ScriptMemPoll.Width = Width;\r
ScriptMemPoll.Address = Address;\r
ScriptMemPoll.Duration = Duration;\r
ScriptMemPoll.LoopTimes = LoopTimes;\r
\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_MEM_POLL)), BitValue, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + WidthInByte), BitMask, WidthInByte);\r
ScriptMemPoll.Address = Address;\r
ScriptMemPoll.Duration = Duration;\r
ScriptMemPoll.LoopTimes = LoopTimes;\r
\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_MEM_POLL)), BitValue, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + WidthInByte), BitMask, WidthInByte);\r
- CopyMem ((VOID*)Script, (VOID*)&ScriptMemPoll, sizeof (EFI_BOOT_SCRIPT_MEM_POLL)); \r
+ CopyMem ((VOID*)Script, (VOID*)&ScriptMemPoll, sizeof (EFI_BOOT_SCRIPT_MEM_POLL));\r
\r
SyncBootScript (Script);\r
\r
\r
SyncBootScript (Script);\r
\r
/**\r
Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only\r
used for debugging script issues.\r
/**\r
Store arbitrary information in the boot script table. This opcode is a no-op on dispatch and is only\r
used for debugging script issues.\r
@param InformationLength Length of the data in bytes\r
@param Information Information to be logged in the boot scrpit\r
@param InformationLength Length of the data in bytes\r
@param Information Information to be logged in the boot scrpit\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
\r
RETURN_STATUS\r
EFIAPI\r
S3BootScriptSaveInformation (\r
RETURN_STATUS\r
EFIAPI\r
S3BootScriptSaveInformation (\r
- IN UINT32 InformationLength, \r
+ IN UINT32 InformationLength,\r
IN VOID *Information\r
)\r
{\r
IN VOID *Information\r
)\r
{\r
ScriptInformation.Length = Length;\r
\r
\r
ScriptInformation.Length = Length;\r
\r
\r
- ScriptInformation.InformationLength = InformationLength; \r
+ ScriptInformation.InformationLength = InformationLength;\r
\r
CopyMem ((VOID*)Script, (VOID*)&ScriptInformation, sizeof (EFI_BOOT_SCRIPT_INFORMATION));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_INFORMATION)), (VOID *) Information, (UINTN) InformationLength);\r
\r
CopyMem ((VOID*)Script, (VOID*)&ScriptInformation, sizeof (EFI_BOOT_SCRIPT_INFORMATION));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_INFORMATION)), (VOID *) Information, (UINTN) InformationLength);\r
/**\r
Store a string in the boot script table. This opcode is a no-op on dispatch and is only\r
used for debugging script issues.\r
/**\r
Store a string in the boot script table. This opcode is a no-op on dispatch and is only\r
used for debugging script issues.\r
@param String The string to save to boot script table\r
@param String The string to save to boot script table\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
\r
IN CONST CHAR8 *String\r
)\r
{\r
IN CONST CHAR8 *String\r
)\r
{\r
- return S3BootScriptSaveInformation ( \r
- (UINT32) AsciiStrLen (String) + 1, \r
+ return S3BootScriptSaveInformation (\r
+ (UINT32) AsciiStrLen (String) + 1,\r
(VOID*) String\r
);\r
}\r
(VOID*) String\r
);\r
}\r
Adds a record for dispatching specified arbitrary code into a specified boot script table.\r
\r
@param EntryPoint Entry point of the code to be dispatched.\r
Adds a record for dispatching specified arbitrary code into a specified boot script table.\r
\r
@param EntryPoint Entry point of the code to be dispatched.\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
**/\r
UINT8 Length;\r
UINT8 *Script;\r
EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch;\r
UINT8 Length;\r
UINT8 *Script;\r
EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch;\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
ScriptDispatch.OpCode = EFI_BOOT_SCRIPT_DISPATCH_OPCODE;\r
ScriptDispatch.Length = Length;\r
ScriptDispatch.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;\r
//\r
// Build script data\r
//\r
ScriptDispatch.OpCode = EFI_BOOT_SCRIPT_DISPATCH_OPCODE;\r
ScriptDispatch.Length = Length;\r
ScriptDispatch.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;\r
- \r
- CopyMem ((VOID*)Script, (VOID*)&ScriptDispatch, sizeof (EFI_BOOT_SCRIPT_DISPATCH)); \r
- \r
+\r
+ CopyMem ((VOID*)Script, (VOID*)&ScriptDispatch, sizeof (EFI_BOOT_SCRIPT_DISPATCH));\r
+\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
/**\r
Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a\r
defined duration.\r
/**\r
Adds a record for I/O reads the I/O location and continues when the exit criteria is satisfied or after a\r
defined duration.\r
- \r
- @param Width The width of the I/O operations. \r
+\r
+ @param Width The width of the I/O operations.\r
@param Address The base address of the I/O operations.\r
@param Data The comparison value used for the polling exit criteria.\r
@param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero\r
@param Address The base address of the I/O operations.\r
@param Data The comparison value used for the polling exit criteria.\r
@param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT64 Address,\r
IN VOID *Data,\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT64 Address,\r
IN VOID *Data,\r
- IN VOID *DataMask, \r
- IN UINT64 Delay \r
+ IN VOID *DataMask,\r
+ IN UINT64 Delay\r
UINT8 *Script;\r
UINT8 Length;\r
EFI_BOOT_SCRIPT_IO_POLL ScriptIoPoll;\r
UINT8 *Script;\r
UINT8 Length;\r
EFI_BOOT_SCRIPT_IO_POLL ScriptIoPoll;\r
- WidthInByte = (UINT8) (0x01 << (Width & 0x03)); \r
+\r
+ WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_POLL) + (WidthInByte * 2));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_POLL) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
ScriptIoPoll.OpCode = EFI_BOOT_SCRIPT_IO_POLL_OPCODE;\r
ScriptIoPoll.Length = (UINT8) (sizeof (EFI_BOOT_SCRIPT_IO_POLL) + (WidthInByte * 2));\r
//\r
// Build script data\r
//\r
ScriptIoPoll.OpCode = EFI_BOOT_SCRIPT_IO_POLL_OPCODE;\r
ScriptIoPoll.Length = (UINT8) (sizeof (EFI_BOOT_SCRIPT_IO_POLL) + (WidthInByte * 2));\r
- ScriptIoPoll.Width = Width; \r
+ ScriptIoPoll.Width = Width;\r
ScriptIoPoll.Address = Address;\r
ScriptIoPoll.Delay = Delay;\r
\r
ScriptIoPoll.Address = Address;\r
ScriptIoPoll.Delay = Delay;\r
\r
- CopyMem ((VOID*)Script, (VOID*)&ScriptIoPoll, sizeof (EFI_BOOT_SCRIPT_IO_POLL)); \r
+ CopyMem ((VOID*)Script, (VOID*)&ScriptIoPoll, sizeof (EFI_BOOT_SCRIPT_IO_POLL));\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_IO_POLL)), Data, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_IO_POLL) + WidthInByte), DataMask, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_IO_POLL)), Data, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_IO_POLL) + WidthInByte), DataMask, WidthInByte);\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or\r
after a defined duration.\r
\r
Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or\r
after a defined duration.\r
\r
- @param Width The width of the I/O operations. \r
+ @param Width The width of the I/O operations.\r
@param Address The address within the PCI configuration space.\r
@param Data The comparison value used for the polling exit criteria.\r
@param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero\r
@param Address The address within the PCI configuration space.\r
@param Data The comparison value used for the polling exit criteria.\r
@param DataMask Mask used for the polling criteria. The bits in the bytes below Width which are zero\r
UINT8 Length;\r
EFI_BOOT_SCRIPT_PCI_CONFIG_POLL ScriptPciPoll;\r
\r
UINT8 Length;\r
EFI_BOOT_SCRIPT_PCI_CONFIG_POLL ScriptPciPoll;\r
\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL) + (WidthInByte * 2));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
ScriptPciPoll.OpCode = EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE;\r
ScriptPciPoll.Length = (UINT8) (sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL) + (WidthInByte * 2));\r
//\r
ScriptPciPoll.OpCode = EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE;\r
ScriptPciPoll.Length = (UINT8) (sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL) + (WidthInByte * 2));\r
- ScriptPciPoll.Width = Width; \r
+ ScriptPciPoll.Width = Width;\r
ScriptPciPoll.Address = Address;\r
ScriptPciPoll.Delay = Delay;\r
\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciPoll, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL));\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL)), Data, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL) + WidthInByte), DataMask, WidthInByte);\r
ScriptPciPoll.Address = Address;\r
ScriptPciPoll.Delay = Delay;\r
\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPciPoll, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL));\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL)), Data, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL) + WidthInByte), DataMask, WidthInByte);\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or\r
after a defined duration.\r
\r
Adds a record for PCI configuration space reads and continues when the exit criteria is satisfied or\r
after a defined duration.\r
\r
- @param Width The width of the I/O operations. \r
+ @param Width The width of the I/O operations.\r
@param Segment The PCI segment number for Address.\r
@param Address The address within the PCI configuration space.\r
@param Data The comparison value used for the polling exit criteria.\r
@param Segment The PCI segment number for Address.\r
@param Address The address within the PCI configuration space.\r
@param Data The comparison value used for the polling exit criteria.\r
IN UINT64 Delay\r
)\r
{\r
IN UINT64 Delay\r
)\r
{\r
UINT8 *Script;\r
UINT8 Length;\r
EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL ScriptPci2Poll;\r
UINT8 *Script;\r
UINT8 Length;\r
EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL ScriptPci2Poll;\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL) + (WidthInByte * 2));\r
\r
WidthInByte = (UINT8) (0x01 << (Width & 0x03));\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL) + (WidthInByte * 2));\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
//\r
// Build script data\r
//\r
ScriptPci2Poll.OpCode = EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE;\r
ScriptPci2Poll.Length = (UINT8) (sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL) + (WidthInByte * 2));\r
//\r
// Build script data\r
//\r
ScriptPci2Poll.OpCode = EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE;\r
ScriptPci2Poll.Length = (UINT8) (sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL) + (WidthInByte * 2));\r
- ScriptPci2Poll.Width = Width; \r
+ ScriptPci2Poll.Width = Width;\r
ScriptPci2Poll.Segment = Segment;\r
ScriptPci2Poll.Address = Address;\r
ScriptPci2Poll.Delay = Delay;\r
ScriptPci2Poll.Segment = Segment;\r
ScriptPci2Poll.Address = Address;\r
ScriptPci2Poll.Delay = Delay;\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPci2Poll, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL));\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL)), Data, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL) + WidthInByte), DataMask, WidthInByte);\r
CopyMem ((VOID*)Script, (VOID*)&ScriptPci2Poll, sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL));\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL)), Data, WidthInByte);\r
CopyMem ((UINT8 *) (Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL) + WidthInByte), DataMask, WidthInByte);\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
}\r
/**\r
Do the calculation of start address from which a new s3 boot script entry will write into.\r
SyncBootScript (Script);\r
\r
return RETURN_SUCCESS;\r
}\r
/**\r
Do the calculation of start address from which a new s3 boot script entry will write into.\r
@param EntryLength The new entry length.\r
@param Position specifies the position in the boot script table where the opcode will be\r
@param EntryLength The new entry length.\r
@param Position specifies the position in the boot script table where the opcode will be\r
- inserted, either before or after, depending on BeforeOrAfter. \r
+ inserted, either before or after, depending on BeforeOrAfter.\r
@param BeforeOrAfter The flag to indicate to insert the nod before or after the position.\r
This parameter is effective when InsertFlag is TRUE\r
@param Script return out the position from which the a new s3 boot script entry will write into\r
@param BeforeOrAfter The flag to indicate to insert the nod before or after the position.\r
This parameter is effective when InsertFlag is TRUE\r
@param Script return out the position from which the a new s3 boot script entry will write into\r
IN UINT8 EntryLength,\r
IN VOID *Position OPTIONAL,\r
IN BOOLEAN BeforeOrAfter OPTIONAL,\r
IN UINT8 EntryLength,\r
IN VOID *Position OPTIONAL,\r
IN BOOLEAN BeforeOrAfter OPTIONAL,\r
)\r
{\r
UINTN TableLength;\r
UINT8 *S3TableBase;\r
)\r
{\r
UINTN TableLength;\r
UINT8 *S3TableBase;\r
- UINTN PositionOffset; \r
+ UINTN PositionOffset;\r
EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader;\r
//\r
// The entry inserting to table is already added to the end of the table\r
//\r
TableLength = mS3BootScriptTablePtr->TableLength - EntryLength;\r
S3TableBase = mS3BootScriptTablePtr->TableBase ;\r
EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader;\r
//\r
// The entry inserting to table is already added to the end of the table\r
//\r
TableLength = mS3BootScriptTablePtr->TableLength - EntryLength;\r
S3TableBase = mS3BootScriptTablePtr->TableBase ;\r
// calculate the Position offset\r
//\r
if (Position != NULL) {\r
PositionOffset = (UINTN) ((UINT8 *)Position - S3TableBase);\r
// calculate the Position offset\r
//\r
if (Position != NULL) {\r
PositionOffset = (UINTN) ((UINT8 *)Position - S3TableBase);\r
//\r
// If the BeforeOrAfter is FALSE, that means to insert the node right after the node.\r
//\r
if (!BeforeOrAfter) {\r
//\r
// If the BeforeOrAfter is FALSE, that means to insert the node right after the node.\r
//\r
if (!BeforeOrAfter) {\r
- CopyMem ((VOID*)&ScriptHeader, Position, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER)); \r
+ CopyMem ((VOID*)&ScriptHeader, Position, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER));\r
PositionOffset += (ScriptHeader.Length);\r
}\r
PositionOffset += (ScriptHeader.Length);\r
}\r
// Insert the node before the adjusted Position\r
//\r
// Insert the node before the adjusted Position\r
//\r
- CopyMem (S3TableBase+PositionOffset+EntryLength, S3TableBase+PositionOffset, TableLength - PositionOffset); \r
+ CopyMem (S3TableBase+PositionOffset+EntryLength, S3TableBase+PositionOffset, TableLength - PositionOffset);\r
- // calculate the the start address for the new entry. \r
+ // calculate the the start address for the new entry.\r
//\r
*Script = S3TableBase + PositionOffset;\r
//\r
*Script = S3TableBase + PositionOffset;\r
} else {\r
if (!BeforeOrAfter) {\r
//\r
// Insert the node to the end of the table\r
//\r
} else {\r
if (!BeforeOrAfter) {\r
//\r
// Insert the node to the end of the table\r
//\r
- *Script = S3TableBase + TableLength; \r
+ *Script = S3TableBase + TableLength;\r
// Insert the node to the beginning of the table\r
//\r
PositionOffset = (UINTN) sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER);\r
// Insert the node to the beginning of the table\r
//\r
PositionOffset = (UINTN) sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER);\r
- CopyMem (S3TableBase+PositionOffset+EntryLength, S3TableBase+PositionOffset, TableLength - PositionOffset); \r
- *Script = S3TableBase + PositionOffset; \r
+ CopyMem (S3TableBase+PositionOffset+EntryLength, S3TableBase+PositionOffset, TableLength - PositionOffset);\r
+ *Script = S3TableBase + PositionOffset;\r
- Move the last boot script entry to the position \r
+ Move the last boot script entry to the position\r
\r
@param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
in the boot script table specified by Position. If Position is NULL or points to\r
\r
@param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
in the boot script table specified by Position. If Position is NULL or points to\r
UINTN StartAddress;\r
UINT32 TableLength;\r
EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader;\r
BOOLEAN ValidatePosition;\r
UINT8* LastOpcode;\r
UINT8 TempBootScriptEntry[BOOT_SCRIPT_NODE_MAX_LENGTH];\r
UINTN StartAddress;\r
UINT32 TableLength;\r
EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader;\r
BOOLEAN ValidatePosition;\r
UINT8* LastOpcode;\r
UINT8 TempBootScriptEntry[BOOT_SCRIPT_NODE_MAX_LENGTH];\r
ValidatePosition = FALSE;\r
TempPosition = (Position == NULL) ? NULL:(*Position);\r
\r
ValidatePosition = FALSE;\r
TempPosition = (Position == NULL) ? NULL:(*Position);\r
\r
//\r
// Find the last boot Script Entry which is not the terminate node\r
//\r
//\r
// Find the last boot Script Entry which is not the terminate node\r
//\r
- while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) { \r
- CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER)); \r
+ while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) {\r
+ CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER));\r
if (TempPosition != NULL && TempPosition == Script) {\r
//\r
if (TempPosition != NULL && TempPosition == Script) {\r
//\r
- // If the position is specified, the position must be pointed to a boot script entry start address. \r
+ // If the position is specified, the position must be pointed to a boot script entry start address.\r
//\r
ValidatePosition = TRUE;\r
}\r
if (ScriptHeader.OpCode != S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE) {\r
LastOpcode = Script;\r
//\r
ValidatePosition = TRUE;\r
}\r
if (ScriptHeader.OpCode != S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE) {\r
LastOpcode = Script;\r
Script = Script + ScriptHeader.Length;\r
}\r
//\r
Script = Script + ScriptHeader.Length;\r
}\r
//\r
if (TempPosition != NULL && !ValidatePosition) {\r
return RETURN_INVALID_PARAMETER;\r
}\r
if (TempPosition != NULL && !ValidatePosition) {\r
return RETURN_INVALID_PARAMETER;\r
}\r
- \r
- CopyMem ((VOID*)&ScriptHeader, LastOpcode, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER)); \r
- \r
- CopyMem((VOID*)TempBootScriptEntry, LastOpcode, ScriptHeader.Length); \r
+\r
+ CopyMem ((VOID*)&ScriptHeader, LastOpcode, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER));\r
+\r
+ CopyMem((VOID*)TempBootScriptEntry, LastOpcode, ScriptHeader.Length);\r
//\r
// Find the right position to write the node in\r
//\r
//\r
// Find the right position to write the node in\r
//\r
ScriptHeader.Length,\r
TempPosition,\r
BeforeOrAfter,\r
ScriptHeader.Length,\r
TempPosition,\r
BeforeOrAfter,\r
);\r
//\r
// Copy the node to Boot script table\r
);\r
//\r
// Copy the node to Boot script table\r
return RETURN_SUCCESS;\r
}\r
/**\r
return RETURN_SUCCESS;\r
}\r
/**\r
- Create a Label node in the boot script table. \r
- \r
+ Create a Label node in the boot script table.\r
+\r
@param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
in the boot script table specified by Position. If Position is NULL or points to\r
NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r
of the table (if FALSE).\r
@param Position On entry, specifies the position in the boot script table where the opcode will be\r
inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
@param BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position\r
in the boot script table specified by Position. If Position is NULL or points to\r
NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end\r
of the table (if FALSE).\r
@param Position On entry, specifies the position in the boot script table where the opcode will be\r
inserted, either before or after, depending on BeforeOrAfter. On exit, specifies\r
- the position of the inserted opcode in the boot script table. \r
+ the position of the inserted opcode in the boot script table.\r
@param InformationLength Length of the label in bytes\r
@param Information Label to be logged in the boot scrpit\r
@param InformationLength Length of the label in bytes\r
@param Information Label to be logged in the boot scrpit\r
@retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
@retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.\r
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.\r
@retval RETURN_SUCCESS Opcode is added.\r
EFIAPI\r
S3BootScriptLabelInternal (\r
IN BOOLEAN BeforeOrAfter,\r
EFIAPI\r
S3BootScriptLabelInternal (\r
IN BOOLEAN BeforeOrAfter,\r
- IN OUT VOID **Position OPTIONAL, \r
- IN UINT32 InformationLength, \r
+ IN OUT VOID **Position OPTIONAL,\r
+ IN UINT32 InformationLength,\r
IN CONST CHAR8 *Information\r
)\r
{\r
UINT8 Length;\r
UINT8 *Script;\r
EFI_BOOT_SCRIPT_INFORMATION ScriptInformation;\r
IN CONST CHAR8 *Information\r
)\r
{\r
UINT8 Length;\r
UINT8 *Script;\r
EFI_BOOT_SCRIPT_INFORMATION ScriptInformation;\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_INFORMATION) + InformationLength);\r
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_INFORMATION) + InformationLength);\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
Script = S3BootScriptGetEntryAddAddress (Length);\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
ScriptInformation.Length = Length;\r
\r
\r
ScriptInformation.Length = Length;\r
\r
\r
- ScriptInformation.InformationLength = InformationLength; \r
+ ScriptInformation.InformationLength = InformationLength;\r
\r
CopyMem ((VOID*)Script, (VOID*)&ScriptInformation, sizeof (EFI_BOOT_SCRIPT_INFORMATION));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_INFORMATION)), (VOID *) Information, (UINTN) InformationLength);\r
\r
CopyMem ((VOID*)Script, (VOID*)&ScriptInformation, sizeof (EFI_BOOT_SCRIPT_INFORMATION));\r
CopyMem ((VOID*)(Script + sizeof (EFI_BOOT_SCRIPT_INFORMATION)), (VOID *) Information, (UINTN) InformationLength);\r
Find a label within the boot script table and, if not present, optionally create it.\r
\r
@param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)\r
Find a label within the boot script table and, if not present, optionally create it.\r
\r
@param BeforeOrAfter Specifies whether the opcode is stored before (TRUE)\r
- or after (FALSE) the position in the boot script table \r
+ or after (FALSE) the position in the boot script table\r
- @param CreateIfNotFound Specifies whether the label will be created if the label \r
+ @param CreateIfNotFound Specifies whether the label will be created if the label\r
does not exists (TRUE) or not (FALSE).\r
@param Position On entry, specifies the position in the boot script table\r
where the opcode will be inserted, either before or after,\r
does not exists (TRUE) or not (FALSE).\r
@param Position On entry, specifies the position in the boot script table\r
where the opcode will be inserted, either before or after,\r
@retval EFI_SUCCESS The operation succeeded. A record was added into the\r
specified script table.\r
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
@retval EFI_SUCCESS The operation succeeded. A record was added into the\r
specified script table.\r
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
- If the opcode is unknow or not supported because of the PCD \r
+ If the opcode is unknow or not supported because of the PCD\r
Feature Flags.\r
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
\r
**/\r
RETURN_STATUS\r
Feature Flags.\r
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
\r
**/\r
RETURN_STATUS\r
S3BootScriptLabel (\r
IN BOOLEAN BeforeOrAfter,\r
IN BOOLEAN CreateIfNotFound,\r
S3BootScriptLabel (\r
IN BOOLEAN BeforeOrAfter,\r
IN BOOLEAN CreateIfNotFound,\r
if (Label[0] == '\0') {\r
return EFI_INVALID_PARAMETER;\r
}\r
if (Label[0] == '\0') {\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
// Check that the script is initialized and synced without adding an entry to the script.\r
// The code must search for the label first before it knows if a new entry needs\r
//\r
// Check that the script is initialized and synced without adding an entry to the script.\r
// The code must search for the label first before it knows if a new entry needs\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
}\r
if (Script == NULL) {\r
return RETURN_OUT_OF_RESOURCES;\r
}\r
//\r
// Check the header and search for existing label.\r
//\r
// Check the header and search for existing label.\r
Script = mS3BootScriptTablePtr->TableBase;\r
CopyMem ((VOID*)&TableHeader, Script, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER));\r
if (TableHeader.OpCode != S3_BOOT_SCRIPT_LIB_TABLE_OPCODE) {\r
Script = mS3BootScriptTablePtr->TableBase;\r
CopyMem ((VOID*)&TableHeader, Script, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER));\r
if (TableHeader.OpCode != S3_BOOT_SCRIPT_LIB_TABLE_OPCODE) {\r
TableLength = mS3BootScriptTablePtr->TableLength;\r
Script = Script + TableHeader.Length;\r
while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) {\r
TableLength = mS3BootScriptTablePtr->TableLength;\r
Script = Script + TableHeader.Length;\r
while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) {\r
- \r
- CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER)); \r
+\r
+ CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER));\r
if (ScriptHeader.OpCode == S3_BOOT_SCRIPT_LIB_LABEL_OPCODE) {\r
if (AsciiStrCmp ((CHAR8 *)(UINTN)(Script+sizeof(EFI_BOOT_SCRIPT_INFORMATION)), Label) == 0) {\r
if (ScriptHeader.OpCode == S3_BOOT_SCRIPT_LIB_LABEL_OPCODE) {\r
if (AsciiStrCmp ((CHAR8 *)(UINTN)(Script+sizeof(EFI_BOOT_SCRIPT_INFORMATION)), Label) == 0) {\r
- (*Position) = Script; \r
+ (*Position) = Script;\r
return EFI_SUCCESS;\r
}\r
return EFI_SUCCESS;\r
}\r
Script = Script + ScriptHeader.Length;\r
}\r
if (CreateIfNotFound) {\r
LabelLength = (UINT32)AsciiStrSize(Label);\r
Script = Script + ScriptHeader.Length;\r
}\r
if (CreateIfNotFound) {\r
LabelLength = (UINT32)AsciiStrSize(Label);\r
- return S3BootScriptLabelInternal (BeforeOrAfter,Position, LabelLength, Label); \r
+ return S3BootScriptLabelInternal (BeforeOrAfter,Position, LabelLength, Label);\r
} else {\r
return EFI_NOT_FOUND;\r
} else {\r
return EFI_NOT_FOUND;\r
@retval EFI_SUCCESS The operation succeeded. A record was added into the\r
specified script table.\r
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
@retval EFI_SUCCESS The operation succeeded. A record was added into the\r
specified script table.\r
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.\r
- If the opcode is unknow or not supported because of the PCD \r
+ If the opcode is unknow or not supported because of the PCD\r
Feature Flags.\r
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
\r
**/\r
RETURN_STATUS\r
Feature Flags.\r
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.\r
\r
**/\r
RETURN_STATUS\r
S3BootScriptCompare (\r
IN UINT8 *Position1,\r
IN UINT8 *Position2,\r
S3BootScriptCompare (\r
IN UINT8 *Position1,\r
IN UINT8 *Position2,\r
\r
if (RelativePosition == NULL) {\r
return EFI_INVALID_PARAMETER;\r
\r
if (RelativePosition == NULL) {\r
return EFI_INVALID_PARAMETER;\r
return EFI_INVALID_PARAMETER;\r
}\r
*RelativePosition = (Position1 < Position2)?-1:((Position1 == Position2)?0:1);\r
return EFI_INVALID_PARAMETER;\r
}\r
*RelativePosition = (Position1 < Position2)?-1:((Position1 == Position2)?0:1);\r
return EFI_SUCCESS;\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
UefiLib\r
SmbusLib\r
PciLib\r
UefiLib\r
SmbusLib\r
PciLib\r
LockBoxLib\r
\r
[Protocols]\r
LockBoxLib\r
\r
[Protocols]\r
// licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
// http://opensource.org/licenses/bsd-license.php\r
// licensed and made available under the terms and conditions of the BSD License\r
// which accompanies this distribution. The full text of the license may be found at\r
// http://opensource.org/licenses/bsd-license.php\r
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
//\r
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
//\r
- Support for S3 boot script lib. This file defined some internal macro and internal \r
+ Support for S3 boot script lib. This file defined some internal macro and internal\r
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
#define PCI_ADDRESS_ENCODE(A) (UINTN)PCI_LIB_ADDRESS( \\r
((((UINTN)(A))& 0xff000000) >> 24), ((((UINTN)(A)) &0x00ff0000) >> 16), ((((UINTN)(A)) & 0xff00) >> 8), ((RShiftU64 ((A), 32) & 0xfff) | ((A)& 0xff)) \\r
)\r
#define PCI_ADDRESS_ENCODE(A) (UINTN)PCI_LIB_ADDRESS( \\r
((((UINTN)(A))& 0xff000000) >> 24), ((((UINTN)(A)) &0x00ff0000) >> 16), ((((UINTN)(A)) & 0xff00) >> 8), ((RShiftU64 ((A), 32) & 0xfff) | ((A)& 0xff)) \\r
)\r
//\r
typedef struct {\r
UINT8 *TableBase;\r
//\r
typedef struct {\r
UINT8 *TableBase;\r
- UINT32 TableLength; // Record the actual memory length \r
- UINT16 TableMemoryPageNumber; // Record the page number Allocated for the table \r
+ UINT32 TableLength; // Record the actual memory length\r
+ UINT16 TableMemoryPageNumber; // Record the page number Allocated for the table\r
BOOLEAN InSmm; // Record if this library is in SMM.\r
BOOLEAN AtRuntime; // Record if current state is after SmmExitBootServices or SmmLegacyBoot.\r
UINT32 BootTimeScriptLength; // Maintain boot time script length in LockBox after SmmReadyToLock in SMM.\r
BOOLEAN InSmm; // Record if this library is in SMM.\r
BOOLEAN AtRuntime; // Record if current state is after SmmExitBootServices or SmmLegacyBoot.\r
UINT32 BootTimeScriptLength; // Maintain boot time script length in LockBox after SmmReadyToLock in SMM.\r