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