From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 8E3BB211D3917 for ; Tue, 5 Mar 2019 05:52:47 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 05:52:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,444,1544515200"; d="scan'208";a="131407039" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 05 Mar 2019 05:52:42 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 5 Mar 2019 05:52:41 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.163]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.134]) with mapi id 14.03.0415.000; Tue, 5 Mar 2019 21:52:25 +0800 From: "Yao, Jiewen" To: Ard Biesheuvel , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH 09/10] StandaloneMmPkg/Core: remove legacy boot support Thread-Index: AQHU01gPNfP2qQ9UDkaLDbd/E1GMFaX9DpSg Date: Tue, 5 Mar 2019 13:52:24 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F54CDCD@shsmsx102.ccr.corp.intel.com> References: <20190305133248.4828-1-ard.biesheuvel@linaro.org> <20190305133248.4828-10-ard.biesheuvel@linaro.org> In-Reply-To: <20190305133248.4828-10-ard.biesheuvel@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGI0YzI0OTEtNmViOC00MzE2LTg0YTgtOTk3ZDllZDVjZDUxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMTh4Y0Z3c0tjQ0t4anZWODMxQmZqcUE3ZktmV0NmeWlhRzJvVk82R3RWbDhMZmU3ZjhaelZSMjBRK3NqUTVRQSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 09/10] StandaloneMmPkg/Core: remove legacy boot support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2019 13:52:48 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ard Biesheuvel > Sent: Tuesday, March 5, 2019 5:33 AM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen > Subject: [edk2] [PATCH 09/10] StandaloneMmPkg/Core: remove legacy boot > support >=20 > Remove the support for booting 'legacy' (i.e., non-UEFI boot) OSes. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > StandaloneMmPkg/Core/StandaloneMmCore.h | 22 ---- > StandaloneMmPkg/Core/StandaloneMmCore.c | 124 ++++++-------------- > 2 files changed, 33 insertions(+), 113 deletions(-) >=20 > diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h > b/StandaloneMmPkg/Core/StandaloneMmCore.h > index 74338dc9da0d..5d336b3dbbf6 100644 > --- a/StandaloneMmPkg/Core/StandaloneMmCore.h > +++ b/StandaloneMmPkg/Core/StandaloneMmCore.h > @@ -635,28 +635,6 @@ MmDriverDispatchHandler ( >=20 > @return Status Code >=20 > -**/ > -EFI_STATUS > -EFIAPI > -MmLegacyBootHandler ( > - IN EFI_HANDLE DispatchHandle, > - IN CONST VOID *Context, OPTIONAL > - IN OUT VOID *CommBuffer, OPTIONAL > - IN OUT UINTN *CommBufferSize OPTIONAL > - ); > - > -/** > - This function is the main entry point for an MM handler dispatch > - or communicate-based callback. > - > - @param DispatchHandle The unique handle assigned to this handler > by MmiHandlerRegister(). > - @param Context Points to an optional handler context > which was specified when the handler was registered. > - @param CommBuffer A pointer to a collection of data in > memory that will > - be conveyed from a non-MM environment > into an MM environment. > - @param CommBufferSize The size of the CommBuffer. > - > - @return Status Code > - > **/ > EFI_STATUS > EFIAPI > diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c > b/StandaloneMmPkg/Core/StandaloneMmCore.c > index 766cdb5c848c..fb6b3055e9c6 100644 > --- a/StandaloneMmPkg/Core/StandaloneMmCore.c > +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c > @@ -87,21 +87,12 @@ EFI_MM_SYSTEM_TABLE gMmCoreMmst =3D { > MmiHandlerUnRegister > }; >=20 > -// > -// Flag to determine if the platform has performed a legacy boot. > -// If this flag is TRUE, then the runtime code and runtime data associat= ed > with the > -// MM IPL are converted to free memory, so the MM Core must guarantee > that is > -// does not touch of the code/data associated with the MM IPL if this fl= ag is > TRUE. > -// > -BOOLEAN mInLegacyBoot =3D FALSE; > - > // > // Table of MMI Handlers that are registered by the MM Core when it is > initialized > // > MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] =3D { > { MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, > NULL, TRUE }, > { MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, > NULL, FALSE }, > - { MmLegacyBootHandler, &gEfiEventLegacyBootGuid, > NULL, FALSE }, > { MmExitBootServiceHandler,&gEfiEventExitBootServicesGuid, > NULL, FALSE }, > { MmReadyToBootHandler, &gEfiEventReadyToBootGuid, > NULL, FALSE }, > { NULL, NULL, > NULL, FALSE }, > @@ -142,47 +133,6 @@ MmEfiNotAvailableYetArg5 ( > return EFI_NOT_AVAILABLE_YET; > } >=20 > -/** > - Software MMI handler that is called when a Legacy Boot event is signal= ed. > The MM > - Core uses this signal to know that a Legacy Boot has been performed an= d > that > - gMmCorePrivate that is shared between the UEFI and MM execution > environments can > - not be accessed from MM anymore since that structure is considered > free memory by > - a legacy OS. > - > - @param DispatchHandle The unique handle assigned to this handler > by MmiHandlerRegister(). > - @param Context Points to an optional handler context > which was specified when the handler was registered. > - @param CommBuffer A pointer to a collection of data in > memory that will > - be conveyed from a non-MM environment > into an MM environment. > - @param CommBufferSize The size of the CommBuffer. > - > - @return Status Code > - > -**/ > -EFI_STATUS > -EFIAPI > -MmLegacyBootHandler ( > - IN EFI_HANDLE DispatchHandle, > - IN CONST VOID *Context, OPTIONAL > - IN OUT VOID *CommBuffer, OPTIONAL > - IN OUT UINTN *CommBufferSize OPTIONAL > - ) > -{ > - EFI_HANDLE MmHandle; > - EFI_STATUS Status =3D EFI_SUCCESS; > - > - if (!mInLegacyBoot) { > - MmHandle =3D NULL; > - Status =3D MmInstallProtocolInterface ( > - &MmHandle, > - &gEfiEventLegacyBootGuid, > - EFI_NATIVE_INTERFACE, > - NULL > - ); > - } > - mInLegacyBoot =3D TRUE; > - return Status; > -} > - > /** > Software MMI handler that is called when a ExitBoot Service event is > signaled. >=20 > @@ -396,7 +346,6 @@ MmEntryPoint ( > { > EFI_STATUS Status; > EFI_MM_COMMUNICATE_HEADER *CommunicateHeader; > - BOOLEAN InLegacyBoot; >=20 > DEBUG ((DEBUG_INFO, "MmEntryPoint ...\n")); >=20 > @@ -413,44 +362,42 @@ MmEntryPoint ( > // > // If a legacy boot has occured, then make sure gMmCorePrivate is not > accessed > // > - InLegacyBoot =3D mInLegacyBoot; > - if (!InLegacyBoot) { > - // > - // TBD: Mark the InMm flag as TRUE > - // > - gMmCorePrivate->InMm =3D TRUE; >=20 > + // > + // TBD: Mark the InMm flag as TRUE > + // > + gMmCorePrivate->InMm =3D TRUE; > + > + // > + // Check to see if this is a Synchronous MMI sent through the MM > Communication > + // Protocol or an Asynchronous MMI > + // > + if (gMmCorePrivate->CommunicationBuffer !=3D 0) { > // > - // Check to see if this is a Synchronous MMI sent through the MM > Communication > - // Protocol or an Asynchronous MMI > + // Synchronous MMI for MM Core or request from Communicate > protocol > // > - if (gMmCorePrivate->CommunicationBuffer !=3D 0) { > + if (!MmIsBufferOutsideMmValid > ((UINTN)gMmCorePrivate->CommunicationBuffer, > gMmCorePrivate->BufferSize)) { > + // > + // If CommunicationBuffer is not in valid address scope, return > EFI_INVALID_PARAMETER > + // > + gMmCorePrivate->CommunicationBuffer =3D 0; > + gMmCorePrivate->ReturnStatus =3D EFI_INVALID_PARAMETER; > + } else { > + CommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER > *)(UINTN)gMmCorePrivate->CommunicationBuffer; > + gMmCorePrivate->BufferSize -=3D OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > + Status =3D MmiManage ( > + &CommunicateHeader->HeaderGuid, > + NULL, > + CommunicateHeader->Data, > + (UINTN *)&gMmCorePrivate->BufferSize > + ); > // > - // Synchronous MMI for MM Core or request from Communicate > protocol > + // Update CommunicationBuffer, BufferSize and ReturnStatus > + // Communicate service finished, reset the pointer to CommBuffer > to NULL > // > - if (!MmIsBufferOutsideMmValid > ((UINTN)gMmCorePrivate->CommunicationBuffer, > gMmCorePrivate->BufferSize)) { > - // > - // If CommunicationBuffer is not in valid address scope, return > EFI_INVALID_PARAMETER > - // > - gMmCorePrivate->CommunicationBuffer =3D 0; > - gMmCorePrivate->ReturnStatus =3D EFI_INVALID_PARAMETER; > - } else { > - CommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER > *)(UINTN)gMmCorePrivate->CommunicationBuffer; > - gMmCorePrivate->BufferSize -=3D OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > - Status =3D MmiManage ( > - &CommunicateHeader->HeaderGuid, > - NULL, > - CommunicateHeader->Data, > - (UINTN *)&gMmCorePrivate->BufferSize > - ); > - // > - // Update CommunicationBuffer, BufferSize and ReturnStatus > - // Communicate service finished, reset the pointer to > CommBuffer to NULL > - // > - gMmCorePrivate->BufferSize +=3D OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > - gMmCorePrivate->CommunicationBuffer =3D 0; > - gMmCorePrivate->ReturnStatus =3D (Status =3D=3D EFI_SUCCESS) ? > EFI_SUCCESS : EFI_NOT_FOUND; > - } > + gMmCorePrivate->BufferSize +=3D OFFSET_OF > (EFI_MM_COMMUNICATE_HEADER, Data); > + gMmCorePrivate->CommunicationBuffer =3D 0; > + gMmCorePrivate->ReturnStatus =3D (Status =3D=3D EFI_SUCCESS) ? > EFI_SUCCESS : EFI_NOT_FOUND; > } > } >=20 > @@ -464,14 +411,9 @@ MmEntryPoint ( > // >=20 > // > - // If a legacy boot has occured, then make sure gMmCorePrivate is not > accessed > + // Clear the InMm flag as we are going to leave MM > // > - if (!InLegacyBoot) { > - // > - // Clear the InMm flag as we are going to leave MM > - // > - gMmCorePrivate->InMm =3D FALSE; > - } > + gMmCorePrivate->InMm =3D FALSE; >=20 > DEBUG ((DEBUG_INFO, "MmEntryPoint Done\n")); > } > -- > 2.20.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel