X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FLibrary%2FPiDxeS3BootScriptLib%2FBootScriptExecute.c;h=b865d4452fc823ee681a02bfdb695ce6e7c366a2;hb=16f6922709952c7ad468dcdee6ef94b3e5a3cd90;hp=cba331a3bda30d41dc5ef231c4838a64a58d528e;hpb=30522140a12f360d24babc36c9d9c8e4be8b1b5e;p=mirror_edk2.git diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c index cba331a3bd..b865d4452f 100644 --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c @@ -1,7 +1,7 @@ /** @file - Interpret and execute the S3 data in S3 boot script. + Interpret and execute the S3 data in S3 boot script. - Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -23,7 +23,7 @@ Management Bus (SMBus) Specification. The resulting transaction will be either that the SMBus slave devices accept this transaction or that this function returns with error. - @param SmbusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, + @param SmbusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC. @param Operation Signifies which particular SMBus hardware protocol instance that it will use to execute the SMBus transactions. This SMBus @@ -120,7 +120,7 @@ SmbusExecute ( return EFI_INVALID_PARAMETER; } - return Status; + return Status; } /** @@ -130,7 +130,7 @@ SmbusExecute ( @param Width Width of the operation. @param Address Address of the operation. @param AddressStride Instride for stepping input buffer. - @param BufferStride Outstride for stepping output buffer. + @param BufferStride Outstride for stepping output buffer. @retval EFI_SUCCESS Successful translation. @retval EFI_INVALID_PARAMETER Width or Address is invalid. @@ -170,18 +170,18 @@ BuildLoopData ( /** Perform IO read operation - + @param[in] Width Width of the operation. @param[in] Address Address of the operation. @param[in] Count Count of the number of accesses to perform. - @param[out] Buffer Pointer to the buffer to read from I/O space. + @param[out] Buffer Pointer to the buffer to read from I/O space. @retval EFI_SUCCESS The data was written to the EFI System. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. - Address is outside the legal range of I/O ports. - + Address is outside the legal range of I/O ports. + **/ EFI_STATUS ScriptIoRead ( @@ -274,18 +274,18 @@ ScriptIoRead ( /** Perform IO write operation - + @param[in] Width Width of the operation. @param[in] Address Address of the operation. @param[in] Count Count of the number of accesses to perform. - @param[in] Buffer Pointer to the buffer to write to I/O space. + @param[in] Buffer Pointer to the buffer to write to I/O space. @retval EFI_SUCCESS The data was written to the EFI System. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. - Address is outside the legal range of I/O ports. - + Address is outside the legal range of I/O ports. + **/ EFI_STATUS ScriptIoWrite ( @@ -322,11 +322,11 @@ ScriptIoWrite ( case S3BootScriptWidthUint8: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8)); IoWrite8 ((UINTN) Address, *In.Uint8); - break; + break; case S3BootScriptWidthFifoUint8: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8)); IoWrite8 ((UINTN) OriginalAddress, *In.Uint8); - break; + break; case S3BootScriptWidthFillUint8: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8)); IoWrite8 ((UINTN) Address, *OriginalIn.Uint8); @@ -334,11 +334,11 @@ ScriptIoWrite ( case S3BootScriptWidthUint16: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16)); IoWrite16 ((UINTN) Address, *In.Uint16); - break; + break; case S3BootScriptWidthFifoUint16: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16)); IoWrite16 ((UINTN) OriginalAddress, *In.Uint16); - break; + break; case S3BootScriptWidthFillUint16: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16)); IoWrite16 ((UINTN) Address, *OriginalIn.Uint16); @@ -346,7 +346,7 @@ ScriptIoWrite ( case S3BootScriptWidthUint32: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32)); IoWrite32 ((UINTN) Address, *In.Uint32); - break; + break; case S3BootScriptWidthFifoUint32: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32)); IoWrite32 ((UINTN) OriginalAddress, *In.Uint32); @@ -358,11 +358,11 @@ ScriptIoWrite ( case S3BootScriptWidthUint64: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64)); IoWrite64 ((UINTN) Address, *In.Uint64); - break; + break; case S3BootScriptWidthFifoUint64: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64)); IoWrite64 ((UINTN) OriginalAddress, *In.Uint64); - break; + break; case S3BootScriptWidthFillUint64: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64)); IoWrite64 ((UINTN) Address, *OriginalIn.Uint64); @@ -371,25 +371,25 @@ ScriptIoWrite ( return EFI_INVALID_PARAMETER; } } - + return EFI_SUCCESS; } /** Interprete the boot script node with EFI_BOOT_SCRIPT_IO_WRITE OP code. - + @param Script Pointer to the node which is to be interpreted. @retval EFI_SUCCESS The data was written to the EFI System. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. - Address is outside the legal range of I/O ports. - + Address is outside the legal range of I/O ports. + **/ EFI_STATUS BootScriptExecuteIoWrite ( - IN UINT8 *Script + IN UINT8 *Script ) { S3_BOOT_SCRIPT_LIB_WIDTH Width; @@ -397,7 +397,7 @@ BootScriptExecuteIoWrite ( UINTN Count; VOID *Buffer; EFI_BOOT_SCRIPT_IO_WRITE IoWrite; - + CopyMem ((VOID*)&IoWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_WRITE)); Width = (S3_BOOT_SCRIPT_LIB_WIDTH) IoWrite.Width; Address = IoWrite.Address; @@ -409,19 +409,19 @@ BootScriptExecuteIoWrite ( } /** Perform memory read operation - + @param Width Width of the operation. @param Address Address of the operation. @param Count Count of the number of accesses to perform. - @param Buffer Pointer to the buffer read from memory. + @param Buffer Pointer to the buffer read from memory. @retval EFI_SUCCESS The data was written to the EFI System. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. - @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count - is not valid for this EFI System. - + @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count + is not valid for this EFI System. + **/ EFI_STATUS ScriptMemoryRead ( @@ -508,19 +508,19 @@ ScriptMemoryRead ( } /** Perform memory write operation - + @param Width Width of the operation. @param Address Address of the operation. @param Count Count of the number of accesses to perform. - @param Buffer Pointer to the buffer write to memory. + @param Buffer Pointer to the buffer write to memory. @retval EFI_SUCCESS The data was written to the EFI System. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. - @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count - is not valid for this EFI System. - + @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count + is not valid for this EFI System. + **/ EFI_STATUS ScriptMemoryWrite ( @@ -532,7 +532,7 @@ ScriptMemoryWrite ( { EFI_STATUS Status; UINTN AddressStride; - UINT64 OriginalAddress; + UINT64 OriginalAddress; UINTN BufferStride; PTR In; PTR OriginalIn; @@ -547,17 +547,17 @@ ScriptMemoryWrite ( // Loop for each iteration and move the data // OriginalAddress = Address; - OriginalIn.Buf = In.Buf; + OriginalIn.Buf = In.Buf; for (; Count > 0; Count--, Address += AddressStride, In.Buf += BufferStride) { switch (Width) { case S3BootScriptWidthUint8: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*In.Uint8)); MmioWrite8 ((UINTN) Address, *In.Uint8); - break; + break; case S3BootScriptWidthFifoUint8: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint8)); MmioWrite8 ((UINTN) OriginalAddress, *In.Uint8); - break; + break; case S3BootScriptWidthFillUint8: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint8)); MmioWrite8 ((UINTN) Address, *OriginalIn.Uint8); @@ -565,11 +565,11 @@ ScriptMemoryWrite ( case S3BootScriptWidthUint16: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*In.Uint16)); MmioWrite16 ((UINTN) Address, *In.Uint16); - break; + break; case S3BootScriptWidthFifoUint16: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint16)); MmioWrite16 ((UINTN) OriginalAddress, *In.Uint16); - break; + break; case S3BootScriptWidthFillUint16: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint16)); MmioWrite16 ((UINTN) Address, *OriginalIn.Uint16); @@ -577,11 +577,11 @@ ScriptMemoryWrite ( case S3BootScriptWidthUint32: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*In.Uint32)); MmioWrite32 ((UINTN) Address, *In.Uint32); - break; + break; case S3BootScriptWidthFifoUint32: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", (UINTN)OriginalAddress, (UINTN)*In.Uint32)); MmioWrite32 ((UINTN) OriginalAddress, *In.Uint32); - break; + break; case S3BootScriptWidthFillUint32: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)Address, (UINTN)*OriginalIn.Uint32)); MmioWrite32 ((UINTN) Address, *OriginalIn.Uint32); @@ -589,11 +589,11 @@ ScriptMemoryWrite ( case S3BootScriptWidthUint64: DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *In.Uint64)); MmioWrite64 ((UINTN) Address, *In.Uint64); - break; + break; case S3BootScriptWidthFifoUint64: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint64 - 0x%08x (0x%016lx)\n", (UINTN)OriginalAddress, *In.Uint64)); MmioWrite64 ((UINTN) OriginalAddress, *In.Uint64); - break; + break; case S3BootScriptWidthFillUint64: DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint64 - 0x%08x (0x%016lx)\n", (UINTN)Address, *OriginalIn.Uint64)); MmioWrite64 ((UINTN) Address, *OriginalIn.Uint64); @@ -608,14 +608,14 @@ ScriptMemoryWrite ( Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_WRITE OP code. @param[in] Script Pointer to the node which is to be interpreted. - + @retval EFI_SUCCESS The data was written to the EFI System. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI System. Buffer is NULL. The Buffer is not aligned for the given Width. - @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count - is not valid for this EFI System. - + @retval EFI_UNSUPPORTED The address range specified by Address, Width, and Count + is not valid for this EFI System. + **/ EFI_STATUS BootScriptExecuteMemoryWrite ( @@ -627,7 +627,7 @@ BootScriptExecuteMemoryWrite ( UINT64 Address; UINTN Count; EFI_BOOT_SCRIPT_MEM_WRITE MemWrite; - + CopyMem((VOID*)&MemWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_WRITE)); Width = (S3_BOOT_SCRIPT_LIB_WIDTH)MemWrite.Width; Address = MemWrite.Address; @@ -636,24 +636,26 @@ BootScriptExecuteMemoryWrite ( DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryWrite - 0x%08x, 0x%08x, 0x%08x\n", (UINTN)Address, Count, (UINTN)Width)); return ScriptMemoryWrite (Width,Address, Count, Buffer); - -} + +} /** - Performance PCI configuration read operation + Performance PCI configuration 2 read operation @param Width Width of the operation. + @param Segment Pci segment number @param Address Address of the operation. @param Count Count of the number of accesses to perform. @param Buffer Pointer to the buffer read from PCI config space - + @retval EFI_SUCCESS The read succeed. - @retval EFI_INVALID_PARAMETER if Width is not defined + @retval EFI_INVALID_PARAMETER if Width is not defined @note A known Limitations in the implementation which is 64bits operations are not supported. **/ EFI_STATUS -ScriptPciCfgRead ( +ScriptPciCfg2Read ( IN S3_BOOT_SCRIPT_LIB_WIDTH Width, + IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer @@ -663,11 +665,11 @@ ScriptPciCfgRead ( UINTN AddressStride; UINTN BufferStride; PTR Out; - UINTN PciAddress; + UINT64 PciAddress; Out.Buf = (UINT8 *) Buffer; - PciAddress = PCI_ADDRESS_ENCODE (Address); + PciAddress = PCI_ADDRESS_ENCODE (Segment, Address); Status = BuildLoopData (Width, PciAddress, &AddressStride, &BufferStride); if (EFI_ERROR (Status)) { @@ -679,42 +681,42 @@ ScriptPciCfgRead ( for (; Count > 0; Count--, PciAddress += AddressStride, Out.Buf += BufferStride) { switch (Width) { case S3BootScriptWidthUint8: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x\n", PciAddress)); - *Out.Uint8 = PciRead8 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%016lx\n", PciAddress)); + *Out.Uint8 = PciSegmentRead8 (PciAddress); break; case S3BootScriptWidthFifoUint8: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x\n", PciAddress)); - *Out.Uint8 = PciRead8 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%016lx\n", PciAddress)); + *Out.Uint8 = PciSegmentRead8 (PciAddress); break; case S3BootScriptWidthFillUint8: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x\n", PciAddress)); - *Out.Uint8 = PciRead8 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%016lx\n", PciAddress)); + *Out.Uint8 = PciSegmentRead8 (PciAddress); break; case S3BootScriptWidthUint16: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x\n", PciAddress)); - *Out.Uint16 = PciRead16 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%016lx\n", PciAddress)); + *Out.Uint16 = PciSegmentRead16 (PciAddress); break; case S3BootScriptWidthFifoUint16: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x\n", PciAddress)); - *Out.Uint16 = PciRead16 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%016lx\n", PciAddress)); + *Out.Uint16 = PciSegmentRead16 (PciAddress); break; case S3BootScriptWidthFillUint16: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x\n", PciAddress)); - *Out.Uint16 = PciRead16 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%016lx\n", PciAddress)); + *Out.Uint16 = PciSegmentRead16 (PciAddress); break; case S3BootScriptWidthUint32: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x\n", PciAddress)); - *Out.Uint32 = PciRead32 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%016lx\n", PciAddress)); + *Out.Uint32 = PciSegmentRead32 (PciAddress); break; case S3BootScriptWidthFifoUint32: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x\n", PciAddress)); - *Out.Uint32 = PciRead32 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%016lx\n", PciAddress)); + *Out.Uint32 = PciSegmentRead32 (PciAddress); break; case S3BootScriptWidthFillUint32: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x\n", PciAddress)); - *Out.Uint32 = PciRead32 (PciAddress); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%016lx\n", PciAddress)); + *Out.Uint32 = PciSegmentRead32 (PciAddress); break; default: @@ -725,21 +727,23 @@ ScriptPciCfgRead ( } /** - Performance PCI configuration write operation + Performance PCI configuration 2 write operation @param Width Width of the operation. + @param Segment Pci segment number @param Address Address of the operation. @param Count Count of the number of accesses to perform. @param Buffer Pointer to the buffer write to PCI config space - + @retval EFI_SUCCESS The write succeed. - @retval EFI_INVALID_PARAMETER if Width is not defined + @retval EFI_INVALID_PARAMETER if Width is not defined @note A known Limitations in the implementation which is 64bits operations are not supported. **/ EFI_STATUS -ScriptPciCfgWrite ( +ScriptPciCfg2Write ( IN S3_BOOT_SCRIPT_LIB_WIDTH Width, + IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer @@ -748,14 +752,14 @@ ScriptPciCfgWrite ( EFI_STATUS Status; UINTN AddressStride; UINTN BufferStride; - UINTN OriginalPciAddress; + UINT64 OriginalPciAddress; PTR In; PTR OriginalIn; - UINTN PciAddress; + UINT64 PciAddress; In.Buf = (UINT8 *) Buffer; - PciAddress = PCI_ADDRESS_ENCODE (Address); + PciAddress = PCI_ADDRESS_ENCODE (Segment, Address); Status = BuildLoopData (Width, PciAddress, &AddressStride, &BufferStride); if (EFI_ERROR (Status)) { @@ -769,40 +773,40 @@ ScriptPciCfgWrite ( for (; Count > 0; Count--, PciAddress += AddressStride, In.Buf += BufferStride) { switch (Width) { case S3BootScriptWidthUint8: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*In.Uint8)); - PciWrite8 (PciAddress, *In.Uint8); - break; + DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint8 - 0x%016lx (0x%02x)\n", PciAddress, (UINTN)*In.Uint8)); + PciSegmentWrite8 (PciAddress, *In.Uint8); + break; case S3BootScriptWidthFifoUint8: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%08x (0x%02x)\n", OriginalPciAddress, (UINTN)*In.Uint8)); - PciWrite8 (OriginalPciAddress, *In.Uint8); - break; + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint8 - 0x%016lx (0x%02x)\n", OriginalPciAddress, (UINTN)*In.Uint8)); + PciSegmentWrite8 (OriginalPciAddress, *In.Uint8); + break; case S3BootScriptWidthFillUint8: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%08x (0x%02x)\n", PciAddress, (UINTN)*OriginalIn.Uint8)); - PciWrite8 (PciAddress, *OriginalIn.Uint8); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint8 - 0x%016lx (0x%02x)\n", PciAddress, (UINTN)*OriginalIn.Uint8)); + PciSegmentWrite8 (PciAddress, *OriginalIn.Uint8); break; case S3BootScriptWidthUint16: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*In.Uint16)); - PciWrite16 (PciAddress, *In.Uint16); - break; + DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint16 - 0x%016lx (0x%04x)\n", PciAddress, (UINTN)*In.Uint16)); + PciSegmentWrite16 (PciAddress, *In.Uint16); + break; case S3BootScriptWidthFifoUint16: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%08x (0x%04x)\n", OriginalPciAddress, (UINTN)*In.Uint16)); - PciWrite16 (OriginalPciAddress, *In.Uint16); - break; + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint16 - 0x%016lx (0x%04x)\n", OriginalPciAddress, (UINTN)*In.Uint16)); + PciSegmentWrite16 (OriginalPciAddress, *In.Uint16); + break; case S3BootScriptWidthFillUint16: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%08x (0x%04x)\n", PciAddress, (UINTN)*OriginalIn.Uint16)); - PciWrite16 (PciAddress, *OriginalIn.Uint16); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint16 - 0x%016lx (0x%04x)\n", PciAddress, (UINTN)*OriginalIn.Uint16)); + PciSegmentWrite16 (PciAddress, *OriginalIn.Uint16); break; case S3BootScriptWidthUint32: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%08x (0x%08x)\n", PciAddress, (UINTN)*In.Uint32)); - PciWrite32 (PciAddress, *In.Uint32); - break; + DEBUG ((EFI_D_INFO, "S3BootScriptWidthUint32 - 0x%016lx (0x%08x)\n", PciAddress, (UINTN)*In.Uint32)); + PciSegmentWrite32 (PciAddress, *In.Uint32); + break; case S3BootScriptWidthFifoUint32: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%08x (0x%08x)\n", OriginalPciAddress, (UINTN)*In.Uint32)); - PciWrite32 (OriginalPciAddress, *In.Uint32); - break; + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFifoUint32 - 0x%016lx (0x%08x)\n", OriginalPciAddress, (UINTN)*In.Uint32)); + PciSegmentWrite32 (OriginalPciAddress, *In.Uint32); + break; case S3BootScriptWidthFillUint32: - DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%08x (0x%08x)\n", (UINTN)PciAddress, (UINTN)*OriginalIn.Uint32)); - PciWrite32 (PciAddress, *OriginalIn.Uint32); + DEBUG ((EFI_D_INFO, "S3BootScriptWidthFillUint32 - 0x%016lx (0x%08x)\n", (UINTN)PciAddress, (UINTN)*OriginalIn.Uint32)); + PciSegmentWrite32 (PciAddress, *OriginalIn.Uint32); break; default: return EFI_INVALID_PARAMETER; @@ -811,10 +815,9 @@ ScriptPciCfgWrite ( return EFI_SUCCESS; } /** - Performance PCI configuration 2 read operation - + Performance PCI configuration read operation + @param Width Width of the operation. - @param Segment Pci segment number @param Address Address of the operation. @param Count Count of the number of accesses to perform. @param Buffer Pointer to the buffer to read from PCI config space. @@ -824,27 +827,22 @@ ScriptPciCfgWrite ( Buffer is NULL. The Buffer is not aligned for the given Width. Address is outside the legal range of I/O ports. - @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as - Zero, or else, assert. + **/ EFI_STATUS -ScriptPciCfg2Read ( +ScriptPciCfgRead ( IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer ) { - ASSERT (Segment==0); - - return ScriptPciCfgRead (Width, Address, Count, Buffer); + return ScriptPciCfg2Read (Width, 0, Address, Count, Buffer); } /** - Performance PCI configuration 2 write operation - + Performance PCI configuration write operation + @param Width Width of the operation. - @param Segment Pci segment number @param Address Address of the operation. @param Count Count of the number of accesses to perform. @param Buffer Pointer to the buffer to write to PCI config space. @@ -854,28 +852,24 @@ ScriptPciCfg2Read ( Buffer is NULL. The Buffer is not aligned for the given Width. Address is outside the legal range of I/O ports. - @note A known Limitations in the implementation which is the 'Segment' parameter is assumed as - Zero, or else, assert. - + **/ EFI_STATUS EFIAPI -ScriptPciCfg2Write ( +ScriptPciCfgWrite ( IN S3_BOOT_SCRIPT_LIB_WIDTH Width, - IN UINT16 Segment, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer ) { - ASSERT (Segment==0); - return ScriptPciCfgWrite (Width, Address, Count, Buffer); + return ScriptPciCfg2Write (Width, 0, Address, Count, Buffer); } /** Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE OP code. - - @param Script The pointer of typed node in boot script table - + + @param Script The pointer of typed node in boot script table + @retval EFI_SUCCESS The operation was executed successfully **/ EFI_STATUS @@ -896,13 +890,13 @@ BootScriptExecutePciCfgWrite ( Count = PciCfgWrite.Count; Buffer = Script + sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE); - DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgWrite - 0x%08x, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (Address), Count, (UINTN)Width)); + DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgWrite - 0x%016lx, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (0, Address), Count, (UINTN)Width)); return ScriptPciCfgWrite (Width, Address, Count, Buffer); } /** Interprete the boot script node with EFI_BOOT_SCRIPT_IO_READ_WRITE OP code. - @param Script The pointer of typed node in boot script table + @param Script The pointer of typed node in boot script table @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation @@ -919,9 +913,9 @@ BootScriptExecuteIoReadWrite ( EFI_STATUS Status; UINT64 Data; EFI_BOOT_SCRIPT_IO_READ_WRITE IoReadWrite; - + Data = 0; - + CopyMem((VOID*)&IoReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_READ_WRITE)); DEBUG ((EFI_D_INFO, "BootScriptExecuteIoReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoReadWrite.Address, AndMask, OrMask)); @@ -946,7 +940,7 @@ BootScriptExecuteIoReadWrite ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_READ_WRITE OP code. - @param Script The pointer of typed node in boot script table + @param Script The pointer of typed node in boot script table @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation @@ -963,13 +957,13 @@ BootScriptExecuteMemoryReadWrite ( EFI_STATUS Status; UINT64 Data; EFI_BOOT_SCRIPT_MEM_READ_WRITE MemReadWrite; - + Data = 0; - + CopyMem((VOID*)&MemReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_READ_WRITE)); DEBUG ((EFI_D_INFO, "BootScriptExecuteMemoryReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemReadWrite.Address, AndMask, OrMask)); - + Status = ScriptMemoryRead ( (S3_BOOT_SCRIPT_LIB_WIDTH) MemReadWrite.Width, MemReadWrite.Address, @@ -990,7 +984,7 @@ BootScriptExecuteMemoryReadWrite ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CFG_READ_WRITE OP code. - @param Script The pointer of typed node in boot script table + @param Script The pointer of typed node in boot script table @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation @@ -1012,8 +1006,8 @@ BootScriptExecutePciCfgReadWrite ( CopyMem((VOID*)&PciCfgReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE)); - DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgReadWrite - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgReadWrite.Address), AndMask, OrMask)); - + DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfgReadWrite - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (0, PciCfgReadWrite.Address), AndMask, OrMask)); + Status = ScriptPciCfgRead ( (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgReadWrite.Width, PciCfgReadWrite.Address, @@ -1038,11 +1032,11 @@ BootScriptExecutePciCfgReadWrite ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_SMBUS_EXECUTE OP code. - @param Script The pointer of typed node in boot script table - + @param Script The pointer of typed node in boot script table + @retval EFI_SUCCESS The operation was executed successfully @retval EFI_UNSUPPORTED Cannot locate smbus ppi or occur error of script execution - @retval Others Result of script execution + @retval Others Result of script execution **/ EFI_STATUS BootScriptExecuteSmbusExecute ( @@ -1052,7 +1046,7 @@ BootScriptExecuteSmbusExecute ( UINTN SmBusAddress; UINTN DataSize; EFI_BOOT_SCRIPT_SMBUS_EXECUTE SmbusExecuteEntry; - + CopyMem ((VOID*)&SmbusExecuteEntry, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_SMBUS_EXECUTE )); DEBUG ((EFI_D_INFO, "BootScriptExecuteSmbusExecute - 0x%08x, 0x%08x\n", (UINTN)SmbusExecuteEntry.SmBusAddress, (UINTN)SmbusExecuteEntry.Operation)); @@ -1069,8 +1063,8 @@ BootScriptExecuteSmbusExecute ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_STALL OP code. - @param Script The pointer of typed node in boot script table - + @param Script The pointer of typed node in boot script table + @retval EFI_SUCCESS The operation was executed successfully **/ EFI_STATUS @@ -1079,7 +1073,7 @@ BootScriptExecuteStall ( ) { EFI_BOOT_SCRIPT_STALL Stall; - + CopyMem ((VOID*)&Stall, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_STALL)); DEBUG ((EFI_D_INFO, "BootScriptExecuteStall - 0x%08x\n", (UINTN)Stall.Duration)); @@ -1089,8 +1083,8 @@ BootScriptExecuteStall ( } /** Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH OP code. - - @param Script The pointer of typed node in boot script table + + @param Script The pointer of typed node in boot script table @retval EFI_SUCCESS The operation was executed successfully **/ EFI_STATUS @@ -1101,7 +1095,7 @@ BootScriptExecuteDispatch ( EFI_STATUS Status; DISPATCH_ENTRYPOINT_FUNC EntryFunc; EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch; - + CopyMem ((VOID*)&ScriptDispatch, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH)); EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch.EntryPoint); @@ -1114,7 +1108,7 @@ BootScriptExecuteDispatch ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_DISPATCH_2 OP code. - @param Script The pointer of typed node in boot script table + @param Script The pointer of typed node in boot script table @retval EFI_SUCCESS The operation was executed successfully **/ EFI_STATUS @@ -1125,11 +1119,11 @@ BootScriptExecuteDispatch2 ( EFI_STATUS Status; DISPATCH_ENTRYPOINT_FUNC EntryFunc; EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2; - + CopyMem ((VOID*)&ScriptDispatch2, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_DISPATCH_2)); DEBUG ((EFI_D_INFO, "BootScriptExecuteDispatch2 - 0x%08x(0x%08x)\n", (UINTN)ScriptDispatch2.EntryPoint, (UINTN)ScriptDispatch2.Context)); - + EntryFunc = (DISPATCH_ENTRYPOINT_FUNC) (UINTN) (ScriptDispatch2.EntryPoint); Status = EntryFunc (NULL, (VOID *) (UINTN) ScriptDispatch2.Context); @@ -1139,11 +1133,11 @@ BootScriptExecuteDispatch2 ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_MEM_POLL OP code. - @param Script The pointer of typed node in boot script table + @param Script The pointer of typed node in boot script table @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation - - @retval EFI_DEVICE_ERROR Data polled from memory does not equal to + + @retval EFI_DEVICE_ERROR Data polled from memory does not equal to the epecting data within the Loop Times. @retval EFI_SUCCESS The operation was executed successfully **/ @@ -1151,15 +1145,15 @@ EFI_STATUS BootScriptExecuteMemPoll ( IN UINT8 *Script, IN UINT64 AndMask, - IN UINT64 OrMask + IN UINT64 OrMask ) { - + UINT64 Data; UINT64 LoopTimes; EFI_STATUS Status; EFI_BOOT_SCRIPT_MEM_POLL MemPoll; - + CopyMem ((VOID*)&MemPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_MEM_POLL)); DEBUG ((EFI_D_INFO, "BootScriptExecuteMemPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)MemPoll.Address, AndMask, OrMask)); @@ -1200,8 +1194,8 @@ BootScriptExecuteMemPoll ( Execute the boot script to interpret the Store arbitrary information. This opcode is a no-op on dispatch and is only used for debugging script issues. - @param Script The pointer of node in boot script table - + @param Script The pointer of node in boot script table + **/ VOID BootScriptExecuteInformation ( @@ -1226,10 +1220,10 @@ BootScriptExecuteInformation ( } /** - Execute the boot script to interpret the Label information. + Execute the boot script to interpret the Label information. + + @param Script The pointer of node in boot script table - @param Script The pointer of node in boot script table - **/ VOID BootScriptExecuteLabel ( @@ -1255,7 +1249,7 @@ BootScriptExecuteLabel ( /** calculate the mask value for 'and' and 'or' operation - @param ScriptHeader The pointer of header of node in boot script table + @param ScriptHeader The pointer of header of node in boot script table @param AndMask The Mask value for 'and' operation @param OrMask The Mask value for 'or' operation @param Script Pointer to the entry. @@ -1287,32 +1281,32 @@ CheckAndOrMask ( case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE: Size = sizeof (EFI_BOOT_SCRIPT_MEM_POLL); break; - + case EFI_BOOT_SCRIPT_IO_POLL_OPCODE: Size = sizeof (EFI_BOOT_SCRIPT_IO_POLL); - break; - + break; + case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE: Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE); break; - + case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE: Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL); break; - + case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE: Size = sizeof (EFI_BOOT_SCRIPT_PCI_CONFIG_POLL); break; - + default: return; } - + DataPtr = Script + Size; switch (ScriptHeader->Width) { case S3BootScriptWidthUint8: - *AndMask = (UINT64) *(DataPtr + 1); + *AndMask = (UINT64) (*(UINT8*) (DataPtr + 1)); *OrMask = (UINT64) (*DataPtr); break; @@ -1340,11 +1334,11 @@ CheckAndOrMask ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_IO_POLL OP code. - @param Script The pointer of typed node in boot script table + @param Script The pointer of typed node in boot script table @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation - - @retval EFI_DEVICE_ERROR Data polled from memory does not equal to + + @retval EFI_DEVICE_ERROR Data polled from memory does not equal to the epecting data within the Loop Times. @retval EFI_SUCCESS The operation was executed successfully **/ @@ -1359,7 +1353,7 @@ BootScriptExecuteIoPoll ( UINT64 Data; UINT64 LoopTimes; EFI_BOOT_SCRIPT_IO_POLL IoPoll; - + CopyMem ((VOID*)&IoPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_IO_POLL)); DEBUG ((EFI_D_INFO, "BootScriptExecuteIoPoll - 0x%08x, 0x%016lx, 0x%016lx\n", (UINTN)IoPoll.Address, AndMask, OrMask)); @@ -1385,7 +1379,7 @@ BootScriptExecuteIoPoll ( ); if ((!EFI_ERROR (Status)) &&(Data & AndMask) == OrMask) { return EFI_SUCCESS; - } + } } if (LoopTimes < IoPoll.Delay) { @@ -1413,7 +1407,7 @@ BootScriptExecutePciCfg2Write ( UINT64 Address; UINTN Count; EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE PciCfg2Write; - + CopyMem ((VOID*)&PciCfg2Write, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE)); Width = (S3_BOOT_SCRIPT_LIB_WIDTH)PciCfg2Write.Width; @@ -1422,14 +1416,14 @@ BootScriptExecutePciCfg2Write ( Count = PciCfg2Write.Count; Buffer = Script + sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE); - DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2Write - 0x%04x, 0x%08x, 0x%08x, 0x%08x\n", Segment, PCI_ADDRESS_ENCODE (Address), Count, (UINTN)Width)); + DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2Write - 0x%016lx, 0x%08x, 0x%08x\n", PCI_ADDRESS_ENCODE (Segment, Address), Count, (UINTN)Width)); return ScriptPciCfg2Write (Width, Segment, Address, Count, Buffer); } /** Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE OP code. - + @param Script The pointer of S3 boot script @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation @@ -1452,8 +1446,8 @@ BootScriptExecutePciCfg2ReadWrite ( CopyMem ((VOID*)&PciCfg2ReadWrite, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE)); - DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2ReadWrite - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2ReadWrite.Segment, PCI_ADDRESS_ENCODE (PciCfg2ReadWrite.Address), AndMask, OrMask)); - + DEBUG ((EFI_D_INFO, "BootScriptExecutePciCfg2ReadWrite - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfg2ReadWrite.Segment, PciCfg2ReadWrite.Address), AndMask, OrMask)); + Status = ScriptPciCfg2Read ( (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2ReadWrite.Width, PciCfg2ReadWrite.Segment, @@ -1477,20 +1471,20 @@ BootScriptExecutePciCfg2ReadWrite ( } /** Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG_POLL OP code. - + @param Script The pointer of S3 boot script @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation @retval EFI_SUCCESS The operation was executed successfully - @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to + @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to epecting data within the Loop Times. **/ EFI_STATUS BootScriptPciCfgPoll ( IN UINT8 *Script, IN UINT64 AndMask, - IN UINT64 OrMask + IN UINT64 OrMask ) { UINT64 Data; @@ -1499,8 +1493,8 @@ BootScriptPciCfgPoll ( EFI_BOOT_SCRIPT_PCI_CONFIG_POLL PciCfgPoll; CopyMem ((VOID*)&PciCfgPoll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG_POLL)); - DEBUG ((EFI_D_INFO, "BootScriptPciCfgPoll - 0x%08x, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfgPoll.Address), AndMask, OrMask)); - + DEBUG ((EFI_D_INFO, "BootScriptPciCfgPoll - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (0, PciCfgPoll.Address), AndMask, OrMask)); + Data = 0; Status = ScriptPciCfgRead ( (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfgPoll.Width, @@ -1536,13 +1530,13 @@ BootScriptPciCfgPoll ( /** Interprete the boot script node with EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL OP code. - + @param Script The pointer of S3 Boot Script @param AndMask Mask value for 'and' operation @param OrMask Mask value for 'or' operation @retval EFI_SUCCESS The operation was executed successfully - @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to + @retval EFI_DEVICE_ERROR Data polled from Pci configuration space does not equal to epecting data within the Loop Times. **/ @@ -1550,7 +1544,7 @@ EFI_STATUS BootScriptPciCfg2Poll ( IN UINT8 *Script, IN UINT64 AndMask, - IN UINT64 OrMask + IN UINT64 OrMask ) { EFI_STATUS Status; @@ -1561,8 +1555,8 @@ BootScriptPciCfg2Poll ( Data = 0; CopyMem ((VOID*)&PciCfg2Poll, (VOID*)Script, sizeof(EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL)); - DEBUG ((EFI_D_INFO, "BootScriptPciCfg2Poll - 0x%04x, 0x%08x, 0x%016lx, 0x%016lx\n", PciCfg2Poll.Segment, PCI_ADDRESS_ENCODE (PciCfg2Poll.Address), AndMask, OrMask)); - + DEBUG ((EFI_D_INFO, "BootScriptPciCfg2Poll - 0x%016lx, 0x%016lx, 0x%016lx\n", PCI_ADDRESS_ENCODE (PciCfg2Poll.Segment, PciCfg2Poll.Address), AndMask, OrMask)); + Status = ScriptPciCfg2Read ( (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width, PciCfg2Poll.Segment, @@ -1580,7 +1574,7 @@ BootScriptPciCfg2Poll ( Data = 0; Status = ScriptPciCfg2Read ( (S3_BOOT_SCRIPT_LIB_WIDTH) PciCfg2Poll.Width, - PciCfg2Poll.Segment, + PciCfg2Poll.Segment, PciCfg2Poll.Address, 1, &Data @@ -1595,18 +1589,15 @@ BootScriptPciCfg2Poll ( } else { return EFI_DEVICE_ERROR; } - + } /** Executes the S3 boot script table. - + @retval RETURN_SUCCESS The boot script table was executed successfully. - @retval RETURN_UNSUPPORTED Invalid script table or opcode. - - @note A known Limitations in the implementation: When interpreting the opcode EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE - EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE and EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE, the 'Segment' parameter is assumed as - Zero, or else, assert. + @retval RETURN_UNSUPPORTED Invalid script table or opcode. + **/ RETURN_STATUS EFIAPI @@ -1623,7 +1614,7 @@ S3BootScriptExecute ( EFI_BOOT_SCRIPT_COMMON_HEADER ScriptHeader; EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader; Script = mS3BootScriptTablePtr->TableBase; - if (Script != 0) { + if (Script != 0) { CopyMem ((VOID*)&TableHeader, Script, sizeof(EFI_BOOT_SCRIPT_TABLE_HEADER)); } else { return EFI_INVALID_PARAMETER; @@ -1635,7 +1626,7 @@ S3BootScriptExecute ( } DEBUG ((EFI_D_INFO, "TableHeader - 0x%08x\n", Script)); - + StartAddress = (UINTN) Script; TableLength = TableHeader.TableLength; Script = Script + TableHeader.Length; @@ -1643,11 +1634,12 @@ S3BootScriptExecute ( AndMask = 0; OrMask = 0; + DEBUG ((EFI_D_INFO, "TableHeader.Version - 0x%04x\n", (UINTN)TableHeader.Version)); DEBUG ((EFI_D_INFO, "TableHeader.TableLength - 0x%08x\n", (UINTN)TableLength)); while ((UINTN) Script < (UINTN) (StartAddress + TableLength)) { DEBUG ((EFI_D_INFO, "ExecuteBootScript - %08x\n", (UINTN)Script)); - + CopyMem ((VOID*)&ScriptHeader, Script, sizeof(EFI_BOOT_SCRIPT_COMMON_HEADER)); switch (ScriptHeader.OpCode) { @@ -1712,7 +1704,7 @@ S3BootScriptExecute ( case EFI_BOOT_SCRIPT_INFORMATION_OPCODE: DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_INFORMATION_OPCODE\n")); BootScriptExecuteInformation (Script); - break; + break; case S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE: DEBUG ((EFI_D_INFO, "S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE\n")); @@ -1743,21 +1735,21 @@ S3BootScriptExecute ( DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_MEM_POLL_OPCODE\n")); CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script); Status = BootScriptExecuteMemPoll (Script, AndMask, OrMask); - + break; - + case EFI_BOOT_SCRIPT_IO_POLL_OPCODE: DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_IO_POLL_OPCODE\n")); CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script); Status = BootScriptExecuteIoPoll (Script, AndMask, OrMask); break; - + case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE: DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE\n")); CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script); Status = BootScriptPciCfgPoll (Script, AndMask, OrMask); break; - + case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE: DEBUG ((EFI_D_INFO, "EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE\n")); CheckAndOrMask (&ScriptHeader, &AndMask, &OrMask, Script);