Now that the SMRAM at the default SMBASE is honored everywhere necessary, implement the actual detection. The (simple) steps are described in previous patch "OvmfPkg/IndustryStandard: add MCH_DEFAULT_SMBASE* register macros".
Cc: Ard Biesheuvel <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Brijesh Singh <[email protected]> Cc: Igor Mammedov <[email protected]> Cc: Jiewen Yao <[email protected]> Cc: Joao M Martins <[email protected]> Cc: Jordan Justen <[email protected]> Cc: Jun Nakajima <[email protected]> Cc: Michael Kinney <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Phillip Goerl <[email protected]> Cc: Yingwen Chen <[email protected]> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512 Signed-off-by: Laszlo Ersek <[email protected]> --- OvmfPkg/PlatformPei/MemDetect.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 8fdc9c2ed7c9..3364193b4952 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -98,14 +98,23 @@ Q35SmramAtDefaultSmbaseInitialization ( VOID ) { + UINTN CtlReg; + UINT8 CtlRegVal; RETURN_STATUS PcdStatus; ASSERT (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID); - mQ35SmramAtDefaultSmbase = FALSE; + CtlReg = DRAMC_REGISTER_Q35 (MCH_DEFAULT_SMBASE_CTL); + PciWrite8 (CtlReg, MCH_DEFAULT_SMBASE_QUERY); + CtlRegVal = PciRead8 (CtlReg); + + mQ35SmramAtDefaultSmbase = (BOOLEAN)(CtlRegVal == MCH_DEFAULT_SMBASE_IN_RAM); PcdStatus = PcdSetBoolS (PcdQ35SmramAtDefaultSmbase, mQ35SmramAtDefaultSmbase); ASSERT_RETURN_ERROR (PcdStatus); + if (mQ35SmramAtDefaultSmbase) { + DEBUG ((DEBUG_INFO, "%a: SMRAM at default SMBASE found\n", __FUNCTION__)); + } } -- 2.19.1.3.g30247aa5d201 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#47934): https://edk2.groups.io/g/devel/message/47934 Mute This Topic: https://groups.io/mt/34274946/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
