From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=songpeng.li@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1E86D21184AB3 for ; Sun, 28 Oct 2018 18:54:20 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2018 18:54:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,438,1534834800"; d="scan'208";a="91955565" Received: from songpeng.ccr.corp.intel.com ([10.239.158.28]) by FMSMGA003.fm.intel.com with ESMTP; 28 Oct 2018 18:54:19 -0700 From: Songpeng Li To: edk2-devel@lists.01.org Cc: Ye Ting , Wu Jiaxin , Fu Siyuan Date: Mon, 29 Oct 2018 09:53:25 +0800 Message-Id: <20181029015326.8528-4-songpeng.li@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 In-Reply-To: <20181029015326.8528-1-songpeng.li@intel.com> References: <20181029015326.8528-1-songpeng.li@intel.com> Subject: [PATCH 3/4] NetworkPkg/UefiPxeBcDxe: Add Conflict Detection Process. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2018 01:54:20 -0000 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 Cc: Wu Jiaxin Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Songpeng Li --- 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 #include #include +#include #include #include diff --git a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf index 130a5456e2..8372cc8982 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 ## SOMETIMES_CONSUMES [Guids] gEfiAdapterInfoUndiIpv6SupportGuid ## SOMETIMES_CONSUMES ## GUID -- 2.18.0.windows.1