]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
NetworkPkg/UefiPxeBcDxe: Fix various typos
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / PxeBcDriver.c
index bc9dc914f3201996d3cb993f34b557b97f1d4121..0e2675be3c984b7a15a37d70e627bf610dc6cdec 100644 (file)
@@ -1,16 +1,10 @@
 /** @file\r
-  Driver Binding functions implementationfor for UefiPxeBc Driver.\r
+  Driver Binding functions implementation for UefiPxeBc Driver.\r
 \r
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>\r
 \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
-  http://opensource.org/licenses/bsd-license.php.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -814,7 +808,7 @@ PxeBcCreateIp4Children (
     }\r
 \r
     //\r
-    // Open SNP on the child handle BY_DRIVER. It will prevent any additionally\r
+    // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally\r
     // layering to perform the experiment.\r
     //\r
     Status = gBS->OpenProtocol (\r
@@ -823,7 +817,7 @@ PxeBcCreateIp4Children (
                     (VOID **) &Snp,\r
                     This->DriverBindingHandle,\r
                     Private->Ip4Nic->Controller,\r
-                    EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                    EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE\r
                     );\r
     if (EFI_ERROR (Status)) {\r
       goto ON_ERROR;\r
@@ -1157,7 +1151,7 @@ PxeBcCreateIp6Children (
     }\r
 \r
     //\r
-    // Open SNP on the child handle BY_DRIVER. It will prevent any additionally\r
+    // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally\r
     // layering to perform the experiment.\r
     //\r
     Status = gBS->OpenProtocol (\r
@@ -1166,7 +1160,7 @@ PxeBcCreateIp6Children (
                     (VOID **) &Snp,\r
                     This->DriverBindingHandle,\r
                     Private->Ip6Nic->Controller,\r
-                    EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                    EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE\r
                     );\r
     if (EFI_ERROR (Status)) {\r
       goto ON_ERROR;\r
@@ -1190,7 +1184,7 @@ PxeBcCreateIp6Children (
   }\r
 \r
   //\r
-  // Set IPv6 avaiable flag and set default configure data for\r
+  // Set IPv6 available flag and set default configure data for\r
   // Udp6Read and Ip6 instance.\r
   //\r
   Status = PxeBcCheckIpv6Support (ControllerHandle, Private, &Private->Mode.Ipv6Available);\r
@@ -1248,6 +1242,10 @@ PxeBcDriverEntryPoint (
 {\r
   EFI_STATUS  Status;\r
 \r
+  if ((PcdGet8(PcdIPv4PXESupport) == PXE_DISABLED) && (PcdGet8(PcdIPv6PXESupport) == PXE_DISABLED)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   Status = EfiLibInstallDriverBindingComponentName2 (\r
              ImageHandle,\r
              SystemTable,\r
@@ -1269,16 +1267,11 @@ PxeBcDriverEntryPoint (
              &gPxeBcComponentName2\r
              );\r
   if (EFI_ERROR (Status)) {\r
-    gBS->UninstallMultipleProtocolInterfaces (\r
-           ImageHandle,\r
-           &gEfiDriverBindingProtocolGuid,\r
-           &gPxeBcIp4DriverBinding,\r
-           &gEfiComponentName2ProtocolGuid,\r
-           &gPxeBcComponentName2,\r
-           &gEfiComponentNameProtocolGuid,\r
-           &gPxeBcComponentName,\r
-           NULL\r
-           );\r
+    EfiLibUninstallDriverBindingComponentName2 (\r
+      &gPxeBcIp4DriverBinding,\r
+      &gPxeBcComponentName,\r
+      &gPxeBcComponentName2\r
+      );\r
   }\r
 \r
   return Status;\r
@@ -1312,9 +1305,15 @@ PxeBcSupported (
   EFI_GUID                        *MtftpServiceBindingGuid;\r
 \r
   if (IpVersion == IP_VERSION_4) {\r
+    if (PcdGet8(PcdIPv4PXESupport) == PXE_DISABLED) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
     DhcpServiceBindingGuid  = &gEfiDhcp4ServiceBindingProtocolGuid;\r
     MtftpServiceBindingGuid = &gEfiMtftp4ServiceBindingProtocolGuid;\r
   } else {\r
+    if (PcdGet8(PcdIPv6PXESupport) == PXE_DISABLED) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
     DhcpServiceBindingGuid  = &gEfiDhcp6ServiceBindingProtocolGuid;\r
     MtftpServiceBindingGuid = &gEfiMtftp6ServiceBindingProtocolGuid;\r
   }\r