1 /** @file
2   EFI Adapter Information Protocol definition.
3   The EFI Adapter Information Protocol is used to dynamically and quickly discover
4   or set device information for an adapter.
5 
6   Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9   @par Revision Reference:
10   This Protocol is introduced in UEFI Specification 2.4
11 
12 **/
13 
14 #ifndef __EFI_ADAPTER_INFORMATION_PROTOCOL_H__
15 #define __EFI_ADAPTER_INFORMATION_PROTOCOL_H__
16 
17 #define EFI_ADAPTER_INFORMATION_PROTOCOL_GUID \
18   { \
19     0xE5DD1403, 0xD622, 0xC24E, {0x84, 0x88, 0xC7, 0x1B, 0x17, 0xF5, 0xE8, 0x02 } \
20   }
21 
22 #define EFI_ADAPTER_INFO_MEDIA_STATE_GUID \
23   { \
24     0xD7C74207, 0xA831, 0x4A26, {0xB1, 0xF5, 0xD1, 0x93, 0x06, 0x5C, 0xE8, 0xB6 } \
25   }
26 
27 #define EFI_ADAPTER_INFO_NETWORK_BOOT_GUID \
28   { \
29     0x1FBD2960, 0x4130, 0x41E5, {0x94, 0xAC, 0xD2, 0xCF, 0x03, 0x7F, 0xB3, 0x7C } \
30   }
31 
32 #define EFI_ADAPTER_INFO_SAN_MAC_ADDRESS_GUID \
33   { \
34     0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 } \
35   }
36 
37 #define EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT_GUID \
38   { \
39     0x4bd56be3, 0x4975, 0x4d8a, {0xa0, 0xad, 0xc4, 0x91, 0x20, 0x4b, 0x5d, 0x4d} \
40   }
41 
42 #define EFI_ADAPTER_INFO_MEDIA_TYPE_GUID \
43   { \
44     0x8484472f, 0x71ec, 0x411a, { 0xb3, 0x9c, 0x62, 0xcd, 0x94, 0xd9, 0x91, 0x6e } \
45   }
46 
47 typedef struct _EFI_ADAPTER_INFORMATION_PROTOCOL EFI_ADAPTER_INFORMATION_PROTOCOL;
48 
49 ///
50 /// EFI_ADAPTER_INFO_MEDIA_STATE
51 ///
52 typedef struct {
53   ///
54   /// Returns the current media state status. MediaState can have any of the following values:
55   /// EFI_SUCCESS: There is media attached to the network adapter. EFI_NOT_READY: This detects a bounced state.
56   /// There was media attached to the network adapter, but it was removed and reattached. EFI_NO_MEDIA: There is
57   /// not any media attached to the network.
58   ///
59   EFI_STATUS    MediaState;
60 } EFI_ADAPTER_INFO_MEDIA_STATE;
61 
62 ///
63 /// EFI_ADAPTER_INFO_MEDIA_TYPE
64 ///
65 typedef struct {
66   ///
67   /// Indicates the current media type. MediaType can have any of the following values:
68   /// 1: Ethernet Network Adapter
69   /// 2: Ethernet Wireless Network Adapter
70   /// 3~255: Reserved
71   ///
72   UINT8    MediaType;
73 } EFI_ADAPTER_INFO_MEDIA_TYPE;
74 
75 ///
76 /// EFI_ADAPTER_INFO_NETWORK_BOOT
77 ///
78 typedef struct {
79   ///
80   /// TRUE if the adapter supports booting from iSCSI IPv4 targets.
81   ///
82   BOOLEAN    iScsiIpv4BootCapablity;
83   ///
84   /// TRUE if the adapter supports booting from iSCSI IPv6 targets.
85   ///
86   BOOLEAN    iScsiIpv6BootCapablity;
87   ///
88   /// TRUE if the adapter supports booting from FCoE targets.
89   ///
90   BOOLEAN    FCoeBootCapablity;
91   ///
92   /// TRUE if the adapter supports an offload engine (such as TCP
93   /// Offload Engine (TOE)) for its iSCSI or FCoE boot operations.
94   ///
95   BOOLEAN    OffloadCapability;
96   ///
97   /// TRUE if the adapter supports multipath I/O (MPIO) for its iSCSI
98   /// boot operations.
99   ///
100   BOOLEAN    iScsiMpioCapability;
101   ///
102   /// TRUE if the adapter is currently configured to boot from iSCSI
103   /// IPv4 targets.
104   ///
105   BOOLEAN    iScsiIpv4Boot;
106   ///
107   /// TRUE if the adapter is currently configured to boot from iSCSI
108   /// IPv6 targets.
109   ///
110   BOOLEAN    iScsiIpv6Boot;
111   ///
112   /// TRUE if the adapter is currently configured to boot from FCoE targets.
113   ///
114   BOOLEAN    FCoeBoot;
115 } EFI_ADAPTER_INFO_NETWORK_BOOT;
116 
117 ///
118 /// EFI_ADAPTER_INFO_SAN_MAC_ADDRESS
119 ///
120 typedef struct {
121   ///
122   /// Returns the SAN MAC address for the adapter.For adapters that support today's 802.3 ethernet
123   /// networking and Fibre-Channel Over Ethernet (FCOE), this conveys the FCOE SAN MAC address from the adapter.
124   ///
125   EFI_MAC_ADDRESS    SanMacAddress;
126 } EFI_ADAPTER_INFO_SAN_MAC_ADDRESS;
127 
128 ///
129 /// EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT
130 ///
131 typedef struct {
132   ///
133   /// Returns capability of UNDI to support IPv6 traffic.
134   ///
135   BOOLEAN    Ipv6Support;
136 } EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT;
137 
138 /**
139   Returns the current state information for the adapter.
140 
141   This function returns information of type InformationType from the adapter.
142   If an adapter does not support the requested informational type, then
143   EFI_UNSUPPORTED is returned.
144 
145   @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.
146   @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.
147   @param[out] InforamtionBlock       The service returns a pointer to the buffer with the InformationBlock
148                                      structure which contains details about the data specific to InformationType.
149   @param[out] InforamtionBlockSize   The driver returns the size of the InformationBlock in bytes.
150 
151   @retval EFI_SUCCESS                The InformationType information was retrieved.
152   @retval EFI_UNSUPPORTED            The InformationType is not known.
153   @retval EFI_DEVICE_ERROR           The device reported an error.
154   @retval EFI_OUT_OF_RESOURCES       The request could not be completed due to a lack of resources.
155   @retval EFI_INVALID_PARAMETER      This is NULL.
156   @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.
157   @retval EFI_INVALID_PARAMETER      InformationBlockSize is NULL.
158 
159 **/
160 typedef
161 EFI_STATUS
162 (EFIAPI *EFI_ADAPTER_INFO_GET_INFO)(
163   IN  EFI_ADAPTER_INFORMATION_PROTOCOL  *This,
164   IN  EFI_GUID                          *InformationType,
165   OUT VOID                              **InformationBlock,
166   OUT UINTN                             *InformationBlockSize
167   );
168 
169 /**
170   Sets state information for an adapter.
171 
172   This function sends information of type InformationType for an adapter.
173   If an adapter does not support the requested information type, then EFI_UNSUPPORTED
174   is returned.
175 
176   @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.
177   @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.
178   @param[in]  InforamtionBlock       A pointer to the InformationBlock structure which contains details
179                                      about the data specific to InformationType.
180   @param[in]  InforamtionBlockSize   The size of the InformationBlock in bytes.
181 
182   @retval EFI_SUCCESS                The information was received and interpreted successfully.
183   @retval EFI_UNSUPPORTED            The InformationType is not known.
184   @retval EFI_DEVICE_ERROR           The device reported an error.
185   @retval EFI_INVALID_PARAMETER      This is NULL.
186   @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.
187   @retval EFI_WRITE_PROTECTED        The InformationType cannot be modified using EFI_ADAPTER_INFO_SET_INFO().
188 
189 **/
190 typedef
191 EFI_STATUS
192 (EFIAPI *EFI_ADAPTER_INFO_SET_INFO)(
193   IN  EFI_ADAPTER_INFORMATION_PROTOCOL  *This,
194   IN  EFI_GUID                          *InformationType,
195   IN  VOID                              *InformationBlock,
196   IN  UINTN                             InformationBlockSize
197   );
198 
199 /**
200   Get a list of supported information types for this instance of the protocol.
201 
202   This function returns a list of InformationType GUIDs that are supported on an
203   adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned
204   in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in
205   InfoTypesBufferCount.
206 
207   @param[in]  This                  A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.
208   @param[out] InfoTypesBuffer       A pointer to the array of InformationType GUIDs that are supported
209                                     by This.
210   @param[out] InfoTypesBufferCount  A pointer to the number of GUIDs present in InfoTypesBuffer.
211 
212   @retval EFI_SUCCESS               The list of information type GUIDs that are supported on this adapter was
213                                     returned in InfoTypesBuffer. The number of information type GUIDs was
214                                     returned in InfoTypesBufferCount.
215   @retval EFI_INVALID_PARAMETER     This is NULL.
216   @retval EFI_INVALID_PARAMETER     InfoTypesBuffer is NULL.
217   @retval EFI_INVALID_PARAMETER     InfoTypesBufferCount is NULL.
218   @retval EFI_OUT_OF_RESOURCES      There is not enough pool memory to store the results.
219 
220 **/
221 typedef
222 EFI_STATUS
223 (EFIAPI *EFI_ADAPTER_INFO_GET_SUPPORTED_TYPES)(
224   IN  EFI_ADAPTER_INFORMATION_PROTOCOL  *This,
225   OUT EFI_GUID                          **InfoTypesBuffer,
226   OUT UINTN                             *InfoTypesBufferCount
227   );
228 
229 ///
230 /// EFI_ADAPTER_INFORMATION_PROTOCOL
231 /// The protocol for adapter provides the following services.
232 /// - Gets device state information from adapter.
233 /// - Sets device information for adapter.
234 /// - Gets a list of supported information types for this instance of the protocol.
235 ///
236 struct _EFI_ADAPTER_INFORMATION_PROTOCOL {
237   EFI_ADAPTER_INFO_GET_INFO               GetInformation;
238   EFI_ADAPTER_INFO_SET_INFO               SetInformation;
239   EFI_ADAPTER_INFO_GET_SUPPORTED_TYPES    GetSupportedTypes;
240 };
241 
242 extern EFI_GUID  gEfiAdapterInformationProtocolGuid;
243 
244 extern EFI_GUID  gEfiAdapterInfoMediaStateGuid;
245 
246 extern EFI_GUID  gEfiAdapterInfoNetworkBootGuid;
247 
248 extern EFI_GUID  gEfiAdapterInfoSanMacAddressGuid;
249 
250 extern EFI_GUID  gEfiAdapterInfoUndiIpv6SupportGuid;
251 
252 #endif
253