From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.73794.1682406195842322329 for ; Tue, 25 Apr 2023 00:03:20 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=aknatWOh; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: zhiguang.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682406200; x=1713942200; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cWfMgL2nA37a0DxcxCdF+m5q8AxOPsEWJ0L8jR7TQ0Y=; b=aknatWOhGy7deqd5X2xvBHQCLnv+vQUPQDWQk4wEeD9JqB4DTS17CJJu 0A9264RzAm0DPEio3qevQt3FUjm0susQAVZ1slFI9rSi8u2fv1Y2vuN0E w/v2XsZCp5Kx9OYfkHb8LES/keC1kcr4Y+lqAx1//5fB1P5z3YvSzceAK GWJT5hmg4psmKf57hOdE3gbOj8m4+Z1QABmO1+dC8WO5Z2itqA5DlLv5m 6ty5RvAmhnhpKB3AI81EaLYPVc3mNNmpZ+8Ob9SdN8O+U5xTtT/dlId5v ld/hgH5SbDeGpJt9qTXyYDa1qmB0nV5L3cxdL6Xc7saFEnRPfgMCpUQUY A==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="374623056" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="374623056" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2023 00:03:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="867781616" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="867781616" Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2023 00:03:18 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Nate DeSimone , Ray Ni Subject: [PATCH 3/5] SimicsOpenBoardPkg: Use SmmAccessLib instead of SmmAccessPei.inf Date: Tue, 25 Apr 2023 15:03:02 +0800 Message-Id: <20230425070304.2120-4-zhiguang.liu@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20230425070304.2120-1-zhiguang.liu@intel.com> References: <20230425070304.2120-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit SmmAccessPei.inf is a PEIM we should deleted, here is the reason: 1. It programs registers MCH_TOLUD to set the Low Usable DRAM, but reading LMCH_TOLUD always return zere in QSP platforms 2. It programs/reads MCH_TSEGMB to implemte some Smm Access service such as open/close/lock. However, this reading LMCH_TOLUD also always return zere 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 informaton 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 Cc: Ray Ni Signed-off-by: Zhiguang Liu --- .../SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 7 +------ .../SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf | 1 - Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c | 9 +++++++++ .../Intel/SimicsOpenBoardPkg/SimicsPei/SimicsPei.inf | 2 ++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc index 7b98baf764..fcae343146 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc @@ -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 { - - 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..844f9b6dcf 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf +++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf @@ -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 13ee415f40..f9a5487365 100644 --- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c +++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -472,6 +473,8 @@ InitializeRamRegions ( VOID ) { + EFI_STATUS Status; + QemuInitializeRam (); if (mS3Supported && mBootMode != BOOT_ON_S3_RESUME) { @@ -544,4 +547,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 618ad4075f..cdc30ad582 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