Revision: 17275
          http://sourceforge.net/p/edk2/code/17275
Author:   tye1
Date:     2015-04-30 02:57:10 +0000 (Thu, 30 Apr 2015)
Log Message:
-----------
Add IPV6 support from UNDI

Add new information block ?\226?\128?\152IPV6 support from UNDI?\226?\128?\153 
in AIP protocol and provide sample implementation in UNDI driver.
Update PXE driver to get ?\226?\128?\152Ipv6Available?\226?\128?\153 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 <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
Reviewed-by: Wu Jiaxin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdePkg/Include/Protocol/AdapterInformation.h
    trunk/edk2/MdePkg/MdePkg.dec
    trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
    trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
    trunk/edk2/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
    trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Init.c
    trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Undi32.h
    trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf

Added Paths:
-----------
    trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c

Modified: trunk/edk2/MdePkg/Include/Protocol/AdapterInformation.h
===================================================================
--- trunk/edk2/MdePkg/Include/Protocol/AdapterInformation.h     2015-04-30 
02:22:53 UTC (rev 17274)
+++ trunk/edk2/MdePkg/Include/Protocol/AdapterInformation.h     2015-04-30 
02:57:10 UTC (rev 17275)
@@ -3,7 +3,7 @@
   The EFI Adapter Information Protocol is used to dynamically and quickly 
discover
   or set device information for an adapter.
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 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
   which accompanies this distribution. The full text of the license may be 
found at
@@ -41,6 +41,11 @@
     0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 
} \
   }
 
+#define EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT_GUID \
+  { \
+    0x4bd56be3, 0x4975, 0x4d8a, {0xa0, 0xad, 0xc4, 0x91, 0x20, 0x4b, 0x5d, 
0x4d} \
+  }
+
 typedef struct _EFI_ADAPTER_INFORMATION_PROTOCOL 
EFI_ADAPTER_INFORMATION_PROTOCOL;
 
 ///
@@ -54,7 +59,7 @@
   /// not any media attached to the network.
   ///
   EFI_STATUS                    MediaState;
-}EFI_ADAPTER_INFO_MEDIA_STATE;
+} EFI_ADAPTER_INFO_MEDIA_STATE;
 
 ///
 /// EFI_ADAPTER_INFO_NETWORK_BOOT
@@ -96,7 +101,7 @@
   /// TRUE if the adapter is currently configured to boot from FCoE targets.
   ///
   BOOLEAN                       FCoeBoot;
-}EFI_ADAPTER_INFO_NETWORK_BOOT;
+} EFI_ADAPTER_INFO_NETWORK_BOOT;
 
 ///
 /// EFI_ADAPTER_INFO_SAN_MAC_ADDRESS
@@ -107,8 +112,18 @@
   /// networking and Fibre-Channel Over Ethernet (FCOE), this conveys the FCOE 
SAN MAC address from the adapter.
   ///
   EFI_MAC_ADDRESS                    SanMacAddress;
-}EFI_ADAPTER_INFO_SAN_MAC_ADDRESS;
+} EFI_ADAPTER_INFO_SAN_MAC_ADDRESS;
 
+///
+/// EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT
+///
+typedef struct {
+  ///
+  /// Returns capability of UNDI to support IPv6 traffic.
+  ///
+  BOOLEAN                            Ipv6Support; 
+} EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT;
+
 /**
   Returns the current state information for the adapter.
 
@@ -221,4 +236,6 @@
 
 extern EFI_GUID gEfiAdapterInfoSanMacAddressGuid;
 
+extern EFI_GUID gEfiAdapterInfoUndiIpv6SupportGuid;
+
 #endif

Modified: trunk/edk2/MdePkg/MdePkg.dec
===================================================================
--- trunk/edk2/MdePkg/MdePkg.dec        2015-04-30 02:22:53 UTC (rev 17274)
+++ trunk/edk2/MdePkg/MdePkg.dec        2015-04-30 02:57:10 UTC (rev 17275)
@@ -560,6 +560,10 @@
   ## Include/Guid/SystemResourceTable.h
   gEfiSystemResourceTableGuid    = { 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 
0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80 }}
 
+  ## Include/Protocol/AdapterInformation.h
+  gEfiAdapterInfoUndiIpv6SupportGuid = { 0x4bd56be3, 0x4975, 0x4d8a, {0xa0, 
0xad, 0xc4, 0x91, 0x20, 0x4b, 0x5d, 0x4d }}
+
+
   #
   # GUID defined in PI1.0
   #

Modified: trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
===================================================================
--- trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c    2015-04-30 02:22:53 UTC 
(rev 17274)
+++ trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c    2015-04-30 02:57:10 UTC 
(rev 17275)
@@ -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,7 +442,104 @@
   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 @@
   // 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;
 

Modified: trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
===================================================================
--- trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h      2015-04-30 02:22:53 UTC 
(rev 17274)
+++ trunk/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h      2015-04-30 02:57:10 UTC 
(rev 17275)
@@ -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>

Modified: trunk/edk2/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
===================================================================
--- trunk/edk2/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf 2015-04-30 02:22:53 UTC 
(rev 17274)
+++ trunk/edk2/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf 2015-04-30 02:57:10 UTC 
(rev 17275)
@@ -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,7 +97,11 @@
   gEfiPxeBaseCodeCallbackProtocolGuid                  ## SOMETIMES_PRODUCES
   gEfiPxeBaseCodeProtocolGuid                          ## BY_START
   gEfiLoadFileProtocolGuid                             ## BY_START
+  gEfiAdapterInformationProtocolGuid                   ## SOMETIMES_CONSUMES
 
+[Guids]
+  gEfiAdapterInfoUndiIpv6SupportGuid
+
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize     ## SOMETIMES_CONSUMES
 [UserExtensions.TianoCore."ExtraFiles"]

Modified: trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Init.c
===================================================================
--- trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Init.c       2015-04-30 02:22:53 UTC 
(rev 17274)
+++ trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Init.c       2015-04-30 02:57:10 UTC 
(rev 17275)
@@ -435,7 +435,7 @@
   UNDI32Device->NIIProtocol_31.MinorVer       = PXE_ROMID_MINORVER_31;
   UNDI32Device->NIIProtocol_31.ImageSize      = 0;
   UNDI32Device->NIIProtocol_31.ImageAddr      = 0;
-  UNDI32Device->NIIProtocol_31.Ipv6Supported  = FALSE;
+  UNDI32Device->NIIProtocol_31.Ipv6Supported  = TRUE;
 
   UNDI32Device->NIIProtocol_31.StringId[0]    = 'U';
   UNDI32Device->NIIProtocol_31.StringId[1]    = 'N';
@@ -444,6 +444,10 @@
 
   UNDI32Device->DeviceHandle                  = NULL;
 
+  UNDI32Device->Aip.GetInformation            = UndiAipGetInfo;
+  UNDI32Device->Aip.SetInformation            = UndiAipSetInfo;
+  UNDI32Device->Aip.GetSupportedTypes         = UndiAipGetSupportedTypes;
+
   //
   // install both the 3.0 and 3.1 NII protocols.
   //
@@ -453,6 +457,8 @@
                   &UNDI32Device->NIIProtocol_31,
                   &gEfiDevicePathProtocolGuid,
                   UNDI32Device->Undi32DevPath,
+                  &gEfiAdapterInformationProtocolGuid,
+                  &UNDI32Device->Aip,
                   NULL
                   );
 
@@ -497,6 +503,8 @@
                   &UNDI32Device->NIIProtocol_31,
                   &gEfiDevicePathProtocolGuid,
                   UNDI32Device->Undi32DevPath,
+                  &gEfiAdapterInformationProtocolGuid,
+                  &UNDI32Device->Aip,
                   NULL
                   );
 

Modified: trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Undi32.h
===================================================================
--- trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Undi32.h     2015-04-30 02:22:53 UTC 
(rev 17274)
+++ trunk/edk2/OptionRomPkg/UndiRuntimeDxe/Undi32.h     2015-04-30 02:57:10 UTC 
(rev 17275)
@@ -21,6 +21,7 @@
 #include <Protocol/PciIo.h>
 #include <Protocol/NetworkInterfaceIdentifier.h>
 #include <Protocol/DevicePath.h>
+#include <Protocol/AdapterInformation.h>
 
 #include <Library/UefiDriverEntryPoint.h>
 #include <Library/UefiRuntimeLib.h>
@@ -30,6 +31,7 @@
 #include <Library/UefiLib.h>
 #include <Library/BaseLib.h>
 #include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
 
 #include <IndustryStandard/Pci.h>
 
@@ -57,10 +59,12 @@
 #define UNDI_DEV_SIGNATURE   SIGNATURE_32('u','n','d','i')
 #define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol_31, 
UNDI_DEV_SIGNATURE)
 #define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)
+#define UNDI_DEV_FROM_AIP(a) CR(a, UNDI32_DEV, Aip, UNDI_DEV_SIGNATURE)
 
 typedef struct {
   UINTN                                     Signature;
   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;
+  EFI_ADAPTER_INFORMATION_PROTOCOL          Aip;
   EFI_HANDLE                                DeviceHandle;
   EFI_DEVICE_PATH_PROTOCOL                  *Undi32BaseDevPath;
   EFI_DEVICE_PATH_PROTOCOL                  *Undi32DevPath;
@@ -343,4 +347,99 @@
 VOID PxeStructInit (PXE_SW_UNDI *PxePtr);
 VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);
 
+//
+// functions defined in UndiAipImpl.c
+//
+
+/**
+  Returns the current state information for the adapter.
+
+  This function returns information of type InformationType from the adapter.
+  If an adapter does not support the requested informational type, then
+  EFI_UNSUPPORTED is returned. 
+
+  @param[in]  This                   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the 
contents of InformationBlock.
+  @param[out] InforamtionBlock       The service returns a pointer to the 
buffer with the InformationBlock
+                                     structure which contains details about 
the data specific to InformationType.
+  @param[out] InforamtionBlockSize   The driver returns the size of the 
InformationBlock in bytes.
+
+  @retval EFI_SUCCESS                The InformationType information was 
retrieved.
+  @retval EFI_UNSUPPORTED            The InformationType is not known.
+  @retval EFI_DEVICE_ERROR           The device reported an error.
+  @retval EFI_OUT_OF_RESOURCES       The request could not be completed due to 
a lack of resources.
+  @retval EFI_INVALID_PARAMETER      This is NULL. 
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL. 
+  @retval EFI_INVALID_PARAMETER      InformationBlockSize is NULL.
+
+**/  
+EFI_STATUS
+EFIAPI
+UndiAipGetInfo (
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,
+  IN   EFI_GUID                         *InformationType,
+  OUT  VOID                             **InformationBlock,
+  OUT  UINTN                            *InformationBlockSize
+  );
+
+/**
+  Sets state information for an adapter.
+
+  This function sends information of type InformationType for an adapter.
+  If an adapter does not support the requested information type, then 
EFI_UNSUPPORTED
+  is returned.
+
+  @param[in]  This                   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the 
contents of InformationBlock.
+  @param[in]  InforamtionBlock       A pointer to the InformationBlock 
structure which contains details
+                                     about the data specific to 
InformationType.
+  @param[in]  InforamtionBlockSize   The size of the InformationBlock in bytes.
+
+  @retval EFI_SUCCESS                The information was received and 
interpreted successfully.
+  @retval EFI_UNSUPPORTED            The InformationType is not known.
+  @retval EFI_DEVICE_ERROR           The device reported an error.
+  @retval EFI_INVALID_PARAMETER      This is NULL.
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.
+  @retval EFI_WRITE_PROTECTED        The InformationType cannot be modified 
using EFI_ADAPTER_INFO_SET_INFO().
+
+**/                        
+EFI_STATUS
+EFIAPI
+UndiAipSetInfo (
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,
+  IN   EFI_GUID                         *InformationType,
+  IN   VOID                             *InformationBlock,
+  IN   UINTN                            InformationBlockSize
+  );
+
+/**
+  Get a list of supported information types for this instance of the protocol.
+
+  This function returns a list of InformationType GUIDs that are supported on 
an
+  adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is 
returned
+  in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is 
returned in
+  InfoTypesBufferCount.
+
+  @param[in]  This                  A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[out] InfoTypesBuffer       A pointer to the list of InformationType 
GUID pointers that are supported
+                                    by This.
+  @param[out] InfoTypesBufferCount  A pointer to the number of GUID pointers 
present in InfoTypesBuffer.
+
+  @retval EFI_SUCCESS               The list of information type GUIDs that 
are supported on this adapter was
+                                    returned in InfoTypesBuffer. The number of 
information type GUIDs was
+                                    returned in InfoTypesBufferCount.
+  @retval EFI_INVALID_PARAMETER     This is NULL.
+  @retval EFI_INVALID_PARAMETER     InfoTypesBuffer is NULL.
+  @retval EFI_INVALID_PARAMETER     InfoTypesBufferCount is NULL.
+  @retval EFI_OUT_OF_RESOURCES      There is not enough pool memory to store 
the results.
+
+**/                        
+EFI_STATUS
+EFIAPI
+UndiAipGetSupportedTypes (
+  IN    EFI_ADAPTER_INFORMATION_PROTOCOL *This,
+  OUT   EFI_GUID                         **InfoTypesBuffer,
+  OUT   UINTN                            *InfoTypesBufferCount
+  );
+
 #endif

Added: trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c
===================================================================
--- trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c                        
        (rev 0)
+++ trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c        2015-04-30 
02:57:10 UTC (rev 17275)
@@ -0,0 +1,151 @@
+/** @file
+
+Copyright (c) 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
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+
+#include "Undi32.h"
+
+
+UINTN      mSupportedInfoTypesCount = 1;
+EFI_GUID   mSupportedInfoTypes[] = {
+  EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT_GUID
+};
+
+/**
+  Returns the current state information for the adapter.
+
+  This function returns information of type InformationType from the adapter.
+  If an adapter does not support the requested informational type, then
+  EFI_UNSUPPORTED is returned. 
+
+  @param[in]  This                   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the 
contents of InformationBlock.
+  @param[out] InforamtionBlock       The service returns a pointer to the 
buffer with the InformationBlock
+                                     structure which contains details about 
the data specific to InformationType.
+  @param[out] InforamtionBlockSize   The driver returns the size of the 
InformationBlock in bytes.
+
+  @retval EFI_SUCCESS                The InformationType information was 
retrieved.
+  @retval EFI_UNSUPPORTED            The InformationType is not known.
+  @retval EFI_DEVICE_ERROR           The device reported an error.
+  @retval EFI_OUT_OF_RESOURCES       The request could not be completed due to 
a lack of resources.
+  @retval EFI_INVALID_PARAMETER      This is NULL. 
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL. 
+  @retval EFI_INVALID_PARAMETER      InformationBlockSize is NULL.
+
+**/  
+EFI_STATUS
+EFIAPI
+UndiAipGetInfo (
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,
+  IN   EFI_GUID                         *InformationType,
+  OUT  VOID                             **InformationBlock,
+  OUT  UINTN                            *InformationBlockSize
+  )
+{
+  UNDI32_DEV                            *UNDI32Device;
+  EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT    *UndiIpv6Support;
+
+  if (This == NULL || InformationBlock == NULL || InformationBlockSize == 
NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (!CompareGuid (InformationType, &gEfiAdapterInfoUndiIpv6SupportGuid)) {
+    return EFI_UNSUPPORTED;
+  }
+
+  UNDI32Device = UNDI_DEV_FROM_AIP (This);
+  *InformationBlockSize = sizeof (EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT);
+  *InformationBlock = AllocateZeroPool (*InformationBlockSize);
+  if (*InformationBlock == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  UndiIpv6Support = (EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *) (*InformationBlock);
+  UndiIpv6Support->Ipv6Support = UNDI32Device->NIIProtocol_31.Ipv6Supported;
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Sets state information for an adapter.
+
+  This function sends information of type InformationType for an adapter.
+  If an adapter does not support the requested information type, then 
EFI_UNSUPPORTED
+  is returned.
+
+  @param[in]  This                   A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the 
contents of InformationBlock.
+  @param[in]  InforamtionBlock       A pointer to the InformationBlock 
structure which contains details
+                                     about the data specific to 
InformationType.
+  @param[in]  InforamtionBlockSize   The size of the InformationBlock in bytes.
+
+  @retval EFI_SUCCESS                The information was received and 
interpreted successfully.
+  @retval EFI_UNSUPPORTED            The InformationType is not known.
+  @retval EFI_DEVICE_ERROR           The device reported an error.
+  @retval EFI_INVALID_PARAMETER      This is NULL.
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.
+  @retval EFI_WRITE_PROTECTED        The InformationType cannot be modified 
using EFI_ADAPTER_INFO_SET_INFO().
+
+**/                        
+EFI_STATUS
+EFIAPI
+UndiAipSetInfo (
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,
+  IN   EFI_GUID                         *InformationType,
+  IN   VOID                             *InformationBlock,
+  IN   UINTN                            InformationBlockSize
+  )
+{
+  return EFI_WRITE_PROTECTED;
+}
+
+/**
+  Get a list of supported information types for this instance of the protocol.
+
+  This function returns a list of InformationType GUIDs that are supported on 
an
+  adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is 
returned
+  in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is 
returned in
+  InfoTypesBufferCount.
+
+  @param[in]  This                  A pointer to the 
EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[out] InfoTypesBuffer       A pointer to the list of InformationType 
GUID pointers that are supported
+                                    by This.
+  @param[out] InfoTypesBufferCount  A pointer to the number of GUID pointers 
present in InfoTypesBuffer.
+
+  @retval EFI_SUCCESS               The list of information type GUIDs that 
are supported on this adapter was
+                                    returned in InfoTypesBuffer. The number of 
information type GUIDs was
+                                    returned in InfoTypesBufferCount.
+  @retval EFI_INVALID_PARAMETER     This is NULL.
+  @retval EFI_INVALID_PARAMETER     InfoTypesBuffer is NULL.
+  @retval EFI_INVALID_PARAMETER     InfoTypesBufferCount is NULL.
+  @retval EFI_OUT_OF_RESOURCES      There is not enough pool memory to store 
the results.
+
+**/                        
+EFI_STATUS
+EFIAPI
+UndiAipGetSupportedTypes (
+  IN    EFI_ADAPTER_INFORMATION_PROTOCOL *This,
+  OUT   EFI_GUID                         **InfoTypesBuffer,
+  OUT   UINTN                            *InfoTypesBufferCount
+  )
+{
+  if (This == NULL || InfoTypesBuffer == NULL || InfoTypesBufferCount == NULL) 
{
+    return EFI_INVALID_PARAMETER;
+  }
+
+  *InfoTypesBufferCount = 1;
+  *InfoTypesBuffer = AllocateCopyPool (sizeof (EFI_GUID), 
&gEfiAdapterInfoUndiIpv6SupportGuid);
+  if (InfoTypesBuffer == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  return EFI_SUCCESS;
+}

Modified: trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf
===================================================================
--- trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf   2015-04-30 
02:22:53 UTC (rev 17274)
+++ trunk/edk2/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf   2015-04-30 
02:57:10 UTC (rev 17275)
@@ -36,11 +36,11 @@
   Decode.c
   Init.c
   ComponentName.c
+  UndiAipImpl.c
 
 [Packages]
   MdePkg/MdePkg.dec
 
-
 [LibraryClasses]
   UefiLib
   UefiBootServicesTableLib
@@ -49,15 +49,18 @@
   UefiRuntimeLib
   UefiDriverEntryPoint
   BaseLib
+  MemoryAllocationLib
 
 [Protocols]
   gEfiNetworkInterfaceIdentifierProtocolGuid_31
   gEfiPciIoProtocolGuid
   gEfiDevicePathProtocolGuid
+  gEfiAdapterInformationProtocolGuid
 
 [Guids]
   gEfiEventExitBootServicesGuid        ## PRODUCES ## Event
   gEfiEventVirtualAddressChangeGuid    ## PRODUCES ## Event
+  gEfiAdapterInfoUndiIpv6SupportGuid   ## PRODUCES
 
 [Depex]
   gEfiBdsArchProtocolGuid AND


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to