]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection
authorfanwang2 <fan.wang@intel.com>
Fri, 8 Dec 2017 01:08:24 +0000 (09:08 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Fri, 8 Dec 2017 01:31:31 +0000 (09:31 +0800)
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>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
MdeModulePkg/Library/DxeNetLib/DxeNetLib.c

index 1bfa33d58d1a07b479b737d6d9a8a504082e9801..d75cca29d61a03673c079bb14c723c31f9a6af50 100644 (file)
@@ -2605,6 +2605,24 @@ NetLibDetectMediaWaitTimeout (
     if (MediaInfo != NULL) {\r
       FreePool (MediaInfo);\r
     }\r
+\r
+    if (Status == EFI_UNSUPPORTED) {\r
+\r
+      //\r
+      // If gEfiAdapterInfoMediaStateGuid is not supported, call NetLibDetectMedia to get media state!\r
+      //\r
+      MediaPresent = TRUE;\r
+      Status = NetLibDetectMedia (ServiceHandle, &MediaPresent);\r
+      if (!EFI_ERROR (Status)) {\r
+        if (MediaPresent == TRUE) {\r
+          *MediaState = EFI_SUCCESS;\r
+        } else {\r
+          *MediaState = EFI_NO_MEDIA;\r
+        }\r
+      }\r
+      return Status;\r
+    }\r
+\r
     return Status;\r
   }\r
 \r