Skip to content

Commit

Permalink
Fix bug in SNP driver where default values for SNP mode are not fille…
Browse files Browse the repository at this point in the history
…d in. This causes ARP and other drivers to fail to bind as they don't think it is an ethernet connection. Mode structure is filled via lazy update, so defaults need some genericly valid info, not zero.

signed-off-by:andrewfish



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12926 6f19259b-4bc3-4df7-8a09-765794883524
  • Loading branch information
andrewfish committed Jan 11, 2012
1 parent a7224ee commit f79fa76
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,35 @@ EFI_SIMPLE_NETWORK_PROTOCOL gEmuSnpTemplate = {
NULL // Mode
};


EFI_SIMPLE_NETWORK_MODE gEmuSnpModeTemplate = {
EfiSimpleNetworkStopped, // State
NET_ETHER_ADDR_LEN, // HwAddressSize
NET_ETHER_HEADER_SIZE, // MediaHeaderSize
1500, // MaxPacketSize
0, // NvRamSize
0, // NvRamAccessSize
0, // ReceiveFilterMask
0, // ReceiveFilterSetting
MAX_MCAST_FILTER_CNT, // MaxMCastFilterCount
0, // MCastFilterCount
{
{ { 0 } }
}, // MCastFilter
{
{ 0 }
}, // CurrentAddress
{
{ 0 }
}, // BroadcastAddress
{
{ 0 }
}, // PermanentAddress
NET_IFTYPE_ETHERNET, // IfType
FALSE, // MacAddressChangeable
FALSE, // MultipleTxSupported
FALSE, // MediaPresentSupported
TRUE // MediaPresent
};


/**
Expand Down Expand Up @@ -585,14 +613,6 @@ EmuSnpDriverBindingSupported (
return Status;
}

//
// Make sure GUID is for a File System handle.
//
Status = EFI_UNSUPPORTED;
if (CompareGuid (EmuIoThunk->Protocol, &gEmuSnpProtocolGuid)) {
Status = EFI_SUCCESS;
}

//
// Close the I/O Abstraction(s) used to perform the supported test
//
Expand Down Expand Up @@ -623,6 +643,14 @@ EmuSnpDriverBindingSupported (
return Status;
}

//
// Make sure GUID is for a SNP handle.
//
Status = EFI_UNSUPPORTED;
if (CompareGuid (EmuIoThunk->Protocol, &gEmuSnpProtocolGuid)) {
Status = EFI_SUCCESS;
}

//
// Close protocol, don't use device path protocol in the Support() function
//
Expand Down Expand Up @@ -715,6 +743,7 @@ EmuSnpDriverBindingStart (
}

CopyMem (&Private->Snp, &gEmuSnpTemplate, sizeof (EFI_SIMPLE_NETWORK_PROTOCOL));
CopyMem (&Private->Mode, &gEmuSnpModeTemplate, sizeof (EFI_SIMPLE_NETWORK_MODE));

Private->Signature = EMU_SNP_PRIVATE_DATA_SIGNATURE;
Private->IoThunk = EmuIoThunk;
Expand Down Expand Up @@ -944,7 +973,6 @@ InitializeEmuSnpDriver (
//
// Install the Driver Protocols
//

Status = EfiLibInstallDriverBindingComponentName2(
ImageHandle,
SystemTable,
Expand Down

0 comments on commit f79fa76

Please sign in to comment.