[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Enable GCC Yocto S3

Guo, Mang posted 1 patch 7 years, 5 months ago
Failed in applying to current master (apply log)
.../Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c     | 34 ++++++++++++++++++++++
.../Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf       |  4 ++-
.../PlatformPostMemPei/PlatformInit.c              | 30 -------------------
.../PlatformPostMemPei/PlatformPostMemPei.inf      |  1 -
.../BroxtonPlatformPkg/PlatformDsc/Components.dsc  |  2 +-
Platform/BroxtonPlatformPkg/PlatformPkg.fdf        |  8 +----
Silicon/BroxtonSoC/BroxtonSiPkg/SiPkgDxe.dsc       |  3 +-
7 files changed, 40 insertions(+), 42 deletions(-)
[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Enable GCC Yocto S3
Posted by Guo, Mang 7 years, 5 months ago
Enable GCC build BIOS image Yocto S3 support. Replace CPU drivers with drivers from core packages.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Guo Mang <mang.guo@intel.com>
---
 .../Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c     | 34 ++++++++++++++++++++++
 .../Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf       |  4 ++-
 .../PlatformPostMemPei/PlatformInit.c              | 30 -------------------
 .../PlatformPostMemPei/PlatformPostMemPei.inf      |  1 -
 .../BroxtonPlatformPkg/PlatformDsc/Components.dsc  |  2 +-
 Platform/BroxtonPlatformPkg/PlatformPkg.fdf        |  8 +----
 Silicon/BroxtonSoC/BroxtonSiPkg/SiPkgDxe.dsc       |  3 +-
 7 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c
index b5cd9f7..3007132 100644
--- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c
+++ b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c
@@ -16,6 +16,7 @@
 #include <Guid/AcpiTableStorage.h>
 #include <Guid/EfiVpdData.h>
 #include <Guid/GlobalVariable.h>
+#include <Protocol/CpuGlobalNvsArea.h>
 #include <Guid/PlatformInfo.h>
 #include <Guid/PlatformCpuInfo.h>
 #include <Guid/SetupVariable.h>
@@ -42,6 +43,7 @@
 #include <Library/DxeVtdLib.h>
 #include <Library/SideBandLib.h>
 #include <Library/SteppingLib.h>
+#include <Private/CpuInitDataHob.h>
 #include "PlatformBaseAddresses.h"
 
 #if (ENBDT_PF_ENABLE == 0)
@@ -66,6 +68,8 @@ CHAR16    gACPIOSFRMfgStringVariableName[]    = ACPI_OSFR_MFG_STRING_VARIABLE_NA
 
 EFI_GLOBAL_NVS_AREA_PROTOCOL  mGlobalNvsArea;
 EFI_CPU_IO2_PROTOCOL          *mCpuIo;
+CPU_INIT_DATA_HOB             *mCpuInitDataHob = NULL;
+CPU_GLOBAL_NVS_AREA_PROTOCOL  CpuGlobalNvsAreaProtocol;
 
 BOOLEAN                       mFirstNotify;
 EFI_PLATFORM_INFO_HOB         *mPlatformInfo;
@@ -1317,6 +1321,7 @@ AcpiPlatformEntryPoint (
   CHAR16                        LocalGuidString[GUID_CHARS_NUMBER];
   UINTN                         Data32;
   UINT32                        VariableAttributes;
+  VOID                          *Hob;
 
   mFirstNotify      = FALSE;
   TableVersion      = EFI_ACPI_TABLE_VERSION_2_0;
@@ -1999,6 +2004,35 @@ AcpiPlatformEntryPoint (
                   NULL
                   );
 
+
+
+  //
+  // Get CPU Init Data Hob
+  //
+  Hob = GetFirstGuidHob (&gCpuInitDataHobGuid);
+  if (Hob == NULL) {
+    DEBUG ((DEBUG_ERROR, "CPU Data HOB not available\n"));
+    ASSERT_EFI_ERROR (EFI_NOT_FOUND);
+  }
+  mCpuInitDataHob    = (CPU_INIT_DATA_HOB *) ((UINTN) Hob + sizeof (EFI_HOB_GUID_TYPE));
+
+  //
+  // Get CPU Global NVS protocol pointer
+  //
+  CpuGlobalNvsAreaProtocol.Area = (CPU_GLOBAL_NVS_AREA *) (UINTN) mCpuInitDataHob->CpuGnvsPointer;
+  CpuGlobalNvsAreaProtocol.Area->DtsAcpiEnable  = 0;
+
+  //
+  // Install Cpu Power management GlobalNVS Area protocol
+  //
+  Status = gBS->InstallMultipleProtocolInterfaces (
+                  &Handle,
+                  &gCpuGlobalNvsAreaProtocolGuid,
+                  &CpuGlobalNvsAreaProtocol,
+                  NULL
+                  );
+  ASSERT_EFI_ERROR (Status);
+
   //
   // Read tables from the storage file.
   //
diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
index cf862fc..31c2a77 100644
--- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  ACPI Platform Driver.
 #
-#  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -62,6 +62,7 @@
   gEfiBxtVariableGuid
   gEfiPramConfGuid
   gPlatformSsdtImageGuid
+  gCpuInitDataHobGuid
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
@@ -77,6 +78,7 @@
   gEfiTcgProtocolGuid
   gEfiFirmwareVolume2ProtocolGuid
   gEfiSeCOperationProtocolGuid
+  gCpuGlobalNvsAreaProtocolGuid
 
 [Pcd]
   gEfiBxtTokenSpaceGuid.PcdScAcpiIoPortBaseAddress
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c
index 7d84e26..bfed3bf 100644
--- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c
@@ -19,7 +19,6 @@
 #include <Guid/PttPTPInstanceGuid.h>
 #include <Ppi/Smbus2.h>
 #include <Library/PcdLib.h>
-#include <Private/Library/CpuS3Lib.h>
 #include <Library/HeciMsgLib.h>
 #include <Ppi/SeCUma.h>
 
@@ -30,13 +29,6 @@
   #pragma optimize ("", off)
 #endif
 
-EFI_STATUS
-EFIAPI
-CpuS3SmmAccessNotifyCallback (
-  IN EFI_PEI_SERVICES           **PeiServices,
-  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
-  IN VOID                       *Ppi
-  );
 
 static EFI_PEI_RESET_PPI            mResetPpi = { IchReset };
 
@@ -69,11 +61,6 @@ static EFI_PEI_PPI_DESCRIPTOR       mPpiList[] = {
 
 static EFI_PEI_NOTIFY_DESCRIPTOR    mNotifyList[] = {
   {
-    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
-    &gPeiSmmAccessPpiGuid,
-    CpuS3SmmAccessNotifyCallback
-  },
-  {
     (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
     &gEfiEndOfPeiSignalPpiGuid,
     EndOfPeiPpiNotifyCallback
@@ -545,23 +532,6 @@ PeiGetSectionFromFv (
 }
 
 
-EFI_STATUS
-EFIAPI
-CpuS3SmmAccessNotifyCallback (
-  IN EFI_PEI_SERVICES           **PeiServices,
-  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
-  IN VOID                       *Ppi
-  )
-{
-  //
-  // Restore Cpu settings only during S3 resume
-  //
-  S3InitializeCpu (PeiServices);
-
-  return EFI_SUCCESS;
-}
-
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf
index 762eff2..2fb7fb6 100644
--- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf
+++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf
@@ -55,7 +55,6 @@
   CpuPolicyLib
   TimerLib
   ScPlatformLib
-  CpuS3Lib
   SeCUmaLib
 
 [Ppis]
diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
index 6bb2a77..234c277 100644
--- a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
+++ b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
@@ -43,6 +43,7 @@
       MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   }
   
+  UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
 
@@ -246,7 +247,6 @@
   $(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformDxe/PlatformDxe.inf
 
   $(PLATFORM_PACKAGE_COMMON)/SaveMemoryConfigDxe/SaveMemoryConfigDxe.inf
-  $(PLATFORM_PACKAGE_COMMON)/Features/S3/SmramSaveInfoHandlerSmm/SmramSaveInfoHandlerSmm.inf
 
 !if $(GOP_DRIVER_ENABLE) == TRUE
   $(PLATFORM_PACKAGE_COMMON)/Console/PlatformGopPolicyDxe/PlatformGopPolicyDxe.inf
diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf b/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
index 4324f4f..eeb0985 100644
--- a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
+++ b/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
@@ -494,11 +494,8 @@ APRIORI DXE {
   INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
 !endif
 
-!if $(TOOL_CHAIN_TAG) == GCC5
   INF UefiCpuPkg/CpuDxe/CpuDxe.inf
-!else
-  INF $(PLATFORM_SI_PACKAGE)/Cpu/CpuInit/Dxe/CpuInitDxe.inf
-!endif
+  INF UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
 
   INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
 
@@ -557,9 +554,6 @@ APRIORI DXE {
   INF $(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.inf
   #INF $(TABLET_PLATFORM_PACKAGE)/PlatformCpuInfo/PlatformCpuInfoDxe.inf
   INF $(PLATFORM_PACKAGE_COMMON)/SaveMemoryConfigDxe/SaveMemoryConfigDxe.inf
-!if $(TOOL_CHAIN_TAG) != GCC5
-  INF $(PLATFORM_PACKAGE_COMMON)/Features/S3/SmramSaveInfoHandlerSmm/SmramSaveInfoHandlerSmm.inf
-!endif
 
 !if $(GOP_DRIVER_ENABLE) == TRUE
   INF $(PLATFORM_PACKAGE_COMMON)/Console/PlatformGopPolicyDxe/PlatformGopPolicyDxe.inf
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SiPkgDxe.dsc b/Silicon/BroxtonSoC/BroxtonSiPkg/SiPkgDxe.dsc
index b568bd9..4ae0803 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/SiPkgDxe.dsc
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SiPkgDxe.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Component description file for the Broxton RC DXE drivers.
 #
-#  Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -16,7 +16,6 @@
 #
 # CPU
 #
-  $(PLATFORM_SI_PACKAGE)/Cpu/CpuInit/Dxe/CpuInitDxe.inf
   !if $(PPM_ENABLE) == TRUE
     $(PLATFORM_SI_PACKAGE)/Cpu/PowerManagement/Dxe/PowerMgmtDxe.inf
     $(PLATFORM_SI_PACKAGE)/Cpu/PowerManagement/Smm/PowerMgmtSmm.inf
-- 
2.8.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel