diff options
author | fanwang2 <fan.wang@intel.com> | 2017-12-08 09:08:24 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-12-08 09:31:31 +0800 |
commit | 5d0e003c8ce2616c763f8edd4ac18f560d418e76 (patch) | |
tree | 5751e3aa43535f485762b40caca28ce69c3c0980 | |
parent | 8bf0380e5e7488f31b0834a987af4f65fe6f2a42 (diff) | |
download | edk2-5d0e003c8ce2616c763f8edd4ac18f560d418e76.zip edk2-5d0e003c8ce2616c763f8edd4ac18f560d418e76.tar.gz edk2-5d0e003c8ce2616c763f8edd4ac18f560d418e76.tar.bz2 |
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>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
-rw-r--r-- | MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 18 |
1 files changed, 18 insertions, 0 deletions
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 @@ -2605,6 +2605,24 @@ NetLibDetectMediaWaitTimeout ( 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;
}
|