}\r
\r
/**\r
- Translates boot script to MDE library interface.\r
+ Perform IO read operation\r
\r
@param[in] Width Width of the operation.\r
@param[in] Address Address of the operation.\r
switch (Width) {\r
\r
case S3BootScriptWidthUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint8 = IoRead8 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFifoUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint8 = IoRead8 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFillUint8:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8Read - 0x%08x\n", Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN) Address));\r
*Out.Uint8 = IoRead8 ((UINTN) Address);\r
break;\r
\r
case S3BootScriptWidthUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint16 = IoRead16 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFifoUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint16 = IoRead16 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFillUint16:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16Read - 0x%08x\n", Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN) Address));\r
*Out.Uint16 = IoRead16 ((UINTN) Address);\r
break;\r
\r
case S3BootScriptWidthUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint32 = IoRead32 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFifoUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint32 = IoRead32 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFillUint32:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32Read - 0x%08x\n", Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN) Address));\r
*Out.Uint32 = IoRead32 ((UINTN) Address);\r
break;\r
\r
+ case S3BootScriptWidthUint64:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint64 = IoRead64 ((UINTN) Address);\r
+ break;\r
+ case S3BootScriptWidthFifoUint64:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint64 = IoRead64 ((UINTN) Address);\r
+ break;\r
+ case S3BootScriptWidthFillUint64:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN) Address));\r
+ *Out.Uint64 = IoRead64 ((UINTN) Address);\r
+ break;\r
+\r
default:\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
\r
/**\r
- Perform a write operation\r
+ Perform IO write operation\r
\r
@param[in] Width Width of the operation.\r
@param[in] Address Address of the operation.\r
return EFI_SUCCESS;\r
}\r
/**\r
- Interprete the IO write entry in S3 boot script and perform the write operation\r
+ Interprete the boot script node with EFI_BOOT_SCRIPT_IO_WRITE OP code.\r
\r
@param Script Pointer to the node which is to be interpreted.\r
\r
Address = IoWrite.Address;\r
Count = IoWrite.Count;\r
Buffer = Script + sizeof (EFI_BOOT_SCRIPT_IO_WRITE);\r
- \r
+\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecuteIoWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)Address, Count, (UINTN)Width));\r
return ScriptIoWrite(Width, Address, Count, Buffer);\r
}\r
/**\r
for (; Count > 0; Count--, Address += AddressStride, Out.Buf += BufferStride) {\r
switch (Width) {\r
case S3BootScriptWidthUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint8 = MmioRead8 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFifoUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint8 = MmioRead8 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFillUint8:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", (UINTN)Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", (UINTN)Address));\r
*Out.Uint8 = MmioRead8 ((UINTN) Address);\r
break;\r
\r
case S3BootScriptWidthUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint16 = MmioRead16 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFifoUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint16 = MmioRead16 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFillUint16:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", (UINTN)Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", (UINTN)Address));\r
*Out.Uint16 = MmioRead16 ((UINTN) Address);\r
break;\r
\r
case S3BootScriptWidthUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint32 = MmioRead32 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFifoUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint32 = MmioRead32 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFillUint32:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", (UINTN)Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", (UINTN)Address));\r
*Out.Uint32 = MmioRead32 ((UINTN) Address);\r
break;\r
\r
case S3BootScriptWidthUint64:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint64 = MmioRead64 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFifoUint64:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x\n", (UINTN)Address));\r
+ *Out.Uint64 = MmioRead64 ((UINTN) Address);\r
+ break;\r
case S3BootScriptWidthFillUint64:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x\n", (UINTN)Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x\n", (UINTN)Address));\r
*Out.Uint64 = MmioRead64 ((UINTN) Address);\r
break;\r
\r
return EFI_SUCCESS;\r
}\r
/**\r
- Translates boot script to MDE library interface.\r
+ Perform memory write operation\r
\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
Count = MemWrite.Count;\r
Buffer = Script + sizeof(EFI_BOOT_SCRIPT_MEM_WRITE);\r
\r
- DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)Address, (UINTN)Count, (UINTN)Width));\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
} \r
/**\r
- Translates boot script to MDE library interface for PCI configuration read operation\r
+ Performance PCI configuration read operation\r
\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
- @param Buffer Pointer to the buffer reaf from PCI config space\r
+ @param Count Count of the number of accesses to perform.\r
+ @param Buffer Pointer to the buffer read from PCI config space\r
\r
@retval EFI_SUCCESS The read succeed.\r
@retval EFI_INVALID_PARAMETER if Width is not defined \r
ScriptPciCfgRead (\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT64 Address,\r
+ IN UINTN Count,\r
OUT VOID *Buffer\r
)\r
{\r
+ EFI_STATUS Status;\r
+ UINTN AddressStride;\r
+ UINTN BufferStride;\r
+ PTR Out;\r
+ UINTN PciAddress;\r
+\r
+ Out.Buf = (UINT8 *) Buffer;\r
+\r
+ PciAddress = PCI_ADDRESS_ENCODE (Address);\r
+\r
+ Status = BuildLoopData (Width, PciAddress, &AddressStride, &BufferStride);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Loop for each iteration and move the data\r
+ //\r
+ for (; Count > 0; Count--, PciAddress += AddressStride, Out.Buf += BufferStride) {\r
switch (Width) {\r
case S3BootScriptWidthUint8:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%016lx\n", Address));\r
- * (UINT8 *) Buffer = PciRead8 (PCI_ADDRESS_ENCODE(Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", PciAddress));\r
+ *Out.Uint8 = PciRead8 (PciAddress);\r
+ break;\r
+ case S3BootScriptWidthFifoUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", PciAddress));\r
+ *Out.Uint8 = PciRead8 (PciAddress);\r
+ break;\r
+ case S3BootScriptWidthFillUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", PciAddress));\r
+ *Out.Uint8 = PciRead8 (PciAddress);\r
break;\r
\r
case S3BootScriptWidthUint16:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%016lx\n", Address));\r
- * (UINT16 *) Buffer = PciRead16 (PCI_ADDRESS_ENCODE(Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", PciAddress));\r
+ *Out.Uint16 = PciRead16 (PciAddress);\r
+ break;\r
+ case S3BootScriptWidthFifoUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", PciAddress));\r
+ *Out.Uint16 = PciRead16 (PciAddress);\r
+ break;\r
+ case S3BootScriptWidthFillUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", PciAddress));\r
+ *Out.Uint16 = PciRead16 (PciAddress);\r
break;\r
\r
case S3BootScriptWidthUint32:\r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%016lx\n", Address));\r
- * (UINT32 *) Buffer = PciRead32 (PCI_ADDRESS_ENCODE(Address));\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", PciAddress));\r
+ *Out.Uint32 = PciRead32 (PciAddress);\r
+ break;\r
+ case S3BootScriptWidthFifoUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", PciAddress));\r
+ *Out.Uint32 = PciRead32 (PciAddress);\r
+ break;\r
+ case S3BootScriptWidthFillUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", PciAddress));\r
+ *Out.Uint32 = PciRead32 (PciAddress);\r
break;\r
\r
default:\r
return EFI_INVALID_PARAMETER;\r
+ }\r
}\r
- return EFI_SUCCESS;\r
+ return EFI_SUCCESS;\r
}\r
\r
/**\r
- Translates boot script to MDE library interface for PCI configuration write operation\r
+ Performance PCI configuration write operation\r
\r
@param Width Width of the operation.\r
@param Address Address of the operation.\r
- @param Buffer Pointer to the buffer reaf from PCI config space\r
+ @param Count Count of the number of accesses to perform.\r
+ @param Buffer Pointer to the buffer write to PCI config space\r
\r
@retval EFI_SUCCESS The write succeed.\r
@retval EFI_INVALID_PARAMETER if Width is not defined \r
ScriptPciCfgWrite (\r
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT64 Address,\r
- OUT VOID *Buffer\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
)\r
{\r
- switch (Width) {\r
- case S3BootScriptWidthUint8:\r
- case S3BootScriptWidthFifoUint8:\r
- case S3BootScriptWidthFillUint8: \r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%016lx (0x%02x)\n", Address, (UINTN)*(UINT8 *) Buffer));\r
- PciWrite8 (PCI_ADDRESS_ENCODE(Address), *(UINT8 *) Buffer);\r
- break;\r
- case S3BootScriptWidthUint16:\r
- case S3BootScriptWidthFifoUint16:\r
- case S3BootScriptWidthFillUint16: \r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%016lx (0x%04x)\n", Address, (UINTN)*(UINT16 *) Buffer));\r
- PciWrite16 (PCI_ADDRESS_ENCODE(Address), *(UINT16 *) Buffer);\r
- break;\r
- case S3BootScriptWidthUint32:\r
- case S3BootScriptWidthFifoUint32:\r
- case S3BootScriptWidthFillUint32: \r
- DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%016lx (0x%08x)\n", Address, (UINTN)*(UINT32 *) Buffer));\r
- PciWrite32 (PCI_ADDRESS_ENCODE(Address), *(UINT32 *) Buffer);\r
- break;\r
- default:\r
- return EFI_INVALID_PARAMETER;\r
+ EFI_STATUS Status;\r
+ UINTN AddressStride;\r
+ UINTN BufferStride;\r
+ UINTN OriginalPciAddress;\r
+ PTR In;\r
+ PTR OriginalIn;\r
+ UINTN PciAddress;\r
+\r
+ In.Buf = (UINT8 *) Buffer;\r
+\r
+ PciAddress = PCI_ADDRESS_ENCODE (Address);\r
+\r
+ Status = BuildLoopData (Width, PciAddress, &AddressStride, &BufferStride);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
}\r
- return EFI_SUCCESS;\r
+ //\r
+ // Loop for each iteration and move the data\r
+ //\r
+ OriginalPciAddress = PciAddress;\r
+ OriginalIn.Buf = In.Buf;\r
+ for (; Count > 0; Count--, PciAddress += AddressStride, In.Buf += BufferStride) {\r
+ switch (Width) {\r
+ case S3BootScriptWidthUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*In.Uint8));\r
+ PciWrite8 (PciAddress, *In.Uint8);\r
+ break; \r
+ case S3BootScriptWidthFifoUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", OriginalPciAddress, (UINTN)*In.Uint8));\r
+ PciWrite8 (OriginalPciAddress, *In.Uint8);\r
+ break; \r
+ case S3BootScriptWidthFillUint8:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*OriginalIn.Uint8));\r
+ PciWrite8 (PciAddress, *OriginalIn.Uint8);\r
+ break;\r
+ case S3BootScriptWidthUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*In.Uint16));\r
+ PciWrite16 (PciAddress, *In.Uint16);\r
+ break; \r
+ case S3BootScriptWidthFifoUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", OriginalPciAddress, (UINTN)*In.Uint16));\r
+ PciWrite16 (OriginalPciAddress, *In.Uint16);\r
+ break; \r
+ case S3BootScriptWidthFillUint16:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*OriginalIn.Uint16));\r
+ PciWrite16 (PciAddress, *OriginalIn.Uint16);\r
+ break;\r
+ case S3BootScriptWidthUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", PciAddress, (UINTN)*In.Uint32));\r
+ PciWrite32 (PciAddress, *In.Uint32);\r
+ break; \r
+ case S3BootScriptWidthFifoUint32:\r
+ DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", OriginalPciAddress, (UINTN)*In.Uint32));\r
+ PciWrite32 (OriginalPciAddress, *In.Uint32);\r
+ break; \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
+ break;\r
+ default:\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ return EFI_SUCCESS;\r
}\r
/**\r
- Perform pci configure 2 read operation.\r
+ Performance PCI configuration 2 read operation\r
\r
@param Width Width of the operation.\r
@param Segment Pci segment number\r
@param Address Address of the operation.\r
- @param Buffer Pointer to the buffer to write to I/O space. \r
+ @param Count Count of the number of accesses to perform.\r
+ @param Buffer Pointer to the buffer to read from PCI config 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
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT16 Segment, \r
IN UINT64 Address,\r
+ IN UINTN Count,\r
OUT VOID *Buffer\r
)\r
{\r
ASSERT (Segment==0);\r
\r
- return ScriptPciCfgRead (Width, Address, Buffer);\r
+ return ScriptPciCfgRead (Width, Address, Count, Buffer);\r
}\r
/**\r
- Perform pci configure write operation.\r
+ Performance PCI configuration 2 write operation\r
\r
@param Width Width of the operation.\r
@param Segment Pci segment number\r
@param Address Address of the operation.\r
- @param Buffer Pointer to the buffer to write to I/O space. \r
+ @param Count Count of the number of accesses to perform.\r
+ @param Buffer Pointer to the buffer to write to PCI config 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
IN S3_BOOT_SCRIPT_LIB_WIDTH Width,\r
IN UINT16 Segment, \r
IN UINT64 Address,\r
- OUT VOID *Buffer\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
)\r
{\r
ASSERT (Segment==0);\r
- return ScriptPciCfgWrite (Width, Address, Buffer);\r
+ return ScriptPciCfgWrite (Width, Address, Count, Buffer);\r
}\r
/**\r
- Perform Pci configuration Write operation.\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
IN UINT8 *Script\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT8 *Buffer;\r
- UINTN DataWidth;\r
- UINTN Index;\r
- UINT64 PciAddress;\r
- UINT8 Reg;\r
- EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE PciConfigWrite;\r
-\r
- CopyMem ((VOID*)&PciConfigWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE));\r
- Status = EFI_SUCCESS;\r
-\r
- PciAddress = PciConfigWrite.Address;\r
- DataWidth = (UINT32)(0x01 << (PciConfigWrite.Width));\r
- Buffer = Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE);\r
+ VOID *Buffer;\r
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
+ UINT64 Address;\r
+ UINTN Count;\r
+ EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE PciCfgWrite;\r
\r
- DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)PciAddress, (UINTN)PciConfigWrite.Count, (UINTN)DataWidth));\r
-\r
- for (Index = 0; Index < PciConfigWrite.Count; Index++) {\r
- Status = ScriptPciCfgWrite (\r
- (S3_BOOT_SCRIPT_LIB_WIDTH) PciConfigWrite.Width,\r
- PciAddress,\r
- Buffer\r
- );\r
+ CopyMem ((VOID*)&PciCfgWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE));\r
\r
- if ( S3BootScriptWidthFillUint8 != PciConfigWrite.Width ||\r
- S3BootScriptWidthFillUint16 != PciConfigWrite.Width || \r
- S3BootScriptWidthFillUint32 != PciConfigWrite.Width ||\r
- S3BootScriptWidthFillUint64 != PciConfigWrite.Width){\r
- Reg = (UINT8) ((UINT8) PciAddress + DataWidth);\r
- PciAddress = (PciAddress & 0xFFFFFFFFFFFFFF00ULL) + Reg;\r
- }\r
-\r
- if (S3BootScriptWidthFifoUint8 != PciConfigWrite.Width ||\r
- S3BootScriptWidthFifoUint16 != PciConfigWrite.Width || \r
- S3BootScriptWidthFifoUint32 != PciConfigWrite.Width ||\r
- S3BootScriptWidthFifoUint64 != PciConfigWrite.Width) {\r
- Buffer += DataWidth;\r
- }\r
- }\r
+ Width = (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfgWrite.Width;\r
+ Address = PciCfgWrite.Address;\r
+ Count = PciCfgWrite.Count;\r
+ Buffer = Script + sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE);\r
\r
- return Status;\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgWrite - 0x%08x, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (Address), Count, (UINTN)Width));\r
+ return ScriptPciCfgWrite (Width, Address, Count, Buffer);\r
}\r
/**\r
- Excute the script to perform IO modification operation.\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 AndMask Mask value for 'and' operation\r
\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, (UINT64)AndMask, (UINT64)OrMask));\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecuteIoReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoReadWrite.Address, AndMask, OrMask));\r
\r
Status = ScriptIoRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) IoReadWrite.Width,\r
return Status;\r
}\r
/**\r
- Excute the script to perform memory modification operation.\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 AndMask Mask value for 'and' operation\r
\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, (UINT64)AndMask, (UINT64)OrMask));\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemReadWrite.Address, AndMask, OrMask));\r
\r
Status = ScriptMemoryRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) MemReadWrite.Width,\r
return Status;\r
}\r
/**\r
- Excute the script to perform PCI IO modification operation.\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 AndMask Mask value for 'and' 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", (UINTN)PciCfgReadWrite.Address, (UINT64)AndMask, (UINT64)OrMask));\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgReadWrite.Address), AndMask, OrMask));\r
\r
Status = ScriptPciCfgRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgReadWrite.Width,\r
PciCfgReadWrite.Address,\r
+ 1,\r
&Data\r
);\r
if (EFI_ERROR (Status)) {\r
Status = ScriptPciCfgWrite (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgReadWrite.Width,\r
PciCfgReadWrite.Address,\r
+ 1,\r
&Data\r
);\r
\r
return Status;\r
}\r
/**\r
- To Execute SMBUS command. \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
);\r
}\r
/**\r
- Execute stall operation in boot script table.\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
return EFI_SUCCESS;\r
}\r
/**\r
- To execute assigned function.\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
- @retval EFI_SUCCESS The operation was executed successfully\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
BootScriptExecuteDispatch (\r
return Status;\r
}\r
/**\r
- Execute dispach2 opertion code which is to invoke a spcified function with one parameter. \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
@retval EFI_SUCCESS The operation was executed successfully\r
return Status;\r
}\r
/**\r
- Excute the script to poll memory.\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 AndMask Mask value for 'and' operation\r
\r
CopyMem ((VOID*)&MemPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_POLL));\r
\r
- DEBUG ((EFI_D_INFO, "BootScriptExecuteMemPoll - 0x%08x\n", (UINTN)MemPoll.Address));\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemPoll.Address, AndMask, OrMask));\r
\r
Data = 0;\r
Status = ScriptMemoryRead (\r
}\r
}\r
/**\r
- Execute the boot script to interpret the Store arbitrary information. \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
return;\r
}\r
/**\r
- Excute the script to poll Io port for some time\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 AndMask Mask value for 'and' operation\r
\r
CopyMem ((VOID*)&IoPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_POLL));\r
\r
- DEBUG ((EFI_D_INFO, "BootScriptExecuteIoPoll - 0x%08x\n", (UINTN)IoPoll.Address));\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoPoll.Address, AndMask, OrMask));\r
\r
Data = 0;\r
Status = ScriptIoRead (\r
}\r
}\r
/**\r
- Perform Pci configuration Write operation.\r
+ Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE OP code.\r
\r
@param Script The pointer of S3 boot script\r
\r
IN UINT8 *Script\r
)\r
{\r
- UINT8 Reg;\r
- UINT8 *Buffer;\r
- UINTN DataWidth;\r
- UINTN Index;\r
- UINT16 Segment;\r
- UINT64 PciAddress;\r
- EFI_STATUS Status;\r
- EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write;\r
+ VOID *Buffer;\r
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;\r
+ UINT16 Segment;\r
+ UINT64 Address;\r
+ UINTN Count;\r
+ EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write;\r
\r
CopyMem ((VOID*)&PciCfg2Write, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE));\r
- Status = EFI_SUCCESS;\r
- Segment = PciCfg2Write.Segment;\r
- PciAddress = PciCfg2Write.Address;\r
- DataWidth = (UINT32)(0x01 << (PciCfg2Write.Width));\r
- Buffer = Script + sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE);\r
-\r
- DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2Write - 0x%08x\n", (UINTN)PciAddress));\r
-\r
- for (Index = 0; Index < PciCfg2Write.Count; Index++) {\r
- Status = ScriptPciCfg2Write (\r
- (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Write.Width,\r
- Segment,\r
- PciAddress,\r
- Buffer\r
- );\r
- if (S3BootScriptWidthFillUint8 != PciCfg2Write.Width ||\r
- S3BootScriptWidthFillUint16 != PciCfg2Write.Width || \r
- S3BootScriptWidthFillUint32 != PciCfg2Write.Width ||\r
- S3BootScriptWidthFillUint64 != PciCfg2Write.Width){\r
- Reg = (UINT8) ((UINT8) PciAddress + DataWidth);\r
- PciAddress = (PciAddress & 0xFFFFFFFFFFFFFF00ULL) + Reg;\r
- }\r
\r
- if (S3BootScriptWidthFifoUint8 != PciCfg2Write.Width ||\r
- S3BootScriptWidthFifoUint16 != PciCfg2Write.Width || \r
- S3BootScriptWidthFifoUint32 != PciCfg2Write.Width ||\r
- S3BootScriptWidthFifoUint64 != PciCfg2Write.Width) {\r
- Buffer += DataWidth;\r
- }\r
- }\r
- return Status;\r
+ Width = (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2Write.Width;\r
+ Segment = PciCfg2Write.Segment;\r
+ Address = PciCfg2Write.Address;\r
+ Count = PciCfg2Write.Count;\r
+ Buffer = Script + sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE);\r
+\r
+ DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2Write - 0x%04x, 0x%08x, 0x%08x, 0x%08x\n", Segment, PCI_ADDRESS_ENCODE (Address), Count, (UINTN)Width));\r
+ return ScriptPciCfg2Write (Width, Segment, Address, Count, Buffer);\r
}\r
\r
\r
/**\r
- Perform pci configuration read & Write operation.\r
+ Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code.\r
\r
@param Script The pointer of S3 boot script\r
@param AndMask Mask value for 'and' operation\r
EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE PciCfg2ReadWrite;\r
CopyMem ((VOID*)&PciCfg2ReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE));\r
\r
- DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2ReadWrite - 0x%08x\n", (UINTN)PciCfg2ReadWrite.Address));\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
\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2ReadWrite.Width,\r
PciCfg2ReadWrite.Segment,\r
PciCfg2ReadWrite.Address,\r
+ 1,\r
&Data\r
);\r
if (EFI_ERROR (Status)) {\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2ReadWrite.Width,\r
PciCfg2ReadWrite.Segment,\r
PciCfg2ReadWrite.Address,\r
+ 1,\r
&Data\r
);\r
return Status;\r
}\r
/**\r
- To perform poll pci configure operation.\r
+ Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code.\r
\r
@param Script The pointer of S3 boot script\r
@param AndMask Mask value for 'and' operation\r
EFI_BOOT_SCRIPT_PCI_CONFIG_POLL PciCfgPoll;\r
CopyMem ((VOID*)&PciCfgPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_POLL));\r
\r
- DEBUG ((EFI_D_INFO, "BootScriptPciCfgPoll - 0x%08x\n", (UINTN)PciCfgPoll.Address));\r
+ DEBUG ((EFI_D_INFO, "BootScriptPciCfgPoll - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgPoll.Address), AndMask, OrMask));\r
\r
Data = 0;\r
Status = ScriptPciCfgRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgPoll.Width,\r
PciCfgPoll.Address,\r
+ 1,\r
&Data\r
);\r
if ((!EFI_ERROR (Status)) &&(Data & AndMask) == OrMask) {\r
Status = ScriptPciCfgRead (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgPoll.Width,\r
PciCfgPoll.Address,\r
+ 1,\r
&Data\r
);\r
if ((!EFI_ERROR (Status)) &&\r
}\r
\r
/**\r
- To perform poll pci configure operation.\r
+ Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL OP code.\r
\r
@param Script The pointer of S3 Boot Script\r
@param AndMask Mask value for 'and' operation\r
Data = 0;\r
CopyMem ((VOID*)&PciCfg2Poll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL));\r
\r
- DEBUG ((EFI_D_INFO, "BootScriptPciCfg2Poll - 0x%08x\n", (UINTN)PciCfg2Poll.Address));\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
\r
Status = ScriptPciCfg2Read (\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
PciCfg2Poll.Segment,\r
PciCfg2Poll.Address,\r
+ 1,\r
&Data\r
);\r
if ((!EFI_ERROR (Status)) && (Data & AndMask) == OrMask) {\r
(S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width,\r
PciCfg2Poll.Segment, \r
PciCfg2Poll.Address,\r
+ 1,\r
&Data\r
);\r
if ((!EFI_ERROR (Status)) && (Data & AndMask) == OrMask) {\r