diff options
author | fanwang2 <fan.wang@intel.com> | 2017-12-18 09:20:26 +0800 |
---|---|---|
committer | Fu Siyuan <siyuan.fu@intel.com> | 2017-12-18 16:38:24 +0800 |
commit | 152f2d5e4546b43f5e842d8538c90055c36dcd19 (patch) | |
tree | 1141ca2b04af3afe1f2d38bab8df1c209c0690dd /NetworkPkg | |
parent | 8ce6b650b0df28a0b8aa5784ccbbe4f8259b5626 (diff) | |
download | edk2-152f2d5e4546b43f5e842d8538c90055c36dcd19.zip edk2-152f2d5e4546b43f5e842d8538c90055c36dcd19.tar.gz edk2-152f2d5e4546b43f5e842d8538c90055c36dcd19.tar.bz2 |
NetworkPkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.
Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting
state handling, and it is forward compatible. So apply this Api in NetworkPkg.
V2:
*Define time period in a macro instead of hard code.
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>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Signed-off-by: fanwang2 <fan.wang@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 8 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h | 2 | ||||
-rw-r--r-- | NetworkPkg/DnsDxe/DnsDhcp.c | 16 | ||||
-rw-r--r-- | NetworkPkg/DnsDxe/DnsDhcp.h | 2 | ||||
-rw-r--r-- | NetworkPkg/HttpBootDxe/HttpBootImpl.c | 8 | ||||
-rw-r--r-- | NetworkPkg/HttpBootDxe/HttpBootImpl.h | 2 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiDhcp.c | 9 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiDhcp6.c | 9 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiProto.c | 8 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiProto.h | 3 | ||||
-rw-r--r-- | NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 8 | ||||
-rw-r--r-- | NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h | 2 |
12 files changed, 45 insertions, 32 deletions
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c index 1107865..b479421 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c @@ -76,7 +76,7 @@ EfiDhcp6Start ( EFI_TPL OldTpl;
DHCP6_INSTANCE *Instance;
DHCP6_SERVICE *Service;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -106,9 +106,9 @@ EfiDhcp6Start ( //
// Check Media Satus.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Service->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Service->Controller, DHCP_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
Status = EFI_NO_MEDIA;
goto ON_ERROR;
}
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h index 06780b6..7110bf8 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h @@ -62,6 +62,8 @@ typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE; #define DHCP6_PORT_CLIENT 546
#define DHCP6_PORT_SERVER 547
+#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
#define DHCP6_INSTANCE_FROM_THIS(Instance) CR ((Instance), DHCP6_INSTANCE, Dhcp6, DHCP6_INSTANCE_SIGNATURE)
#define DHCP6_SERVICE_FROM_THIS(Service) CR ((Service), DHCP6_SERVICE, ServiceBinding, DHCP6_SERVICE_SIGNATURE)
diff --git a/NetworkPkg/DnsDxe/DnsDhcp.c b/NetworkPkg/DnsDxe/DnsDhcp.c index 93779be..951477b 100644 --- a/NetworkPkg/DnsDxe/DnsDhcp.c +++ b/NetworkPkg/DnsDxe/DnsDhcp.c @@ -269,7 +269,7 @@ GetDns4ServerFromDhcp4 ( EFI_STATUS Status;
EFI_HANDLE Image;
EFI_HANDLE Controller;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
EFI_HANDLE MnpChildHandle;
EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
EFI_MANAGED_NETWORK_CONFIG_DATA MnpConfigData;
@@ -316,9 +316,9 @@ GetDns4ServerFromDhcp4 ( //
// Check media.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
@@ -620,7 +620,7 @@ GetDns6ServerFromDhcp6 ( EFI_DHCP6_PACKET_OPTION *Oro;
EFI_DHCP6_RETRANSMISSION InfoReqReXmit;
EFI_EVENT Timer;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
DNS6_SERVER_INFOR DnsServerInfor;
Dhcp6Handle = NULL;
@@ -635,9 +635,9 @@ GetDns6ServerFromDhcp6 ( //
// Check media status before doing DHCP.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
diff --git a/NetworkPkg/DnsDxe/DnsDhcp.h b/NetworkPkg/DnsDxe/DnsDhcp.h index 62bf717..9c61f84 100644 --- a/NetworkPkg/DnsDxe/DnsDhcp.h +++ b/NetworkPkg/DnsDxe/DnsDhcp.h @@ -37,6 +37,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define DHCP6_TAG_DNS_REQUEST 6
#define DHCP6_TAG_DNS_SERVER 23
+#define DNS_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
//
// The required Dns4 server information.
//
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c index d591db5..7f0616d 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -548,7 +548,7 @@ HttpBootDxeLoadFile ( {
HTTP_BOOT_PRIVATE_DATA *Private;
HTTP_BOOT_VIRTUAL_NIC *VirtualNic;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
BOOLEAN UsingIpv6;
EFI_STATUS Status;
HTTP_BOOT_IMAGE_TYPE ImageType;
@@ -570,9 +570,9 @@ HttpBootDxeLoadFile ( //
// Check media status before HTTP boot start
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Private->Controller, HTTP_BOOT_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
AsciiPrint ("\n Error: Could not detect network connection.\n");
return EFI_NO_MEDIA;
}
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.h b/NetworkPkg/HttpBootDxe/HttpBootImpl.h index da58bb6..5316035 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.h +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.h @@ -14,6 +14,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #ifndef __EFI_HTTP_BOOT_IMPL_H__
#define __EFI_HTTP_BOOT_IMPL_H__
+#define HTTP_BOOT_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
/**
Attempt to complete a DHCPv4 D.O.R.A or DHCPv6 S.R.A.A sequence to retrieve the boot resource information.
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c b/NetworkPkg/IScsiDxe/IScsiDhcp.c index 309ce0d..e6f6972 100644 --- a/NetworkPkg/IScsiDxe/IScsiDhcp.c +++ b/NetworkPkg/IScsiDxe/IScsiDhcp.c @@ -443,7 +443,7 @@ IScsiDoDhcp ( EFI_DHCP4_PACKET_OPTION *ParaList;
EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData;
ISCSI_SESSION_CONFIG_NVDATA *NvData;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
Dhcp4Handle = NULL;
Ip4Config2 = NULL;
@@ -453,9 +453,10 @@ IScsiDoDhcp ( //
// Check media status before doing DHCP.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus!= EFI_SUCCESS) {
+ AsciiPrint ("\n Error: Could not detect network connection.\n");
return EFI_NO_MEDIA;
}
diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp6.c b/NetworkPkg/IScsiDxe/IScsiDhcp6.c index 06c634c..90acb94 100644 --- a/NetworkPkg/IScsiDxe/IScsiDhcp6.c +++ b/NetworkPkg/IScsiDxe/IScsiDhcp6.c @@ -401,14 +401,15 @@ IScsiDoDhcp6 ( EFI_DHCP6_PACKET_OPTION *Oro;
EFI_DHCP6_RETRANSMISSION InfoReqReXmit;
EFI_EVENT Timer;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
//
// Check media status before doing DHCP.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Controller, ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
+ AsciiPrint ("\n Error: Could not detect network connection.\n");
return EFI_NO_MEDIA;
}
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c b/NetworkPkg/IScsiDxe/IScsiProto.c index 1602a26..38e4af2 100644 --- a/NetworkPkg/IScsiDxe/IScsiProto.c +++ b/NetworkPkg/IScsiDxe/IScsiProto.c @@ -444,14 +444,14 @@ IScsiSessionLogin ( VOID *Tcp;
EFI_GUID *ProtocolGuid;
UINT8 RetryCount;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
//
// Check media status before session login.
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Session->Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Session->Private->Controller, ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.h b/NetworkPkg/IScsiDxe/IScsiProto.h index 367914d..d57bda5 100644 --- a/NetworkPkg/IScsiDxe/IScsiProto.h +++ b/NetworkPkg/IScsiDxe/IScsiProto.h @@ -40,6 +40,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define ISCSI_VERSION_MAX 0x00
#define ISCSI_VERSION_MIN 0x00
+#define ISCSI_CHECK_MEDIA_LOGIN_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+#define ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
#define ISCSI_REDIRECT_ADDR_START_DELIMITER '['
#define ISCSI_REDIRECT_ADDR_END_DELIMITER ']'
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c index 1fc26c5..dc77d25 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c @@ -2347,7 +2347,7 @@ EfiPxeLoadFile ( EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
BOOLEAN UsingIpv6;
EFI_STATUS Status;
- BOOLEAN MediaPresent;
+ EFI_STATUS MediaStatus;
if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
return EFI_INVALID_PARAMETER;
@@ -2373,9 +2373,9 @@ EfiPxeLoadFile ( //
// Check media status before PXE start
//
- MediaPresent = TRUE;
- NetLibDetectMedia (Private->Controller, &MediaPresent);
- if (!MediaPresent) {
+ MediaStatus = EFI_SUCCESS;
+ NetLibDetectMediaWaitTimeout (Private->Controller, PXEBC_CHECK_MEDIA_WAITING_TIME, &MediaStatus);
+ if (MediaStatus != EFI_SUCCESS) {
return EFI_NO_MEDIA;
}
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h index 2cdc8bf..7f1ecfb 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h @@ -76,6 +76,8 @@ typedef struct _PXEBC_VIRTUAL_NIC PXEBC_VIRTUAL_NIC; #define PXEBC_MENU_MAX_NUM 24
#define PXEBC_OFFER_MAX_NUM 16
+#define PXEBC_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+
#define PXEBC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'P')
#define PXEBC_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('P', 'X', 'E', 'V')
#define PXEBC_PRIVATE_DATA_FROM_PXEBC(a) CR (a, PXEBC_PRIVATE_DATA, PxeBc, PXEBC_PRIVATE_DATA_SIGNATURE)
|