]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c
Bug Fix in DxeSmmDriverEntryLib.
[mirror_edk2.git] / IntelFrameworkPkg / Library / DxeSmmDriverEntryPoint / DriverEntryPoint.c
index cf50f2395beb67ef13fde85ec8ac146f84e8422d..539adc1345dcfc6a73e94f2a0fb9d3df2a34ef22 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
-  Entry point to a EFI/DXE driver.\r
+  This file implement EfiMain() for library class DxeSmmDriverEntryPoint.\r
+  EfiMain() is common driver entry point for all SMM driver who uses DxeSmmDriverEntryPoint\r
+  library class.\r
 \r
 Copyright (c) 2006, Intel Corporation<BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -12,13 +14,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#include <FrameworkDxe.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/DxeSmmDriverEntryPoint.h>\r
+\r
+#include <FrameworkSmm.h>\r
 \r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/SmmBase.h>\r
+#include <Protocol/DevicePath.h>\r
+\r
+#include <Library/DxeSmmDriverEntryPoint.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
 \r
 EFI_BOOT_SERVICES  *mBS;\r
 \r
@@ -127,26 +133,14 @@ _DriverUnloadHandler (
   EFI_HANDLE ImageHandle\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
-\r
-  //\r
-  // Call the unload handlers for all the modules\r
   //\r
-  Status = ProcessModuleUnloadList (ImageHandle);\r
-\r
+  // Call the unload handlers for all the modules.\r
+  // \r
+  // Note: All libraries were constructed in SMM space, \r
+  // therefore we can not destruct them in Unload \r
+  // handler.\r
   //\r
-  // If the driver specific unload handler does not return an error, then call all of the\r
-  // library destructors.  If the unload handler returned an error, then the driver can not be\r
-  // unloaded, and the library destructors should not be called\r
-  //\r
-  if (!EFI_ERROR (Status)) {\r
-    ProcessLibraryDestructorList (ImageHandle, gST);\r
-  }\r
-\r
-  //\r
-  // Return the status from the driver specific unload handler\r
-  //\r
-  return Status;\r
+  return ProcessModuleUnloadList (ImageHandle);\r
 }\r
 \r
 /**\r