diff options
author | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-20 09:30:24 +0000 |
---|---|---|
committer | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-20 09:30:24 +0000 |
commit | f415234b3ba57895e43fdf7b7ed24e77a7b699ce (patch) | |
tree | 62a3ec71436ba157895a5460ad4576e9e10ee3b9 /OptionRomPkg | |
parent | d394581d11ff0c7ba2c32e01a676c80e090ecdb8 (diff) | |
download | edk2-platforms-f415234b3ba57895e43fdf7b7ed24e77a7b699ce.tar.xz |
Fix an issue that upper layer driver can not use NIC card in its driver binding stop().
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11574 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OptionRomPkg')
-rw-r--r-- | OptionRomPkg/UndiRuntimeDxe/Init.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/OptionRomPkg/UndiRuntimeDxe/Init.c b/OptionRomPkg/UndiRuntimeDxe/Init.c index 77931681e7..d6ad430a63 100644 --- a/OptionRomPkg/UndiRuntimeDxe/Init.c +++ b/OptionRomPkg/UndiRuntimeDxe/Init.c @@ -1,7 +1,7 @@ /** @file
Initialization functions for EFI UNDI32 driver.
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, 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
@@ -573,7 +573,6 @@ UndiDriverStop ( UINTN Index;
UNDI32_DEV *UNDI32Device;
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NIIProtocol;
- EFI_PCI_IO_PROTOCOL *PciIo;
//
// Complete all outstanding transactions to Controller.
@@ -617,24 +616,6 @@ UndiDriverStop ( UNDI32Device = UNDI_DEV_FROM_THIS (NIIProtocol);
- //
- // Restore original PCI attributes
- //
- Status = UNDI32Device->NicInfo.Io_Function->Attributes (
- UNDI32Device->NicInfo.Io_Function,
- EfiPciIoAttributeOperationSet,
- UNDI32Device->NicInfo.OriginalPciAttributes,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
Status = gBS->UninstallMultipleProtocolInterfaces (
ChildHandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
@@ -643,19 +624,30 @@ UndiDriverStop ( &UNDI32Device->NIIProtocol_31,
NULL
);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Restore original PCI attributes
+ //
+ Status = UNDI32Device->NicInfo.Io_Function->Attributes (
+ UNDI32Device->NicInfo.Io_Function,
+ EfiPciIoAttributeOperationSet,
+ UNDI32Device->NicInfo.OriginalPciAttributes,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ ChildHandleBuffer[Index]
+ );
+
+ ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
gBS->FreePool (UNDI32Device->Undi32DevPath);
gBS->FreePool (UNDI32Device);
+
}
}
|