For network dynamic media support:

1. add library function NetLibDetectMedia to NetLib for media detection
2. update MnpDxe to periodically poll for media status update and check for media status before packet transmit
3. update Ip4Dxe to return ModeData using Mnp->GetModeData()
4. update IScsiDxe to check for media status before try to do DHCP and session login
5. update UefiPxeBcDxe to check for media status before PXE start

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9919 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xdu2
2010-02-03 04:37:53 +00:00
parent e51e619ed7
commit dd29f3edb9
16 changed files with 449 additions and 62 deletions

View File

@@ -1,7 +1,7 @@
/** @file
Implementation of Managed Network Protocol private services.
Copyright (c) 2005 - 2009, Intel Corporation.<BR>
Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions
of the BSD License which accompanies this distribution. The full
@@ -355,6 +355,22 @@ MnpInitializeDeviceData (
goto ERROR;
}
//
// Create the timer for media detection.
//
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL | EVT_TIMER,
TPL_CALLBACK,
MnpCheckMediaStatus,
MnpDeviceData,
&MnpDeviceData->MediaDetectTimer
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "MnpInitializeDeviceData: CreateEvent for media detection failed.\n"));
goto ERROR;
}
//
// Create the timer for tx timeout check.
//
@@ -382,6 +398,10 @@ ERROR:
gBS->CloseEvent (MnpDeviceData->TimeoutCheckTimer);
}
if (MnpDeviceData->MediaDetectTimer != NULL) {
gBS->CloseEvent (MnpDeviceData->MediaDetectTimer);
}
if (MnpDeviceData->PollTimer != NULL) {
gBS->CloseEvent (MnpDeviceData->PollTimer);
}
@@ -443,9 +463,10 @@ MnpDestroyDeviceData (
//
// Close the event.
//
gBS->CloseEvent (&MnpDeviceData->TxTimeoutEvent);
gBS->CloseEvent (&MnpDeviceData->TimeoutCheckTimer);
gBS->CloseEvent (&MnpDeviceData->PollTimer);
gBS->CloseEvent (MnpDeviceData->TxTimeoutEvent);
gBS->CloseEvent (MnpDeviceData->TimeoutCheckTimer);
gBS->CloseEvent (MnpDeviceData->MediaDetectTimer);
gBS->CloseEvent (MnpDeviceData->PollTimer);
//
// Free the tx buffer.
@@ -1010,6 +1031,24 @@ MnpStart (
goto ErrorExit;
}
//
// Start the media detection timer.
//
Status = gBS->SetTimer (
MnpDeviceData->MediaDetectTimer,
TimerPeriodic,
MNP_MEDIA_DETECT_INTERVAL
);
if (EFI_ERROR (Status)) {
DEBUG (
(EFI_D_ERROR,
"MnpStart, gBS->SetTimer for MediaDetectTimer %r.\n",
Status)
);
goto ErrorExit;
}
}
}
@@ -1095,6 +1134,11 @@ MnpStop (
//
Status = gBS->SetTimer (MnpDeviceData->TimeoutCheckTimer, TimerCancel, 0);
//
// Cancel the media detect timer.
//
Status = gBS->SetTimer (MnpDeviceData->MediaDetectTimer, TimerCancel, 0);
//
// Stop the simple network.
//