#include <Library/DpcLib.h>\r
#include <Library/UefiHiiServicesLib.h>\r
\r
-typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;\r
\r
//\r
// Global variables\r
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
EFI_DHCP4_PROTOCOL *Dhcp4;\r
EFI_HANDLE Dhcp4Handle;\r
EFI_EVENT Dhcp4Event;\r
-};\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
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
#endif\r
NULL\r
};\r
\r
+//\r
+// The intance of template of IP4 Config private data\r
+//\r
+IP4_CONFIG_INSTANCE mIp4ConfigTemplate = {\r
+ IP4_CONFIG_INSTANCE_SIGNATURE,\r
+ NULL,\r
+ NULL,\r
+ (EFI_DEVICE_PATH_PROTOCOL *) NULL,\r
+ {\r
+ NULL,\r
+ NULL,\r
+ NULL\r
+ },\r
+ {\r
+ NULL,\r
+ NULL,\r
+ NULL\r
+ },\r
+ NULL,\r
+ (EFI_DEVICE_PATH_PROTOCOL *) NULL,\r
+ NULL,\r
+ {\r
+ FALSE,\r
+ FALSE,\r
+ {\r
+ 0\r
+ },\r
+ {\r
+ 0\r
+ },\r
+ {\r
+ 0\r
+ }\r
+ },\r
+ 0,\r
+ (EFI_MANAGED_NETWORK_PROTOCOL *) NULL,\r
+ NULL,\r
+ NULL,\r
+ NULL,\r
+ EFI_NOT_READY,\r
+ {\r
+ 0,\r
+ 0,\r
+ {\r
+ 0\r
+ }\r
+ },\r
+ (CHAR16 *) NULL,\r
+ (NIC_IP4_CONFIG_INFO *) NULL,\r
+ (EFI_DHCP4_PROTOCOL *) NULL,\r
+ NULL,\r
+ NULL\r
+};\r
+\r
/**\r
The entry point for IP4 config driver which install the driver\r
binding and component name protocol on its image.\r
//\r
// Allocate an instance then initialize it\r
//\r
- Instance = AllocateZeroPool (sizeof (IP4_CONFIG_INSTANCE));\r
+ Instance = AllocateCopyPool (sizeof (IP4_CONFIG_INSTANCE), &mIp4ConfigTemplate);\r
\r
if (Instance == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
goto ON_ERROR;\r
}\r
\r
- Instance->Signature = IP4_CONFIG_INSTANCE_SIGNATURE;\r
Instance->Controller = ControllerHandle;\r
Instance->Image = This->DriverBindingHandle;\r
Instance->ParentDevicePath = ParentDevicePath;\r
Instance->Mnp = Mnp;\r
Instance->MnpHandle = MnpHandle;\r
\r
- Instance->DoneEvent = NULL;\r
- Instance->ReconfigEvent = NULL;\r
- Instance->Result = EFI_NOT_READY;\r
- Instance->NicConfig = NULL;\r
-\r
- Instance->Dhcp4 = NULL;\r
- Instance->Dhcp4Handle = NULL;\r
- Instance->Dhcp4Event = NULL;\r
-\r
Status = Mnp->GetModeData (Mnp, NULL, &SnpMode);\r
\r
if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {\r