From 2bbe9553c495bb9024b4b51743142a0a50e0d370 Mon Sep 17 00:00:00 2001 From: Ye Ting Date: Thu, 30 Apr 2015 02:57:10 +0000 Subject: [PATCH] Add IPV6 support from UNDI MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Fu Siyuan Reviewed-by: Wu Jiaxin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17275 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Protocol/AdapterInformation.h | 25 ++- MdePkg/MdePkg.dec | 4 + NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 112 ++++++++++++- NetworkPkg/UefiPxeBcDxe/PxeBcImpl.h | 3 +- NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf | 6 +- OptionRomPkg/UndiRuntimeDxe/Init.c | 10 +- OptionRomPkg/UndiRuntimeDxe/Undi32.h | 99 ++++++++++++ OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c | 151 ++++++++++++++++++ .../UndiRuntimeDxe/UndiRuntimeDxe.inf | 5 +- 9 files changed, 405 insertions(+), 10 deletions(-) create mode 100644 OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c diff --git a/MdePkg/Include/Protocol/AdapterInformation.h b/MdePkg/Include/Protocol/AdapterInformation.h index 63b560a106..275e1b63af 100644 --- a/MdePkg/Include/Protocol/AdapterInformation.h +++ b/MdePkg/Include/Protocol/AdapterInformation.h @@ -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.
+ Copyright (c) 2014 - 2015, Intel Corporation. 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 @@ -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 @@ typedef struct { /// 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 @@ typedef struct { /// 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,7 +112,17 @@ typedef struct { /// 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 gEfiAdapterInfoNetworkBootGuid; extern EFI_GUID gEfiAdapterInfoSanMacAddressGuid; +extern EFI_GUID gEfiAdapterInfoUndiIpv6SupportGuid; + #endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 644f2ba978..531eedb0e3 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -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 # 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.
- Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
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.
+ Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
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 #include #include +#include #include #include 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.
+# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
# # 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 diff --git a/OptionRomPkg/UndiRuntimeDxe/Init.c b/OptionRomPkg/UndiRuntimeDxe/Init.c index 4e4327005f..41892ca2b6 100644 --- a/OptionRomPkg/UndiRuntimeDxe/Init.c +++ b/OptionRomPkg/UndiRuntimeDxe/Init.c @@ -435,7 +435,7 @@ UndiDriverStart ( 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 @@ UndiDriverStart ( 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 @@ UndiDriverStart ( &UNDI32Device->NIIProtocol_31, &gEfiDevicePathProtocolGuid, UNDI32Device->Undi32DevPath, + &gEfiAdapterInformationProtocolGuid, + &UNDI32Device->Aip, NULL ); @@ -497,6 +503,8 @@ UndiErrorAllocDataPointer: &UNDI32Device->NIIProtocol_31, &gEfiDevicePathProtocolGuid, UNDI32Device->Undi32DevPath, + &gEfiAdapterInformationProtocolGuid, + &UNDI32Device->Aip, NULL ); diff --git a/OptionRomPkg/UndiRuntimeDxe/Undi32.h b/OptionRomPkg/UndiRuntimeDxe/Undi32.h index d09761d59d..18341dd512 100644 --- a/OptionRomPkg/UndiRuntimeDxe/Undi32.h +++ b/OptionRomPkg/UndiRuntimeDxe/Undi32.h @@ -21,6 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include @@ -30,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include @@ -57,10 +59,12 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gUndiComponentName2; #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 @@ INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr); 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 diff --git a/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c b/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c new file mode 100644 index 0000000000..17552a1929 --- /dev/null +++ b/OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c @@ -0,0 +1,151 @@ +/** @file + +Copyright (c) 2015, Intel Corporation. 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 +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; +} diff --git a/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf b/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf index 4be7044be7..b07c04e2cf 100644 --- a/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf +++ b/OptionRomPkg/UndiRuntimeDxe/UndiRuntimeDxe.inf @@ -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 -- 2.39.2