[edk2-devel] [PATCH V1 1/1] UefiCpuPkg/ResetVector: Cache Disable should not be set by default in CR0

2023-07-27 Thread xueshengfeng via groups.io
From: "Wu, MingliangX" 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4511

With 64 bit build we are seeing the CD in control register CR 0 set.
This causes the NEM to disabled for some specific bios profiles.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Debkumar De 
Cc: Catharine West 
Signed-off-by: Wu, Mingliang 
---
 UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm 
b/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm
index f59fc6ead4ba..4af2e875c31c 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm
@@ -7,7 +7,7 @@
 ;
 ;--
 
-%define SEC_DEFAULT_CR0  0x4023
+%define SEC_DEFAULT_CR0  0x0023
 %define SEC_DEFAULT_CR4  0x640
 
 BITS16
-- 
2.26.2.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107303): https://edk2.groups.io/g/devel/message/107303
Mute This Topic: https://groups.io/mt/100367559/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause Assert

2023-02-15 Thread xueshengfeng via groups.io
Hi  Liming,

Yes, it is good to us if catch this stable tag 202302.
Thank you very much

-邮件原件-
发件人: gaoliming [mailto:gaolim...@byosoft.com.cn] 
发送时间: 2023年2月15日 11:59
收件人: 'xueshengfeng'; devel@edk2.groups.io; jian.j.w...@intel.com
抄送: heinrich.schucha...@canonical.com; edhaya.chand...@arm.com; 
samer.el-haj-mahm...@arm.com; 'lijun10x'; 'Sunny Wang'
主题: 回复: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause Assert

Xueshengfeng:
  This patch is good to me. Reviewed-by: Liming Gao 

  Does this patch plan to catch this stable tag 202302?

Thanks
Liming
> -邮件原件-
> 发件人: xueshengfeng 
> 发送时间: 2023年2月2日 14:21
> 收件人: devel@edk2.groups.io; jian.j.w...@intel.com;
> gaolim...@byosoft.com.cn
> 抄送: heinrich.schucha...@canonical.com; edhaya.chand...@arm.com;
> samer.el-haj-mahm...@arm.com; lijun10x ; Sunny
> Wang 
> 主题: [PATCH] MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause
> Assert
> 
> From: lijun10x 
> 
> 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 
> Cc: Liming Gao 
> Cc: Sunny Wang 
> Cc: Heinrich Schuchardt 
> Cc: G Edhaya Chandran 
> Cc: Samer El-Haj-Mahmoud 
> ---
>  .../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 a

[edk2-devel] [PATCH] REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4331

2023-02-01 Thread xueshengfeng via groups.io
From: lijun10x 

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...@intel.com
Cc: Liming Gao 
Cc: Sunny Wang 
Cc: Heinrich Schuchardt 
Cc: G Edhaya Chandran 
Cc: Samer El-Haj-Mahmoud 
---
 .../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 BufferThe 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  

[edk2-devel] [PATCH] ShellPkg/SmbiosView: Smbiosview tool is not show Extended Speed and Extended Configured Memory Speed in type 17.

2022-08-08 Thread xueshengfeng via groups.io
From: Shengfengx Xue 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4014

if Configured Memory Speed is 65,535 MT/s or greater,
and the actual speed is stored in the Extended Configured Memory Speed
field. but current Smbiosview have no this logic.

Signed-off-by: Shengfengx Xue 
---
 .../UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c| 5 +
 1 file changed, 5 insertions(+)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index a0ee286c9a..0ab9f5063a 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -878,6 +878,11 @@ SmbiosPrintStructure (
 }
   }
 
+  if (AE_SMBIOS_VERSION (0x3, 0x3) && (Struct->Hdr->Length > 0x54)) {
+PRINT_STRUCT_VALUE_H (Struct, Type17, ExtendedSpeed);
+PRINT_STRUCT_VALUE_H (Struct, Type17, ExtendedConfiguredMemorySpeed);
+  }
+
   break;
 
 //
-- 
2.26.2.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92208): https://edk2.groups.io/g/devel/message/92208
Mute This Topic: https://groups.io/mt/92898444/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] MdeModulePkg/Variable: SCT run AuthVar_conf is failed

2022-07-05 Thread xueshengfeng via groups.io
From: Lijun10x 

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3969

Attr are EFI_VARIABLE_NON_VOLATILE|VARIABLE_AUTHENTICATED_WRITE_ACCESS,
will return EFI_INVALID_PARAMETER.
Added one case, only when one attribute is EFI_VARIABLE_NON_VOLATILE
will EFI_INVALID_PARAMETER be returned.
If attr are EFI_VARIABLE_NON_VOLATILE|VARIABLE_AUTHENTICATED_WRITE_ACCESS
will return EFI_UNSUPPORTED.
In the UEFI2.7 spec, there is a description as below:
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should not be
used. Platforms should return EFI_UNSUPPORTED if a caller to
SetVariable() specifies this attribute.

Signed-off-by: JunX1 Li 
Reviewed-by: Liming Gao 
Reviewed-by: G Edhaya Chandran 
Reviewed-by: Samer El-Haj-Mahmoud 
Reviewed-by: Sunny Wang 
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 6c1a3440ac..14c176887a 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -2676,7 +2676,11 @@ VariableServiceSetVariable (
 //
 // Only EFI_VARIABLE_NON_VOLATILE attribute is invalid
 //
-return EFI_INVALID_PARAMETER;
+if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
+  return EFI_UNSUPPORTED;
+} else {
+  return EFI_INVALID_PARAMETER;
+}
   } else if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) != 0) {
 if (!mVariableModuleGlobal->VariableGlobal.AuthSupport) {
   //
-- 
2.26.2.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91067): https://edk2.groups.io/g/devel/message/91067
Mute This Topic: https://groups.io/mt/92188170/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-