summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c18
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h127
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c31
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf8
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.vfr93
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.unibin3088 -> 2846 bytes
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c917
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.h50
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4NvData.h23
-rw-r--r--MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c6
10 files changed, 435 insertions, 838 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
index fa0445e247..5f8821a4d6 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
@@ -49,7 +49,7 @@ Ip4ConfigGetNicInfo (
Config = Ip4ConfigFindNicVariable (Variable, NicAddr);
if (Config == NULL) {
- gBS->FreePool (Variable);
+ FreePool (Variable);
return NULL;
}
@@ -62,14 +62,14 @@ Ip4ConfigGetNicInfo (
Ip4ConfigWriteVariable (NewVariable);
if (NewVariable != NULL) {
- gBS->FreePool (NewVariable);
+ FreePool (NewVariable);
};
- gBS->FreePool (Config);
+ FreePool (Config);
Config = NULL;
}
- gBS->FreePool (Variable);
+ FreePool (Variable);
return Config;
}
@@ -131,7 +131,7 @@ EfiNicIp4ConfigGetInfo (
*ConfigLen = Len;
- gBS->FreePool (Config);
+ FreePool (Config);
return Status;
}
@@ -200,14 +200,14 @@ EfiNicIp4ConfigSetInfo (
Status = Ip4ConfigWriteVariable (NewVariable);
if (NewVariable != NULL) {
- gBS->FreePool (NewVariable);
+ FreePool (NewVariable);
}
//
// Variable is NULL when saving the first configure parameter
//
if (Variable != NULL) {
- gBS->FreePool (Variable);
+ FreePool (Variable);
}
if (EFI_ERROR (Status)) {
@@ -277,7 +277,7 @@ Ip4ConfigOnDhcp4Complete (
if (Instance->NicConfig != NULL) {
ASSERT (Instance->NicConfig->Source == IP4_CONFIG_SOURCE_DHCP);
Perment = Instance->NicConfig->Perment;
- gBS->FreePool (Instance->NicConfig);
+ FreePool (Instance->NicConfig);
}
Instance->NicConfig = AllocatePool (sizeof (NIC_IP4_CONFIG_INFO) + 2* sizeof (EFI_IP4_ROUTE_TABLE));
@@ -741,7 +741,7 @@ Ip4ConfigCleanConfig (
)
{
if (Instance->NicConfig != NULL) {
- gBS->FreePool (Instance->NicConfig);
+ FreePool (Instance->NicConfig);
Instance->NicConfig = NULL;
}
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
index 8cc789d273..cd2e6cd396 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h
@@ -1,7 +1,7 @@
/** @file
Header file for IP4Config driver.
-Copyright (c) 2006 - 2009, Intel Corporation.<BR>
+Copyright (c) 2006 - 2010, Intel Corporation.<BR>
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<BR>
@@ -23,6 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiConfigRouting.h>
+#include <Protocol/ServiceBinding.h>
#include <Guid/MdeModuleHii.h>
@@ -38,6 +39,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/HiiLib.h>
#include <Library/PrintLib.h>
#include <Library/DpcLib.h>
+#include <Library/UefiHiiServicesLib.h>
#include "NicIp4Variable.h"
@@ -46,27 +48,24 @@ typedef struct _IP4_CONFIG_INSTANCE IP4_CONFIG_INSTANCE;
//
// Global variables
//
-extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
-
-extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
-extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
+extern EFI_DRIVER_BINDING_PROTOCOL gIp4ConfigDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gIp4ConfigComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gIp4ConfigComponentName2;
+
+extern IP4_CONFIG_INSTANCE *mIp4ConfigNicList[MAX_IP4_CONFIG_IN_VARIABLE];
+extern EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate;
#define IP4_PROTO_ICMP 0x01
#define IP4_CONFIG_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')
-typedef enum {
- IP4_CONFIG_STATE_IDLE = 0,
- IP4_CONFIG_STATE_STARTED,
- IP4_CONFIG_STATE_CONFIGURED
-} IP4_CONFIG_STATE;
+#define IP4_CONFIG_STATE_IDLE 0
+#define IP4_CONFIG_STATE_STARTED 1
+#define IP4_CONFIG_STATE_CONFIGURED 2
+
+#define DHCP_TAG_PARA_LIST 55
+#define DHCP_TAG_NETMASK 1
+#define DHCP_TAG_ROUTER 3
-typedef enum {
- DHCP_TAG_PARA_LIST = 55,
- DHCP_TAG_NETMASK = 1,
- DHCP_TAG_ROUTER = 3
-} DHCP_TAGS;
//
// Configure the DHCP to request the routers and netmask
@@ -79,93 +78,67 @@ typedef struct {
} IP4_CONFIG_DHCP4_OPTION;
#pragma pack()
-
-typedef struct {
- UINTN DeviceNum;
- BOOLEAN Enabled;
- EFI_IPv4_ADDRESS LocalIp;
- EFI_IPv4_ADDRESS SubnetMask;
- EFI_IPv4_ADDRESS Gateway;
-} IP4_CONFIG_SESSION_DATA;
-
-typedef struct _IP4_CONFIG_FORM_ENTRY {
- LIST_ENTRY Link;
- IP4_CONFIG_INSTANCE *Ip4ConfigInstance;
- EFI_HANDLE Controller;
- CHAR16 MacString[95];
- EFI_STRING_ID PortTitleToken;
- EFI_STRING_ID PortTitleHelpToken;
- IP4_CONFIG_SESSION_DATA SessionConfigData;
-} IP4CONFIG_FORM_ENTRY;
-
-#define IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'C')
-
-typedef struct _IP4_FORM_CALLBACK_INFO_INSTANCE {
- UINTN Signature;
- EFI_HANDLE DriverHandle;
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
- EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
- EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
- EFI_HII_HANDLE RegisteredHandle;
- IP4CONFIG_FORM_ENTRY *Current;
-} IP4_FORM_CALLBACK_INFO;
-
-#define IP4CONFIG_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK(Callback) \
- CR ( \
- Callback, \
- IP4_FORM_CALLBACK_INFO, \
- ConfigAccess, \
- IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE \
- )
+typedef struct _IP4CONFIG_CALLBACK_INFO {
+ BOOLEAN Configured;
+ BOOLEAN DhcpEnabled;
+ EFI_IPv4_ADDRESS LocalIp;
+ EFI_IPv4_ADDRESS SubnetMask;
+ EFI_IPv4_ADDRESS Gateway;
+} IP4_SETTING_INFO;
struct _IP4_CONFIG_INSTANCE {
- UINT32 Signature;
- EFI_HANDLE Controller;
- EFI_HANDLE Image;
-
- EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
-
- IP4_FORM_CALLBACK_INFO Ip4FormCallbackInfo;
+ UINT32 Signature;
+ EFI_HANDLE Controller;
+ EFI_HANDLE Image;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+
+ EFI_IP4_CONFIG_PROTOCOL Ip4ConfigProtocol;
+
+ EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccessProtocol;
+ EFI_HANDLE ChildHandle;
+ EFI_DEVICE_PATH_PROTOCOL *HiiVendorDevicePath;
+ EFI_HII_HANDLE RegisteredHandle;
+ IP4_SETTING_INFO Ip4ConfigCallbackInfo;
//
// NicConfig's state, such as IP4_CONFIG_STATE_IDLE
//
- INTN State;
+ INTN State;
//
// Mnp child to keep the connection with MNP.
//
- EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
- EFI_HANDLE MnpHandle;
+ EFI_MANAGED_NETWORK_PROTOCOL *Mnp;
+ EFI_HANDLE MnpHandle;
//
// User's requests data
//
- EFI_EVENT DoneEvent;
- EFI_EVENT ReconfigEvent;
- EFI_STATUS Result;
+ 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;
+ 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;
+ 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_IP4FORM_CALLBACK_INFO(this) \
- CR (this, IP4_CONFIG_INSTANCE, Ip4FormCallbackInfo, IP4_CONFIG_INSTANCE_SIGNATURE)
+#define IP4_CONFIG_INSTANCE_FROM_CONFIG_ACCESS(this) \
+ CR (this, IP4_CONFIG_INSTANCE, HiiConfigAccessProtocol, IP4_CONFIG_INSTANCE_SIGNATURE)
/**
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
index 503c7cb814..60cf318772 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c
@@ -42,8 +42,6 @@ EfiIp4ConfigUnload (
{
UINT32 Index;
- Ip4ConfigFormUnload ();
-
//
// Stop all the IP4_CONFIG instances
//
@@ -81,8 +79,6 @@ Ip4ConfigDriverEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- Ip4ConfigFormInit ();
-
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
@@ -161,6 +157,16 @@ Ip4ConfigDriverBindingStart (
IP4_CONFIG_VARIABLE *NewVariable;
EFI_STATUS Status;
UINT32 Index;
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+
+ Status = gBS->HandleProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ParentDevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
//
// Check for multiple start.
@@ -222,6 +228,7 @@ Ip4ConfigDriverBindingStart (
Instance->Signature = IP4_CONFIG_INSTANCE_SIGNATURE;
Instance->Controller = ControllerHandle;
Instance->Image = This->DriverBindingHandle;
+ Instance->ParentDevicePath = ParentDevicePath;
CopyMem (&Instance->Ip4ConfigProtocol, &mIp4ConfigProtocolTemplate, sizeof (mIp4ConfigProtocolTemplate));
@@ -272,12 +279,6 @@ Ip4ConfigDriverBindingStart (
}
Status = Ip4ConfigDeviceInit (Instance);
- if (!EFI_ERROR (Status)) {
- //
- // Try to add a port configuration page for this controller.
- //
- Ip4ConfigUpdateForm (Instance, TRUE);
- }
//
// Install the IP4_CONFIG and NIC_IP4CONFIG protocols
@@ -335,21 +336,21 @@ Ip4ConfigDriverBindingStart (
Ip4ConfigWriteVariable (NewVariable);
if (NewVariable != NULL) {
- gBS->FreePool (NewVariable);
+ FreePool (NewVariable);
}
ON_EXIT:
- gBS->FreePool (Variable);
+ FreePool (Variable);
if (NicConfig != NULL) {
- gBS->FreePool (NicConfig);
+ FreePool (NicConfig);
}
return EFI_SUCCESS;
ON_ERROR:
if (Instance != NULL) {
- gBS->FreePool (Instance);
+ FreePool (Instance);
}
if (Mnp != NULL) {
@@ -506,7 +507,7 @@ Ip4ConfigDriverBindingStop (
Ip4ConfigCleanConfig (Instance);
mIp4ConfigNicList[Instance->NicIndex] = NULL;
- gBS->FreePool (Instance);
+ FreePool (Instance);
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
index 2fe1b3bd90..e49c895a85 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
@@ -1,7 +1,6 @@
#/** @file
# Component name for module Ip4Config
#
-# FIX ME!
# Copyright (c) 2006 - 2009, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
@@ -28,10 +27,6 @@
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
-# DRIVER_BINDING = gIp4ConfigDriverBinding
-# COMPONENT_NAME = gIp4ConfigComponentName
-# COMPONENT_NAME2 = gIp4ConfigComponentName2
-#
[Sources.common]
ComponentName.c
@@ -68,9 +63,8 @@
gEfiIp4ConfigProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiManagedNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDhcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[Guids]
- gEfiIfrTianoGuid ## CONSUMES ## Guid
gEfiNicIp4ConfigVariableGuid ## CONSUMES ## Guid
+
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.vfr b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.vfr
index eb5b40848f..578045ffe2 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.vfr
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.vfr
@@ -1,7 +1,7 @@
/** @file
Vfr file for IP4 config.
-Copyright (c) 2009, Intel Corporation.<BR>
+Copyright (c) 2009 - 2010, Intel Corporation.<BR>
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
@@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define EFI_NETWORK_DEVICE_CLASS 0x04
formset
- guid = EFI_NIC_IP4_CONFIG_VARIABLE_GUID,
+ guid = EFI_NIC_IP4_CONFIG_NVDATA_GUID,
title = STRING_TOKEN(STR_IP4_CONFIG_FORM_TITLE),
help = STRING_TOKEN(STR_IP4_CONFIG_FORM_HELP),
class = EFI_NETWORK_DEVICE_CLASS,
@@ -24,53 +24,57 @@ formset
varstore IP4_CONFIG_IFR_NVDATA,
name = EfiNicIp4ConfigVariable,
- guid = EFI_NIC_IP4_CONFIG_VARIABLE_GUID;
+ guid = EFI_NIC_IP4_CONFIG_NVDATA_GUID;
form formid = FORMID_MAIN_FORM,
- title = STRING_TOKEN(STR_IP4_MAIN_FORM_TITLE);
-
- label DEVICE_ENTRY_LABEL;
- label LABEL_END;
-
- endform;
-
- form formid = FORMID_DEVICE_FORM,
title = STRING_TOKEN(STR_IP4_DEVICE_FORM_TITLE);
- checkbox varid = EfiNicIp4ConfigVariable.DhcpEnable,
- prompt = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
- help = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
+ checkbox varid = EfiNicIp4ConfigVariable.Configure,
+ prompt = STRING_TOKEN(STR_IP4_CONFIGURE),
+ help = STRING_TOKEN(STR_IP4_CONFIGURE),
flags = INTERACTIVE,
- key = KEY_DHCP_ENABLE,
+ key = KEY_ENABLE,
endcheckbox;
- suppressif ideqval EfiNicIp4ConfigVariable.DhcpEnable == 0x01;
- string varid = EfiNicIp4ConfigVariable.StationAddress,
- prompt = STRING_TOKEN(STR_IP4_LOCAL_IP_ADDRESS),
- help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
- flags = INTERACTIVE,
- key = KEY_LOCAL_IP,
- minsize = IP_MIN_SIZE,
- maxsize = IP_MAX_SIZE,
- endstring;
-
- string varid = EfiNicIp4ConfigVariable.SubnetMask,
- prompt = STRING_TOKEN(STR_IP4_LOCAL_MASK),
- help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
- flags = INTERACTIVE,
- key = KEY_SUBNET_MASK,
- minsize = IP_MIN_SIZE,
- maxsize = IP_MAX_SIZE,
- endstring;
-
- string varid = EfiNicIp4ConfigVariable.GatewayAddress,
- prompt = STRING_TOKEN(STR_IP4_LOCAL_GATEWAY),
- help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
- flags = INTERACTIVE,
- key = KEY_GATE_WAY,
- minsize = IP_MIN_SIZE,
- maxsize = IP_MAX_SIZE,
- endstring;
+ suppressif ideqval EfiNicIp4ConfigVariable.Configure == 0x00;
+
+ checkbox varid = EfiNicIp4ConfigVariable.DhcpEnable,
+ prompt = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
+ help = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
+ flags = INTERACTIVE,
+ key = KEY_DHCP_ENABLE,
+ endcheckbox;
+ endif;
+
+ suppressif ideqval EfiNicIp4ConfigVariable.DhcpEnable == 0x01 OR ideqval EfiNicIp4ConfigVariable.Configure == 0x00;
+
+ string varid = EfiNicIp4ConfigVariable.StationAddress,
+ prompt = STRING_TOKEN(STR_IP4_LOCAL_IP_ADDRESS),
+ help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
+ flags = INTERACTIVE,
+ key = KEY_LOCAL_IP,
+ minsize = IP_MIN_SIZE,
+ maxsize = IP_MAX_SIZE,
+ endstring;
+
+ string varid = EfiNicIp4ConfigVariable.SubnetMask,
+ prompt = STRING_TOKEN(STR_IP4_LOCAL_MASK),
+ help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
+ flags = INTERACTIVE,
+ key = KEY_SUBNET_MASK,
+ minsize = IP_MIN_SIZE,
+ maxsize = IP_MAX_SIZE,
+ endstring;
+
+ string varid = EfiNicIp4ConfigVariable.GatewayAddress,
+ prompt = STRING_TOKEN(STR_IP4_LOCAL_GATEWAY),
+ help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
+ flags = INTERACTIVE,
+ key = KEY_GATE_WAY,
+ minsize = IP_MIN_SIZE,
+ maxsize = IP_MAX_SIZE,
+ endstring;
+
endif;
subtitle text = STRING_TOKEN(STR_NULL);
@@ -81,11 +85,6 @@ formset
flags = INTERACTIVE,
key = KEY_SAVE_CHANGES;
- goto FORMID_MAIN_FORM,
- prompt = STRING_TOKEN (STR_RETURN_MAIN_FORM),
- help = STRING_TOKEN (STR_RETURN_MAIN_FORM),
- flags = 0;
-
endform;
endformset;
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni
index 9e66e78488..b7629b72c4 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxeStrings.uni
Binary files differ
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c
index a5b7c93ebe..c3fbcb978e 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.c
@@ -1,7 +1,7 @@
/** @file
Helper functions for configuring or getting the parameters relating to Ip4.
-Copyright (c) 2009, Intel Corporation.<BR>
+Copyright (c) 2009 - 2010, Intel Corporation.<BR>
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
@@ -16,39 +16,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 Ip4HexString[] = "0123456789ABCDEFabcdef";
-UINTN mNumberOfIp4Devices = 0;
+EFI_GUID mNicIp4ConfigNvDataGuid = EFI_NIC_IP4_CONFIG_NVDATA_GUID;
-IP4_FORM_CALLBACK_INFO *mCallbackInfo = NULL;
-
-LIST_ENTRY mIp4ConfigFormList = {
- &mIp4ConfigFormList,
- &mIp4ConfigFormList
+//
+// Template used to mark the end of a list of packages
+//
+GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_HII_PACKAGE_HEADER mEndOfPakageList = {
+ sizeof (EFI_HII_PACKAGE_HEADER),
+ EFI_HII_PACKAGE_END
};
-HII_VENDOR_DEVICE_PATH mIp4ConifgHiiVendorDevicePath = {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- {
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
- }
- },
- //
- // {6D3FD906-42B9-4220-9E63-9D8C972D58EE}
- //
- { 0x6d3fd906, 0x42b9, 0x4220, { 0x9e, 0x63, 0x9d, 0x8c, 0x97, 0x2d, 0x58, 0xee } }
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
- }
- }
-};
/**
Convert the mac address into a hexadecimal encoded "-" seperated string.
@@ -198,8 +175,8 @@ Ip4ConfigIpToStr (
/**
Convert the network configuration data into the IFR data.
- @param[in] ConfigFormEntry The IP4 configuration form entry.
- @param[out] IfrNvData The IFR nv data.
+ @param[in] Ip4ConfigInstance The IP4Config instance
+ @param[out] IfrFormNvData The IFR nv data.
**/
VOID
Ip4ConfigConvertDeviceConfigDataToIfrNvData (
@@ -211,13 +188,12 @@ Ip4ConfigConvertDeviceConfigDataToIfrNvData (
NIC_IP4_CONFIG_INFO *NicConfig;
UINTN ConfigLen;
- IfrFormNvData->DhcpEnable = 1;
-
ConfigLen = sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * 2;
NicConfig = AllocateZeroPool (ConfigLen);
ASSERT (NicConfig != NULL);
Status = EfiNicIp4ConfigGetInfo (Ip4ConfigInstance, &ConfigLen, NicConfig);
if (!EFI_ERROR (Status)) {
+ IfrFormNvData->Configure = 1;
if (NicConfig->Source == IP4_CONFIG_SOURCE_DHCP) {
IfrFormNvData->DhcpEnable = 1;
} else {
@@ -226,39 +202,104 @@ Ip4ConfigConvertDeviceConfigDataToIfrNvData (
Ip4ConfigIpToStr (&NicConfig->Ip4Info.SubnetMask, IfrFormNvData->SubnetMask);
Ip4ConfigIpToStr (&NicConfig->Ip4Info.RouteTable[1].GatewayAddress, IfrFormNvData->GatewayAddress);
}
+ } else {
+ IfrFormNvData->Configure = 0;
}
+
FreePool (NicConfig);
}
/**
- Get the IP4 configuration form entry by the index of the goto opcode actived.
+ Convert the IFR data into the network configuration data and set the IP
+ configure parameters for the NIC.
+
+ @param[in, out] Ip4ConfigInstance The IP4Config instance.
- @param[in] Index The 0-based index of the goto opcode actived.
+ @retval EFI_SUCCESS The configure parameter for this NIC was
+ set successfully.
+ @retval EFI_ALREADY_STARTED There is a pending auto configuration.
+ @retval EFI_NOT_FOUND No auto configure parameter is found.
- @return The IP4 configuration form entry found.
**/
-IP4CONFIG_FORM_ENTRY *
-Ip4GetConfigFormEntryByIndex (
- IN UINT32 Index
+EFI_STATUS
+Ip4ConfigConvertIfrNvDataToDeviceConfigData (
+ IN OUT IP4_CONFIG_INSTANCE *Ip4ConfigInstance
)
{
- UINT32 CurrentIndex;
- LIST_ENTRY *Entry;
- IP4CONFIG_FORM_ENTRY *ConfigFormEntry;
+ EFI_STATUS Status;
+ EFI_IP_ADDRESS HostIp;
+ EFI_IP_ADDRESS SubnetMask;
+ EFI_IP_ADDRESS Gateway;
+ EFI_INPUT_KEY Key;
+ NIC_IP4_CONFIG_INFO *NicInfo;
+ EFI_IP_ADDRESS Ip;
- CurrentIndex = 0;
- ConfigFormEntry = NULL;
+ if (!Ip4ConfigInstance->Ip4ConfigCallbackInfo.Configured) {
+ //
+ // Clear the variable
+ //
+ ZeroMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo, sizeof (IP4_SETTING_INFO));
- NET_LIST_FOR_EACH (Entry, &mIp4ConfigFormList) {
- if (CurrentIndex == Index) {
- ConfigFormEntry = NET_LIST_USER_STRUCT (Entry, IP4CONFIG_FORM_ENTRY, Link);
- break;
+ Status = EfiNicIp4ConfigSetInfo (Ip4ConfigInstance, NULL, TRUE);
+ if (Status == EFI_NOT_FOUND) {
+ return EFI_SUCCESS;
}
- CurrentIndex++;
+ return Status;
}
- return ConfigFormEntry;
+ NicInfo = AllocateZeroPool (sizeof (NIC_IP4_CONFIG_INFO) + 2 * sizeof (EFI_IP4_ROUTE_TABLE));
+ ASSERT (NicInfo != NULL);
+
+ NicInfo->Ip4Info.RouteTable = (EFI_IP4_ROUTE_TABLE *) (NicInfo + 1);
+
+ if (!Ip4ConfigInstance->Ip4ConfigCallbackInfo.DhcpEnabled) {
+ CopyMem (&HostIp.v4, &Ip4ConfigInstance->Ip4ConfigCallbackInfo.LocalIp, sizeof (HostIp.v4));
+ CopyMem (&SubnetMask.v4, &Ip4ConfigInstance->Ip4ConfigCallbackInfo.SubnetMask, sizeof (SubnetMask.v4));
+ CopyMem (&Gateway.v4, &Ip4ConfigInstance->Ip4ConfigCallbackInfo.Gateway, sizeof (Gateway.v4));
+
+ if (!Ip4IsUnicast (NTOHL (HostIp.Addr[0]), 0)) {
+ CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
+ return EFI_INVALID_PARAMETER;
+ }
+ if (EFI_IP4_EQUAL (&SubnetMask, &mZeroIp4Addr)) {
+ CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Subnet Mask!", NULL);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((Gateway.Addr[0] != 0)) {
+ if (SubnetMask.Addr[0] == 0) {
+ CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Gateway address is set but subnet mask is zero.", NULL);
+ return EFI_INVALID_PARAMETER;
+
+ } else if (!IP4_NET_EQUAL (HostIp.Addr[0], Gateway.Addr[0], SubnetMask.Addr[0])) {
+ CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Local IP and Gateway are not in the same subnet.", NULL);
+ return EFI_INVALID_PARAMETER; }
+ }
+
+ NicInfo->Source = IP4_CONFIG_SOURCE_STATIC;
+ NicInfo->Ip4Info.RouteTableSize = 2;
+
+ CopyMem (&NicInfo->Ip4Info.StationAddress, &HostIp.v4, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&NicInfo->Ip4Info.SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
+
+ Ip.Addr[0] = HostIp.Addr[0] & SubnetMask.Addr[0];
+
+ CopyMem (&NicInfo->Ip4Info.RouteTable[0].SubnetAddress, &Ip.v4, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&NicInfo->Ip4Info.RouteTable[0].SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&NicInfo->Ip4Info.RouteTable[1].GatewayAddress, &Gateway.v4, sizeof (EFI_IPv4_ADDRESS));
+
+ } else {
+ NicInfo->Source = IP4_CONFIG_SOURCE_DHCP;
+ ZeroMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.LocalIp, sizeof (EFI_IPv4_ADDRESS));
+ ZeroMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
+ ZeroMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.Gateway, sizeof (EFI_IPv4_ADDRESS));
+ }
+
+ NicInfo->Perment = TRUE;
+ CopyMem (&NicInfo->NicAddr, &Ip4ConfigInstance->NicAddr, sizeof (NIC_ADDR));
+
+ return EfiNicIp4ConfigSetInfo (Ip4ConfigInstance, NicInfo, TRUE);
}
/**
@@ -335,51 +376,74 @@ Ip4DeviceExtractConfig (
EFI_STATUS Status;
UINTN ConfigLen;
NIC_IP4_CONFIG_INFO *IfrDeviceNvData;
- IP4_FORM_CALLBACK_INFO *Private;
- EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
IP4_CONFIG_INSTANCE *Ip4ConfigInstance;
+ IP4_CONFIG_IFR_NVDATA *IfrFormNvData;
- if (Request == NULL) {
+ if (Request == NULL || Progress == NULL || Results == NULL) {
return EFI_INVALID_PARAMETER;
}
*Progress = Request;
+ Ip4ConfigInstance = IP4_CONFIG_INSTANCE_FROM_CONFIG_ACCESS (This);
+
//
// Check Request data in <ConfigHdr>.
//
- if (!HiiIsConfigHdrMatch (Request, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
- return EFI_NOT_FOUND;
- }
+ if (HiiIsConfigHdrMatch (Request, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
+ IfrDeviceNvData = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
+ if (IfrDeviceNvData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
- Private = IP4CONFIG_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
- Ip4ConfigInstance = IP4_CONFIG_INSTANCE_FROM_IP4FORM_CALLBACK_INFO (Private);
+ ConfigLen = sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * 2;
+ Status = EfiNicIp4ConfigGetInfo (Ip4ConfigInstance, &ConfigLen, IfrDeviceNvData);
+ if (EFI_ERROR (Status)) {
+ FreePool (IfrDeviceNvData);
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
+ //
+ Status = gHiiConfigRouting->BlockToConfig (
+ gHiiConfigRouting,
+ Request,
+ (UINT8 *) IfrDeviceNvData,
+ NIC_ITEM_CONFIG_SIZE,
+ Results,
+ Progress
+ );
+
+ FreePool (IfrDeviceNvData);
- IfrDeviceNvData = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
- if (IfrDeviceNvData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
+ } else if (HiiIsConfigHdrMatch (Request, &mNicIp4ConfigNvDataGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
- Status = EfiNicIp4ConfigGetInfo (Ip4ConfigInstance, &ConfigLen, IfrDeviceNvData);
- if (EFI_ERROR (Status)) {
- FreePool (IfrDeviceNvData);
+ IfrFormNvData = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
+ if (IfrFormNvData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Ip4ConfigConvertDeviceConfigDataToIfrNvData (Ip4ConfigInstance, IfrFormNvData);
+
+ //
+ // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
+ //
+ Status = gHiiConfigRouting->BlockToConfig (
+ gHiiConfigRouting,
+ Request,
+ (UINT8 *) IfrFormNvData,
+ sizeof (IP4_CONFIG_IFR_NVDATA),
+ Results,
+ Progress
+ );
+
+ FreePool (IfrFormNvData);
+
+ } else {
return EFI_NOT_FOUND;
}
- //
- // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
- //
- HiiConfigRouting = Private->ConfigRouting;
- Status = HiiConfigRouting->BlockToConfig (
- HiiConfigRouting,
- Request,
- (UINT8 *) IfrDeviceNvData,
- NIC_ITEM_CONFIG_SIZE,
- Results,
- Progress
- );
-
- FreePool (IfrDeviceNvData);
return Status;
}
@@ -428,191 +492,81 @@ Ip4DeviceRouteConfig (
EFI_STATUS Status;
UINTN BufferSize;
NIC_IP4_CONFIG_INFO *IfrDeviceNvData;
+ IP4_CONFIG_IFR_NVDATA *IfrFormNvData;
NIC_IP4_CONFIG_INFO *NicInfo;
- IP4_FORM_CALLBACK_INFO *Private;
- EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
IP4_CONFIG_INSTANCE *Ip4ConfigInstance;
EFI_MAC_ADDRESS ZeroMac;
- if (Configuration == NULL) {
+ if (Configuration == NULL || Progress == NULL) {
return EFI_INVALID_PARAMETER;
}
*Progress = Configuration;
- //
- // Check Routing data in <ConfigHdr>.
- //
- if (!HiiIsConfigHdrMatch (Configuration, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
- return EFI_NOT_FOUND;
- }
-
- Private = IP4CONFIG_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
- Ip4ConfigInstance = IP4_CONFIG_INSTANCE_FROM_IP4FORM_CALLBACK_INFO (Private);
-
- IfrDeviceNvData = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
- if (IfrDeviceNvData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
+ Ip4ConfigInstance = IP4_CONFIG_INSTANCE_FROM_CONFIG_ACCESS (This);
//
- // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
+ // Check Routing data in <ConfigHdr>.
//
- HiiConfigRouting = Private->ConfigRouting;
- BufferSize = NIC_ITEM_CONFIG_SIZE;
- Status = HiiConfigRouting->ConfigToBlock (
- HiiConfigRouting,
- Configuration,
- (UINT8 *) IfrDeviceNvData,
- &BufferSize,
- Progress
- );
- if (!EFI_ERROR (Status)) {
- ZeroMem (&ZeroMac, sizeof (EFI_MAC_ADDRESS));
- if (CompareMem (&IfrDeviceNvData->NicAddr.MacAddr, &ZeroMac, IfrDeviceNvData->NicAddr.Len) != 0) {
- BufferSize = sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * IfrDeviceNvData->Ip4Info.RouteTableSize;
- NicInfo = AllocateCopyPool (BufferSize, IfrDeviceNvData);
- Status = EfiNicIp4ConfigSetInfo (Ip4ConfigInstance, NicInfo, TRUE);
- } else {
- Status = EfiNicIp4ConfigSetInfo (Ip4ConfigInstance, NULL, TRUE);
+ if (HiiIsConfigHdrMatch (Configuration, &mNicIp4ConfigNvDataGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
+ //
+ // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
+ //
+ IfrFormNvData = AllocateZeroPool (sizeof (IP4_CONFIG_IFR_NVDATA));
+ if (IfrFormNvData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- }
- FreePool (IfrDeviceNvData);
- return Status;
-
-}
-
-/**
- This function allows the caller to request the current
- configuration for one or more named elements. The resulting
- string is in <ConfigAltResp> format. Any and all alternative
- configuration strings shall also be appended to the end of the
- current configuration string. If they are, they must appear
- after the current configuration. They must contain the same
- routing (GUID, NAME, PATH) as the current configuration string.
- They must have an additional description indicating the type of
- alternative configuration the string represents,
- "ALTCFG=<StringToken>". That <StringToken> (when
- converted from Hex UNICODE to binary) is a reference to a
- string in the associated string pack.
+ BufferSize = NIC_ITEM_CONFIG_SIZE;
+ Status = gHiiConfigRouting->ConfigToBlock (
+ gHiiConfigRouting,
+ Configuration,
+ (UINT8 *) IfrFormNvData,
+ &BufferSize,
+ Progress
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = Ip4ConfigConvertIfrNvDataToDeviceConfigData (Ip4ConfigInstance);
+ }
+
+ FreePool (IfrFormNvData);
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param[in] Request A null-terminated Unicode string in
- <ConfigRequest> format. Note that this
- includes the routing information as well as
- the configurable name / value pairs. It is
- invalid for this string to be in
- <MultiConfigRequest> format.
- @param[out] Progress On return, points to a character in the
- Request string. Points to the string's null
- terminator if request was successful. Points
- to the most recent "&" before the first
- failing name / value pair (or the beginning
- of the string if the failure is in the first
- name / value pair) if the request was not
- successful.
- @param[out] Results A null-terminated Unicode string in
- <ConfigAltResp> format which has all values
- filled in for the names in the Request string.
- String to be allocated by the called function.
+ } else if (HiiIsConfigHdrMatch (Configuration, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
- @retval EFI_SUCCESS The Results string is filled with the
- values corresponding to all requested
- names.
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
- parts of the results that must be
- stored awaiting possible future
- protocols.
- @retval EFI_INVALID_PARAMETER For example, passing in a NULL
- for the Request parameter
- would result in this type of
- error. In this case, the
- Progress parameter would be
- set to NULL.
- @retval EFI_NOT_FOUND Routing data doesn't match any
- known driver. Progress set to the
- first character in the routing header.
- Note: There is no requirement that the
- driver validate the routing data. It
- must skip the <ConfigHdr> in order to
- process the names.
- @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set
- to most recent & before the
- error or the beginning of the
- string.
- @retval EFI_INVALID_PARAMETER Unknown name. Progress points
- to the & before the name in
- question.Currently not implemented.
-**/
-EFI_STATUS
-EFIAPI
-Ip4FormExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
- )
-{
- if (Request == NULL || Progress == NULL || Results == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *Progress = Request;
- return EFI_NOT_FOUND;
-}
+ IfrDeviceNvData = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
+ if (IfrDeviceNvData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
-/**
- This function applies changes in a driver's configuration.
- Input is a Configuration, which has the routing data for this
- driver followed by name / value configuration pairs. The driver
- must apply those pairs to its configurable storage. If the
- driver's configuration is stored in a linear block of data
- and the driver's name / value pairs are in <BlockConfig>
- format, it may use the ConfigToBlock helper function (above) to
- simplify the job. Currently not implemented.
+ BufferSize = NIC_ITEM_CONFIG_SIZE;
+ Status = gHiiConfigRouting->ConfigToBlock (
+ gHiiConfigRouting,
+ Configuration,
+ (UINT8 *) IfrDeviceNvData,
+ &BufferSize,
+ Progress
+ );
+ if (!EFI_ERROR (Status)) {
+ ZeroMem (&ZeroMac, sizeof (EFI_MAC_ADDRESS));
+ if (CompareMem (&IfrDeviceNvData->NicAddr.MacAddr, &ZeroMac, IfrDeviceNvData->NicAddr.Len) != 0) {
+ BufferSize = sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * IfrDeviceNvData->Ip4Info.RouteTableSize;
+ NicInfo = AllocateCopyPool (BufferSize, IfrDeviceNvData);
+ Status = EfiNicIp4ConfigSetInfo (Ip4ConfigInstance, NicInfo, TRUE);
+ } else {
+ ZeroMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo, sizeof (IP4_SETTING_INFO));
+ Status = EfiNicIp4ConfigSetInfo (Ip4ConfigInstance, NULL, TRUE);
+ }
+ }
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
- @param[in] Configuration A null-terminated Unicode string in
- <ConfigString> format.
- @param[out] Progress A pointer to a string filled in with the
- offset of the most recent '&' before the
- first failing name / value pair (or the
- beginn ing of the string if the failure
- is in the first name / value pair) or
- the terminating NULL if all was
- successful.
+ FreePool (IfrDeviceNvData);
- @retval EFI_SUCCESS The results have been distributed or are
- awaiting distribution.
- @retval EFI_OUT_OF_MEMORY Not enough memory to store the
- parts of the results that must be
- stored awaiting possible future
- protocols.
- @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
- Results parameter would result
- in this type of error.
- @retval EFI_NOT_FOUND Target for the specified routing data
- was not found.
-**/
-EFI_STATUS
-EFIAPI
-Ip4FormRouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
- )
-{
- if (Configuration == NULL || Progress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
+ } else {
- *Progress = Configuration;
- if (!HiiIsConfigHdrMatch (Configuration, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
return EFI_NOT_FOUND;
}
+
+ return Status;
- *Progress = Configuration + StrLen (Configuration);
- return EFI_SUCCESS;
}
/**
@@ -653,23 +607,15 @@ Ip4FormCallback (
)
{
IP4_CONFIG_INSTANCE *Ip4ConfigInstance;
- IP4_FORM_CALLBACK_INFO *Private;
CHAR8 Ip4String[IP4_STR_MAX_SIZE];
- CHAR16 PortString[128];
- EFI_STRING_ID DeviceFormTitleToken;
IP4_CONFIG_IFR_NVDATA *IfrFormNvData;
- IP4CONFIG_FORM_ENTRY *ConfigFormEntry;
EFI_IP_ADDRESS HostIp;
EFI_IP_ADDRESS SubnetMask;
EFI_IP_ADDRESS Gateway;
EFI_STATUS Status;
EFI_INPUT_KEY Key;
- NIC_IP4_CONFIG_INFO *NicInfo;
- EFI_IP_ADDRESS Ip;
-
- ConfigFormEntry = NULL;
- Private = IP4CONFIG_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
+ Ip4ConfigInstance = IP4_CONFIG_INSTANCE_FROM_CONFIG_ACCESS (This);
IfrFormNvData = AllocateZeroPool (sizeof (IP4_CONFIG_IFR_NVDATA));
if (IfrFormNvData == NULL) {
@@ -679,7 +625,7 @@ Ip4FormCallback (
//
// Retrive uncommitted data from Browser
//
- if (!HiiGetBrowserData (&gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE, sizeof (IP4_CONFIG_IFR_NVDATA), (UINT8 *) IfrFormNvData)) {
+ if (!HiiGetBrowserData (&mNicIp4ConfigNvDataGuid, EFI_NIC_IP4_CONFIG_VARIABLE, sizeof (IP4_CONFIG_IFR_NVDATA), (UINT8 *) IfrFormNvData)) {
FreePool (IfrFormNvData);
return EFI_NOT_FOUND;
}
@@ -688,11 +634,19 @@ Ip4FormCallback (
switch (QuestionId) {
+ case KEY_ENABLE:
+ if (IfrFormNvData->Configure == 0) {
+ Ip4ConfigInstance->Ip4ConfigCallbackInfo.Configured = FALSE;
+ } else {
+ Ip4ConfigInstance->Ip4ConfigCallbackInfo.Configured = TRUE;
+ }
+ break;
+
case KEY_DHCP_ENABLE:
if (IfrFormNvData->DhcpEnable == 0) {
- Private->Current->SessionConfigData.Enabled = FALSE;
+ Ip4ConfigInstance->Ip4ConfigCallbackInfo.DhcpEnabled = FALSE;
} else {
- Private->Current->SessionConfigData.Enabled = TRUE;
+ Ip4ConfigInstance->Ip4ConfigCallbackInfo.DhcpEnabled = TRUE;
}
break;
@@ -704,7 +658,7 @@ Ip4FormCallback (
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
Status = EFI_INVALID_PARAMETER;
} else {
- CopyMem (&Private->Current->SessionConfigData.LocalIp, &HostIp.v4, sizeof (HostIp.v4));
+ CopyMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.LocalIp, &HostIp.v4, sizeof (HostIp.v4));
}
break;
@@ -716,7 +670,7 @@ Ip4FormCallback (
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid SubnetMask!", NULL);
Status = EFI_INVALID_PARAMETER;
} else {
- CopyMem (&Private->Current->SessionConfigData.SubnetMask, &SubnetMask.v4, sizeof (SubnetMask.v4));
+ CopyMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.SubnetMask, &SubnetMask.v4, sizeof (SubnetMask.v4));
}
break;
@@ -728,82 +682,24 @@ Ip4FormCallback (
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Gateway!", NULL);
Status = EFI_INVALID_PARAMETER;
} else {
- CopyMem (&Private->Current->SessionConfigData.Gateway, &Gateway.v4, sizeof (Gateway.v4));
+ CopyMem (&Ip4ConfigInstance->Ip4ConfigCallbackInfo.Gateway, &Gateway.v4, sizeof (Gateway.v4));
}
break;
case KEY_SAVE_CHANGES:
- Ip4ConfigInstance = Private->Current->Ip4ConfigInstance;
- NicInfo = AllocateZeroPool (sizeof (NIC_IP4_CONFIG_INFO) + 2 * sizeof (EFI_IP4_ROUTE_TABLE));
- ASSERT (NicInfo != NULL);
-
- NicInfo->Ip4Info.RouteTable = (EFI_IP4_ROUTE_TABLE *) (NicInfo + 1);
-
- if (!Private->Current->SessionConfigData.Enabled) {
- CopyMem (&HostIp.v4, &Private->Current->SessionConfigData.LocalIp, sizeof (HostIp.v4));
- CopyMem (&SubnetMask.v4, &Private->Current->SessionConfigData.SubnetMask, sizeof (SubnetMask.v4));
- CopyMem (&Gateway.v4, &Private->Current->SessionConfigData.Gateway, sizeof (Gateway.v4));
-
- if ((Gateway.Addr[0] != 0)) {
- if (SubnetMask.Addr[0] == 0) {
- CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Gateway address is set but subnet mask is zero.", NULL);
- Status = EFI_INVALID_PARAMETER;
- break;
- } else if (!IP4_NET_EQUAL (HostIp.Addr[0], Gateway.Addr[0], SubnetMask.Addr[0])) {
- CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Local IP and Gateway are not in the same subnet.", NULL);
- Status = EFI_INVALID_PARAMETER;
- break;
- }
- }
-
- NicInfo->Source = IP4_CONFIG_SOURCE_STATIC;
- NicInfo->Ip4Info.RouteTableSize = 2;
-
- CopyMem (&NicInfo->Ip4Info.StationAddress, &HostIp.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&NicInfo->Ip4Info.SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
-
- Ip.Addr[0] = HostIp.Addr[0] & SubnetMask.Addr[0];
-
- CopyMem (&NicInfo->Ip4Info.RouteTable[0].SubnetAddress, &Ip.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&NicInfo->Ip4Info.RouteTable[0].SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&NicInfo->Ip4Info.RouteTable[1].GatewayAddress, &Gateway.v4, sizeof (EFI_IPv4_ADDRESS));
- } else {
- NicInfo->Source = IP4_CONFIG_SOURCE_DHCP;
- }
-
- NicInfo->Perment = TRUE;
- CopyMem (&NicInfo->NicAddr, &Ip4ConfigInstance->NicAddr, sizeof (NIC_ADDR));
-
- EfiNicIp4ConfigSetInfo (Ip4ConfigInstance, NicInfo, TRUE);
-
+ Status = Ip4ConfigConvertIfrNvDataToDeviceConfigData (Ip4ConfigInstance);
+
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
+
break;
default:
- if ((QuestionId >= KEY_DEVICE_ENTRY_BASE) && (QuestionId < (mNumberOfIp4Devices + KEY_DEVICE_ENTRY_BASE))) {
- //
- // In case goto the device configuration form, update the device form title.
- //
- ConfigFormEntry = Ip4GetConfigFormEntryByIndex ((UINT32) (QuestionId - KEY_DEVICE_ENTRY_BASE));
- ASSERT (ConfigFormEntry != NULL);
-
- Ip4ConfigInstance = ConfigFormEntry->Ip4ConfigInstance;
-
- UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);
- DeviceFormTitleToken = (EFI_STRING_ID) STR_IP4_DEVICE_FORM_TITLE;
- HiiSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString, NULL);
-
- Ip4ConfigConvertDeviceConfigDataToIfrNvData (Ip4ConfigInstance, IfrFormNvData);
-
- Private->Current = ConfigFormEntry;
- }
-
+
break;
}
if (!EFI_ERROR (Status)) {
-
//
// Pass changed uncommitted data back to Form Browser
//
@@ -811,6 +707,7 @@ Ip4FormCallback (
}
FreePool (IfrFormNvData);
+
return Status;
}
@@ -825,43 +722,93 @@ Ip4FormCallback (
**/
EFI_STATUS
Ip4ConfigDeviceInit (
- IN IP4_CONFIG_INSTANCE *Instance
+ IN IP4_CONFIG_INSTANCE *Instance
)
{
- EFI_STATUS Status;
- EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
- IP4_FORM_CALLBACK_INFO *CallbackInfo;
-
- Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **)&HiiDatabase);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
+ VENDOR_DEVICE_PATH VendorDeviceNode;
+ EFI_SERVICE_BINDING_PROTOCOL *MnpSb;
+ CHAR16 MacString[95];
+ CHAR16 MenuString[128];
+ CHAR16 PortString[128];
+ CHAR16 *OldMenuString;
- CallbackInfo = &Instance->Ip4FormCallbackInfo;
+ ConfigAccess = &Instance->HiiConfigAccessProtocol;
+ ConfigAccess->ExtractConfig = Ip4DeviceExtractConfig;
+ ConfigAccess->RouteConfig = Ip4DeviceRouteConfig;
+ ConfigAccess->Callback = Ip4FormCallback;
- CallbackInfo->Signature = IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE;
- CallbackInfo->HiiDatabase = HiiDatabase;
+ //
+ // Construct device path node for EFI HII Config Access protocol,
+ // which consists of controller physical device path and one hardware
+ // vendor guid node.
+ //
+ ZeroMem (&VendorDeviceNode, sizeof (VENDOR_DEVICE_PATH));
+ VendorDeviceNode.Header.Type = HARDWARE_DEVICE_PATH;
+ VendorDeviceNode.Header.SubType = HW_VENDOR_DP;
- CallbackInfo->ConfigAccess.ExtractConfig = Ip4DeviceExtractConfig;
- CallbackInfo->ConfigAccess.RouteConfig = Ip4DeviceRouteConfig;
- CallbackInfo->ConfigAccess.Callback = NULL;
+ CopyGuid (&VendorDeviceNode.Guid, &gEfiNicIp4ConfigVariableGuid);
- Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&CallbackInfo->ConfigRouting);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ SetDevicePathNodeLength (&VendorDeviceNode.Header, sizeof (VENDOR_DEVICE_PATH));
+ Instance->HiiVendorDevicePath = AppendDevicePathNode (
+ Instance->ParentDevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *) &VendorDeviceNode
+ );
- CallbackInfo->DriverHandle = Instance->Controller;
+ Instance->ChildHandle = NULL;
//
- // Install Device Path Protocol and Config Access protocol to driver handle
+ // Install Device Path Protocol and Config Access protocol on new handle
//
Status = gBS->InstallMultipleProtocolInterfaces (
- &CallbackInfo->DriverHandle,
+ &Instance->ChildHandle,
+ &gEfiDevicePathProtocolGuid,
+ Instance->HiiVendorDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
- &CallbackInfo->ConfigAccess,
+ ConfigAccess,
NULL
);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Open the Parent Handle for the child
+ //
+ Status = gBS->OpenProtocol (
+ Instance->Controller,
+ &gEfiManagedNetworkServiceBindingProtocolGuid,
+ (VOID **) &MnpSb,
+ Instance->Image,
+ Instance->ChildHandle,
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+ );
+ }
+
ASSERT_EFI_ERROR (Status);
+
+ //
+ // Publish our HII data
+ //
+ Instance->RegisteredHandle = HiiAddPackages (
+ &mNicIp4ConfigNvDataGuid,
+ Instance->ChildHandle,
+ Ip4ConfigDxeStrings,
+ Ip4ConfigDxeBin,
+ NULL
+ );
+ if (Instance->RegisteredHandle == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Append MAC string in the menu string and tile string
+ //
+ Ip4MacAddrToStr (&Instance->NicAddr.MacAddr, Instance->NicAddr.Len, MacString);
+
+ OldMenuString = HiiGetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG_FORM_TITLE), NULL);
+ UnicodeSPrint (MenuString, 128, L"%s (MAC:%s)", OldMenuString, MacString);
+ HiiSetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_CONFIG_FORM_TITLE), MenuString, NULL);
+
+ UnicodeSPrint (PortString, 128, L"MAC:%s", MacString);
+ HiiSetString (Instance->RegisteredHandle, STRING_TOKEN (STR_IP4_DEVICE_FORM_TITLE), PortString, NULL);
return Status;
}
@@ -879,292 +826,32 @@ Ip4ConfigDeviceUnload (
IN IP4_CONFIG_INSTANCE *Instance
)
{
- IP4_FORM_CALLBACK_INFO *CallbackInfo;
-
- CallbackInfo = &Instance->Ip4FormCallbackInfo;
-
- Ip4ConfigUpdateForm (Instance, FALSE);
-
//
- // Uninstall EFI_HII_CONFIG_ACCESS_PROTOCOL
+ // Remove HII package list
//
- gBS->UninstallMultipleProtocolInterfaces (
- CallbackInfo->DriverHandle,
- &gEfiHiiConfigAccessProtocolGuid,
- &CallbackInfo->ConfigAccess,
- NULL
- );
-
- return EFI_SUCCESS;
-}
-
-/**
- Unload the network configuration form, this includes: delete all the network
- device configuration entries, uninstall the form callback protocol and
- free the resources used.
-
- @retval EFI_SUCCESS The network configuration form is unloaded.
-**/
-EFI_STATUS
-Ip4ConfigFormUnload (
- VOID
- )
-{
- IP4CONFIG_FORM_ENTRY *ConfigFormEntry;
-
- while (!IsListEmpty (&mIp4ConfigFormList)) {
- //
- // Uninstall the device forms as the network driver instance may fail to
- // control the controller but still install the device configuration form.
- // In such case, upon driver unloading, the driver instance's driverbinding.
- // stop () won't be called, so we have to take this chance here to uninstall
- // the device form.
- //
- ConfigFormEntry = NET_LIST_USER_STRUCT (mIp4ConfigFormList.ForwardLink, IP4CONFIG_FORM_ENTRY, Link);
- Ip4ConfigUpdateForm (ConfigFormEntry->Ip4ConfigInstance, FALSE);
- }
+ HiiRemovePackages (Instance->RegisteredHandle);
//
- // Remove HII package list
+ // Close the child handle
//
- mCallbackInfo->HiiDatabase->RemovePackageList (
- mCallbackInfo->HiiDatabase,
- mCallbackInfo->RegisteredHandle
- );
+ gBS->CloseProtocol (
+ Instance->Controller,
+ &gEfiManagedNetworkServiceBindingProtocolGuid,
+ Instance->Image,
+ Instance->ChildHandle
+ );
//
// Uninstall EFI_HII_CONFIG_ACCESS_PROTOCOL
//
gBS->UninstallMultipleProtocolInterfaces (
- mCallbackInfo->DriverHandle,
+ Instance->ChildHandle,
&gEfiDevicePathProtocolGuid,
- &mIp4ConifgHiiVendorDevicePath,
+ Instance->HiiVendorDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
- &mCallbackInfo->ConfigAccess,
+ &Instance->HiiConfigAccessProtocol,
NULL
);
- FreePool (mCallbackInfo);
-
- return EFI_SUCCESS;
-}
-
-/**
- Updates the network configuration form to add/delete an entry for the network
- device specified by the Instance.
-
- @param[in] Instance The IP4 Config instance.
- @param[in] AddForm Whether to add or delete a form entry.
-
- @retval EFI_SUCCESS The network configuration form is updated.
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
- @retval Others Other errors as indicated.
-**/
-EFI_STATUS
-Ip4ConfigUpdateForm (
- IN IP4_CONFIG_INSTANCE *Instance,
- IN BOOLEAN AddForm
- )
-{
- LIST_ENTRY *Entry;
- IP4CONFIG_FORM_ENTRY *ConfigFormEntry;
- BOOLEAN EntryExisted;
- EFI_STATUS Status;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- CHAR16 PortString[128];
- UINT16 FormIndex;
- VOID *StartOpCodeHandle;
- VOID *EndOpCodeHandle;
- EFI_IFR_GUID_LABEL *StartLabel;
- EFI_IFR_GUID_LABEL *EndLabel;
-
- ConfigFormEntry = NULL;
- EntryExisted = FALSE;
-
- NET_LIST_FOR_EACH (Entry, &mIp4ConfigFormList) {
- ConfigFormEntry = NET_LIST_USER_STRUCT (Entry, IP4CONFIG_FORM_ENTRY, Link);
-
- if (ConfigFormEntry->Controller == Instance->Controller) {
- EntryExisted = TRUE;
- break;
- }
- }
-
- if (AddForm) {
- if (EntryExisted) {
- return EFI_SUCCESS;
- } else {
- //
- // Add a new form.
- //
- ConfigFormEntry = (IP4CONFIG_FORM_ENTRY *) AllocateZeroPool (sizeof (IP4CONFIG_FORM_ENTRY));
- if (ConfigFormEntry == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ConfigFormEntry->Ip4ConfigInstance = Instance;
- InitializeListHead (&ConfigFormEntry->Link);
- ConfigFormEntry->Controller = Instance->Controller;
-
- //
- // Get the simple network protocol and convert the MAC address into
- // the formatted string.
- //
- Status = gBS->HandleProtocol (
- Instance->Controller,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **)&Snp
- );
- ASSERT (Status == EFI_SUCCESS);
-
- Ip4MacAddrToStr (&Snp->Mode->PermanentAddress, Snp->Mode->HwAddressSize, ConfigFormEntry->MacString);
-
- //
- // Compose the Port string and create a new EFI_STRING_ID.
- //
- UnicodeSPrint (PortString, 128, L"%s %s", Instance->NicName, ConfigFormEntry->MacString);
- ConfigFormEntry->PortTitleToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);
-
- //
- // Compose the help string of this port and create a new EFI_STRING_ID.
- //
- UnicodeSPrint (PortString, 128, L"Set the network parameters on eth%d %s", 0, ConfigFormEntry->MacString);
- ConfigFormEntry->PortTitleHelpToken = HiiSetString (mCallbackInfo->RegisteredHandle, 0, PortString, NULL);
-
- InsertTailList (&mIp4ConfigFormList, &ConfigFormEntry->Link);
- mNumberOfIp4Devices++;
- }
- } else {
- ASSERT (EntryExisted);
-
- mNumberOfIp4Devices--;
- RemoveEntryList (&ConfigFormEntry->Link);
- gBS->FreePool (ConfigFormEntry);
- }
-
- //
- // Init OpCode Handle
- //
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (StartOpCodeHandle != NULL);
-
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();
- ASSERT (EndOpCodeHandle != NULL);
-
- //
- // Create Hii Extend Label OpCode as the start opcode
- //
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = DEVICE_ENTRY_LABEL;
-
- //
- // Create Hii Extend Label OpCode as the end opcode
- //
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- EndLabel->Number = LABEL_END;
-
- FormIndex = 0;
-
- FormIndex = 0;
- NET_LIST_FOR_EACH (Entry, &mIp4ConfigFormList) {
- ConfigFormEntry = NET_LIST_USER_STRUCT (Entry, IP4CONFIG_FORM_ENTRY, Link);
-
- HiiCreateGotoOpCode (
- StartOpCodeHandle, // Container for dynamic created opcodes
- FORMID_DEVICE_FORM, // Target Form ID
- ConfigFormEntry->PortTitleToken, // Prompt text
- ConfigFormEntry->PortTitleHelpToken, // Help text
- EFI_IFR_FLAG_CALLBACK, // Question flag
- (UINT16)(KEY_DEVICE_ENTRY_BASE + FormIndex) // Question ID
- );
-
- FormIndex++;
- }
-
- HiiUpdateForm (
- mCallbackInfo->RegisteredHandle,
- &gEfiNicIp4ConfigVariableGuid,
- FORMID_MAIN_FORM,
- StartOpCodeHandle, // Label DEVICE_ENTRY_LABEL
- EndOpCodeHandle // LABEL_END
- );
-
- HiiFreeOpCodeHandle (StartOpCodeHandle);
- HiiFreeOpCodeHandle (EndOpCodeHandle);
-
return EFI_SUCCESS;
}
-
-/**
- Initialize the network configuration form, this includes: delete all the network
- device configuration entries, install the form callback protocol and
- allocate the resources used.
-
- @retval EFI_SUCCESS The network configuration form is unloaded.
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
-**/
-EFI_STATUS
-Ip4ConfigFormInit (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
- IP4_FORM_CALLBACK_INFO *CallbackInfo;
-
- Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **)&HiiDatabase);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CallbackInfo = (IP4_FORM_CALLBACK_INFO *) AllocateZeroPool (sizeof (IP4_FORM_CALLBACK_INFO));
- if (CallbackInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- CallbackInfo->Signature = IP4CONFIG_FORM_CALLBACK_INFO_SIGNATURE;
- CallbackInfo->HiiDatabase = HiiDatabase;
-
- CallbackInfo->ConfigAccess.ExtractConfig = Ip4FormExtractConfig;
- CallbackInfo->ConfigAccess.RouteConfig = Ip4FormRouteConfig;
- CallbackInfo->ConfigAccess.Callback = Ip4FormCallback;
-
- Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&CallbackInfo->ConfigRouting);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CallbackInfo->DriverHandle = NULL;
- //
- // Install Device Path Protocol and Config Access protocol to driver handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &CallbackInfo->DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mIp4ConifgHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &CallbackInfo->ConfigAccess,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Publish our HII data
- //
- CallbackInfo->RegisteredHandle = HiiAddPackages (
- &gEfiNicIp4ConfigVariableGuid,
- CallbackInfo->DriverHandle,
- Ip4ConfigDxeStrings,
- Ip4ConfigDxeBin,
- NULL
- );
- if (CallbackInfo->RegisteredHandle == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- mCallbackInfo = CallbackInfo;
-
- return Status;
-}
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.h
index ba30a2ccf5..54e5405461 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.h
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigNv.h
@@ -24,31 +24,6 @@ extern UINT8 Ip4ConfigDxeStrings[];
#define NIC_ITEM_CONFIG_SIZE sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * MAX_IP4_CONFIG_IN_VARIABLE
-///
-/// HII specific Vendor Device Path definition.
-///
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
-} HII_VENDOR_DEVICE_PATH;
-
-/**
- Updates the network configuration form to add/delete an entry for the network
- device specified by the Instance.
-
- @param[in] Instance The IP4 Config instance.
- @param[in] AddForm Whether to add or delete a form entry.
-
- @retval EFI_SUCCESS The network configuration form is updated.
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
- @retval Others Other errors as indicated.
-**/
-EFI_STATUS
-Ip4ConfigUpdateForm (
- IN IP4_CONFIG_INSTANCE *Instance,
- IN BOOLEAN AddForm
- );
-
/**
Install HII Config Access protocol for network device and allocate resource.
@@ -76,29 +51,4 @@ Ip4ConfigDeviceUnload (
IN IP4_CONFIG_INSTANCE *Instance
);
-/**
- Initialize the network configuration form, this includes: delete all the network
- device configuration entries, install the form callback protocol and
- allocate the resources used.
-
- @retval EFI_SUCCESS The network configuration form is unloaded.
- @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
-**/
-EFI_STATUS
-Ip4ConfigFormInit (
- VOID
- );
-
-/**
- Unload the network configuration form, this includes: delete all the network
- device configuration entries, uninstall the form callback protocol and
- free the resources used.
-
- @retval EFI_SUCCESS The network configuration form is unloaded.
-**/
-EFI_STATUS
-Ip4ConfigFormUnload (
- VOID
- );
-
#endif
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4NvData.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4NvData.h
index ac2b3dcca4..13941e1867 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4NvData.h
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4NvData.h
@@ -1,7 +1,7 @@
/** @file
Routines used to operate the Ip4 configure variable.
-Copyright (c) 2009, Intel Corporation.<BR>
+Copyright (c) 2009 - 2010, Intel Corporation.<BR>
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<BR>
@@ -15,29 +15,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _NIC_IP4_NV_DATA_H_
#define _NIC_IP4_NV_DATA_H_
-
-//
-// one copy from NicIp4ConfigNvData.h
-//
-#define EFI_NIC_IP4_CONFIG_VARIABLE_GUID \
+#define EFI_NIC_IP4_CONFIG_NVDATA_GUID \
{ \
- 0xd8944553, 0xc4dd, 0x41f4, { 0x9b, 0x30, 0xe1, 0x39, 0x7c, 0xfb, 0x26, 0x7b } \
+ 0x9d5b53f, 0xf4b0, 0x4f59, { 0xa0, 0xb1, 0x7b, 0x57, 0xd3, 0x5c, 0xe, 0x5 } \
}
#define FORMID_MAIN_FORM 1
#define FORMID_DEVICE_FORM 2
+#define KEY_ENABLE 0x100
#define KEY_DHCP_ENABLE 0x101
#define KEY_LOCAL_IP 0x102
#define KEY_SUBNET_MASK 0x103
#define KEY_GATE_WAY 0x104
#define KEY_SAVE_CHANGES 0x105
-#define DEVICE_ENTRY_LABEL 0x1234
-#define LABEL_END 0xffff
-
-#define KEY_DEVICE_ENTRY_BASE 0x1000
-
#define IP_MIN_SIZE 7
#define IP_MAX_SIZE 15
#define IP4_STR_MAX_SIZE 16
@@ -48,12 +40,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/// of variable length.
///
typedef struct {
- UINT16 NicAddr[3]; ///< NIC MAC address
- UINT8 Reserved; ///< Reserved bits
- UINT8 DhcpEnable; ///< Static or DHCP
+ UINT16 NicAddr[3]; ///< NIC MAC address
+ UINT8 Configure; ///< NIC configure status
+ UINT8 DhcpEnable; ///< Static or DHCP
CHAR16 StationAddress[IP4_STR_MAX_SIZE]; ///< IP addresses
CHAR16 SubnetMask[IP4_STR_MAX_SIZE]; ///< Subnet address
CHAR16 GatewayAddress[IP4_STR_MAX_SIZE]; ///< Gateway address
} IP4_CONFIG_IFR_NVDATA;
#endif
+
diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
index a5f00ee645..b948cf8c7b 100644
--- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
+++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c
@@ -1,7 +1,7 @@
/** @file
Routines used to operate the Ip4 configure variable.
-Copyright (c) 2006 - 2008, Intel Corporation.<BR>
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>
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<BR>
@@ -151,7 +151,7 @@ REMOVE_VARIABLE:
ON_ERROR:
if (Variable != NULL) {
- gBS->FreePool (Variable);
+ FreePool (Variable);
}
return NULL;
@@ -296,7 +296,7 @@ Ip4ConfigModifyVariable (
if (Old != NULL) {
TotalLen -= SIZEOF_NIC_IP4_CONFIG_INFO (Old);
- gBS->FreePool (Old);
+ FreePool (Old);
}
if (Config != NULL) {