summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-13 09:29:44 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-13 09:29:44 +0000
commit638868496cafa80a7212f654559944f34f65598a (patch)
treeff1cc2e186b78bab3aa5a0efbc7c64d1a0006e28 /MdeModulePkg/Library
parent945e3aed0f238c5c3e401a7793d1e8133c85d7c7 (diff)
downloadedk2-638868496cafa80a7212f654559944f34f65598a.zip
edk2-638868496cafa80a7212f654559944f34f65598a.tar.gz
edk2-638868496cafa80a7212f654559944f34f65598a.tar.bz2
1. retired NicIp4ConfigProtocolGuid
2. moved NicIp4ConfigVariableGuid to Include/Guid/NicIp4ConfigNvData.h 3. updated Ip4ConfigDxe module to publish one setup page to Get/Set network parameters. Also, Ip4ConfgiDxe installed EFI HII Config Access protocol for each network devices. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8309 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/DxeNetLib/DxeNetLib.c105
-rw-r--r--MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf11
2 files changed, 91 insertions, 25 deletions
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index b69bd20..59da12c 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -15,11 +15,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/ServiceBinding.h>
#include <Protocol/SimpleNetwork.h>
-#include <Protocol/NicIp4Config.h>
+#include <Protocol/HiiConfigRouting.h>
#include <Protocol/ComponentName.h>
#include <Protocol/ComponentName2.h>
#include <Protocol/Dpc.h>
+#include <Guid/NicIp4ConfigNvData.h>
+
#include <Library/NetLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
@@ -28,11 +30,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DevicePathLib.h>
+#include <Library/HiiLib.h>
+#include <Library/PrintLib.h>
EFI_DPC_PROTOCOL *mDpc = NULL;
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mNetLibHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+#define NIC_ITEM_CONFIG_SIZE sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * 2
+
//
// All the supported IP4 maskes in host byte order.
//
@@ -1248,43 +1254,98 @@ NetLibDefaultAddressIsStatic (
IN EFI_HANDLE Controller
)
{
- EFI_STATUS Status;
- EFI_NIC_IP4_CONFIG_PROTOCOL *NicIp4;
- UINTN Len;
- NIC_IP4_CONFIG_INFO *ConfigInfo;
- BOOLEAN IsStatic;
-
- Status = gBS->HandleProtocol (
- Controller,
- &gEfiNicIp4ConfigProtocolGuid,
- (VOID **) &NicIp4
- );
+ EFI_STATUS Status;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
+ UINTN Len;
+ NIC_IP4_CONFIG_INFO *ConfigInfo;
+ BOOLEAN IsStatic;
+ EFI_STRING ConfigHdr;
+ EFI_STRING ConfigResp;
+ EFI_STRING AccessProgress;
+ EFI_STRING AccessResults;
+ EFI_STRING String;
+
+ ConfigInfo = NULL;
+ ConfigHdr = NULL;
+ ConfigResp = NULL;
+ AccessProgress = NULL;
+ AccessResults = NULL;
+ IsStatic = TRUE;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiConfigRoutingProtocolGuid,
+ NULL,
+ (VOID **) &HiiConfigRouting
+ );
if (EFI_ERROR (Status)) {
return TRUE;
}
- Len = 0;
- Status = NicIp4->GetInfo (NicIp4, &Len, NULL);
- if (Status != EFI_BUFFER_TOO_SMALL) {
- return TRUE;
+ //
+ // Construct config request string header
+ //
+ ConfigHdr = HiiConstructConfigHdr (&gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE, Controller);
+
+ Len = StrLen (ConfigHdr);
+ ConfigResp = AllocateZeroPool (Len + NIC_ITEM_CONFIG_SIZE * 2 + 200);
+ if (ConfigResp == NULL) {
+ goto ON_EXIT;
+ }
+ StrCpy (ConfigResp, ConfigHdr);
+
+ String = ConfigResp + Len;
+ UnicodeSPrint (
+ String,
+ (8 + 4 + 7 + 4) * sizeof (CHAR16),
+ L"&OFFSET=%04X&WIDTH=%04X",
+ OFFSET_OF (NIC_IP4_CONFIG_INFO, Source),
+ sizeof (UINT32)
+ );
+
+ Status = HiiConfigRouting->ExtractConfig (
+ HiiConfigRouting,
+ ConfigResp,
+ &AccessProgress,
+ &AccessResults
+ );
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
}
- ConfigInfo = AllocatePool (Len);
+ ConfigInfo = AllocateZeroPool (sizeof (NIC_IP4_CONFIG_INFO));
if (ConfigInfo == NULL) {
- return TRUE;
+ goto ON_EXIT;
}
- IsStatic = TRUE;
- Status = NicIp4->GetInfo (NicIp4, &Len, ConfigInfo);
+ ConfigInfo->Source = IP4_CONFIG_SOURCE_STATIC;
+ Len = NIC_ITEM_CONFIG_SIZE;
+ Status = HiiConfigRouting->ConfigToBlock (
+ HiiConfigRouting,
+ AccessResults,
+ (UINT8 *) ConfigInfo,
+ &Len,
+ &AccessProgress
+ );
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
IsStatic = (BOOLEAN) (ConfigInfo->Source == IP4_CONFIG_SOURCE_STATIC);
-
+
ON_EXIT:
- gBS->FreePool (ConfigInfo);
+ if (AccessResults != NULL) {
+ FreePool (AccessResults);
+ }
+ if (ConfigInfo != NULL) {
+ FreePool (ConfigInfo);
+ }
+ if (ConfigResp != NULL) {
+ FreePool (ConfigResp);
+ }
+ if (ConfigHdr != NULL) {
+ FreePool (ConfigHdr);
+ }
return IsStatic;
}
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
index 4ac01a7..2f2b2d0 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
@@ -1,7 +1,7 @@
/** @file
Instance of DxeNetLib.
-Copyright (c) 2006, 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
@@ -48,13 +48,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
UefiLib
MemoryAllocationLib
DevicePathLib
-
+ HiiLib
+ PrintLib
+
+[Guids]
+ gEfiNicIp4ConfigVariableGuid
+
[Protocols]
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiNicIp4ConfigProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDpcProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[Depex]
gEfiDpcProtocolGuid