From: fanwang2 <fan.wang@intel.com>
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>, Fu Siyuan <siyuan.fu@intel.com>,
Wu Jiaxin <jiaxin.wu@intel.com>, Wang Fan <fan.wang@intel.com>
Subject: [Patch 2/3] MdeModulePkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
Date: Tue, 12 Dec 2017 16:54:01 +0800 [thread overview]
Message-ID: <1513068842-4892-3-git-send-email-fan.wang@intel.com> (raw)
In-Reply-To: <1513068842-4892-1-git-send-email-fan.wang@intel.com>
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 <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
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
next prev parent reply other threads:[~2017-12-12 8:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 8:53 [Patch 0/3] *** SUBJECT HERE *** fanwang2
2017-12-12 8:54 ` [Patch 1/3] NetworkPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout fanwang2
2017-12-13 1:43 ` Fu, Siyuan
2017-12-12 8:54 ` fanwang2 [this message]
2017-12-12 8:54 ` [Patch 3/3] ShellPkg: " fanwang2
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=1513068842-4892-3-git-send-email-fan.wang@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