MdeModulePkg: Refine SNP driver's media status check logic.

Some UNDI drivers may not support the cable detect in UNDI INITIALIZE command,
but support the media present check in UNDI GET_STATUS command. Current SNP
driver will set the MediaPresentSupported field to FALSE in EFI_SIMPLE_NETWORK_MODE
for such case, which forbid the media detect from the callers.

This patch updates the SNP driver to support such kind of UNDIs for media detect.
MediaPresentSupported will be set to TRUE, and a GET_STATUS command will be issued
immediately after INITIALIZE command in SNP->Initialize() function, to refresh
the value of MediaPresent in SNP mode data.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-By: Ye Ting <ting.ye@intel.com>
Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
Fu Siyuan
2016-05-03 17:11:22 +08:00
parent 89ecd4cf80
commit 128946c9c3
4 changed files with 64 additions and 16 deletions

View File

@@ -229,7 +229,10 @@ SnpUndi32Initialize (
//
Snp->TxRxBufferSize = (UINT32) (Snp->InitInfo.MemoryRequired + ExtraRxBufferSize + ExtraTxBufferSize);
if (Snp->Mode.MediaPresentSupported) {
//
// If UNDI support cable detect for INITIALIZE command, try it first.
//
if (Snp->CableDetectSupported) {
if (PxeInit (Snp, PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) == EFI_SUCCESS) {
Snp->Mode.MediaPresent = TRUE;
goto ON_EXIT;
@@ -242,6 +245,14 @@ SnpUndi32Initialize (
if (EFI_ERROR (EfiStatus)) {
gBS->CloseEvent (Snp->Snp.WaitForPacket);
goto ON_EXIT;
}
//
// Try to update the MediaPresent field of EFI_SIMPLE_NETWORK_MODE if the UNDI support it.
//
if (Snp->MediaStatusSupported) {
PxeGetStatus (Snp, NULL, FALSE);
}
ON_EXIT: