.../PiDxeS3BootScriptLib/BootScriptSave.c | 132 ++++++++++++++---- 1 file changed, 108 insertions(+), 24 deletions(-)
From: lijun10x <junx1.li@intel.com>
Some platforms don't support S3 with PcdAcpiS3Enable set as False.
Debug mode bios will ASSERT at this time as Follows.
ASSERT_RETURN_ERROR (Status = Out of Resources)
DXE_ASSERT!: Edk2\MdePkg\Library\BaseS3PciSegmentLib\S3PciSegmentLib.c (61): !(((INTN)(RETURN_STATUS)(Status)) < 0)
Steps to reproduce the issue:-
1.Set PcdAcpiS3Enable to FALSE.
2.Build the bios in debug mode.
3.Power on and Check the serial log.
Note: Prerequisite is that S3PciSegmentLib is Called and the caller's code is run.
Root Cause:
S3PciSegmentLib call S3BootScriptLib which controlled by PcdAcpiS3Enable.
If PcdAcpiS3Enable set as false, S3BootScriptLib will return error status(Out of Resources).
S3PciSegmentLib will ASSERT if S3BootScriptLib return error.
Solution:
Make S3BootScriptLib return success if PcdAcpiS3Enable was disabled,
which behave as a null S3BootScriptLib instance which just return success for no action is required to do.
Signed-off-by: junx1.li@intel.com
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Sunny Wang <sunny.wang@arm.com>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: G Edhaya Chandran <edhaya.chandran@arm.com>
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
.../PiDxeS3BootScriptLib/BootScriptSave.c | 132 ++++++++++++++----
1 file changed, 108 insertions(+), 24 deletions(-)
diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c
index f8d4983d81..b9b8562f14 100644
--- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c
+++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c
@@ -1004,7 +1004,7 @@ S3BootScriptCloseTable (
@param Buffer The source buffer from which to write data.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1021,6 +1021,10 @@ S3BootScriptSaveIoWrite (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_IO_WRITE ScriptIoWrite;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
WidthInByte = (UINT8)(0x01 << (Width & 0x03));
//
@@ -1064,7 +1068,7 @@ S3BootScriptSaveIoWrite (
@param DataMask A pointer to the data mask to be AND-ed with the data read from the register
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1080,6 +1084,10 @@ S3BootScriptSaveIoReadWrite (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_IO_READ_WRITE ScriptIoReadWrite;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
WidthInByte = (UINT8)(0x01 << (Width & 0x03));
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + (WidthInByte * 2));
@@ -1114,7 +1122,7 @@ S3BootScriptSaveIoReadWrite (
@param Buffer The source buffer from which to write the data.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1130,6 +1138,10 @@ S3BootScriptSaveMemWrite (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_MEM_WRITE ScriptMemWrite;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
WidthInByte = (UINT8)(0x01 << (Width & 0x03));
//
@@ -1174,7 +1186,7 @@ S3BootScriptSaveMemWrite (
@param DataMask A pointer to the data mask to be AND-ed with the data read from the register.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1190,6 +1202,10 @@ S3BootScriptSaveMemReadWrite (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_MEM_READ_WRITE ScriptMemReadWrite;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
WidthInByte = (UINT8)(0x01 << (Width & 0x03));
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + (WidthInByte * 2));
@@ -1224,7 +1240,7 @@ S3BootScriptSaveMemReadWrite (
@param Buffer The source buffer from which to write the data.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
@note A known Limitations in the implementation which is 64bits operations are not supported.
**/
@@ -1242,6 +1258,10 @@ S3BootScriptSavePciCfgWrite (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE ScriptPciWrite;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if ((Width == S3BootScriptWidthUint64) ||
(Width == S3BootScriptWidthFifoUint64) ||
(Width == S3BootScriptWidthFillUint64))
@@ -1293,7 +1313,7 @@ S3BootScriptSavePciCfgWrite (
@param DataMask A pointer to the data mask to be AND-ed.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN__SUCCESS Opcode is added.
+ @retval RETURN__SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
@note A known Limitations in the implementation which is 64bits operations are not supported.
**/
@@ -1311,6 +1331,10 @@ S3BootScriptSavePciCfgReadWrite (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE ScriptPciReadWrite;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if ((Width == S3BootScriptWidthUint64) ||
(Width == S3BootScriptWidthFifoUint64) ||
(Width == S3BootScriptWidthFillUint64))
@@ -1357,7 +1381,7 @@ S3BootScriptSavePciCfgReadWrite (
@param Buffer The source buffer from which to write the data.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
@note A known Limitations in the implementation which is 64bits operations are not supported.
**/
@@ -1376,6 +1400,10 @@ S3BootScriptSavePciCfg2Write (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE ScriptPciWrite2;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if ((Width == S3BootScriptWidthUint64) ||
(Width == S3BootScriptWidthFifoUint64) ||
(Width == S3BootScriptWidthFillUint64))
@@ -1429,7 +1457,7 @@ S3BootScriptSavePciCfg2Write (
@param DataMask A pointer to the data mask to be AND-ed.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
@note A known Limitations in the implementation which is 64bits operations are not supported.
**/
@@ -1448,6 +1476,10 @@ S3BootScriptSavePciCfg2ReadWrite (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE ScriptPciReadWrite2;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if ((Width == S3BootScriptWidthUint64) ||
(Width == S3BootScriptWidthFifoUint64) ||
(Width == S3BootScriptWidthFillUint64))
@@ -1601,7 +1633,7 @@ CheckParameters (
@param Buffer Contains the value of data to execute to the SMBUS slave device.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1618,6 +1650,10 @@ S3BootScriptSaveSmbusExecute (
UINT8 *Script;
EFI_BOOT_SCRIPT_SMBUS_EXECUTE ScriptSmbusExecute;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if (Length == NULL) {
BufferLength = 0;
} else {
@@ -1670,7 +1706,7 @@ S3BootScriptSaveSmbusExecute (
@param Duration Duration in microseconds of the stall
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1682,6 +1718,10 @@ S3BootScriptSaveStall (
UINT8 *Script;
EFI_BOOT_SCRIPT_STALL ScriptStall;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_STALL));
Script = S3BootScriptGetEntryAddAddress (Length);
@@ -1710,7 +1750,7 @@ S3BootScriptSaveStall (
@param Context Argument to be passed into the EntryPoint of the code to be dispatched.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1723,6 +1763,10 @@ S3BootScriptSaveDispatch2 (
UINT8 *Script;
EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH_2));
Script = S3BootScriptGetEntryAddAddress (Length);
@@ -1762,7 +1806,7 @@ S3BootScriptSaveDispatch2 (
@param LoopTimes The times of the register polling.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
@@ -1781,6 +1825,10 @@ S3BootScriptSaveMemPoll (
UINT8 WidthInByte;
EFI_BOOT_SCRIPT_MEM_POLL ScriptMemPoll;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
WidthInByte = (UINT8)(0x01 << (Width & 0x03));
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + (WidthInByte * 2));
@@ -1817,7 +1865,7 @@ S3BootScriptSaveMemPoll (
@param Information Information to be logged in the boot scrpit
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
@@ -1831,6 +1879,10 @@ S3BootScriptSaveInformation (
UINT8 *Script;
EFI_BOOT_SCRIPT_INFORMATION ScriptInformation;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
//
// Truncation check
//
@@ -1868,7 +1920,7 @@ S3BootScriptSaveInformation (
@param String The string to save to boot script table
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
@@ -1889,7 +1941,7 @@ S3BootScriptSaveInformationAsciiString (
@param EntryPoint Entry point of the code to be dispatched.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -1901,6 +1953,10 @@ S3BootScriptSaveDispatch (
UINT8 *Script;
EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH));
Script = S3BootScriptGetEntryAddAddress (Length);
@@ -1935,7 +1991,7 @@ S3BootScriptSaveDispatch (
granularity so the delay may be longer.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
@@ -1953,6 +2009,10 @@ S3BootScriptSaveIoPoll (
UINT8 Length;
EFI_BOOT_SCRIPT_IO_POLL ScriptIoPoll;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
WidthInByte = (UINT8)(0x01 << (Width & 0x03));
Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_POLL) + (WidthInByte * 2));
@@ -1992,7 +2052,7 @@ S3BootScriptSaveIoPoll (
granularity so the delay may be longer.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
@note A known Limitations in the implementation which is 64bits operations are not supported.
**/
@@ -2011,6 +2071,10 @@ S3BootScriptSavePciPoll (
UINT8 Length;
EFI_BOOT_SCRIPT_PCI_CONFIG_POLL ScriptPciPoll;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if ((Width == S3BootScriptWidthUint64) ||
(Width == S3BootScriptWidthFifoUint64) ||
(Width == S3BootScriptWidthFillUint64))
@@ -2058,7 +2122,7 @@ S3BootScriptSavePciPoll (
granularity so the delay may be longer.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
@note A known Limitations in the implementation which is 64bits operations are not supported.
**/
@@ -2078,6 +2142,10 @@ S3BootScriptSavePci2Poll (
UINT8 Length;
EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL ScriptPci2Poll;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if ((Width == S3BootScriptWidthUint64) ||
(Width == S3BootScriptWidthFifoUint64) ||
(Width == S3BootScriptWidthFillUint64))
@@ -2192,7 +2260,7 @@ S3BootScriptCalculateInsertAddress (
@retval RETURN_OUT_OF_RESOURCES The table is not available.
@retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.
- @retval RETURN_SUCCESS Opcode is inserted.
+ @retval RETURN_SUCCESS Opcode is inserted no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
EFIAPI
@@ -2210,6 +2278,10 @@ S3BootScriptMoveLastOpcode (
UINT8 *LastOpcode;
UINT8 TempBootScriptEntry[BOOT_SCRIPT_NODE_MAX_LENGTH];
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
ValidatePosition = FALSE;
TempPosition = (Position == NULL) ? NULL : (*Position);
@@ -2297,7 +2369,7 @@ S3BootScriptMoveLastOpcode (
@retval RETURN_INVALID_PARAMETER The Position is not a valid position in the boot script table.
@retval RETURN_OUT_OF_RESOURCES Not enough memory for the table do operation.
- @retval RETURN_SUCCESS Opcode is added.
+ @retval RETURN_SUCCESS Opcode is added or no action is required as ACPI S3 was disabled.
**/
RETURN_STATUS
@@ -2313,6 +2385,10 @@ S3BootScriptLabelInternal (
UINT8 *Script;
EFI_BOOT_SCRIPT_INFORMATION ScriptInformation;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
//
// Truncation check
//
@@ -2357,8 +2433,8 @@ S3BootScriptLabelInternal (
of the inserted opcode in the boot script table.
@param Label Points to the label which will be inserted in the boot script table.
- @retval EFI_SUCCESS The operation succeeded. A record was added into the
- specified script table.
+ @retval EFI_SUCCESS The operation succeeded or no action is required.
+ A record was added into the specified script table if ACPI S3 was enabled.
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
If the opcode is unknow or not supported because of the PCD
Feature Flags.
@@ -2381,6 +2457,10 @@ S3BootScriptLabel (
EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader;
UINT32 LabelLength;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
//
// Check NULL Label
//
@@ -2443,8 +2523,8 @@ S3BootScriptLabel (
@param Position2 The positions in the boot script table to compare
@param RelativePosition On return, points to the result of the comparison
- @retval EFI_SUCCESS The operation succeeded. A record was added into the
- specified script table.
+ @retval EFI_SUCCESS The operation succeeded or no action is required.
+ A record was added into the specified script table if ACPI S3 was enabled.
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
If the opcode is unknow or not supported because of the PCD
Feature Flags.
@@ -2462,6 +2542,10 @@ S3BootScriptCompare (
UINT8 *Script;
UINT32 TableLength;
+ if (!mS3BootScriptAcpiS3Enable) {
+ return RETURN_SUCCESS;
+ }
+
if (RelativePosition == NULL) {
return EFI_INVALID_PARAMETER;
}
--
2.26.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99418): https://edk2.groups.io/g/devel/message/99418
Mute This Topic: https://groups.io/mt/96684353/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Xueshengfeng: This patch is good to me. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Does this patch plan to catch this stable tag 202302? Thanks Liming > -----邮件原件----- > 发件人: xueshengfeng <xueshengfeng@byosoft.com.cn> > 发送时间: 2023年2月2日 14:21 > 收件人: devel@edk2.groups.io; jian.j.wang@intel.com; > gaoliming@byosoft.com.cn > 抄送: heinrich.schuchardt@canonical.com; edhaya.chandran@arm.com; > samer.el-haj-mahmoud@arm.com; lijun10x <junx1.li@intel.com>; Sunny > Wang <sunny.wang@arm.com> > 主题: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause > Assert > > From: lijun10x <junx1.li@intel.com> > > Some platforms don't support S3 with PcdAcpiS3Enable set as False. > Debug mode bios will ASSERT at this time as Follows. > ASSERT_RETURN_ERROR (Status = Out of Resources) > DXE_ASSERT!: > Edk2\MdePkg\Library\BaseS3PciSegmentLib\S3PciSegmentLib.c > (61): !(((INTN)(RETURN_STATUS)(Status)) < 0) > > Steps to reproduce the issue: > 1.Set PcdAcpiS3Enable to FALSE. > 2.Build the bios in debug mode. > 3.Power on and Check the serial log. > Note: Prerequisite is that S3PciSegmentLib is Called and > the caller's code is run. > > Root Cause: > S3PciSegmentLib call S3BootScriptLib controlled by PcdAcpiS3Enable. > If PcdAcpiS3Enable set as false, S3BootScriptLib will return error > status(Out of Resources). > S3PciSegmentLib will ASSERT if S3BootScriptLib return error. > > Solution: > Make S3BootScriptLib return success if PcdAcpiS3Enable was disabled, > which behave as a null S3BootScriptLib instance which just return success > for no action is required to do. > > Signed-off-by: JunX1 Li <junx1.li@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Sunny Wang <sunny.wang@arm.com> > Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > Cc: G Edhaya Chandran <edhaya.chandran@arm.com> > Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> > --- > .../PiDxeS3BootScriptLib/BootScriptSave.c | 132 ++++++++++++++---- > 1 file changed, 108 insertions(+), 24 deletions(-) > > diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > index f8d4983d81..b9b8562f14 100644 > --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > @@ -1004,7 +1004,7 @@ S3BootScriptCloseTable ( > @param Buffer The source buffer from which to write data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1021,6 +1021,10 @@ S3BootScriptSaveIoWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_IO_WRITE ScriptIoWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > // > @@ -1064,7 +1068,7 @@ S3BootScriptSaveIoWrite ( > @param DataMask A pointer to the data mask to be AND-ed with the > data read from the register > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1080,6 +1084,10 @@ S3BootScriptSaveIoReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_IO_READ_WRITE ScriptIoReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + > (WidthInByte * 2)); > > @@ -1114,7 +1122,7 @@ S3BootScriptSaveIoReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1130,6 +1138,10 @@ S3BootScriptSaveMemWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_WRITE ScriptMemWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > // > @@ -1174,7 +1186,7 @@ S3BootScriptSaveMemWrite ( > @param DataMask A pointer to the data mask to be AND-ed with the > data read from the register. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1190,6 +1202,10 @@ S3BootScriptSaveMemReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_READ_WRITE ScriptMemReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + > (WidthInByte * 2)); > > @@ -1224,7 +1240,7 @@ S3BootScriptSaveMemReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1242,6 +1258,10 @@ S3BootScriptSavePciCfgWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE ScriptPciWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1293,7 +1313,7 @@ S3BootScriptSavePciCfgWrite ( > @param DataMask A pointer to the data mask to be AND-ed. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN__SUCCESS Opcode is added. > + @retval RETURN__SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1311,6 +1331,10 @@ S3BootScriptSavePciCfgReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE ScriptPciReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1357,7 +1381,7 @@ S3BootScriptSavePciCfgReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1376,6 +1400,10 @@ S3BootScriptSavePciCfg2Write ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE ScriptPciWrite2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1429,7 +1457,7 @@ S3BootScriptSavePciCfg2Write ( > @param DataMask A pointer to the data mask to be AND-ed. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1448,6 +1476,10 @@ S3BootScriptSavePciCfg2ReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE ScriptPciReadWrite2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1601,7 +1633,7 @@ CheckParameters ( > @param Buffer Contains the value of data to execute to the > SMBUS slave device. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1618,6 +1650,10 @@ S3BootScriptSaveSmbusExecute ( > UINT8 *Script; > EFI_BOOT_SCRIPT_SMBUS_EXECUTE ScriptSmbusExecute; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if (Length == NULL) { > BufferLength = 0; > } else { > @@ -1670,7 +1706,7 @@ S3BootScriptSaveSmbusExecute ( > @param Duration Duration in microseconds of the stall > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1682,6 +1718,10 @@ S3BootScriptSaveStall ( > UINT8 *Script; > EFI_BOOT_SCRIPT_STALL ScriptStall; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_STALL)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1710,7 +1750,7 @@ S3BootScriptSaveStall ( > @param Context Argument to be passed into the EntryPoint of the > code to be dispatched. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1723,6 +1763,10 @@ S3BootScriptSaveDispatch2 ( > UINT8 *Script; > EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH_2)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1762,7 +1806,7 @@ S3BootScriptSaveDispatch2 ( > @param LoopTimes The times of the register polling. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1781,6 +1825,10 @@ S3BootScriptSaveMemPoll ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_POLL ScriptMemPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + (WidthInByte > * 2)); > @@ -1817,7 +1865,7 @@ S3BootScriptSaveMemPoll ( > @param Information Information to be logged in the boot scrpit > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1831,6 +1879,10 @@ S3BootScriptSaveInformation ( > UINT8 *Script; > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Truncation check > // > @@ -1868,7 +1920,7 @@ S3BootScriptSaveInformation ( > @param String The string to save to boot script table > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1889,7 +1941,7 @@ S3BootScriptSaveInformationAsciiString ( > @param EntryPoint Entry point of the code to be dispatched. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1901,6 +1953,10 @@ S3BootScriptSaveDispatch ( > UINT8 *Script; > EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1935,7 +1991,7 @@ S3BootScriptSaveDispatch ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1953,6 +2009,10 @@ S3BootScriptSaveIoPoll ( > UINT8 Length; > EFI_BOOT_SCRIPT_IO_POLL ScriptIoPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_POLL) + > (WidthInByte * 2)); > > @@ -1992,7 +2052,7 @@ S3BootScriptSaveIoPoll ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -2011,6 +2071,10 @@ S3BootScriptSavePciPoll ( > UINT8 Length; > EFI_BOOT_SCRIPT_PCI_CONFIG_POLL ScriptPciPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -2058,7 +2122,7 @@ S3BootScriptSavePciPoll ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -2078,6 +2142,10 @@ S3BootScriptSavePci2Poll ( > UINT8 Length; > EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL ScriptPci2Poll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -2192,7 +2260,7 @@ S3BootScriptCalculateInsertAddress ( > > @retval RETURN_OUT_OF_RESOURCES The table is not available. > @retval RETURN_INVALID_PARAMETER The Position is not a valid > position in the boot script table. > - @retval RETURN_SUCCESS Opcode is inserted. > + @retval RETURN_SUCCESS Opcode is inserted no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -2210,6 +2278,10 @@ S3BootScriptMoveLastOpcode ( > UINT8 *LastOpcode; > UINT8 > TempBootScriptEntry[BOOT_SCRIPT_NODE_MAX_LENGTH]; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > ValidatePosition = FALSE; > TempPosition = (Position == NULL) ? NULL : (*Position); > > @@ -2297,7 +2369,7 @@ S3BootScriptMoveLastOpcode ( > > @retval RETURN_INVALID_PARAMETER The Position is not a valid > position in the boot script table. > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -2313,6 +2385,10 @@ S3BootScriptLabelInternal ( > UINT8 *Script; > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Truncation check > // > @@ -2357,8 +2433,8 @@ S3BootScriptLabelInternal ( > of the inserted opcode in the boot > script table. > @param Label Points to the label which will be > inserted in the boot script table. > > - @retval EFI_SUCCESS The operation succeeded. A record > was added into the > - specified script table. > + @retval EFI_SUCCESS The operation succeeded or no action > is required. > + A record was added into the > specified script table if ACPI S3 was enabled. > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > boot script is not supported. > If the opcode is unknow or not > supported because of the PCD > Feature Flags. > @@ -2381,6 +2457,10 @@ S3BootScriptLabel ( > EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader; > UINT32 LabelLength; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Check NULL Label > // > @@ -2443,8 +2523,8 @@ S3BootScriptLabel ( > @param Position2 The positions in the boot script table > to compare > @param RelativePosition On return, points to the result of the > comparison > > - @retval EFI_SUCCESS The operation succeeded. A record > was added into the > - specified script table. > + @retval EFI_SUCCESS The operation succeeded or no action > is required. > + A record was added into the > specified script table if ACPI S3 was enabled. > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > boot script is not supported. > If the opcode is unknow or not > supported because of the PCD > Feature Flags. > @@ -2462,6 +2542,10 @@ S3BootScriptCompare ( > UINT8 *Script; > UINT32 TableLength; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if (RelativePosition == NULL) { > return EFI_INVALID_PARAMETER; > } > -- > 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100216): https://edk2.groups.io/g/devel/message/100216 Mute This Topic: https://groups.io/mt/96976904/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi Liming, Yes, it is good to us if catch this stable tag 202302. Thank you very much -----邮件原件----- 发件人: gaoliming [mailto:gaoliming@byosoft.com.cn] 发送时间: 2023年2月15日 11:59 收件人: 'xueshengfeng'; devel@edk2.groups.io; jian.j.wang@intel.com 抄送: heinrich.schuchardt@canonical.com; edhaya.chandran@arm.com; samer.el-haj-mahmoud@arm.com; 'lijun10x'; 'Sunny Wang' 主题: 回复: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause Assert Xueshengfeng: This patch is good to me. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Does this patch plan to catch this stable tag 202302? Thanks Liming > -----邮件原件----- > 发件人: xueshengfeng <xueshengfeng@byosoft.com.cn> > 发送时间: 2023年2月2日 14:21 > 收件人: devel@edk2.groups.io; jian.j.wang@intel.com; > gaoliming@byosoft.com.cn > 抄送: heinrich.schuchardt@canonical.com; edhaya.chandran@arm.com; > samer.el-haj-mahmoud@arm.com; lijun10x <junx1.li@intel.com>; Sunny > Wang <sunny.wang@arm.com> > 主题: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause > Assert > > From: lijun10x <junx1.li@intel.com> > > Some platforms don't support S3 with PcdAcpiS3Enable set as False. > Debug mode bios will ASSERT at this time as Follows. > ASSERT_RETURN_ERROR (Status = Out of Resources) > DXE_ASSERT!: > Edk2\MdePkg\Library\BaseS3PciSegmentLib\S3PciSegmentLib.c > (61): !(((INTN)(RETURN_STATUS)(Status)) < 0) > > Steps to reproduce the issue: > 1.Set PcdAcpiS3Enable to FALSE. > 2.Build the bios in debug mode. > 3.Power on and Check the serial log. > Note: Prerequisite is that S3PciSegmentLib is Called and > the caller's code is run. > > Root Cause: > S3PciSegmentLib call S3BootScriptLib controlled by PcdAcpiS3Enable. > If PcdAcpiS3Enable set as false, S3BootScriptLib will return error > status(Out of Resources). > S3PciSegmentLib will ASSERT if S3BootScriptLib return error. > > Solution: > Make S3BootScriptLib return success if PcdAcpiS3Enable was disabled, > which behave as a null S3BootScriptLib instance which just return success > for no action is required to do. > > Signed-off-by: JunX1 Li <junx1.li@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Sunny Wang <sunny.wang@arm.com> > Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > Cc: G Edhaya Chandran <edhaya.chandran@arm.com> > Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> > --- > .../PiDxeS3BootScriptLib/BootScriptSave.c | 132 ++++++++++++++---- > 1 file changed, 108 insertions(+), 24 deletions(-) > > diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > index f8d4983d81..b9b8562f14 100644 > --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > @@ -1004,7 +1004,7 @@ S3BootScriptCloseTable ( > @param Buffer The source buffer from which to write data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1021,6 +1021,10 @@ S3BootScriptSaveIoWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_IO_WRITE ScriptIoWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > // > @@ -1064,7 +1068,7 @@ S3BootScriptSaveIoWrite ( > @param DataMask A pointer to the data mask to be AND-ed with the > data read from the register > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1080,6 +1084,10 @@ S3BootScriptSaveIoReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_IO_READ_WRITE ScriptIoReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + > (WidthInByte * 2)); > > @@ -1114,7 +1122,7 @@ S3BootScriptSaveIoReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1130,6 +1138,10 @@ S3BootScriptSaveMemWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_WRITE ScriptMemWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > // > @@ -1174,7 +1186,7 @@ S3BootScriptSaveMemWrite ( > @param DataMask A pointer to the data mask to be AND-ed with the > data read from the register. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1190,6 +1202,10 @@ S3BootScriptSaveMemReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_READ_WRITE ScriptMemReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + > (WidthInByte * 2)); > > @@ -1224,7 +1240,7 @@ S3BootScriptSaveMemReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1242,6 +1258,10 @@ S3BootScriptSavePciCfgWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE ScriptPciWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1293,7 +1313,7 @@ S3BootScriptSavePciCfgWrite ( > @param DataMask A pointer to the data mask to be AND-ed. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN__SUCCESS Opcode is added. > + @retval RETURN__SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1311,6 +1331,10 @@ S3BootScriptSavePciCfgReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE ScriptPciReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1357,7 +1381,7 @@ S3BootScriptSavePciCfgReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1376,6 +1400,10 @@ S3BootScriptSavePciCfg2Write ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE ScriptPciWrite2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1429,7 +1457,7 @@ S3BootScriptSavePciCfg2Write ( > @param DataMask A pointer to the data mask to be AND-ed. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1448,6 +1476,10 @@ S3BootScriptSavePciCfg2ReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE ScriptPciReadWrite2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1601,7 +1633,7 @@ CheckParameters ( > @param Buffer Contains the value of data to execute to the > SMBUS slave device. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1618,6 +1650,10 @@ S3BootScriptSaveSmbusExecute ( > UINT8 *Script; > EFI_BOOT_SCRIPT_SMBUS_EXECUTE ScriptSmbusExecute; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if (Length == NULL) { > BufferLength = 0; > } else { > @@ -1670,7 +1706,7 @@ S3BootScriptSaveSmbusExecute ( > @param Duration Duration in microseconds of the stall > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1682,6 +1718,10 @@ S3BootScriptSaveStall ( > UINT8 *Script; > EFI_BOOT_SCRIPT_STALL ScriptStall; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_STALL)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1710,7 +1750,7 @@ S3BootScriptSaveStall ( > @param Context Argument to be passed into the EntryPoint of the > code to be dispatched. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1723,6 +1763,10 @@ S3BootScriptSaveDispatch2 ( > UINT8 *Script; > EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH_2)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1762,7 +1806,7 @@ S3BootScriptSaveDispatch2 ( > @param LoopTimes The times of the register polling. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1781,6 +1825,10 @@ S3BootScriptSaveMemPoll ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_POLL ScriptMemPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + (WidthInByte > * 2)); > @@ -1817,7 +1865,7 @@ S3BootScriptSaveMemPoll ( > @param Information Information to be logged in the boot scrpit > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1831,6 +1879,10 @@ S3BootScriptSaveInformation ( > UINT8 *Script; > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Truncation check > // > @@ -1868,7 +1920,7 @@ S3BootScriptSaveInformation ( > @param String The string to save to boot script table > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1889,7 +1941,7 @@ S3BootScriptSaveInformationAsciiString ( > @param EntryPoint Entry point of the code to be dispatched. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1901,6 +1953,10 @@ S3BootScriptSaveDispatch ( > UINT8 *Script; > EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1935,7 +1991,7 @@ S3BootScriptSaveDispatch ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1953,6 +2009,10 @@ S3BootScriptSaveIoPoll ( > UINT8 Length; > EFI_BOOT_SCRIPT_IO_POLL ScriptIoPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_POLL) + > (WidthInByte * 2)); > > @@ -1992,7 +2052,7 @@ S3BootScriptSaveIoPoll ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -2011,6 +2071,10 @@ S3BootScriptSavePciPoll ( > UINT8 Length; > EFI_BOOT_SCRIPT_PCI_CONFIG_POLL ScriptPciPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -2058,7 +2122,7 @@ S3BootScriptSavePciPoll ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -2078,6 +2142,10 @@ S3BootScriptSavePci2Poll ( > UINT8 Length; > EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL ScriptPci2Poll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -2192,7 +2260,7 @@ S3BootScriptCalculateInsertAddress ( > > @retval RETURN_OUT_OF_RESOURCES The table is not available. > @retval RETURN_INVALID_PARAMETER The Position is not a valid > position in the boot script table. > - @retval RETURN_SUCCESS Opcode is inserted. > + @retval RETURN_SUCCESS Opcode is inserted no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -2210,6 +2278,10 @@ S3BootScriptMoveLastOpcode ( > UINT8 *LastOpcode; > UINT8 > TempBootScriptEntry[BOOT_SCRIPT_NODE_MAX_LENGTH]; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > ValidatePosition = FALSE; > TempPosition = (Position == NULL) ? NULL : (*Position); > > @@ -2297,7 +2369,7 @@ S3BootScriptMoveLastOpcode ( > > @retval RETURN_INVALID_PARAMETER The Position is not a valid > position in the boot script table. > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -2313,6 +2385,10 @@ S3BootScriptLabelInternal ( > UINT8 *Script; > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Truncation check > // > @@ -2357,8 +2433,8 @@ S3BootScriptLabelInternal ( > of the inserted opcode in the boot > script table. > @param Label Points to the label which will be > inserted in the boot script table. > > - @retval EFI_SUCCESS The operation succeeded. A record > was added into the > - specified script table. > + @retval EFI_SUCCESS The operation succeeded or no action > is required. > + A record was added into the > specified script table if ACPI S3 was enabled. > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > boot script is not supported. > If the opcode is unknow or not > supported because of the PCD > Feature Flags. > @@ -2381,6 +2457,10 @@ S3BootScriptLabel ( > EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader; > UINT32 LabelLength; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Check NULL Label > // > @@ -2443,8 +2523,8 @@ S3BootScriptLabel ( > @param Position2 The positions in the boot script table > to compare > @param RelativePosition On return, points to the result of the > comparison > > - @retval EFI_SUCCESS The operation succeeded. A record > was added into the > - specified script table. > + @retval EFI_SUCCESS The operation succeeded or no action > is required. > + A record was added into the > specified script table if ACPI S3 was enabled. > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > boot script is not supported. > If the opcode is unknow or not > supported because of the PCD > Feature Flags. > @@ -2462,6 +2542,10 @@ S3BootScriptCompare ( > UINT8 *Script; > UINT32 TableLength; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if (RelativePosition == NULL) { > return EFI_INVALID_PARAMETER; > } > -- > 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100242): https://edk2.groups.io/g/devel/message/100242 Mute This Topic: https://groups.io/mt/96986082/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Xueshengfeng: Create PR https://github.com/tianocore/edk2/pull/4047 for this patch. Thanks Liming > -----邮件原件----- > 发件人: xueshengfeng <xueshengfeng@byosoft.com.cn> > 发送时间: 2023年2月15日 12:18 > 收件人: 'gaoliming' <gaoliming@byosoft.com.cn>; devel@edk2.groups.io; > jian.j.wang@intel.com > 抄送: heinrich.schuchardt@canonical.com; edhaya.chandran@arm.com; > samer.el-haj-mahmoud@arm.com; 'lijun10x' <junx1.li@intel.com>; 'Sunny > Wang' <sunny.wang@arm.com> > 主题: 答复: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE > cause Assert > > Hi Liming, > > Yes, it is good to us if catch this stable tag 202302. > Thank you very much > > -----邮件原件----- > 发件人: gaoliming [mailto:gaoliming@byosoft.com.cn] > 发送时间: 2023年2月15日 11:59 > 收件人: 'xueshengfeng'; devel@edk2.groups.io; jian.j.wang@intel.com > 抄送: heinrich.schuchardt@canonical.com; edhaya.chandran@arm.com; > samer.el-haj-mahmoud@arm.com; 'lijun10x'; 'Sunny Wang' > 主题: 回复: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE > cause Assert > > Xueshengfeng: > This patch is good to me. Reviewed-by: Liming Gao > <gaoliming@byosoft.com.cn> > > Does this patch plan to catch this stable tag 202302? > > Thanks > Liming > > -----邮件原件----- > > 发件人: xueshengfeng <xueshengfeng@byosoft.com.cn> > > 发送时间: 2023年2月2日 14:21 > > 收件人: devel@edk2.groups.io; jian.j.wang@intel.com; > > gaoliming@byosoft.com.cn > > 抄送: heinrich.schuchardt@canonical.com; edhaya.chandran@arm.com; > > samer.el-haj-mahmoud@arm.com; lijun10x <junx1.li@intel.com>; Sunny > > Wang <sunny.wang@arm.com> > > 主题: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause > > Assert > > > > From: lijun10x <junx1.li@intel.com> > > > > Some platforms don't support S3 with PcdAcpiS3Enable set as False. > > Debug mode bios will ASSERT at this time as Follows. > > ASSERT_RETURN_ERROR (Status = Out of Resources) > > DXE_ASSERT!: > > Edk2\MdePkg\Library\BaseS3PciSegmentLib\S3PciSegmentLib.c > > (61): !(((INTN)(RETURN_STATUS)(Status)) < 0) > > > > Steps to reproduce the issue: > > 1.Set PcdAcpiS3Enable to FALSE. > > 2.Build the bios in debug mode. > > 3.Power on and Check the serial log. > > Note: Prerequisite is that S3PciSegmentLib is Called and > > the caller's code is run. > > > > Root Cause: > > S3PciSegmentLib call S3BootScriptLib controlled by PcdAcpiS3Enable. > > If PcdAcpiS3Enable set as false, S3BootScriptLib will return error > > status(Out of Resources). > > S3PciSegmentLib will ASSERT if S3BootScriptLib return error. > > > > Solution: > > Make S3BootScriptLib return success if PcdAcpiS3Enable was disabled, > > which behave as a null S3BootScriptLib instance which just return success > > for no action is required to do. > > > > Signed-off-by: JunX1 Li <junx1.li@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Cc: Sunny Wang <sunny.wang@arm.com> > > Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > > Cc: G Edhaya Chandran <edhaya.chandran@arm.com> > > Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> > > --- > > .../PiDxeS3BootScriptLib/BootScriptSave.c | 132 > ++++++++++++++---- > > 1 file changed, 108 insertions(+), 24 deletions(-) > > > > diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > > b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > > index f8d4983d81..b9b8562f14 100644 > > --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > > +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > > @@ -1004,7 +1004,7 @@ S3BootScriptCloseTable ( > > @param Buffer The source buffer from which to write data. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1021,6 +1021,10 @@ S3BootScriptSaveIoWrite ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_IO_WRITE ScriptIoWrite; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > > > // > > @@ -1064,7 +1068,7 @@ S3BootScriptSaveIoWrite ( > > @param DataMask A pointer to the data mask to be AND-ed with the > > data read from the register > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1080,6 +1084,10 @@ S3BootScriptSaveIoReadWrite ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_IO_READ_WRITE ScriptIoReadWrite; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + > > (WidthInByte * 2)); > > > > @@ -1114,7 +1122,7 @@ S3BootScriptSaveIoReadWrite ( > > @param Buffer The source buffer from which to write the data. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1130,6 +1138,10 @@ S3BootScriptSaveMemWrite ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_MEM_WRITE ScriptMemWrite; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > > > // > > @@ -1174,7 +1186,7 @@ S3BootScriptSaveMemWrite ( > > @param DataMask A pointer to the data mask to be AND-ed with the > > data read from the register. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1190,6 +1202,10 @@ S3BootScriptSaveMemReadWrite ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_MEM_READ_WRITE ScriptMemReadWrite; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) > + > > (WidthInByte * 2)); > > > > @@ -1224,7 +1240,7 @@ S3BootScriptSaveMemReadWrite ( > > @param Buffer The source buffer from which to write the data. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > @note A known Limitations in the implementation which is 64bits > > operations are not supported. > > > > **/ > > @@ -1242,6 +1258,10 @@ S3BootScriptSavePciCfgWrite ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE ScriptPciWrite; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if ((Width == S3BootScriptWidthUint64) || > > (Width == S3BootScriptWidthFifoUint64) || > > (Width == S3BootScriptWidthFillUint64)) > > @@ -1293,7 +1313,7 @@ S3BootScriptSavePciCfgWrite ( > > @param DataMask A pointer to the data mask to be AND-ed. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN__SUCCESS Opcode is added. > > + @retval RETURN__SUCCESS Opcode is added or no action > is > > required as ACPI S3 was disabled. > > @note A known Limitations in the implementation which is 64bits > > operations are not supported. > > > > **/ > > @@ -1311,6 +1331,10 @@ S3BootScriptSavePciCfgReadWrite ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE ScriptPciReadWrite; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if ((Width == S3BootScriptWidthUint64) || > > (Width == S3BootScriptWidthFifoUint64) || > > (Width == S3BootScriptWidthFillUint64)) > > @@ -1357,7 +1381,7 @@ S3BootScriptSavePciCfgReadWrite ( > > @param Buffer The source buffer from which to write the data. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > @note A known Limitations in the implementation which is 64bits > > operations are not supported. > > > > **/ > > @@ -1376,6 +1400,10 @@ S3BootScriptSavePciCfg2Write ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE ScriptPciWrite2; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if ((Width == S3BootScriptWidthUint64) || > > (Width == S3BootScriptWidthFifoUint64) || > > (Width == S3BootScriptWidthFillUint64)) > > @@ -1429,7 +1457,7 @@ S3BootScriptSavePciCfg2Write ( > > @param DataMask A pointer to the data mask to be AND-ed. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > @note A known Limitations in the implementation which is 64bits > > operations are not supported. > > > > **/ > > @@ -1448,6 +1476,10 @@ S3BootScriptSavePciCfg2ReadWrite ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE > ScriptPciReadWrite2; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if ((Width == S3BootScriptWidthUint64) || > > (Width == S3BootScriptWidthFifoUint64) || > > (Width == S3BootScriptWidthFillUint64)) > > @@ -1601,7 +1633,7 @@ CheckParameters ( > > @param Buffer Contains the value of data to execute to the > > SMBUS slave device. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1618,6 +1650,10 @@ S3BootScriptSaveSmbusExecute ( > > UINT8 *Script; > > EFI_BOOT_SCRIPT_SMBUS_EXECUTE ScriptSmbusExecute; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if (Length == NULL) { > > BufferLength = 0; > > } else { > > @@ -1670,7 +1706,7 @@ S3BootScriptSaveSmbusExecute ( > > @param Duration Duration in microseconds of the stall > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1682,6 +1718,10 @@ S3BootScriptSaveStall ( > > UINT8 *Script; > > EFI_BOOT_SCRIPT_STALL ScriptStall; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_STALL)); > > > > Script = S3BootScriptGetEntryAddAddress (Length); > > @@ -1710,7 +1750,7 @@ S3BootScriptSaveStall ( > > @param Context Argument to be passed into the EntryPoint of > the > > code to be dispatched. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1723,6 +1763,10 @@ S3BootScriptSaveDispatch2 ( > > UINT8 *Script; > > EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH_2)); > > > > Script = S3BootScriptGetEntryAddAddress (Length); > > @@ -1762,7 +1806,7 @@ S3BootScriptSaveDispatch2 ( > > @param LoopTimes The times of the register polling. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > > > **/ > > RETURN_STATUS > > @@ -1781,6 +1825,10 @@ S3BootScriptSaveMemPoll ( > > UINT8 WidthInByte; > > EFI_BOOT_SCRIPT_MEM_POLL ScriptMemPoll; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + > (WidthInByte > > * 2)); > > @@ -1817,7 +1865,7 @@ S3BootScriptSaveMemPoll ( > > @param Information Information to be logged in the boot > scrpit > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > > > **/ > > RETURN_STATUS > > @@ -1831,6 +1879,10 @@ S3BootScriptSaveInformation ( > > UINT8 *Script; > > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > // > > // Truncation check > > // > > @@ -1868,7 +1920,7 @@ S3BootScriptSaveInformation ( > > @param String The string to save to boot script table > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > > > **/ > > RETURN_STATUS > > @@ -1889,7 +1941,7 @@ S3BootScriptSaveInformationAsciiString ( > > @param EntryPoint Entry point of the code to be dispatched. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -1901,6 +1953,10 @@ S3BootScriptSaveDispatch ( > > UINT8 *Script; > > EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH)); > > > > Script = S3BootScriptGetEntryAddAddress (Length); > > @@ -1935,7 +1991,7 @@ S3BootScriptSaveDispatch ( > > granularity so the delay may be > > longer. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > > > **/ > > RETURN_STATUS > > @@ -1953,6 +2009,10 @@ S3BootScriptSaveIoPoll ( > > UINT8 Length; > > EFI_BOOT_SCRIPT_IO_POLL ScriptIoPoll; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_POLL) + > > (WidthInByte * 2)); > > > > @@ -1992,7 +2052,7 @@ S3BootScriptSaveIoPoll ( > > granularity so the delay may be > > longer. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > @note A known Limitations in the implementation which is 64bits > > operations are not supported. > > > > **/ > > @@ -2011,6 +2071,10 @@ S3BootScriptSavePciPoll ( > > UINT8 Length; > > EFI_BOOT_SCRIPT_PCI_CONFIG_POLL ScriptPciPoll; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if ((Width == S3BootScriptWidthUint64) || > > (Width == S3BootScriptWidthFifoUint64) || > > (Width == S3BootScriptWidthFillUint64)) > > @@ -2058,7 +2122,7 @@ S3BootScriptSavePciPoll ( > > granularity so the delay may be > > longer. > > > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > @note A known Limitations in the implementation which is 64bits > > operations are not supported. > > > > **/ > > @@ -2078,6 +2142,10 @@ S3BootScriptSavePci2Poll ( > > UINT8 Length; > > EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL ScriptPci2Poll; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if ((Width == S3BootScriptWidthUint64) || > > (Width == S3BootScriptWidthFifoUint64) || > > (Width == S3BootScriptWidthFillUint64)) > > @@ -2192,7 +2260,7 @@ S3BootScriptCalculateInsertAddress ( > > > > @retval RETURN_OUT_OF_RESOURCES The table is not available. > > @retval RETURN_INVALID_PARAMETER The Position is not a valid > > position in the boot script table. > > - @retval RETURN_SUCCESS Opcode is inserted. > > + @retval RETURN_SUCCESS Opcode is inserted no action is > > required as ACPI S3 was disabled. > > **/ > > RETURN_STATUS > > EFIAPI > > @@ -2210,6 +2278,10 @@ S3BootScriptMoveLastOpcode ( > > UINT8 *LastOpcode; > > UINT8 > > TempBootScriptEntry[BOOT_SCRIPT_NODE_MAX_LENGTH]; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > ValidatePosition = FALSE; > > TempPosition = (Position == NULL) ? NULL : (*Position); > > > > @@ -2297,7 +2369,7 @@ S3BootScriptMoveLastOpcode ( > > > > @retval RETURN_INVALID_PARAMETER The Position is not a valid > > position in the boot script table. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > > table do operation. > > - @retval RETURN_SUCCESS Opcode is added. > > + @retval RETURN_SUCCESS Opcode is added or no action is > > required as ACPI S3 was disabled. > > > > **/ > > RETURN_STATUS > > @@ -2313,6 +2385,10 @@ S3BootScriptLabelInternal ( > > UINT8 *Script; > > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > // > > // Truncation check > > // > > @@ -2357,8 +2433,8 @@ S3BootScriptLabelInternal ( > > of the inserted opcode in the boot > > script table. > > @param Label Points to the label which will be > > inserted in the boot script table. > > > > - @retval EFI_SUCCESS The operation succeeded. A record > > was added into the > > - specified script table. > > + @retval EFI_SUCCESS The operation succeeded or no > action > > is required. > > + A record was added into the > > specified script table if ACPI S3 was enabled. > > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > > boot script is not supported. > > If the opcode is unknow or not > > supported because of the PCD > > Feature Flags. > > @@ -2381,6 +2457,10 @@ S3BootScriptLabel ( > > EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader; > > UINT32 LabelLength; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > // > > // Check NULL Label > > // > > @@ -2443,8 +2523,8 @@ S3BootScriptLabel ( > > @param Position2 The positions in the boot script > table > > to compare > > @param RelativePosition On return, points to the result of the > > comparison > > > > - @retval EFI_SUCCESS The operation succeeded. A record > > was added into the > > - specified script table. > > + @retval EFI_SUCCESS The operation succeeded or no > action > > is required. > > + A record was added into the > > specified script table if ACPI S3 was enabled. > > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > > boot script is not supported. > > If the opcode is unknow or not > > supported because of the PCD > > Feature Flags. > > @@ -2462,6 +2542,10 @@ S3BootScriptCompare ( > > UINT8 *Script; > > UINT32 TableLength; > > > > + if (!mS3BootScriptAcpiS3Enable) { > > + return RETURN_SUCCESS; > > + } > > + > > if (RelativePosition == NULL) { > > return EFI_INVALID_PARAMETER; > > } > > -- > > 2.26.2.windows.1 > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#100221): https://edk2.groups.io/g/devel/message/100221 Mute This Topic: https://groups.io/mt/96976904/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Please update patch subject as PkgName ModuleName: Description. You can refer to the existing commit message in Edk2. And, please run BaseTools\Scripts\PatchCheck.py to verify the patch format. Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 xueshengfeng > via groups.io > 发送时间: 2023年2月1日 18:02 > 收件人: devel@edk2.groups.io; jian.j.wang@intel.com; > gaoliming@byosoft.com.cn > 抄送: heinrich.schuchardt@canonical.com; edhaya.chandran@arm.com; > samer.el-haj-mahmoud@arm.com; lijun10x <junx1.li@intel.com>; Sunny > Wang <sunny.wang@arm.com> > 主题: [edk2-devel] [PATCH] REF: > https://bugzilla.tianocore.org/show_bug.cgi?id=4331 > > From: lijun10x <junx1.li@intel.com> > > Some platforms don't support S3 with PcdAcpiS3Enable set as False. > Debug mode bios will ASSERT at this time as Follows. > ASSERT_RETURN_ERROR (Status = Out of Resources) > DXE_ASSERT!: > Edk2\MdePkg\Library\BaseS3PciSegmentLib\S3PciSegmentLib.c > (61): !(((INTN)(RETURN_STATUS)(Status)) < 0) > > Steps to reproduce the issue:- > 1.Set PcdAcpiS3Enable to FALSE. > 2.Build the bios in debug mode. > 3.Power on and Check the serial log. > Note: Prerequisite is that S3PciSegmentLib is Called and the caller's code is > run. > > Root Cause: > S3PciSegmentLib call S3BootScriptLib which controlled by PcdAcpiS3Enable. > If PcdAcpiS3Enable set as false, S3BootScriptLib will return error status(Out of > Resources). > S3PciSegmentLib will ASSERT if S3BootScriptLib return error. > > Solution: > Make S3BootScriptLib return success if PcdAcpiS3Enable was disabled, > which behave as a null S3BootScriptLib instance which just return success for > no action is required to do. > > Signed-off-by: junx1.li@intel.com > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Sunny Wang <sunny.wang@arm.com> > Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > Cc: G Edhaya Chandran <edhaya.chandran@arm.com> > Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> > --- > .../PiDxeS3BootScriptLib/BootScriptSave.c | 132 ++++++++++++++---- > 1 file changed, 108 insertions(+), 24 deletions(-) > > diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > index f8d4983d81..b9b8562f14 100644 > --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c > @@ -1004,7 +1004,7 @@ S3BootScriptCloseTable ( > @param Buffer The source buffer from which to write data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1021,6 +1021,10 @@ S3BootScriptSaveIoWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_IO_WRITE ScriptIoWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > // > @@ -1064,7 +1068,7 @@ S3BootScriptSaveIoWrite ( > @param DataMask A pointer to the data mask to be AND-ed with the > data read from the register > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1080,6 +1084,10 @@ S3BootScriptSaveIoReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_IO_READ_WRITE ScriptIoReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_READ_WRITE) + > (WidthInByte * 2)); > > @@ -1114,7 +1122,7 @@ S3BootScriptSaveIoReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1130,6 +1138,10 @@ S3BootScriptSaveMemWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_WRITE ScriptMemWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > // > @@ -1174,7 +1186,7 @@ S3BootScriptSaveMemWrite ( > @param DataMask A pointer to the data mask to be AND-ed with the > data read from the register. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1190,6 +1202,10 @@ S3BootScriptSaveMemReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_READ_WRITE ScriptMemReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_READ_WRITE) + > (WidthInByte * 2)); > > @@ -1224,7 +1240,7 @@ S3BootScriptSaveMemReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1242,6 +1258,10 @@ S3BootScriptSavePciCfgWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE ScriptPciWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1293,7 +1313,7 @@ S3BootScriptSavePciCfgWrite ( > @param DataMask A pointer to the data mask to be AND-ed. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN__SUCCESS Opcode is added. > + @retval RETURN__SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1311,6 +1331,10 @@ S3BootScriptSavePciCfgReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE ScriptPciReadWrite; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1357,7 +1381,7 @@ S3BootScriptSavePciCfgReadWrite ( > @param Buffer The source buffer from which to write the data. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1376,6 +1400,10 @@ S3BootScriptSavePciCfg2Write ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE ScriptPciWrite2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1429,7 +1457,7 @@ S3BootScriptSavePciCfg2Write ( > @param DataMask A pointer to the data mask to be AND-ed. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -1448,6 +1476,10 @@ S3BootScriptSavePciCfg2ReadWrite ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE ScriptPciReadWrite2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -1601,7 +1633,7 @@ CheckParameters ( > @param Buffer Contains the value of data to execute to the > SMBUS slave device. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1618,6 +1650,10 @@ S3BootScriptSaveSmbusExecute ( > UINT8 *Script; > EFI_BOOT_SCRIPT_SMBUS_EXECUTE ScriptSmbusExecute; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if (Length == NULL) { > BufferLength = 0; > } else { > @@ -1670,7 +1706,7 @@ S3BootScriptSaveSmbusExecute ( > @param Duration Duration in microseconds of the stall > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1682,6 +1718,10 @@ S3BootScriptSaveStall ( > UINT8 *Script; > EFI_BOOT_SCRIPT_STALL ScriptStall; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_STALL)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1710,7 +1750,7 @@ S3BootScriptSaveStall ( > @param Context Argument to be passed into the EntryPoint of the > code to be dispatched. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1723,6 +1763,10 @@ S3BootScriptSaveDispatch2 ( > UINT8 *Script; > EFI_BOOT_SCRIPT_DISPATCH_2 ScriptDispatch2; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH_2)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1762,7 +1806,7 @@ S3BootScriptSaveDispatch2 ( > @param LoopTimes The times of the register polling. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1781,6 +1825,10 @@ S3BootScriptSaveMemPoll ( > UINT8 WidthInByte; > EFI_BOOT_SCRIPT_MEM_POLL ScriptMemPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_MEM_POLL) + (WidthInByte > * 2)); > @@ -1817,7 +1865,7 @@ S3BootScriptSaveMemPoll ( > @param Information Information to be logged in the boot scrpit > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1831,6 +1879,10 @@ S3BootScriptSaveInformation ( > UINT8 *Script; > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Truncation check > // > @@ -1868,7 +1920,7 @@ S3BootScriptSaveInformation ( > @param String The string to save to boot script table > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1889,7 +1941,7 @@ S3BootScriptSaveInformationAsciiString ( > @param EntryPoint Entry point of the code to be dispatched. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -1901,6 +1953,10 @@ S3BootScriptSaveDispatch ( > UINT8 *Script; > EFI_BOOT_SCRIPT_DISPATCH ScriptDispatch; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH)); > > Script = S3BootScriptGetEntryAddAddress (Length); > @@ -1935,7 +1991,7 @@ S3BootScriptSaveDispatch ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -1953,6 +2009,10 @@ S3BootScriptSaveIoPoll ( > UINT8 Length; > EFI_BOOT_SCRIPT_IO_POLL ScriptIoPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > WidthInByte = (UINT8)(0x01 << (Width & 0x03)); > Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_IO_POLL) + > (WidthInByte * 2)); > > @@ -1992,7 +2052,7 @@ S3BootScriptSaveIoPoll ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -2011,6 +2071,10 @@ S3BootScriptSavePciPoll ( > UINT8 Length; > EFI_BOOT_SCRIPT_PCI_CONFIG_POLL ScriptPciPoll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -2058,7 +2122,7 @@ S3BootScriptSavePciPoll ( > granularity so the delay may be > longer. > > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > @note A known Limitations in the implementation which is 64bits > operations are not supported. > > **/ > @@ -2078,6 +2142,10 @@ S3BootScriptSavePci2Poll ( > UINT8 Length; > EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL ScriptPci2Poll; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if ((Width == S3BootScriptWidthUint64) || > (Width == S3BootScriptWidthFifoUint64) || > (Width == S3BootScriptWidthFillUint64)) > @@ -2192,7 +2260,7 @@ S3BootScriptCalculateInsertAddress ( > > @retval RETURN_OUT_OF_RESOURCES The table is not available. > @retval RETURN_INVALID_PARAMETER The Position is not a valid > position in the boot script table. > - @retval RETURN_SUCCESS Opcode is inserted. > + @retval RETURN_SUCCESS Opcode is inserted no action is > required as ACPI S3 was disabled. > **/ > RETURN_STATUS > EFIAPI > @@ -2210,6 +2278,10 @@ S3BootScriptMoveLastOpcode ( > UINT8 *LastOpcode; > UINT8 > TempBootScriptEntry[BOOT_SCRIPT_NODE_MAX_LENGTH]; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > ValidatePosition = FALSE; > TempPosition = (Position == NULL) ? NULL : (*Position); > > @@ -2297,7 +2369,7 @@ S3BootScriptMoveLastOpcode ( > > @retval RETURN_INVALID_PARAMETER The Position is not a valid > position in the boot script table. > @retval RETURN_OUT_OF_RESOURCES Not enough memory for the > table do operation. > - @retval RETURN_SUCCESS Opcode is added. > + @retval RETURN_SUCCESS Opcode is added or no action is > required as ACPI S3 was disabled. > > **/ > RETURN_STATUS > @@ -2313,6 +2385,10 @@ S3BootScriptLabelInternal ( > UINT8 *Script; > EFI_BOOT_SCRIPT_INFORMATION ScriptInformation; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Truncation check > // > @@ -2357,8 +2433,8 @@ S3BootScriptLabelInternal ( > of the inserted opcode in the boot > script table. > @param Label Points to the label which will be > inserted in the boot script table. > > - @retval EFI_SUCCESS The operation succeeded. A record > was added into the > - specified script table. > + @retval EFI_SUCCESS The operation succeeded or no action > is required. > + A record was added into the > specified script table if ACPI S3 was enabled. > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > boot script is not supported. > If the opcode is unknow or not > supported because of the PCD > Feature Flags. > @@ -2381,6 +2457,10 @@ S3BootScriptLabel ( > EFI_BOOT_SCRIPT_TABLE_HEADER TableHeader; > UINT32 LabelLength; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > // > // Check NULL Label > // > @@ -2443,8 +2523,8 @@ S3BootScriptLabel ( > @param Position2 The positions in the boot script table > to compare > @param RelativePosition On return, points to the result of the > comparison > > - @retval EFI_SUCCESS The operation succeeded. A record > was added into the > - specified script table. > + @retval EFI_SUCCESS The operation succeeded or no action > is required. > + A record was added into the > specified script table if ACPI S3 was enabled. > @retval EFI_INVALID_PARAMETER The parameter is illegal or the given > boot script is not supported. > If the opcode is unknow or not > supported because of the PCD > Feature Flags. > @@ -2462,6 +2542,10 @@ S3BootScriptCompare ( > UINT8 *Script; > UINT32 TableLength; > > + if (!mS3BootScriptAcpiS3Enable) { > + return RETURN_SUCCESS; > + } > + > if (RelativePosition == NULL) { > return EFI_INVALID_PARAMETER; > } > -- > 2.26.2.windows.1 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99431): https://edk2.groups.io/g/devel/message/99431 Mute This Topic: https://groups.io/mt/96693527/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.