Update SnpDxe to support dynamic media detect.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9994 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
xdu2 2010-02-12 08:45:15 +00:00
parent 993702aa7b
commit c777c3574e
3 changed files with 241 additions and 212 deletions

View File

@ -54,6 +54,10 @@ PxeGetStatus (
Snp->Cdb.OpFlags |= PXE_OPFLAGS_GET_INTERRUPT_STATUS; Snp->Cdb.OpFlags |= PXE_OPFLAGS_GET_INTERRUPT_STATUS;
} }
if (Snp->MediaStatusSupported) {
Snp->Cdb.OpFlags |= PXE_OPFLAGS_GET_MEDIA_STATUS;
}
Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED; Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED; Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
@ -121,6 +125,15 @@ PxeGetStatus (
} }
//
// Update MediaPresent field of EFI_SIMPLE_NETWORK_MODE if the UNDI support
// returning media status from GET_STATUS command
//
if (Snp->MediaStatusSupported) {
Snp->Snp.Mode->MediaPresent =
(BOOLEAN) (((Snp->Cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_NO_MEDIA) != 0) ? FALSE : TRUE);
}
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -581,6 +581,16 @@ SimpleNetworkDriverStart (
Snp->Mode.MediaPresentSupported = FALSE; Snp->Mode.MediaPresentSupported = FALSE;
} }
switch (InitStatFlags & PXE_STATFLAGS_GET_STATUS_NO_MEDIA_MASK) {
case PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED:
Snp->MediaStatusSupported = TRUE;
break;
case PXE_STATFLAGS_GET_STATUS_NO_MEDIA_NOT_SUPPORTED:
default:
Snp->MediaStatusSupported = FALSE;
}
if ((Pxe->hw.Implementation & PXE_ROMID_IMP_STATION_ADDR_SETTABLE) != 0) { if ((Pxe->hw.Implementation & PXE_ROMID_IMP_STATION_ADDR_SETTABLE) != 0) {
Snp->Mode.MacAddressChangeable = TRUE; Snp->Mode.MacAddressChangeable = TRUE;
} else { } else {

View File

@ -1,7 +1,7 @@
/** @file /** @file
Declaration of strctures and functions for SnpDxe driver. Declaration of strctures and functions for SnpDxe driver.
Copyright (c) 2004 - 2009, Intel Corporation. <BR> Copyright (c) 2004 - 2010, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials are licensed All rights reserved. This program and the accompanying materials are licensed
and made available under the terms and conditions of the BSD License which and made available under the terms and conditions of the BSD License which
accompanies this distribution. The full text of the license may be found at accompanies this distribution. The full text of the license may be found at
@ -122,6 +122,12 @@ typedef struct {
} MapList[MAX_MAP_LENGTH]; } MapList[MAX_MAP_LENGTH];
EFI_EVENT ExitBootServicesEvent; EFI_EVENT ExitBootServicesEvent;
//
// Whether UNDI support reporting media status from GET_STATUS command,
// i.e. PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED
//
BOOLEAN MediaStatusSupported;
} SNP_DRIVER; } SNP_DRIVER;
#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE) #define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, Snp, SNP_DRIVER_SIGNATURE)