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