mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
8ce6b650b0
commit
152f2d5e45
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ']'
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue