From 396e9039aec00982e98392a843635c1dcff5364d Mon Sep 17 00:00:00 2001 From: niruiyu Date: Tue, 24 May 2011 03:32:42 +0000 Subject: Add the DriverFamilyOverride support in DxeCore. 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 | 1 + MdeModulePkg/Core/Dxe/DxeMain.inf | 3 ++- MdeModulePkg/Core/Dxe/Hand/DriverSupport.c | 39 +++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index e7ec3c8..f565102 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -48,6 +48,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf index 8b99908..e00ee8d 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -2,7 +2,7 @@ # This is core module in DXE phase. It provides an implementation of DXE Core that is # compliant with DXE CIS. # -# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -129,6 +129,7 @@ gEfiMetronomeArchProtocolGuid ## CONSUMES gEfiTimerArchProtocolGuid ## CONSUMES gEfiBusSpecificDriverOverrideProtocolGuid ## CONSUMES + gEfiDriverFamilyOverrideProtocolGuid ## CONSUMES gEfiPlatformDriverOverrideProtocolGuid ## CONSUMES gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMES gEfiFirmwareVolumeBlockProtocolGuid ## PRODUCES diff --git a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c index f542275..16ebfec 100644 --- a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c +++ b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c @@ -1,7 +1,7 @@ /** @file Support functions to connect/disconnect UEFI Driver model Protocol -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -352,8 +352,10 @@ CoreConnectSingleController ( UINTN NewDriverBindingHandleCount; EFI_HANDLE *NewDriverBindingHandleBuffer; EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; + EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL *DriverFamilyOverride; UINTN NumberOfSortedDriverBindingProtocols; EFI_DRIVER_BINDING_PROTOCOL **SortedDriverBindingProtocols; + UINT32 DriverFamilyOverrideVersion; UINT32 HighestVersion; UINTN HighestIndex; UINTN SortIndex; @@ -437,6 +439,41 @@ CoreConnectSingleController ( } // + // Add the Driver Family Override Protocol drivers for ControllerHandle + // + while (TRUE) { + HighestIndex = DriverBindingHandleCount; + HighestVersion = 0; + for (Index = 0; Index < DriverBindingHandleCount; Index++) { + Status = CoreHandleProtocol ( + DriverBindingHandleBuffer[Index], + &gEfiDriverFamilyOverrideProtocolGuid, + (VOID **) &DriverFamilyOverride + ); + if (!EFI_ERROR (Status) && (DriverFamilyOverride != NULL)) { + DriverFamilyOverrideVersion = DriverFamilyOverride->GetVersion (DriverFamilyOverride); + if ((HighestIndex == DriverBindingHandleCount) || (DriverFamilyOverrideVersion > HighestVersion)) { + HighestVersion = DriverFamilyOverrideVersion; + HighestIndex = Index; + } + } + } + + if (HighestIndex == DriverBindingHandleCount) { + break; + } + + AddSortedDriverBindingProtocol ( + DriverBindingHandleBuffer[HighestIndex], + &NumberOfSortedDriverBindingProtocols, + SortedDriverBindingProtocols, + DriverBindingHandleCount, + DriverBindingHandleBuffer, + FALSE + ); + } + + // // Get the Bus Specific Driver Override Protocol instance on the Controller Handle // Status = CoreHandleProtocol ( -- cgit v1.1