1. Add EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName() support.
2. Fix the driver binding Stop() hang issue in the network stack. 3. Add Ip4 raw data support. 4. Add iSCSI Dhcp option 60 support. Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Ouyang Qian <qian.ouyang@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13995 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
UEFI Component Name(2) protocol implementation for SnpDxe driver.
|
||||
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
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 text of the license may be found at
|
||||
@@ -175,6 +175,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSimpleNetworkDriverNameT
|
||||
}
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gSimpleNetworkControllerNameTable = NULL;
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
@@ -231,6 +233,78 @@ SimpleNetworkComponentNameGetDriverName (
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Update the component name for the Snp child handle.
|
||||
|
||||
@param Snp[in] A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS Update the ControllerNameTable of this instance successfully.
|
||||
@retval EFI_INVALID_PARAMETER The input parameter is invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UpdateName (
|
||||
IN EFI_SIMPLE_NETWORK_PROTOCOL *Snp
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 HandleName[80];
|
||||
UINTN OffSet;
|
||||
UINTN Index;
|
||||
|
||||
if (Snp == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
OffSet = 0;
|
||||
OffSet += UnicodeSPrint (
|
||||
HandleName,
|
||||
sizeof (HandleName),
|
||||
L"SNP (MAC="
|
||||
);
|
||||
for (Index = 0; Index < Snp->Mode->HwAddressSize; Index++) {
|
||||
OffSet += UnicodeSPrint (
|
||||
HandleName + OffSet,
|
||||
sizeof (HandleName) - OffSet,
|
||||
L"%02X-",
|
||||
Snp->Mode->CurrentAddress.Addr[Index]
|
||||
);
|
||||
}
|
||||
//
|
||||
// Remove the last '-'
|
||||
//
|
||||
OffSet--;
|
||||
OffSet += UnicodeSPrint (
|
||||
HandleName,
|
||||
sizeof (HandleName),
|
||||
L")"
|
||||
);
|
||||
if (gSimpleNetworkControllerNameTable != NULL) {
|
||||
FreeUnicodeStringTable (gSimpleNetworkControllerNameTable);
|
||||
gSimpleNetworkControllerNameTable = NULL;
|
||||
}
|
||||
|
||||
Status = AddUnicodeString2 (
|
||||
"eng",
|
||||
gSimpleNetworkComponentName.SupportedLanguages,
|
||||
&gSimpleNetworkControllerNameTable,
|
||||
HandleName,
|
||||
TRUE
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return AddUnicodeString2 (
|
||||
"en",
|
||||
gSimpleNetworkComponentName2.SupportedLanguages,
|
||||
&gSimpleNetworkControllerNameTable,
|
||||
HandleName,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@@ -310,5 +384,52 @@ SimpleNetworkComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
EFI_STATUS Status;
|
||||
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
|
||||
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure this driver is currently managing ControllHandle
|
||||
//
|
||||
Status = EfiTestManagedDevice (
|
||||
ControllerHandle,
|
||||
gSimpleNetworkDriverBinding.DriverBindingHandle,
|
||||
&gEfiSimpleNetworkProtocolGuid
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve an instance of a produced protocol from ControllerHandle
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleNetworkProtocolGuid,
|
||||
(VOID **)&Snp,
|
||||
NULL,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Update the component name for this child handle.
|
||||
//
|
||||
Status = UpdateName (Snp);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
gSimpleNetworkControllerNameTable,
|
||||
ControllerName,
|
||||
(BOOLEAN)(This == &gSimpleNetworkComponentName)
|
||||
);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Implementation of driver entry point and driver binding protocol.
|
||||
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
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 text of the license may be found at
|
||||
@@ -828,7 +828,7 @@ SimpleNetworkDriverStop (
|
||||
//
|
||||
// Simple Network Protocol Driver Global Variables
|
||||
//
|
||||
EFI_DRIVER_BINDING_PROTOCOL mSimpleNetworkDriverBinding = {
|
||||
EFI_DRIVER_BINDING_PROTOCOL gSimpleNetworkDriverBinding = {
|
||||
SimpleNetworkDriverSupported,
|
||||
SimpleNetworkDriverStart,
|
||||
SimpleNetworkDriverStop,
|
||||
@@ -1014,7 +1014,7 @@ InitializeSnpNiiDriver (
|
||||
return EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&mSimpleNetworkDriverBinding,
|
||||
&gSimpleNetworkDriverBinding,
|
||||
ImageHandle,
|
||||
&gSimpleNetworkComponentName,
|
||||
&gSimpleNetworkComponentName2
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Declaration of strctures and functions for SnpDxe driver.
|
||||
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
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 text of the license may be found at
|
||||
@@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
@@ -135,6 +136,7 @@ typedef struct {
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gSimpleNetworkDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gSimpleNetworkComponentName2;
|
||||
|
||||
|
Reference in New Issue
Block a user