]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add the DriverFamilyOverride support in DxeCore.
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 24 May 2011 03:32:42 +0000 (03:32 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 24 May 2011 03:32:42 +0000 (03:32 +0000)
Signed-off-by: niruiyu
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11698 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg/Core/Dxe/DxeMain.inf
MdeModulePkg/Core/Dxe/Hand/DriverSupport.c

index e7ec3c856175928f40380d40f68bd51ef2eae9be..f5651026fa9c1cd3e1f1b95803854d9e7c06e615 100644 (file)
@@ -48,6 +48,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Protocol/Capsule.h>\r
 #include <Protocol/BusSpecificDriverOverride.h>\r
+#include <Protocol/DriverFamilyOverride.h>\r
 #include <Protocol/TcgService.h>\r
 #include <Protocol/HiiPackageList.h>\r
 #include <Protocol/SmmBase2.h>\r
index 8b99908df0b482dfb50d156a022d10be8b623c3a..e00ee8d28416573a9efd54cf07ef556320773cd9 100644 (file)
@@ -2,7 +2,7 @@
 #  This is core module in DXE phase. It provides an implementation of DXE Core that is\r
 #  compliant with DXE CIS.  \r
 #  \r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #  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
   gEfiMetronomeArchProtocolGuid                 ## CONSUMES\r
   gEfiTimerArchProtocolGuid                     ## CONSUMES\r
   gEfiBusSpecificDriverOverrideProtocolGuid     ## CONSUMES\r
+  gEfiDriverFamilyOverrideProtocolGuid          ## CONSUMES\r
   gEfiPlatformDriverOverrideProtocolGuid        ## CONSUMES\r
   gEfiDriverBindingProtocolGuid                 ## SOMETIMES_CONSUMES\r
   gEfiFirmwareVolumeBlockProtocolGuid           ## PRODUCES\r
index f542275a3dd3c4915a49913d15d6ee362698d704..16ebfec21c5e0bd873d668fa914b62ae5e9ba0f5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support functions to connect/disconnect UEFI Driver model Protocol\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -352,8 +352,10 @@ CoreConnectSingleController (
   UINTN                                      NewDriverBindingHandleCount;\r
   EFI_HANDLE                                 *NewDriverBindingHandleBuffer;\r
   EFI_DRIVER_BINDING_PROTOCOL                *DriverBinding;\r
+  EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL        *DriverFamilyOverride;\r
   UINTN                                      NumberOfSortedDriverBindingProtocols;\r
   EFI_DRIVER_BINDING_PROTOCOL                **SortedDriverBindingProtocols;\r
+  UINT32                                     DriverFamilyOverrideVersion;\r
   UINT32                                     HighestVersion;\r
   UINTN                                      HighestIndex;\r
   UINTN                                      SortIndex;\r
@@ -436,6 +438,41 @@ CoreConnectSingleController (
     } while (!EFI_ERROR (Status));\r
   }\r
 \r
+  //\r
+  // Add the Driver Family Override Protocol drivers for ControllerHandle\r
+  //\r
+  while (TRUE) {\r
+    HighestIndex   = DriverBindingHandleCount;\r
+    HighestVersion = 0;\r
+    for (Index = 0; Index < DriverBindingHandleCount; Index++) {\r
+      Status = CoreHandleProtocol (\r
+                 DriverBindingHandleBuffer[Index],\r
+                 &gEfiDriverFamilyOverrideProtocolGuid,\r
+                 (VOID **) &DriverFamilyOverride\r
+                 );\r
+      if (!EFI_ERROR (Status) && (DriverFamilyOverride != NULL)) {\r
+        DriverFamilyOverrideVersion = DriverFamilyOverride->GetVersion (DriverFamilyOverride);\r
+        if ((HighestIndex == DriverBindingHandleCount) || (DriverFamilyOverrideVersion > HighestVersion)) {\r
+          HighestVersion = DriverFamilyOverrideVersion;\r
+          HighestIndex   = Index;\r
+        }\r
+      }\r
+    }\r
+\r
+    if (HighestIndex == DriverBindingHandleCount) {\r
+      break;\r
+    }\r
+\r
+    AddSortedDriverBindingProtocol (\r
+      DriverBindingHandleBuffer[HighestIndex],\r
+      &NumberOfSortedDriverBindingProtocols,\r
+      SortedDriverBindingProtocols,\r
+      DriverBindingHandleCount,\r
+      DriverBindingHandleBuffer,\r
+      FALSE\r
+      );\r
+  }\r
+\r
   //\r
   // Get the Bus Specific Driver Override Protocol instance on the Controller Handle\r
   //\r