]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Add various well-known GUIDs encountered in WiFi boot
authorMichael Brown <mcb30@ipxe.org>
Fri, 28 Mar 2025 21:01:42 +0000 (21:01 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 28 Mar 2025 21:01:42 +0000 (21:01 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/efi/Protocol/AdapterInformation.h [new file with mode: 0644]
src/include/ipxe/efi/Protocol/EapConfiguration.h [new file with mode: 0644]
src/include/ipxe/efi/Protocol/Supplicant.h [new file with mode: 0644]
src/include/ipxe/efi/Protocol/WiFi2.h [new file with mode: 0644]
src/include/ipxe/efi/efi.h
src/interface/efi/efi_guid.c

diff --git a/src/include/ipxe/efi/Protocol/AdapterInformation.h b/src/include/ipxe/efi/Protocol/AdapterInformation.h
new file mode 100644 (file)
index 0000000..ca79407
--- /dev/null
@@ -0,0 +1,257 @@
+/** @file
+  EFI Adapter Information Protocol definition.
+  The EFI Adapter Information Protocol is used to dynamically and quickly discover
+  or set device information for an adapter.
+
+  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.4
+
+**/
+
+#ifndef __EFI_ADAPTER_INFORMATION_PROTOCOL_H__
+#define __EFI_ADAPTER_INFORMATION_PROTOCOL_H__
+
+FILE_LICENCE ( BSD2_PATENT );
+
+#define EFI_ADAPTER_INFORMATION_PROTOCOL_GUID \
+  { \
+    0xE5DD1403, 0xD622, 0xC24E, {0x84, 0x88, 0xC7, 0x1B, 0x17, 0xF5, 0xE8, 0x02 } \
+  }
+
+#define EFI_ADAPTER_INFO_MEDIA_STATE_GUID \
+  { \
+    0xD7C74207, 0xA831, 0x4A26, {0xB1, 0xF5, 0xD1, 0x93, 0x06, 0x5C, 0xE8, 0xB6 } \
+  }
+
+#define EFI_ADAPTER_INFO_NETWORK_BOOT_GUID \
+  { \
+    0x1FBD2960, 0x4130, 0x41E5, {0x94, 0xAC, 0xD2, 0xCF, 0x03, 0x7F, 0xB3, 0x7C } \
+  }
+
+#define EFI_ADAPTER_INFO_SAN_MAC_ADDRESS_GUID \
+  { \
+    0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 } \
+  }
+
+#define EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT_GUID \
+  { \
+    0x4bd56be3, 0x4975, 0x4d8a, {0xa0, 0xad, 0xc4, 0x91, 0x20, 0x4b, 0x5d, 0x4d} \
+  }
+
+#define EFI_ADAPTER_INFO_MEDIA_TYPE_GUID \
+  { \
+    0x8484472f, 0x71ec, 0x411a, { 0xb3, 0x9c, 0x62, 0xcd, 0x94, 0xd9, 0x91, 0x6e } \
+  }
+
+typedef struct _EFI_ADAPTER_INFORMATION_PROTOCOL EFI_ADAPTER_INFORMATION_PROTOCOL;
+
+///
+/// EFI_ADAPTER_INFO_MEDIA_STATE
+///
+typedef struct {
+  ///
+  /// Returns the current media state status. MediaState can have any of the following values:
+  /// EFI_SUCCESS: There is media attached to the network adapter. EFI_NOT_READY: This detects a bounced state.
+  /// There was media attached to the network adapter, but it was removed and reattached. EFI_NO_MEDIA: There is
+  /// not any media attached to the network.
+  ///
+  EFI_STATUS    MediaState;
+} EFI_ADAPTER_INFO_MEDIA_STATE;
+
+///
+/// EFI_ADAPTER_INFO_MEDIA_TYPE
+///
+typedef struct {
+  ///
+  /// Indicates the current media type. MediaType can have any of the following values:
+  /// 1: Ethernet Network Adapter
+  /// 2: Ethernet Wireless Network Adapter
+  /// 3~255: Reserved
+  ///
+  UINT8    MediaType;
+} EFI_ADAPTER_INFO_MEDIA_TYPE;
+
+///
+/// EFI_ADAPTER_INFO_NETWORK_BOOT
+///
+typedef struct {
+  ///
+  /// TRUE if the adapter supports booting from iSCSI IPv4 targets.
+  ///
+  BOOLEAN    iScsiIpv4BootCapablity;
+  ///
+  /// TRUE if the adapter supports booting from iSCSI IPv6 targets.
+  ///
+  BOOLEAN    iScsiIpv6BootCapablity;
+  ///
+  /// TRUE if the adapter supports booting from FCoE targets.
+  ///
+  BOOLEAN    FCoeBootCapablity;
+  ///
+  /// TRUE if the adapter supports an offload engine (such as TCP
+  /// Offload Engine (TOE)) for its iSCSI or FCoE boot operations.
+  ///
+  BOOLEAN    OffloadCapability;
+  ///
+  /// TRUE if the adapter supports multipath I/O (MPIO) for its iSCSI
+  /// boot operations.
+  ///
+  BOOLEAN    iScsiMpioCapability;
+  ///
+  /// TRUE if the adapter is currently configured to boot from iSCSI
+  /// IPv4 targets.
+  ///
+  BOOLEAN    iScsiIpv4Boot;
+  ///
+  /// TRUE if the adapter is currently configured to boot from iSCSI
+  /// IPv6 targets.
+  ///
+  BOOLEAN    iScsiIpv6Boot;
+  ///
+  /// TRUE if the adapter is currently configured to boot from FCoE targets.
+  ///
+  BOOLEAN    FCoeBoot;
+} EFI_ADAPTER_INFO_NETWORK_BOOT;
+
+///
+/// EFI_ADAPTER_INFO_SAN_MAC_ADDRESS
+///
+typedef struct {
+  ///
+  /// Returns the SAN MAC address for the adapter.For adapters that support today's 802.3 ethernet
+  /// networking and Fibre-Channel Over Ethernet (FCOE), this conveys the FCOE SAN MAC address from the adapter.
+  ///
+  EFI_MAC_ADDRESS    SanMacAddress;
+} EFI_ADAPTER_INFO_SAN_MAC_ADDRESS;
+
+///
+/// EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT
+///
+typedef struct {
+  ///
+  /// Returns capability of UNDI to support IPv6 traffic.
+  ///
+  BOOLEAN    Ipv6Support;
+} EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT;
+
+/**
+  Returns the current state information for the adapter.
+
+  This function returns information of type InformationType from the adapter.
+  If an adapter does not support the requested informational type, then
+  EFI_UNSUPPORTED is returned. If an adapter does not contain Information for
+  the requested InformationType, it fills InformationBlockSize with 0 and
+  returns EFI_NOT_FOUND.
+
+  @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.
+  @param[out] InforamtionBlock       The service returns a pointer to the buffer with the InformationBlock
+                                     structure which contains details about the data specific to InformationType.
+  @param[out] InforamtionBlockSize   The driver returns the size of the InformationBlock in bytes.
+
+  @retval EFI_SUCCESS                The InformationType information was retrieved.
+  @retval EFI_UNSUPPORTED            The InformationType is not known.
+  @retval EFI_NOT_FOUND              Information is not available for the requested information type.
+  @retval EFI_DEVICE_ERROR           The device reported an error.
+  @retval EFI_OUT_OF_RESOURCES       The request could not be completed due to a lack of resources.
+  @retval EFI_INVALID_PARAMETER      This is NULL.
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.
+  @retval EFI_INVALID_PARAMETER      InformationBlockSize is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ADAPTER_INFO_GET_INFO)(
+  IN  EFI_ADAPTER_INFORMATION_PROTOCOL  *This,
+  IN  EFI_GUID                          *InformationType,
+  OUT VOID                              **InformationBlock,
+  OUT UINTN                             *InformationBlockSize
+  );
+
+/**
+  Sets state information for an adapter.
+
+  This function sends information of type InformationType for an adapter.
+  If an adapter does not support the requested information type, then EFI_UNSUPPORTED
+  is returned.
+
+  @param[in]  This                   A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[in]  InformationType        A pointer to an EFI_GUID that defines the contents of InformationBlock.
+  @param[in]  InforamtionBlock       A pointer to the InformationBlock structure which contains details
+                                     about the data specific to InformationType.
+  @param[in]  InforamtionBlockSize   The size of the InformationBlock in bytes.
+
+  @retval EFI_SUCCESS                The information was received and interpreted successfully.
+  @retval EFI_UNSUPPORTED            The InformationType is not known.
+  @retval EFI_DEVICE_ERROR           The device reported an error.
+  @retval EFI_INVALID_PARAMETER      This is NULL.
+  @retval EFI_INVALID_PARAMETER      InformationBlock is NULL.
+  @retval EFI_WRITE_PROTECTED        The InformationType cannot be modified using EFI_ADAPTER_INFO_SET_INFO().
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ADAPTER_INFO_SET_INFO)(
+  IN  EFI_ADAPTER_INFORMATION_PROTOCOL  *This,
+  IN  EFI_GUID                          *InformationType,
+  IN  VOID                              *InformationBlock,
+  IN  UINTN                             InformationBlockSize
+  );
+
+/**
+  Get a list of supported information types for this instance of the protocol.
+
+  This function returns a list of InformationType GUIDs that are supported on an
+  adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned
+  in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in
+  InfoTypesBufferCount.
+
+  @param[in]  This                  A pointer to the EFI_ADAPTER_INFORMATION_PROTOCOL instance.
+  @param[out] InfoTypesBuffer       A pointer to the array of InformationType GUIDs that are supported
+                                    by This.
+  @param[out] InfoTypesBufferCount  A pointer to the number of GUIDs present in InfoTypesBuffer.
+
+  @retval EFI_SUCCESS               The list of information type GUIDs that are supported on this adapter was
+                                    returned in InfoTypesBuffer. The number of information type GUIDs was
+                                    returned in InfoTypesBufferCount.
+  @retval EFI_INVALID_PARAMETER     This is NULL.
+  @retval EFI_INVALID_PARAMETER     InfoTypesBuffer is NULL.
+  @retval EFI_INVALID_PARAMETER     InfoTypesBufferCount is NULL.
+  @retval EFI_OUT_OF_RESOURCES      There is not enough pool memory to store the results.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_ADAPTER_INFO_GET_SUPPORTED_TYPES)(
+  IN  EFI_ADAPTER_INFORMATION_PROTOCOL  *This,
+  OUT EFI_GUID                          **InfoTypesBuffer,
+  OUT UINTN                             *InfoTypesBufferCount
+  );
+
+///
+/// EFI_ADAPTER_INFORMATION_PROTOCOL
+/// The protocol for adapter provides the following services.
+/// - Gets device state information from adapter.
+/// - Sets device information for adapter.
+/// - Gets a list of supported information types for this instance of the protocol.
+///
+struct _EFI_ADAPTER_INFORMATION_PROTOCOL {
+  EFI_ADAPTER_INFO_GET_INFO               GetInformation;
+  EFI_ADAPTER_INFO_SET_INFO               SetInformation;
+  EFI_ADAPTER_INFO_GET_SUPPORTED_TYPES    GetSupportedTypes;
+};
+
+extern EFI_GUID  gEfiAdapterInformationProtocolGuid;
+
+extern EFI_GUID  gEfiAdapterInfoMediaStateGuid;
+
+extern EFI_GUID  gEfiAdapterInfoNetworkBootGuid;
+
+extern EFI_GUID  gEfiAdapterInfoSanMacAddressGuid;
+
+extern EFI_GUID  gEfiAdapterInfoUndiIpv6SupportGuid;
+
+#endif
diff --git a/src/include/ipxe/efi/Protocol/EapConfiguration.h b/src/include/ipxe/efi/Protocol/EapConfiguration.h
new file mode 100644 (file)
index 0000000..406e56d
--- /dev/null
@@ -0,0 +1,155 @@
+/** @file
+  This file defines the EFI EAP Configuration protocol.
+
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.5
+
+**/
+
+#ifndef __EFI_EAP_CONFIGURATION_PROTOCOL_H__
+#define __EFI_EAP_CONFIGURATION_PROTOCOL_H__
+
+FILE_LICENCE ( BSD2_PATENT );
+
+///
+/// EFI EAP Configuration protocol provides a way to set and get EAP configuration.
+///
+#define EFI_EAP_CONFIGURATION_PROTOCOL_GUID \
+  { \
+    0xe5b58dbb, 0x7688, 0x44b4, {0x97, 0xbf, 0x5f, 0x1d, 0x4b, 0x7c, 0xc8, 0xdb } \
+  }
+
+typedef struct _EFI_EAP_CONFIGURATION_PROTOCOL EFI_EAP_CONFIGURATION_PROTOCOL;
+
+///
+/// Make sure it not conflict with any real EapTypeXXX
+///
+#define EFI_EAP_TYPE_ATTRIBUTE  0
+
+typedef enum {
+  ///
+  /// EFI_EAP_TYPE_ATTRIBUTE
+  ///
+  EfiEapConfigEapAuthMethod,
+  EfiEapConfigEapSupportedAuthMethod,
+  ///
+  /// EapTypeIdentity
+  ///
+  EfiEapConfigIdentityString,
+  ///
+  /// EapTypeEAPTLS/EapTypePEAP
+  ///
+  EfiEapConfigEapTlsCACert,
+  EfiEapConfigEapTlsClientCert,
+  EfiEapConfigEapTlsClientPrivateKeyFile,
+  EfiEapConfigEapTlsClientPrivateKeyFilePassword, // ASCII format, Volatile
+  EfiEapConfigEapTlsCipherSuite,
+  EfiEapConfigEapTlsSupportedCipherSuite,
+  ///
+  /// EapTypeMSChapV2
+  ///
+  EfiEapConfigEapMSChapV2Password, // UNICODE format, Volatile
+  ///
+  /// EapTypePEAP
+  ///
+  EfiEapConfigEap2ndAuthMethod,
+  ///
+  /// More...
+  ///
+} EFI_EAP_CONFIG_DATA_TYPE;
+
+///
+/// EFI_EAP_TYPE
+///
+typedef UINT8 EFI_EAP_TYPE;
+#define EFI_EAP_TYPE_ATTRIBUTE      0
+#define EFI_EAP_TYPE_IDENTITY       1
+#define EFI_EAP_TYPE_NOTIFICATION   2
+#define EFI_EAP_TYPE_NAK            3
+#define EFI_EAP_TYPE_MD5CHALLENGE   4
+#define EFI_EAP_TYPE_OTP            5
+#define EFI_EAP_TYPE_GTC            6
+#define EFI_EAP_TYPE_EAPTLS         13
+#define EFI_EAP_TYPE_EAPSIM         18
+#define EFI_EAP_TYPE_TTLS           21
+#define EFI_EAP_TYPE_PEAP           25
+#define EFI_EAP_TYPE_MSCHAPV2       26
+#define EFI_EAP_TYPE_EAP_EXTENSION  33
+
+/**
+  Set EAP configuration data.
+
+  The SetData() function sets EAP configuration to non-volatile storage or volatile
+  storage.
+
+  @param[in]  This                Pointer to the EFI_EAP_CONFIGURATION_PROTOCOL instance.
+  @param[in]  EapType             EAP type.
+  @param[in]  DataType            Configuration data type.
+  @param[in]  Data                Pointer to configuration data.
+  @param[in]  DataSize            Total size of configuration data.
+
+  @retval EFI_SUCCESS             The EAP configuration data is set successfully.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
+                                  Data is NULL.
+                                  DataSize is 0.
+  @retval EFI_UNSUPPORTED         The EapType or DataType is unsupported.
+  @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_EAP_CONFIGURATION_SET_DATA)(
+  IN EFI_EAP_CONFIGURATION_PROTOCOL       *This,
+  IN EFI_EAP_TYPE                         EapType,
+  IN EFI_EAP_CONFIG_DATA_TYPE             DataType,
+  IN VOID                                 *Data,
+  IN UINTN                                DataSize
+  );
+
+/**
+  Get EAP configuration data.
+
+  The GetData() function gets EAP configuration.
+
+  @param[in]       This           Pointer to the EFI_EAP_CONFIGURATION_PROTOCOL instance.
+  @param[in]       EapType        EAP type.
+  @param[in]       DataType       Configuration data type.
+  @param[in, out]  Data           Pointer to configuration data.
+  @param[in, out]  DataSize       Total size of configuration data. On input, it means
+                                  the size of Data buffer. On output, it means the size
+                                  of copied Data buffer if EFI_SUCCESS, and means the
+                                  size of desired Data buffer if EFI_BUFFER_TOO_SMALL.
+
+  @retval EFI_SUCCESS             The EAP configuration data is got successfully.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is TRUE:
+                                  Data is NULL.
+                                  DataSize is NULL.
+  @retval EFI_UNSUPPORTED         The EapType or DataType is unsupported.
+  @retval EFI_NOT_FOUND           The EAP configuration data is not found.
+  @retval EFI_BUFFER_TOO_SMALL    The buffer is too small to hold the buffer.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_EAP_CONFIGURATION_GET_DATA)(
+  IN EFI_EAP_CONFIGURATION_PROTOCOL       *This,
+  IN EFI_EAP_TYPE                         EapType,
+  IN EFI_EAP_CONFIG_DATA_TYPE             DataType,
+  IN OUT VOID                             *Data,
+  IN OUT UINTN                            *DataSize
+  );
+
+///
+/// The EFI_EAP_CONFIGURATION_PROTOCOL
+/// is designed to provide a way to set and get EAP configuration, such as Certificate,
+/// private key file.
+///
+struct _EFI_EAP_CONFIGURATION_PROTOCOL {
+  EFI_EAP_CONFIGURATION_SET_DATA    SetData;
+  EFI_EAP_CONFIGURATION_GET_DATA    GetData;
+};
+
+extern EFI_GUID  gEfiEapConfigurationProtocolGuid;
+
+#endif
diff --git a/src/include/ipxe/efi/Protocol/Supplicant.h b/src/include/ipxe/efi/Protocol/Supplicant.h
new file mode 100644 (file)
index 0000000..8b3d753
--- /dev/null
@@ -0,0 +1,460 @@
+/** @file
+  This file defines the EFI Supplicant Protocol.
+
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.6
+
+**/
+
+#ifndef __EFI_SUPPLICANT_PROTOCOL_H__
+#define __EFI_SUPPLICANT_PROTOCOL_H__
+
+FILE_LICENCE ( BSD2_PATENT );
+
+#include <ipxe/efi/Protocol/WiFi2.h>
+
+///
+/// The EFI Supplicant Service Binding Protocol is used to locate EFI
+/// Supplicant Protocol drivers to create and destroy child of the driver to
+/// communicate with other host using Supplicant protocol.
+///
+#define EFI_SUPPLICANT_SERVICE_BINDING_PROTOCOL_GUID \
+  { \
+    0x45bcd98e, 0x59ad, 0x4174, { 0x95, 0x46, 0x34, 0x4a, 0x7, 0x48, 0x58, 0x98 } \
+  }
+
+///
+/// The EFI Supplicant protocol provides services to process authentication and
+/// data encryption/decryption for security management.
+///
+#define EFI_SUPPLICANT_PROTOCOL_GUID \
+  { \
+    0x54fcc43e, 0xaa89, 0x4333, { 0x9a, 0x85, 0xcd, 0xea, 0x24, 0x5, 0x1e, 0x9e } \
+  }
+
+typedef struct _EFI_SUPPLICANT_PROTOCOL EFI_SUPPLICANT_PROTOCOL;
+
+///
+/// EFI_SUPPLICANT_CRYPT_MODE
+///
+typedef enum {
+  //
+  // Encrypt data provided in the fragment buffers.
+  //
+  EfiSupplicantEncrypt,
+  //
+  // Decrypt data provided in the fragment buffers.
+  //
+  EfiSupplicantDecrypt,
+} EFI_SUPPLICANT_CRYPT_MODE;
+
+///
+/// EFI_SUPPLICANT_DATA_TYPE
+///
+typedef enum {
+  //
+  // Session Configuration
+  //
+
+  //
+  // Current authentication type in use. The corresponding Data is of type
+  // EFI_80211_AKM_SUITE_SELECTOR.
+  //
+  EfiSupplicant80211AKMSuite,
+  //
+  // Group data encryption type in use. The corresponding Data is of type
+  // EFI_SUPPLICANT_CIPHER_SUITE_SELECTOR.
+  //
+  EfiSupplicant80211GroupDataCipherSuite,
+  //
+  // Pairwise encryption type in use. The corresponding Data is of type
+  // EFI_80211_CIPHER_SUITE_SELECTOR.
+  //
+  EfiSupplicant80211PairwiseCipherSuite,
+  //
+  // PSK password. The corresponding Data is a NULL-terminated ASCII string.
+  //
+  EfiSupplicant80211PskPassword,
+  //
+  // Target SSID name. The corresponding Data is of type EFI_80211_SSID.
+  //
+  EfiSupplicant80211TargetSSIDName,
+  //
+  // Station MAC address. The corresponding Data is of type
+  // EFI_80211_MAC_ADDRESS.
+  //
+  EfiSupplicant80211StationMac,
+  //
+  // Target SSID MAC address. The corresponding Data is 6 bytes MAC address.
+  //
+  EfiSupplicant80211TargetSSIDMac,
+
+  //
+  // Session Information
+  //
+
+  //
+  // 802.11 PTK. The corresponding Data is of type EFI_SUPPLICANT_KEY.
+  //
+  EfiSupplicant80211PTK,
+  //
+  // 802.11 GTK. The corresponding Data is of type EFI_SUPPLICANT_GTK_LIST.
+  //
+  EfiSupplicant80211GTK,
+  //
+  // Supplicant state. The corresponding Data is
+  // EFI_EAPOL_SUPPLICANT_PAE_STATE.
+  //
+  EfiSupplicantState,
+  //
+  // 802.11 link state. The corresponding Data is EFI_80211_LINK_STATE.
+  //
+  EfiSupplicant80211LinkState,
+  //
+  // Flag indicates key is refreshed. The corresponding Data is
+  // EFI_SUPPLICANT_KEY_REFRESH.
+  //
+  EfiSupplicantKeyRefresh,
+
+  //
+  // Session Configuration
+  //
+
+  //
+  // Supported authentication types. The corresponding Data is of type
+  // EFI_80211_AKM_SUITE_SELECTOR.
+  //
+  EfiSupplicant80211SupportedAKMSuites,
+  //
+  // Supported software encryption types provided by supplicant driver. The
+  // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.
+  //
+  EfiSupplicant80211SupportedSoftwareCipherSuites,
+  //
+  // Supported hardware encryption types provided by wireless UNDI driver. The
+  // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.
+  //
+  EfiSupplicant80211SupportedHardwareCipherSuites,
+
+  //
+  // Session Information
+  //
+
+  //
+  // 802.11 Integrity GTK. The corresponding Data is of type
+  // EFI_SUPPLICANT_GTK_LIST.
+  //
+  EfiSupplicant80211IGTK,
+  //
+  // 802.11 PMK. The corresponding Data is 32 bytes pairwise master key.
+  //
+  EfiSupplicant80211PMK,
+  EfiSupplicantDataTypeMaximum
+} EFI_SUPPLICANT_DATA_TYPE;
+
+///
+/// EFI_80211_LINK_STATE
+///
+typedef enum {
+  //
+  // Indicates initial start state, unauthenticated, unassociated.
+  //
+  Ieee80211UnauthenticatedUnassociated,
+  //
+  // Indicates authenticated, unassociated.
+  //
+  Ieee80211AuthenticatedUnassociated,
+  //
+  // Indicates authenticated and associated, but pending RSN authentication.
+  //
+  Ieee80211PendingRSNAuthentication,
+  //
+  // Indicates authenticated and associated.
+  //
+  Ieee80211AuthenticatedAssociated
+} EFI_80211_LINK_STATE;
+
+///
+/// EFI_SUPPLICANT_KEY_TYPE (IEEE Std 802.11 Section 6.3.19.1.2)
+///
+typedef enum {
+  Group,
+  Pairwise,
+  PeerKey,
+  IGTK
+} EFI_SUPPLICANT_KEY_TYPE;
+
+///
+/// EFI_SUPPLICANT_KEY_DIRECTION (IEEE Std 802.11 Section 6.3.19.1.2)
+///
+typedef enum {
+  //
+  // Indicates that the keys are being installed for the receive direction.
+  //
+  Receive,
+  //
+  // Indicates that the keys are being installed for the transmit direction.
+  //
+  Transmit,
+  //
+  // Indicates that the keys are being installed for both the receive and
+  // transmit directions.
+  //
+  Both
+} EFI_SUPPLICANT_KEY_DIRECTION;
+
+///
+/// EFI_SUPPLICANT_KEY_REFRESH
+///
+typedef struct {
+  //
+  // If TRUE, indicates GTK is just refreshed after a successful call to
+  // EFI_SUPPLICANT_PROTOCOL.BuildResponsePacket().
+  //
+  BOOLEAN    GTKRefresh;
+} EFI_SUPPLICANT_KEY_REFRESH;
+
+#define EFI_MAX_KEY_LEN  64
+
+///
+/// EFI_SUPPLICANT_KEY
+///
+typedef struct {
+  //
+  // The key value.
+  //
+  UINT8                           Key[EFI_MAX_KEY_LEN];
+  //
+  // Length in bytes of the Key. Should be up to EFI_MAX_KEY_LEN.
+  //
+  UINT8                           KeyLen;
+  //
+  // The key identifier.
+  //
+  UINT8                           KeyId;
+  //
+  // Defines whether this key is a group key, pairwise key, PeerKey, or
+  // Integrity Group.
+  //
+  EFI_SUPPLICANT_KEY_TYPE         KeyType;
+  //
+  // The value is set according to the KeyType.
+  //
+  EFI_80211_MAC_ADDRESS           Addr;
+  //
+  // The Receive Sequence Count value.
+  //
+  UINT8                           Rsc[8];
+  //
+  // Length in bytes of the Rsc. Should be up to 8.
+  //
+  UINT8                           RscLen;
+  //
+  // Indicates whether the key is configured by the Authenticator or
+  // Supplicant. The value true indicates Authenticator.
+  //
+  BOOLEAN                         IsAuthenticator;
+  //
+  // The cipher suite required for this association.
+  //
+  EFI_80211_SUITE_SELECTOR        CipherSuite;
+  //
+  // Indicates the direction for which the keys are to be installed.
+  //
+  EFI_SUPPLICANT_KEY_DIRECTION    Direction;
+} EFI_SUPPLICANT_KEY;
+
+///
+/// EFI_SUPPLICANT_GTK_LIST
+///
+typedef struct {
+  //
+  // Indicates the number of GTKs that are contained in GTKList.
+  //
+  UINT8                 GTKCount;
+  //
+  // A variable-length array of GTKs of type EFI_SUPPLICANT_KEY. The number of
+  // entries is specified by GTKCount.
+  //
+  EFI_SUPPLICANT_KEY    GTKList[1];
+} EFI_SUPPLICANT_GTK_LIST;
+
+///
+/// EFI_SUPPLICANT_FRAGMENT_DATA
+///
+typedef struct {
+  //
+  // Length of data buffer in the fragment.
+  //
+  UINT32    FragmentLength;
+  //
+  // Pointer to the data buffer in the fragment.
+  //
+  VOID      *FragmentBuffer;
+} EFI_SUPPLICANT_FRAGMENT_DATA;
+
+/**
+  BuildResponsePacket() is called during STA and AP authentication is in
+  progress. Supplicant derives the PTK or session keys depend on type of
+  authentication is being employed.
+
+  @param[in]       This           Pointer to the EFI_SUPPLICANT_PROTOCOL
+                                  instance.
+  @param[in]       RequestBuffer  Pointer to the most recently received EAPOL
+                                  packet. NULL means the supplicant need
+                                  initiate the EAP authentication session and
+                                  send EAPOL-Start message.
+  @param[in]       RequestBufferSize
+                                  Packet size in bytes for the most recently
+                                  received EAPOL packet. 0 is only valid when
+                                  RequestBuffer is NULL.
+  @param[out]      Buffer         Pointer to the buffer to hold the built
+                                  packet.
+  @param[in, out]  BufferSize     Pointer to the buffer size in bytes. On
+                                  input, it is the buffer size provided by the
+                                  caller. On output, it is the buffer size in
+                                  fact needed to contain the packet.
+
+  @retval EFI_SUCCESS             The required EAPOL packet is built
+                                  successfully.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is
+                                  TRUE:
+                                  RequestBuffer is NULL, but RequestSize is
+                                  NOT 0.
+                                  RequestBufferSize is 0.
+                                  Buffer is NULL, but RequestBuffer is NOT 0.
+                                  BufferSize is NULL.
+  @retval EFI_BUFFER_TOO_SMALL    BufferSize is too small to hold the response
+                                  packet.
+  @retval EFI_NOT_READY           Current EAPOL session state is NOT ready to
+                                  build ResponsePacket.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SUPPLICANT_BUILD_RESPONSE_PACKET)(
+  IN     EFI_SUPPLICANT_PROTOCOL          *This,
+  IN     UINT8                            *RequestBuffer      OPTIONAL,
+  IN     UINTN                            RequestBufferSize   OPTIONAL,
+  OUT UINT8                            *Buffer,
+  IN OUT UINTN                            *BufferSize
+  );
+
+/**
+  ProcessPacket() is called to Supplicant driver to encrypt or decrypt the data
+  depending type of authentication type.
+
+  @param[in]       This           Pointer to the EFI_SUPPLICANT_PROTOCOL
+                                  instance.
+  @param[in, out]  FragmentTable  Pointer to a list of fragment. The caller
+                                  will take responsible to handle the original
+                                  FragmentTable while it may be reallocated in
+                                  Supplicant driver.
+  @param[in]       FragmentCount  Number of fragment.
+  @param[in]       CryptMode      Crypt mode.
+
+  @retval EFI_SUCCESS             The operation completed successfully.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is
+                                  TRUE:
+                                  FragmentTable is NULL.
+                                  FragmentCount is NULL.
+                                  CryptMode is invalid.
+  @retval EFI_NOT_READY           Current supplicant state is NOT Authenticated.
+  @retval EFI_ABORTED             Something wrong decryption the message.
+  @retval EFI_UNSUPPORTED         This API is not supported.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SUPPLICANT_PROCESS_PACKET)(
+  IN     EFI_SUPPLICANT_PROTOCOL          *This,
+  IN OUT EFI_SUPPLICANT_FRAGMENT_DATA     **FragmentTable,
+  IN     UINT32                           *FragmentCount,
+  IN     EFI_SUPPLICANT_CRYPT_MODE        CryptMode
+  );
+
+/**
+  Set Supplicant configuration data.
+
+  @param[in]  This                Pointer to the EFI_SUPPLICANT_PROTOCOL
+                                  instance.
+  @param[in]  DataType            The type of data.
+  @param[in]  Data                Pointer to the buffer to hold the data.
+  @param[in]  DataSize            Pointer to the buffer size in bytes.
+
+  @retval EFI_SUCCESS             The Supplicant configuration data is set
+                                  successfully.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is
+                                  TRUE:
+                                  Data is NULL.
+                                  DataSize is 0.
+  @retval EFI_UNSUPPORTED         The DataType is unsupported.
+  @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SUPPLICANT_SET_DATA)(
+  IN EFI_SUPPLICANT_PROTOCOL              *This,
+  IN EFI_SUPPLICANT_DATA_TYPE             DataType,
+  IN VOID                                 *Data,
+  IN UINTN                                DataSize
+  );
+
+/**
+  Get Supplicant configuration data.
+
+  @param[in]       This           Pointer to the EFI_SUPPLICANT_PROTOCOL
+                                  instance.
+  @param[in]       DataType       The type of data.
+  @param[out]      Data           Pointer to the buffer to hold the data.
+                                  Ignored if DataSize is 0.
+  @param[in, out]  DataSize       Pointer to the buffer size in bytes. On
+                                  input, it is the buffer size provided by the
+                                  caller. On output, it is the buffer size in
+                                  fact needed to contain the packet.
+
+  @retval EFI_SUCCESS             The Supplicant configuration data is got
+                                  successfully.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is
+                                  TRUE:
+                                  This is NULL.
+                                  DataSize is NULL.
+                                  Data is NULL if *DataSize is not zero.
+  @retval EFI_UNSUPPORTED         The DataType is unsupported.
+  @retval EFI_NOT_FOUND           The Supplicant configuration data is not
+                                  found.
+  @retval EFI_BUFFER_TOO_SMALL    The size of Data is too small for the
+                                  specified configuration data and the required
+                                  size is returned in DataSize.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SUPPLICANT_GET_DATA)(
+  IN     EFI_SUPPLICANT_PROTOCOL          *This,
+  IN     EFI_SUPPLICANT_DATA_TYPE         DataType,
+  OUT UINT8                            *Data      OPTIONAL,
+  IN OUT UINTN                            *DataSize
+  );
+
+///
+/// The EFI_SUPPLICANT_PROTOCOL is designed to provide unified place for WIFI
+/// and EAP security management. Both PSK authentication and 802.1X EAP
+/// authentication can be managed via this protocol and driver or application
+/// as a consumer can only focus on about packet transmitting or receiving.
+///
+struct _EFI_SUPPLICANT_PROTOCOL {
+  EFI_SUPPLICANT_BUILD_RESPONSE_PACKET    BuildResponsePacket;
+  EFI_SUPPLICANT_PROCESS_PACKET           ProcessPacket;
+  EFI_SUPPLICANT_SET_DATA                 SetData;
+  EFI_SUPPLICANT_GET_DATA                 GetData;
+};
+
+extern EFI_GUID  gEfiSupplicantServiceBindingProtocolGuid;
+extern EFI_GUID  gEfiSupplicantProtocolGuid;
+
+#endif
diff --git a/src/include/ipxe/efi/Protocol/WiFi2.h b/src/include/ipxe/efi/Protocol/WiFi2.h
new file mode 100644 (file)
index 0000000..1d9bc5f
--- /dev/null
@@ -0,0 +1,409 @@
+/** @file
+  This file defines the EFI Wireless MAC Connection II Protocol.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Revision Reference:
+  This Protocol is introduced in UEFI Specification 2.6
+
+**/
+
+#ifndef __EFI_WIFI2_PROTOCOL_H__
+#define __EFI_WIFI2_PROTOCOL_H__
+
+FILE_LICENCE ( BSD2_PATENT );
+
+#define EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL_GUID \
+  { \
+    0x1b0fb9bf, 0x699d, 0x4fdd, { 0xa7, 0xc3, 0x25, 0x46, 0x68, 0x1b, 0xf6, 0x3b } \
+  }
+
+typedef struct _EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL;
+
+///
+/// EFI_80211_BSS_TYPE
+///
+typedef enum {
+  IeeeInfrastructureBSS,
+  IeeeIndependentBSS,
+  IeeeMeshBSS,
+  IeeeAnyBss
+} EFI_80211_BSS_TYPE;
+
+///
+/// EFI_80211_CONNECT_NETWORK_RESULT_CODE
+///
+typedef enum {
+  //
+  // The connection establishment operation finished successfully.
+  //
+  ConnectSuccess,
+  //
+  // The connection was refused by the Network.
+  //
+  ConnectRefused,
+  //
+  // The connection establishment operation failed (i.e, Network is not
+  // detected).
+  //
+  ConnectFailed,
+  //
+  // The connection establishment operation was terminated on timeout.
+  //
+  ConnectFailureTimeout,
+  //
+  // The connection establishment operation failed on other reason.
+  //
+  ConnectFailedReasonUnspecified
+} EFI_80211_CONNECT_NETWORK_RESULT_CODE;
+
+///
+/// EFI_80211_MAC_ADDRESS
+///
+typedef struct {
+  UINT8    Addr[6];
+} EFI_80211_MAC_ADDRESS;
+
+#define EFI_MAX_SSID_LEN  32
+
+///
+/// EFI_80211_SSID
+///
+typedef struct {
+  //
+  // Length in bytes of the SSId. If zero, ignore SSId field.
+  //
+  UINT8    SSIdLen;
+  //
+  // Specifies the service set identifier.
+  //
+  UINT8    SSId[EFI_MAX_SSID_LEN];
+} EFI_80211_SSID;
+
+///
+/// EFI_80211_GET_NETWORKS_DATA
+///
+typedef struct {
+  //
+  // The number of EFI_80211_SSID in SSIDList. If zero, SSIDList should be
+  // ignored.
+  //
+  UINT32            NumOfSSID;
+  //
+  // The SSIDList is a pointer to an array of EFI_80211_SSID instances. The
+  // number of entries is specified by NumOfSSID. The array should only include
+  // SSIDs of hidden networks. It is suggested that the caller inputs less than
+  // 10 elements in the SSIDList. It is the caller's responsibility to free
+  // this buffer.
+  //
+  EFI_80211_SSID    SSIDList[1];
+} EFI_80211_GET_NETWORKS_DATA;
+
+///
+/// EFI_80211_SUITE_SELECTOR
+///
+typedef struct {
+  //
+  // Organization Unique Identifier, as defined in IEEE 802.11 standard,
+  // usually set to 00-0F-AC.
+  //
+  UINT8    Oui[3];
+  //
+  // Suites types, as defined in IEEE 802.11 standard.
+  //
+  UINT8    SuiteType;
+} EFI_80211_SUITE_SELECTOR;
+
+///
+/// EFI_80211_AKM_SUITE_SELECTOR
+///
+typedef struct {
+  //
+  // Indicates the number of AKM suite selectors that are contained in
+  // AKMSuiteList. If zero, the AKMSuiteList is ignored.
+  //
+  UINT16                      AKMSuiteCount;
+  //
+  // A variable-length array of AKM suites, as defined in IEEE 802.11 standard,
+  // Table 8-101. The number of entries is specified by AKMSuiteCount.
+  //
+  EFI_80211_SUITE_SELECTOR    AKMSuiteList[1];
+} EFI_80211_AKM_SUITE_SELECTOR;
+
+///
+/// EFI_80211_CIPHER_SUITE_SELECTOR
+///
+typedef struct {
+  //
+  // Indicates the number of cipher suites that are contained in
+  // CipherSuiteList. If zero, the CipherSuiteList is ignored.
+  //
+  UINT16                      CipherSuiteCount;
+  //
+  // A variable-length array of cipher suites, as defined in IEEE 802.11
+  // standard, Table 8-99. The number of entries is specified by
+  // CipherSuiteCount.
+  //
+  EFI_80211_SUITE_SELECTOR    CipherSuiteList[1];
+} EFI_80211_CIPHER_SUITE_SELECTOR;
+
+///
+/// EFI_80211_NETWORK
+///
+typedef struct {
+  //
+  // Specifies the type of the BSS.
+  //
+  EFI_80211_BSS_TYPE                 BSSType;
+  //
+  // Specifies the SSID of the BSS.
+  //
+  EFI_80211_SSID                     SSId;
+  //
+  // Pointer to the AKM suites supported in the wireless network.
+  //
+  EFI_80211_AKM_SUITE_SELECTOR       *AKMSuite;
+  //
+  // Pointer to the cipher suites supported in the wireless network.
+  //
+  EFI_80211_CIPHER_SUITE_SELECTOR    *CipherSuite;
+} EFI_80211_NETWORK;
+
+///
+/// EFI_80211_NETWORK_DESCRIPTION
+///
+typedef struct {
+  //
+  // Specifies the found wireless network.
+  //
+  EFI_80211_NETWORK    Network;
+  //
+  // Indicates the network quality as a value between 0 to 100, where 100
+  // indicates the highest network quality.
+  //
+  UINT8                NetworkQuality;
+} EFI_80211_NETWORK_DESCRIPTION;
+
+///
+/// EFI_80211_GET_NETWORKS_RESULT
+///
+typedef struct {
+  //
+  // The number of EFI_80211_NETWORK_DESCRIPTION in NetworkDesc. If zero,
+  // NetworkDesc should be ignored.
+  //
+  UINT8                            NumOfNetworkDesc;
+  //
+  // The NetworkDesc is a pointer to an array of EFI_80211_NETWORK_DESCRIPTION
+  // instances. It is caller's responsibility to free this buffer.
+  //
+  EFI_80211_NETWORK_DESCRIPTION    NetworkDesc[1];
+} EFI_80211_GET_NETWORKS_RESULT;
+
+///
+/// EFI_80211_GET_NETWORKS_TOKEN
+///
+typedef struct {
+  //
+  // If the status code returned by GetNetworks() is EFI_SUCCESS, then this
+  // Event will be signaled after the Status field is updated by the EFI
+  // Wireless MAC Connection Protocol II driver. The type of Event must be
+  // EFI_NOTIFY_SIGNAL.
+  //
+  EFI_EVENT    Event;
+  //
+  // Will be set to one of the following values:
+  // EFI_SUCCESS: The operation completed successfully.
+  // EFI_NOT_FOUND: Failed to find available wireless networks.
+  // EFI_DEVICE_ERROR: An unexpected network or system error occurred.
+  // EFI_ACCESS_DENIED: The operation is not completed due to some underlying
+  // hardware or software state.
+  // EFI_NOT_READY: The operation is started but not yet completed.
+  //
+  EFI_STATUS                       Status;
+  //
+  // Pointer to the input data for getting networks.
+  //
+  EFI_80211_GET_NETWORKS_DATA      *Data;
+  //
+  // Indicates the scan result. It is caller's responsibility to free this
+  // buffer.
+  //
+  EFI_80211_GET_NETWORKS_RESULT    *Result;
+} EFI_80211_GET_NETWORKS_TOKEN;
+
+///
+/// EFI_80211_CONNECT_NETWORK_DATA
+///
+typedef struct {
+  //
+  // Specifies the wireless network to connect to.
+  //
+  EFI_80211_NETWORK    *Network;
+  //
+  // Specifies a time limit in seconds that is optionally present, after which
+  // the connection establishment procedure is terminated by the UNDI driver.
+  // This is an optional parameter and may be 0. Values of 5 seconds or higher
+  // are recommended.
+  //
+  UINT32               FailureTimeout;
+} EFI_80211_CONNECT_NETWORK_DATA;
+
+///
+/// EFI_80211_CONNECT_NETWORK_TOKEN
+///
+typedef struct {
+  //
+  // If the status code returned by ConnectNetwork() is EFI_SUCCESS, then this
+  // Event will be signaled after the Status field is updated by the EFI
+  // Wireless MAC Connection Protocol II driver. The type of Event must be
+  // EFI_NOTIFY_SIGNAL.
+  //
+  EFI_EVENT    Event;
+  //
+  // Will be set to one of the following values:
+  // EFI_SUCCESS: The operation completed successfully.
+  // EFI_DEVICE_ERROR: An unexpected network or system error occurred.
+  // EFI_ACCESS_DENIED: The operation is not completed due to some underlying
+  // hardware or software state.
+  // EFI_NOT_READY: The operation is started but not yet completed.
+  //
+  EFI_STATUS                               Status;
+  //
+  // Pointer to the connection data.
+  //
+  EFI_80211_CONNECT_NETWORK_DATA           *Data;
+  //
+  // Indicates the connection state.
+  //
+  EFI_80211_CONNECT_NETWORK_RESULT_CODE    ResultCode;
+} EFI_80211_CONNECT_NETWORK_TOKEN;
+
+///
+/// EFI_80211_DISCONNECT_NETWORK_TOKEN
+///
+typedef struct {
+  //
+  // If the status code returned by DisconnectNetwork() is EFI_SUCCESS, then
+  // this Event will be signaled after the Status field is updated by the EFI
+  // Wireless MAC Connection Protocol II driver. The type of Event must be
+  // EFI_NOTIFY_SIGNAL.
+  //
+  EFI_EVENT     Event;
+  //
+  // Will be set to one of the following values:
+  // EFI_SUCCESS: The operation completed successfully
+  // EFI_DEVICE_ERROR: An unexpected network or system error occurred.
+  // EFI_ACCESS_DENIED: The operation is not completed due to some underlying
+  // hardware or software state.
+  //
+  EFI_STATUS    Status;
+} EFI_80211_DISCONNECT_NETWORK_TOKEN;
+
+/**
+  Request a survey of potential wireless networks that administrator can later
+  elect to try to join.
+
+  @param[in]  This                Pointer to the
+                                  EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL
+                                  instance.
+  @param[in]  Token               Pointer to the token for getting wireless
+                                  network.
+
+  @retval EFI_SUCCESS             The operation started, and an event will
+                                  eventually be raised for the caller.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is
+                                  TRUE:
+                                  This is NULL.
+                                  Token is NULL.
+  @retval EFI_UNSUPPORTED         One or more of the input parameters is not
+                                  supported by this implementation.
+  @retval EFI_ALREADY_STARTED     The operation of getting wireless network is
+                                  already started.
+  @retval EFI_OUT_OF_RESOURCES    Required system resources could not be
+                                  allocated.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_WIRELESS_MAC_CONNECTION_II_GET_NETWORKS)(
+  IN EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL          *This,
+  IN EFI_80211_GET_NETWORKS_TOKEN                     *Token
+  );
+
+/**
+  Connect a wireless network specified by a particular SSID, BSS type and
+  Security type.
+
+  @param[in]  This                Pointer to the
+                                  EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL
+                                  instance.
+  @param[in]  Token               Pointer to the token for connecting wireless
+                                  network.
+
+  @retval EFI_SUCCESS             The operation started successfully. Results
+                                  will be notified eventually.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is
+                                  TRUE:
+                                  This is NULL.
+                                  Token is NULL.
+  @retval EFI_UNSUPPORTED         One or more of the input parameters are not
+                                  supported by this implementation.
+  @retval EFI_ALREADY_STARTED     The connection process is already started.
+  @retval EFI_NOT_FOUND           The specified wireless network is not found.
+  @retval EFI_OUT_OF_RESOURCES    Required system resources could not be
+                                  allocated.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_WIRELESS_MAC_CONNECTION_II_CONNECT_NETWORK)(
+  IN EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL          *This,
+  IN EFI_80211_CONNECT_NETWORK_TOKEN                  *Token
+  );
+
+/**
+  Request a disconnection with current connected wireless network.
+
+  @param[in]  This                Pointer to the
+                                  EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL
+                                  instance.
+  @param[in]  Token               Pointer to the token for disconnecting
+                                  wireless network.
+
+  @retval EFI_SUCCESS             The operation started successfully. Results
+                                  will be notified eventually.
+  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is
+                                  TRUE:
+                                  This is NULL.
+                                  Token is NULL.
+  @retval EFI_UNSUPPORTED         One or more of the input parameters are not
+                                  supported by this implementation.
+  @retval EFI_NOT_FOUND           Not connected to a wireless network.
+  @retval EFI_OUT_OF_RESOURCES    Required system resources could not be
+                                  allocated.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_WIRELESS_MAC_CONNECTION_II_DISCONNECT_NETWORK)(
+  IN EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL          *This,
+  IN EFI_80211_DISCONNECT_NETWORK_TOKEN               *Token
+  );
+
+///
+/// The EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL provides network management
+/// service interfaces for 802.11 network stack. It is used by network
+/// applications (and drivers) to establish wireless connection with a wireless
+/// network.
+///
+struct _EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL {
+  EFI_WIRELESS_MAC_CONNECTION_II_GET_NETWORKS          GetNetworks;
+  EFI_WIRELESS_MAC_CONNECTION_II_CONNECT_NETWORK       ConnectNetwork;
+  EFI_WIRELESS_MAC_CONNECTION_II_DISCONNECT_NETWORK    DisconnectNetwork;
+};
+
+extern EFI_GUID  gEfiWiFi2ProtocolGuid;
+
+#endif
index 8347d824923cee54e787a40e59ae4747963f2bd5..29c292f36523d1ba532c8c43542278736918346b 100644 (file)
@@ -172,6 +172,7 @@ struct efi_config_table {
 
 extern EFI_GUID efi_absolute_pointer_protocol_guid;
 extern EFI_GUID efi_acpi_table_protocol_guid;
+extern EFI_GUID efi_adapter_information_protocol_guid;
 extern EFI_GUID efi_apple_net_boot_protocol_guid;
 extern EFI_GUID efi_arp_protocol_guid;
 extern EFI_GUID efi_arp_service_binding_protocol_guid;
@@ -192,6 +193,7 @@ extern EFI_GUID efi_dns4_service_binding_protocol_guid;
 extern EFI_GUID efi_dns6_protocol_guid;
 extern EFI_GUID efi_dns6_service_binding_protocol_guid;
 extern EFI_GUID efi_driver_binding_protocol_guid;
+extern EFI_GUID efi_eap_configuration_protocol_guid;
 extern EFI_GUID efi_graphics_output_protocol_guid;
 extern EFI_GUID efi_hii_config_access_protocol_guid;
 extern EFI_GUID efi_hii_font_protocol_guid;
@@ -228,6 +230,7 @@ extern EFI_GUID efi_simple_pointer_protocol_guid;
 extern EFI_GUID efi_simple_text_input_protocol_guid;
 extern EFI_GUID efi_simple_text_input_ex_protocol_guid;
 extern EFI_GUID efi_simple_text_output_protocol_guid;
+extern EFI_GUID efi_supplicant_protocol_guid;
 extern EFI_GUID efi_tcg_protocol_guid;
 extern EFI_GUID efi_tcg2_protocol_guid;
 extern EFI_GUID efi_tcp4_protocol_guid;
@@ -245,6 +248,7 @@ extern EFI_GUID efi_usb_hc_protocol_guid;
 extern EFI_GUID efi_usb2_hc_protocol_guid;
 extern EFI_GUID efi_usb_io_protocol_guid;
 extern EFI_GUID efi_vlan_config_protocol_guid;
+extern EFI_GUID efi_wifi2_protocol_guid;
 
 extern EFI_GUID efi_acpi_10_table_guid;
 extern EFI_GUID efi_acpi_20_table_guid;
index 1b16dd1b78275138f79c6bc5562e229f001bf67c..84c517443a441ce85ad4bcc57e46c6f190e9c016 100644 (file)
@@ -28,6 +28,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #include <ipxe/efi/efi.h>
 #include <ipxe/efi/Protocol/AbsolutePointer.h>
 #include <ipxe/efi/Protocol/AcpiTable.h>
+#include <ipxe/efi/Protocol/AdapterInformation.h>
 #include <ipxe/efi/Protocol/AppleNetBoot.h>
 #include <ipxe/efi/Protocol/Arp.h>
 #include <ipxe/efi/Protocol/BlockIo.h>
@@ -44,6 +45,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #include <ipxe/efi/Protocol/Dns4.h>
 #include <ipxe/efi/Protocol/Dns6.h>
 #include <ipxe/efi/Protocol/DriverBinding.h>
+#include <ipxe/efi/Protocol/EapConfiguration.h>
 #include <ipxe/efi/Protocol/GraphicsOutput.h>
 #include <ipxe/efi/Protocol/HiiConfigAccess.h>
 #include <ipxe/efi/Protocol/HiiFont.h>
@@ -72,6 +74,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #include <ipxe/efi/Protocol/SimpleTextIn.h>
 #include <ipxe/efi/Protocol/SimpleTextInEx.h>
 #include <ipxe/efi/Protocol/SimpleTextOut.h>
+#include <ipxe/efi/Protocol/Supplicant.h>
 #include <ipxe/efi/Protocol/TcgService.h>
 #include <ipxe/efi/Protocol/Tcg2Protocol.h>
 #include <ipxe/efi/Protocol/Tcp4.h>
@@ -84,6 +87,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #include <ipxe/efi/Protocol/Usb2HostController.h>
 #include <ipxe/efi/Protocol/UsbIo.h>
 #include <ipxe/efi/Protocol/VlanConfig.h>
+#include <ipxe/efi/Protocol/WiFi2.h>
 #include <ipxe/efi/Guid/Acpi.h>
 #include <ipxe/efi/Guid/Fdt.h>
 #include <ipxe/efi/Guid/FileInfo.h>
@@ -112,6 +116,10 @@ EFI_GUID efi_absolute_pointer_protocol_guid
 EFI_GUID efi_acpi_table_protocol_guid
        = EFI_ACPI_TABLE_PROTOCOL_GUID;
 
+/** Adapter information protocol GUID */
+EFI_GUID efi_adapter_information_protocol_guid
+       = EFI_ADAPTER_INFORMATION_PROTOCOL_GUID;
+
 /** Apple NetBoot protocol GUID */
 EFI_GUID efi_apple_net_boot_protocol_guid
        = EFI_APPLE_NET_BOOT_PROTOCOL_GUID;
@@ -192,6 +200,10 @@ EFI_GUID efi_dns6_service_binding_protocol_guid
 EFI_GUID efi_driver_binding_protocol_guid
        = EFI_DRIVER_BINDING_PROTOCOL_GUID;
 
+/** EAP configuration protocol GUID */
+EFI_GUID efi_eap_configuration_protocol_guid
+       = EFI_EAP_CONFIGURATION_PROTOCOL_GUID;
+
 /** Graphics output protocol GUID */
 EFI_GUID efi_graphics_output_protocol_guid
        = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
@@ -336,6 +348,10 @@ EFI_GUID efi_simple_text_input_ex_protocol_guid
 EFI_GUID efi_simple_text_output_protocol_guid
        = EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID;
 
+/** Supplicant protocol GUID */
+EFI_GUID efi_supplicant_protocol_guid
+       = EFI_SUPPLICANT_PROTOCOL_GUID;
+
 /** TCG protocol GUID */
 EFI_GUID efi_tcg_protocol_guid
        = EFI_TCG_PROTOCOL_GUID;
@@ -404,6 +420,10 @@ EFI_GUID efi_usb_io_protocol_guid
 EFI_GUID efi_vlan_config_protocol_guid
        = EFI_VLAN_CONFIG_PROTOCOL_GUID;
 
+/** WiFi 2 protocol GUID */
+EFI_GUID efi_wifi2_protocol_guid
+       = EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL_GUID;
+
 /** ACPI 1.0 table GUID */
 EFI_GUID efi_acpi_10_table_guid
        = ACPI_10_TABLE_GUID;
@@ -469,6 +489,12 @@ static EFI_GUID efi_vlan_config_dxe_guid = {
        { 0xa8, 0xf4, 0x08, 0x51, 0x9b, 0xc4, 0x39, 0xdf }
 };
 
+/** WiFiConnectionMgrDxe module GUID */
+static EFI_GUID efi_wifi_connection_mgr_dxe_guid = {
+       0x99b7c019, 0x4789, 0x4829,
+       { 0xa7, 0xbd, 0x0d, 0x4b, 0xaa, 0x62, 0x28, 0x72 }
+};
+
 /** A well-known GUID */
 struct efi_well_known_guid {
        /** GUID */
@@ -487,6 +513,8 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
          "Acpi20" },
        { &efi_acpi_table_protocol_guid,
          "AcpiTable" },
+       { &efi_adapter_information_protocol_guid,
+         "AdapterInfo" },
        { &efi_apple_net_boot_protocol_guid,
          "AppleNetBoot" },
        { &efi_arp_protocol_guid,
@@ -529,6 +557,8 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
          "Dns6" },
        { &efi_dns6_service_binding_protocol_guid,
          "Dns6Sb" },
+       { &efi_eap_configuration_protocol_guid,
+         "EapConfig" },
        { &efi_fdt_table_guid,
          "Fdt" },
        { &efi_global_variable,
@@ -615,6 +645,8 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
          "Smbios" },
        { &efi_smbios3_table_guid,
          "Smbios3" },
+       { &efi_supplicant_protocol_guid,
+         "Supplicant" },
        { &efi_tcg_protocol_guid,
          "Tcg" },
        { &efi_tcg2_protocol_guid,
@@ -655,6 +687,10 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
          "VlanConfig" },
        { &efi_vlan_config_dxe_guid,
          "VlanConfigDxe" },
+       { &efi_wifi2_protocol_guid,
+         "Wifi2" },
+       { &efi_wifi_connection_mgr_dxe_guid,
+         "WiFiConnectionMgrDxe" },
 };
 
 /**