From nobody Sat Apr 27 19:47:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512640272652281.47085753414035; Thu, 7 Dec 2017 01:51:12 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A541921B0283E; Thu, 7 Dec 2017 01:46:38 -0800 (PST) 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 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 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,372,1508828400"; d="scan'208";a="182136106" From: fanwang2 To: edk2-devel@lists.01.org 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: [edk2] [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: , Cc: Ye Ting , Wang Fan , Fu Siyuan , Jiaxin Wu MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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/Libr= ary/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 { =20 if (MediaInfo !=3D NULL) { FreePool (MediaInfo); } + + if (Status =3D=3D EFI_UNSUPPORTED) { + + // + // If gEfiAdapterInfoMediaStateGuid is not supported, call NetLibDet= ectMedia to get media state! + // + MediaPresent =3D TRUE; + Status =3D NetLibDetectMedia (ServiceHandle, &MediaPresent); + if (!EFI_ERROR (Status)) { + if (MediaPresent =3D=3D TRUE) { + *MediaState =3D EFI_SUCCESS; + } else { + *MediaState =3D EFI_NO_MEDIA; + } + } + return Status; + } + return Status; } =20 // // Loop to check media state=20 --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel