public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection
@ 2017-12-07  9:51 fanwang2
  2017-12-07 10:47 ` Wu, Jiaxin
  2017-12-08  0:59 ` Fu, Siyuan
  0 siblings, 2 replies; 3+ messages in thread
From: fanwang2 @ 2017-12-07  9:51 UTC (permalink / raw)
  To: edk2-devel; +Cc: Fu Siyuan, Ye Ting, Jiaxin Wu, Wang Fan

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection
  2017-12-07  9:51 [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection fanwang2
@ 2017-12-07 10:47 ` Wu, Jiaxin
  2017-12-08  0:59 ` Fu, Siyuan
  1 sibling, 0 replies; 3+ messages in thread
From: Wu, Jiaxin @ 2017-12-07 10:47 UTC (permalink / raw)
  To: Wang, Fan, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wang, Fan, Fu, Siyuan

Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>



> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> fanwang2
> Sent: Thursday, December 7, 2017 5:51 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wang, Fan <fan.wang@intel.com>; Fu,
> Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch] MdeModulePkg/NetLib: Fix an error when AIP
> doesn't support network media state detection
> 
> 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
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection
  2017-12-07  9:51 [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection fanwang2
  2017-12-07 10:47 ` Wu, Jiaxin
@ 2017-12-08  0:59 ` Fu, Siyuan
  1 sibling, 0 replies; 3+ messages in thread
From: Fu, Siyuan @ 2017-12-08  0:59 UTC (permalink / raw)
  To: Wang, Fan, edk2-devel@lists.01.org; +Cc: Ye, Ting, Wang, Fan, Wu, Jiaxin

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> fanwang2
> Sent: Thursday, December 7, 2017 5:51 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wang, Fan <fan.wang@intel.com>; Fu,
> Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't
> support network media state detection
> 
> 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
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-08  0:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-07  9:51 [Patch] MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media state detection fanwang2
2017-12-07 10:47 ` Wu, Jiaxin
2017-12-08  0:59 ` Fu, Siyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox