]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StandaloneMmPkg/Core: remove legacy boot support
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 5 Mar 2019 09:14:12 +0000 (10:14 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 11 Mar 2019 11:51:12 +0000 (12:51 +0100)
Remove the support for booting 'legacy' (i.e., non-UEFI boot) OSes.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Achin Gupta <achin.gupta@arm.com>
StandaloneMmPkg/Core/StandaloneMmCore.c
StandaloneMmPkg/Core/StandaloneMmCore.h

index 766cdb5c848c22b23d5c4a9d625cde6252eb5637..fb6b3055e9c6da1fd4be0af78971bfd01e10fce7 100644 (file)
@@ -87,21 +87,12 @@ EFI_MM_SYSTEM_TABLE  gMmCoreMmst = {
   MmiHandlerUnRegister\r
 };\r
 \r
-//\r
-// Flag to determine if the platform has performed a legacy boot.\r
-// If this flag is TRUE, then the runtime code and runtime data associated with the\r
-// MM IPL are converted to free memory, so the MM Core must guarantee that is\r
-// does not touch of the code/data associated with the MM IPL if this flag is TRUE.\r
-//\r
-BOOLEAN  mInLegacyBoot = FALSE;\r
-\r
 //\r
 // Table of MMI Handlers that are registered by the MM Core when it is initialized\r
 //\r
 MM_CORE_MMI_HANDLERS  mMmCoreMmiHandlers[] = {\r
   { MmReadyToLockHandler,    &gEfiDxeMmReadyToLockProtocolGuid,  NULL, TRUE  },\r
   { MmEndOfDxeHandler,       &gEfiEndOfDxeEventGroupGuid,        NULL, FALSE },\r
-  { MmLegacyBootHandler,     &gEfiEventLegacyBootGuid,           NULL, FALSE },\r
   { MmExitBootServiceHandler,&gEfiEventExitBootServicesGuid,     NULL, FALSE },\r
   { MmReadyToBootHandler,    &gEfiEventReadyToBootGuid,          NULL, FALSE },\r
   { NULL,                    NULL,                               NULL, FALSE },\r
@@ -142,47 +133,6 @@ MmEfiNotAvailableYetArg5 (
   return EFI_NOT_AVAILABLE_YET;\r
 }\r
 \r
-/**\r
-  Software MMI handler that is called when a Legacy Boot event is signaled.  The MM\r
-  Core uses this signal to know that a Legacy Boot has been performed and that\r
-  gMmCorePrivate that is shared between the UEFI and MM execution environments can\r
-  not be accessed from MM anymore since that structure is considered free memory by\r
-  a legacy OS.\r
-\r
-  @param  DispatchHandle  The unique handle assigned to this handler by MmiHandlerRegister().\r
-  @param  Context         Points to an optional handler context which was specified when the handler was registered.\r
-  @param  CommBuffer      A pointer to a collection of data in memory that will\r
-                          be conveyed from a non-MM environment into an MM environment.\r
-  @param  CommBufferSize  The size of the CommBuffer.\r
-\r
-  @return Status Code\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MmLegacyBootHandler (\r
-  IN     EFI_HANDLE  DispatchHandle,\r
-  IN     CONST VOID  *Context,        OPTIONAL\r
-  IN OUT VOID        *CommBuffer,     OPTIONAL\r
-  IN OUT UINTN       *CommBufferSize  OPTIONAL\r
-  )\r
-{\r
-  EFI_HANDLE  MmHandle;\r
-  EFI_STATUS  Status = EFI_SUCCESS;\r
-\r
-  if (!mInLegacyBoot) {\r
-    MmHandle = NULL;\r
-    Status = MmInstallProtocolInterface (\r
-               &MmHandle,\r
-               &gEfiEventLegacyBootGuid,\r
-               EFI_NATIVE_INTERFACE,\r
-               NULL\r
-               );\r
-  }\r
-  mInLegacyBoot = TRUE;\r
-  return Status;\r
-}\r
-\r
 /**\r
   Software MMI handler that is called when a ExitBoot Service event is signaled.\r
 \r
@@ -396,7 +346,6 @@ MmEntryPoint (
 {\r
   EFI_STATUS                  Status;\r
   EFI_MM_COMMUNICATE_HEADER  *CommunicateHeader;\r
-  BOOLEAN                     InLegacyBoot;\r
 \r
   DEBUG ((DEBUG_INFO, "MmEntryPoint ...\n"));\r
 \r
@@ -413,44 +362,42 @@ MmEntryPoint (
   //\r
   // If a legacy boot has occured, then make sure gMmCorePrivate is not accessed\r
   //\r
-  InLegacyBoot = mInLegacyBoot;\r
-  if (!InLegacyBoot) {\r
-    //\r
-    // TBD: Mark the InMm flag as TRUE\r
-    //\r
-    gMmCorePrivate->InMm = TRUE;\r
 \r
+  //\r
+  // TBD: Mark the InMm flag as TRUE\r
+  //\r
+  gMmCorePrivate->InMm = TRUE;\r
+\r
+  //\r
+  // Check to see if this is a Synchronous MMI sent through the MM Communication\r
+  // Protocol or an Asynchronous MMI\r
+  //\r
+  if (gMmCorePrivate->CommunicationBuffer != 0) {\r
     //\r
-    // Check to see if this is a Synchronous MMI sent through the MM Communication\r
-    // Protocol or an Asynchronous MMI\r
+    // Synchronous MMI for MM Core or request from Communicate protocol\r
     //\r
-    if (gMmCorePrivate->CommunicationBuffer != 0) {\r
+    if (!MmIsBufferOutsideMmValid ((UINTN)gMmCorePrivate->CommunicationBuffer, gMmCorePrivate->BufferSize)) {\r
+      //\r
+      // If CommunicationBuffer is not in valid address scope, return EFI_INVALID_PARAMETER\r
       //\r
-      // Synchronous MMI for MM Core or request from Communicate protocol\r
+      gMmCorePrivate->CommunicationBuffer = 0;\r
+      gMmCorePrivate->ReturnStatus = EFI_INVALID_PARAMETER;\r
+    } else {\r
+      CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)(UINTN)gMmCorePrivate->CommunicationBuffer;\r
+      gMmCorePrivate->BufferSize -= OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);\r
+      Status = MmiManage (\r
+                 &CommunicateHeader->HeaderGuid,\r
+                 NULL,\r
+                 CommunicateHeader->Data,\r
+                 (UINTN *)&gMmCorePrivate->BufferSize\r
+                 );\r
       //\r
-      if (!MmIsBufferOutsideMmValid ((UINTN)gMmCorePrivate->CommunicationBuffer, gMmCorePrivate->BufferSize)) {\r
-        //\r
-        // If CommunicationBuffer is not in valid address scope, return EFI_INVALID_PARAMETER\r
-        //\r
-        gMmCorePrivate->CommunicationBuffer = 0;\r
-        gMmCorePrivate->ReturnStatus = EFI_INVALID_PARAMETER;\r
-      } else {\r
-        CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)(UINTN)gMmCorePrivate->CommunicationBuffer;\r
-        gMmCorePrivate->BufferSize -= OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);\r
-        Status = MmiManage (\r
-                   &CommunicateHeader->HeaderGuid,\r
-                   NULL,\r
-                   CommunicateHeader->Data,\r
-                   (UINTN *)&gMmCorePrivate->BufferSize\r
-                   );\r
-        //\r
-        // Update CommunicationBuffer, BufferSize and ReturnStatus\r
-        // Communicate service finished, reset the pointer to CommBuffer to NULL\r
-        //\r
-        gMmCorePrivate->BufferSize += OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);\r
-        gMmCorePrivate->CommunicationBuffer = 0;\r
-        gMmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
-      }\r
+      // Update CommunicationBuffer, BufferSize and ReturnStatus\r
+      // Communicate service finished, reset the pointer to CommBuffer to NULL\r
+      //\r
+      gMmCorePrivate->BufferSize += OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);\r
+      gMmCorePrivate->CommunicationBuffer = 0;\r
+      gMmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
     }\r
   }\r
 \r
@@ -464,14 +411,9 @@ MmEntryPoint (
   //\r
 \r
   //\r
-  // If a legacy boot has occured, then make sure gMmCorePrivate is not accessed\r
+  // Clear the InMm flag as we are going to leave MM\r
   //\r
-  if (!InLegacyBoot) {\r
-    //\r
-    // Clear the InMm flag as we are going to leave MM\r
-    //\r
-    gMmCorePrivate->InMm = FALSE;\r
-  }\r
+  gMmCorePrivate->InMm = FALSE;\r
 \r
   DEBUG ((DEBUG_INFO, "MmEntryPoint Done\n"));\r
 }\r
index 74338dc9da0d7442b793cf5d5cef9a4533913373..5d336b3dbbf6af22337f8d7c51318c702c915a41 100644 (file)
@@ -635,28 +635,6 @@ MmDriverDispatchHandler (
 \r
   @return Status Code\r
 \r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MmLegacyBootHandler (\r
-  IN     EFI_HANDLE               DispatchHandle,\r
-  IN     CONST VOID               *Context,        OPTIONAL\r
-  IN OUT VOID                     *CommBuffer,     OPTIONAL\r
-  IN OUT UINTN                    *CommBufferSize  OPTIONAL\r
-  );\r
-\r
-/**\r
-  This function is the main entry point for an MM handler dispatch\r
-  or communicate-based callback.\r
-\r
-  @param  DispatchHandle  The unique handle assigned to this handler by MmiHandlerRegister().\r
-  @param  Context         Points to an optional handler context which was specified when the handler was registered.\r
-  @param  CommBuffer      A pointer to a collection of data in memory that will\r
-                          be conveyed from a non-MM environment into an MM environment.\r
-  @param  CommBufferSize  The size of the CommBuffer.\r
-\r
-  @return Status Code\r
-\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r