-/** @file
-
-Copyright (c) 2006 - 2007, 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.
-
-Module Name:
-
- Ip4Config.h
-
-Abstract:
-
- Header file for IP4Config driver.
-
-
-**/
-
-#ifndef __EFI_IP4CONFIG_H__
-#define __EFI_IP4CONFIG_H__
-
-#include <PiDxe.h>\r
+/** @file\r
+ Header file for IP4Config driver.\r
+\r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r
+All rights reserved. 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/Ip4Config.h>\r
#include <Protocol/ManagedNetwork.h>\r
+#include <Protocol/HiiConfigAccess.h>\r
+#include <Protocol/HiiDatabase.h>\r
+#include <Protocol/HiiConfigRouting.h>\r
\r
+#include <Guid/MdeModuleHii.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/UefiLib.h>\r
#include <Library/NetLib.h>\r
#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>
-
-#include "NicIp4Variable.h"
-
-typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
-
-enum {
- IP4_CONFIG_STATE_IDLE = 0,
- IP4_CONFIG_STATE_STARTED,
- IP4_CONFIG_STATE_CONFIGURED,
-
- IP4_PROTO_ICMP = 0x01,
- IP4_CONFIG_INSTANCE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'C'),
-
- DHCP_TAG_PARA_LIST = 55,
- DHCP_TAG_NETMASK = 1,
- DHCP_TAG_ROUTER = 3
-};
-
-//
-// Configure the DHCP to request the routers and netmask
-// from server. The DHCP_TAG_NETMASK is included in Head.
-//
-#pragma pack(1)
-typedef struct {
- EFI_DHCP4_PACKET_OPTION Head;
- UINT8 Route;
-} IP4_CONFIG_DHCP4_OPTION;
-#pragma pack()
-
-struct _IP4_CONFIG_INSTANCE {
- UINT32 Signature;
- EFI_HANDLE Controller;
- EFI_HANDLE Image;
-
- EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
- EFI_NIC_IP4_CONFIG_PROTOCOL NicIp4Protocol;
-
- //
- // NicConfig's state, such as IP4_CONFIG_STATE_IDLE
- //
- INTN State;
-
- //
- // Mnp child to keep the connection with MNP.
- //
- EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
- EFI_HANDLE MnpHandle;
-
- //
- // User's requests data
- //
- EFI_EVENT DoneEvent;
- EFI_EVENT ReconfigEvent;
- EFI_STATUS Result;
-
- //
- // Identity of this interface and some configuration info.
- //
- NIC_ADDR NicAddr;
- UINT16 NicName[IP4_NIC_NAME_LENGTH];
- UINT32 NicIndex;
- NIC_IP4_CONFIG_INFO *NicConfig;
-
- //
- // DHCP handles to access DHCP
- //
- EFI_DHCP4_PROTOCOL *Dhcp4;
- EFI_HANDLE Dhcp4Handle;
- EFI_EVENT Dhcp4Event;
-};
-
-#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)
-
-extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
-extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
-extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
-extern EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate;
-
-VOID
-Ip4ConfigCleanDhcp4 (
- IN IP4_CONFIG_INSTANCE *This
- );
-
-VOID
-Ip4ConfigCleanConfig (
- IN IP4_CONFIG_INSTANCE *Instance
- );
-#endif
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/DpcLib.h>\r
+\r
+#include "NicIp4Variable.h"\r
+\r
+typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;\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 IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];\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
+\r
+typedef struct {\r
+ UINTN DeviceNum;\r
+ BOOLEAN Enabled;\r
+ EFI_IPv4_ADDRESS LocalIp;\r
+ EFI_IPv4_ADDRESS SubnetMask;\r
+ EFI_IPv4_ADDRESS Gateway;\r
+} IP4_CONFIG_SESSION_DATA;\r
+\r
+typedef struct _IP4_CONFIG_FORM_ENTRY {\r
+ LIST_ENTRY Link;\r
+ IP4_CONFIG_INSTANCE *Ip4ConfigInstance;\r
+ EFI_HANDLE Controller;\r
+ CHAR16 *MacString;\r
+ EFI_STRING_ID PortTitleToken;\r
+ EFI_STRING_ID PortTitleHelpToken;\r
+ IP4_CONFIG_SESSION_DATA SessionConfigData;\r
+} IP4CONFIG_FORM_ENTRY;\r
+\r
+#define IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')\r
+\r
+typedef struct _IP4_FORM_CALLBACK_INFO_INSTANCE {\r
+ UINTN Signature;\r
+ EFI_HANDLE DriverHandle;\r
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;\r
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;\r
+ EFI_HII_HANDLE RegisteredHandle;\r
+ IP4CONFIG_FORM_ENTRY *Current;\r
+} IP4_FORM_CALLBACK_INFO;\r
+\r
+#define IP4CONFIG_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK(Callback) \\r
+ CR ( \\r
+ Callback, \\r
+ IP4_FORM_CALLBACK_INFO, \\r
+ ConfigAccess, \\r
+ IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE \\r
+ )\r
+\r
+struct _IP4_CONFIG_INSTANCE {\r
+ UINT32 Signature;\r
+ EFI_HANDLE Controller;\r
+ EFI_HANDLE Image;\r
+\r
+ EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;\r
+\r
+ IP4_FORM_CALLBACK_INFO Ip4FormCallbackInfo;\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
+ UINT16 NicName[IP4_NIC_NAME_LENGTH];\r
+ UINT32 NicIndex;\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
+#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_IP4FORM_CALLBACK_INFO(this) \\r
+ CR (this, IP4_CONFIG_INSTANCE, Ip4FormCallbackInfo, 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 configure parameter for this NIC.\r
+\r
+ @param Instance The IP4 CONFIG Instance.\r
+ @param ConfigLen The length of the NicConfig buffer.\r
+ @param NicConfig The buffer to receive the NIC's configure\r
+ parameter.\r
+\r
+ @retval EFI_SUCCESS The configure parameter for this NIC was \r
+ obtained successfully .\r
+ @retval EFI_INVALID_PARAMETER This or ConfigLen is NULL.\r
+ @retval EFI_NOT_FOUND There is no configure parameter for the NIC in\r
+ NVRam.\r
+ @retval EFI_BUFFER_TOO_SMALL The ConfigLen is too small or the NicConfig is \r
+ NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiNicIp4ConfigGetInfo (\r
+ IN IP4_CONFIG_INSTANCE *Instance,\r
+ IN OUT UINTN *ConfigLen,\r
+ OUT NIC_IP4_CONFIG_INFO *NicConfig\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 not a valid EFI_HANDLE.\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
+#endif\r