]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueSmmDriverEntryPoint.c
Add 4 Framework/PI SMM thunk drivers. Combined use of these drivers can support usage...
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / EntryPoints / EdkIIGlueSmmDriverEntryPoint.c
index 9d5f467cfdfeb15a1fcf53fa8802c3d6be2b2b19..6dd128af8c8f83225934499bac6d9bc0c0ac141d 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2004 - 2006, Intel Corporation                                                         \r
+Copyright (c) 2004 - 2009, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -314,19 +314,14 @@ _ModuleEntryPoint (
   EFI_HANDLE                 Handle;\r
 \r
   //\r
-  // Cache a pointer to the Boot Services Table \r
+  // Call constructor for all libraries\r
   //\r
-  mBS = SystemTable->BootServices;\r
+  ProcessLibraryConstructorList (ImageHandle, SystemTable);\r
 \r
   //\r
-  // Retrieve the Loaded Image Protocol\r
+  // Cache a pointer to the Boot Services Table \r
   //\r
-  Status = mBS->HandleProtocol (\r
-                  ImageHandle, \r
-                  &gEfiLoadedImageProtocolGuid,\r
-                  (VOID*)&LoadedImage\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
+  mBS = SystemTable->BootServices;\r
 \r
   //\r
   // Retrieve SMM Base Protocol\r
@@ -347,6 +342,27 @@ _ModuleEntryPoint (
   //\r
   //\r
   if (!InSmm) {\r
+    //\r
+    // Retrieve the Loaded Image Protocol\r
+    //\r
+    Status = mBS->HandleProtocol (\r
+                    ImageHandle, \r
+                    &gEfiLoadedImageProtocolGuid,\r
+                    (VOID*)&LoadedImage\r
+                    );\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    //\r
+    // Install the unload handler\r
+    //\r
+    Status = mBS->HandleProtocol (\r
+                      ImageHandle,\r
+                      &gEfiLoadedImageProtocolGuid,\r
+                      (VOID **)&LoadedImage\r
+                      );\r
+    ASSERT_EFI_ERROR (Status);\r
+    LoadedImage->Unload = _DriverUnloadHandler;\r
+\r
     //\r
     // Retrieve the Device Path Protocol from the DeviceHandle tha this driver was loaded from\r
     //\r
@@ -368,33 +384,17 @@ _ModuleEntryPoint (
     //\r
     Status = SmmBase->Register (SmmBase, CompleteFilePath, NULL, 0, &Handle, FALSE);\r
     ASSERT_EFI_ERROR (Status);\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Call constructor for all libraries\r
-  //\r
-  ProcessLibraryConstructorList (ImageHandle, SystemTable);\r
-\r
-  //\r
-  // Install the unload handler\r
-  //\r
-  Status = mBS->HandleProtocol (\r
-                    ImageHandle,\r
-                    &gEfiLoadedImageProtocolGuid,\r
-                    (VOID **)&LoadedImage\r
-                    );\r
-  ASSERT_EFI_ERROR (Status);\r
-  LoadedImage->Unload = _DriverUnloadHandler;\r
+  } else {\r
 \r
-  //\r
-  // Call the list of driver entry points\r
-  //\r
-  #ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__\r
-  Status = (__EDKII_GLUE_MODULE_ENTRY_POINT__ (ImageHandle, SystemTable));\r
-  #else\r
-  Status = EFI_SUCCESS;\r
-  #endif\r
+    //\r
+    // Call the list of driver entry points\r
+    //\r
+    #ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__\r
+    Status = (__EDKII_GLUE_MODULE_ENTRY_POINT__ (ImageHandle, SystemTable));\r
+    #else\r
+    Status = EFI_SUCCESS;\r
+    #endif\r
+  }\r
 \r
   if (EFI_ERROR (Status)) {\r
     ProcessLibraryDestructorList (ImageHandle, SystemTable);\r