diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2013-07-10 02:06:49 +0000 |
---|---|---|
committer | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-07-10 02:06:49 +0000 |
commit | de27b8f0707bee2cd3238a5755420515e8e6bdc3 (patch) | |
tree | e2d67bb7a957c5fe41822c2cfee7944b99243f9e /EdkCompatibilityPkg/Foundation | |
parent | f87bc6e5c54001d3d14c93fee8eecd0b4fd6657a (diff) | |
download | edk2-platforms-de27b8f0707bee2cd3238a5755420515e8e6bdc3.tar.xz |
Fill the ImageHandle and DriverBindingHandle field of Driver Binding Protocol before installing the Driver Binding Protocol instance.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14460 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Foundation')
-rw-r--r-- | EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c | 92 |
1 files changed, 43 insertions, 49 deletions
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c index c82736c74b..d5af3d69cc 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -40,23 +40,26 @@ UefiDriverModelLibConstructor ( )
{
EFI_STATUS Status = EFI_UNSUPPORTED;
- EFI_HANDLE DriverBindingHandle;
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
//
+ // The Driver Binding Protocol must never be NULL
+ //
+ DriverBinding = (EFI_DRIVER_BINDING_PROTOCOL *) _gDriverModelProtocolList[0].DriverBinding;
+ ASSERT(DriverBinding != NULL);
+
+ //
+ // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
// Install the first Driver Bindng Protocol onto ImageHandle
//
- DriverBindingHandle = ImageHandle;
+ DriverBinding->ImageHandle = ImageHandle;
+ DriverBinding->DriverBindingHandle = ImageHandle;
//
// See if onle one Driver Binding Protocol is advertised by the driver
// EdkIIGlueLib: _gDriverModelProtocolListEntries is always 1
//
- //
- // The Driver Binding Protocol must never be NULL
- //
- ASSERT(_gDriverModelProtocolList[0].DriverBinding != NULL);
//
// Check for all 8 possible combinations of the ComponentName, DriverConfiguration, and DriverDiagnostics Protocol
@@ -68,14 +71,14 @@ UefiDriverModelLibConstructor ( if (_gDriverModelProtocolList[0].DriverConfiguration == NULL) {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
NULL
);
@@ -83,15 +86,15 @@ UefiDriverModelLibConstructor ( } else {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
NULL
@@ -102,15 +105,15 @@ UefiDriverModelLibConstructor ( if (_gDriverModelProtocolList[0].DriverConfiguration == NULL) {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
NULL
@@ -119,16 +122,16 @@ UefiDriverModelLibConstructor ( } else {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
@@ -144,14 +147,14 @@ UefiDriverModelLibConstructor ( if (_gDriverModelProtocolList[0].DriverConfiguration2== NULL) {
if (_gDriverModelProtocolList[0].ComponentName2== NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName2,
NULL
);
@@ -159,15 +162,15 @@ UefiDriverModelLibConstructor ( } else {
if (_gDriverModelProtocolList[0].ComponentName2 == NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiDriverConfiguration2ProtocolGuid, (EFI_DRIVER_CONFIGURATION2_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName2,
&gEfiDriverConfiguration2ProtocolGuid, (EFI_DRIVER_CONFIGURATION2_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration2,
NULL
@@ -178,15 +181,15 @@ UefiDriverModelLibConstructor ( if (_gDriverModelProtocolList[0].DriverConfiguration2 == NULL) {
if (_gDriverModelProtocolList[0].ComponentName2 == NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiDriverDiagnostics2ProtocolGuid, (EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName2,
&gEfiDriverDiagnostics2ProtocolGuid, (EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics2,
NULL
@@ -195,16 +198,16 @@ UefiDriverModelLibConstructor ( } else {
if (_gDriverModelProtocolList[0].ComponentName2 == NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiDriverConfiguration2ProtocolGuid, (EFI_DRIVER_CONFIGURATION2_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration2,
&gEfiDriverDiagnostics2ProtocolGuid, (EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
+ &DriverBinding->DriverBindingHandle,
+ &gEfiDriverBindingProtocolGuid, DriverBinding,
&gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName2,
&gEfiDriverConfiguration2ProtocolGuid, (EFI_DRIVER_CONFIGURATION2_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration2,
&gEfiDriverDiagnostics2ProtocolGuid, (EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics2,
@@ -219,16 +222,7 @@ UefiDriverModelLibConstructor ( // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
//
ASSERT_EFI_ERROR (Status);
-
- //
- // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
- //
- DriverBinding = (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding;
- DriverBinding->ImageHandle = ImageHandle;
- DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
-
- return EFI_SUCCESS;
+ return Status;
}
/**
|