public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Songpeng Li <songpeng.li@intel.com>
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>, Wu Jiaxin <jiaxin.wu@intel.com>,
	Fu Siyuan <siyuan.fu@intel.com>
Subject: [PATCH v2 3/4] NetworkPkg/UefiPxeBcDxe: Add Conflict Detection Process.
Date: Mon, 29 Oct 2018 13:48:01 +0800	[thread overview]
Message-ID: <20181029054802.68148-4-songpeng.li@intel.com> (raw)
In-Reply-To: <20181029054802.68148-1-songpeng.li@intel.com>

v2: Modify UefiPxeBcDxe.inf file:
  tag protocol guid should be marked as BY_START

The current PxeBc Driver in MdeModulePkg and NetworkPkg has no conflict
detection when both installed in platform, this process is for conflict
driver detect.

Also we modified the version of the driver binding protocol of PxeBc Driver
in NetworkPkg for overriding the same driver in MdeModulePkg.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1278
Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Songpeng Li <songpeng.li@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c    | 42 ++++++++++++++++++++++--
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h      |  1 +
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf |  1 +
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
index 0ab640beca..70b0948daa 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
@@ -21,7 +21,7 @@ EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp4DriverBinding = {
   PxeBcIp4DriverBindingSupported,
   PxeBcIp4DriverBindingStart,
   PxeBcIp4DriverBindingStop,
-  0xa,
+  0xb,
   NULL,
   NULL
 };
@@ -30,7 +30,7 @@ EFI_DRIVER_BINDING_PROTOCOL gPxeBcIp6DriverBinding = {
   PxeBcIp6DriverBindingSupported,
   PxeBcIp6DriverBindingStart,
   PxeBcIp6DriverBindingStop,
-  0xa,
+  0xb,
   NULL,
   NULL
 };
@@ -1319,6 +1319,20 @@ PxeBcSupported (
     MtftpServiceBindingGuid = &gEfiMtftp6ServiceBindingProtocolGuid;
   }
 
+  if (IpVersion == IP_VERSION_4) {
+    Status = gBS->OpenProtocol (
+                    ControllerHandle,
+                    &gEdkiiPxeBcTagProtocolGuid,
+                    NULL,
+                    This->DriverBindingHandle,
+                    ControllerHandle,
+                    EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+                    );
+    if (!EFI_ERROR (Status)) {
+      return EFI_ALREADY_STARTED;
+    }
+  }
+
   //
   // Try to open the Mtftp and Dhcp protocol to test whether IP stack is ready.
   //
@@ -1492,6 +1506,23 @@ PxeBcStart (
     goto ON_ERROR;
   }
 
+  if (IpVersion == IP_VERSION_4) {
+    //
+    // Install Tag Guid For Conflict Detect
+    //
+    Status = gBS->InstallMultipleProtocolInterfaces(
+                    &ControllerHandle,
+                    &gEdkiiPxeBcTagProtocolGuid, NULL,
+                    NULL
+                    );
+    if (EFI_ERROR (Status)) {
+      //
+      // Failed to install Tag Guid
+      //
+      goto ON_ERROR;
+    }
+  }
+
   return EFI_SUCCESS;
 
 ON_ERROR:
@@ -1622,6 +1653,13 @@ PxeBcStop (
     return Status;
   }
 
+  if (IpVersion == IP_VERSION_4) {
+    gBS->UninstallMultipleProtocolInterfaces(
+           ControllerHandle,
+           &gEdkiiPxeBcTagProtocolGuid, NULL,
+           NULL
+           );
+  }
 
   if (Private->Ip4Nic != NULL && IpVersion == IP_VERSION_4) {
     PxeBcDestroyIp4Children (This, Private);
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
index 0bb5d51e93..453a3189db 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
@@ -41,6 +41,7 @@
 #include <Protocol/ServiceBinding.h>
 #include <Protocol/DriverBinding.h>
 #include <Protocol/AdapterInformation.h>
+#include <Protocol/PxeBcTag.h>
 
 #include <Library/DebugLib.h>
 #include <Library/BaseMemoryLib.h>
diff --git a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
index 130a5456e2..13a979c8fe 100644
--- a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
+++ b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
@@ -107,6 +107,7 @@
   gEfiPxeBaseCodeProtocolGuid                          ## BY_START
   gEfiLoadFileProtocolGuid                             ## BY_START
   gEfiAdapterInformationProtocolGuid                   ## SOMETIMES_CONSUMES
+  gEdkiiPxeBcTagProtocolGuid                           ## BY_START
 
 [Guids]
   gEfiAdapterInfoUndiIpv6SupportGuid                   ## SOMETIMES_CONSUMES ## GUID
-- 
2.18.0.windows.1



  parent reply	other threads:[~2018-10-29  5:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29  5:47 [PATCH v2 0/4] Conflict Detection for Tcp and PxeBc Driver Songpeng Li
2018-10-29  5:47 ` [PATCH v2 1/4] MdeModulePkg: Add Tag Protocol for PxeBc Driver Conflict Detection Songpeng Li
2018-10-29  5:48 ` [PATCH v2 2/4] MdeModulePkg/UefiPxeBcDxe: Add Conflict Detection Process Songpeng Li
2018-10-29  5:48 ` Songpeng Li [this message]
2018-10-29  5:48 ` [PATCH v2 4/4] NetworkPkg/TcpDxe: Modify the Version of Driver Binding Protocol Songpeng Li
2018-10-29  7:11 ` [PATCH v2 0/4] Conflict Detection for Tcp and PxeBc Driver Wu, Jiaxin
2018-10-29  7:12 ` Fu, Siyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181029054802.68148-4-songpeng.li@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox