/** @file\r
+ The driver binding for IP4 CONFIG protocol.\r
\r
-Copyright (c) 2006, Intel Corporation\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\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
-Module Name:\r
-\r
- Ip4ConfigDriver.c\r
-\r
-Abstract:\r
-\r
- The driver binding for IP4 CONFIG protocol.\r
-\r
-\r
**/\r
\r
\r
#include "Ip4Config.h"\r
+#include "Ip4ConfigNV.h"\r
\r
+EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding = {\r
+ Ip4ConfigDriverBindingSupported,\r
+ Ip4ConfigDriverBindingStart,\r
+ Ip4ConfigDriverBindingStop,\r
+ 0xa,\r
+ NULL,\r
+ NULL\r
+};\r
\r
/**\r
Stop all the auto configuration when the IP4 configure driver is\r
{\r
UINT32 Index;\r
\r
+ Ip4ConfigFormUnload ();\r
+\r
//\r
// Stop all the IP4_CONFIG instances\r
//\r
return NetLibDefaultUnload (ImageHandle);\r
}\r
\r
-//@MT: EFI_DRIVER_ENTRY_POINT (Ip4ConfigDriverEntryPoint)\r
+/**\r
+ The entry point for IP4 config driver which install the driver\r
+ binding and component name protocol on its image.\r
+\r
+ @param ImageHandle The image handle of the driver.\r
+ @param SystemTable The system table.\r
+\r
+ @retval EFI_SUCCES All the related protocols are installed on the driver.\r
+ @retval Others Failed to install protocols.\r
\r
+**/\r
EFI_STATUS\r
+EFIAPI\r
Ip4ConfigDriverEntryPoint (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- The entry point for IP4 config driver which install the driver\r
- binding and component name protocol on its image.\r
-\r
-Arguments:\r
-\r
- ImageHandle - The Image handle of the driver\r
- SystemTable - The system table\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - All the related protocols are installed on the driver\r
- Others - Failed to install the protocol\r
-\r
---*/\r
{\r
- return NetLibInstallAllDriverProtocolsWithUnload (\r
+ Ip4ConfigFormInit ();\r
+\r
+ return EfiLibInstallDriverBindingComponentName2 (\r
ImageHandle,\r
SystemTable,\r
&gIp4ConfigDriverBinding,\r
ImageHandle,\r
&gIp4ConfigComponentName,\r
- NULL,\r
- NULL,\r
- EfiIp4ConfigUnload\r
+ &gIp4ConfigComponentName2\r
);\r
}\r
\r
//\r
// Allocate an instance then initialize it\r
//\r
- Instance = NetAllocatePool (sizeof (IP4_CONFIG_INSTANCE));\r
+ Instance = AllocatePool (sizeof (IP4_CONFIG_INSTANCE));\r
\r
if (Instance == NULL) {\r
Status = EFI_OUT_OF_RESOURCES;\r
Instance->Controller = ControllerHandle;\r
Instance->Image = This->DriverBindingHandle;\r
\r
- Instance->Ip4ConfigProtocol = mIp4ConfigProtocolTemplate;\r
- Instance->NicIp4Protocol = mNicIp4ConfigProtocolTemplate;\r
+ CopyMem (&Instance->Ip4ConfigProtocol, &mIp4ConfigProtocolTemplate, sizeof (mIp4ConfigProtocolTemplate));\r
\r
Instance->State = IP4_CONFIG_STATE_IDLE;\r
Instance->Mnp = Mnp;\r
\r
Instance->NicAddr.Type = (UINT16) SnpMode.IfType;\r
Instance->NicAddr.Len = (UINT8) SnpMode.HwAddressSize;\r
- CopyMem (&Instance->NicAddr.MacAddr, &SnpMode.CurrentAddress, sizeof (EFI_MAC_ADDRESS));\r
+ CopyMem (&Instance->NicAddr.MacAddr, &SnpMode.CurrentAddress, Instance->NicAddr.Len);\r
\r
//\r
// Add it to the global list, and compose the name\r
goto ON_ERROR;\r
}\r
\r
+ Status = Ip4ConfigDeviceInit (Instance);\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Try to add a port configuration page for this controller.\r
+ //\r
+ Ip4ConfigUpdateForm (Instance, TRUE);\r
+ }\r
+\r
//\r
// Install the IP4_CONFIG and NIC_IP4CONFIG protocols\r
//\r
&ControllerHandle,\r
&gEfiIp4ConfigProtocolGuid,\r
&Instance->Ip4ConfigProtocol,\r
- &gEfiNicIp4ConfigProtocolGuid,\r
- &Instance->NicIp4Protocol,\r
NULL\r
);\r
\r
NewVariable = Ip4ConfigModifyVariable (Variable, &Instance->NicAddr, NULL);\r
\r
} else if (NicConfig->Source == IP4_CONFIG_SOURCE_DHCP) {\r
- NetZeroMem (&NicConfig->Ip4Info, sizeof (EFI_IP4_IPCONFIG_DATA));\r
+ ZeroMem (&NicConfig->Ip4Info, sizeof (EFI_IP4_IPCONFIG_DATA));\r
NewVariable = Ip4ConfigModifyVariable (Variable, &Instance->NicAddr, NicConfig);\r
\r
}\r
Ip4ConfigWriteVariable (NewVariable);\r
\r
if (NewVariable != NULL) {\r
- NetFreePool (NewVariable);\r
+ gBS->FreePool (NewVariable);\r
}\r
\r
ON_EXIT:\r
- NetFreePool (Variable);\r
+ gBS->FreePool (Variable);\r
\r
if (NicConfig != NULL) {\r
- NetFreePool (NicConfig);\r
+ gBS->FreePool (NicConfig);\r
}\r
\r
return EFI_SUCCESS;\r
\r
ON_ERROR:\r
if (Instance != NULL) {\r
- NetFreePool (Instance);\r
+ gBS->FreePool (Instance);\r
}\r
\r
if (Mnp != NULL) {\r
\r
Instance = IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (Ip4Config);\r
\r
+ Ip4ConfigDeviceUnload (Instance);\r
+\r
//\r
// Unload the protocols first to inform the top drivers\r
//\r
NicHandle,\r
&gEfiIp4ConfigProtocolGuid,\r
&Instance->Ip4ConfigProtocol,\r
- &gEfiNicIp4ConfigProtocolGuid,\r
- &Instance->NicIp4Protocol,\r
NULL\r
);\r
\r
\r
Ip4ConfigCleanConfig (Instance);\r
mIp4ConfigNicList[Instance->NicIndex] = NULL;\r
- NetFreePool (Instance);\r
+ gBS->FreePool (Instance);\r
\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding = {\r
- Ip4ConfigDriverBindingSupported,\r
- Ip4ConfigDriverBindingStart,\r
- Ip4ConfigDriverBindingStop,\r
- 0xa,\r
- NULL,\r
- NULL\r
-};\r