xref: /openbmc/linux/drivers/net/wireless/intel/iwlwifi/mei/sap.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1*9ad28ba1STom Rix /* SPDX-License-Identifier: GPL-2.0-only */
22da4366fSEmmanuel Grumbach /*
3e5d3a64eSAvraham Stern  * Copyright (C) 2021 - 2022 Intel Corporation
42da4366fSEmmanuel Grumbach  */
52da4366fSEmmanuel Grumbach 
62da4366fSEmmanuel Grumbach #ifndef __sap_h__
72da4366fSEmmanuel Grumbach #define __sap_h__
82da4366fSEmmanuel Grumbach 
92da4366fSEmmanuel Grumbach #include "mei/iwl-mei.h"
102da4366fSEmmanuel Grumbach 
112da4366fSEmmanuel Grumbach /**
122da4366fSEmmanuel Grumbach  * DOC: Introduction
132da4366fSEmmanuel Grumbach  *
142da4366fSEmmanuel Grumbach  * SAP is the protocol used by the Intel Wireless driver (iwlwifi)
152da4366fSEmmanuel Grumbach  * and the wireless driver implemented in the CSME firmware.
162da4366fSEmmanuel Grumbach  * It allows to do several things:
172da4366fSEmmanuel Grumbach  * 1) Decide who is the owner of the device: CSME or the host
182da4366fSEmmanuel Grumbach  * 2) When the host is the owner of the device, CSME can still
192da4366fSEmmanuel Grumbach  * send and receive packets through iwlwifi.
202da4366fSEmmanuel Grumbach  *
212da4366fSEmmanuel Grumbach  * The protocol uses the ME interface (mei driver) to send
222da4366fSEmmanuel Grumbach  * messages to the CSME firmware. Those messages have a header
232da4366fSEmmanuel Grumbach  * &struct iwl_sap_me_msg_hdr and this header is followed
242da4366fSEmmanuel Grumbach  * by a payload.
252da4366fSEmmanuel Grumbach  *
262da4366fSEmmanuel Grumbach  * Since this messaging system cannot support high amounts of
272da4366fSEmmanuel Grumbach  * traffic, iwlwifi and the CSME firmware's WLAN driver have an
28*9ad28ba1STom Rix  * additional communication pipe to exchange information. The body
292da4366fSEmmanuel Grumbach  * of the message is copied to a shared area and the message that
302da4366fSEmmanuel Grumbach  * goes over the ME interface just signals the other side
312da4366fSEmmanuel Grumbach  * that a new message is waiting in the shared area. The ME
322da4366fSEmmanuel Grumbach  * interface is used only for signaling and not to transfer
332da4366fSEmmanuel Grumbach  * the payload.
342da4366fSEmmanuel Grumbach  *
352da4366fSEmmanuel Grumbach  * This shared area of memory is DMA'able mapped to be
362da4366fSEmmanuel Grumbach  * writable by both the CSME firmware and iwlwifi. It is
372da4366fSEmmanuel Grumbach  * mapped to address space of the device that controls the ME
382da4366fSEmmanuel Grumbach  * interface's DMA engine. Any data that iwlwifi needs to
392da4366fSEmmanuel Grumbach  * send to the CSME firmware needs to be copied to there.
402da4366fSEmmanuel Grumbach  */
412da4366fSEmmanuel Grumbach 
422da4366fSEmmanuel Grumbach /**
432da4366fSEmmanuel Grumbach  * DOC: Initial Handshake
442da4366fSEmmanuel Grumbach  *
452da4366fSEmmanuel Grumbach  * Once we get a link to the CMSE's WLAN driver we start the handshake
462da4366fSEmmanuel Grumbach  * to establish the shared memory that will allow the communication between
472da4366fSEmmanuel Grumbach  * the CSME's WLAN driver and the host.
482da4366fSEmmanuel Grumbach  *
492da4366fSEmmanuel Grumbach  * 1) Host sends %SAP_ME_MSG_START message with the physical address
502da4366fSEmmanuel Grumbach  * of the shared area.
512da4366fSEmmanuel Grumbach  * 2) CSME replies with %SAP_ME_MSG_START_OK which includes the versions
522da4366fSEmmanuel Grumbach  * protocol versions supported by CSME.
532da4366fSEmmanuel Grumbach  */
542da4366fSEmmanuel Grumbach 
552da4366fSEmmanuel Grumbach /**
562da4366fSEmmanuel Grumbach  * DOC: Host and driver state messages
572da4366fSEmmanuel Grumbach  *
58*9ad28ba1STom Rix  * In order to let CSME know about the host state and the host driver state,
592da4366fSEmmanuel Grumbach  * the host sends messages that let CSME know about the host's state.
602da4366fSEmmanuel Grumbach  * When the host driver is loaded, the host sends %SAP_MSG_NOTIF_WIFIDR_UP.
612da4366fSEmmanuel Grumbach  * When the host driver is unloaded, the host sends %SAP_MSG_NOTIF_WIFIDR_DOWN.
622da4366fSEmmanuel Grumbach  * When the iwlmei is unloaded, %SAP_MSG_NOTIF_HOST_GOES_DOWN is sent to let
632da4366fSEmmanuel Grumbach  * CSME know not to access the shared memory anymore since it'll be freed.
642da4366fSEmmanuel Grumbach  *
652da4366fSEmmanuel Grumbach  * CSME will reply to SAP_MSG_NOTIF_WIFIDR_UP by
662da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_AMT_STATE to let the host driver whether CSME can use the
672da4366fSEmmanuel Grumbach  * WiFi device or not followed by %SAP_MSG_NOTIF_CSME_CONN_STATUS to inform
682da4366fSEmmanuel Grumbach  * the host driver on the connection state of CSME.
692da4366fSEmmanuel Grumbach  *
702da4366fSEmmanuel Grumbach  * When host is associated to an AP, it must send %SAP_MSG_NOTIF_HOST_LINK_UP
712da4366fSEmmanuel Grumbach  * and when it disconnect from the AP, it must send
722da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_HOST_LINK_DOWN.
732da4366fSEmmanuel Grumbach  */
742da4366fSEmmanuel Grumbach 
752da4366fSEmmanuel Grumbach /**
762da4366fSEmmanuel Grumbach  * DOC: Ownership
772da4366fSEmmanuel Grumbach  *
782da4366fSEmmanuel Grumbach  * The device can be controlled either by the CSME firmware or
79*9ad28ba1STom Rix  * by the host driver: iwlwifi. There is a negotiation between
802da4366fSEmmanuel Grumbach  * those two entities to determine who controls (or owns) the
812da4366fSEmmanuel Grumbach  * device. Since the CSME can control the device even when the
822da4366fSEmmanuel Grumbach  * OS is not working or even missing, the CSME can request the
832da4366fSEmmanuel Grumbach  * device if it comes to the conclusion that the OS's host driver
842da4366fSEmmanuel Grumbach  * is not operational. This is why the host driver needs to
852da4366fSEmmanuel Grumbach  * signal CSME that it is up and running. If the driver is
862da4366fSEmmanuel Grumbach  * unloaded, it'll signal CSME that it is going down so that
872da4366fSEmmanuel Grumbach  * CSME can take ownership.
882da4366fSEmmanuel Grumbach  */
892da4366fSEmmanuel Grumbach 
902da4366fSEmmanuel Grumbach /**
912da4366fSEmmanuel Grumbach  * DOC: Ownership transfer
922da4366fSEmmanuel Grumbach  *
932da4366fSEmmanuel Grumbach  * When the host driver needs the device, it'll send the
942da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP that will be replied by
952da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ which will let the
962da4366fSEmmanuel Grumbach  * host know whether the ownership is granted or no. If the ownership is
972da4366fSEmmanuel Grumbach  * granted, the hosts sends %SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED.
982da4366fSEmmanuel Grumbach  *
992da4366fSEmmanuel Grumbach  * When CSME requests ownership, it'll send the
1002da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP and give some time to host to stop
1012da4366fSEmmanuel Grumbach  * accessing the device. The host needs to send
1022da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED to confirm that it won't access
1032da4366fSEmmanuel Grumbach  * the device anymore. If the host failed to send this message fast enough,
1042da4366fSEmmanuel Grumbach  * CSME will take ownership on the device anyway.
1052da4366fSEmmanuel Grumbach  * When CSME is willing to release the ownership, it'll send
1062da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP.
1072da4366fSEmmanuel Grumbach  */
1082da4366fSEmmanuel Grumbach 
1092da4366fSEmmanuel Grumbach /**
1102da4366fSEmmanuel Grumbach  * DOC: Data messages
1112da4366fSEmmanuel Grumbach  *
1122da4366fSEmmanuel Grumbach  * Data messages must be sent and receives on a separate queue in the shared
1132da4366fSEmmanuel Grumbach  * memory. Almost all the data messages use the %SAP_MSG_DATA_PACKET for both
1142da4366fSEmmanuel Grumbach  * packets sent by CSME to the host to be sent to the AP or for packets
1152da4366fSEmmanuel Grumbach  * received from the AP and sent by the host to CSME.
1162da4366fSEmmanuel Grumbach  * CSME sends filters to the host to let the host what inbound packets it must
1172da4366fSEmmanuel Grumbach  * send to CSME. Those filters are received by the host as a
1182da4366fSEmmanuel Grumbach  * %SAP_MSG_NOTIF_CSME_FILTERS command.
1192da4366fSEmmanuel Grumbach  * The only outbound packets that must be sent to CSME are the DHCP packets.
1202da4366fSEmmanuel Grumbach  * Those packets must use the %SAP_MSG_CB_DATA_PACKET message.
1212da4366fSEmmanuel Grumbach  */
1222da4366fSEmmanuel Grumbach 
1232da4366fSEmmanuel Grumbach /**
1242da4366fSEmmanuel Grumbach  * enum iwl_sap_me_msg_id - the ID of the ME message
1252da4366fSEmmanuel Grumbach  * @SAP_ME_MSG_START: See &struct iwl_sap_me_msg_start.
1262da4366fSEmmanuel Grumbach  * @SAP_ME_MSG_START_OK: See &struct iwl_sap_me_msg_start_ok.
1272da4366fSEmmanuel Grumbach  * @SAP_ME_MSG_CHECK_SHARED_AREA: This message has no payload.
1282da4366fSEmmanuel Grumbach  */
1292da4366fSEmmanuel Grumbach enum iwl_sap_me_msg_id {
1302da4366fSEmmanuel Grumbach 	SAP_ME_MSG_START	= 1,
1312da4366fSEmmanuel Grumbach 	SAP_ME_MSG_START_OK,
1322da4366fSEmmanuel Grumbach 	SAP_ME_MSG_CHECK_SHARED_AREA,
1332da4366fSEmmanuel Grumbach };
1342da4366fSEmmanuel Grumbach 
1352da4366fSEmmanuel Grumbach /**
1362da4366fSEmmanuel Grumbach  * struct iwl_sap_me_msg_hdr - the header of the ME message
1372da4366fSEmmanuel Grumbach  * @type: the type of the message, see &enum iwl_sap_me_msg_id.
1382da4366fSEmmanuel Grumbach  * @seq_num: a sequence number used for debug only.
139*9ad28ba1STom Rix  * @len: the length of the message.
1402da4366fSEmmanuel Grumbach  */
1412da4366fSEmmanuel Grumbach struct iwl_sap_me_msg_hdr {
1422da4366fSEmmanuel Grumbach 	__le32 type;
1432da4366fSEmmanuel Grumbach 	__le32 seq_num;
1442da4366fSEmmanuel Grumbach 	__le32 len;
1452da4366fSEmmanuel Grumbach } __packed;
1462da4366fSEmmanuel Grumbach 
1472da4366fSEmmanuel Grumbach /**
1482da4366fSEmmanuel Grumbach  * struct iwl_sap_me_msg_start - used for the %SAP_ME_MSG_START message
1492da4366fSEmmanuel Grumbach  * @hdr: See &struct iwl_sap_me_msg_hdr.
1502da4366fSEmmanuel Grumbach  * @shared_mem: physical address of SAP shared memory area.
1512da4366fSEmmanuel Grumbach  * @init_data_seq_num: seq_num of the first data packet HOST -> CSME.
1522da4366fSEmmanuel Grumbach  * @init_notif_seq_num: seq_num of the first notification HOST -> CSME.
1532da4366fSEmmanuel Grumbach  * @supported_versions: The host sends to the CSME a zero-terminated array
1542da4366fSEmmanuel Grumbach  * of versions its supports.
1552da4366fSEmmanuel Grumbach  *
1562da4366fSEmmanuel Grumbach  * This message is sent by the host to CSME and will responded by the
1572da4366fSEmmanuel Grumbach  * %SAP_ME_MSG_START_OK message.
1582da4366fSEmmanuel Grumbach  */
1592da4366fSEmmanuel Grumbach struct iwl_sap_me_msg_start {
1602da4366fSEmmanuel Grumbach 	struct iwl_sap_me_msg_hdr hdr;
1612da4366fSEmmanuel Grumbach 	__le64 shared_mem;
1622da4366fSEmmanuel Grumbach 	__le16 init_data_seq_num;
1632da4366fSEmmanuel Grumbach 	__le16 init_notif_seq_num;
1642da4366fSEmmanuel Grumbach 	u8 supported_versions[64];
1652da4366fSEmmanuel Grumbach } __packed;
1662da4366fSEmmanuel Grumbach 
1672da4366fSEmmanuel Grumbach /**
1682da4366fSEmmanuel Grumbach  * struct iwl_sap_me_msg_start_ok - used for the %SAP_ME_MSG_START_OK
1692da4366fSEmmanuel Grumbach  * @hdr: See &struct iwl_sap_me_msg_hdr
1702da4366fSEmmanuel Grumbach  * @init_data_seq_num: Not used.
1712da4366fSEmmanuel Grumbach  * @init_notif_seq_num: Not used
1722da4366fSEmmanuel Grumbach  * @supported_version: The version that will be used.
1732da4366fSEmmanuel Grumbach  * @reserved: For alignment.
1742da4366fSEmmanuel Grumbach  *
1752da4366fSEmmanuel Grumbach  * This message is sent by CSME to the host in response to the
1762da4366fSEmmanuel Grumbach  * %SAP_ME_MSG_START message.
1772da4366fSEmmanuel Grumbach  */
1782da4366fSEmmanuel Grumbach struct iwl_sap_me_msg_start_ok {
1792da4366fSEmmanuel Grumbach 	struct iwl_sap_me_msg_hdr hdr;
1802da4366fSEmmanuel Grumbach 	__le16 init_data_seq_num;
1812da4366fSEmmanuel Grumbach 	__le16 init_notif_seq_num;
1822da4366fSEmmanuel Grumbach 	u8 supported_version;
1832da4366fSEmmanuel Grumbach 	u8 reserved[3];
1842da4366fSEmmanuel Grumbach } __packed;
1852da4366fSEmmanuel Grumbach 
1862da4366fSEmmanuel Grumbach /**
1872da4366fSEmmanuel Grumbach  * enum iwl_sap_msg - SAP messages
1882da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_BOTH_WAYS_MIN: Not used.
1892da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_PING: No payload. Solicitate a response message (check-alive).
1902da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_PONG: No payload. The response message.
1912da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_BOTH_WAYS_MAX: Not used.
1922da4366fSEmmanuel Grumbach  *
1932da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_FROM_CSME_MIN: Not used.
1942da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_CSME_FILTERS: TODO
1952da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_AMT_STATE: Payload is a DW. Any non-zero value means
1962da4366fSEmmanuel Grumbach  *	that CSME is enabled.
1972da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ: Payload is a DW. 0 means
1982da4366fSEmmanuel Grumbach  *	the host will not get ownership. Any other value means the host is
1992da4366fSEmmanuel Grumbach  *	the owner.
2002da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP: No payload.
2012da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_TRIGGER_IP_REFRESH: No payload.
2022da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP: No payload.
2032da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_NIC_OWNER: Payload is a DW. See &enum iwl_sap_nic_owner.
2042da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_CSME_CONN_STATUS: See &struct iwl_sap_notif_conn_status.
2052da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_NVM: See &struct iwl_sap_nvm.
206733eb54fSAvraham Stern  * @SAP_MSG_NOTIF_PLDR_ACK: See &struct iwl_sap_pldr_ack_data.
2072da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_FROM_CSME_MAX: Not used.
2082da4366fSEmmanuel Grumbach  *
2092da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_FROM_HOST_MIN: Not used.
2102da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_BAND_SELECTION: TODO
2112da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_RADIO_STATE: Payload is a DW.
2122da4366fSEmmanuel Grumbach  *	See &enum iwl_sap_radio_state_bitmap.
2132da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_NIC_INFO: See &struct iwl_sap_notif_host_nic_info.
2142da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP: No payload.
2152da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_HOST_SUSPENDS: Payload is a DW. Bitmap described in
2162da4366fSEmmanuel Grumbach  *	&enum iwl_sap_notif_host_suspends_bitmap.
2172da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_HOST_RESUMES: Payload is a DW. 0 or 1. 1 says that
2182da4366fSEmmanuel Grumbach  *	the CSME should re-initialize the init control block.
2192da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_HOST_GOES_DOWN: No payload.
2202da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED: No payload.
2212da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_COUNTRY_CODE: See &struct iwl_sap_notif_country_code.
2222da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_HOST_LINK_UP: See &struct iwl_sap_notif_host_link_up.
2232da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_HOST_LINK_DOWN: See &struct iwl_sap_notif_host_link_down.
2242da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_WHO_OWNS_NIC: No payload.
2252da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_WIFIDR_DOWN: No payload.
2262da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_WIFIDR_UP: No payload.
2272da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED: No payload.
2282da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_SAR_LIMITS: See &struct iwl_sap_notif_sar_limits.
2292da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_GET_NVM: No payload. Triggers %SAP_MSG_NOTIF_NVM.
230733eb54fSAvraham Stern  * @SAP_MSG_NOTIF_PLDR: See &struct iwl_sap_pldr_data.
231733eb54fSAvraham Stern  * @SAP_MSG_NOTIF_PLDR_END: See &struct iwl_sap_pldr_end_data.
2322da4366fSEmmanuel Grumbach  * @SAP_MSG_NOTIF_FROM_HOST_MAX: Not used.
2332da4366fSEmmanuel Grumbach  *
2342da4366fSEmmanuel Grumbach  * @SAP_MSG_DATA_MIN: Not used.
2352da4366fSEmmanuel Grumbach  * @SAP_MSG_DATA_PACKET: Packets that passed the filters defined by
2362da4366fSEmmanuel Grumbach  *	%SAP_MSG_NOTIF_CSME_FILTERS. The payload is &struct iwl_sap_hdr with
2372da4366fSEmmanuel Grumbach  *	the payload of the packet immediately afterwards.
2382da4366fSEmmanuel Grumbach  * @SAP_MSG_CB_DATA_PACKET: Indicates to CSME that we transmitted a specific
2392da4366fSEmmanuel Grumbach  *	packet. Used only for DHCP transmitted packets. See
2402da4366fSEmmanuel Grumbach  *	&struct iwl_sap_cb_data.
2412da4366fSEmmanuel Grumbach  * @SAP_MSG_DATA_MAX: Not used.
2422da4366fSEmmanuel Grumbach  */
2432da4366fSEmmanuel Grumbach enum iwl_sap_msg {
2442da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_BOTH_WAYS_MIN			= 0,
2452da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_PING				= 1,
2462da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_PONG				= 2,
2472da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_BOTH_WAYS_MAX,
2482da4366fSEmmanuel Grumbach 
2492da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_FROM_CSME_MIN			= 500,
2502da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_CSME_FILTERS			= SAP_MSG_NOTIF_FROM_CSME_MIN,
2512da4366fSEmmanuel Grumbach 	/* 501 is deprecated */
2522da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_AMT_STATE				= 502,
2532da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ	= 503,
2542da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP		= 504,
2552da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_TRIGGER_IP_REFRESH		= 505,
2562da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP	= 506,
2572da4366fSEmmanuel Grumbach 	/* 507 is deprecated */
2582da4366fSEmmanuel Grumbach 	/* 508 is deprecated */
2592da4366fSEmmanuel Grumbach 	/* 509 is deprecated */
2602da4366fSEmmanuel Grumbach 	/* 510 is deprecated */
2612da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_NIC_OWNER				= 511,
2622da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_CSME_CONN_STATUS			= 512,
2632da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_NVM				= 513,
264733eb54fSAvraham Stern 	/* 514 - 517 not supported */
265733eb54fSAvraham Stern 	SAP_MSG_NOTIF_PLDR_ACK				= 518,
2662da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_FROM_CSME_MAX,
2672da4366fSEmmanuel Grumbach 
2682da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_FROM_HOST_MIN			= 1000,
2692da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_BAND_SELECTION			= SAP_MSG_NOTIF_FROM_HOST_MIN,
2702da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_RADIO_STATE			= 1001,
2712da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_NIC_INFO				= 1002,
2722da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP	= 1003,
2732da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_HOST_SUSPENDS			= 1004,
2742da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_HOST_RESUMES			= 1005,
2752da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_HOST_GOES_DOWN			= 1006,
2762da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED		= 1007,
2772da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_COUNTRY_CODE			= 1008,
2782da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_HOST_LINK_UP			= 1009,
2792da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_HOST_LINK_DOWN			= 1010,
2802da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_WHO_OWNS_NIC			= 1011,
2812da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_WIFIDR_DOWN			= 1012,
2822da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_WIFIDR_UP				= 1013,
2832da4366fSEmmanuel Grumbach 	/* 1014 is deprecated */
2842da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED		= 1015,
2852da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_SAR_LIMITS			= 1016,
2862da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_GET_NVM				= 1017,
287733eb54fSAvraham Stern 	/* 1018 - 1023 not supported */
288733eb54fSAvraham Stern 	SAP_MSG_NOTIF_PLDR				= 1024,
289733eb54fSAvraham Stern 	SAP_MSG_NOTIF_PLDR_END				= 1025,
2902da4366fSEmmanuel Grumbach 	SAP_MSG_NOTIF_FROM_HOST_MAX,
2912da4366fSEmmanuel Grumbach 
2922da4366fSEmmanuel Grumbach 	SAP_MSG_DATA_MIN				= 2000,
2932da4366fSEmmanuel Grumbach 	SAP_MSG_DATA_PACKET				= SAP_MSG_DATA_MIN,
2942da4366fSEmmanuel Grumbach 	SAP_MSG_CB_DATA_PACKET				= 2001,
2952da4366fSEmmanuel Grumbach 	SAP_MSG_DATA_MAX,
2962da4366fSEmmanuel Grumbach };
2972da4366fSEmmanuel Grumbach 
2982da4366fSEmmanuel Grumbach /**
2992da4366fSEmmanuel Grumbach  * struct iwl_sap_hdr - prefixes any SAP message
3002da4366fSEmmanuel Grumbach  * @type: See &enum iwl_sap_msg.
3012da4366fSEmmanuel Grumbach  * @len: The length of the message (header not included).
3022da4366fSEmmanuel Grumbach  * @seq_num: For debug.
3032da4366fSEmmanuel Grumbach  * @payload: The payload of the message.
3042da4366fSEmmanuel Grumbach  */
3052da4366fSEmmanuel Grumbach struct iwl_sap_hdr {
3062da4366fSEmmanuel Grumbach 	__le16 type;
3072da4366fSEmmanuel Grumbach 	__le16 len;
3082da4366fSEmmanuel Grumbach 	__le32 seq_num;
309c5f67574SGustavo A. R. Silva 	u8 payload[];
3102da4366fSEmmanuel Grumbach };
3112da4366fSEmmanuel Grumbach 
3122da4366fSEmmanuel Grumbach /**
3132da4366fSEmmanuel Grumbach  * struct iwl_sap_msg_dw - suits any DW long SAP message
3142da4366fSEmmanuel Grumbach  * @hdr: The SAP header
3152da4366fSEmmanuel Grumbach  * @val: The value of the DW.
3162da4366fSEmmanuel Grumbach  */
3172da4366fSEmmanuel Grumbach struct iwl_sap_msg_dw {
3182da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
3192da4366fSEmmanuel Grumbach 	__le32 val;
3202da4366fSEmmanuel Grumbach };
3212da4366fSEmmanuel Grumbach 
3222da4366fSEmmanuel Grumbach /**
3232da4366fSEmmanuel Grumbach  * enum iwl_sap_nic_owner - used by %SAP_MSG_NOTIF_NIC_OWNER
3242da4366fSEmmanuel Grumbach  * @SAP_NIC_OWNER_UNKNOWN: Not used.
3252da4366fSEmmanuel Grumbach  * @SAP_NIC_OWNER_HOST: The host owns the NIC.
3262da4366fSEmmanuel Grumbach  * @SAP_NIC_OWNER_ME: CSME owns the NIC.
3272da4366fSEmmanuel Grumbach  */
3282da4366fSEmmanuel Grumbach enum iwl_sap_nic_owner {
3292da4366fSEmmanuel Grumbach 	SAP_NIC_OWNER_UNKNOWN,
3302da4366fSEmmanuel Grumbach 	SAP_NIC_OWNER_HOST,
3312da4366fSEmmanuel Grumbach 	SAP_NIC_OWNER_ME,
3322da4366fSEmmanuel Grumbach };
3332da4366fSEmmanuel Grumbach 
3342da4366fSEmmanuel Grumbach enum iwl_sap_wifi_auth_type {
3352da4366fSEmmanuel Grumbach 	SAP_WIFI_AUTH_TYPE_OPEN		= IWL_MEI_AKM_AUTH_OPEN,
3362da4366fSEmmanuel Grumbach 	SAP_WIFI_AUTH_TYPE_RSNA		= IWL_MEI_AKM_AUTH_RSNA,
3372da4366fSEmmanuel Grumbach 	SAP_WIFI_AUTH_TYPE_RSNA_PSK	= IWL_MEI_AKM_AUTH_RSNA_PSK,
3382da4366fSEmmanuel Grumbach 	SAP_WIFI_AUTH_TYPE_SAE		= IWL_MEI_AKM_AUTH_SAE,
3392da4366fSEmmanuel Grumbach 	SAP_WIFI_AUTH_TYPE_MAX,
3402da4366fSEmmanuel Grumbach };
3412da4366fSEmmanuel Grumbach 
3422da4366fSEmmanuel Grumbach /**
3432da4366fSEmmanuel Grumbach  * enum iwl_sap_wifi_cipher_alg
3442da4366fSEmmanuel Grumbach  * @SAP_WIFI_CIPHER_ALG_NONE: TBD
345e5d3a64eSAvraham Stern  * @SAP_WIFI_CIPHER_ALG_TKIP: TBD
3462da4366fSEmmanuel Grumbach  * @SAP_WIFI_CIPHER_ALG_CCMP: TBD
3472da4366fSEmmanuel Grumbach  * @SAP_WIFI_CIPHER_ALG_GCMP: TBD
3482da4366fSEmmanuel Grumbach  * @SAP_WIFI_CIPHER_ALG_GCMP_256: TBD
3492da4366fSEmmanuel Grumbach  */
3502da4366fSEmmanuel Grumbach enum iwl_sap_wifi_cipher_alg {
3512da4366fSEmmanuel Grumbach 	SAP_WIFI_CIPHER_ALG_NONE	= IWL_MEI_CIPHER_NONE,
352e5d3a64eSAvraham Stern 	SAP_WIFI_CIPHER_ALG_TKIP	= IWL_MEI_CIPHER_TKIP,
3532da4366fSEmmanuel Grumbach 	SAP_WIFI_CIPHER_ALG_CCMP	= IWL_MEI_CIPHER_CCMP,
3542da4366fSEmmanuel Grumbach 	SAP_WIFI_CIPHER_ALG_GCMP	= IWL_MEI_CIPHER_GCMP,
3552da4366fSEmmanuel Grumbach 	SAP_WIFI_CIPHER_ALG_GCMP_256	= IWL_MEI_CIPHER_GCMP_256,
3562da4366fSEmmanuel Grumbach };
3572da4366fSEmmanuel Grumbach 
3582da4366fSEmmanuel Grumbach /**
3592da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_connection_info - nested in other structures
3602da4366fSEmmanuel Grumbach  * @ssid_len: The length of the SSID.
3612da4366fSEmmanuel Grumbach  * @ssid: The SSID.
3622da4366fSEmmanuel Grumbach  * @auth_mode: The authentication mode. See &enum iwl_sap_wifi_auth_type.
3632da4366fSEmmanuel Grumbach  * @pairwise_cipher: The cipher used for unicast packets.
3642da4366fSEmmanuel Grumbach  *	See &enum iwl_sap_wifi_cipher_alg.
3652da4366fSEmmanuel Grumbach  * @channel: The channel on which we are associated.
3662da4366fSEmmanuel Grumbach  * @band: The band on which we are associated.
3672da4366fSEmmanuel Grumbach  * @reserved: For alignment.
3682da4366fSEmmanuel Grumbach  * @bssid: The BSSID.
3692da4366fSEmmanuel Grumbach  * @reserved1: For alignment.
3702da4366fSEmmanuel Grumbach  */
3712da4366fSEmmanuel Grumbach struct iwl_sap_notif_connection_info {
3722da4366fSEmmanuel Grumbach 	__le32 ssid_len;
3732da4366fSEmmanuel Grumbach 	u8 ssid[32];
3742da4366fSEmmanuel Grumbach 	__le32 auth_mode;
3752da4366fSEmmanuel Grumbach 	__le32 pairwise_cipher;
3762da4366fSEmmanuel Grumbach 	u8 channel;
3772da4366fSEmmanuel Grumbach 	u8 band;
3782da4366fSEmmanuel Grumbach 	__le16 reserved;
3792da4366fSEmmanuel Grumbach 	u8 bssid[6];
3802da4366fSEmmanuel Grumbach 	__le16 reserved1;
3812da4366fSEmmanuel Grumbach } __packed;
3822da4366fSEmmanuel Grumbach 
3832da4366fSEmmanuel Grumbach /**
3842da4366fSEmmanuel Grumbach  * enum iwl_sap_scan_request - for the scan_request field
3852da4366fSEmmanuel Grumbach  * @SCAN_REQUEST_FILTERING: Filtering is requested.
3862da4366fSEmmanuel Grumbach  * @SCAN_REQUEST_FAST: Fast scan is requested.
3872da4366fSEmmanuel Grumbach  */
3882da4366fSEmmanuel Grumbach enum iwl_sap_scan_request {
3892da4366fSEmmanuel Grumbach 	SCAN_REQUEST_FILTERING	= 1 << 0,
3902da4366fSEmmanuel Grumbach 	SCAN_REQUEST_FAST	= 1 << 1,
3912da4366fSEmmanuel Grumbach };
3922da4366fSEmmanuel Grumbach 
3932da4366fSEmmanuel Grumbach /**
3942da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_conn_status - payload of %SAP_MSG_NOTIF_CSME_CONN_STATUS
3952da4366fSEmmanuel Grumbach  * @hdr: The SAP header
3962da4366fSEmmanuel Grumbach  * @link_prot_state: Non-zero if link protection is active.
3972da4366fSEmmanuel Grumbach  * @scan_request: See &enum iwl_sap_scan_request.
3982da4366fSEmmanuel Grumbach  * @conn_info: Information about the connection.
3992da4366fSEmmanuel Grumbach  */
4002da4366fSEmmanuel Grumbach struct iwl_sap_notif_conn_status {
4012da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
4022da4366fSEmmanuel Grumbach 	__le32 link_prot_state;
4032da4366fSEmmanuel Grumbach 	__le32 scan_request;
4042da4366fSEmmanuel Grumbach 	struct iwl_sap_notif_connection_info conn_info;
4052da4366fSEmmanuel Grumbach } __packed;
4062da4366fSEmmanuel Grumbach 
4072da4366fSEmmanuel Grumbach /**
4082da4366fSEmmanuel Grumbach  * enum iwl_sap_radio_state_bitmap - used for %SAP_MSG_NOTIF_RADIO_STATE
4092da4366fSEmmanuel Grumbach  * @SAP_SW_RFKILL_DEASSERTED: If set, SW RfKill is de-asserted
4102da4366fSEmmanuel Grumbach  * @SAP_HW_RFKILL_DEASSERTED: If set, HW RfKill is de-asserted
4112da4366fSEmmanuel Grumbach  *
4122da4366fSEmmanuel Grumbach  * If both bits are set, then the radio is on.
4132da4366fSEmmanuel Grumbach  */
4142da4366fSEmmanuel Grumbach enum iwl_sap_radio_state_bitmap {
4152da4366fSEmmanuel Grumbach 	SAP_SW_RFKILL_DEASSERTED	= 1 << 0,
4162da4366fSEmmanuel Grumbach 	SAP_HW_RFKILL_DEASSERTED	= 1 << 1,
4172da4366fSEmmanuel Grumbach };
4182da4366fSEmmanuel Grumbach 
4192da4366fSEmmanuel Grumbach /**
4202da4366fSEmmanuel Grumbach  * enum iwl_sap_notif_host_suspends_bitmap - used for %SAP_MSG_NOTIF_HOST_SUSPENDS
4212da4366fSEmmanuel Grumbach  * @SAP_OFFER_NIC: TBD
4222da4366fSEmmanuel Grumbach  * @SAP_FILTER_CONFIGURED: TBD
4232da4366fSEmmanuel Grumbach  * @SAP_NLO_CONFIGURED: TBD
4242da4366fSEmmanuel Grumbach  * @SAP_HOST_OWNS_NIC: TBD
4252da4366fSEmmanuel Grumbach  * @SAP_LINK_PROTECTED: TBD
4262da4366fSEmmanuel Grumbach  */
4272da4366fSEmmanuel Grumbach enum iwl_sap_notif_host_suspends_bitmap {
4282da4366fSEmmanuel Grumbach 	SAP_OFFER_NIC		= 1 << 0,
4292da4366fSEmmanuel Grumbach 	SAP_FILTER_CONFIGURED	= 1 << 1,
4302da4366fSEmmanuel Grumbach 	SAP_NLO_CONFIGURED	= 1 << 2,
4312da4366fSEmmanuel Grumbach 	SAP_HOST_OWNS_NIC	= 1 << 3,
4322da4366fSEmmanuel Grumbach 	SAP_LINK_PROTECTED	= 1 << 4,
4332da4366fSEmmanuel Grumbach };
4342da4366fSEmmanuel Grumbach 
4352da4366fSEmmanuel Grumbach /**
4362da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_country_code - payload of %SAP_MSG_NOTIF_COUNTRY_CODE
4372da4366fSEmmanuel Grumbach  * @hdr: The SAP header
4382da4366fSEmmanuel Grumbach  * @mcc: The country code.
4392da4366fSEmmanuel Grumbach  * @source_id: TBD
4402da4366fSEmmanuel Grumbach  * @reserved: For alignment.
4412da4366fSEmmanuel Grumbach  * @diff_time: TBD
4422da4366fSEmmanuel Grumbach  */
4432da4366fSEmmanuel Grumbach struct iwl_sap_notif_country_code {
4442da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
4452da4366fSEmmanuel Grumbach 	__le16 mcc;
4462da4366fSEmmanuel Grumbach 	u8 source_id;
4472da4366fSEmmanuel Grumbach 	u8 reserved;
4482da4366fSEmmanuel Grumbach 	__le32 diff_time;
4492da4366fSEmmanuel Grumbach } __packed;
4502da4366fSEmmanuel Grumbach 
4512da4366fSEmmanuel Grumbach /**
4522da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_host_link_up - payload of %SAP_MSG_NOTIF_HOST_LINK_UP
4532da4366fSEmmanuel Grumbach  * @hdr: The SAP header
4542da4366fSEmmanuel Grumbach  * @conn_info: Information about the connection.
4552da4366fSEmmanuel Grumbach  * @colloc_channel: The collocated channel
4562da4366fSEmmanuel Grumbach  * @colloc_band: The band of the collocated channel.
4572da4366fSEmmanuel Grumbach  * @reserved: For alignment.
4582da4366fSEmmanuel Grumbach  * @colloc_bssid: The collocated BSSID.
4592da4366fSEmmanuel Grumbach  * @reserved1: For alignment.
4602da4366fSEmmanuel Grumbach  */
4612da4366fSEmmanuel Grumbach struct iwl_sap_notif_host_link_up {
4622da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
4632da4366fSEmmanuel Grumbach 	struct iwl_sap_notif_connection_info conn_info;
4642da4366fSEmmanuel Grumbach 	u8 colloc_channel;
4652da4366fSEmmanuel Grumbach 	u8 colloc_band;
4662da4366fSEmmanuel Grumbach 	__le16 reserved;
4672da4366fSEmmanuel Grumbach 	u8 colloc_bssid[6];
4682da4366fSEmmanuel Grumbach 	__le16 reserved1;
4692da4366fSEmmanuel Grumbach } __packed;
4702da4366fSEmmanuel Grumbach 
4712da4366fSEmmanuel Grumbach /**
4722da4366fSEmmanuel Grumbach  * enum iwl_sap_notif_link_down_type - used in &struct iwl_sap_notif_host_link_down
4732da4366fSEmmanuel Grumbach  * @HOST_LINK_DOWN_TYPE_NONE: TBD
4742da4366fSEmmanuel Grumbach  * @HOST_LINK_DOWN_TYPE_TEMPORARY: TBD
4752da4366fSEmmanuel Grumbach  * @HOST_LINK_DOWN_TYPE_LONG: TBD
4762da4366fSEmmanuel Grumbach  */
4772da4366fSEmmanuel Grumbach enum iwl_sap_notif_link_down_type {
4782da4366fSEmmanuel Grumbach 	HOST_LINK_DOWN_TYPE_NONE,
4792da4366fSEmmanuel Grumbach 	HOST_LINK_DOWN_TYPE_TEMPORARY,
4802da4366fSEmmanuel Grumbach 	HOST_LINK_DOWN_TYPE_LONG,
4812da4366fSEmmanuel Grumbach };
4822da4366fSEmmanuel Grumbach 
4832da4366fSEmmanuel Grumbach /**
4842da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_host_link_down - payload for %SAP_MSG_NOTIF_HOST_LINK_DOWN
4852da4366fSEmmanuel Grumbach  * @hdr: The SAP header
4862da4366fSEmmanuel Grumbach  * @type: See &enum iwl_sap_notif_link_down_type.
4872da4366fSEmmanuel Grumbach  * @reserved: For alignment.
4882da4366fSEmmanuel Grumbach  * @reason_valid: If 0, ignore the next field.
4892da4366fSEmmanuel Grumbach  * @reason: The reason of the disconnection.
4902da4366fSEmmanuel Grumbach  */
4912da4366fSEmmanuel Grumbach struct iwl_sap_notif_host_link_down {
4922da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
4932da4366fSEmmanuel Grumbach 	u8 type;
4942da4366fSEmmanuel Grumbach 	u8 reserved[2];
4952da4366fSEmmanuel Grumbach 	u8 reason_valid;
4962da4366fSEmmanuel Grumbach 	__le32 reason;
4972da4366fSEmmanuel Grumbach } __packed;
4982da4366fSEmmanuel Grumbach 
4992da4366fSEmmanuel Grumbach /**
5002da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_host_nic_info - payload for %SAP_MSG_NOTIF_NIC_INFO
5012da4366fSEmmanuel Grumbach  * @hdr: The SAP header
5022da4366fSEmmanuel Grumbach  * @mac_address: The MAC address as configured to the interface.
5032da4366fSEmmanuel Grumbach  * @nvm_address: The MAC address as configured in the NVM.
5042da4366fSEmmanuel Grumbach  */
5052da4366fSEmmanuel Grumbach struct iwl_sap_notif_host_nic_info {
5062da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
5072da4366fSEmmanuel Grumbach 	u8 mac_address[6];
5082da4366fSEmmanuel Grumbach 	u8 nvm_address[6];
5092da4366fSEmmanuel Grumbach } __packed;
5102da4366fSEmmanuel Grumbach 
5112da4366fSEmmanuel Grumbach /**
5122da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_dw - payload is a dw
5132da4366fSEmmanuel Grumbach  * @hdr: The SAP header.
5142da4366fSEmmanuel Grumbach  * @dw: The payload.
5152da4366fSEmmanuel Grumbach  */
5162da4366fSEmmanuel Grumbach struct iwl_sap_notif_dw {
5172da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
5182da4366fSEmmanuel Grumbach 	__le32 dw;
5192da4366fSEmmanuel Grumbach } __packed;
5202da4366fSEmmanuel Grumbach 
5212da4366fSEmmanuel Grumbach /**
5222da4366fSEmmanuel Grumbach  * struct iwl_sap_notif_sar_limits - payload for %SAP_MSG_NOTIF_SAR_LIMITS
5232da4366fSEmmanuel Grumbach  * @hdr: The SAP header
5242da4366fSEmmanuel Grumbach  * @sar_chain_info_table: Tx power limits.
5252da4366fSEmmanuel Grumbach  */
5262da4366fSEmmanuel Grumbach struct iwl_sap_notif_sar_limits {
5272da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
5282da4366fSEmmanuel Grumbach 	__le16 sar_chain_info_table[2][5];
5292da4366fSEmmanuel Grumbach } __packed;
5302da4366fSEmmanuel Grumbach 
5312da4366fSEmmanuel Grumbach /**
5322da4366fSEmmanuel Grumbach  * enum iwl_sap_nvm_caps - capabilities for NVM SAP
5332da4366fSEmmanuel Grumbach  * @SAP_NVM_CAPS_LARI_SUPPORT: Lari is supported
5342da4366fSEmmanuel Grumbach  * @SAP_NVM_CAPS_11AX_SUPPORT: 11AX is supported
5352da4366fSEmmanuel Grumbach  */
5362da4366fSEmmanuel Grumbach enum iwl_sap_nvm_caps {
5372da4366fSEmmanuel Grumbach 	SAP_NVM_CAPS_LARI_SUPPORT	= BIT(0),
5382da4366fSEmmanuel Grumbach 	SAP_NVM_CAPS_11AX_SUPPORT	= BIT(1),
5392da4366fSEmmanuel Grumbach };
5402da4366fSEmmanuel Grumbach 
5412da4366fSEmmanuel Grumbach /**
5422da4366fSEmmanuel Grumbach  * struct iwl_sap_nvm - payload for %SAP_MSG_NOTIF_NVM
5432da4366fSEmmanuel Grumbach  * @hdr: The SAP header.
5442da4366fSEmmanuel Grumbach  * @hw_addr: The MAC address
5452da4366fSEmmanuel Grumbach  * @n_hw_addrs: The number of MAC addresses
5462da4366fSEmmanuel Grumbach  * @reserved: For alignment.
5472da4366fSEmmanuel Grumbach  * @radio_cfg: The radio configuration.
5482da4366fSEmmanuel Grumbach  * @caps: See &enum iwl_sap_nvm_caps.
5492da4366fSEmmanuel Grumbach  * @nvm_version: The version of the NVM.
5502da4366fSEmmanuel Grumbach  * @channels: The data for each channel.
5512da4366fSEmmanuel Grumbach  */
5522da4366fSEmmanuel Grumbach struct iwl_sap_nvm {
5532da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
5542da4366fSEmmanuel Grumbach 	u8 hw_addr[6];
5552da4366fSEmmanuel Grumbach 	u8 n_hw_addrs;
5562da4366fSEmmanuel Grumbach 	u8 reserved;
5572da4366fSEmmanuel Grumbach 	__le32 radio_cfg;
5582da4366fSEmmanuel Grumbach 	__le32 caps;
5592da4366fSEmmanuel Grumbach 	__le32 nvm_version;
5602da4366fSEmmanuel Grumbach 	__le32 channels[110];
5612da4366fSEmmanuel Grumbach } __packed;
5622da4366fSEmmanuel Grumbach 
5632da4366fSEmmanuel Grumbach /**
5642da4366fSEmmanuel Grumbach  * enum iwl_sap_eth_filter_flags - used in &struct iwl_sap_eth_filter
5652da4366fSEmmanuel Grumbach  * @SAP_ETH_FILTER_STOP: Do not process further filters.
5662da4366fSEmmanuel Grumbach  * @SAP_ETH_FILTER_COPY: Copy the packet to the CSME.
5672da4366fSEmmanuel Grumbach  * @SAP_ETH_FILTER_ENABLED: If false, the filter should be ignored.
5682da4366fSEmmanuel Grumbach  */
5692da4366fSEmmanuel Grumbach enum iwl_sap_eth_filter_flags {
5702da4366fSEmmanuel Grumbach 	SAP_ETH_FILTER_STOP    = BIT(0),
5712da4366fSEmmanuel Grumbach 	SAP_ETH_FILTER_COPY    = BIT(1),
5722da4366fSEmmanuel Grumbach 	SAP_ETH_FILTER_ENABLED = BIT(2),
5732da4366fSEmmanuel Grumbach };
5742da4366fSEmmanuel Grumbach 
5752da4366fSEmmanuel Grumbach /**
5762da4366fSEmmanuel Grumbach  * struct iwl_sap_eth_filter - a L2 filter
5772da4366fSEmmanuel Grumbach  * @mac_address: Address to filter.
5782da4366fSEmmanuel Grumbach  * @flags: See &enum iwl_sap_eth_filter_flags.
5792da4366fSEmmanuel Grumbach  */
5802da4366fSEmmanuel Grumbach struct iwl_sap_eth_filter {
5812da4366fSEmmanuel Grumbach 	u8 mac_address[6];
5822da4366fSEmmanuel Grumbach 	u8 flags;
5832da4366fSEmmanuel Grumbach } __packed;
5842da4366fSEmmanuel Grumbach 
5852da4366fSEmmanuel Grumbach /**
5862da4366fSEmmanuel Grumbach  * enum iwl_sap_flex_filter_flags - used in &struct iwl_sap_flex_filter
5872da4366fSEmmanuel Grumbach  * @SAP_FLEX_FILTER_COPY: Pass UDP / TCP packets to CSME.
5882da4366fSEmmanuel Grumbach  * @SAP_FLEX_FILTER_ENABLED: If false, the filter should be ignored.
5892da4366fSEmmanuel Grumbach  * @SAP_FLEX_FILTER_IPV4: Filter requires match on the IP address as well.
5902da4366fSEmmanuel Grumbach  * @SAP_FLEX_FILTER_IPV6: Filter requires match on the IP address as well.
5912da4366fSEmmanuel Grumbach  * @SAP_FLEX_FILTER_TCP: Filter should be applied on TCP packets.
5922da4366fSEmmanuel Grumbach  * @SAP_FLEX_FILTER_UDP: Filter should be applied on UDP packets.
5932da4366fSEmmanuel Grumbach  */
5942da4366fSEmmanuel Grumbach enum iwl_sap_flex_filter_flags {
5952da4366fSEmmanuel Grumbach 	SAP_FLEX_FILTER_COPY		= BIT(0),
5962da4366fSEmmanuel Grumbach 	SAP_FLEX_FILTER_ENABLED		= BIT(1),
5972da4366fSEmmanuel Grumbach 	SAP_FLEX_FILTER_IPV6		= BIT(2),
5982da4366fSEmmanuel Grumbach 	SAP_FLEX_FILTER_IPV4		= BIT(3),
5992da4366fSEmmanuel Grumbach 	SAP_FLEX_FILTER_TCP		= BIT(4),
6002da4366fSEmmanuel Grumbach 	SAP_FLEX_FILTER_UDP		= BIT(5),
6012da4366fSEmmanuel Grumbach };
6022da4366fSEmmanuel Grumbach 
6032da4366fSEmmanuel Grumbach /**
6042da4366fSEmmanuel Grumbach  * struct iwl_sap_flex_filter -
6052da4366fSEmmanuel Grumbach  * @src_port: Source port in network format.
6062da4366fSEmmanuel Grumbach  * @dst_port: Destination port in network format.
6072da4366fSEmmanuel Grumbach  * @flags: Flags and protocol, see &enum iwl_sap_flex_filter_flags.
6082da4366fSEmmanuel Grumbach  * @reserved: For alignment.
6092da4366fSEmmanuel Grumbach  */
6102da4366fSEmmanuel Grumbach struct iwl_sap_flex_filter {
6112da4366fSEmmanuel Grumbach 	__be16 src_port;
6122da4366fSEmmanuel Grumbach 	__be16 dst_port;
6132da4366fSEmmanuel Grumbach 	u8 flags;
6142da4366fSEmmanuel Grumbach 	u8 reserved;
6152da4366fSEmmanuel Grumbach } __packed;
6162da4366fSEmmanuel Grumbach 
6172da4366fSEmmanuel Grumbach /**
6182da4366fSEmmanuel Grumbach  * enum iwl_sap_ipv4_filter_flags - used in &struct iwl_sap_ipv4_filter
6192da4366fSEmmanuel Grumbach  * @SAP_IPV4_FILTER_ICMP_PASS: Pass ICMP packets to CSME.
6202da4366fSEmmanuel Grumbach  * @SAP_IPV4_FILTER_ICMP_COPY: Pass ICMP packets to host.
6212da4366fSEmmanuel Grumbach  * @SAP_IPV4_FILTER_ARP_REQ_PASS: Pass ARP requests to CSME.
6222da4366fSEmmanuel Grumbach  * @SAP_IPV4_FILTER_ARP_REQ_COPY: Pass ARP requests to host.
6232da4366fSEmmanuel Grumbach  * @SAP_IPV4_FILTER_ARP_RESP_PASS: Pass ARP responses to CSME.
6242da4366fSEmmanuel Grumbach  * @SAP_IPV4_FILTER_ARP_RESP_COPY: Pass ARP responses to host.
6252da4366fSEmmanuel Grumbach  */
6262da4366fSEmmanuel Grumbach enum iwl_sap_ipv4_filter_flags {
6272da4366fSEmmanuel Grumbach 	SAP_IPV4_FILTER_ICMP_PASS	= BIT(0),
6282da4366fSEmmanuel Grumbach 	SAP_IPV4_FILTER_ICMP_COPY	= BIT(1),
6292da4366fSEmmanuel Grumbach 	SAP_IPV4_FILTER_ARP_REQ_PASS	= BIT(2),
6302da4366fSEmmanuel Grumbach 	SAP_IPV4_FILTER_ARP_REQ_COPY	= BIT(3),
6312da4366fSEmmanuel Grumbach 	SAP_IPV4_FILTER_ARP_RESP_PASS	= BIT(4),
6322da4366fSEmmanuel Grumbach 	SAP_IPV4_FILTER_ARP_RESP_COPY	= BIT(5),
6332da4366fSEmmanuel Grumbach };
6342da4366fSEmmanuel Grumbach 
6352da4366fSEmmanuel Grumbach /**
6362da4366fSEmmanuel Grumbach  * struct iwl_sap_ipv4_filter-
6372da4366fSEmmanuel Grumbach  * @ipv4_addr: The IP address to filer.
6382da4366fSEmmanuel Grumbach  * @flags: See &enum iwl_sap_ipv4_filter_flags.
6392da4366fSEmmanuel Grumbach  */
6402da4366fSEmmanuel Grumbach struct iwl_sap_ipv4_filter {
6412da4366fSEmmanuel Grumbach 	__be32 ipv4_addr;
6422da4366fSEmmanuel Grumbach 	__le32 flags;
6432da4366fSEmmanuel Grumbach } __packed;
6442da4366fSEmmanuel Grumbach 
6452da4366fSEmmanuel Grumbach /**
6462da4366fSEmmanuel Grumbach  * enum iwl_sap_ipv6_filter_flags -
6472da4366fSEmmanuel Grumbach  * @SAP_IPV6_ADDR_FILTER_COPY: Pass packets to the host.
6482da4366fSEmmanuel Grumbach  * @SAP_IPV6_ADDR_FILTER_ENABLED: If false, the filter should be ignored.
6492da4366fSEmmanuel Grumbach  */
6502da4366fSEmmanuel Grumbach enum iwl_sap_ipv6_filter_flags {
6512da4366fSEmmanuel Grumbach 	SAP_IPV6_ADDR_FILTER_COPY	= BIT(0),
6522da4366fSEmmanuel Grumbach 	SAP_IPV6_ADDR_FILTER_ENABLED	= BIT(1),
6532da4366fSEmmanuel Grumbach };
6542da4366fSEmmanuel Grumbach 
6552da4366fSEmmanuel Grumbach /**
6562da4366fSEmmanuel Grumbach  * struct iwl_sap_ipv6_filter -
6572da4366fSEmmanuel Grumbach  * @addr_lo24: Lowest 24 bits of the IPv6 address.
6582da4366fSEmmanuel Grumbach  * @flags: See &enum iwl_sap_ipv6_filter_flags.
6592da4366fSEmmanuel Grumbach  */
6602da4366fSEmmanuel Grumbach struct iwl_sap_ipv6_filter {
6612da4366fSEmmanuel Grumbach 	u8 addr_lo24[3];
6622da4366fSEmmanuel Grumbach 	u8 flags;
6632da4366fSEmmanuel Grumbach } __packed;
6642da4366fSEmmanuel Grumbach 
6652da4366fSEmmanuel Grumbach /**
6662da4366fSEmmanuel Grumbach  * enum iwl_sap_icmpv6_filter_flags -
6672da4366fSEmmanuel Grumbach  * @SAP_ICMPV6_FILTER_ENABLED: If false, the filter should be ignored.
6682da4366fSEmmanuel Grumbach  * @SAP_ICMPV6_FILTER_COPY: Pass packets to the host.
6692da4366fSEmmanuel Grumbach  */
6702da4366fSEmmanuel Grumbach enum iwl_sap_icmpv6_filter_flags {
6712da4366fSEmmanuel Grumbach 	SAP_ICMPV6_FILTER_ENABLED	= BIT(0),
6722da4366fSEmmanuel Grumbach 	SAP_ICMPV6_FILTER_COPY		= BIT(1),
6732da4366fSEmmanuel Grumbach };
6742da4366fSEmmanuel Grumbach 
6752da4366fSEmmanuel Grumbach /**
6762da4366fSEmmanuel Grumbach  * enum iwl_sap_vlan_filter_flags -
6772da4366fSEmmanuel Grumbach  * @SAP_VLAN_FILTER_VLAN_ID_MSK: TBD
6782da4366fSEmmanuel Grumbach  * @SAP_VLAN_FILTER_ENABLED: If false, the filter should be ignored.
6792da4366fSEmmanuel Grumbach  */
6802da4366fSEmmanuel Grumbach enum iwl_sap_vlan_filter_flags {
6812da4366fSEmmanuel Grumbach 	SAP_VLAN_FILTER_VLAN_ID_MSK	= 0x0FFF,
6822da4366fSEmmanuel Grumbach 	SAP_VLAN_FILTER_ENABLED		= BIT(15),
6832da4366fSEmmanuel Grumbach };
6842da4366fSEmmanuel Grumbach 
6852da4366fSEmmanuel Grumbach /**
6862da4366fSEmmanuel Grumbach  * struct iwl_sap_oob_filters - Out of band filters (for RX only)
6872da4366fSEmmanuel Grumbach  * @flex_filters: Array of &struct iwl_sap_flex_filter.
6882da4366fSEmmanuel Grumbach  * @icmpv6_flags: See &enum iwl_sap_icmpv6_filter_flags.
6892da4366fSEmmanuel Grumbach  * @ipv6_filters: Array of &struct iwl_sap_ipv6_filter.
6902da4366fSEmmanuel Grumbach  * @eth_filters: Array of &struct iwl_sap_eth_filter.
6912da4366fSEmmanuel Grumbach  * @reserved: For alignment.
6922da4366fSEmmanuel Grumbach  * @ipv4_filter: &struct iwl_sap_ipv4_filter.
6932da4366fSEmmanuel Grumbach  * @vlan: See &enum iwl_sap_vlan_filter_flags.
6942da4366fSEmmanuel Grumbach  */
6952da4366fSEmmanuel Grumbach struct iwl_sap_oob_filters {
6962da4366fSEmmanuel Grumbach 	struct iwl_sap_flex_filter flex_filters[14];
6972da4366fSEmmanuel Grumbach 	__le32 icmpv6_flags;
6982da4366fSEmmanuel Grumbach 	struct iwl_sap_ipv6_filter ipv6_filters[4];
6992da4366fSEmmanuel Grumbach 	struct iwl_sap_eth_filter eth_filters[5];
7002da4366fSEmmanuel Grumbach 	u8 reserved;
7012da4366fSEmmanuel Grumbach 	struct iwl_sap_ipv4_filter ipv4_filter;
7022da4366fSEmmanuel Grumbach 	__le16 vlan[4];
7032da4366fSEmmanuel Grumbach } __packed;
7042da4366fSEmmanuel Grumbach 
7052da4366fSEmmanuel Grumbach /**
7062da4366fSEmmanuel Grumbach  * struct iwl_sap_csme_filters - payload of %SAP_MSG_NOTIF_CSME_FILTERS
7072da4366fSEmmanuel Grumbach  * @hdr: The SAP header.
7082da4366fSEmmanuel Grumbach  * @mode: Not used.
7092da4366fSEmmanuel Grumbach  * @mac_address: Not used.
7102da4366fSEmmanuel Grumbach  * @reserved: For alignment.
7112da4366fSEmmanuel Grumbach  * @cbfilters: Not used.
7122da4366fSEmmanuel Grumbach  * @filters: Out of band filters.
7132da4366fSEmmanuel Grumbach  */
7142da4366fSEmmanuel Grumbach struct iwl_sap_csme_filters {
7152da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
7162da4366fSEmmanuel Grumbach 	__le32 mode;
7172da4366fSEmmanuel Grumbach 	u8 mac_address[6];
7182da4366fSEmmanuel Grumbach 	__le16 reserved;
7192da4366fSEmmanuel Grumbach 	u8 cbfilters[1728];
7202da4366fSEmmanuel Grumbach 	struct iwl_sap_oob_filters filters;
7212da4366fSEmmanuel Grumbach } __packed;
7222da4366fSEmmanuel Grumbach 
7232da4366fSEmmanuel Grumbach #define CB_TX_DHCP_FILT_IDX 30
7242da4366fSEmmanuel Grumbach /**
7252da4366fSEmmanuel Grumbach  * struct iwl_sap_cb_data - header to be added for transmitted packets.
7262da4366fSEmmanuel Grumbach  * @hdr: The SAP header.
7272da4366fSEmmanuel Grumbach  * @reserved: Not used.
7282da4366fSEmmanuel Grumbach  * @to_me_filt_status: The filter that matches. Bit %CB_TX_DHCP_FILT_IDX should
7292da4366fSEmmanuel Grumbach  *	be set for DHCP (the only packet that uses this header).
7302da4366fSEmmanuel Grumbach  * @reserved2: Not used.
7312da4366fSEmmanuel Grumbach  * @data_len: The length of the payload.
7322da4366fSEmmanuel Grumbach  * @payload: The payload of the transmitted packet.
7332da4366fSEmmanuel Grumbach  */
7342da4366fSEmmanuel Grumbach struct iwl_sap_cb_data {
7352da4366fSEmmanuel Grumbach 	struct iwl_sap_hdr hdr;
7362da4366fSEmmanuel Grumbach 	__le32 reserved[7];
7372da4366fSEmmanuel Grumbach 	__le32 to_me_filt_status;
7382da4366fSEmmanuel Grumbach 	__le32 reserved2;
7392da4366fSEmmanuel Grumbach 	__le32 data_len;
7402da4366fSEmmanuel Grumbach 	u8 payload[];
7412da4366fSEmmanuel Grumbach };
7422da4366fSEmmanuel Grumbach 
743733eb54fSAvraham Stern /**
744733eb54fSAvraham Stern  * struct iwl_sap_pldr_data - payload of %SAP_MSG_NOTIF_PLDR
745733eb54fSAvraham Stern  * @hdr: The SAP header.
746733eb54fSAvraham Stern  * @version: SAP message version
747733eb54fSAvraham Stern  */
748733eb54fSAvraham Stern struct iwl_sap_pldr_data {
749733eb54fSAvraham Stern 	struct iwl_sap_hdr hdr;
750733eb54fSAvraham Stern 	__le32 version;
751733eb54fSAvraham Stern } __packed;
752733eb54fSAvraham Stern 
753733eb54fSAvraham Stern /**
754733eb54fSAvraham Stern  * enum iwl_sap_pldr_status -
755733eb54fSAvraham Stern  * @SAP_PLDR_STATUS_SUCCESS: PLDR started/ended successfully
756733eb54fSAvraham Stern  * @SAP_PLDR_STATUS_FAILURE: PLDR failed to start/end
757733eb54fSAvraham Stern  */
758733eb54fSAvraham Stern enum iwl_sap_pldr_status {
759733eb54fSAvraham Stern 	SAP_PLDR_STATUS_SUCCESS	= 0,
760733eb54fSAvraham Stern 	SAP_PLDR_STATUS_FAILURE	= 1,
761733eb54fSAvraham Stern };
762733eb54fSAvraham Stern 
763733eb54fSAvraham Stern /*
764733eb54fSAvraham Stern  * struct iwl_sap_pldr_end_data - payload of %SAP_MSG_NOTIF_PLDR_END
765733eb54fSAvraham Stern  * @hdr: The SAP header.
766733eb54fSAvraham Stern  * @version: SAP message version
767733eb54fSAvraham Stern  * @status: PLDR end status
768733eb54fSAvraham Stern  */
769733eb54fSAvraham Stern struct iwl_sap_pldr_end_data {
770733eb54fSAvraham Stern 	struct iwl_sap_hdr hdr;
771733eb54fSAvraham Stern 	__le32 version;
772733eb54fSAvraham Stern 	__le32 status;
773733eb54fSAvraham Stern } __packed;
774733eb54fSAvraham Stern 
775733eb54fSAvraham Stern /*
776733eb54fSAvraham Stern  * struct iwl_sap_pldr_ack_data - payload of %SAP_MSG_NOTIF_PLDR_ACK
777733eb54fSAvraham Stern  * @version: SAP message version
778733eb54fSAvraham Stern  * @status: CSME accept/refuse to the PLDR request
779733eb54fSAvraham Stern  */
780733eb54fSAvraham Stern struct iwl_sap_pldr_ack_data {
781733eb54fSAvraham Stern 	struct iwl_sap_hdr hdr;
782733eb54fSAvraham Stern 	__le32 version;
783733eb54fSAvraham Stern 	__le32 status;
784733eb54fSAvraham Stern } __packed;
785733eb54fSAvraham Stern 
7862da4366fSEmmanuel Grumbach #endif /* __sap_h__ */
787