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>
This commit is contained in:
fanwang2 2017-12-08 09:08:24 +08:00 committed by Jiaxin Wu
parent 8bf0380e5e
commit 5d0e003c8c
1 changed files with 18 additions and 0 deletions

View File

@ -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;
}