]> git.proxmox.com Git - mirror_edk2.git/commitdiff
In Supported(), try to test open SNP protocol BY_DRIVER instead of using TEST_PROTOCOL.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Aug 2008 08:16:40 +0000 (08:16 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Aug 2008 08:16:40 +0000 (08:16 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5601 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/MnpDxe/MnpDriver.c

index fe6b63beaccdcdaddaf23429930c878223b07027..0ca41516c72dc880eecdd4abaf74677cd4f4ce07 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation\r
+Copyright (c) 2005 - 2008, Intel Corporation\r
 All rights reserved. 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
@@ -53,7 +53,8 @@ MnpDriverBindingSupported (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
+  EFI_STATUS                   Status;\r
+  EFI_SIMPLE_NETWORK_PROTOCOL  *Snp;\r
 \r
   //\r
   // Test to see if MNP is already installed.\r
@@ -67,23 +68,36 @@ MnpDriverBindingSupported (
                   EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
                   );\r
   if (!EFI_ERROR (Status)) {\r
-\r
     return EFI_ALREADY_STARTED;\r
   }\r
 \r
   //\r
-  // Test to see if SNP is installed.\r
+  // Test to open the Simple Network protocol BY_DRIVER.\r
   //\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
                   &gEfiSimpleNetworkProtocolGuid,\r
-                  NULL,\r
+                  (VOID **) &Snp,\r
                   This->DriverBindingHandle,\r
                   ControllerHandle,\r
-                  EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
+                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
                   );\r
 \r
-  return Status;\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Close the openned SNP protocol.\r
+  //\r
+  gBS->CloseProtocol (\r
+         ControllerHandle,\r
+         &gEfiSimpleNetworkProtocolGuid,\r
+         This->DriverBindingHandle,\r
+         ControllerHandle\r
+         );\r
+\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 \r