summaryrefslogtreecommitdiffstats
path: root/NetworkPkg
diff options
context:
space:
mode:
authorYe Ting <ting.ye@intel.com>2015-04-30 02:57:10 +0000
committertye1 <tye1@Edk2>2015-04-30 02:57:10 +0000
commit2bbe9553c495bb9024b4b51743142a0a50e0d370 (patch)
tree3cf8c8c3b5e30d44a3f1410115bb1eb5c6f3961e /NetworkPkg
parent1f17c7f71b14307ff5e0f9694ee800364c865374 (diff)
downloadedk2-2bbe9553c495bb9024b4b51743142a0a50e0d370.tar.gz
edk2-2bbe9553c495bb9024b4b51743142a0a50e0d370.tar.bz2
edk2-2bbe9553c495bb9024b4b51743142a0a50e0d370.zip
Add IPV6 support from UNDI
Add new information block ‘IPV6 support from UNDI’ in AIP protocol and provide sample implementation in UNDI driver. Update PXE driver to get ‘Ipv6Available’ of PXE BC Mode data from UNDI driver, if unsupported then not to start PXE over IPv6 path. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17275 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c112
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h3
-rw-r--r--NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf6
3 files changed, 117 insertions, 4 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
index 92fd1f19df..c2987b8734 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
@@ -2,7 +2,7 @@
Driver Binding functions implementationfor for UefiPxeBc Driver.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -442,6 +442,103 @@ PxeBcDestroyIp6Children (
Private->Mode.Ipv6Available = FALSE;
}
+/**
+ Check whether UNDI protocol supports IPv6.
+
+ @param[in] ControllerHandle Controller handle.
+ @param[in] Private Pointer to PXEBC_PRIVATE_DATA.
+ @param[out] Ipv6Support TRUE if UNDI supports IPv6.
+
+ @retval EFI_SUCCESS Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully.
+ @retval EFI_NOT_FOUND Don't know whether UNDI supports IPv6 since NII or AIP is not available.
+
+**/
+EFI_STATUS
+PxeBcCheckIpv6Support (
+ IN EFI_HANDLE ControllerHandle,
+ IN PXEBC_PRIVATE_DATA *Private,
+ OUT BOOLEAN *Ipv6Support
+ )
+{
+ EFI_HANDLE Handle;
+ EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
+ EFI_STATUS Status;
+ EFI_GUID *InfoTypesBuffer;
+ UINTN InfoTypeBufferCount;
+ UINTN TypeIndex;
+ BOOLEAN Supported;
+ VOID *InfoBlock;
+ UINTN InfoBlockSize;
+
+ ASSERT (Private != NULL && Ipv6Support != NULL);
+
+ //
+ // Check whether the UNDI supports IPv6 by NII protocol.
+ //
+ if (Private->Nii != NULL) {
+ *Ipv6Support = Private->Nii->Ipv6Supported;
+ return EFI_SUCCESS;
+ }
+
+ //
+ // Check whether the UNDI supports IPv6 by AIP protocol.
+ //
+
+ //
+ // Get the NIC handle by SNP protocol.
+ //
+ Handle = NetLibGetSnpHandle (ControllerHandle, NULL);
+ if (Handle == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ Aip = NULL;
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiAdapterInformationProtocolGuid,
+ (VOID *) &Aip
+ );
+ if (EFI_ERROR (Status) || Aip == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ InfoTypesBuffer = NULL;
+ InfoTypeBufferCount = 0;
+ Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
+ if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {
+ FreePool (InfoTypesBuffer);
+ return EFI_NOT_FOUND;
+ }
+
+ Supported = FALSE;
+ for (TypeIndex = 0; TypeIndex < InfoTypeBufferCount; TypeIndex++) {
+ if (CompareGuid (&InfoTypesBuffer[TypeIndex], &gEfiAdapterInfoUndiIpv6SupportGuid)) {
+ Supported = TRUE;
+ break;
+ }
+ }
+
+ FreePool (InfoTypesBuffer);
+ if (!Supported) {
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // We now have adapter information block.
+ //
+ InfoBlock = NULL;
+ InfoBlockSize = 0;
+ Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);
+ if (EFI_ERROR (Status) || InfoBlock == NULL) {
+ FreePool (InfoBlock);
+ return EFI_NOT_FOUND;
+ }
+
+ *Ipv6Support = ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *) InfoBlock)->Ipv6Support;
+ FreePool (InfoBlock);
+ return EFI_SUCCESS;
+
+}
/**
Create the opened instances based on IPv4.
@@ -1057,7 +1154,18 @@ PxeBcCreateIp6Children (
// Set IPv6 avaiable flag and set default configure data for
// Udp6Read and Ip6 instance.
//
- Private->Mode.Ipv6Available = TRUE;
+ Status = PxeBcCheckIpv6Support (ControllerHandle, Private, &Private->Mode.Ipv6Available);
+ if (EFI_ERROR (Status)) {
+ //
+ // Fail to get the data whether UNDI supports IPv6. Set default value.
+ //
+ Private->Mode.Ipv6Available = TRUE;
+ }
+
+ if (!Private->Mode.Ipv6Available) {
+ goto ON_ERROR;
+ }
+
Udp6CfgData = &Private->Udp6CfgData;
Ip6CfgData = &Private->Ip6CfgData;
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
index 8f754e0b3b..4aa3ce2f5b 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
@@ -2,7 +2,7 @@
This EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
interfaces declaration.
- Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -37,6 +37,7 @@
#include <Protocol/PxeBaseCodeCallBack.h>
#include <Protocol/ServiceBinding.h>
#include <Protocol/DriverBinding.h>
+#include <Protocol/AdapterInformation.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
diff --git a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
index 594032e79b..1b9c41276c 100644
--- a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
+++ b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
@@ -6,7 +6,7 @@
# with an IPv4 stack, an IPv6 stack or both.
#
#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -97,6 +97,10 @@
gEfiPxeBaseCodeCallbackProtocolGuid ## SOMETIMES_PRODUCES
gEfiPxeBaseCodeProtocolGuid ## BY_START
gEfiLoadFileProtocolGuid ## BY_START
+ gEfiAdapterInformationProtocolGuid ## SOMETIMES_CONSUMES
+
+[Guids]
+ gEfiAdapterInfoUndiIpv6SupportGuid
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize ## SOMETIMES_CONSUMES