From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01b.sbp.mail.zen.net.uk (smarthost01b.sbp.mail.zen.net.uk [212.23.1.3]) by mx.groups.io with SMTP id smtpd.web08.2128.1644528505493470753 for ; Thu, 10 Feb 2022 13:28:25 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.3, mailfrom: sean@starlabs.systems) Received: from [217.155.46.38] (helo=sean-StarBook.lan) by smarthost01b.sbp.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nIGzI-0007lw-3i; Thu, 10 Feb 2022 21:28:24 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: eric.dong@intel.com, Patrick Rudolph Subject: [PATCH 16/18] UefiCpuPkg: Disable MTRR programming for UefiPayloadPkg Date: Thu, 10 Feb 2022 21:28:22 +0000 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-smarthost01b-IP: [217.155.46.38] Feedback-ID: 217.155.46.38 Content-Transfer-Encoding: quoted-printable From: Patrick Rudolph The MTRRs have already been programmed by FSB. Signed-off-by: Patrick Rudolph --- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 4 ++++ UefiCpuPkg/Library/MtrrLib/MtrrLib.inf | 2 +- UefiCpuPkg/UefiCpuPkg.dec | 4 ++++ UefiCpuPkg/UefiCpuPkg.uni | 8 ++++++-- UefiPayloadPkg/UefiPayloadPkg.dsc | 4 ++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/Mtrr= Lib/MtrrLib.c index e5c862c83d..8734bae2f0 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -2845,6 +2845,10 @@ IsMtrrSupported ( CPUID_VERSION_INFO_EDX Edx;=0D MSR_IA32_MTRRCAP_REGISTER MtrrCap;=0D =0D + if (PcdGetBool (PcdCpuDisableMtrrProgramming)) {=0D + return FALSE;=0D + }=0D +=0D //=0D // Check CPUID(1).EDX[12] for MTRR capability=0D //=0D diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf b/UefiCpuPkg/Library/Mt= rrLib/MtrrLib.inf index 4c9ea2def3..afc0bcc724 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf @@ -15,7 +15,6 @@ VERSION_STRING =3D 1.0=0D LIBRARY_CLASS =3D MtrrLib=0D =0D -=0D #=0D # The following information is for reference only and not required by the = build tools.=0D #=0D @@ -37,4 +36,5 @@ =0D [Pcd]=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs ## SOMET= IMES_CONSUMES=0D + gUefiCpuPkgTokenSpaceGuid.PcdCpuDisableMtrrProgramming ## CONSU= MES=0D =0D diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 7de66fde67..a2a4ecc094 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -217,6 +217,10 @@ # @Prompt SMM Code Access Check.=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable|TRUE|BOOLEAN|0x= 60000013=0D =0D + ## Disables MTRR programming in case it's already programmed by FSB.=0D + # @Prompt Disable MTRR programming.=0D + gUefiCpuPkgTokenSpaceGuid.PcdCpuDisableMtrrProgramming|FALSE|BOOLEAN|0x0= 0000017=0D +=0D ## Specifies the number of variable MTRRs reserved for OS use. The defau= lt number of=0D # MTRRs reserved for OS use is 2.=0D # @Prompt Number of reserved variable MTRRs.=0D diff --git a/UefiCpuPkg/UefiCpuPkg.uni b/UefiCpuPkg/UefiCpuPkg.uni index 219c1963bf..3db0063f50 100644 --- a/UefiCpuPkg/UefiCpuPkg.uni +++ b/UefiCpuPkg/UefiCpuPkg.uni @@ -140,9 +140,13 @@ =0D #string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuHotPlugDataAddress_HELP #lang= uage en-US "Contains the pointer to a CPU Hot Plug Data structure if CPU ho= t-plug is supported."=0D =0D -#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_= PROMPT #language en-US "Number of reserved variable MTRRs"=0D +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuDisableMtrrProgramming_PROMPT = #language en-US "Number of reserved variable MTRRs"=0D =0D -#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_= HELP #language en-US "Specifies the number of variable MTRRs reserved for = OS use."=0D +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuDisableMtrrProgramming_HELP #= language en-US "Specifies the number of variable MTRRs reserved for OS use.= "=0D +=0D +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_= PROMPT #language en-US "Disable MTRR programming."=0D +=0D +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_= HELP #language en-US "Disables MTRR programming in case it's already progr= ammed by FSB."=0D =0D #string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuApLoopMode_PROMPT #language e= n-US "The AP wait loop state"=0D =0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index c8562d592b..afec9109c1 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -37,6 +37,7 @@ DEFINE BOOT_MANAGER_ESCAPE =3D FALSE=0D DEFINE BOOTSPLASH_IMAGE =3D FALSE=0D DEFINE FOLLOW_BGRT_SPEC =3D FALSE=0D + DEFINE MTRR_PROGRAMMING =3D TRUE=0D DEFINE PLATFORM_BOOT_TIMEOUT =3D 3=0D #=0D # SBL: UEFI payload for Slim Bootloader=0D @@ -412,6 +413,9 @@ =0D gUefiPayloadPkgTokenSpaceGuid.PcdAbove4GMemory|$(ABOVE_4G_MEMORY)=0D =0D + # Disable MTRR programming=0D + gUefiCpuPkgTokenSpaceGuid.PcdCpuDisableMtrrProgramming|$(MTRR_PROGRAMMIN= G)=0D +=0D [PcdsPatchableInModule.X64]=0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)= =0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER= )=0D --=20 2.32.0