]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add IPV6 support from UNDI
authorYe Ting <ting.ye@intel.com>
Thu, 30 Apr 2015 02:57:10 +0000 (02:57 +0000)
committertye1 <tye1@Edk2>
Thu, 30 Apr 2015 02:57:10 +0000 (02:57 +0000)
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

MdePkg/Include/Protocol/AdapterInformation.h
MdePkg/MdePkg.dec
NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h
NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
OptionRomPkg/UndiRuntimeDxe/Init.c
OptionRomPkg/UndiRuntimeDxe/Undi32.h
OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c [new file with mode: 0644]
OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf

index 63b560a106bfc7797a1c225e691dd1af2db58895..275e1b63af02fc0d8584ae3c43d0e66a1c29094c 100644 (file)
@@ -3,7 +3,7 @@
   The EFI Adapter Information Protocol is used to dynamically and quickly discover\r
   or set device information for an adapter.\r
 \r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution. The full text of the license may be found at\r
     0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 } \\r
   }\r
 \r
+#define EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT_GUID \\r
+  { \\r
+    0x4bd56be3, 0x4975, 0x4d8a, {0xa0, 0xad, 0xc4, 0x91, 0x20, 0x4b, 0x5d, 0x4d} \\r
+  }\r
+\r
 typedef struct _EFI_ADAPTER_INFORMATION_PROTOCOL EFI_ADAPTER_INFORMATION_PROTOCOL;\r
 \r
 ///\r
@@ -54,7 +59,7 @@ typedef struct {
   /// not any media attached to the network.\r
   ///\r
   EFI_STATUS                    MediaState;\r
-}EFI_ADAPTER_INFO_MEDIA_STATE;\r
+} EFI_ADAPTER_INFO_MEDIA_STATE;\r
 \r
 ///\r
 /// EFI_ADAPTER_INFO_NETWORK_BOOT\r
@@ -96,7 +101,7 @@ typedef struct {
   /// TRUE if the adapter is currently configured to boot from FCoE targets.\r
   ///\r
   BOOLEAN                       FCoeBoot;\r
-}EFI_ADAPTER_INFO_NETWORK_BOOT;\r
+} EFI_ADAPTER_INFO_NETWORK_BOOT;\r
 \r
 ///\r
 /// EFI_ADAPTER_INFO_SAN_MAC_ADDRESS\r
@@ -107,7 +112,17 @@ typedef struct {
   /// networking and Fibre-Channel Over Ethernet (FCOE), this conveys the FCOE SAN MAC address from the adapter.\r
   ///\r
   EFI_MAC_ADDRESS                    SanMacAddress;\r
-}EFI_ADAPTER_INFO_SAN_MAC_ADDRESS;\r
+} EFI_ADAPTER_INFO_SAN_MAC_ADDRESS;\r
+\r
+///\r
+/// EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT\r
+///\r
+typedef struct {\r
+  ///\r
+  /// Returns capability of UNDI to support IPv6 traffic.\r
+  ///\r
+  BOOLEAN                            Ipv6Support; \r
+} EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT;\r
 \r
 /**\r
   Returns the current state information for the adapter.\r
@@ -221,4 +236,6 @@ extern EFI_GUID gEfiAdapterInfoNetworkBootGuid;
 \r
 extern EFI_GUID gEfiAdapterInfoSanMacAddressGuid;\r
 \r
+extern EFI_GUID gEfiAdapterInfoUndiIpv6SupportGuid;\r
+\r
 #endif\r
index 644f2ba9782803f4ecbf7ca9f7847049e13f839e..531eedb0e32439cae9ccb2a47f1c1d02520f9e04 100644 (file)
   ## Include/Guid/SystemResourceTable.h\r
   gEfiSystemResourceTableGuid    = { 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80 }}\r
 \r
+  ## Include/Protocol/AdapterInformation.h\r
+  gEfiAdapterInfoUndiIpv6SupportGuid = { 0x4bd56be3, 0x4975, 0x4d8a, {0xa0, 0xad, 0xc4, 0x91, 0x20, 0x4b, 0x5d, 0x4d }}\r
+\r
+\r
   #\r
   # GUID defined in PI1.0\r
   #\r
index 92fd1f19df64bc9ebbf972a58dcc96adb7a5b306..c2987b8734a8986cbba9e0e776ca08842fa919ab 100644 (file)
@@ -2,7 +2,7 @@
   Driver Binding functions implementationfor for UefiPxeBc Driver.\r
 \r
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -442,6 +442,103 @@ PxeBcDestroyIp6Children (
   Private->Mode.Ipv6Available = FALSE;\r
 }\r
 \r
+/**\r
+  Check whether UNDI protocol supports IPv6.\r
+\r
+  @param[in]   ControllerHandle  Controller handle.\r
+  @param[in]   Private           Pointer to PXEBC_PRIVATE_DATA.\r
+  @param[out]  Ipv6Support       TRUE if UNDI supports IPv6.\r
+\r
+  @retval EFI_SUCCESS            Get the result whether UNDI supports IPv6 by NII or AIP protocol successfully.\r
+  @retval EFI_NOT_FOUND          Don't know whether UNDI supports IPv6 since NII or AIP is not available.\r
+\r
+**/\r
+EFI_STATUS\r
+PxeBcCheckIpv6Support (\r
+  IN  EFI_HANDLE                   ControllerHandle,\r
+  IN  PXEBC_PRIVATE_DATA           *Private,\r
+  OUT BOOLEAN                      *Ipv6Support\r
+  )\r
+{\r
+  EFI_HANDLE                       Handle;\r
+  EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;\r
+  EFI_STATUS                       Status;\r
+  EFI_GUID                         *InfoTypesBuffer;\r
+  UINTN                            InfoTypeBufferCount;\r
+  UINTN                            TypeIndex;\r
+  BOOLEAN                          Supported;\r
+  VOID                             *InfoBlock;\r
+  UINTN                            InfoBlockSize;\r
+\r
+  ASSERT (Private != NULL && Ipv6Support != NULL);\r
+\r
+  //\r
+  // Check whether the UNDI supports IPv6 by NII protocol.\r
+  //\r
+  if (Private->Nii != NULL) {\r
+    *Ipv6Support = Private->Nii->Ipv6Supported;\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  //\r
+  // Check whether the UNDI supports IPv6 by AIP protocol.\r
+  //\r
+\r
+  //\r
+  // Get the NIC handle by SNP protocol.\r
+  //  \r
+  Handle = NetLibGetSnpHandle (ControllerHandle, NULL);\r
+  if (Handle == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  Aip    = NULL;\r
+  Status = gBS->HandleProtocol (\r
+                  Handle,\r
+                  &gEfiAdapterInformationProtocolGuid,\r
+                  (VOID *) &Aip\r
+                  );\r
+  if (EFI_ERROR (Status) || Aip == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  InfoTypesBuffer     = NULL;\r
+  InfoTypeBufferCount = 0;\r
+  Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);\r
+  if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {\r
+    FreePool (InfoTypesBuffer);\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  Supported = FALSE;\r
+  for (TypeIndex = 0; TypeIndex < InfoTypeBufferCount; TypeIndex++) {\r
+    if (CompareGuid (&InfoTypesBuffer[TypeIndex], &gEfiAdapterInfoUndiIpv6SupportGuid)) {\r
+      Supported = TRUE;\r
+      break;\r
+    }\r
+  }\r
+\r
+  FreePool (InfoTypesBuffer);\r
+  if (!Supported) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  //\r
+  // We now have adapter information block.\r
+  //\r
+  InfoBlock     = NULL;\r
+  InfoBlockSize = 0;\r
+  Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);\r
+  if (EFI_ERROR (Status) || InfoBlock == NULL) {\r
+    FreePool (InfoBlock);\r
+    return EFI_NOT_FOUND;\r
+  }  \r
+\r
+  *Ipv6Support = ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *) InfoBlock)->Ipv6Support;\r
+  FreePool (InfoBlock);\r
+  return EFI_SUCCESS;\r
+\r
+}\r
 \r
 /**\r
   Create the opened instances based on IPv4.\r
@@ -1057,7 +1154,18 @@ PxeBcCreateIp6Children (
   // Set IPv6 avaiable flag and set default configure data for\r
   // Udp6Read and Ip6 instance.\r
   //\r
-  Private->Mode.Ipv6Available     = TRUE;\r
+  Status = PxeBcCheckIpv6Support (ControllerHandle, Private, &Private->Mode.Ipv6Available);\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // Fail to get the data whether UNDI supports IPv6. Set default value.\r
+    //\r
+    Private->Mode.Ipv6Available   = TRUE;\r
+  }\r
+\r
+  if (!Private->Mode.Ipv6Available) {\r
+    goto ON_ERROR;\r
+  }\r
+\r
   Udp6CfgData                     = &Private->Udp6CfgData;\r
   Ip6CfgData                      = &Private->Ip6CfgData;\r
 \r
index 8f754e0b3b7ca47d50783578e6a705d0c16b91ce..4aa3ce2f5b13310a2a70be2e01775212b261fe29 100644 (file)
@@ -2,7 +2,7 @@
   This EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.\r
   interfaces declaration.\r
 \r
-  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -37,6 +37,7 @@
 #include <Protocol/PxeBaseCodeCallBack.h>\r
 #include <Protocol/ServiceBinding.h>\r
 #include <Protocol/DriverBinding.h>\r
+#include <Protocol/AdapterInformation.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
index 594032e79bd000b74e9f8b81833b3d27e756f803..1b9c41276c04c88c51ced87e1d89c459e3b7491a 100644 (file)
@@ -6,7 +6,7 @@
 #  with an IPv4 stack, an IPv6 stack or both.\r
 #\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
   gEfiPxeBaseCodeCallbackProtocolGuid                  ## SOMETIMES_PRODUCES\r
   gEfiPxeBaseCodeProtocolGuid                          ## BY_START\r
   gEfiLoadFileProtocolGuid                             ## BY_START\r
+  gEfiAdapterInformationProtocolGuid                   ## SOMETIMES_CONSUMES\r
+\r
+[Guids]\r
+  gEfiAdapterInfoUndiIpv6SupportGuid\r
 \r
 [Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdTftpBlockSize     ## SOMETIMES_CONSUMES\r
index 4e4327005ff78a2ca37799bdf09f54fae265e475..41892ca2b6aff8949d05fb14e2254903a9bd6057 100644 (file)
@@ -435,7 +435,7 @@ UndiDriverStart (
   UNDI32Device->NIIProtocol_31.MinorVer       = PXE_ROMID_MINORVER_31;\r
   UNDI32Device->NIIProtocol_31.ImageSize      = 0;\r
   UNDI32Device->NIIProtocol_31.ImageAddr      = 0;\r
-  UNDI32Device->NIIProtocol_31.Ipv6Supported  = FALSE;\r
+  UNDI32Device->NIIProtocol_31.Ipv6Supported  = TRUE;\r
 \r
   UNDI32Device->NIIProtocol_31.StringId[0]    = 'U';\r
   UNDI32Device->NIIProtocol_31.StringId[1]    = 'N';\r
@@ -444,6 +444,10 @@ UndiDriverStart (
 \r
   UNDI32Device->DeviceHandle                  = NULL;\r
 \r
+  UNDI32Device->Aip.GetInformation            = UndiAipGetInfo;\r
+  UNDI32Device->Aip.SetInformation            = UndiAipSetInfo;\r
+  UNDI32Device->Aip.GetSupportedTypes         = UndiAipGetSupportedTypes;\r
+\r
   //\r
   // install both the 3.0 and 3.1 NII protocols.\r
   //\r
@@ -453,6 +457,8 @@ UndiDriverStart (
                   &UNDI32Device->NIIProtocol_31,\r
                   &gEfiDevicePathProtocolGuid,\r
                   UNDI32Device->Undi32DevPath,\r
+                  &gEfiAdapterInformationProtocolGuid,\r
+                  &UNDI32Device->Aip,\r
                   NULL\r
                   );\r
 \r
@@ -497,6 +503,8 @@ UndiErrorAllocDataPointer:
                   &UNDI32Device->NIIProtocol_31,\r
                   &gEfiDevicePathProtocolGuid,\r
                   UNDI32Device->Undi32DevPath,\r
+                  &gEfiAdapterInformationProtocolGuid,\r
+                  &UNDI32Device->Aip,\r
                   NULL\r
                   );\r
 \r
index d09761d59ddc319d9e8b7faad7bf6d8d44c38375..18341dd5128a70fa226a95e1b1d8bb7517eaf100 100644 (file)
@@ -21,6 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/PciIo.h>\r
 #include <Protocol/NetworkInterfaceIdentifier.h>\r
 #include <Protocol/DevicePath.h>\r
+#include <Protocol/AdapterInformation.h>\r
 \r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiRuntimeLib.h>\r
@@ -30,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/DevicePathLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
 \r
 #include <IndustryStandard/Pci.h>\r
 \r
@@ -57,10 +59,12 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gUndiComponentName2;
 #define UNDI_DEV_SIGNATURE   SIGNATURE_32('u','n','d','i')\r
 #define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol_31, UNDI_DEV_SIGNATURE)\r
 #define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)\r
+#define UNDI_DEV_FROM_AIP(a) CR(a, UNDI32_DEV, Aip, UNDI_DEV_SIGNATURE)\r
 \r
 typedef struct {\r
   UINTN                                     Signature;\r
   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;\r
+  EFI_ADAPTER_INFORMATION_PROTOCOL          Aip;\r
   EFI_HANDLE                                DeviceHandle;\r
   EFI_DEVICE_PATH_PROTOCOL                  *Undi32BaseDevPath;\r
   EFI_DEVICE_PATH_PROTOCOL                  *Undi32DevPath;\r
@@ -343,4 +347,99 @@ INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr);
 VOID PxeStructInit (PXE_SW_UNDI *PxePtr);\r
 VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);\r
 \r
+//\r
+// functions defined in UndiAipImpl.c\r
+//\r
+\r
+/**\r
+  Returns the current state information for the adapter.\r
+\r
+  This function returns information of type InformationType from the adapter.\r
+  If an adapter does not support the requested informational type, then\r
+  EFI_UNSUPPORTED is returned. \r
+\r
+  @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.\r
+  @param[out] InforamtionBlock       The service returns a pointer to the buffer with the InformationBlock\r
+                                     structure which contains details about the data specific to InformationType.\r
+  @param[out] InforamtionBlockSize   The driver returns the size of the InformationBlock in bytes.\r
+\r
+  @retval EFI_SUCCESS                The InformationType information was retrieved.\r
+  @retval EFI_UNSUPPORTED            The InformationType is not known.\r
+  @retval EFI_DEVICE_ERROR           The device reported an error.\r
+  @retval EFI_OUT_OF_RESOURCES       The request could not be completed due to a lack of resources.\r
+  @retval EFI_INVALID_PARAMETER      This is NULL. \r
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL. \r
+  @retval EFI_INVALID_PARAMETER      InformationBlockSize is NULL.\r
+\r
+**/  \r
+EFI_STATUS\r
+EFIAPI\r
+UndiAipGetInfo (\r
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
+  IN   EFI_GUID                         *InformationType,\r
+  OUT  VOID                             **InformationBlock,\r
+  OUT  UINTN                            *InformationBlockSize\r
+  );\r
+\r
+/**\r
+  Sets state information for an adapter.\r
+\r
+  This function sends information of type InformationType for an adapter.\r
+  If an adapter does not support the requested information type, then EFI_UNSUPPORTED\r
+  is returned.\r
+\r
+  @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.\r
+  @param[in]  InforamtionBlock       A pointer to the InformationBlock structure which contains details\r
+                                     about the data specific to InformationType.\r
+  @param[in]  InforamtionBlockSize   The size of the InformationBlock in bytes.\r
+\r
+  @retval EFI_SUCCESS                The information was received and interpreted successfully.\r
+  @retval EFI_UNSUPPORTED            The InformationType is not known.\r
+  @retval EFI_DEVICE_ERROR           The device reported an error.\r
+  @retval EFI_INVALID_PARAMETER      This is NULL.\r
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.\r
+  @retval EFI_WRITE_PROTECTED        The InformationType cannot be modified using EFI_ADAPTER_INFO_SET_INFO().\r
+\r
+**/                        \r
+EFI_STATUS\r
+EFIAPI\r
+UndiAipSetInfo (\r
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
+  IN   EFI_GUID                         *InformationType,\r
+  IN   VOID                             *InformationBlock,\r
+  IN   UINTN                            InformationBlockSize\r
+  );\r
+\r
+/**\r
+  Get a list of supported information types for this instance of the protocol.\r
+\r
+  This function returns a list of InformationType GUIDs that are supported on an\r
+  adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned\r
+  in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in\r
+  InfoTypesBufferCount.\r
+\r
+  @param[in]  This                  A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
+  @param[out] InfoTypesBuffer       A pointer to the list of InformationType GUID pointers that are supported\r
+                                    by This.\r
+  @param[out] InfoTypesBufferCount  A pointer to the number of GUID pointers present in InfoTypesBuffer.\r
+\r
+  @retval EFI_SUCCESS               The list of information type GUIDs that are supported on this adapter was\r
+                                    returned in InfoTypesBuffer. The number of information type GUIDs was\r
+                                    returned in InfoTypesBufferCount.\r
+  @retval EFI_INVALID_PARAMETER     This is NULL.\r
+  @retval EFI_INVALID_PARAMETER     InfoTypesBuffer is NULL.\r
+  @retval EFI_INVALID_PARAMETER     InfoTypesBufferCount is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES      There is not enough pool memory to store the results.\r
+\r
+**/                        \r
+EFI_STATUS\r
+EFIAPI\r
+UndiAipGetSupportedTypes (\r
+  IN    EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
+  OUT   EFI_GUID                         **InfoTypesBuffer,\r
+  OUT   UINTN                            *InfoTypesBufferCount\r
+  );\r
+\r
 #endif\r
diff --git a/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c b/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c
new file mode 100644 (file)
index 0000000..17552a1
--- /dev/null
@@ -0,0 +1,151 @@
+/** @file\r
+\r
+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+\r
+#include "Undi32.h"\r
+\r
+\r
+UINTN      mSupportedInfoTypesCount = 1;\r
+EFI_GUID   mSupportedInfoTypes[] = {\r
+  EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT_GUID\r
+};\r
+\r
+/**\r
+  Returns the current state information for the adapter.\r
+\r
+  This function returns information of type InformationType from the adapter.\r
+  If an adapter does not support the requested informational type, then\r
+  EFI_UNSUPPORTED is returned. \r
+\r
+  @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.\r
+  @param[out] InforamtionBlock       The service returns a pointer to the buffer with the InformationBlock\r
+                                     structure which contains details about the data specific to InformationType.\r
+  @param[out] InforamtionBlockSize   The driver returns the size of the InformationBlock in bytes.\r
+\r
+  @retval EFI_SUCCESS                The InformationType information was retrieved.\r
+  @retval EFI_UNSUPPORTED            The InformationType is not known.\r
+  @retval EFI_DEVICE_ERROR           The device reported an error.\r
+  @retval EFI_OUT_OF_RESOURCES       The request could not be completed due to a lack of resources.\r
+  @retval EFI_INVALID_PARAMETER      This is NULL. \r
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL. \r
+  @retval EFI_INVALID_PARAMETER      InformationBlockSize is NULL.\r
+\r
+**/  \r
+EFI_STATUS\r
+EFIAPI\r
+UndiAipGetInfo (\r
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
+  IN   EFI_GUID                         *InformationType,\r
+  OUT  VOID                             **InformationBlock,\r
+  OUT  UINTN                            *InformationBlockSize\r
+  )\r
+{\r
+  UNDI32_DEV                            *UNDI32Device;\r
+  EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT    *UndiIpv6Support;\r
+\r
+  if (This == NULL || InformationBlock == NULL || InformationBlockSize == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (!CompareGuid (InformationType, &gEfiAdapterInfoUndiIpv6SupportGuid)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  UNDI32Device = UNDI_DEV_FROM_AIP (This);\r
+  *InformationBlockSize = sizeof (EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT);\r
+  *InformationBlock = AllocateZeroPool (*InformationBlockSize);\r
+  if (*InformationBlock == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  UndiIpv6Support = (EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *) (*InformationBlock);\r
+  UndiIpv6Support->Ipv6Support = UNDI32Device->NIIProtocol_31.Ipv6Supported;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Sets state information for an adapter.\r
+\r
+  This function sends information of type InformationType for an adapter.\r
+  If an adapter does not support the requested information type, then EFI_UNSUPPORTED\r
+  is returned.\r
+\r
+  @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.\r
+  @param[in]  InforamtionBlock       A pointer to the InformationBlock structure which contains details\r
+                                     about the data specific to InformationType.\r
+  @param[in]  InforamtionBlockSize   The size of the InformationBlock in bytes.\r
+\r
+  @retval EFI_SUCCESS                The information was received and interpreted successfully.\r
+  @retval EFI_UNSUPPORTED            The InformationType is not known.\r
+  @retval EFI_DEVICE_ERROR           The device reported an error.\r
+  @retval EFI_INVALID_PARAMETER      This is NULL.\r
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.\r
+  @retval EFI_WRITE_PROTECTED        The InformationType cannot be modified using EFI_ADAPTER_INFO_SET_INFO().\r
+\r
+**/                        \r
+EFI_STATUS\r
+EFIAPI\r
+UndiAipSetInfo (\r
+  IN   EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
+  IN   EFI_GUID                         *InformationType,\r
+  IN   VOID                             *InformationBlock,\r
+  IN   UINTN                            InformationBlockSize\r
+  )\r
+{\r
+  return EFI_WRITE_PROTECTED;\r
+}\r
+\r
+/**\r
+  Get a list of supported information types for this instance of the protocol.\r
+\r
+  This function returns a list of InformationType GUIDs that are supported on an\r
+  adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned\r
+  in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in\r
+  InfoTypesBufferCount.\r
+\r
+  @param[in]  This                  A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
+  @param[out] InfoTypesBuffer       A pointer to the list of InformationType GUID pointers that are supported\r
+                                    by This.\r
+  @param[out] InfoTypesBufferCount  A pointer to the number of GUID pointers present in InfoTypesBuffer.\r
+\r
+  @retval EFI_SUCCESS               The list of information type GUIDs that are supported on this adapter was\r
+                                    returned in InfoTypesBuffer. The number of information type GUIDs was\r
+                                    returned in InfoTypesBufferCount.\r
+  @retval EFI_INVALID_PARAMETER     This is NULL.\r
+  @retval EFI_INVALID_PARAMETER     InfoTypesBuffer is NULL.\r
+  @retval EFI_INVALID_PARAMETER     InfoTypesBufferCount is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES      There is not enough pool memory to store the results.\r
+\r
+**/                        \r
+EFI_STATUS\r
+EFIAPI\r
+UndiAipGetSupportedTypes (\r
+  IN    EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
+  OUT   EFI_GUID                         **InfoTypesBuffer,\r
+  OUT   UINTN                            *InfoTypesBufferCount\r
+  )\r
+{\r
+  if (This == NULL || InfoTypesBuffer == NULL || InfoTypesBufferCount == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  *InfoTypesBufferCount = 1;\r
+  *InfoTypesBuffer = AllocateCopyPool (sizeof (EFI_GUID), &gEfiAdapterInfoUndiIpv6SupportGuid);\r
+  if (InfoTypesBuffer == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
index 4be7044be74705776206026e9c52025d16e6c9be..b07c04e2cff72aeac55d133361f53b23fa792f68 100644 (file)
   Decode.c\r
   Init.c\r
   ComponentName.c\r
+  UndiAipImpl.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
 \r
-\r
 [LibraryClasses]\r
   UefiLib\r
   UefiBootServicesTableLib\r
   UefiRuntimeLib\r
   UefiDriverEntryPoint\r
   BaseLib\r
+  MemoryAllocationLib\r
 \r
 [Protocols]\r
   gEfiNetworkInterfaceIdentifierProtocolGuid_31\r
   gEfiPciIoProtocolGuid\r
   gEfiDevicePathProtocolGuid\r
+  gEfiAdapterInformationProtocolGuid\r
 \r
 [Guids]\r
   gEfiEventExitBootServicesGuid        ## PRODUCES ## Event\r
   gEfiEventVirtualAddressChangeGuid    ## PRODUCES ## Event\r
+  gEfiAdapterInfoUndiIpv6SupportGuid   ## PRODUCES\r
 \r
 [Depex]\r
   gEfiBdsArchProtocolGuid AND\r