From f79fa76e9ccebb8cb680455e034f63035ae44412 Mon Sep 17 00:00:00 2001 From: andrewfish Date: Wed, 11 Jan 2012 19:00:26 +0000 Subject: [PATCH] Fix bug in SNP driver where default values for SNP mode are not filled 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 --- EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c | 48 ++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c b/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c index 7f8a643e8a..09d16fd8b6 100644 --- a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c +++ b/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c @@ -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 +}; /** @@ -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 // @@ -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 // @@ -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; @@ -944,7 +973,6 @@ InitializeEmuSnpDriver ( // // Install the Driver Protocols // - Status = EfiLibInstallDriverBindingComponentName2( ImageHandle, SystemTable, -- 2.39.2