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