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 I/O functions.
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
@ -210,6 +210,18 @@ MnpSyncSendPacket (
HeaderSize = Snp->Mode->MediaHeaderSize - TxData->HeaderLength;
//
// Check media status before transmit packet.
// Note: media status will be updated by periodic timer MediaDetectTimer.
//
if (!Snp->Mode->MediaPresent) {
//
// Media not present, skip packet transmit and report EFI_NO_MEDIA
//
Status = EFI_NO_MEDIA;
goto SIGNAL_TOKEN;
}
//
// Start the timeout event.
//
@ -998,9 +1010,8 @@ EXIT:
/**
Remove the received packets if timeout occurs.
@param[in] Event The event this notify function registered to.
@param[in] Context Pointer to the context data registered to the
event.
@param[in] Event The event this notify function registered to.
@param[in] Context Pointer to the context data registered to the event.
**/
VOID
@ -1065,19 +1076,50 @@ MnpCheckPacketTimeout (
}
}
/**
Poll to update MediaPresent field in SNP ModeData by Snp->GetStatus().
@param[in] Event The event this notify function registered to.
@param[in] Context Pointer to the context data registered to the event.
**/
VOID
EFIAPI
MnpCheckMediaStatus (
IN EFI_EVENT Event,
IN VOID *Context
)
{
MNP_DEVICE_DATA *MnpDeviceData;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
UINT32 InterruptStatus;
MnpDeviceData = (MNP_DEVICE_DATA *) Context;
NET_CHECK_SIGNATURE (MnpDeviceData, MNP_DEVICE_DATA_SIGNATURE);
Snp = MnpDeviceData->Snp;
if (Snp->Mode->MediaPresentSupported) {
//
// Upon successful return of GetStatus(), the MediaPresent field of
// EFI_SIMPLE_NETWORK_MODE will be updated to reflect any change of media status
//
Snp->GetStatus (Snp, &InterruptStatus, NULL);
}
}
/**
Poll to receive the packets from Snp. This function is either called by upperlayer
protocols/applications or the system poll timer notify mechanism.
@param[in] Event The event this notify function registered to.
@param[in, out] Context Pointer to the context data registered to the event.
@param[in] Event The event this notify function registered to.
@param[in] Context Pointer to the context data registered to the event.
**/
VOID
EFIAPI
MnpSystemPoll (
IN EFI_EVENT Event,
IN OUT VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
MNP_DEVICE_DATA *MnpDeviceData;