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:
vanjeff
2009-05-13 09:29:44 +00:00
parent 945e3aed0f
commit 638868496c
15 changed files with 1733 additions and 291 deletions

View File

@@ -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