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=192.55.52.115; helo=mga14.intel.com; envelope-from=fan.wang@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 508D321B02839 for ; Thu, 7 Dec 2017 01:46:37 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2017 01:51:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,372,1508828400"; d="scan'208";a="182136106" Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.33]) by orsmga005.jf.intel.com with ESMTP; 07 Dec 2017 01:51:08 -0800 From: fanwang2 To: edk2-devel@lists.01.org Cc: Fu Siyuan , Ye Ting , Jiaxin Wu , Wang Fan Date: Thu, 7 Dec 2017 17:51:03 +0800 Message-Id: <1512640263-7280-1-git-send-email-fan.wang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection 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: Thu, 07 Dec 2017 09:46:37 -0000 AIP may not support detecting network media state, in this case, should call NetLibDetectMedia to get media state. This patch is to fix this issue. Cc: Fu Siyuan Cc: Ye Ting Cc: Jiaxin Wu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan --- MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index 1bfa33d..d75cca2 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -2603,10 +2603,28 @@ NetLibDetectMediaWaitTimeout ( } else { if (MediaInfo != NULL) { FreePool (MediaInfo); } + + if (Status == EFI_UNSUPPORTED) { + + // + // If gEfiAdapterInfoMediaStateGuid is not supported, call NetLibDetectMedia to get media state! + // + MediaPresent = TRUE; + Status = NetLibDetectMedia (ServiceHandle, &MediaPresent); + if (!EFI_ERROR (Status)) { + if (MediaPresent == TRUE) { + *MediaState = EFI_SUCCESS; + } else { + *MediaState = EFI_NO_MEDIA; + } + } + return Status; + } + return Status; } // // Loop to check media state -- 1.9.5.msysgit.1