mirror of https://github.com/acidanthera/audk.git
1. retired NicIp4ConfigProtocolGuid
2. moved NicIp4ConfigVariableGuid to Include/Guid/NicIp4ConfigNvData.h 3. updated Ip4ConfigDxe module to publish one setup page to Get/Set network parameters. Also, Ip4ConfgiDxe installed EFI HII Config Access protocol for each network devices. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8309 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
945e3aed0f
commit
638868496c
|
@ -0,0 +1,73 @@
|
|||
/** @file
|
||||
This file defines NIC_IP4_CONFIG_INFO structure.
|
||||
|
||||
Copyright (c) 2009, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __NIC_IP4_CONFIG_NVDATA_H__
|
||||
#define __NIC_IP4_CONFIG_NVDATA_H__
|
||||
|
||||
#include <Protocol/Ip4Config.h>
|
||||
|
||||
#define EFI_NIC_IP4_CONFIG_VARIABLE_GUID \
|
||||
{ \
|
||||
0xd8944553, 0xc4dd, 0x41f4, { 0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b } \
|
||||
}
|
||||
|
||||
#define EFI_NIC_IP4_CONFIG_VARIABLE L"EfiNicIp4ConfigVariable"
|
||||
|
||||
typedef enum {
|
||||
//
|
||||
// Config source: dhcp or static
|
||||
//
|
||||
IP4_CONFIG_SOURCE_DHCP = 0,
|
||||
IP4_CONFIG_SOURCE_STATIC,
|
||||
IP4_CONFIG_SOURCE_MAX,
|
||||
|
||||
IP4_NIC_NAME_LENGTH = 64,
|
||||
MAX_IP4_CONFIG_IN_VARIABLE = 16
|
||||
} IP4_CONFIG_TYPE;
|
||||
|
||||
//
|
||||
// The following structures are used by drivers/applications other
|
||||
// than EFI_IP4_PROTOCOL, such as ifconfig shell application, to
|
||||
// communicate the IP configuration information to EFI_IP4_CONFIG_PROTOCOL.
|
||||
// EFI_IP4_CONFIG_PROTOCOL in turn is used by EFI_IP4_PROTOCOL to get
|
||||
// the default IP4 configuration. ifconfig can't use the EFI_IP4_PROTOCOL
|
||||
// because it don't know how to configure the default IP address even
|
||||
// it has got the address.
|
||||
//
|
||||
|
||||
///
|
||||
/// NIC_ADDR contains the interface's type and MAC address to identify
|
||||
/// a specific NIC.
|
||||
///
|
||||
typedef struct {
|
||||
UINT16 Type; ///< Interface type
|
||||
UINT8 Len; ///< Length of MAC address
|
||||
EFI_MAC_ADDRESS MacAddr; ///< MAC address of interface
|
||||
} NIC_ADDR;
|
||||
|
||||
///
|
||||
/// NIC_IP4_CONFIG_INFO contains the IP4 configure
|
||||
/// parameters for that NIC. NIC_IP4_CONFIG_INFO is
|
||||
/// of variable length.
|
||||
///
|
||||
typedef struct {
|
||||
NIC_ADDR NicAddr; ///< Link layer address to identify the NIC
|
||||
UINT32 Source; ///< Static or DHCP
|
||||
BOOLEAN Perment; ///< Survive the reboot or not
|
||||
EFI_IP4_IPCONFIG_DATA Ip4Info; ///< IP addresses
|
||||
} NIC_IP4_CONFIG_INFO;
|
||||
|
||||
extern EFI_GUID gEfiNicIp4ConfigVariableGuid;
|
||||
|
||||
#endif
|
|
@ -1,177 +0,0 @@
|
|||
/** @file
|
||||
This file defines NicIp4Config Protocol.
|
||||
EFI_NIC_IP4_CONFIG_PROTOCOL is a proprietary protocol, not defined by UEFI2.0.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __NIC_IP4_CONFIG_H__
|
||||
#define __NIC_IP4_CONFIG_H__
|
||||
|
||||
#include <Protocol/Ip4Config.h>
|
||||
|
||||
|
||||
#define EFI_NIC_IP4_CONFIG_PROTOCOL_GUID \
|
||||
{ \
|
||||
0xdca3d4d, 0x12da, 0x4728, { 0xbf, 0x7e, 0x86, 0xce, 0xb9, 0x28, 0xd0, 0x67 } \
|
||||
}
|
||||
|
||||
#define EFI_NIC_IP4_CONFIG_VARIABLE_GUID \
|
||||
{ \
|
||||
0xd8944553, 0xc4dd, 0x41f4, { 0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b } \
|
||||
}
|
||||
|
||||
#define EFI_NIC_IP4_CONFIG_VARIABLE L"EfiNicIp4ConfigVariable"
|
||||
|
||||
|
||||
typedef struct _EFI_NIC_IP4_CONFIG_PROTOCOL EFI_NIC_IP4_CONFIG_PROTOCOL;
|
||||
|
||||
typedef enum {
|
||||
//
|
||||
// Config source: dhcp or static
|
||||
//
|
||||
IP4_CONFIG_SOURCE_DHCP = 0,
|
||||
IP4_CONFIG_SOURCE_STATIC,
|
||||
IP4_CONFIG_SOURCE_MAX,
|
||||
|
||||
IP4_NIC_NAME_LENGTH = 64,
|
||||
MAX_IP4_CONFIG_IN_VARIABLE = 16
|
||||
} IP4_CONFIG_TYPE;
|
||||
|
||||
//
|
||||
// The following structures are used by drivers/applications other
|
||||
// than EFI_IP4_PROTOCOL, such as ifconfig shell application, to
|
||||
// communicate the IP configuration information to EFI_IP4_CONFIG_PROTOCOL.
|
||||
// EFI_IP4_CONFIG_PROTOCOL in turn is used by EFI_IP4_PROTOCOL to get
|
||||
// the default IP4 configuration. ifconfig can't use the EFI_IP4_PROTOCOL
|
||||
// because it don't know how to configure the default IP address even
|
||||
// it has got the address.
|
||||
//
|
||||
|
||||
///
|
||||
/// NIC_ADDR contains the interface's type and MAC address to identify
|
||||
/// a specific NIC.
|
||||
///
|
||||
typedef struct {
|
||||
UINT16 Type; ///< Interface type
|
||||
UINT8 Len; ///< Length of MAC address
|
||||
EFI_MAC_ADDRESS MacAddr; ///< MAC address of interface
|
||||
} NIC_ADDR;
|
||||
|
||||
///
|
||||
/// NIC_IP4_CONFIG_INFO contains the IP4 configure
|
||||
/// parameters for that NIC. NIC_IP4_CONFIG_INFO is
|
||||
/// of variable length.
|
||||
///
|
||||
typedef struct {
|
||||
NIC_ADDR NicAddr; ///< Link layer address to identify the NIC
|
||||
UINT32 Source; ///< Static or DHCP
|
||||
BOOLEAN Perment; ///< Survive the reboot or not
|
||||
EFI_IP4_IPCONFIG_DATA Ip4Info; ///< IP addresses
|
||||
} NIC_IP4_CONFIG_INFO;
|
||||
|
||||
///
|
||||
/// IP4_CONFIG_VARIABLE is the EFI variable to
|
||||
/// save the configuration. IP4_CONFIG_VARIABLE is
|
||||
/// of variable length.
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Len; ///< Total length of the variable
|
||||
UINT16 CheckSum; ///< CheckSum, the same as IP4 head checksum
|
||||
UINT32 Count; ///< Number of NIC_IP4_CONFIG_INFO follows
|
||||
NIC_IP4_CONFIG_INFO ConfigInfo;
|
||||
} IP4_CONFIG_VARIABLE;
|
||||
|
||||
/**
|
||||
Get the configure parameter for this NIC.
|
||||
|
||||
@param This The NIC IP4 CONFIG protocol.
|
||||
@param Len The length of the NicConfig buffer.
|
||||
@param NicConfig The buffer to receive the NIC's configure
|
||||
parameter.
|
||||
|
||||
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||
obtained successfully .
|
||||
@retval EFI_INVALID_PARAMETER This or ConfigLen is NULL.
|
||||
@retval EFI_NOT_FOUND There is no configure parameter for the NIC in
|
||||
NVRam.
|
||||
@retval EFI_BUFFER_TOO_SMALL The ConfigLen is too small or the NicConfig is
|
||||
NULL.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_NIC_IP4_CONFIG_GET_INFO)(
|
||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||
IN OUT UINTN *Len,
|
||||
OUT NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Set the IP configure parameters for this NIC.
|
||||
|
||||
If Reconfig is TRUE, the IP driver will be informed to discard current
|
||||
auto configure parameter and restart the auto configuration process.
|
||||
If current there is a pending auto configuration, EFI_ALREADY_STARTED is
|
||||
returned. You can only change the configure setting when either
|
||||
the configure has finished or not started yet. If NicConfig, the
|
||||
NIC's configure parameter is removed from the variable.
|
||||
|
||||
@param This The NIC IP4 CONFIG protocol
|
||||
@param NicConfig The new NIC IP4 configure parameter
|
||||
@param Reconfig Inform the IP4 driver to restart the auto
|
||||
configuration
|
||||
|
||||
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||
set successfully .
|
||||
@retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is
|
||||
invalid.
|
||||
@retval EFI_ALREADY_STARTED There is a pending auto configuration.
|
||||
@retval EFI_NOT_FOUND No auto configure parameter is found
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_NIC_IP4_CONFIG_SET_INFO)(
|
||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||
IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL,
|
||||
IN BOOLEAN ReConfig
|
||||
);
|
||||
|
||||
/**
|
||||
Return the name and MAC address for the NIC. The Name, if not NULL,
|
||||
has at least IP4_NIC_NAME_LENGTH bytes.
|
||||
|
||||
@param This The NIC IP4 CONFIG protocol
|
||||
@param Name The buffer to return the name
|
||||
@param NicAddr The buffer to return the MAC addr
|
||||
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_SUCCESS The name or address of the NIC are returned.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_NIC_IP4_CONFIG_GET_NAME)(
|
||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||
OUT UINT16 *Name OPTIONAL,
|
||||
OUT NIC_ADDR *NicAddr OPTIONAL
|
||||
);
|
||||
|
||||
struct _EFI_NIC_IP4_CONFIG_PROTOCOL {
|
||||
EFI_NIC_IP4_CONFIG_GET_NAME GetName;
|
||||
EFI_NIC_IP4_CONFIG_GET_INFO GetInfo;
|
||||
EFI_NIC_IP4_CONFIG_SET_INFO SetInfo;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiNicIp4ConfigVariableGuid;
|
||||
extern EFI_GUID gEfiNicIp4ConfigProtocolGuid;
|
||||
#endif
|
|
@ -15,11 +15,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
#include <Protocol/ServiceBinding.h>
|
||||
#include <Protocol/SimpleNetwork.h>
|
||||
#include <Protocol/NicIp4Config.h>
|
||||
#include <Protocol/HiiConfigRouting.h>
|
||||
#include <Protocol/ComponentName.h>
|
||||
#include <Protocol/ComponentName2.h>
|
||||
#include <Protocol/Dpc.h>
|
||||
|
||||
#include <Guid/NicIp4ConfigNvData.h>
|
||||
|
||||
#include <Library/NetLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
@ -28,11 +30,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
|
||||
EFI_DPC_PROTOCOL *mDpc = NULL;
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mNetLibHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
|
||||
|
||||
#define NIC_ITEM_CONFIG_SIZE sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * 2
|
||||
|
||||
//
|
||||
// All the supported IP4 maskes in host byte order.
|
||||
//
|
||||
|
@ -1248,43 +1254,98 @@ NetLibDefaultAddressIsStatic (
|
|||
IN EFI_HANDLE Controller
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_NIC_IP4_CONFIG_PROTOCOL *NicIp4;
|
||||
UINTN Len;
|
||||
NIC_IP4_CONFIG_INFO *ConfigInfo;
|
||||
BOOLEAN IsStatic;
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
UINTN Len;
|
||||
NIC_IP4_CONFIG_INFO *ConfigInfo;
|
||||
BOOLEAN IsStatic;
|
||||
EFI_STRING ConfigHdr;
|
||||
EFI_STRING ConfigResp;
|
||||
EFI_STRING AccessProgress;
|
||||
EFI_STRING AccessResults;
|
||||
EFI_STRING String;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
Controller,
|
||||
&gEfiNicIp4ConfigProtocolGuid,
|
||||
(VOID **) &NicIp4
|
||||
);
|
||||
ConfigInfo = NULL;
|
||||
ConfigHdr = NULL;
|
||||
ConfigResp = NULL;
|
||||
AccessProgress = NULL;
|
||||
AccessResults = NULL;
|
||||
IsStatic = TRUE;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiHiiConfigRoutingProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &HiiConfigRouting
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Len = 0;
|
||||
Status = NicIp4->GetInfo (NicIp4, &Len, NULL);
|
||||
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||
return TRUE;
|
||||
//
|
||||
// Construct config request string header
|
||||
//
|
||||
ConfigHdr = HiiConstructConfigHdr (&gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE, Controller);
|
||||
|
||||
Len = StrLen (ConfigHdr);
|
||||
ConfigResp = AllocateZeroPool (Len + NIC_ITEM_CONFIG_SIZE * 2 + 200);
|
||||
if (ConfigResp == NULL) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
StrCpy (ConfigResp, ConfigHdr);
|
||||
|
||||
String = ConfigResp + Len;
|
||||
UnicodeSPrint (
|
||||
String,
|
||||
(8 + 4 + 7 + 4) * sizeof (CHAR16),
|
||||
L"&OFFSET=%04X&WIDTH=%04X",
|
||||
OFFSET_OF (NIC_IP4_CONFIG_INFO, Source),
|
||||
sizeof (UINT32)
|
||||
);
|
||||
|
||||
Status = HiiConfigRouting->ExtractConfig (
|
||||
HiiConfigRouting,
|
||||
ConfigResp,
|
||||
&AccessProgress,
|
||||
&AccessResults
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
ConfigInfo = AllocatePool (Len);
|
||||
ConfigInfo = AllocateZeroPool (sizeof (NIC_IP4_CONFIG_INFO));
|
||||
if (ConfigInfo == NULL) {
|
||||
return TRUE;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
IsStatic = TRUE;
|
||||
Status = NicIp4->GetInfo (NicIp4, &Len, ConfigInfo);
|
||||
ConfigInfo->Source = IP4_CONFIG_SOURCE_STATIC;
|
||||
Len = NIC_ITEM_CONFIG_SIZE;
|
||||
Status = HiiConfigRouting->ConfigToBlock (
|
||||
HiiConfigRouting,
|
||||
AccessResults,
|
||||
(UINT8 *) ConfigInfo,
|
||||
&Len,
|
||||
&AccessProgress
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
IsStatic = (BOOLEAN) (ConfigInfo->Source == IP4_CONFIG_SOURCE_STATIC);
|
||||
|
||||
|
||||
ON_EXIT:
|
||||
|
||||
gBS->FreePool (ConfigInfo);
|
||||
if (AccessResults != NULL) {
|
||||
FreePool (AccessResults);
|
||||
}
|
||||
if (ConfigInfo != NULL) {
|
||||
FreePool (ConfigInfo);
|
||||
}
|
||||
if (ConfigResp != NULL) {
|
||||
FreePool (ConfigResp);
|
||||
}
|
||||
if (ConfigHdr != NULL) {
|
||||
FreePool (ConfigHdr);
|
||||
}
|
||||
|
||||
return IsStatic;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Instance of DxeNetLib.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation.<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation.<BR>
|
||||
All rights reserved. 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
|
||||
|
@ -48,13 +48,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
UefiLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
|
||||
HiiLib
|
||||
PrintLib
|
||||
|
||||
[Guids]
|
||||
gEfiNicIp4ConfigVariableGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiNicIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDpcProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
[Depex]
|
||||
gEfiDpcProtocolGuid
|
||||
|
|
|
@ -121,6 +121,9 @@
|
|||
## Include/Guid/Crc32GuidedSectionExtraction.h
|
||||
gEfiCrc32GuidedSectionExtractionGuid = { 0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } }
|
||||
|
||||
## Include/Guid/NicIp4ConfigNvData.h
|
||||
gEfiNicIp4ConfigVariableGuid = {0xd8944553, 0xc4dd, 0x41f4, { 0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b }}
|
||||
|
||||
[Protocols.common]
|
||||
## Load File protocol provides capability to load and unload EFI image into memory and execute it.
|
||||
## Include/Protocol/LoadPe32Image.h
|
||||
|
@ -136,12 +139,6 @@
|
|||
## Include/Protocol/GenericMemoryTest.h
|
||||
gEfiGenericMemTestProtocolGuid = { 0x309DE7F1, 0x7F5E, 0x4ACE, { 0xB4, 0x9C, 0x53, 0x1B, 0xE5, 0xAA, 0x95, 0xEF }}
|
||||
|
||||
## Include/Protocol/NicIp4Config.h
|
||||
gEfiNicIp4ConfigProtocolGuid = {0xdca3d4d, 0x12da, 0x4728, { 0xbf, 0x7e, 0x86, 0xce, 0xb9, 0x28, 0xd0, 0x67 }}
|
||||
|
||||
## Include/Protocol/NicIp4Config.h
|
||||
gEfiNicIp4ConfigVariableGuid = {0xd8944553, 0xc4dd, 0x41f4, { 0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b }}
|
||||
|
||||
## Include/Protocol/Dpc.h
|
||||
gEfiDpcProtocolGuid = {0x480f8ae9, 0xc46, 0x4aa9, { 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6 }}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
This code implements the IP4Config and NicIp4Config protocols.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation.<BR>
|
||||
All rights reserved. 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<BR>
|
||||
|
@ -16,45 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
|
||||
|
||||
/**
|
||||
Return the name and MAC address for the NIC. The Name, if not NULL,
|
||||
has at least IP4_NIC_NAME_LENGTH bytes.
|
||||
|
||||
@param This The NIC IP4 CONFIG protocol
|
||||
@param Name The buffer to return the name
|
||||
@param NicAddr The buffer to return the MAC addr
|
||||
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_SUCCESS The name or address of the NIC are returned.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiNicIp4ConfigGetName (
|
||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||
OUT UINT16 *Name OPTIONAL,
|
||||
OUT NIC_ADDR *NicAddr OPTIONAL
|
||||
)
|
||||
{
|
||||
IP4_CONFIG_INSTANCE *Instance;
|
||||
|
||||
if (This == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG (This);
|
||||
|
||||
if (Name != NULL) {
|
||||
CopyMem (Name, Instance->NicName, IP4_NIC_NAME_LENGTH);
|
||||
}
|
||||
|
||||
if (NicAddr != NULL) {
|
||||
CopyMem (NicAddr, &Instance->NicAddr, sizeof (*NicAddr));
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the NIC's configure information from the IP4 configure variable.
|
||||
|
@ -116,7 +77,7 @@ Ip4ConfigGetNicInfo (
|
|||
/**
|
||||
Get the configure parameter for this NIC.
|
||||
|
||||
@param This The NIC IP4 CONFIG protocol.
|
||||
@param Instance The IP4 CONFIG Instance.
|
||||
@param ConfigLen The length of the NicConfig buffer.
|
||||
@param NicConfig The buffer to receive the NIC's configure
|
||||
parameter.
|
||||
|
@ -133,24 +94,22 @@ Ip4ConfigGetNicInfo (
|
|||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiNicIp4ConfigGetInfo (
|
||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||
IN IP4_CONFIG_INSTANCE *Instance,
|
||||
IN OUT UINTN *ConfigLen,
|
||||
OUT NIC_IP4_CONFIG_INFO *NicConfig
|
||||
)
|
||||
{
|
||||
IP4_CONFIG_INSTANCE *Instance;
|
||||
NIC_IP4_CONFIG_INFO *Config;
|
||||
EFI_STATUS Status;
|
||||
UINTN Len;
|
||||
|
||||
if ((This == NULL) || (ConfigLen == NULL)) {
|
||||
if ((Instance == NULL) || (ConfigLen == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the Nic's configuration parameter from variable
|
||||
//
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG (This);
|
||||
Config = Ip4ConfigGetNicInfo (&Instance->NicAddr);
|
||||
|
||||
if (Config == NULL) {
|
||||
|
@ -187,7 +146,7 @@ EfiNicIp4ConfigGetInfo (
|
|||
the configure has finished or not started yet. If NicConfig, the
|
||||
NIC's configure parameter is removed from the variable.
|
||||
|
||||
@param This The NIC IP4 CONFIG protocol
|
||||
@param Instance The IP4 CONFIG instance.
|
||||
@param NicConfig The new NIC IP4 configure parameter
|
||||
@param Reconfig Inform the IP4 driver to restart the auto
|
||||
configuration
|
||||
|
@ -203,12 +162,11 @@ EfiNicIp4ConfigGetInfo (
|
|||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiNicIp4ConfigSetInfo (
|
||||
IN EFI_NIC_IP4_CONFIG_PROTOCOL *This,
|
||||
IN IP4_CONFIG_INSTANCE *Instance,
|
||||
IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL,
|
||||
IN BOOLEAN Reconfig
|
||||
)
|
||||
{
|
||||
IP4_CONFIG_INSTANCE *Instance;
|
||||
IP4_CONFIG_VARIABLE *Variable;
|
||||
IP4_CONFIG_VARIABLE *NewVariable;
|
||||
EFI_STATUS Status;
|
||||
|
@ -216,12 +174,10 @@ EfiNicIp4ConfigSetInfo (
|
|||
//
|
||||
// Validate the parameters
|
||||
//
|
||||
if (This == NULL) {
|
||||
if (Instance == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG (This);
|
||||
|
||||
if ((NicConfig != NULL) && (!Ip4ConfigIsValid (NicConfig) ||
|
||||
!NIC_ADDR_EQUAL (&NicConfig->NicAddr, &Instance->NicAddr))) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@ -372,7 +328,7 @@ Ip4ConfigOnDhcp4Complete (
|
|||
// ignore the return status of EfiNicIp4ConfigSetInfo. Network
|
||||
// stack can operate even that failed.
|
||||
//
|
||||
EfiNicIp4ConfigSetInfo (&Instance->NicIp4Protocol, Instance->NicConfig, FALSE);
|
||||
EfiNicIp4ConfigSetInfo (Instance, Instance->NicConfig, FALSE);
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
|
@ -802,8 +758,3 @@ EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate = {
|
|||
EfiIp4ConfigGetData
|
||||
};
|
||||
|
||||
EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate = {
|
||||
EfiNicIp4ConfigGetName,
|
||||
EfiNicIp4ConfigGetInfo,
|
||||
EfiNicIp4ConfigSetInfo
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Header file for IP4Config driver.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation.<BR>
|
||||
All rights reserved. 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<BR>
|
||||
|
@ -20,7 +20,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Protocol/Dhcp4.h>
|
||||
#include <Protocol/Ip4Config.h>
|
||||
#include <Protocol/ManagedNetwork.h>
|
||||
#include <Protocol/HiiConfigAccess.h>
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
#include <Protocol/HiiConfigRouting.h>
|
||||
|
||||
#include <Guid/MdeModuleHii.h>
|
||||
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
|
@ -29,13 +35,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Library/NetLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
|
||||
#include "NicIp4Variable.h"
|
||||
|
||||
typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
|
||||
|
||||
//
|
||||
// Global variables
|
||||
// Global variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
|
||||
|
@ -43,7 +51,6 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
|
|||
|
||||
extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
|
||||
extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
|
||||
extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
|
||||
|
||||
#define IP4_PROTO_ICMP 0x01
|
||||
#define IP4_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')
|
||||
|
@ -71,13 +78,53 @@ typedef struct {
|
|||
} IP4_CONFIG_DHCP4_OPTION;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINTN DeviceNum;
|
||||
BOOLEAN Enabled;
|
||||
EFI_IPv4_ADDRESS LocalIp;
|
||||
EFI_IPv4_ADDRESS SubnetMask;
|
||||
EFI_IPv4_ADDRESS Gateway;
|
||||
} IP4_CONFIG_SESSION_DATA;
|
||||
|
||||
typedef struct _IP4_CONFIG_FORM_ENTRY {
|
||||
LIST_ENTRY Link;
|
||||
IP4_CONFIG_INSTANCE *Ip4ConfigInstance;
|
||||
EFI_HANDLE Controller;
|
||||
CHAR16 MacString[95];
|
||||
EFI_STRING_ID PortTitleToken;
|
||||
EFI_STRING_ID PortTitleHelpToken;
|
||||
IP4_CONFIG_SESSION_DATA SessionConfigData;
|
||||
} IP4CONFIG_FORM_ENTRY;
|
||||
|
||||
#define IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')
|
||||
|
||||
typedef struct _IP4_FORM_CALLBACK_INFO_INSTANCE {
|
||||
UINTN Signature;
|
||||
EFI_HANDLE DriverHandle;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
|
||||
EFI_HII_HANDLE RegisteredHandle;
|
||||
IP4CONFIG_FORM_ENTRY *Current;
|
||||
} IP4_FORM_CALLBACK_INFO;
|
||||
|
||||
#define IP4CONFIG_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK(Callback) \
|
||||
CR ( \
|
||||
Callback, \
|
||||
IP4_FORM_CALLBACK_INFO, \
|
||||
ConfigAccess, \
|
||||
IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE \
|
||||
)
|
||||
|
||||
struct _IP4_CONFIG_INSTANCE {
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE Controller;
|
||||
EFI_HANDLE Image;
|
||||
|
||||
EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
|
||||
EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
|
||||
|
||||
IP4_FORM_CALLBACK_INFO Ip4FormCallbackInfo;
|
||||
|
||||
//
|
||||
// NicConfig's state, such as IP4_CONFIG_STATE_IDLE
|
||||
|
@ -116,8 +163,65 @@ struct _IP4_CONFIG_INSTANCE {
|
|||
#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \
|
||||
CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
|
||||
|
||||
#define IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG(this) \
|
||||
CR (this, IP4_CONFIG_INSTANCE, NicIp4Protocol, IP4_CONFIG_INSTANCE_SIGNATURE)
|
||||
#define IP4_CONFIG_INSTANCE_FROM_IP4FORM_CALLBACK_INFO(this) \
|
||||
CR (this, IP4_CONFIG_INSTANCE, Ip4FormCallbackInfo, IP4_CONFIG_INSTANCE_SIGNATURE)
|
||||
|
||||
|
||||
/**
|
||||
Set the IP configure parameters for this NIC.
|
||||
|
||||
If Reconfig is TRUE, the IP driver will be informed to discard current
|
||||
auto configure parameter and restart the auto configuration process.
|
||||
If current there is a pending auto configuration, EFI_ALREADY_STARTED is
|
||||
returned. You can only change the configure setting when either
|
||||
the configure has finished or not started yet. If NicConfig, the
|
||||
NIC's configure parameter is removed from the variable.
|
||||
|
||||
@param Instance The IP4 CONFIG instance.
|
||||
@param NicConfig The new NIC IP4 configure parameter
|
||||
@param Reconfig Inform the IP4 driver to restart the auto
|
||||
configuration
|
||||
|
||||
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||
set successfully .
|
||||
@retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is
|
||||
invalid.
|
||||
@retval EFI_ALREADY_STARTED There is a pending auto configuration.
|
||||
@retval EFI_NOT_FOUND No auto configure parameter is found
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiNicIp4ConfigSetInfo (
|
||||
IN IP4_CONFIG_INSTANCE *Instance,
|
||||
IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL,
|
||||
IN BOOLEAN Reconfig
|
||||
);
|
||||
|
||||
/**
|
||||
Get the configure parameter for this NIC.
|
||||
|
||||
@param Instance The IP4 CONFIG Instance.
|
||||
@param ConfigLen The length of the NicConfig buffer.
|
||||
@param NicConfig The buffer to receive the NIC's configure
|
||||
parameter.
|
||||
|
||||
@retval EFI_SUCCESS The configure parameter for this NIC was
|
||||
obtained successfully .
|
||||
@retval EFI_INVALID_PARAMETER This or ConfigLen is NULL.
|
||||
@retval EFI_NOT_FOUND There is no configure parameter for the NIC in
|
||||
NVRam.
|
||||
@retval EFI_BUFFER_TOO_SMALL The ConfigLen is too small or the NicConfig is
|
||||
NULL.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiNicIp4ConfigGetInfo (
|
||||
IN IP4_CONFIG_INSTANCE *Instance,
|
||||
IN OUT UINTN *ConfigLen,
|
||||
OUT NIC_IP4_CONFIG_INFO *NicConfig
|
||||
);
|
||||
|
||||
/**
|
||||
Release all the DHCP related resources.
|
||||
|
@ -144,7 +248,7 @@ VOID
|
|||
Ip4ConfigCleanConfig (
|
||||
IN IP4_CONFIG_INSTANCE *Instance
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
|
@ -168,7 +272,7 @@ Ip4ConfigCleanConfig (
|
|||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 4646 or ISO 639-2 language code format.
|
||||
in RFC 3066 or ISO 639-2 language code format.
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
|
@ -225,14 +329,14 @@ Ip4ConfigComponentNameGetDriverName (
|
|||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 4646 or ISO 639-2 language code format.
|
||||
RFC 3066 or ISO 639-2 language code format.
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
|
@ -258,7 +362,7 @@ Ip4ConfigComponentNameGetControllerName (
|
|||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Test to see if this driver supports ControllerHandle.
|
||||
|
||||
|
@ -279,7 +383,7 @@ Ip4ConfigDriverBindingSupported (
|
|||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Start this driver on ControllerHandle.
|
||||
|
||||
|
@ -300,7 +404,7 @@ Ip4ConfigDriverBindingStart (
|
|||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Stop this driver on ControllerHandle.
|
||||
|
||||
|
@ -322,5 +426,5 @@ Ip4ConfigDriverBindingStop (
|
|||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
|
||||
#include "Ip4Config.h"
|
||||
#include "Ip4ConfigNV.h"
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding = {
|
||||
Ip4ConfigDriverBindingSupported,
|
||||
|
@ -41,6 +42,8 @@ EfiIp4ConfigUnload (
|
|||
{
|
||||
UINT32 Index;
|
||||
|
||||
Ip4ConfigFormUnload ();
|
||||
|
||||
//
|
||||
// Stop all the IP4_CONFIG instances
|
||||
//
|
||||
|
@ -78,6 +81,8 @@ Ip4ConfigDriverEntryPoint (
|
|||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
Ip4ConfigFormInit ();
|
||||
|
||||
return EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
|
@ -219,7 +224,6 @@ Ip4ConfigDriverBindingStart (
|
|||
Instance->Image = This->DriverBindingHandle;
|
||||
|
||||
CopyMem (&Instance->Ip4ConfigProtocol, &mIp4ConfigProtocolTemplate, sizeof (mIp4ConfigProtocolTemplate));
|
||||
CopyMem (&Instance->NicIp4Protocol, &mNicIp4ConfigProtocolTemplate, sizeof (mNicIp4ConfigProtocolTemplate));
|
||||
|
||||
Instance->State = IP4_CONFIG_STATE_IDLE;
|
||||
Instance->Mnp = Mnp;
|
||||
|
@ -242,7 +246,7 @@ Ip4ConfigDriverBindingStart (
|
|||
|
||||
Instance->NicAddr.Type = (UINT16) SnpMode.IfType;
|
||||
Instance->NicAddr.Len = (UINT8) SnpMode.HwAddressSize;
|
||||
CopyMem (&Instance->NicAddr.MacAddr, &SnpMode.CurrentAddress, sizeof (Instance->NicAddr.MacAddr));
|
||||
CopyMem (&Instance->NicAddr.MacAddr, &SnpMode.CurrentAddress, Instance->NicAddr.Len);
|
||||
|
||||
//
|
||||
// Add it to the global list, and compose the name
|
||||
|
@ -275,6 +279,14 @@ Ip4ConfigDriverBindingStart (
|
|||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
Status = Ip4ConfigDeviceInit (Instance);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Try to add a port configuration page for this controller.
|
||||
//
|
||||
Ip4ConfigUpdateForm (Instance, TRUE);
|
||||
}
|
||||
|
||||
//
|
||||
// Install the IP4_CONFIG and NIC_IP4CONFIG protocols
|
||||
//
|
||||
|
@ -282,8 +294,6 @@ Ip4ConfigDriverBindingStart (
|
|||
&ControllerHandle,
|
||||
&gEfiIp4ConfigProtocolGuid,
|
||||
&Instance->Ip4ConfigProtocol,
|
||||
&gEfiNicIp4ConfigProtocolGuid,
|
||||
&Instance->NicIp4Protocol,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
@ -464,6 +474,8 @@ Ip4ConfigDriverBindingStop (
|
|||
|
||||
Instance = IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (Ip4Config);
|
||||
|
||||
Ip4ConfigDeviceUnload (Instance);
|
||||
|
||||
//
|
||||
// Unload the protocols first to inform the top drivers
|
||||
//
|
||||
|
@ -471,8 +483,6 @@ Ip4ConfigDriverBindingStop (
|
|||
NicHandle,
|
||||
&gEfiIp4ConfigProtocolGuid,
|
||||
&Instance->Ip4ConfigProtocol,
|
||||
&gEfiNicIp4ConfigProtocolGuid,
|
||||
&Instance->NicIp4Protocol,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Component name for module Ip4Config
|
||||
#
|
||||
# FIX ME!
|
||||
# Copyright (c) 2006, Intel Corporation
|
||||
# Copyright (c) 2006 - 2009, Intel Corporation
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -40,6 +40,11 @@
|
|||
Ip4Config.h
|
||||
NicIp4Variable.h
|
||||
Ip4Config.c
|
||||
Ip4ConfigDxe.vfr
|
||||
Ip4ConfigDxeStrings.uni
|
||||
Ip4NvData.h
|
||||
Ip4ConfigNv.h
|
||||
Ip4ConfigNv.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
@ -53,13 +58,20 @@
|
|||
UefiRuntimeServicesTableLib
|
||||
DebugLib
|
||||
NetLib
|
||||
HiiLib
|
||||
PrintLib
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiDhcp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiManagedNetworkServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiIp4ConfigProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiManagedNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDhcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiNicIp4ConfigVariableGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiNicIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
[Guids]
|
||||
gEfiIfrTianoGuid ## CONSUMES ## Guid
|
||||
gEfiNicIp4ConfigVariableGuid ## CONSUMES ## Guid
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/** @file
|
||||
Vfr file for IP4 config.
|
||||
|
||||
Copyright (c) 2009, Intel Corporation.<BR>
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
#include "Ip4NvData.h"
|
||||
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
|
||||
formset
|
||||
guid = EFI_NIC_IP4_CONFIG_VARIABLE_GUID,
|
||||
title = STRING_TOKEN(STR_IP4_CONFIG_FORM_TITLE),
|
||||
help = STRING_TOKEN(STR_IP4_CONFIG_FORM_HELP),
|
||||
class = EFI_NETWORK_DEVICE_CLASS,
|
||||
subclass = 0x03,
|
||||
|
||||
varstore IP4_CONFIG_IFR_NVDATA,
|
||||
name = EfiNicIp4ConfigVariable,
|
||||
guid = EFI_NIC_IP4_CONFIG_VARIABLE_GUID;
|
||||
|
||||
form formid = FORMID_MAIN_FORM,
|
||||
title = STRING_TOKEN(STR_IP4_MAIN_FORM_TITLE);
|
||||
|
||||
label DEVICE_ENTRY_LABEL;
|
||||
label LABEL_END;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORMID_DEVICE_FORM,
|
||||
title = STRING_TOKEN(STR_IP4_DEVICE_FORM_TITLE);
|
||||
|
||||
checkbox varid = EfiNicIp4ConfigVariable.DhcpEnable,
|
||||
prompt = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
|
||||
help = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_DHCP_ENABLE,
|
||||
endcheckbox;
|
||||
|
||||
suppressif ideqval EfiNicIp4ConfigVariable.DhcpEnable == 0x01;
|
||||
string varid = EfiNicIp4ConfigVariable.StationAddress,
|
||||
prompt = STRING_TOKEN(STR_IP4_LOCAL_IP_ADDRESS),
|
||||
help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_LOCAL_IP,
|
||||
minsize = IP_MIN_SIZE,
|
||||
maxsize = IP_MAX_SIZE,
|
||||
endstring;
|
||||
|
||||
string varid = EfiNicIp4ConfigVariable.SubnetMask,
|
||||
prompt = STRING_TOKEN(STR_IP4_LOCAL_MASK),
|
||||
help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_SUBNET_MASK,
|
||||
minsize = IP_MIN_SIZE,
|
||||
maxsize = IP_MAX_SIZE,
|
||||
endstring;
|
||||
|
||||
string varid = EfiNicIp4ConfigVariable.GatewayAddress,
|
||||
prompt = STRING_TOKEN(STR_IP4_LOCAL_GATEWAY),
|
||||
help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_GATE_WAY,
|
||||
minsize = IP_MIN_SIZE,
|
||||
maxsize = IP_MAX_SIZE,
|
||||
endstring;
|
||||
endif;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL);
|
||||
|
||||
goto FORMID_DEVICE_FORM,
|
||||
prompt = STRING_TOKEN (STR_SAVE_CHANGES),
|
||||
help = STRING_TOKEN (STR_SAVE_CHANGES),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_SAVE_CHANGES;
|
||||
|
||||
goto FORMID_MAIN_FORM,
|
||||
prompt = STRING_TOKEN (STR_RETURN_MAIN_FORM),
|
||||
help = STRING_TOKEN (STR_RETURN_MAIN_FORM),
|
||||
flags = 0;
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,104 @@
|
|||
/** @file
|
||||
The header file of IP4ConfigNV.c
|
||||
|
||||
Copyright (c) 2009, Intel Corporation.<BR>
|
||||
All rights reserved. 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _IP4_CONFIGNV_H_
|
||||
#define _IP4_CONFIGNV_H_
|
||||
|
||||
#include "Ip4Config.h"
|
||||
#include "Ip4NVData.h"
|
||||
|
||||
extern UINT8 Ip4ConfigDxeBin[];
|
||||
extern UINT8 Ip4ConfigDxeStrings[];
|
||||
|
||||
#define NIC_ITEM_CONFIG_SIZE sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * 2
|
||||
|
||||
|
||||
///
|
||||
/// HII specific Vendor Device Path definition.
|
||||
///
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} HII_VENDOR_DEVICE_PATH;
|
||||
|
||||
/**
|
||||
Updates the network configuration form to add/delete an entry for the network
|
||||
device specified by the Instance.
|
||||
|
||||
@param[in] Instance The IP4 Config instance.
|
||||
@param[in] AddForm Whether to add or delete a form entry.
|
||||
|
||||
@retval EFI_SUCCESS The network configuration form is updated.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
@retval Others Other errors as indicated.
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4ConfigUpdateForm (
|
||||
IN IP4_CONFIG_INSTANCE *Instance,
|
||||
IN BOOLEAN AddForm
|
||||
);
|
||||
|
||||
/**
|
||||
Install HII Config Access protocol for network device and allocate resource.
|
||||
|
||||
@param[in] Instance The IP4 Config instance.
|
||||
|
||||
@retval EFI_SUCCESS The HII Config Access protocol is installed.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
@retval Others Other errors as indicated.
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4ConfigDeviceInit (
|
||||
IN IP4_CONFIG_INSTANCE *Instance
|
||||
);
|
||||
|
||||
/**
|
||||
Uninstall HII Config Access protocol for network device and free resource.
|
||||
|
||||
@param[in] Instance The IP4 Config instance.
|
||||
|
||||
@retval EFI_SUCCESS The HII Config Access protocol is uninstalled.
|
||||
@retval Others Other errors as indicated.
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4ConfigDeviceUnload (
|
||||
IN IP4_CONFIG_INSTANCE *Instance
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize the network configuration form, this includes: delete all the network
|
||||
device configuration entries, install the form callback protocol and
|
||||
allocate the resources used.
|
||||
|
||||
@retval EFI_SUCCESS The network configuration form is unloaded.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4ConfigFormInit (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Unload the network configuration form, this includes: delete all the network
|
||||
device configuration entries, uninstall the form callback protocol and
|
||||
free the resources used.
|
||||
|
||||
@retval EFI_SUCCESS The network configuration form is unloaded.
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4ConfigFormUnload (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,59 @@
|
|||
/** @file
|
||||
Routines used to operate the Ip4 configure variable.
|
||||
|
||||
Copyright (c) 2009, Intel Corporation.<BR>
|
||||
All rights reserved. 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<BR>
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _NIC_IP4_NV_DATA_H_
|
||||
#define _NIC_IP4_NV_DATA_H_
|
||||
|
||||
|
||||
//
|
||||
// one copy from NicIp4ConfigNvData.h
|
||||
//
|
||||
#define EFI_NIC_IP4_CONFIG_VARIABLE_GUID \
|
||||
{ \
|
||||
0xd8944553, 0xc4dd, 0x41f4, { 0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b } \
|
||||
}
|
||||
|
||||
#define FORMID_MAIN_FORM 1
|
||||
#define FORMID_DEVICE_FORM 2
|
||||
|
||||
#define KEY_DHCP_ENABLE 0x101
|
||||
#define KEY_LOCAL_IP 0x102
|
||||
#define KEY_SUBNET_MASK 0x103
|
||||
#define KEY_GATE_WAY 0x104
|
||||
#define KEY_SAVE_CHANGES 0x105
|
||||
|
||||
#define DEVICE_ENTRY_LABEL 0x1234
|
||||
#define LABEL_END 0xffff
|
||||
|
||||
#define KEY_DEVICE_ENTRY_BASE 0x1000
|
||||
|
||||
#define IP_MIN_SIZE 7
|
||||
#define IP_MAX_SIZE 15
|
||||
#define IP4_STR_MAX_SIZE 16
|
||||
|
||||
///
|
||||
/// NIC_IP4_CONFIG_INFO contains the IP4 configure
|
||||
/// parameters for that NIC. NIC_IP4_CONFIG_INFO is
|
||||
/// of variable length.
|
||||
///
|
||||
typedef struct {
|
||||
UINT16 NicAddr[3]; ///< NIC MAC address
|
||||
UINT8 Reserved; ///< Reserved bits
|
||||
UINT8 DhcpEnable; ///< Static or DHCP
|
||||
CHAR16 StationAddress[IP4_STR_MAX_SIZE]; ///< IP addresses
|
||||
CHAR16 SubnetMask[IP4_STR_MAX_SIZE]; ///< Subnet address
|
||||
CHAR16 GatewayAddress[IP4_STR_MAX_SIZE]; ///< Gateway address
|
||||
} IP4_CONFIG_IFR_NVDATA;
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Routines used to operate the Ip4 configure variable.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation.<BR>
|
||||
Copyright (c) 2006 - 2009, Intel Corporation.<BR>
|
||||
All rights reserved. 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<BR>
|
||||
|
@ -17,6 +17,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Guid/NicIp4ConfigNvData.h>
|
||||
|
||||
#include <Library/NetLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
@ -24,8 +26,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
|
||||
#include <Protocol/NicIp4Config.h>
|
||||
|
||||
///
|
||||
/// IP4_CONFIG_VARIABLE is the EFI variable to
|
||||
/// save the configuration. IP4_CONFIG_VARIABLE is
|
||||
/// of variable length.
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Len; ///< Total length of the variable
|
||||
UINT16 CheckSum; ///< CheckSum, the same as IP4 head checksum
|
||||
UINT32 Count; ///< Number of NIC_IP4_CONFIG_INFO follows
|
||||
NIC_IP4_CONFIG_INFO ConfigInfo;
|
||||
} IP4_CONFIG_VARIABLE;
|
||||
|
||||
//
|
||||
// Return the size of NIC_IP4_CONFIG_INFO and EFI_IP4_IPCONFIG_DATA.
|
||||
|
@ -143,3 +154,4 @@ Ip4ConfigFixRouteTablePointer (
|
|||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue