[edk2-devel] [patch 09/11] UefiCpuPkg: Remove PcdFrameworkCompatibilitySupport usage

Dandan Bi posted 11 patches 6 years, 9 months ago
[edk2-devel] [patch 09/11] UefiCpuPkg: Remove PcdFrameworkCompatibilitySupport usage
Posted by Dandan Bi 6 years, 9 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464

Currently Framework compatibility support is not needed and
PcdFrameworkCompatibilitySupport will be removed from edk2.
So remove the usage of this PCD firstly.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../Universal/Acpi/S3Resume2Pei/S3Resume.c    | 30 -------------------
 .../Acpi/S3Resume2Pei/S3Resume2Pei.inf        |  3 +-
 2 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
index 77c3fb6bdc..83ce1c4037 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
@@ -741,12 +741,10 @@ S3ResumeExecuteBootScript (
 {
   EFI_STATUS                 Status;
   PEI_SMM_ACCESS_PPI         *SmmAccess;
   UINTN                      Index;
   VOID                       *GuidHob;
-  IA32_DESCRIPTOR            *IdtDescriptor;
-  VOID                       *IdtBuffer;
   PEI_S3_RESUME_STATE        *PeiS3ResumeState;
   BOOLEAN                    InterruptStatus;
 
   DEBUG ((DEBUG_INFO, "S3ResumeExecuteBootScript()\n"));
 
@@ -802,38 +800,10 @@ S3ResumeExecuteBootScript (
 
   if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
     AsmWriteCr3 ((UINTN)AcpiS3Context->S3NvsPageTableAddress);
   }
 
-  if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {
-    //
-    // On some platform, such as ECP, a dispatch node in boot script table may execute a 32-bit PEIM which may need PeiServices
-    // pointer. So PeiServices need preserve in (IDTBase- sizeof (UINTN)).
-    //
-    IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
-    //
-    // Make sure the newly allocated IDT align with 16-bytes
-    //
-    IdtBuffer = AllocatePages (EFI_SIZE_TO_PAGES((IdtDescriptor->Limit + 1) + 16));
-    if (IdtBuffer == NULL) {
-      REPORT_STATUS_CODE (
-        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
-        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED)
-        );
-      ASSERT (FALSE);
-    }
-    //
-    // Additional 16 bytes allocated to save IA32 IDT descriptor and Pei Service Table Pointer
-    // IA32 IDT descriptor will be used to setup IA32 IDT table for 32-bit Framework Boot Script code
-    //
-    ZeroMem (IdtBuffer, 16);
-    AsmReadIdtr ((IA32_DESCRIPTOR *)IdtBuffer);
-    CopyMem ((VOID*)((UINT8*)IdtBuffer + 16),(VOID*)(IdtDescriptor->Base), (IdtDescriptor->Limit + 1));
-    IdtDescriptor->Base = (UINTN)((UINT8*)IdtBuffer + 16);
-    *(UINTN*)(IdtDescriptor->Base - sizeof(UINTN)) = (UINTN)GetPeiServicesTablePointer ();
-  }
-
   InterruptStatus = SaveAndDisableInterrupts ();
   //
   // Need to make sure the GDT is loaded with values that support long mode and real mode.
   //
   AsmWriteGdtr (&mGdt);
diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
index d694a98691..aae984d138 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
@@ -3,11 +3,11 @@
 #
 # This module works with StandAloneBootScriptExecutor to S3 resume to OS.
 # This module will excute the boot script saved during last boot and after that,
 # control is passed to OS waking up handler.
 #
-# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -87,11 +87,10 @@
   gEfiEndOfPeiSignalPpiGuid                     ## SOMETIMES_PRODUCES
   gEfiPeiSmmCommunicationPpiGuid                ## SOMETIMES_CONSUMES
 
 [FeaturePcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode         ## CONSUMES
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport  ## CONSUMES
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable  ## SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask    ## CONSUMES
 
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39728): https://edk2.groups.io/g/devel/message/39728
Mute This Topic: https://groups.io/mt/31379004/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [patch 09/11] UefiCpuPkg: Remove PcdFrameworkCompatibilitySupport usage
Posted by Laszlo Ersek 6 years, 9 months ago
On 04/29/19 04:16, Dandan Bi wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464
> 
> Currently Framework compatibility support is not needed and
> PcdFrameworkCompatibilitySupport will be removed from edk2.
> So remove the usage of this PCD firstly.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  .../Universal/Acpi/S3Resume2Pei/S3Resume.c    | 30 -------------------
>  .../Acpi/S3Resume2Pei/S3Resume2Pei.inf        |  3 +-
>  2 files changed, 1 insertion(+), 32 deletions(-)
> 
> diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
> index 77c3fb6bdc..83ce1c4037 100644
> --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
> +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
> @@ -741,12 +741,10 @@ S3ResumeExecuteBootScript (
>  {
>    EFI_STATUS                 Status;
>    PEI_SMM_ACCESS_PPI         *SmmAccess;
>    UINTN                      Index;
>    VOID                       *GuidHob;
> -  IA32_DESCRIPTOR            *IdtDescriptor;
> -  VOID                       *IdtBuffer;
>    PEI_S3_RESUME_STATE        *PeiS3ResumeState;
>    BOOLEAN                    InterruptStatus;
>  
>    DEBUG ((DEBUG_INFO, "S3ResumeExecuteBootScript()\n"));
>  
> @@ -802,38 +800,10 @@ S3ResumeExecuteBootScript (
>  
>    if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
>      AsmWriteCr3 ((UINTN)AcpiS3Context->S3NvsPageTableAddress);
>    }
>  
> -  if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) {
> -    //
> -    // On some platform, such as ECP, a dispatch node in boot script table may execute a 32-bit PEIM which may need PeiServices
> -    // pointer. So PeiServices need preserve in (IDTBase- sizeof (UINTN)).
> -    //
> -    IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
> -    //
> -    // Make sure the newly allocated IDT align with 16-bytes
> -    //
> -    IdtBuffer = AllocatePages (EFI_SIZE_TO_PAGES((IdtDescriptor->Limit + 1) + 16));
> -    if (IdtBuffer == NULL) {
> -      REPORT_STATUS_CODE (
> -        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
> -        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_FAILED)
> -        );
> -      ASSERT (FALSE);
> -    }
> -    //
> -    // Additional 16 bytes allocated to save IA32 IDT descriptor and Pei Service Table Pointer
> -    // IA32 IDT descriptor will be used to setup IA32 IDT table for 32-bit Framework Boot Script code
> -    //
> -    ZeroMem (IdtBuffer, 16);
> -    AsmReadIdtr ((IA32_DESCRIPTOR *)IdtBuffer);
> -    CopyMem ((VOID*)((UINT8*)IdtBuffer + 16),(VOID*)(IdtDescriptor->Base), (IdtDescriptor->Limit + 1));
> -    IdtDescriptor->Base = (UINTN)((UINT8*)IdtBuffer + 16);
> -    *(UINTN*)(IdtDescriptor->Base - sizeof(UINTN)) = (UINTN)GetPeiServicesTablePointer ();
> -  }
> -
>    InterruptStatus = SaveAndDisableInterrupts ();
>    //
>    // Need to make sure the GDT is loaded with values that support long mode and real mode.
>    //
>    AsmWriteGdtr (&mGdt);
> diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
> index d694a98691..aae984d138 100644
> --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
> +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
> @@ -3,11 +3,11 @@
>  #
>  # This module works with StandAloneBootScriptExecutor to S3 resume to OS.
>  # This module will excute the boot script saved during last boot and after that,
>  # control is passed to OS waking up handler.
>  #
> -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
>  # Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -87,11 +87,10 @@
>    gEfiEndOfPeiSignalPpiGuid                     ## SOMETIMES_PRODUCES
>    gEfiPeiSmmCommunicationPpiGuid                ## SOMETIMES_CONSUMES
>  
>  [FeaturePcd]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode         ## CONSUMES
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport  ## CONSUMES
>  
>  [Pcd]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable  ## SOMETIMES_CONSUMES
>    gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask    ## CONSUMES
>  
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39783): https://edk2.groups.io/g/devel/message/39783
Mute This Topic: https://groups.io/mt/31379004/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-