public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: fanwang2 <fan.wang@intel.com>
To: edk2-devel@lists.01.org
Cc: Fu Siyuan <siyuan.fu@intel.com>, Ye Ting <ting.ye@intel.com>,
	Jiaxin Wu <jiaxin.wu@intel.com>, Wang Fan <fan.wang@intel.com>
Subject: [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection
Date: Thu,  7 Dec 2017 17:51:03 +0800	[thread overview]
Message-ID: <1512640263-7280-1-git-send-email-fan.wang@intel.com> (raw)

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 <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
---
 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



             reply	other threads:[~2017-12-07  9:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07  9:51 fanwang2 [this message]
2017-12-07 10:47 ` [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection Wu, Jiaxin
2017-12-08  0:59 ` Fu, Siyuan

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=1512640263-7280-1-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