From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Subject: [PATCH 3/5] OvmfPkg/SmmAccess: rebase code unique to SmmAccessPei to Q35TsegSizeLib
Date: Thu, 8 Jun 2017 19:13:31 +0200 [thread overview]
Message-ID: <20170608171333.17937-4-lersek@redhat.com> (raw)
In-Reply-To: <20170608171333.17937-1-lersek@redhat.com>
SmmAccessPei and SmmAccess2Dxe share the internals between their
PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL implementations,
respectively, in "SmramInternal.c".
In this patch, convert the code that is unique to SmmAccessPei -- namely
SmmAccessPeiEntryPoint() -- to Q35TsegSizeLib client code, as follows:
- Replace FixedPcdGet8 (PcdQ35TsegMbytes) macro invocations with
Q35TsegSizeGetPreferredMbytes () function calls.
- Replace any mapping, from FixedPcdGet8 (PcdQ35TsegMbytes) to
MCH_ESMRAMC_TSEG_xMB bitmask macros, with
Q35TsegSizeGetPreferredEsmramcTsegSzMask() function calls.
This causes no change in observable behavior.
After this patch, no module INF file except
"OvmfPkg/Library/Q35TsegSizeLib/Q35TsegSizeLib.inf" refers to
PcdQ35TsegMbytes.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
OvmfPkg/SmmAccess/SmmAccessPei.inf | 4 +---
OvmfPkg/SmmAccess/SmmAccessPei.c | 7 +++----
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/OvmfPkg/SmmAccess/SmmAccessPei.inf b/OvmfPkg/SmmAccess/SmmAccessPei.inf
index 3908b085da3a..c07c603cb663 100644
--- a/OvmfPkg/SmmAccess/SmmAccessPei.inf
+++ b/OvmfPkg/SmmAccess/SmmAccessPei.inf
@@ -51,19 +51,17 @@ [LibraryClasses]
DebugLib
HobLib
IoLib
PcdLib
PciLib
PeiServicesLib
PeimEntryPoint
+ Q35TsegSizeLib
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
-[FixedPcd]
- gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
-
[Ppis]
gPeiSmmAccessPpiGuid ## PRODUCES
[Depex]
TRUE
diff --git a/OvmfPkg/SmmAccess/SmmAccessPei.c b/OvmfPkg/SmmAccess/SmmAccessPei.c
index a4ce610a4650..104671a15c64 100644
--- a/OvmfPkg/SmmAccess/SmmAccessPei.c
+++ b/OvmfPkg/SmmAccess/SmmAccessPei.c
@@ -28,14 +28,15 @@
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/PciLib.h>
#include <Library/PeiServicesLib.h>
+#include <Library/Q35TsegSizeLib.h>
#include <Ppi/SmmAccess.h>
#include <OvmfPlatforms.h>
#include "SmramInternal.h"
//
@@ -315,25 +316,23 @@ SmmAccessPeiEntryPoint (
PciWrite32 (DRAMC_REGISTER_Q35 (MCH_BGSM),
TopOfLowRamMb << MCH_BGSM_MB_SHIFT);
//
// Set TSEG Memory Base.
//
PciWrite32 (DRAMC_REGISTER_Q35 (MCH_TSEGMB),
- (TopOfLowRamMb - FixedPcdGet8 (PcdQ35TsegMbytes)) << MCH_TSEGMB_MB_SHIFT);
+ (TopOfLowRamMb - Q35TsegSizeGetPreferredMbytes ()) << MCH_TSEGMB_MB_SHIFT);
//
// Set TSEG size, and disable TSEG visibility outside of SMM. Note that the
// T_EN bit has inverse meaning; when T_EN is set, then TSEG visibility is
// *restricted* to SMM.
//
EsmramcVal &= ~(UINT32)MCH_ESMRAMC_TSEG_MASK;
- EsmramcVal |= FixedPcdGet8 (PcdQ35TsegMbytes) == 8 ? MCH_ESMRAMC_TSEG_8MB :
- FixedPcdGet8 (PcdQ35TsegMbytes) == 2 ? MCH_ESMRAMC_TSEG_2MB :
- MCH_ESMRAMC_TSEG_1MB;
+ EsmramcVal |= Q35TsegSizeGetPreferredEsmramcTsegSzMask ();
EsmramcVal |= MCH_ESMRAMC_T_EN;
PciWrite8 (DRAMC_REGISTER_Q35 (MCH_ESMRAMC), EsmramcVal);
//
// TSEG should be closed (see above), but unlocked, initially. Set G_SMRAME
// (Global SMRAM Enable) too, as both D_LCK and T_EN depend on it.
//
--
2.9.3
next prev parent reply other threads:[~2017-06-08 17:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 17:13 [PATCH 0/5] OvmfPkg: recognize an extended TSEG when QEMU offers it Laszlo Ersek
2017-06-08 17:13 ` [PATCH 1/5] OvmfPkg: introduce Q35TsegSizeLib (class header and sole lib instance) Laszlo Ersek
2017-06-19 17:30 ` Jordan Justen
2017-06-19 19:39 ` Laszlo Ersek
2017-06-26 17:59 ` Jordan Justen
2017-06-26 19:12 ` Laszlo Ersek
2017-06-26 22:36 ` Jordan Justen
2017-06-26 23:04 ` Laszlo Ersek
2017-06-29 19:14 ` Jordan Justen
2017-07-01 20:42 ` Laszlo Ersek
2017-07-02 5:50 ` Jordan Justen
2017-06-21 0:52 ` Yao, Jiewen
2017-06-22 16:22 ` Laszlo Ersek
2017-06-08 17:13 ` [PATCH 2/5] OvmfPkg/PlatformPei: rebase to Q35TsegSizeLib Laszlo Ersek
2017-06-08 17:13 ` Laszlo Ersek [this message]
2017-06-08 17:13 ` [PATCH 4/5] OvmfPkg/SmmAccess: rebase shared PEIM/DXE code " Laszlo Ersek
2017-06-08 17:13 ` [PATCH 5/5] OvmfPkg/Q35TsegSizeLib: recognize an extended TSEG when QEMU offers it Laszlo Ersek
2017-06-16 8:15 ` [PATCH 0/5] OvmfPkg: " Laszlo Ersek
2017-06-19 18:09 ` Jordan Justen
2017-06-19 22:39 ` Laszlo Ersek
2017-06-20 22:29 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170608171333.17937-4-lersek@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox