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

@ -1092,6 +1092,40 @@ NetLibGetMacString (
OUT CHAR16 **MacString
);
/**
Detect media status for specified network device.
The underlying UNDI driver may or may not support reporting media status from
GET_STATUS command (PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED). This routine
will try to invoke Snp->GetStatus() to get the media status: if media already
present, it return directly; if media not present, it will stop SNP and then
restart SNP to get the latest media status, this give chance to get the correct
media status for old UNDI driver which doesn't support reporting media status
from GET_STATUS command.
Note: there will be two limitations for current algorithm:
1) for UNDI with this capability, in case of cable is not attached, there will
be an redundant Stop/Start() process;
2) for UNDI without this capability, in case cable is attached in UNDI
initialize while unattached latter, NetLibDetectMedia() will report
MediaPresent as TRUE, this cause upper layer apps wait for timeout time.
@param[in] ServiceHandle The handle where network service binding protocols are
installed on.
@param[out] MediaPresent The pointer to store the media status.
@retval EFI_SUCCESS Media detection success.
@retval EFI_INVALID_PARAMETER ServiceHandle is not valid network device handle.
@retval EFI_UNSUPPORTED Network device does not support media detection.
@retval EFI_DEVICE_ERROR SNP is in unknown state.
**/
EFI_STATUS
EFIAPI
NetLibDetectMedia (
IN EFI_HANDLE ServiceHandle,
OUT BOOLEAN *MediaPresent
);
/**
Create an IPv4 device path node.
@ -1201,7 +1235,7 @@ NetLibDefaultUnload (
@param[in] String The pointer to the Ascii string.
@param[out] Ip4Address The pointer to the converted IPv4 address.
@retval EFI_SUCCESS Convert to IPv4 address successfully.
@retval EFI_SUCCESS Convert to IPv4 address successfully.
@retval EFI_INVALID_PARAMETER The string is mal-formated or Ip4Address is NULL.
**/
@ -1218,7 +1252,7 @@ NetLibAsciiStrToIp4 (
@param[in] String The pointer to the Ascii string.
@param[out] Ip6Address The pointer to the converted IPv6 address.
@retval EFI_SUCCESS Convert to IPv6 address successfully.
@retval EFI_SUCCESS Convert to IPv6 address successfully.
@retval EFI_INVALID_PARAMETER The string is mal-formated or Ip6Address is NULL.
**/
@ -1234,7 +1268,7 @@ NetLibAsciiStrToIp6 (
@param[in] String The pointer to the Ascii string.
@param[out] Ip4Address The pointer to the converted IPv4 address.
@retval EFI_SUCCESS Convert to IPv4 address successfully.
@retval EFI_SUCCESS Convert to IPv4 address successfully.
@retval EFI_INVALID_PARAMETER The string is mal-formated or Ip4Address is NULL.
@retval EFI_OUT_OF_RESOURCES Fail to perform the operation due to lack of resource.
@ -1252,7 +1286,7 @@ NetLibStrToIp4 (
@param[in] String The pointer to the Ascii string.
@param[out] Ip6Address The pointer to the converted IPv6 address.
@retval EFI_SUCCESS Convert to IPv6 address successfully.
@retval EFI_SUCCESS Convert to IPv6 address successfully.
@retval EFI_INVALID_PARAMETER The string is mal-formated or Ip6Address is NULL.
@retval EFI_OUT_OF_RESOURCES Fail to perform the operation due to lack of resource.
@ -1272,7 +1306,7 @@ NetLibStrToIp6 (
@param[out] Ip6Address The pointer to the converted IPv6 address.
@param[out] PrefixLength The pointer to the converted prefix length.
@retval EFI_SUCCESS Convert to IPv6 address successfully.
@retval EFI_SUCCESS Convert to IPv6 address successfully.
@retval EFI_INVALID_PARAMETER The string is mal-formated or Ip6Address is NULL.
@retval EFI_OUT_OF_RESOURCES Fail to perform the operation due to lack of resource.