[edk2-devel] [edk2-libc Patch 0/1] Update Maintainer Info

2023-03-26 Thread Jayaprakash, N
This patch is for updating the maintainer info of edk2-libc repo.

Jayaprakash N (1):
  edk2-libc: Update Maintainer.txt file

 Maintainers.txt | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.40.0.windows.1



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




[edk2-devel] [edk2-libc Patch 1/1] edk2-libc: Update Maintainer.txt file

2023-03-26 Thread Jayaprakash, N
REF : https://bugzilla.tianocore.org/show_bug.cgi?id=4388

This commit adds Jayaprakash N as one of the maintainers of
edk2-libc repo.

Cc: Rebecca Cran 
Cc: Michael D Kinney 
Signed-off-by: Jayaprakash N 
---
 Maintainers.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index c262b2f..8a98987 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -62,8 +62,10 @@ AppPkg
 W: https://github.com/tianocore/tianocore.github.io/wiki/AppPkg
 M: Rebecca Cran 
 M: Michael D Kinney 
+M: Jayaprakash N 
 
 StdLib, StdLibPrivateInternalFiles
 W: https://github.com/tianocore/tianocore.github.io/wiki/StdLib
 M: Rebecca Cran 
 M: Michael D Kinney 
+M: Jayaprakash N 
-- 
2.40.0.windows.1



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




Re: [edk2-devel] [edk2-libc Patch 2/2] Added file header with copyright and license.

2023-03-26 Thread Ajay Kadapathri
Sure I will do.

Thanks,
Ajay

-Original Message-
From: Kinney, Michael D  
Sent: Friday, March 24, 2023 8:54 PM
To: Kadapathri, Ajay ; devel@edk2.groups.io
Cc: Rebecca Cran ; Jayaprakash, N ; 
Kinney, Michael D 
Subject: RE: [edk2-libc Patch 2/2] Added file header with copyright and license.

Can you combine with this patch #1?

Thanks,

Mike

> -Original Message-
> From: Kadapathri, Ajay 
> Sent: Friday, March 24, 2023 1:27 AM
> To: devel@edk2.groups.io
> Cc: Rebecca Cran ; Kinney, Michael D 
> ; Jayaprakash, N 
> Subject: [edk2-libc Patch 2/2] Added file header with copyright and license.
> 
> Cc: Rebecca Cran 
> Cc: Michael D Kinney 
> Cc: Jayaprakash N 
> Signed-off-by: Ajay Kadapathri 
> ---
>  .../Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm   | 17 -
>  .../Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s  | 17 -
>  .../PyMod-3.6.8/Modules/cpu_ia32.nasm   | 17 -
>  .../PyMod-3.6.8/Modules/cpu_ia32_gcc.s  | 16 
>  4 files changed, 64 insertions(+), 3 deletions(-)
> 
> diff --git 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm 
> b/AppPkg/Applications/Python/Python-
> 3.6.8/PyMod-3.6.8/Modules/cpu.nasm
> index 2d4f561..bd50015 100644
> --- 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.nasm
> +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu.
> +++ nasm
> @@ -1,4 +1,19 @@
> -;TITLE   cpu.asm: Assembly code for the x64 resources
> +;
> +--
> +;
> +; Copyright (c) 2011 - 2023, Intel Corporation. All rights 
> +reserved. ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; 
> +Module Name:
> +;
> +;   cpu.nasm
> +;
> +; Abstract:
> +;
> +;   swsmi function
> +;
> +; Notes:
> +;
> +;
> +--
> 
>  DEFAULT REL
>  SECTION .text
> diff --git 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.
> s b/AppPkg/Applications/Python/Python-
> 3.6.8/PyMod-3.6.8/Modules/cpu_gcc.s
> index 5fc536e..5441691 100644
> --- 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_gcc.
> s
> +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_
> +++ gcc.s
> @@ -1,4 +1,19 @@
> -#  cpu_gcc.s: Assembly code for the x64 resources (GCC)
> +#
> +--
> +#
> +# Copyright (c) 2011 - 2023, Intel Corporation. All rights 
> +reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent # # 
> +Module Name:
> +#
> +#   cpu_gcc.s
> +#
> +# Abstract:
> +#
> +#   swsmi function
> +#
> +# Notes:
> +#
> +#
> +--
> 
>  .global _swsmi
> 
> diff --git 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32
> .nasm 
> b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32
> .nasm
> index 71e2e2c..790b923 100644
> --- 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32
> .nasm
> +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_
> +++ ia32.nasm
> @@ -1,4 +1,19 @@
> -;TITLE   cpu.asm: Assembly code for the i386 resources
> +;
> +--
> +;
> +; Copyright (c) 2011 - 2023, Intel Corporation. All rights 
> +reserved. ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; 
> +Module Name:
> +;
> +;   cpu_ia32.nasm
> +;
> +; Abstract:
> +;
> +;   swsmi function
> +;
> +; Notes:
> +;
> +;
> +--
> 
>  SECTION .text
> 
> diff --git 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32
> _gcc.s 
> b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32
> _gcc.s
> index 77e307d..35e883b 100644
> --- 
> a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_ia32
> _gcc.s
> +++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Modules/cpu_
> +++ ia32_gcc.s
> @@ -1,3 +1,19 @@
> +#
> +--
> +#
> +# Copyright (c) 2011 - 2023, Intel Corporation. All rights 
> +reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent # # 
> +Module Name:
> +#
> +#   cpu_ia32_gcc.s
> +#
> +# Abstract:
> +#
> +#   swsmi function
> +#
> +# Notes:
> +#
> +#
> +--
> 
>  .global _swsmi
> 
> --
> 2.39.1.windows.1



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




Re: [edk2-devel] [Patch 0/2] Add and use FirmwareVolumeShadowPpi

2023-03-26 Thread Wang, Jian J
For the patch series,

Reviewed-by: Jian J Wang 

Regards,
Jian



> -Original Message-
> From: Kinney, Michael D 
> Sent: Wednesday, March 22, 2023 10:06 AM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen ; Wang, Jian J ;
> Gao, Liming ; Patel, Umang
> 
> Subject: [Patch 0/2] Add and use FirmwareVolumeShadowPpi
> 
> Add FirmwareVolumeShadow PPI to shadow an FV to memory.
> and use it to shadow FVs to memory.
> 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Liming Gao 
> Signed-off-by: Patel Umang 
> 
> Umang Patel (2):
>   MdeModulePkg/Include/Ppi: Add FirmwareVolumeShadowPpi
>   SecurityPkg/FvReportPei: Use FirmwareVolumeShadowPpi
> 
>  .../Include/Ppi/FirmwareVolumeShadowPpi.h | 61 +++
>  MdeModulePkg/MdeModulePkg.dec |  3 +
>  SecurityPkg/FvReportPei/FvReportPei.c | 37 ---
>  SecurityPkg/FvReportPei/FvReportPei.h |  1 +
>  SecurityPkg/FvReportPei/FvReportPei.inf   |  1 +
>  5 files changed, 96 insertions(+), 7 deletions(-)
>  create mode 100644
> MdeModulePkg/Include/Ppi/FirmwareVolumeShadowPpi.h
> 
> --
> 2.39.1.windows.1



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




[edk2-devel] [PATCH 2/2] UefiCpuPkg: After reset, wake up APs by SIPI.

2023-03-26 Thread Yuanhao Xie
Following a power-up or RESET, since all APs are already in the
“wait-for-SIPI state,” the BSP can broadcast just a single SIPI IPI to
the APs to wake them up and initialize them.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index e5dc852ed9..a540b3fe3d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1233,7 +1233,14 @@ WakeUpAP (
   if (CpuMpData->SevSnpIsEnabled && (CpuMpData->InitFlag != ApInitConfig)) 
{
 SevSnpCreateAP (CpuMpData, -1);
   } else {
-SendInitSipiSipiAllExcludingSelf ((UINT32)ExchangeInfo->BufferStart);
+if (CpuMpData->InitFlag == ApInitConfig) {
+  //
+  // SIPI can be used for the first time wake up after reset to reduce 
boot time.
+  //
+  SendStartupIpiAllExcludingSelf ((UINT32)ExchangeInfo->BufferStart);
+} else {
+  SendInitSipiSipiAllExcludingSelf ((UINT32)ExchangeInfo->BufferStart);
+}
   }
 }
 
-- 
2.36.1.windows.1



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




[edk2-devel] [PATCH 1/2] UefiCpuPkg: Add SendStartupIpiAllExcludingSelf

2023-03-26 Thread Yuanhao Xie
Add new API SendStartupIpiAllExcludingSelf(), and modify
SendInitSipiSipiAllExcludingSelf() by let it call the new API.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Include/Library/LocalApicLib.h | 17 +++-
 .../Library/BaseXApicLib/BaseXApicLib.c   | 43 +--
 .../BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 43 +--
 3 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/UefiCpuPkg/Include/Library/LocalApicLib.h 
b/UefiCpuPkg/Include/Library/LocalApicLib.h
index b55d88b0f5..d7c2ad3f70 100644
--- a/UefiCpuPkg/Include/Library/LocalApicLib.h
+++ b/UefiCpuPkg/Include/Library/LocalApicLib.h
@@ -4,7 +4,7 @@
   Local APIC library assumes local APIC is enabled. It does not
   handles cases where local APIC is disabled.
 
-  Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -185,6 +185,21 @@ SendInitIpiAllExcludingSelf (
   VOID
   );
 
+/**
+  Send a Start-up IPI to all processors excluding self.
+  This function returns after the IPI has been accepted by the target 
processors.
+  if StartupRoutine >= 1M, then ASSERT.
+  if StartupRoutine is not multiple of 4K, then ASSERT.
+  @param  StartupRoutine  Points to a start-up routine which is below 1M 
physical
+  address and 4K aligned.
+**/
+
+VOID
+EFIAPI
+SendStartupIpiAllExcludingSelf (
+  IN UINT32  StartupRoutine
+  );
+
 /**
   Send an INIT-Start-up-Start-up IPI sequence to a specified target processor.
 
diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c 
b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
index 008b8a070b..d56c6275cc 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
@@ -3,7 +3,7 @@
 
   This local APIC library instance supports xAPIC mode only.
 
-  Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
   Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -497,6 +497,33 @@ SendInitIpiAllExcludingSelf (
   SendIpi (IcrLow.Uint32, 0);
 }
 
+/**
+  Send a Start-up IPI to all processors excluding self.
+  This function returns after the IPI has been accepted by the target 
processors.
+  if StartupRoutine >= 1M, then ASSERT.
+  if StartupRoutine is not multiple of 4K, then ASSERT.
+  @param  StartupRoutine  Points to a start-up routine which is below 1M 
physical
+  address and 4K aligned.
+**/
+VOID
+EFIAPI
+SendStartupIpiAllExcludingSelf (
+  IN UINT32  StartupRoutine
+  )
+{
+  LOCAL_APIC_ICR_LOW  IcrLow;
+
+  ASSERT (StartupRoutine < 0x10);
+  ASSERT ((StartupRoutine & 0xfff) == 0);
+
+  IcrLow.Uint32= 0;
+  IcrLow.Bits.Vector   = (StartupRoutine >> 12);
+  IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_STARTUP;
+  IcrLow.Bits.Level= 1;
+  IcrLow.Bits.DestinationShorthand = 
LOCAL_APIC_DESTINATION_SHORTHAND_ALL_EXCLUDING_SELF;
+  SendIpi (IcrLow.Uint32, 0);
+}
+
 /**
   Send an INIT-Start-up-Start-up IPI sequence to a specified target processor.
 
@@ -551,22 +578,12 @@ SendInitSipiSipiAllExcludingSelf (
   IN UINT32  StartupRoutine
   )
 {
-  LOCAL_APIC_ICR_LOW  IcrLow;
-
-  ASSERT (StartupRoutine < 0x10);
-  ASSERT ((StartupRoutine & 0xfff) == 0);
-
   SendInitIpiAllExcludingSelf ();
   MicroSecondDelay (PcdGet32 (PcdCpuInitIpiDelayInMicroSeconds));
-  IcrLow.Uint32= 0;
-  IcrLow.Bits.Vector   = (StartupRoutine >> 12);
-  IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_STARTUP;
-  IcrLow.Bits.Level= 1;
-  IcrLow.Bits.DestinationShorthand = 
LOCAL_APIC_DESTINATION_SHORTHAND_ALL_EXCLUDING_SELF;
-  SendIpi (IcrLow.Uint32, 0);
+  SendStartupIpiAllExcludingSelf (StartupRoutine);
   if (!StandardSignatureIsAuthenticAMD ()) {
 MicroSecondDelay (200);
-SendIpi (IcrLow.Uint32, 0);
+SendStartupIpiAllExcludingSelf (StartupRoutine);
   }
 }
 
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c 
b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
index 0ba0499631..aa4eb11181 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
@@ -4,7 +4,7 @@
   This local APIC library instance supports x2APIC capable processors
   which have xAPIC and x2APIC modes.
 
-  Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
   Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -736,6 +736,33 @@ SendInitIpiAllExcludingSelf (
   SendIpi (IcrLow.Uint32, 0);
 }
 
+/**
+  

[edk2-devel] [PATCH 0/2] Wake up APs by a single SIPI.

2023-03-26 Thread Yuanhao Xie
After a power-up or reset, all application processors (APs) are in a 
state where they are waiting for sipi. In this state, the bootstrap 
processor (BSP) send a single SIPI Inter-Processor Interrupt 
(IPI) to all the APs.

Yuanhao Xie (2):
  UefiCpuPkg: Add SendStartupIpiAllExcludingSelf
  UefiCpuPkg: After reset, wake up APs by SIPI.

 UefiCpuPkg/Include/Library/LocalApicLib.h | 17 +++-
 .../Library/BaseXApicLib/BaseXApicLib.c   | 43 +--
 .../BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 43 +--
 UefiCpuPkg/Library/MpInitLib/MpLib.c  |  9 +++-
 4 files changed, 84 insertions(+), 28 deletions(-)

-- 
2.36.1.windows.1



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




[edk2-devel] [Patch V7 21/22] UefiCpuPkg/CpuPageTableLib: Add RandomTest for PAE paging

2023-03-26 Thread duntan
Add RandomTest for PAE paging.

Signed-off-by: Dun Tan 
Cc: Eric Dong 
Reviewed-by: Ray Ni 
Cc: Rahul Kumar 
Tested-by: Gerd Hoffmann 
Acked-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c |  2 
++
 UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c  |  3 
+--
 UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c  | 12 

 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c 
b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c
index 4303095579..b0be2c5a73 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c
@@ -13,6 +13,7 @@ static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT  
mTestContextPaging4Level= { P
 static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT  mTestContextPaging4Level1GB = { 
Paging4Level1GB, 100, 20, USE_RANDOM_ARRAY };
 static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT  mTestContextPaging5Level= { 
Paging5Level, 100, 20, USE_RANDOM_ARRAY };
 static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT  mTestContextPaging5Level1GB = { 
Paging5Level1GB, 100, 20, USE_RANDOM_ARRAY };
+static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT  mTestContextPagingPae   = { 
PagingPae, 100, 20, USE_RANDOM_ARRAY };
 
 /**
   Check if the input parameters are not supported.
@@ -884,6 +885,7 @@ UefiTestMain (
   AddTestCase (RandomTestCase, "Random Test for Paging4Level1G", "Random Test 
Case2", TestCaseforRandomTest, NULL, NULL, );
   AddTestCase (RandomTestCase, "Random Test for Paging5Level", "Random Test 
Case3", TestCaseforRandomTest, NULL, NULL, );
   AddTestCase (RandomTestCase, "Random Test for Paging5Level1G", "Random Test 
Case4", TestCaseforRandomTest, NULL, NULL, );
+  AddTestCase (RandomTestCase, "Random Test for PagingPae", "Random Test 
Case5", TestCaseforRandomTest, NULL, NULL, );
 
   //
   // Execute the tests.
diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c 
b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
index 2db49f7de7..f7a77d00e7 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
@@ -258,10 +258,9 @@ ValidateAndRandomeModifyPageTable (
   UNIT_TEST_STATUS   Status;
   IA32_PAGING_ENTRY  *PagingEntry;
 
-  if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode 
>= PagingModeMax)) {
+  if ((PagingMode == Paging32bit) || (PagingMode >= PagingModeMax)) {
 //
 // 32bit paging is never supported.
-// PAE paging will be supported later.
 //
 return UNIT_TEST_ERROR_TEST_FAILED;
   }
diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c 
b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c
index 22f179c21f..67776255c2 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c
@@ -175,10 +175,9 @@ IsPageTableValid (
 return UNIT_TEST_PASSED;
   }
 
-  if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode 
>= PagingModeMax)) {
+  if ((PagingMode == Paging32bit) || (PagingMode >= PagingModeMax)) {
 //
 // 32bit paging is never supported.
-// PAE paging will be supported later.
 //
 return UNIT_TEST_ERROR_TEST_FAILED;
   }
@@ -187,7 +186,12 @@ IsPageTableValid (
   MaxLevel = (UINT8)(PagingMode >> 8);
 
   PagingEntry = (IA32_PAGING_ENTRY *)(UINTN)PageTable;
-  for (Index = 0; Index < 512; Index++) {
+  for (Index = 0; Index < ((PagingMode == PagingPae) ? 4 : 512); Index++) {
+if (PagingMode == PagingPae) {
+  UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero, 0);
+  UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero2, 0);
+}
+
 Status = IsPageTableEntryValid ([Index], MaxLevel, 
MaxLeafLevel, Index << (9 * MaxLevel + 3));
 if (Status != UNIT_TEST_PASSED) {
   return Status;
@@ -264,7 +268,7 @@ GetEntryFromPageTable (
   UINT64 Index;
   IA32_PAGING_ENTRY  *PagingEntry;
 
-  if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode 
>= PagingModeMax)) {
+  if ((PagingMode == Paging32bit) || (PagingMode >= PagingModeMax)) {
 //
 // 32bit paging is never supported.
 // PAE paging will be supported later.
-- 
2.31.1.windows.1



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




[edk2-devel] [Patch V7 20/22] UefiCpuPkg/CpuPageTableLib: Enable PAE paging

2023-03-26 Thread duntan
Modify CpuPageTableLib code to enable PAE paging.
In PageTableMap() API:
When creating new PAE page table, after creating page table,
set all MustBeZero fields of 4 PDPTE to 0. The MustBeZero
fields are treated as RW and other attributes by the common
map logic. So they might be set to 1.
When updating exsiting PAE page table, the special steps are:
1.Prepare 4K-aligned 32bytes memory in stack for 4 temp PDPTE.
2.Copy original 4 PDPTE to the 4 temp PDPTE and set the RW,
  UserSupervisor to 1 and set Nx of 4 temp PDPTE to 0.
4.After updating the page table, set the MustBeZero fields of
  4 temp PDPTE to 0.
5.Copy the temp PDPTE to original PDPTE.

In PageTableParse() API, also create 4 temp PDPTE in stack.
Copy original 4 PDPTE to the 4 temp PDPTE. Then set the RW,
UserSupervisor to 1 and set Nx of 4 temp PDPTE to 0. Finally
use the address of temp PDPTE as the page table address.

Signed-off-by: Dun Tan 
Cc: Eric Dong 
Reviewed-by: Ray Ni 
Cc: Rahul Kumar 
Tested-by: Gerd Hoffmann 
Acked-by: Gerd Hoffmann 
---
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h  |  4 +++-
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c   | 53 
-
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableParse.c | 27 
++-
 3 files changed, 73 insertions(+), 11 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h 
b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h
index 2c67ecb469..24da0ffb30 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h
+++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h
@@ -1,7 +1,7 @@
 /** @file
   Internal header for CpuPageTableLib.
 
-  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -20,6 +20,8 @@
 
 #define REGION_LENGTH(l)  LShiftU64 (1, (l) * 9 + 3)
 
+#define MAX_PAE_PDPTE_NUM  4
+
 typedef enum {
   Pte   = 1,
   Pde   = 2,
diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c 
b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
index 0d576ce39a..eff02619fa 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
@@ -671,15 +671,17 @@ PageTableMap (
   IA32_PAGE_LEVEL MaxLeafLevel;
   IA32_MAP_ATTRIBUTE  ParentAttribute;
   BOOLEAN LocalIsModified;
+  UINTN   Index;
+  IA32_PAGING_ENTRY   *PagingEntry;
+  UINT8   BufferInStack[SIZE_4KB - 1 + MAX_PAE_PDPTE_NUM * sizeof 
(IA32_PAGING_ENTRY)];
 
   if (Length == 0) {
 return RETURN_SUCCESS;
   }
 
-  if ((PagingMode == Paging32bit) || (PagingMode == PagingPae) || (PagingMode 
>= PagingModeMax)) {
+  if ((PagingMode == Paging32bit) || (PagingMode >= PagingModeMax)) {
 //
 // 32bit paging is never supported.
-// PAE paging will be supported later.
 //
 return RETURN_UNSUPPORTED;
   }
@@ -716,17 +718,32 @@ PageTableMap (
 
   MaxLeafLevel = (IA32_PAGE_LEVEL)(UINT8)PagingMode;
   MaxLevel = (IA32_PAGE_LEVEL)(UINT8)(PagingMode >> 8);
-  MaxLinearAddress = LShiftU64 (1, 12 + MaxLevel * 9);
+  MaxLinearAddress = (PagingMode == PagingPae) ? LShiftU64 (1, 32) : LShiftU64 
(1, 12 + MaxLevel * 9);
 
   if ((LinearAddress > MaxLinearAddress) || (Length > MaxLinearAddress - 
LinearAddress)) {
 //
-// Maximum linear address is (1 << 48) or (1 << 57)
+// Maximum linear address is (1 << 32), (1 << 48) or (1 << 57)
 //
 return RETURN_INVALID_PARAMETER;
   }
 
   TopPagingEntry.Uintn = *PageTable;
   if (TopPagingEntry.Uintn != 0) {
+if (PagingMode == PagingPae) {
+  //
+  // Create 4 temporary PDPTE at a 4k-aligned address.
+  // Copy the original PDPTE content and set ReadWrite, UserSupervisor to 
1, set Nx to 0.
+  //
+  TopPagingEntry.Uintn = ALIGN_VALUE ((UINTN)BufferInStack, BASE_4KB);
+  PagingEntry  = (IA32_PAGING_ENTRY *)(TopPagingEntry.Uintn);
+  CopyMem (PagingEntry, (VOID *)(*PageTable), MAX_PAE_PDPTE_NUM * sizeof 
(IA32_PAGING_ENTRY));
+  for (Index = 0; Index < MAX_PAE_PDPTE_NUM; Index++) {
+PagingEntry[Index].Pnle.Bits.ReadWrite  = 1;
+PagingEntry[Index].Pnle.Bits.UserSupervisor = 1;
+PagingEntry[Index].Pnle.Bits.Nx = 0;
+  }
+}
+
 TopPagingEntry.Pce.Present= 1;
 TopPagingEntry.Pce.ReadWrite  = 1;
 TopPagingEntry.Pce.UserSupervisor = 1;
@@ -801,7 +818,33 @@ PageTableMap (
  );
 
   if (!RETURN_ERROR (Status)) {
-*PageTable = (UINTN)(TopPagingEntry.Uintn & IA32_PE_BASE_ADDRESS_MASK_40);
+PagingEntry = (IA32_PAGING_ENTRY *)(UINTN)(TopPagingEntry.Uintn & 
IA32_PE_BASE_ADDRESS_MASK_40);
+
+if (PagingMode == PagingPae) {
+  //
+  // These MustBeZero fields are treated as RW and other attributes by the 
common map logic. So they might be set to 1.
+  //
+  for (Index = 0; 

[edk2-devel] [Patch V7 00/22] Fix issues in CpuPageTableLib

2023-03-26 Thread duntan
In the V7 atch set
In 'Add RandomTest for PAE paging', modify duplicated test case name from 
'Random Test Case1' to 'Random Test Case5'.
In 'Enable PAE paging', modify the copy-right year of 
UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h.

Other patches are Reviewed-by Ray.

Dun Tan (20):
  UefiCpuPkg/CpuPageTableLib: Remove unneeded 'if' condition
  UefiCpuPkg/CpuPageTableLib: Add check for input Length
  UefiCpuPkg/CpuPageTableLib:Initialize some LocalVariable at beginning
  UefiCpuPkg/CpuPageTableLib: Fix the non-1:1 mapping issue
  UefiCpuPkg/CpuPageTableLib:Clear PageSize bit(Bit7) for non-leaf
  UefiCpuPkg/CpuPageTableLib: Fix issue when splitting leaf entry
  UefiCpuPkg/MpInitLib: Add code to initialize MapMask
  UefiCpuPkg/CpuPageTableLib:Add check for Mask and Attr
  UefiCpuPkg/CpuPageTableLib: Add manual test to check Mask and Attr
  UefiCpuPkg/CpuPageTableLib:Modify RandomBoolean() in RandomTest
  UefiCpuPkg/CpuPageTableLib: Add LastMapEntry pointer
  UefiCpuPkg/CpuPageTableLib:Modify RandomTest to check Mask/Attr
  UefiCpuPkg/CpuPageTableLib: Enable non-1:1 mapping in random test
  UefiCpuPkg/CpuPageTableLib: Add OUTPUT IsModified parameter.
  UefiCpuPkg/CpuPageTableLib: Modify RandomTest to check IsModified
  UefiCpuPkg/CpuPageTableLib: Add check for page table creation
  UefiCpuPkg: Combine branch for non-present and leaf ParentEntry
  UefiCpuPkg/CpuPageTableLib: Enable PAE paging
  UefiCpuPkg/CpuPageTableLib: Add RandomTest for PAE paging
  UefiCpuPkg/CpuPageTableLib: Reduce the number of random tests

Zhiguang Liu (2):
  UefiCpuPkg: Fix IA32 build failure in CpuPageTableLib.inf
  UefiCpuPkg: Modify UnitTest code since tested API is changed

 UefiCpuPkg/Include/Library/CpuPageTableLib.h  |  
44 +---
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h | 
129 
++---
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c  | 
317 
+++--
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableParse.c|  
27 ++-
 UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c | 
225 
+++--
 UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c  | 
338 
+-
 UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c  |  
22 +++---
 UefiCpuPkg/Library/MpInitLib/X64/CreatePageTable.c|  
11 +--
 8 files changed, 784 insertions(+), 329 deletions(-)

-- 
2.31.1.windows.1



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




Re: [edk2-devel] [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year

2023-03-26 Thread Ni, Ray
I see. Thanks for explanation.

Reviewed-by: Ray Ni 

> -Original Message-
> From: Kinney, Michael D 
> Sent: Monday, March 27, 2023 1:06 AM
> To: Ni, Ray ; devel@edk2.groups.io
> Cc: Kinney, Michael D 
> Subject: RE: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> 
> Hi Ray,
> 
> A second example from the UEFI SCTs (https://github.com/tianocore/edk2-
> test)
> 
> Calls UEFI RT service SetTime() with year 2001.
> 
> https://github.com/tianocore/edk2-
> test/blob/39f27f233aeab16f71fc8f5ed6b287eb9f884ec6/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/
> TimeServicesBBTestConformance.c#L572
> 
> Mike
> 
> > -Original Message-
> > From: Kinney, Michael D 
> > Sent: Sunday, March 26, 2023 10:00 AM
> > To: Ni, Ray ; devel@edk2.groups.io
> > Cc: Kinney, Michael D 
> > Subject: RE: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> >
> > Hi Ray,
> >
> > Firmware tests such as FWTS (https://github.com/ColinIanKing/fwts) have
> test
> > Cases for the UEFI time services.  In this case, FWTS has test cases to set
> > the year to 2012 and 2016.  If the minimum year is set to 2023, these test
> > cases fail.
> >
> >
> https://github.com/ColinIanKing/fwts/blob/4e8be7ab0cee56a85845d21ef79
> 6aa618a6a83e3/src/uefi/uefirttime/uefirttime.c#L328
> >
> > I agree that a reasonable approach is to set the default year to the year
> that
> > a system is manufactured.  However, if this is done, the FWTS tests fail
> > because the current edk2 sources use the same setting for both the
> minimum
> > year and the default year.
> >
> > The min/max year should really be based on the hardware capabilities of
> the
> > device that provides time/date information.  The default year should be a
> > platform policy setting.
> >
> > Adding a new PCD for the default year provides a platform setting that that
> > can be set independent of the min/max year hardware capabilities.
> >
> > Mike
> >
> > > -Original Message-
> > > From: Ni, Ray 
> > > Sent: Sunday, March 26, 2023 2:30 AM
> > > To: Kinney, Michael D ;
> devel@edk2.groups.io
> > > Subject: RE: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> > >
> > > Mike,
> > > When adding the Min/Max year PCD, the idea was Min year is the default
> year value.
> > > The idea assumed that when a PC is shipped to customers the Min year is
> set to
> > > the current year.
> > >
> > > Can we explain why need the default year PCD?
> > >
> > > Thanks,
> > > Ray
> > >
> > > > -Original Message-
> > > > From: Kinney, Michael D 
> > > > Sent: Sunday, March 26, 2023 11:23 AM
> > > > To: devel@edk2.groups.io
> > > > Cc: Ni, Ray 
> > > > Subject: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> > > >
> > > > Add PcdRtcDefaultYear to specify the default year to use when
> > > > the RTC is in an invalid state. Make sure PcdRtcDefaultYear is
> > > > >= PcdMinimalValidYear and <= PcdMaximalValidYear.  Set the
> > > > default value for this PCD to PcdMinimalValidYear to preserve
> > > > the existing behavior. A platform DSC file can override this
> > > > default value setting.
> > > >
> > > > Cc: Ray Ni 
> > > > Signed-off-by: Michael D Kinney 
> > > > ---
> > > >  PcAtChipsetPkg/PcAtChipsetPkg.dec   | 6 ++
> > > >  PcAtChipsetPkg/PcAtChipsetPkg.uni   | 4 
> > > >  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c  | 4 ++--
> > > >  .../PcatRealTimeClockRuntimeDxe.inf | 1 +
> > > >  4 files changed, 13 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > > b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > > index a53ca777e85a..0db385fb901f 100644
> > > > --- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > > +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > > @@ -76,6 +76,12 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx,
> > > > PcdsPatchableInModule]
> > > ># @Expression 0x8001 |
> > > > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear <
> > > > gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear + 100
> > > >
> > > >
> gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear|2097|UINT16|0x000
> > > > E
> > > >
> > > > +  ## This PCD specifies the RTC default year when the RTC is in an
> invalid
> > > > state.
> > > > +  # @Prompt Default year in RTC.
> > > > +  # @Expression 0x8001 |
> > > > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear >=
> > > > gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear
> > > > +  # @Expression 0x8001 |
> > > > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear <=
> > > > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear
> > > > +
> > > >
> gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear|gPcAtChipsetPkgToke
> > > > nSpaceGuid.PcdMinimalValidYear|UINT16|0x000F
> > > > +
> > > >## Specifies RTC Index Register address in MMIO space.
> > > ># @Prompt RTC Index Register address
> > > >
> > > >
> 

[edk2-devel] Event: Tools, CI, Code base construction meeting series - Monday, March 27, 2023 #cal-reminder

2023-03-26 Thread Group Notification
*Reminder: Tools, CI, Code base construction meeting series*

*When:*
Monday, March 27, 2023
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://github.com/tianocore/edk2/discussions/2614

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1753771 )

*Description:*

TianoCore community,

Microsoft and Intel will be hosting a series of open meetings to discuss build, 
CI, tools, and other related topics. If you are interested, have ideas/opinions 
please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft 
Teams.

MS Teams Link in following discussion: * 
https://github.com/tianocore/edk2/discussions/2614

Anyone is welcome to join.

* tianocore/edk2: EDK II (github.com)
* tianocore/edk2-basetools: EDK II BaseTools Python tools as a PIP module 
(github.com) https://github.com/tianocore/edk2-basetools
* tianocore/edk2-pytool-extensions: Extensions to the edk2 build system 
allowing for a more robust and plugin based build system and tool execution 
environment (github.com) https://github.com/tianocore/edk2-pytool-extensions
* tianocore/edk2-pytool-library: Python library package that supports UEFI 
development (github.com) https://github.com/tianocore/edk2-pytool-library

MS Teams Browser Clients * 
https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client


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




Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64

2023-03-26 Thread Sheng Lean Tan
Added @rebe...@bsdio.com  as well.


On Sun, 26 Mar 2023 at 21:39, Sheng Lean Tan via groups.io  wrote:

> Can someone also help to review this please?
> Thanks.
>
>
> On Fri, 17 Mar 2023 at 15:06, Patrick Rudolph <
> patrick.rudo...@9elements.com> wrote:
>
>> Drop the "-z max-page-size=0x40" option as it causes the ELF
>> header to overflow into the .text section, causing undefined
>> behaviour.
>>
>> With high optimization level it corrupts essential code and
>> the binary would crash. It might work with low optimization
>> level though. As the default is to use Oz and LTO, it always
>> crashes.
>>
>> Test:
>> The ELF generated by
>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>>
>> Signed-off-by: Patrick Rudolph 
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
>> ---
>>  BaseTools/Conf/tools_def.template | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/BaseTools/Conf/tools_def.template
>> b/BaseTools/Conf/tools_def.template
>> index 9b59bd75c3..0c584ab390 100755
>> --- a/BaseTools/Conf/tools_def.template
>> +++ b/BaseTools/Conf/tools_def.template
>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX= ENV(CLANG_BIN)
>>
>>  # LLVM/CLANG doesn't support -n link option. So, it can't share the same
>> IA32_X64_DLINK_COMMON flag.
>>  # LLVM/CLANG doesn't support common page size. So, it can't share the
>> same GccBase.lds script.
>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON   = -nostdlib
>> -Wl,-q,--gc-sections -z max-page-size=0x40
>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON   = -nostdlib
>> -Wl,-q,--gc-sections
>>  DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
>> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>>  DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0
>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u
>> ReferenceAcpiTable
>>  DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS=
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u
>> $(IMAGE_ENTRY_POINT)
>> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
>> --
>> 2.39.1
>>
>>
>>
>> 
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#101341):
>> https://edk2.groups.io/g/devel/message/101341
>> Mute This Topic: https://groups.io/mt/97673649/6757431
>> Group Owner: devel+ow...@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub [
>> sheng@9elements.com]
>> 
>>
>>
>> 
>
>


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




Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64

2023-03-26 Thread Sheng Lean Tan
Can someone also help to review this please?
Thanks.


On Fri, 17 Mar 2023 at 15:06, Patrick Rudolph 
wrote:

> Drop the "-z max-page-size=0x40" option as it causes the ELF
> header to overflow into the .text section, causing undefined
> behaviour.
>
> With high optimization level it corrupts essential code and
> the binary would crash. It might work with low optimization
> level though. As the default is to use Oz and LTO, it always
> crashes.
>
> Test:
> The ELF generated by
> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>
> Signed-off-by: Patrick Rudolph 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> ---
>  BaseTools/Conf/tools_def.template | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 9b59bd75c3..0c584ab390 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX= ENV(CLANG_BIN)
>
>  # LLVM/CLANG doesn't support -n link option. So, it can't share the same
> IA32_X64_DLINK_COMMON flag.
>  # LLVM/CLANG doesn't support common page size. So, it can't share the
> same GccBase.lds script.
> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON   = -nostdlib
> -Wl,-q,--gc-sections -z max-page-size=0x40
> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-q,--gc-sections
>  DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>  DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0
> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u
> ReferenceAcpiTable
>  DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS=
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u
> $(IMAGE_ENTRY_POINT)
> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
> --
> 2.39.1
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#101341): https://edk2.groups.io/g/devel/message/101341
> Mute This Topic: https://groups.io/mt/97673649/6757431
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [sheng@9elements.com
> ]
> 
>
>
>


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




Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32

2023-03-26 Thread Sheng Lean Tan
Would anyone mind to spare some time to review this patch?
Thanks.


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




Re: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS definitions

2023-03-26 Thread Michael D Kinney
Both PRs have been merged.

Commit: 
https://github.com/tianocore/edk2/commit/2c93253c95dbbc161650dfaeccaa3d866a2e29f2
Commit: 
https://github.com/tianocore/edk2/commit/69e59545b14739e004d3f0452411e195d2a3c197

Mike

From: Chang, Abner 
Sent: Sunday, March 26, 2023 6:56 AM
To: Kinney, Michael D ; devel@edk2.groups.io; 
Nickle Wang ; Oram, Isaac W ; Leif 
Lindholm ; Andrew Fish 
Cc: Gao, Liming ; Liu, Zhiguang 
; Igor Kulchytskyy ; Attar, AbdulLateef 
(Abdul Lateef) 
Subject: RE: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS definitions


[AMD Official Use Only - General]


Thanks Mike,



IPMI KCS: https://github.com/tianocore/edk2/pull/4184

MCTP: https://github.com/tianocore/edk2/pull/4183

We also fixed the ECC error in these two PRs, please also help to push it.



@Kinney, Michael D, @Leif 
Lindholm, @Andrew Fish

Hi stewards,

I would like to be the maintainer for *IPMI* and *MCTP* files under both MdePkg 
and MdeModulePkg. I will send the Maintainers.txt update for that if you have 
no concerns.

Will also invite Isaac @Oram, Isaac W from Intel 
and Nickle @Nickle Wang from Nvidia as reviewers.

Thanks

Abner



> -Original Message-

> From: Kinney, Michael D 
> mailto:michael.d.kin...@intel.com>>

> Sent: Saturday, March 25, 2023 11:33 PM

> To: devel@edk2.groups.io; Chang, Abner 
> mailto:abner.ch...@amd.com>>

> Cc: Gao, Liming mailto:gaolim...@byosoft.com.cn>>; 
> Liu, Zhiguang

> mailto:zhiguang@intel.com>>; Nickle Wang 
> mailto:nick...@nvidia.com>>; Igor

> Kulchytskyy mailto:ig...@ami.com>>; Oram, Isaac W 
> mailto:isaac.w.o...@intel.com>>;

> Attar, AbdulLateef (Abdul Lateef) 
> mailto:abdullateef.at...@amd.com>>; Kinney,

> Michael D mailto:michael.d.kin...@intel.com>>

> Subject: RE: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS

> definitions

>

> Caution: This message originated from an External Source. Use proper

> caution when opening attachments, clicking links, or responding.

>

>

> Reviewed-by: Michael D Kinney 
> mailto:michael.d.kin...@intel.com>>

>

> > -Original Message-

> > From: devel@edk2.groups.io 
> > mailto:devel@edk2.groups.io>> On Behalf Of Chang,

> > Abner via groups.io

> > Sent: Friday, March 24, 2023 2:14 AM

> > To: devel@edk2.groups.io

> > Cc: Kinney, Michael D 
> > mailto:michael.d.kin...@intel.com>>; Gao, Liming

> > mailto:gaolim...@byosoft.com.cn>>; Liu, Zhiguang 
> > mailto:zhiguang@intel.com>>;

> > Nickle Wang mailto:nick...@nvidia.com>>; Igor 
> > Kulchytskyy mailto:ig...@ami.com>>;

> > Oram, Isaac W mailto:isaac.w.o...@intel.com>>; 
> > Abdul Lateef Attar

> > mailto:abdullateef.at...@amd.com>>

> > Subject: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS

> > definitions

> >

> > From: Abner Chang mailto:abner.ch...@amd.com>>

> >

> > BZ #4354

> > This change adds definitions for IPMI KCS.

> >

> > Spec ref:

> >

> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/i

> pm

> > i-second-gen-interface-spec-v2-rev1-1.html

> >

> > Signed-off-by: Abner Chang mailto:abner.ch...@amd.com>>

> > Cc: Michael D Kinney 
> > mailto:michael.d.kin...@intel.com>>

> > Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>

> > Cc: Zhiguang Liu mailto:zhiguang@intel.com>>

> > Cc: Nickle Wang mailto:nick...@nvidia.com>>

> > Cc: Igor Kulchytskyy mailto:ig...@ami.com>>

> > Cc: Isaac Oram mailto:isaac.w.o...@intel.com>>

> > Cc: Abdul Lateef Attar 
> > mailto:abdullateef.at...@amd.com>>

> > Acked-by: Isaac Oram mailto:isaac.w.o...@intel.com>>

> > ---

> >  MdePkg/MdePkg.dec |  6 ++

> >  MdePkg/Include/IndustryStandard/IpmiKcs.h | 76

> > +++

> >  2 files changed, 82 insertions(+)

> >  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h

> >

> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index

> > 2d643bede1d..5cf04bc0cb6 100644

> > --- a/MdePkg/MdePkg.dec

> > +++ b/MdePkg/MdePkg.dec

> > @@ -9,6 +9,7 @@

> >  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development

> > LP  # Copyright (c) 2022, Loongson Technology Corporation Limited.

> > All rights reserved.  # Copyright (c) 2021 - 2022, Arm Limited.

> > All rights reserved.

> > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights

> > +reserved.

> >  #

> >  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -2342,6 +2343,11

> > @@

> ># @Prompt Memory Address of GuidedExtractHandler Table.

> >

> >

> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000

> 000

> > |UINT64|0x30001015

> >

> > +  ## This value is the IPMI KCS Interface I/O base address 

[edk2-devel] [PATCH v4 1/1] ArmPkg/SmbiosMiscDxe: Adjust the priority of getting firmware version

2023-03-26 Thread Tinh Nguyen via groups.io
The BIOS Firmware Version in the SMBIOS Type 0 can be fetched from
the fixed PcdFirmwareVersionString or platform specific OemMiscLib.
In fact, the support from OemMiscLib comes into play when the firmware
version may be modified at boot time for extended information.
Therefore, the priority of getting the version from OemMiscLib should
be higher.

In case there is no modification in the OemMiscLib, we have to keep
HII string STR_MISC_BIOS_VERSION empty or 'Not Specified'
to indicate that the firmware version should be fetched from
the PcdFirmwareVersionString.

Signed-off-by: Tinh Nguyen 
Reviewed-by: Rebecca Cran 
Reviewed-by: Oliver Smith-Denny 
Reviewed-by: Leif Lindholm 
---

Changes since v1:
   + Change GetBiosVersion () to SetBiosVersion () and move the selection logic
   fully into SetBiosVersion ().
Changes since v2:
   + Add R-B by Rebecca and remove @retval
   VOID
Changes since v3:
   + Change the function's comment. Add R-B by Leif and Oliver.

 ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 58 

 1 file changed, 36 insertions(+), 22 deletions(-)

diff --git 
a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c 
b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
index 66ead22a6e2c..c9f25b750254 100644
--- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
+++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
@@ -1,6 +1,6 @@
 /** @file

 

-  Copyright (c) 2022, Ampere Computing LLC. All rights reserved.

+  Copyright (c) 2022 - 2023, Ampere Computing LLC. All rights reserved.

   Copyright (c) 2021, NUVIA Inc. All rights reserved.

   Copyright (c) 2009, Intel Corporation. All rights reserved.

   Copyright (c) 2015, Hisilicon Limited. All rights reserved.

@@ -124,22 +124,47 @@ GetBiosReleaseDate (
   return ReleaseDate;

 }

 

-/**

-  Fetches the firmware ('BIOS') version from the

-  FirmwareVersionInfo HOB.

+/**  Fetches the Firmware version string for SMBIOS type 0

+

+  This function first acquires the firmware version string from OemMiscLib;

+  if it is invalid, PcdFirmwareVersionString is used as a fallback,

+  and then sets it in SMBIOS type 0.

 

-  @return The version as a UTF-16 string

 **/

-CHAR16 *

-GetBiosVersion (

+VOID

+SetBiosVersion (

   VOID

   )

 {

-  CHAR16  *ReleaseString;

+  CHAR16 *DefaultVersionString;

+  CHAR16 *Version;

+  EFI_STRING_ID  TokenToUpdate;

 

-  ReleaseString = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);

+  DefaultVersionString = HiiGetString (

+   mSmbiosMiscHiiHandle,

+   STRING_TOKEN (STR_MISC_BIOS_VERSION),

+   NULL

+   );

 

-  return ReleaseString;

+  OemUpdateSmbiosInfo (

+mSmbiosMiscHiiHandle,

+STRING_TOKEN (STR_MISC_BIOS_VERSION),

+BiosVersionType00

+);

+

+  Version = HiiGetString (

+  mSmbiosMiscHiiHandle,

+  STRING_TOKEN (STR_MISC_BIOS_VERSION),

+  NULL

+  );

+

+  if (((StrCmp (Version, DefaultVersionString) == 0) || (StrLen (Version) == 
0))) {

+Version = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);

+if (StrLen (Version) > 0) {

+  TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION);

+  HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);

+}

+  }

 }

 

 /**

@@ -187,18 +212,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) {
 HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Vendor, NULL);

   }

 

-  Version = GetBiosVersion ();

-

-  if (StrLen (Version) > 0) {

-TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION);

-HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);

-  } else {

-OemUpdateSmbiosInfo (

-  mSmbiosMiscHiiHandle,

-  STRING_TOKEN (STR_MISC_BIOS_VERSION),

-  BiosVersionType00

-  );

-  }

+  SetBiosVersion ();

 

   Char16String = GetBiosReleaseDate ();

   if (StrLen (Char16String) > 0) {

--
2.39.2


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




Re: [edk2-devel] [PATCH v4 0/2] Upl remove arch spec initialization

2023-03-26 Thread Dhaval Sharma
Can I please get review comments on this patchset? If all well, I hope to get 
it merged based on feedback.
Thanks!
=D


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




Re: [edk2-devel] [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year

2023-03-26 Thread Michael D Kinney
Hi Ray,

A second example from the UEFI SCTs (https://github.com/tianocore/edk2-test)

Calls UEFI RT service SetTime() with year 2001.

https://github.com/tianocore/edk2-test/blob/39f27f233aeab16f71fc8f5ed6b287eb9f884ec6/uefi-sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/TimeServices/BlackBoxTest/TimeServicesBBTestConformance.c#L572

Mike

> -Original Message-
> From: Kinney, Michael D 
> Sent: Sunday, March 26, 2023 10:00 AM
> To: Ni, Ray ; devel@edk2.groups.io
> Cc: Kinney, Michael D 
> Subject: RE: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> 
> Hi Ray,
> 
> Firmware tests such as FWTS (https://github.com/ColinIanKing/fwts) have test
> Cases for the UEFI time services.  In this case, FWTS has test cases to set
> the year to 2012 and 2016.  If the minimum year is set to 2023, these test
> cases fail.
> 
> https://github.com/ColinIanKing/fwts/blob/4e8be7ab0cee56a85845d21ef796aa618a6a83e3/src/uefi/uefirttime/uefirttime.c#L328
> 
> I agree that a reasonable approach is to set the default year to the year that
> a system is manufactured.  However, if this is done, the FWTS tests fail
> because the current edk2 sources use the same setting for both the minimum
> year and the default year.
> 
> The min/max year should really be based on the hardware capabilities of the
> device that provides time/date information.  The default year should be a
> platform policy setting.
> 
> Adding a new PCD for the default year provides a platform setting that that
> can be set independent of the min/max year hardware capabilities.
> 
> Mike
> 
> > -Original Message-
> > From: Ni, Ray 
> > Sent: Sunday, March 26, 2023 2:30 AM
> > To: Kinney, Michael D ; devel@edk2.groups.io
> > Subject: RE: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> >
> > Mike,
> > When adding the Min/Max year PCD, the idea was Min year is the default year 
> > value.
> > The idea assumed that when a PC is shipped to customers the Min year is set 
> > to
> > the current year.
> >
> > Can we explain why need the default year PCD?
> >
> > Thanks,
> > Ray
> >
> > > -Original Message-
> > > From: Kinney, Michael D 
> > > Sent: Sunday, March 26, 2023 11:23 AM
> > > To: devel@edk2.groups.io
> > > Cc: Ni, Ray 
> > > Subject: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> > >
> > > Add PcdRtcDefaultYear to specify the default year to use when
> > > the RTC is in an invalid state. Make sure PcdRtcDefaultYear is
> > > >= PcdMinimalValidYear and <= PcdMaximalValidYear.  Set the
> > > default value for this PCD to PcdMinimalValidYear to preserve
> > > the existing behavior. A platform DSC file can override this
> > > default value setting.
> > >
> > > Cc: Ray Ni 
> > > Signed-off-by: Michael D Kinney 
> > > ---
> > >  PcAtChipsetPkg/PcAtChipsetPkg.dec   | 6 ++
> > >  PcAtChipsetPkg/PcAtChipsetPkg.uni   | 4 
> > >  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c  | 4 ++--
> > >  .../PcatRealTimeClockRuntimeDxe.inf | 1 +
> > >  4 files changed, 13 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > index a53ca777e85a..0db385fb901f 100644
> > > --- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > > @@ -76,6 +76,12 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx,
> > > PcdsPatchableInModule]
> > ># @Expression 0x8001 |
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear <
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear + 100
> > >
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear|2097|UINT16|0x000
> > > E
> > >
> > > +  ## This PCD specifies the RTC default year when the RTC is in an 
> > > invalid
> > > state.
> > > +  # @Prompt Default year in RTC.
> > > +  # @Expression 0x8001 |
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear >=
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear
> > > +  # @Expression 0x8001 |
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear <=
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear
> > > +
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear|gPcAtChipsetPkgToke
> > > nSpaceGuid.PcdMinimalValidYear|UINT16|0x000F
> > > +
> > >## Specifies RTC Index Register address in MMIO space.
> > ># @Prompt RTC Index Register address
> > >
> > > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64|0x0|UINT64|0x00
> > > 22
> > > diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > > b/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > > index d290dcf1650f..8eb7970c58aa 100644
> > > --- a/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > > +++ b/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > > @@ -79,6 +79,10 @@
> > >
> > >  #string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdMaximalValidYear_HELP
> > > #language en-US "This PCD specifies the maximal valid year in RTC."
> > >
> > > +#string
> > > 

Re: [edk2-devel] [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year

2023-03-26 Thread Michael D Kinney
Hi Ray,

Firmware tests such as FWTS (https://github.com/ColinIanKing/fwts) have test
Cases for the UEFI time services.  In this case, FWTS has test cases to set
the year to 2012 and 2016.  If the minimum year is set to 2023, these test
cases fail.

https://github.com/ColinIanKing/fwts/blob/4e8be7ab0cee56a85845d21ef796aa618a6a83e3/src/uefi/uefirttime/uefirttime.c#L328

I agree that a reasonable approach is to set the default year to the year that
a system is manufactured.  However, if this is done, the FWTS tests fail
because the current edk2 sources use the same setting for both the minimum
year and the default year.

The min/max year should really be based on the hardware capabilities of the
device that provides time/date information.  The default year should be a
platform policy setting.

Adding a new PCD for the default year provides a platform setting that that
can be set independent of the min/max year hardware capabilities.

Mike

> -Original Message-
> From: Ni, Ray 
> Sent: Sunday, March 26, 2023 2:30 AM
> To: Kinney, Michael D ; devel@edk2.groups.io
> Subject: RE: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> 
> Mike,
> When adding the Min/Max year PCD, the idea was Min year is the default year 
> value.
> The idea assumed that when a PC is shipped to customers the Min year is set to
> the current year.
> 
> Can we explain why need the default year PCD?
> 
> Thanks,
> Ray
> 
> > -Original Message-
> > From: Kinney, Michael D 
> > Sent: Sunday, March 26, 2023 11:23 AM
> > To: devel@edk2.groups.io
> > Cc: Ni, Ray 
> > Subject: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> >
> > Add PcdRtcDefaultYear to specify the default year to use when
> > the RTC is in an invalid state. Make sure PcdRtcDefaultYear is
> > >= PcdMinimalValidYear and <= PcdMaximalValidYear.  Set the
> > default value for this PCD to PcdMinimalValidYear to preserve
> > the existing behavior. A platform DSC file can override this
> > default value setting.
> >
> > Cc: Ray Ni 
> > Signed-off-by: Michael D Kinney 
> > ---
> >  PcAtChipsetPkg/PcAtChipsetPkg.dec   | 6 ++
> >  PcAtChipsetPkg/PcAtChipsetPkg.uni   | 4 
> >  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c  | 4 ++--
> >  .../PcatRealTimeClockRuntimeDxe.inf | 1 +
> >  4 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > index a53ca777e85a..0db385fb901f 100644
> > --- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> > @@ -76,6 +76,12 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx,
> > PcdsPatchableInModule]
> ># @Expression 0x8001 |
> > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear <
> > gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear + 100
> >
> > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear|2097|UINT16|0x000
> > E
> >
> > +  ## This PCD specifies the RTC default year when the RTC is in an invalid
> > state.
> > +  # @Prompt Default year in RTC.
> > +  # @Expression 0x8001 |
> > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear >=
> > gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear
> > +  # @Expression 0x8001 |
> > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear <=
> > gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear
> > +
> > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear|gPcAtChipsetPkgToke
> > nSpaceGuid.PcdMinimalValidYear|UINT16|0x000F
> > +
> >## Specifies RTC Index Register address in MMIO space.
> ># @Prompt RTC Index Register address
> >
> > gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64|0x0|UINT64|0x00
> > 22
> > diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > b/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > index d290dcf1650f..8eb7970c58aa 100644
> > --- a/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > +++ b/PcAtChipsetPkg/PcAtChipsetPkg.uni
> > @@ -79,6 +79,10 @@
> >
> >  #string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdMaximalValidYear_HELP
> > #language en-US "This PCD specifies the maximal valid year in RTC."
> >
> > +#string
> > STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcDefaultYear_PROMPT
> > #language en-US "Default year in RTC"
> > +
> > +#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcDefaultYear_HELP
> > #language en-US "This PCD specifies the RTC default year when the RTC is in
> > an invalid state."
> > +
> >  #string
> > STR_gPcAtChipsetPkgTokenSpaceGuid_PcdAcpiIoPortBaseAddressMask_PR
> > OMPT   #language en-US  "ACPI IO Port Base Address Mask"
> >
> >  #string
> > STR_gPcAtChipsetPkgTokenSpaceGuid_PcdAcpiIoPortBaseAddressMask_HE
> > LP #language en-US  "Defines the bit mask to retrieve ACPI IO Port Base
> > Address."
> > diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> > b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> > index 9242a2e82600..b059e92f02dc 100644
> > --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> > +++ 

[edk2-devel] Introduce a new repo "edk2-redfish-client" under Tianocore Github

2023-03-26 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Hi edk2 community,
We are proposing to introduce a new repository under Tianocore Github which is 
edk2-redfish-client. The plan is to have RedfishClientPkg, Redfish simulator 
and python script that generates edk2 Redfish client drivers under 
edk2-redfish-client repo.
edk2-redfish-client, refer to 
https://github.com/tianocore/edk2-staging/tree/edk2-redfish-client/RedfishClientPkg,
 which is a PoC project (already proved) that provides the mechanism to map HII 
options (which has the corresponding "x-uefi-redfish-$NAMESPACE" language in 
UNI file) to Redfish properties defined in Redfish schema data model.
Here is the readme for edk2-redfish-client 
https://github.com/tianocore/edk2-staging/blob/edk2-redfish-client/RedfishClientPkg/Readme.md
 that delineates the mechanism of RedfishClientPkg. In order to provide a 
simple solution for edk2 developers, auto-generated source files those are 
produced by python script is required to be built with edk2 firmware to connect 
HII options with Redfish properties. There are two python scripts that generate 
the necessary edk2 drivers and libraries.

  *   Redfish C to JSON convertor 
(https://github.com/DMTF/Redfish-Schema-C-Struct-Generator)

This generates edk2 driver modules that compliant with UEFI spec 31.2 EFI 
Redfish JSON Structure Converter

Auto-generated Source files: 
https://github.com/tianocore/edk2-staging/tree/edk2-redfish-client/RedfishClientPkg/ConverterLib
 and 
https://github.com/tianocore/edk2-staging/tree/edk2-redfish-client/RedfishClientPkg/Converter



  *   Redfish Feature drivers generator (not upstream yet, plan to upstream 
that script under edk2-redfish-client.
This generates edk2 drivers that act as intermediary layer between HII and 
Redfish property and delivers Redfish payload through driver stack provided by 
RedfishPkg under edk2 repo.
Files: 
https://github.com/tianocore/edk2-staging/tree/edk2-redfish-client/RedfishClientPkg/Features

You can see that from Redfish schemas 
(https://www.dmtf.org/sites/default/files/standards/documents/DSP8010_2022.3_0.zip),
 each Redfish schema introduces more than one version as time goes on. How many 
Redfish schemas and which version of Redfish schema are used on system is at 
discretion of OEM. Currently there are 3,767 schema files, those schemas 
propagate ten times of schema files for above auto-generated files. Of course, 
platform firmware is not able to pull in all of those files. Platform firmware 
only picks up the corresponding auto-generated files for the Redfish schemas 
and particular version those are supported on their system. There is an ongoing 
edk2 build tool task that supports to automatically pick up the auto-generated 
files according to "x-uefi-Redfish-" language used in HII form set. We 
currently had implementation in 
https://github.com/tianocore/edk2-staging/blob/edk2-redfish-client/RedfishClientPkg/RedfishJsonStructureDxe.dsc.inc,
 but edk2 build tool work is not ready yet. However, edk2 platform developer 
can still pull in the necessary edk2 Redfish client modules to platform 
metafiles manually.

According to above scenario, we are not going to accommodate those files under 
edk2 or edk2-platform repos. Having a separate repo under Tianocore is a way 
for edk2 developer to clone the repo when their project requires Redfish edk2 
firmware support. Maintainers of this repo is also responsible to update the 
files when every time Redfish WG releases the new version of Redfish schema.
Your input is welcome.
Thanks
Abner





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




Re: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS definitions

2023-03-26 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]


Thanks Mike,



IPMI KCS: https://github.com/tianocore/edk2/pull/4184

MCTP: https://github.com/tianocore/edk2/pull/4183

We also fixed the ECC error in these two PRs, please also help to push it.



@Kinney, Michael D, @Leif 
Lindholm, @Andrew Fish

Hi stewards,

I would like to be the maintainer for *IPMI* and *MCTP* files under both MdePkg 
and MdeModulePkg. I will send the Maintainers.txt update for that if you have 
no concerns.

Will also invite Isaac @Oram, Isaac W from Intel 
and Nickle @Nickle Wang from Nvidia as reviewers.

Thanks

Abner



> -Original Message-

> From: Kinney, Michael D 

> Sent: Saturday, March 25, 2023 11:33 PM

> To: devel@edk2.groups.io; Chang, Abner 

> Cc: Gao, Liming ; Liu, Zhiguang

> ; Nickle Wang ; Igor

> Kulchytskyy ; Oram, Isaac W ;

> Attar, AbdulLateef (Abdul Lateef) ; Kinney,

> Michael D 

> Subject: RE: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS

> definitions

>

> Caution: This message originated from an External Source. Use proper

> caution when opening attachments, clicking links, or responding.

>

>

> Reviewed-by: Michael D Kinney 
> mailto:michael.d.kin...@intel.com>>

>

> > -Original Message-

> > From: devel@edk2.groups.io 
> > mailto:devel@edk2.groups.io>> On Behalf Of Chang,

> > Abner via groups.io

> > Sent: Friday, March 24, 2023 2:14 AM

> > To: devel@edk2.groups.io

> > Cc: Kinney, Michael D 
> > mailto:michael.d.kin...@intel.com>>; Gao, Liming

> > mailto:gaolim...@byosoft.com.cn>>; Liu, Zhiguang 
> > mailto:zhiguang@intel.com>>;

> > Nickle Wang mailto:nick...@nvidia.com>>; Igor 
> > Kulchytskyy mailto:ig...@ami.com>>;

> > Oram, Isaac W mailto:isaac.w.o...@intel.com>>; 
> > Abdul Lateef Attar

> > mailto:abdullateef.at...@amd.com>>

> > Subject: [edk2-devel] [PATCH v5] MdePkg/Include: Add IPMI KCS

> > definitions

> >

> > From: Abner Chang mailto:abner.ch...@amd.com>>

> >

> > BZ #4354

> > This change adds definitions for IPMI KCS.

> >

> > Spec ref:

> >

> https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/i

> pm

> > i-second-gen-interface-spec-v2-rev1-1.html

> >

> > Signed-off-by: Abner Chang mailto:abner.ch...@amd.com>>

> > Cc: Michael D Kinney 
> > mailto:michael.d.kin...@intel.com>>

> > Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>

> > Cc: Zhiguang Liu mailto:zhiguang@intel.com>>

> > Cc: Nickle Wang mailto:nick...@nvidia.com>>

> > Cc: Igor Kulchytskyy mailto:ig...@ami.com>>

> > Cc: Isaac Oram mailto:isaac.w.o...@intel.com>>

> > Cc: Abdul Lateef Attar 
> > mailto:abdullateef.at...@amd.com>>

> > Acked-by: Isaac Oram mailto:isaac.w.o...@intel.com>>

> > ---

> >  MdePkg/MdePkg.dec |  6 ++

> >  MdePkg/Include/IndustryStandard/IpmiKcs.h | 76

> > +++

> >  2 files changed, 82 insertions(+)

> >  create mode 100644 MdePkg/Include/IndustryStandard/IpmiKcs.h

> >

> > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index

> > 2d643bede1d..5cf04bc0cb6 100644

> > --- a/MdePkg/MdePkg.dec

> > +++ b/MdePkg/MdePkg.dec

> > @@ -9,6 +9,7 @@

> >  # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development

> > LP  # Copyright (c) 2022, Loongson Technology Corporation Limited.

> > All rights reserved.  # Copyright (c) 2021 - 2022, Arm Limited.

> > All rights reserved.

> > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights

> > +reserved.

> >  #

> >  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -2342,6 +2343,11

> > @@

> ># @Prompt Memory Address of GuidedExtractHandler Table.

> >

> >

> gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1000

> 000

> > |UINT64|0x30001015

> >

> > +  ## This value is the IPMI KCS Interface I/O base address used to transmit

> IPMI commands.

> > +  #  The value of 0xca2 is the default I/O base address defined in IPMI

> specification.

> > +  # @Prompt IPMI KCS Interface I/O Base Address

> > +

> > +

> gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|0xca2|UINT16|0x00

> 00

> > + 0031

> > +

> >  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]

> >## This value is used to set the base address of PCI express hierarchy.

> ># @Prompt PCI Express Base Address.

> > diff --git a/MdePkg/Include/IndustryStandard/IpmiKcs.h

> > b/MdePkg/Include/IndustryStandard/IpmiKcs.h

> > new file mode 100644

> > index 000..7b3ba45bf9d

> > --- /dev/null

> > +++ b/MdePkg/Include/IndustryStandard/IpmiKcs.h

> > @@ -0,0 +1,76 @@

> > +/** @file

> > +  IPMI KCS Register Definitions

> > +

> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. 

Re: [edk2-devel] [PATCH 0/1] MdeModulePkg/Ahci: Skip retry for non-transient errors

2023-03-26 Thread Anbazhagan, Baraneedharan via groups.io
It's OK to remove the PCD since password issue is fixed in different way. On 
other hand, PCD allows the platform to determine the retries independent of 
specific command. Am OK with either approach on this one currently. Thanks.

From: devel@edk2.groups.io  On Behalf Of Wu, Hao A via 
groups.io
Sent: Thursday, March 23, 2023 8:14 PM
To: Anbazhagan, Baraneedharan ; devel@edk2.groups.io; 
Albecki, Mateusz 
Cc: Ni, Ray ; Chang, Hunter 
Subject: Re: [edk2-devel] [PATCH 0/1] MdeModulePkg/Ahci: Skip retry for 
non-transient errors

CAUTION: External Email
Thanks Baranee. We will proceed to merge the this patch after reviewing process.

For the PCD (PcdAhciCommandRetryCount) previously introduced to address the 
password retry issue, what is your opinion on it?
Do you think we can remove it or keep it for other reason? Thanks.

Best Regards,
Hao Wu

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Anbazhagan, 
Baraneedharan via groups.io
Sent: Friday, March 24, 2023 12:55 AM
To: devel@edk2.groups.io; Wu, Hao A 
mailto:hao.a...@intel.com>>; Albecki, Mateusz 
mailto:mateusz.albe...@intel.com>>
Cc: Ni, Ray mailto:ray...@intel.com>>; Chang, Hunter 
mailto:hunter.ch...@intel.com>>
Subject: Re: [edk2-devel] [PATCH 0/1] MdeModulePkg/Ahci: Skip retry for 
non-transient errors

Hi,
This patch seems to resolve the issue reported in 4011 - MdeModulePkg: Need 
configurable AHCI command retries 
(tianocore.org) and 
verified with 'AHCI_COMMAND_RETRIES' as 5. Able to unlock the drive with 
correct password on 2nd attempt after providing an incorrect password.

Thanks,
Baranee

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Wu, Hao A via 
groups.io
Sent: Wednesday, March 22, 2023 1:59 AM
To: Albecki, Mateusz 
mailto:mateusz.albe...@intel.com>>; Anbazhagan, 
Baraneedharan mailto:anbazha...@hp.com>>; 
devel@edk2.groups.io
Cc: Ni, Ray mailto:ray...@intel.com>>; Chang, Hunter 
mailto:hunter.ch...@intel.com>>
Subject: Re: [edk2-devel] [PATCH 0/1] MdeModulePkg/Ahci: Skip retry for 
non-transient errors

CAUTION: External Email
Thanks Mateusz, the patch looks good to me.
I noticed that there are some check failures in 
https://github.com/tianocore/edk2/pull/4157,
 could you help to address them?


Hello Baraneedharan Anbazhagan,
Could you help to check if this patch can resolve the issue 
https://bugzilla.tianocore.org/show_bug.cgi?id=4011
 when switching back to: "#define AHCI_COMMAND_RETRIES 5"?
This change can be accessed for integration at: 
https://patch-diff.githubusercontent.com/raw/tianocore/edk2/pull/4157.patch
Thanks in advance.

Best Regards,
Hao Wu

> -Original Message-
> From: Albecki, Mateusz 
> mailto:mateusz.albe...@intel.com>>
> Sent: Wednesday, March 22, 2023 4:20 AM
> To: devel@edk2.groups.io
> Cc: Albecki, Mateusz 
> mailto:mateusz.albe...@intel.com>>; Wu, Hao A
> mailto:hao.a...@intel.com>>; Ni, Ray 
> mailto:ray...@intel.com>>; Chang, Hunter
> mailto:hunter.ch...@intel.com>>
> Subject: [PATCH 0/1] MdeModulePkg/Ahci: Skip retry for non-transient errors
>
> Fix for the recovery logic which causes hdd unlock to fail if user supplies
> incorrect password. Every failed packet used to be recovered which is causing
> the incorrect password to be tried multiple times. This patch series fixes the
> logic to only retry commands that failed due to CRC error.
>
> BZ: 
> https://bugzilla.tianocore.org/show_bug.cgi?id=4011
>
> Github pull: 
> https://github.com/tianocore/edk2/pull/4157
>
> Tests:
> - tested basic linux boot from AHCI on qemu
> - tested basic linux boot from AHCI on custom qemu which will fail 50% of the
> DMA commands with CRC error.
> Observed that all of the packets that failed were successfully retried. Custom
> Qemu: 
> https://github.com/matalbec/qemu/tree/sata_dma_50p_fail
> - additionally Hunter Chang tested and confirmed that the password issue is no
> longer observed.
>
> Cc: Hao A Wu mailto:hao.a...@intel.com>>
> Cc: Ray Ni mailto:ray...@intel.com>>
> Cc: Hunter Chang mailto:hunter.ch...@intel.com>>
>
> Mateusz Albecki (1):
> MdeModulePkg/Ahci: Skip retry for non-transient errors
>
> .../Bus/Ata/AtaAtapiPassThru/AhciMode.c | 69 +--
> .../Bus/Ata/AtaAtapiPassThru/AhciMode.h | 3 +-
> 2 files changed, 67 insertions(+), 5 deletions(-)
>
> --
> 2.39.1.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101896): 

Re: [edk2-devel] [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year

2023-03-26 Thread Ni, Ray
Mike,
When adding the Min/Max year PCD, the idea was Min year is the default year 
value.
The idea assumed that when a PC is shipped to customers the Min year is set to
the current year.

Can we explain why need the default year PCD?

Thanks,
Ray

> -Original Message-
> From: Kinney, Michael D 
> Sent: Sunday, March 26, 2023 11:23 AM
> To: devel@edk2.groups.io
> Cc: Ni, Ray 
> Subject: [Patch 1/1] PcAtChipsetPkg: Add PCD for RTC default year
> 
> Add PcdRtcDefaultYear to specify the default year to use when
> the RTC is in an invalid state. Make sure PcdRtcDefaultYear is
> >= PcdMinimalValidYear and <= PcdMaximalValidYear.  Set the
> default value for this PCD to PcdMinimalValidYear to preserve
> the existing behavior. A platform DSC file can override this
> default value setting.
> 
> Cc: Ray Ni 
> Signed-off-by: Michael D Kinney 
> ---
>  PcAtChipsetPkg/PcAtChipsetPkg.dec   | 6 ++
>  PcAtChipsetPkg/PcAtChipsetPkg.uni   | 4 
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c  | 4 ++--
>  .../PcatRealTimeClockRuntimeDxe.inf | 1 +
>  4 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> index a53ca777e85a..0db385fb901f 100644
> --- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> @@ -76,6 +76,12 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx,
> PcdsPatchableInModule]
># @Expression 0x8001 |
> gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear <
> gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear + 100
> 
> gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear|2097|UINT16|0x000
> E
> 
> +  ## This PCD specifies the RTC default year when the RTC is in an invalid
> state.
> +  # @Prompt Default year in RTC.
> +  # @Expression 0x8001 |
> gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear >=
> gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear
> +  # @Expression 0x8001 |
> gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear <=
> gPcAtChipsetPkgTokenSpaceGuid.PcdMaximalValidYear
> +
> gPcAtChipsetPkgTokenSpaceGuid.PcdRtcDefaultYear|gPcAtChipsetPkgToke
> nSpaceGuid.PcdMinimalValidYear|UINT16|0x000F
> +
>## Specifies RTC Index Register address in MMIO space.
># @Prompt RTC Index Register address
> 
> gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64|0x0|UINT64|0x00
> 22
> diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.uni
> b/PcAtChipsetPkg/PcAtChipsetPkg.uni
> index d290dcf1650f..8eb7970c58aa 100644
> --- a/PcAtChipsetPkg/PcAtChipsetPkg.uni
> +++ b/PcAtChipsetPkg/PcAtChipsetPkg.uni
> @@ -79,6 +79,10 @@
> 
>  #string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdMaximalValidYear_HELP
> #language en-US "This PCD specifies the maximal valid year in RTC."
> 
> +#string
> STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcDefaultYear_PROMPT
> #language en-US "Default year in RTC"
> +
> +#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdRtcDefaultYear_HELP
> #language en-US "This PCD specifies the RTC default year when the RTC is in
> an invalid state."
> +
>  #string
> STR_gPcAtChipsetPkgTokenSpaceGuid_PcdAcpiIoPortBaseAddressMask_PR
> OMPT   #language en-US  "ACPI IO Port Base Address Mask"
> 
>  #string
> STR_gPcAtChipsetPkgTokenSpaceGuid_PcdAcpiIoPortBaseAddressMask_HE
> LP #language en-US  "Defines the bit mask to retrieve ACPI IO Port Base
> Address."
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> index 9242a2e82600..b059e92f02dc 100644
> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> @@ -317,7 +317,7 @@ PcRtcInit (
>  Time.Hour   = RTC_INIT_HOUR;
>  Time.Day= RTC_INIT_DAY;
>  Time.Month  = RTC_INIT_MONTH;
> -Time.Year   = PcdGet16 (PcdMinimalValidYear);
> +Time.Year   = PcdGet16 (PcdRtcDefaultYear);
>  Time.Nanosecond = 0;
>  Time.TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
>  Time.Daylight   = 0;
> @@ -357,7 +357,7 @@ PcRtcInit (
>Time.Hour   = RTC_INIT_HOUR;
>Time.Day= RTC_INIT_DAY;
>Time.Month  = RTC_INIT_MONTH;
> -  Time.Year   = PcdGet16 (PcdMinimalValidYear);
> +  Time.Year   = PcdGet16 (PcdRtcDefaultYear);
>Time.Nanosecond = 0;
>Time.TimeZone   = Global->SavedTimeZone;
>Time.Daylight   = Global->Daylight;
> diff --git
> a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntim
> eDxe.inf
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntim
> eDxe.inf
> index 0d8eca28b659..c344b059878c 100644
> ---
> a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntim
> eDxe.inf
> +++
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntim
> eDxe.inf
> @@ -76,6 +76,7 @@ [Pcd]
>gPcAtChipsetPkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout   ##
> CONSUMES
>