+++ /dev/null
-/** @file\r
- Header file for IP4Config driver.\r
-\r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at<BR>\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _EFI_IP4CONFIG_H_\r
-#define _EFI_IP4CONFIG_H_\r
-\r
-#include <Uefi.h>\r
-\r
-#include <Protocol/Dhcp4.h>\r
-#include <Protocol/Ip4Config.h>\r
-#include <Protocol/ManagedNetwork.h>\r
-#include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/HiiDatabase.h>\r
-#include <Protocol/HiiConfigRouting.h>\r
-#include <Protocol/ServiceBinding.h>\r
-\r
-#include <Guid/MdeModuleHii.h>\r
-#include <Guid/NicIp4ConfigNvData.h>\r
-\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/NetLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/DpcLib.h>\r
-#include <Library/UefiHiiServicesLib.h>\r
-\r
-\r
-//\r
-// Global variables\r
-//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;\r
-\r
-extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;\r
-\r
-#define IP4_PROTO_ICMP 0x01\r
-#define IP4_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')\r
-\r
-#define IP4_CONFIG_STATE_IDLE 0\r
-#define IP4_CONFIG_STATE_STARTED 1\r
-#define IP4_CONFIG_STATE_CONFIGURED 2\r
-\r
-#define DHCP_TAG_PARA_LIST 55\r
-#define DHCP_TAG_NETMASK 1\r
-#define DHCP_TAG_ROUTER 3\r
-\r
-\r
-//\r
-// Configure the DHCP to request the routers and netmask\r
-// from server. The DHCP_TAG_NETMASK is included in Head.\r
-//\r
-#pragma pack(1)\r
-typedef struct {\r
- EFI_DHCP4_PACKET_OPTION Head;\r
- UINT8 Route;\r
-} IP4_CONFIG_DHCP4_OPTION;\r
-#pragma pack()\r
-\r
-typedef struct _IP4CONFIG_CALLBACK_INFO {\r
- BOOLEAN Configured;\r
- BOOLEAN DhcpEnabled;\r
- EFI_IPv4_ADDRESS LocalIp;\r
- EFI_IPv4_ADDRESS SubnetMask;\r
- EFI_IPv4_ADDRESS Gateway;\r
-} IP4_SETTING_INFO;\r
-\r
-typedef struct _IP4_CONFIG_INSTANCE {\r
- UINT32 Signature;\r
- EFI_HANDLE Controller;\r
- EFI_HANDLE Image;\r
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
-\r
- EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;\r
-\r
- EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccessProtocol;\r
- EFI_HANDLE ChildHandle;\r
- EFI_DEVICE_PATH_PROTOCOL *HiiVendorDevicePath;\r
- EFI_HII_HANDLE RegisteredHandle;\r
- IP4_SETTING_INFO Ip4ConfigCallbackInfo;\r
-\r
- //\r
- // NicConfig's state, such as IP4_CONFIG_STATE_IDLE\r
- //\r
- INTN State;\r
-\r
- //\r
- // Mnp child to keep the connection with MNP.\r
- //\r
- EFI_MANAGED_NETWORK_PROTOCOL *Mnp;\r
- EFI_HANDLE MnpHandle;\r
-\r
- //\r
- // User's requests data\r
- //\r
- EFI_EVENT DoneEvent;\r
- EFI_EVENT ReconfigEvent;\r
- EFI_STATUS Result;\r
-\r
- //\r
- // Identity of this interface and some configuration info.\r
- //\r
- NIC_ADDR NicAddr;\r
- CHAR16 *MacString;\r
- NIC_IP4_CONFIG_INFO *NicConfig;\r
-\r
- //\r
- // DHCP handles to access DHCP\r
- //\r
- EFI_DHCP4_PROTOCOL *Dhcp4;\r
- EFI_HANDLE Dhcp4Handle;\r
- EFI_EVENT Dhcp4Event;\r
-\r
- //\r
- // A dedicated timer is used to poll underlying media status\r
- //\r
- EFI_EVENT Timer;\r
-\r
- //\r
- // Underlying media present status. \r
- //\r
- BOOLEAN MediaPresent;\r
-\r
- //\r
- // A flag to indicate EfiIp4ConfigStart should not run\r
- //\r
- BOOLEAN DoNotStart;\r
-} IP4_CONFIG_INSTANCE;\r
-\r
-#define IP4_CONFIG_INSTANCE_FROM_IP4CONFIG(this) \\r
- CR (this, IP4_CONFIG_INSTANCE, Ip4ConfigProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)\r
-\r
-#define IP4_CONFIG_INSTANCE_FROM_CONFIG_ACCESS(this) \\r
- CR (this, IP4_CONFIG_INSTANCE, HiiConfigAccessProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)\r
-\r
-\r
-/**\r
- Set the IP configure parameters for this NIC.\r
-\r
- If Reconfig is TRUE, the IP driver will be informed to discard current\r
- auto configure parameter and restart the auto configuration process.\r
- If current there is a pending auto configuration, EFI_ALREADY_STARTED is\r
- returned. You can only change the configure setting when either\r
- the configure has finished or not started yet. If NicConfig, the\r
- NIC's configure parameter is removed from the variable.\r
-\r
- @param Instance The IP4 CONFIG instance.\r
- @param NicConfig The new NIC IP4 configure parameter.\r
- @param Reconfig Inform the IP4 driver to restart the auto\r
- configuration.\r
-\r
- @retval EFI_SUCCESS The configure parameter for this NIC was\r
- set successfully.\r
- @retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is\r
- invalid.\r
- @retval EFI_ALREADY_STARTED There is a pending auto configuration.\r
- @retval EFI_NOT_FOUND No auto configure parameter is found.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EfiNicIp4ConfigSetInfo (\r
- IN IP4_CONFIG_INSTANCE *Instance,\r
- IN NIC_IP4_CONFIG_INFO *NicConfig OPTIONAL,\r
- IN BOOLEAN Reconfig\r
- );\r
-\r
-/**\r
- Get the NIC's configure information from the IP4 configure variable.\r
- It will remove the invalid variable.\r
-\r
- @param Instance The IP4 CONFIG instance.\r
-\r
- @return NULL if no configure for the NIC in the variable, or it is invalid.\r
- Otherwise the pointer to the NIC's IP configure parameter will be returned.\r
-\r
-**/\r
-NIC_IP4_CONFIG_INFO *\r
-EfiNicIp4ConfigGetInfo (\r
- IN IP4_CONFIG_INSTANCE *Instance\r
- );\r
-\r
-/**\r
- Release all the DHCP related resources.\r
-\r
- @param This The IP4 configure instance\r
-\r
- @return None\r
-\r
-**/\r
-VOID\r
-Ip4ConfigCleanDhcp4 (\r
- IN IP4_CONFIG_INSTANCE *This\r
- );\r
-\r
-/**\r
- Clean up all the configuration parameters.\r
-\r
- @param Instance The IP4 configure instance\r
-\r
- @return None\r
-\r
-**/\r
-VOID\r
-Ip4ConfigCleanConfig (\r
- IN IP4_CONFIG_INSTANCE *Instance\r
- );\r
-\r
-//\r
-// EFI Component Name Functions\r
-//\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the driver.\r
-\r
- This function retrieves the user readable name of a driver in the form of a\r
- Unicode string. If the driver specified by This has a user readable name in\r
- the language specified by Language, then a pointer to the driver name is\r
- returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
- by This does not support the language specified by Language,\r
- then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified\r
- in RFC 3066 or ISO 639-2 language code format.\r
- @param DriverName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- driver specified by This in the language\r
- specified by Language.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
- This and the language specified by Language was\r
- returned in DriverName.\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
- @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ip4ConfigComponentNameGetDriverName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-/**\r
- Retrieves a Unicode string that is the user readable name of the controller\r
- that is being managed by a driver.\r
-\r
- This function retrieves the user readable name of the controller specified by\r
- ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
- driver specified by This has a user readable name in the language specified by\r
- Language, then a pointer to the controller name is returned in ControllerName,\r
- and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
- managing the controller specified by ControllerHandle and ChildHandle,\r
- then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
- support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
-\r
- @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
- EFI_COMPONENT_NAME_PROTOCOL instance.\r
- @param ControllerHandle[in] The handle of a controller that the driver\r
- specified by This is managing. This handle\r
- specifies the controller whose name is to be\r
- returned.\r
- @param ChildHandle[in] The handle of the child controller to retrieve\r
- the name of. This is an optional parameter that\r
- may be NULL. It will be NULL for device\r
- drivers. It will also be NULL for a bus drivers\r
- that wish to retrieve the name of the bus\r
- controller. It will not be NULL for a bus\r
- driver that wishes to retrieve the name of a\r
- child controller.\r
- @param Language[in] A pointer to a Null-terminated ASCII string\r
- array indicating the language. This is the\r
- language of the driver name that the caller is\r
- requesting, and it must match one of the\r
- languages specified in SupportedLanguages. The\r
- number of languages supported by a driver is up\r
- to the driver writer. Language is specified in\r
- RFC 3066 or ISO 639-2 language code format.\r
- @param ControllerName[out] A pointer to the Unicode string to return.\r
- This Unicode string is the name of the\r
- controller specified by ControllerHandle and\r
- ChildHandle in the language specified by\r
- Language from the point of view of the driver\r
- specified by This.\r
-\r
- @retval EFI_SUCCESS The Unicode string for the user readable name in\r
- the language specified by Language for the\r
- driver specified by This was returned in\r
- DriverName.\r
- @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
- EFI_HANDLE.\r
- @retval EFI_INVALID_PARAMETER Language is NULL.\r
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
- @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
- managing the controller specified by\r
- ControllerHandle and ChildHandle.\r
- @retval EFI_UNSUPPORTED The driver specified by This does not support\r
- the language specified by Language.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ip4ConfigComponentNameGetControllerName (\r
- IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle OPTIONAL,\r
- IN CHAR8 *Language,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-/**\r
- Test to see if this driver supports ControllerHandle.\r
-\r
- @param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to test\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCES This driver supports this device\r
- @retval EFI_ALREADY_STARTED This driver is already running on this device\r
- @retval other This driver does not support this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ip4ConfigDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
- );\r
-\r
-/**\r
- Start this driver on ControllerHandle.\r
-\r
- @param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to bind driver to\r
- @param RemainingDevicePath Optional parameter use to pick a specific child\r
- device to start.\r
-\r
- @retval EFI_SUCCES This driver is added to ControllerHandle\r
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
- @retval other This driver does not support this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ip4ConfigDriverBindingStart (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
- );\r
-\r
-/**\r
- Stop this driver on ControllerHandle.\r
-\r
- @param This Protocol instance pointer.\r
- @param ControllerHandle Handle of device to stop driver on\r
- @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
- children is zero stop the entire bus driver.\r
- @param ChildHandleBuffer List of Child Handles to Stop.\r
-\r
- @retval EFI_SUCCES This driver is removed ControllerHandle\r
- @retval other This driver was not removed from this device\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Ip4ConfigDriverBindingStop (\r
- IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN UINTN NumberOfChildren,\r
- IN EFI_HANDLE *ChildHandleBuffer\r
- );\r
-\r
-/**\r
- Starts running the configuration policy for the EFI IPv4 Protocol driver.\r
-\r
- The Start() function is called to determine and to begin the platform\r
- configuration policy by the EFI IPv4 Protocol driver. This determination may\r
- be as simple as returning EFI_UNSUPPORTED if there is no EFI IPv4 Protocol\r
- driver configuration policy. It may be as involved as loading some defaults\r
- from nonvolatile storage, downloading dynamic data from a DHCP server, and\r
- checking permissions with a site policy server.\r
- Starting the configuration policy is just the beginning. It may finish almost\r
- instantly or it may take several minutes before it fails to retrieve configuration\r
- information from one or more servers. Once the policy is started, drivers\r
- should use the DoneEvent parameter to determine when the configuration policy\r
- has completed. EFI_IP4_CONFIG_PROTOCOL.GetData() must then be called to\r
- determine if the configuration succeeded or failed.\r
- Until the configuration completes successfully, EFI IPv4 Protocol driver instances\r
- that are attempting to use default configurations must return EFI_NO_MAPPING.\r
- Once the configuration is complete, the EFI IPv4 Configuration Protocol driver\r
- signals DoneEvent. The configuration may need to be updated in the future,\r
- however; in this case, the EFI IPv4 Configuration Protocol driver must signal\r
- ReconfigEvent, and all EFI IPv4 Protocol driver instances that are using default\r
- configurations must return EFI_NO_MAPPING until the configuration policy has\r
- been rerun.\r
-\r
- @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.\r
- @param DoneEvent Event that will be signaled when the EFI IPv4\r
- Protocol driver configuration policy completes\r
- execution. This event must be of type EVT_NOTIFY_SIGNAL.\r
- @param ReconfigEvent Event that will be signaled when the EFI IPv4\r
- Protocol driver configuration needs to be updated.\r
- This event must be of type EVT_NOTIFY_SIGNAL.\r
-\r
- @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol\r
- driver is now running.\r
- @retval EFI_INVALID_PARAMETER One or more of the following parameters is NULL:\r
- This\r
- DoneEvent\r
- ReconfigEvent\r
- @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
- @retval EFI_ALREADY_STARTED The configuration policy for the EFI IPv4 Protocol\r
- driver was already started.\r
- @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred.\r
- @retval EFI_UNSUPPORTED This interface does not support the EFI IPv4 Protocol\r
- driver configuration.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EfiIp4ConfigStart (\r
- IN EFI_IP4_CONFIG_PROTOCOL *This,\r
- IN EFI_EVENT DoneEvent,\r
- IN EFI_EVENT ReconfigEvent\r
- );\r
-\r
-/**\r
- Stops running the configuration policy for the EFI IPv4 Protocol driver.\r
-\r
- The Stop() function stops the configuration policy for the EFI IPv4 Protocol driver.\r
- All configuration data will be lost after calling Stop().\r
-\r
- @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.\r
-\r
- @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol\r
- driver has been stopped.\r
- @retval EFI_INVALID_PARAMETER This is NULL.\r
- @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol\r
- driver was not started.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EfiIp4ConfigStop (\r
- IN EFI_IP4_CONFIG_PROTOCOL *This\r
- );\r
-\r
-/**\r
- Returns the default configuration data (if any) for the EFI IPv4 Protocol driver.\r
-\r
- The GetData() function returns the current configuration data for the EFI IPv4\r
- Protocol driver after the configuration policy has completed.\r
-\r
- @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.\r
- @param ConfigDataSize On input, the size of the ConfigData buffer.\r
- On output, the count of bytes that were written\r
- into the ConfigData buffer.\r
- @param ConfigData Pointer to the EFI IPv4 Configuration Protocol\r
- driver configuration data structure.\r
- Type EFI_IP4_IPCONFIG_DATA is defined in\r
- "Related Definitions" below.\r
-\r
- @retval EFI_SUCCESS The EFI IPv4 Protocol driver configuration has been returned.\r
- @retval EFI_INVALID_PARAMETER This is NULL.\r
- @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol\r
- driver is not running.\r
- @retval EFI_NOT_READY EFI IPv4 Protocol driver configuration is still running.\r
- @retval EFI_ABORTED EFI IPv4 Protocol driver configuration could not complete.\r
- Currently not implemented.\r
- @retval EFI_BUFFER_TOO_SMALL *ConfigDataSize is smaller than the configuration\r
- data buffer or ConfigData is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EfiIp4ConfigGetData (\r
- IN EFI_IP4_CONFIG_PROTOCOL *This,\r
- IN OUT UINTN *ConfigDataSize,\r
- OUT EFI_IP4_IPCONFIG_DATA *ConfigData OPTIONAL\r
- );\r
-\r
-/**\r
- A dedicated timer is used to poll underlying media status. In case of\r
- cable swap, a new round auto configuration will be initiated. The timer \r
- will signal the IP4 to run the auto configuration again. IP4 driver will free\r
- old IP address related resource, such as route table and Interface, then\r
- initiate a DHCP round by IP4Config->Start to acquire new IP, eventually\r
- create route table for new IP address.\r
-\r
- @param[in] Event The IP4 service instance's heart beat timer.\r
- @param[in] Context The IP4 service instance.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-MediaChangeDetect (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- );\r
-\r
-#endif\r