From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0C26381E9E for ; Thu, 19 Jan 2017 22:25:31 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 19 Jan 2017 22:25:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,257,1477983600"; d="scan'208";a="215568374" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 19 Jan 2017 22:25:30 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 19 Jan 2017 22:25:30 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 19 Jan 2017 22:25:29 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.177]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Fri, 20 Jan 2017 14:25:27 +0800 From: "Wei, David" To: "Lu, ShifeiX A" , "edk2-devel@lists.01.org" Thread-Topic: [Patch][edk2-platforms/devel-MinnowBoard3] Enable Mor. Thread-Index: AQHScuSzDzjJaQUUC0CNb8NjK6DJoKFA5hVQ Date: Fri, 20 Jan 2017 06:25:26 +0000 Message-ID: <89954A0B46707A448411A627AD4EEE3468EF3723@SHSMSX101.ccr.corp.intel.com> References: <4cf59319-3bf5-4fcb-a9c6-97d267eea76d@SHWDEOPENPSI011.local> In-Reply-To: <4cf59319-3bf5-4fcb-a9c6-97d267eea76d@SHWDEOPENPSI011.local> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch][edk2-platforms/devel-MinnowBoard3] Enable Mor. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2017 06:25:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: zwei4 Thanks, David Wei =20 -----Original Message----- From: Lu, ShifeiX A=20 Sent: Friday, January 20, 2017 2:16 PM To: edk2-devel@lists.01.org Cc: Wei, David Subject: [Patch][edk2-platforms/devel-MinnowBoard3] Enable Mor. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: lushifex --- .../Common/Acpi/AcpiTablesPCAT/Platform.asl | 13 ++-- .../MemoryTest/NullMemoryTestDxe/NullMemoryTest.c | 72 ++++++++---------= ---- .../MemoryTest/NullMemoryTestDxe/NullMemoryTest.h | 2 +- .../NullMemoryTestDxe/NullMemoryTestDxe.inf | 4 +- .../NullMemoryTestDxe/NullMemoryTestDxe.uni | Bin 2194 -> 2194 byte= s .../NullMemoryTestDxe/NullMemoryTestDxeExtra.uni | Bin 1372 -> 1372 byte= s .../BroxtonPlatformPkg/PlatformDsc/Components.dsc | 1 + Platform/BroxtonPlatformPkg/PlatformPkg.fdf | 1 + 8 files changed, 40 insertions(+), 53 deletions(-) diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Platfor= m.asl b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Platform.asl index 7847f2f..04ea3ad 100644 --- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Platform.asl +++ b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Platform.asl @@ -1,5 +1,5 @@ /** @file - Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -19,7 +19,6 @@ External(PDC1) External(PDC2) External(PDC3) External(\_PR.CPU0._PPC, IntObj) -External(\_SB.PCI0.LPCB.TPM.PTS, MethodObj) Name(ECUP, 1) // EC State indicator: 1- Normal Mode 0- Low Power Mode Mutex(EHLD, 0) // EC Hold indicator: 0- No one accessing the EC Power Stat= e 1- Someone else is accessing the EC Power State =20 @@ -153,10 +152,12 @@ Method(_PTS,1) //clear GPE0_STS Store(Ones, G0S) =20 - // - // Call TPM PTS method - // - \_SB.TPM.PTS (Arg0) + If (CondRefOf(\_SB.TPM.PTS)) { + // + // Call TPM PTS method + // + \_SB.TPM.PTS (Arg0) + } =20 // // Set GPIO_116 (SOC_CODEC_IRQ) 20k pull-down for device I2S audio codec= INT343A before enter S3/S4 diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Uni= versal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c b/Platform/BroxtonPlat= formPkg/Common/SampleCode/MdeModulePkg/Universal/MemoryTest/NullMemoryTestD= xe/NullMemoryTest.c index a3f5971..b506f13 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/= MemoryTest/NullMemoryTestDxe/NullMemoryTest.c +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/= MemoryTest/NullMemoryTestDxe/NullMemoryTest.c @@ -2,7 +2,7 @@ Implementation of Generic Memory Test Protocol which does not perform re= al memory test. Also clears memory when the MemoryOverwriteRequest bit is set. =20 - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -19,7 +19,6 @@ #include #include #include -#include =20 UINT64 mTestedSystemMemory =3D 0; UINT64 mTotalSystemMemory =3D 0; @@ -151,19 +150,12 @@ BOOLEAN IsMemoryOverwriteRequested ( ) { - BOOLEAN bRetValue =3D 0; - EFI_STATUS Status; - UINT64 MemoryOverwriteReq =3D 0; - UINTN VariableSize; - UINT8 CmosRegValue; - - DEBUG((EFI_D_INFO, "+IsMemoryOverwriteRequested\n")); + BOOLEAN bRetValue =3D 0; + EFI_STATUS Status; + UINT64 MemoryOverwriteReq =3D 0; + UINTN VariableSize; =20 - // - // Read the CMOS Register EFI_CMOS_CLEAN_RESET - // - IoWrite8(CmosIo_72, EFI_CMOS_CLEAN_RESET); - CmosRegValue =3D IoRead8(CmosIo_73); + DEBUG ((EFI_D_INFO, "IsMemoryOverwriteRequested\n")); =20 // // Get the MOR variable @@ -187,25 +179,18 @@ IsMemoryOverwriteRequested ( &MemoryOverwriteReq ); } else { + MemoryOverwriteReq =3D 0; DEBUG ((EFI_D_ERROR, "IsMemoryOverwriteRequested: Failed to Get MOR = Variable - Status =3D %r\n", Status)); } goto Exit; } - - DEBUG ((EFI_D_INFO, "IsMemoryOverwriteRequested: MOR Control Value =3D %= 02x, CmosRegValue =3D %02x\n", MemoryOverwriteReq, CmosRegValue)); - - if ((MOR_CLEAR_MEMORY_VALUE(MemoryOverwriteReq)) && - (((CmosRegValue !=3D B_MAGIC_CLEAN_RESET_VALUE) && (MOR_DISABLE_AUTO_D= ETECT_VALUE(MemoryOverwriteReq) =3D=3D 0)) || - (MOR_DISABLE_AUTO_DETECT_VALUE(MemoryOverwriteReq) =3D=3D 1)) - ) - { - DEBUG((EFI_D_INFO, "IsMemoryOverwriteRequested: Un-controlled Reset de= tected and hence requesting the Memory Clear\n")); + if (MOR_CLEAR_MEMORY_VALUE (MemoryOverwriteReq)) { + DEBUG ((EFI_D_INFO, "IsMemoryOverwriteRequested: Un-controlled Reset d= etected and hence requesting the Memory Clear\n")); bRetValue =3D 1; } =20 Exit: - IoWrite8(CmosIo_73, B_MAGIC_INIT_VALUE); // Initialize to a known value - DEBUG((EFI_D_INFO, "-IsMemoryOverwriteRequested: bRetValue =3D %d\n", bR= etValue)); + DEBUG ((EFI_D_INFO, "IsMemoryOverwriteRequested: bRetValue =3D %d\n", bR= etValue)); return bRetValue; } =20 @@ -219,16 +204,15 @@ HandleMorRequest ( // // Check if there is a need for memory overwrite. // - bCleanMemory =3D IsMemoryOverwriteRequested(); + bCleanMemory =3D IsMemoryOverwriteRequested (); =20 // // Clear memory if OS requested a memory overwrite operation. // This is being done for the memory used by OS =3D> Stolen memory is no= t cleared as OS cannot store keys in UEFI Stolen memory // - if (bCleanMemory) - { - DEBUG((EFI_D_INFO, "Clearing the memory per MOR request.\n")); - ClearAvailableSystemMemory(); + if (bCleanMemory) { + DEBUG ((EFI_D_INFO, "Clearing the memory per MOR request.\n")); + ClearAvailableSystemMemory (); } =20 return; @@ -308,17 +292,17 @@ InitializeMemoryTest ( // For those reserved memory that have not been tested, simply promo= te to system memory. // gDS->RemoveMemorySpace ( - MemorySpaceMap[Index].BaseAddress, - MemorySpaceMap[Index].Length - ); + MemorySpaceMap[Index].BaseAddress, + MemorySpaceMap[Index].Length + ); =20 gDS->AddMemorySpace ( - EfiGcdMemoryTypeSystemMemory, - MemorySpaceMap[Index].BaseAddress, - MemorySpaceMap[Index].Length, - MemorySpaceMap[Index].Capabilities &~ - (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TEST= ED | EFI_MEMORY_RUNTIME) - ); + EfiGcdMemoryTypeSystemMemory, + MemorySpaceMap[Index].BaseAddress, + MemorySpaceMap[Index].Length, + MemorySpaceMap[Index].Capabilities &~ + (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TES= TED | EFI_MEMORY_RUNTIME) + ); =20 mTestedSystemMemory +=3D MemorySpaceMap[Index].Length; mTotalSystemMemory +=3D MemorySpaceMap[Index].Length; @@ -425,11 +409,11 @@ GenCompatibleRangeTest ( gDS->RemoveMemorySpace (StartAddress, Length); =20 gDS->AddMemorySpace ( - EfiGcdMemoryTypeSystemMemory, - StartAddress, - Length, - Descriptor.Capabilities &~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIAL= IZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME) - ); + EfiGcdMemoryTypeSystemMemory, + StartAddress, + Length, + Descriptor.Capabilities &~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIA= LIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME) + ); =20 return EFI_SUCCESS; } diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Uni= versal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h b/Platform/BroxtonPlat= formPkg/Common/SampleCode/MdeModulePkg/Universal/MemoryTest/NullMemoryTestD= xe/NullMemoryTest.h index 5065bf9..a7f453d 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/= MemoryTest/NullMemoryTestDxe/NullMemoryTest.h +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/= MemoryTest/NullMemoryTestDxe/NullMemoryTest.h @@ -1,7 +1,7 @@ /** @file Include file of the NULL memory test driver. =20 - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Uni= versal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf b/Platform/Broxto= nPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/MemoryTest/NullMemory= TestDxe/NullMemoryTestDxe.inf index 3db2784..fdbb089 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/= MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/= MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf @@ -2,7 +2,7 @@ # This driver installs Generic Memory Test Protocol which does not perfor= m real memory test. # Also clears memory when the MemoryOverwriteRequest bit is set. # -# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -36,7 +36,7 @@ [Packages] MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec - BroxtonPlatformPkg/PlatformPkg.dec # required for CMOSMap.h + BroxtonPlatformPkg/PlatformPkg.dec =20 [LibraryClasses] MemoryAllocationLib diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Uni= versal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.uni b/Platform/Broxto= nPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/MemoryTest/NullMemory= TestDxe/NullMemoryTestDxe.uni index 5dd1545aa796652aea0686060dfa5da6793dc32a..e08347d80d260cffcf139590514= cb810d0c8b145 100644 GIT binary patch delta 14 VcmbOvI7x7W6eFYgW@*N9b^soL1D5~* delta 14 VcmbOvI7x7W6eFYAW@*N9b^soF1C{^) diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Uni= versal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxeExtra.uni b/Platform/B= roxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/MemoryTest/NullM= emoryTestDxe/NullMemoryTestDxeExtra.uni index 997aba5a6ef429bdff615e25d28073938cd51eab..5ec80856921237fc5732b0f4757= 5f0e7f68076a8 100644 GIT binary patch delta 12 Ucmcb^b%$%h5k~WkN2jv@03`MWY5)KL delta 12 Ucmcb^b%$%h5k|9(N2jv@03`7RX#fBK diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc b/Platf= orm/BroxtonPlatformPkg/PlatformDsc/Components.dsc index 0edcd98..1366b2b 100644 --- a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc +++ b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc @@ -185,6 +185,7 @@ =20 !if $(FTPM_ENABLE) =3D=3D TRUE SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf + SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLockSmm.inf =20 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf { diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf b/Platform/Broxton= PlatformPkg/PlatformPkg.fdf index 404efd1..790f188 100644 --- a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf +++ b/Platform/BroxtonPlatformPkg/PlatformPkg.fdf @@ -533,6 +533,7 @@ APRIORI DXE { =20 !if $(FTPM_ENABLE) =3D=3D TRUE INF SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.inf + INF SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLockSmm.inf INF RuleOverride =3D DRIVER_ACPITABLE $(PLATFORM_PACKAGE_COMMON)/SampleC= ode/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf !endif =20 --=20 2.7.0.windows.1