]> git.proxmox.com Git - mirror_edk2.git/blame - OptionRomPkg/UndiRuntimeDxe/UndiAipImpl.c
Add IPV6 support from UNDI
[mirror_edk2.git] / OptionRomPkg / UndiRuntimeDxe / UndiAipImpl.c
CommitLineData
2bbe9553
YT
1/** @file\r
2\r
3Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11**/\r
12\r
13\r
14#include "Undi32.h"\r
15\r
16\r
17UINTN mSupportedInfoTypesCount = 1;\r
18EFI_GUID mSupportedInfoTypes[] = {\r
19 EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT_GUID\r
20};\r
21\r
22/**\r
23 Returns the current state information for the adapter.\r
24\r
25 This function returns information of type InformationType from the adapter.\r
26 If an adapter does not support the requested informational type, then\r
27 EFI_UNSUPPORTED is returned. \r
28\r
29 @param[in] This A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
30 @param[in] InformationType A pointer to an EFI_GUID that defines the contents of InformationBlock.\r
31 @param[out] InforamtionBlock The service returns a pointer to the buffer with the InformationBlock\r
32 structure which contains details about the data specific to InformationType.\r
33 @param[out] InforamtionBlockSize The driver returns the size of the InformationBlock in bytes.\r
34\r
35 @retval EFI_SUCCESS The InformationType information was retrieved.\r
36 @retval EFI_UNSUPPORTED The InformationType is not known.\r
37 @retval EFI_DEVICE_ERROR The device reported an error.\r
38 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
39 @retval EFI_INVALID_PARAMETER This is NULL. \r
40 @retval EFI_INVALID_PARAMETER InformationBlock is NULL. \r
41 @retval EFI_INVALID_PARAMETER InformationBlockSize is NULL.\r
42\r
43**/ \r
44EFI_STATUS\r
45EFIAPI\r
46UndiAipGetInfo (\r
47 IN EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
48 IN EFI_GUID *InformationType,\r
49 OUT VOID **InformationBlock,\r
50 OUT UINTN *InformationBlockSize\r
51 )\r
52{\r
53 UNDI32_DEV *UNDI32Device;\r
54 EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *UndiIpv6Support;\r
55\r
56 if (This == NULL || InformationBlock == NULL || InformationBlockSize == NULL) {\r
57 return EFI_INVALID_PARAMETER;\r
58 }\r
59\r
60 if (!CompareGuid (InformationType, &gEfiAdapterInfoUndiIpv6SupportGuid)) {\r
61 return EFI_UNSUPPORTED;\r
62 }\r
63\r
64 UNDI32Device = UNDI_DEV_FROM_AIP (This);\r
65 *InformationBlockSize = sizeof (EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT);\r
66 *InformationBlock = AllocateZeroPool (*InformationBlockSize);\r
67 if (*InformationBlock == NULL) {\r
68 return EFI_OUT_OF_RESOURCES;\r
69 }\r
70\r
71 UndiIpv6Support = (EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *) (*InformationBlock);\r
72 UndiIpv6Support->Ipv6Support = UNDI32Device->NIIProtocol_31.Ipv6Supported;\r
73\r
74 return EFI_SUCCESS;\r
75}\r
76\r
77/**\r
78 Sets state information for an adapter.\r
79\r
80 This function sends information of type InformationType for an adapter.\r
81 If an adapter does not support the requested information type, then EFI_UNSUPPORTED\r
82 is returned.\r
83\r
84 @param[in] This A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
85 @param[in] InformationType A pointer to an EFI_GUID that defines the contents of InformationBlock.\r
86 @param[in] InforamtionBlock A pointer to the InformationBlock structure which contains details\r
87 about the data specific to InformationType.\r
88 @param[in] InforamtionBlockSize The size of the InformationBlock in bytes.\r
89\r
90 @retval EFI_SUCCESS The information was received and interpreted successfully.\r
91 @retval EFI_UNSUPPORTED The InformationType is not known.\r
92 @retval EFI_DEVICE_ERROR The device reported an error.\r
93 @retval EFI_INVALID_PARAMETER This is NULL.\r
94 @retval EFI_INVALID_PARAMETER InformationBlock is NULL.\r
95 @retval EFI_WRITE_PROTECTED The InformationType cannot be modified using EFI_ADAPTER_INFO_SET_INFO().\r
96\r
97**/ \r
98EFI_STATUS\r
99EFIAPI\r
100UndiAipSetInfo (\r
101 IN EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
102 IN EFI_GUID *InformationType,\r
103 IN VOID *InformationBlock,\r
104 IN UINTN InformationBlockSize\r
105 )\r
106{\r
107 return EFI_WRITE_PROTECTED;\r
108}\r
109\r
110/**\r
111 Get a list of supported information types for this instance of the protocol.\r
112\r
113 This function returns a list of InformationType GUIDs that are supported on an\r
114 adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned\r
115 in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in\r
116 InfoTypesBufferCount.\r
117\r
118 @param[in] This A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.\r
119 @param[out] InfoTypesBuffer A pointer to the list of InformationType GUID pointers that are supported\r
120 by This.\r
121 @param[out] InfoTypesBufferCount A pointer to the number of GUID pointers present in InfoTypesBuffer.\r
122\r
123 @retval EFI_SUCCESS The list of information type GUIDs that are supported on this adapter was\r
124 returned in InfoTypesBuffer. The number of information type GUIDs was\r
125 returned in InfoTypesBufferCount.\r
126 @retval EFI_INVALID_PARAMETER This is NULL.\r
127 @retval EFI_INVALID_PARAMETER InfoTypesBuffer is NULL.\r
128 @retval EFI_INVALID_PARAMETER InfoTypesBufferCount is NULL.\r
129 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results.\r
130\r
131**/ \r
132EFI_STATUS\r
133EFIAPI\r
134UndiAipGetSupportedTypes (\r
135 IN EFI_ADAPTER_INFORMATION_PROTOCOL *This,\r
136 OUT EFI_GUID **InfoTypesBuffer,\r
137 OUT UINTN *InfoTypesBufferCount\r
138 )\r
139{\r
140 if (This == NULL || InfoTypesBuffer == NULL || InfoTypesBufferCount == NULL) {\r
141 return EFI_INVALID_PARAMETER;\r
142 }\r
143\r
144 *InfoTypesBufferCount = 1;\r
145 *InfoTypesBuffer = AllocateCopyPool (sizeof (EFI_GUID), &gEfiAdapterInfoUndiIpv6SupportGuid);\r
146 if (InfoTypesBuffer == NULL) {\r
147 return EFI_OUT_OF_RESOURCES;\r
148 }\r
149\r
150 return EFI_SUCCESS;\r
151}\r