From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=fan.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 CA93321B02825 for ; Tue, 12 Dec 2017 00:50:15 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2017 00:54:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,394,1508828400"; d="scan'208";a="2130324" Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.33]) by orsmga006.jf.intel.com with ESMTP; 12 Dec 2017 00:54:53 -0800 From: fanwang2 To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin , Wang Fan Date: Tue, 12 Dec 2017 16:54:01 +0800 Message-Id: <1513068842-4892-3-git-send-email-fan.wang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1513068842-4892-1-git-send-email-fan.wang@intel.com> References: <1513068842-4892-1-git-send-email-fan.wang@intel.com> Subject: [Patch 2/3] MdeModulePkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Dec 2017 08:50:16 -0000 Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting state handling, and it is forward compatible. So apply this Api in MdeModulePkg. Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan --- MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c | 10 +++++----- MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c | 10 +++++----- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c index 869a56a..25b7e0a 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDhcp.c @@ -358,23 +358,23 @@ IScsiDoDhcp ( EFI_HANDLE Dhcp4Handle; EFI_DHCP4_PROTOCOL *Dhcp4; EFI_STATUS Status; EFI_DHCP4_PACKET_OPTION *ParaList; EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData; - BOOLEAN MediaPresent; + EFI_STATUS MediaStatus; UINT8 *Data; Dhcp4Handle = NULL; Dhcp4 = NULL; ParaList = NULL; // - // Check media status before do DHCP + // Check media status before do DHCP, wait no more than 20 seconds // - MediaPresent = TRUE; - NetLibDetectMedia (Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus = EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Controller, EFI_TIMER_PERIOD_SECONDS(20), &MediaStatus); + if (MediaStatus != EFI_SUCCESS) { return EFI_NO_MEDIA; } // // Create a DHCP4 child instance and get the protocol. diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c index 14f13f8..3406bee 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c @@ -287,20 +287,20 @@ IScsiSessionLogin ( { EFI_STATUS Status; ISCSI_SESSION *Session; ISCSI_CONNECTION *Conn; EFI_TCP4_PROTOCOL *Tcp4; - BOOLEAN MediaPresent; + EFI_STATUS MediaStatus; Session = &Private->Session; // - // Check media status before session login + // Check media status before session login, wait no more than 20 seconds // - MediaPresent = TRUE; - NetLibDetectMedia (Private->Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus = EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Private->Controller, EFI_TIMER_PERIOD_SECONDS(20), &MediaStatus); + if (MediaStatus != EFI_SUCCESS) { return EFI_NO_MEDIA; } // // Set session identifier diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c index 6d4f33f..da52310 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c @@ -2799,11 +2799,11 @@ EfiPxeLoadFile ( PXEBC_PRIVATE_DATA *Private; EFI_PXE_BASE_CODE_PROTOCOL *PxeBc; BOOLEAN NewMakeCallback; EFI_STATUS Status; UINT64 TmpBufSize; - BOOLEAN MediaPresent; + EFI_STATUS MediaStatus; if (FilePath == NULL || !IsDevicePathEnd (FilePath)) { return EFI_INVALID_PARAMETER; } @@ -2823,15 +2823,15 @@ EfiPxeLoadFile ( if (!BootPolicy) { return EFI_UNSUPPORTED; } // - // Check media status before PXE start + // Check media status before PXE start, no more than 20 seconds // - MediaPresent = TRUE; - NetLibDetectMedia (Private->Controller, &MediaPresent); - if (!MediaPresent) { + MediaStatus = EFI_SUCCESS; + NetLibDetectMediaWaitTimeout (Private->Controller, EFI_TIMER_PERIOD_SECONDS(20), &MediaStatus); + if (MediaStatus != EFI_SUCCESS) { return EFI_NO_MEDIA; } Status = PxeBc->Start (PxeBc, FALSE); if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) { -- 1.9.5.msysgit.1