]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
SourceLevelDebugPkg/SecPeiDebugAgentLib: Restore CPU interrupt state
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / Ip4Config.h
index 5eadad27461513a048c93f9bb0984a40bdff156d..cbe8ec5fcfde864b06d1a2ef3af0a5fdf30f1355 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for IP4Config driver.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\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
@@ -26,6 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #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
@@ -41,9 +42,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/DpcLib.h>\r
 #include <Library/UefiHiiServicesLib.h>\r
 \r
-#include "NicIp4Variable.h"\r
-\r
-typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;\r
 \r
 //\r
 // Global variables\r
@@ -52,7 +50,6 @@ extern EFI_DRIVER_BINDING_PROTOCOL     gIp4ConfigDriverBinding;
 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
@@ -86,7 +83,7 @@ typedef struct _IP4CONFIG_CALLBACK_INFO {
   EFI_IPv4_ADDRESS                 Gateway;\r
 } IP4_SETTING_INFO;\r
 \r
-struct _IP4_CONFIG_INSTANCE {\r
+typedef struct _IP4_CONFIG_INSTANCE {\r
   UINT32                          Signature;\r
   EFI_HANDLE                      Controller;\r
   EFI_HANDLE                      Image;\r
@@ -122,8 +119,7 @@ struct _IP4_CONFIG_INSTANCE {
   // Identity of this interface and some configuration info.\r
   //\r
   NIC_ADDR                        NicAddr;\r
-  UINT16                          NicName[IP4_NIC_NAME_LENGTH];\r
-  UINT32                          NicIndex;\r
+  CHAR16                          *MacString;\r
   NIC_IP4_CONFIG_INFO             *NicConfig;\r
 \r
   //\r
@@ -132,7 +128,22 @@ struct _IP4_CONFIG_INSTANCE {
   EFI_DHCP4_PROTOCOL              *Dhcp4;\r
   EFI_HANDLE                      Dhcp4Handle;\r
   EFI_EVENT                       Dhcp4Event;\r
-};\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
@@ -173,28 +184,18 @@ EfiNicIp4ConfigSetInfo (
   );\r
 \r
 /**\r
-  Get the configure parameter for this NIC.\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
-  @param  ConfigLen              The length of the NicConfig buffer.\r
-  @param  NicConfig              The buffer to receive the NIC's configure\r
-                                 parameter.\r
+  @param  Instance               The IP4 CONFIG instance.\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
+  @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
-EFI_STATUS\r
-EFIAPI\r
+NIC_IP4_CONFIG_INFO *\r
 EfiNicIp4ConfigGetInfo (\r
-  IN  IP4_CONFIG_INSTANCE         *Instance,\r
-  IN OUT  UINTN                   *ConfigLen,\r
-  OUT NIC_IP4_CONFIG_INFO         *NicConfig\r
+  IN  IP4_CONFIG_INSTANCE   *Instance\r
   );\r
 \r
 /**\r
@@ -315,7 +316,7 @@ Ip4ConfigComponentNameGetDriverName (
                                 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 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
@@ -401,4 +402,132 @@ Ip4ConfigDriverBindingStop (
   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