[edk2-devel] [PATCH v2 3/5] SimicsOpenBoardPkg: Use SmmAccessLib instead of SmmAccessPei.inf
Zhiguang Liu
zhiguang.liu at intel.com
Wed Apr 26 06:15:47 UTC 2023
SmmAccessPei.inf is a PEIM we should delete, here is the reason:
1. It programs registers MCH_TOLUD to set the Low Usable DRAM,
but reading LMCH_TOLUD always return zero in QSP platforms
2. It programs/reads MCH_TSEGMB to implement some Smm Access service
such as open/close/lock. However, this reading LMCH_TOLUD also always
return zero in QSP platforms
3. It returns the hard-code Smm range information. However, there are
two improper things about this. One is that we already have the hard
code value about T-Seg base/size in MemDetect. The other Smm range
information is already saved in gEfiSmmSmramMemoryGuid Hob. No need
hard-code value.
So, this patch uses another way, calling PeiInstallSmmAccessPpi from
SmmAccessLib. The lib instance we choose will use the
gEfiSmmSmramMemoryGuid Hob information.
In a word, with the patch, we can avoid additional hard-code, and
avoid programing unimplemented registers.
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Reviewed-by: Ray Ni <ray.ni at intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu at intel.com>
---
.../SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 9 ++-------
.../SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf | 3 +--
Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c | 9 +++++++++
.../Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf | 2 ++
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 7b98baf764..ae6f980a68 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
## @file
# The main build description file for the X58Ich10 board.
#
-# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2023, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -142,6 +142,7 @@
# Silicon Package
#####################################
ReportCpuHobLib|IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf
+ SmmAccessLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLib/PeiSmmAccessLib.inf
#####################################
# Platform Package
@@ -190,12 +191,6 @@
#######################################
# Silicon Initialization Package
#######################################
-!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
- $(SKT_PKG)/Smm/Access/SmmAccessPei.inf {
- <LibraryClasses>
- PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
- }
-!endif
#####################################
# Platform Package
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
index 221706ae03..94f4ead826 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
@@ -1,6 +1,6 @@
## @file
#
-# Copyright (c) 2019 Intel Corporation. All rights reserved. <BR>
+# Copyright (c) 2019 - 2023 Intel Corporation. All rights reserved. <BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -165,7 +165,6 @@ INF MinPlatformPkg/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf
!include MinPlatformPkg/Include/Fdf/CoreSecurityPostMemoryInclude.fdf
INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
-INF $(SKT_PKG)/Smm/Access/SmmAccessPei.inf
# S3 SMM PEI driver
#INF UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
index 5da8ef80b2..b1df1c2ef2 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
@@ -25,6 +25,7 @@
#include <Library/CmosAccessLib.h>
#include <SimicsPlatforms.h>
#include <Guid/SmramMemoryReserve.h>
+#include <Library/SmmAccessLib.h>
#include <CmosMap.h>
@@ -482,6 +483,8 @@ InitializeRamRegions (
VOID
)
{
+ EFI_STATUS Status;
+
QemuInitializeRam ();
if (mS3Supported && mBootMode != BOOT_ON_S3_RESUME) {
@@ -554,4 +557,10 @@ InitializeRamRegions (
);
}
}
+
+ //
+ // Install EFI_PEI_MM_ACCESS_PPI for S3 resume case
+ //
+ Status = PeiInstallSmmAccessPpi ();
+ ASSERT_EFI_ERROR (Status);
}
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf
index 9a85ccb962..9f5f8761fc 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf
@@ -36,6 +36,7 @@
SimicsX58SktPkg/SktPkg.dec
SimicsIch10Pkg/Ich10Pkg.dec
BoardModulePkg/BoardModulePkg.dec
+ IntelSiliconPkg/IntelSiliconPkg.dec
[Guids]
gEfiMemoryTypeInformationGuid
@@ -55,6 +56,7 @@
MtrrLib
PcdLib
CmosAccessLib
+ SmmAccessLib
[Pcd]
gSimicsOpenBoardPkgTokenSpaceGuid.PcdSimicsPeiMemFvBase
--
2.31.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103614): https://edk2.groups.io/g/devel/message/103614
Mute This Topic: https://groups.io/mt/98509465/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list