162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2021 - 2022 Intel Corporation
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __sap_h__
762306a36Sopenharmony_ci#define __sap_h__
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include "mei/iwl-mei.h"
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/**
1262306a36Sopenharmony_ci * DOC: Introduction
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * SAP is the protocol used by the Intel Wireless driver (iwlwifi)
1562306a36Sopenharmony_ci * and the wireless driver implemented in the CSME firmware.
1662306a36Sopenharmony_ci * It allows to do several things:
1762306a36Sopenharmony_ci * 1) Decide who is the owner of the device: CSME or the host
1862306a36Sopenharmony_ci * 2) When the host is the owner of the device, CSME can still
1962306a36Sopenharmony_ci * send and receive packets through iwlwifi.
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci * The protocol uses the ME interface (mei driver) to send
2262306a36Sopenharmony_ci * messages to the CSME firmware. Those messages have a header
2362306a36Sopenharmony_ci * &struct iwl_sap_me_msg_hdr and this header is followed
2462306a36Sopenharmony_ci * by a payload.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci * Since this messaging system cannot support high amounts of
2762306a36Sopenharmony_ci * traffic, iwlwifi and the CSME firmware's WLAN driver have an
2862306a36Sopenharmony_ci * additional communication pipe to exchange information. The body
2962306a36Sopenharmony_ci * of the message is copied to a shared area and the message that
3062306a36Sopenharmony_ci * goes over the ME interface just signals the other side
3162306a36Sopenharmony_ci * that a new message is waiting in the shared area. The ME
3262306a36Sopenharmony_ci * interface is used only for signaling and not to transfer
3362306a36Sopenharmony_ci * the payload.
3462306a36Sopenharmony_ci *
3562306a36Sopenharmony_ci * This shared area of memory is DMA'able mapped to be
3662306a36Sopenharmony_ci * writable by both the CSME firmware and iwlwifi. It is
3762306a36Sopenharmony_ci * mapped to address space of the device that controls the ME
3862306a36Sopenharmony_ci * interface's DMA engine. Any data that iwlwifi needs to
3962306a36Sopenharmony_ci * send to the CSME firmware needs to be copied to there.
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/**
4362306a36Sopenharmony_ci * DOC: Initial Handshake
4462306a36Sopenharmony_ci *
4562306a36Sopenharmony_ci * Once we get a link to the CMSE's WLAN driver we start the handshake
4662306a36Sopenharmony_ci * to establish the shared memory that will allow the communication between
4762306a36Sopenharmony_ci * the CSME's WLAN driver and the host.
4862306a36Sopenharmony_ci *
4962306a36Sopenharmony_ci * 1) Host sends %SAP_ME_MSG_START message with the physical address
5062306a36Sopenharmony_ci * of the shared area.
5162306a36Sopenharmony_ci * 2) CSME replies with %SAP_ME_MSG_START_OK which includes the versions
5262306a36Sopenharmony_ci * protocol versions supported by CSME.
5362306a36Sopenharmony_ci */
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci/**
5662306a36Sopenharmony_ci * DOC: Host and driver state messages
5762306a36Sopenharmony_ci *
5862306a36Sopenharmony_ci * In order to let CSME know about the host state and the host driver state,
5962306a36Sopenharmony_ci * the host sends messages that let CSME know about the host's state.
6062306a36Sopenharmony_ci * When the host driver is loaded, the host sends %SAP_MSG_NOTIF_WIFIDR_UP.
6162306a36Sopenharmony_ci * When the host driver is unloaded, the host sends %SAP_MSG_NOTIF_WIFIDR_DOWN.
6262306a36Sopenharmony_ci * When the iwlmei is unloaded, %SAP_MSG_NOTIF_HOST_GOES_DOWN is sent to let
6362306a36Sopenharmony_ci * CSME know not to access the shared memory anymore since it'll be freed.
6462306a36Sopenharmony_ci *
6562306a36Sopenharmony_ci * CSME will reply to SAP_MSG_NOTIF_WIFIDR_UP by
6662306a36Sopenharmony_ci * %SAP_MSG_NOTIF_AMT_STATE to let the host driver whether CSME can use the
6762306a36Sopenharmony_ci * WiFi device or not followed by %SAP_MSG_NOTIF_CSME_CONN_STATUS to inform
6862306a36Sopenharmony_ci * the host driver on the connection state of CSME.
6962306a36Sopenharmony_ci *
7062306a36Sopenharmony_ci * When host is associated to an AP, it must send %SAP_MSG_NOTIF_HOST_LINK_UP
7162306a36Sopenharmony_ci * and when it disconnect from the AP, it must send
7262306a36Sopenharmony_ci * %SAP_MSG_NOTIF_HOST_LINK_DOWN.
7362306a36Sopenharmony_ci */
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/**
7662306a36Sopenharmony_ci * DOC: Ownership
7762306a36Sopenharmony_ci *
7862306a36Sopenharmony_ci * The device can be controlled either by the CSME firmware or
7962306a36Sopenharmony_ci * by the host driver: iwlwifi. There is a negotiation between
8062306a36Sopenharmony_ci * those two entities to determine who controls (or owns) the
8162306a36Sopenharmony_ci * device. Since the CSME can control the device even when the
8262306a36Sopenharmony_ci * OS is not working or even missing, the CSME can request the
8362306a36Sopenharmony_ci * device if it comes to the conclusion that the OS's host driver
8462306a36Sopenharmony_ci * is not operational. This is why the host driver needs to
8562306a36Sopenharmony_ci * signal CSME that it is up and running. If the driver is
8662306a36Sopenharmony_ci * unloaded, it'll signal CSME that it is going down so that
8762306a36Sopenharmony_ci * CSME can take ownership.
8862306a36Sopenharmony_ci */
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci/**
9162306a36Sopenharmony_ci * DOC: Ownership transfer
9262306a36Sopenharmony_ci *
9362306a36Sopenharmony_ci * When the host driver needs the device, it'll send the
9462306a36Sopenharmony_ci * %SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP that will be replied by
9562306a36Sopenharmony_ci * %SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ which will let the
9662306a36Sopenharmony_ci * host know whether the ownership is granted or no. If the ownership is
9762306a36Sopenharmony_ci * granted, the hosts sends %SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED.
9862306a36Sopenharmony_ci *
9962306a36Sopenharmony_ci * When CSME requests ownership, it'll send the
10062306a36Sopenharmony_ci * %SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP and give some time to host to stop
10162306a36Sopenharmony_ci * accessing the device. The host needs to send
10262306a36Sopenharmony_ci * %SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED to confirm that it won't access
10362306a36Sopenharmony_ci * the device anymore. If the host failed to send this message fast enough,
10462306a36Sopenharmony_ci * CSME will take ownership on the device anyway.
10562306a36Sopenharmony_ci * When CSME is willing to release the ownership, it'll send
10662306a36Sopenharmony_ci * %SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP.
10762306a36Sopenharmony_ci */
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci/**
11062306a36Sopenharmony_ci * DOC: Data messages
11162306a36Sopenharmony_ci *
11262306a36Sopenharmony_ci * Data messages must be sent and receives on a separate queue in the shared
11362306a36Sopenharmony_ci * memory. Almost all the data messages use the %SAP_MSG_DATA_PACKET for both
11462306a36Sopenharmony_ci * packets sent by CSME to the host to be sent to the AP or for packets
11562306a36Sopenharmony_ci * received from the AP and sent by the host to CSME.
11662306a36Sopenharmony_ci * CSME sends filters to the host to let the host what inbound packets it must
11762306a36Sopenharmony_ci * send to CSME. Those filters are received by the host as a
11862306a36Sopenharmony_ci * %SAP_MSG_NOTIF_CSME_FILTERS command.
11962306a36Sopenharmony_ci * The only outbound packets that must be sent to CSME are the DHCP packets.
12062306a36Sopenharmony_ci * Those packets must use the %SAP_MSG_CB_DATA_PACKET message.
12162306a36Sopenharmony_ci */
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/**
12462306a36Sopenharmony_ci * enum iwl_sap_me_msg_id - the ID of the ME message
12562306a36Sopenharmony_ci * @SAP_ME_MSG_START: See &struct iwl_sap_me_msg_start.
12662306a36Sopenharmony_ci * @SAP_ME_MSG_START_OK: See &struct iwl_sap_me_msg_start_ok.
12762306a36Sopenharmony_ci * @SAP_ME_MSG_CHECK_SHARED_AREA: This message has no payload.
12862306a36Sopenharmony_ci */
12962306a36Sopenharmony_cienum iwl_sap_me_msg_id {
13062306a36Sopenharmony_ci	SAP_ME_MSG_START	= 1,
13162306a36Sopenharmony_ci	SAP_ME_MSG_START_OK,
13262306a36Sopenharmony_ci	SAP_ME_MSG_CHECK_SHARED_AREA,
13362306a36Sopenharmony_ci};
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci/**
13662306a36Sopenharmony_ci * struct iwl_sap_me_msg_hdr - the header of the ME message
13762306a36Sopenharmony_ci * @type: the type of the message, see &enum iwl_sap_me_msg_id.
13862306a36Sopenharmony_ci * @seq_num: a sequence number used for debug only.
13962306a36Sopenharmony_ci * @len: the length of the message.
14062306a36Sopenharmony_ci */
14162306a36Sopenharmony_cistruct iwl_sap_me_msg_hdr {
14262306a36Sopenharmony_ci	__le32 type;
14362306a36Sopenharmony_ci	__le32 seq_num;
14462306a36Sopenharmony_ci	__le32 len;
14562306a36Sopenharmony_ci} __packed;
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci/**
14862306a36Sopenharmony_ci * struct iwl_sap_me_msg_start - used for the %SAP_ME_MSG_START message
14962306a36Sopenharmony_ci * @hdr: See &struct iwl_sap_me_msg_hdr.
15062306a36Sopenharmony_ci * @shared_mem: physical address of SAP shared memory area.
15162306a36Sopenharmony_ci * @init_data_seq_num: seq_num of the first data packet HOST -> CSME.
15262306a36Sopenharmony_ci * @init_notif_seq_num: seq_num of the first notification HOST -> CSME.
15362306a36Sopenharmony_ci * @supported_versions: The host sends to the CSME a zero-terminated array
15462306a36Sopenharmony_ci * of versions its supports.
15562306a36Sopenharmony_ci *
15662306a36Sopenharmony_ci * This message is sent by the host to CSME and will responded by the
15762306a36Sopenharmony_ci * %SAP_ME_MSG_START_OK message.
15862306a36Sopenharmony_ci */
15962306a36Sopenharmony_cistruct iwl_sap_me_msg_start {
16062306a36Sopenharmony_ci	struct iwl_sap_me_msg_hdr hdr;
16162306a36Sopenharmony_ci	__le64 shared_mem;
16262306a36Sopenharmony_ci	__le16 init_data_seq_num;
16362306a36Sopenharmony_ci	__le16 init_notif_seq_num;
16462306a36Sopenharmony_ci	u8 supported_versions[64];
16562306a36Sopenharmony_ci} __packed;
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci/**
16862306a36Sopenharmony_ci * struct iwl_sap_me_msg_start_ok - used for the %SAP_ME_MSG_START_OK
16962306a36Sopenharmony_ci * @hdr: See &struct iwl_sap_me_msg_hdr
17062306a36Sopenharmony_ci * @init_data_seq_num: Not used.
17162306a36Sopenharmony_ci * @init_notif_seq_num: Not used
17262306a36Sopenharmony_ci * @supported_version: The version that will be used.
17362306a36Sopenharmony_ci * @reserved: For alignment.
17462306a36Sopenharmony_ci *
17562306a36Sopenharmony_ci * This message is sent by CSME to the host in response to the
17662306a36Sopenharmony_ci * %SAP_ME_MSG_START message.
17762306a36Sopenharmony_ci */
17862306a36Sopenharmony_cistruct iwl_sap_me_msg_start_ok {
17962306a36Sopenharmony_ci	struct iwl_sap_me_msg_hdr hdr;
18062306a36Sopenharmony_ci	__le16 init_data_seq_num;
18162306a36Sopenharmony_ci	__le16 init_notif_seq_num;
18262306a36Sopenharmony_ci	u8 supported_version;
18362306a36Sopenharmony_ci	u8 reserved[3];
18462306a36Sopenharmony_ci} __packed;
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci/**
18762306a36Sopenharmony_ci * enum iwl_sap_msg - SAP messages
18862306a36Sopenharmony_ci * @SAP_MSG_NOTIF_BOTH_WAYS_MIN: Not used.
18962306a36Sopenharmony_ci * @SAP_MSG_NOTIF_PING: No payload. Solicitate a response message (check-alive).
19062306a36Sopenharmony_ci * @SAP_MSG_NOTIF_PONG: No payload. The response message.
19162306a36Sopenharmony_ci * @SAP_MSG_NOTIF_BOTH_WAYS_MAX: Not used.
19262306a36Sopenharmony_ci *
19362306a36Sopenharmony_ci * @SAP_MSG_NOTIF_FROM_CSME_MIN: Not used.
19462306a36Sopenharmony_ci * @SAP_MSG_NOTIF_CSME_FILTERS: TODO
19562306a36Sopenharmony_ci * @SAP_MSG_NOTIF_AMT_STATE: Payload is a DW. Any non-zero value means
19662306a36Sopenharmony_ci *	that CSME is enabled.
19762306a36Sopenharmony_ci * @SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ: Payload is a DW. 0 means
19862306a36Sopenharmony_ci *	the host will not get ownership. Any other value means the host is
19962306a36Sopenharmony_ci *	the owner.
20062306a36Sopenharmony_ci * @SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP: No payload.
20162306a36Sopenharmony_ci * @SAP_MSG_NOTIF_TRIGGER_IP_REFRESH: No payload.
20262306a36Sopenharmony_ci * @SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP: No payload.
20362306a36Sopenharmony_ci * @SAP_MSG_NOTIF_NIC_OWNER: Payload is a DW. See &enum iwl_sap_nic_owner.
20462306a36Sopenharmony_ci * @SAP_MSG_NOTIF_CSME_CONN_STATUS: See &struct iwl_sap_notif_conn_status.
20562306a36Sopenharmony_ci * @SAP_MSG_NOTIF_NVM: See &struct iwl_sap_nvm.
20662306a36Sopenharmony_ci * @SAP_MSG_NOTIF_PLDR_ACK: See &struct iwl_sap_pldr_ack_data.
20762306a36Sopenharmony_ci * @SAP_MSG_NOTIF_FROM_CSME_MAX: Not used.
20862306a36Sopenharmony_ci *
20962306a36Sopenharmony_ci * @SAP_MSG_NOTIF_FROM_HOST_MIN: Not used.
21062306a36Sopenharmony_ci * @SAP_MSG_NOTIF_BAND_SELECTION: TODO
21162306a36Sopenharmony_ci * @SAP_MSG_NOTIF_RADIO_STATE: Payload is a DW.
21262306a36Sopenharmony_ci *	See &enum iwl_sap_radio_state_bitmap.
21362306a36Sopenharmony_ci * @SAP_MSG_NOTIF_NIC_INFO: See &struct iwl_sap_notif_host_nic_info.
21462306a36Sopenharmony_ci * @SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP: No payload.
21562306a36Sopenharmony_ci * @SAP_MSG_NOTIF_HOST_SUSPENDS: Payload is a DW. Bitmap described in
21662306a36Sopenharmony_ci *	&enum iwl_sap_notif_host_suspends_bitmap.
21762306a36Sopenharmony_ci * @SAP_MSG_NOTIF_HOST_RESUMES: Payload is a DW. 0 or 1. 1 says that
21862306a36Sopenharmony_ci *	the CSME should re-initialize the init control block.
21962306a36Sopenharmony_ci * @SAP_MSG_NOTIF_HOST_GOES_DOWN: No payload.
22062306a36Sopenharmony_ci * @SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED: No payload.
22162306a36Sopenharmony_ci * @SAP_MSG_NOTIF_COUNTRY_CODE: See &struct iwl_sap_notif_country_code.
22262306a36Sopenharmony_ci * @SAP_MSG_NOTIF_HOST_LINK_UP: See &struct iwl_sap_notif_host_link_up.
22362306a36Sopenharmony_ci * @SAP_MSG_NOTIF_HOST_LINK_DOWN: See &struct iwl_sap_notif_host_link_down.
22462306a36Sopenharmony_ci * @SAP_MSG_NOTIF_WHO_OWNS_NIC: No payload.
22562306a36Sopenharmony_ci * @SAP_MSG_NOTIF_WIFIDR_DOWN: No payload.
22662306a36Sopenharmony_ci * @SAP_MSG_NOTIF_WIFIDR_UP: No payload.
22762306a36Sopenharmony_ci * @SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED: No payload.
22862306a36Sopenharmony_ci * @SAP_MSG_NOTIF_SAR_LIMITS: See &struct iwl_sap_notif_sar_limits.
22962306a36Sopenharmony_ci * @SAP_MSG_NOTIF_GET_NVM: No payload. Triggers %SAP_MSG_NOTIF_NVM.
23062306a36Sopenharmony_ci * @SAP_MSG_NOTIF_PLDR: See &struct iwl_sap_pldr_data.
23162306a36Sopenharmony_ci * @SAP_MSG_NOTIF_PLDR_END: See &struct iwl_sap_pldr_end_data.
23262306a36Sopenharmony_ci * @SAP_MSG_NOTIF_FROM_HOST_MAX: Not used.
23362306a36Sopenharmony_ci *
23462306a36Sopenharmony_ci * @SAP_MSG_DATA_MIN: Not used.
23562306a36Sopenharmony_ci * @SAP_MSG_DATA_PACKET: Packets that passed the filters defined by
23662306a36Sopenharmony_ci *	%SAP_MSG_NOTIF_CSME_FILTERS. The payload is &struct iwl_sap_hdr with
23762306a36Sopenharmony_ci *	the payload of the packet immediately afterwards.
23862306a36Sopenharmony_ci * @SAP_MSG_CB_DATA_PACKET: Indicates to CSME that we transmitted a specific
23962306a36Sopenharmony_ci *	packet. Used only for DHCP transmitted packets. See
24062306a36Sopenharmony_ci *	&struct iwl_sap_cb_data.
24162306a36Sopenharmony_ci * @SAP_MSG_DATA_MAX: Not used.
24262306a36Sopenharmony_ci */
24362306a36Sopenharmony_cienum iwl_sap_msg {
24462306a36Sopenharmony_ci	SAP_MSG_NOTIF_BOTH_WAYS_MIN			= 0,
24562306a36Sopenharmony_ci	SAP_MSG_NOTIF_PING				= 1,
24662306a36Sopenharmony_ci	SAP_MSG_NOTIF_PONG				= 2,
24762306a36Sopenharmony_ci	SAP_MSG_NOTIF_BOTH_WAYS_MAX,
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci	SAP_MSG_NOTIF_FROM_CSME_MIN			= 500,
25062306a36Sopenharmony_ci	SAP_MSG_NOTIF_CSME_FILTERS			= SAP_MSG_NOTIF_FROM_CSME_MIN,
25162306a36Sopenharmony_ci	/* 501 is deprecated */
25262306a36Sopenharmony_ci	SAP_MSG_NOTIF_AMT_STATE				= 502,
25362306a36Sopenharmony_ci	SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ	= 503,
25462306a36Sopenharmony_ci	SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP		= 504,
25562306a36Sopenharmony_ci	SAP_MSG_NOTIF_TRIGGER_IP_REFRESH		= 505,
25662306a36Sopenharmony_ci	SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP	= 506,
25762306a36Sopenharmony_ci	/* 507 is deprecated */
25862306a36Sopenharmony_ci	/* 508 is deprecated */
25962306a36Sopenharmony_ci	/* 509 is deprecated */
26062306a36Sopenharmony_ci	/* 510 is deprecated */
26162306a36Sopenharmony_ci	SAP_MSG_NOTIF_NIC_OWNER				= 511,
26262306a36Sopenharmony_ci	SAP_MSG_NOTIF_CSME_CONN_STATUS			= 512,
26362306a36Sopenharmony_ci	SAP_MSG_NOTIF_NVM				= 513,
26462306a36Sopenharmony_ci	/* 514 - 517 not supported */
26562306a36Sopenharmony_ci	SAP_MSG_NOTIF_PLDR_ACK				= 518,
26662306a36Sopenharmony_ci	SAP_MSG_NOTIF_FROM_CSME_MAX,
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci	SAP_MSG_NOTIF_FROM_HOST_MIN			= 1000,
26962306a36Sopenharmony_ci	SAP_MSG_NOTIF_BAND_SELECTION			= SAP_MSG_NOTIF_FROM_HOST_MIN,
27062306a36Sopenharmony_ci	SAP_MSG_NOTIF_RADIO_STATE			= 1001,
27162306a36Sopenharmony_ci	SAP_MSG_NOTIF_NIC_INFO				= 1002,
27262306a36Sopenharmony_ci	SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP	= 1003,
27362306a36Sopenharmony_ci	SAP_MSG_NOTIF_HOST_SUSPENDS			= 1004,
27462306a36Sopenharmony_ci	SAP_MSG_NOTIF_HOST_RESUMES			= 1005,
27562306a36Sopenharmony_ci	SAP_MSG_NOTIF_HOST_GOES_DOWN			= 1006,
27662306a36Sopenharmony_ci	SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED		= 1007,
27762306a36Sopenharmony_ci	SAP_MSG_NOTIF_COUNTRY_CODE			= 1008,
27862306a36Sopenharmony_ci	SAP_MSG_NOTIF_HOST_LINK_UP			= 1009,
27962306a36Sopenharmony_ci	SAP_MSG_NOTIF_HOST_LINK_DOWN			= 1010,
28062306a36Sopenharmony_ci	SAP_MSG_NOTIF_WHO_OWNS_NIC			= 1011,
28162306a36Sopenharmony_ci	SAP_MSG_NOTIF_WIFIDR_DOWN			= 1012,
28262306a36Sopenharmony_ci	SAP_MSG_NOTIF_WIFIDR_UP				= 1013,
28362306a36Sopenharmony_ci	/* 1014 is deprecated */
28462306a36Sopenharmony_ci	SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED		= 1015,
28562306a36Sopenharmony_ci	SAP_MSG_NOTIF_SAR_LIMITS			= 1016,
28662306a36Sopenharmony_ci	SAP_MSG_NOTIF_GET_NVM				= 1017,
28762306a36Sopenharmony_ci	/* 1018 - 1023 not supported */
28862306a36Sopenharmony_ci	SAP_MSG_NOTIF_PLDR				= 1024,
28962306a36Sopenharmony_ci	SAP_MSG_NOTIF_PLDR_END				= 1025,
29062306a36Sopenharmony_ci	SAP_MSG_NOTIF_FROM_HOST_MAX,
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci	SAP_MSG_DATA_MIN				= 2000,
29362306a36Sopenharmony_ci	SAP_MSG_DATA_PACKET				= SAP_MSG_DATA_MIN,
29462306a36Sopenharmony_ci	SAP_MSG_CB_DATA_PACKET				= 2001,
29562306a36Sopenharmony_ci	SAP_MSG_DATA_MAX,
29662306a36Sopenharmony_ci};
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci/**
29962306a36Sopenharmony_ci * struct iwl_sap_hdr - prefixes any SAP message
30062306a36Sopenharmony_ci * @type: See &enum iwl_sap_msg.
30162306a36Sopenharmony_ci * @len: The length of the message (header not included).
30262306a36Sopenharmony_ci * @seq_num: For debug.
30362306a36Sopenharmony_ci * @payload: The payload of the message.
30462306a36Sopenharmony_ci */
30562306a36Sopenharmony_cistruct iwl_sap_hdr {
30662306a36Sopenharmony_ci	__le16 type;
30762306a36Sopenharmony_ci	__le16 len;
30862306a36Sopenharmony_ci	__le32 seq_num;
30962306a36Sopenharmony_ci	u8 payload[];
31062306a36Sopenharmony_ci};
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci/**
31362306a36Sopenharmony_ci * struct iwl_sap_msg_dw - suits any DW long SAP message
31462306a36Sopenharmony_ci * @hdr: The SAP header
31562306a36Sopenharmony_ci * @val: The value of the DW.
31662306a36Sopenharmony_ci */
31762306a36Sopenharmony_cistruct iwl_sap_msg_dw {
31862306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
31962306a36Sopenharmony_ci	__le32 val;
32062306a36Sopenharmony_ci};
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci/**
32362306a36Sopenharmony_ci * enum iwl_sap_nic_owner - used by %SAP_MSG_NOTIF_NIC_OWNER
32462306a36Sopenharmony_ci * @SAP_NIC_OWNER_UNKNOWN: Not used.
32562306a36Sopenharmony_ci * @SAP_NIC_OWNER_HOST: The host owns the NIC.
32662306a36Sopenharmony_ci * @SAP_NIC_OWNER_ME: CSME owns the NIC.
32762306a36Sopenharmony_ci */
32862306a36Sopenharmony_cienum iwl_sap_nic_owner {
32962306a36Sopenharmony_ci	SAP_NIC_OWNER_UNKNOWN,
33062306a36Sopenharmony_ci	SAP_NIC_OWNER_HOST,
33162306a36Sopenharmony_ci	SAP_NIC_OWNER_ME,
33262306a36Sopenharmony_ci};
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_cienum iwl_sap_wifi_auth_type {
33562306a36Sopenharmony_ci	SAP_WIFI_AUTH_TYPE_OPEN		= IWL_MEI_AKM_AUTH_OPEN,
33662306a36Sopenharmony_ci	SAP_WIFI_AUTH_TYPE_RSNA		= IWL_MEI_AKM_AUTH_RSNA,
33762306a36Sopenharmony_ci	SAP_WIFI_AUTH_TYPE_RSNA_PSK	= IWL_MEI_AKM_AUTH_RSNA_PSK,
33862306a36Sopenharmony_ci	SAP_WIFI_AUTH_TYPE_SAE		= IWL_MEI_AKM_AUTH_SAE,
33962306a36Sopenharmony_ci	SAP_WIFI_AUTH_TYPE_MAX,
34062306a36Sopenharmony_ci};
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci/**
34362306a36Sopenharmony_ci * enum iwl_sap_wifi_cipher_alg
34462306a36Sopenharmony_ci * @SAP_WIFI_CIPHER_ALG_NONE: TBD
34562306a36Sopenharmony_ci * @SAP_WIFI_CIPHER_ALG_TKIP: TBD
34662306a36Sopenharmony_ci * @SAP_WIFI_CIPHER_ALG_CCMP: TBD
34762306a36Sopenharmony_ci * @SAP_WIFI_CIPHER_ALG_GCMP: TBD
34862306a36Sopenharmony_ci * @SAP_WIFI_CIPHER_ALG_GCMP_256: TBD
34962306a36Sopenharmony_ci */
35062306a36Sopenharmony_cienum iwl_sap_wifi_cipher_alg {
35162306a36Sopenharmony_ci	SAP_WIFI_CIPHER_ALG_NONE	= IWL_MEI_CIPHER_NONE,
35262306a36Sopenharmony_ci	SAP_WIFI_CIPHER_ALG_TKIP	= IWL_MEI_CIPHER_TKIP,
35362306a36Sopenharmony_ci	SAP_WIFI_CIPHER_ALG_CCMP	= IWL_MEI_CIPHER_CCMP,
35462306a36Sopenharmony_ci	SAP_WIFI_CIPHER_ALG_GCMP	= IWL_MEI_CIPHER_GCMP,
35562306a36Sopenharmony_ci	SAP_WIFI_CIPHER_ALG_GCMP_256	= IWL_MEI_CIPHER_GCMP_256,
35662306a36Sopenharmony_ci};
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ci/**
35962306a36Sopenharmony_ci * struct iwl_sap_notif_connection_info - nested in other structures
36062306a36Sopenharmony_ci * @ssid_len: The length of the SSID.
36162306a36Sopenharmony_ci * @ssid: The SSID.
36262306a36Sopenharmony_ci * @auth_mode: The authentication mode. See &enum iwl_sap_wifi_auth_type.
36362306a36Sopenharmony_ci * @pairwise_cipher: The cipher used for unicast packets.
36462306a36Sopenharmony_ci *	See &enum iwl_sap_wifi_cipher_alg.
36562306a36Sopenharmony_ci * @channel: The channel on which we are associated.
36662306a36Sopenharmony_ci * @band: The band on which we are associated.
36762306a36Sopenharmony_ci * @reserved: For alignment.
36862306a36Sopenharmony_ci * @bssid: The BSSID.
36962306a36Sopenharmony_ci * @reserved1: For alignment.
37062306a36Sopenharmony_ci */
37162306a36Sopenharmony_cistruct iwl_sap_notif_connection_info {
37262306a36Sopenharmony_ci	__le32 ssid_len;
37362306a36Sopenharmony_ci	u8 ssid[32];
37462306a36Sopenharmony_ci	__le32 auth_mode;
37562306a36Sopenharmony_ci	__le32 pairwise_cipher;
37662306a36Sopenharmony_ci	u8 channel;
37762306a36Sopenharmony_ci	u8 band;
37862306a36Sopenharmony_ci	__le16 reserved;
37962306a36Sopenharmony_ci	u8 bssid[6];
38062306a36Sopenharmony_ci	__le16 reserved1;
38162306a36Sopenharmony_ci} __packed;
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/**
38462306a36Sopenharmony_ci * enum iwl_sap_scan_request - for the scan_request field
38562306a36Sopenharmony_ci * @SCAN_REQUEST_FILTERING: Filtering is requested.
38662306a36Sopenharmony_ci * @SCAN_REQUEST_FAST: Fast scan is requested.
38762306a36Sopenharmony_ci */
38862306a36Sopenharmony_cienum iwl_sap_scan_request {
38962306a36Sopenharmony_ci	SCAN_REQUEST_FILTERING	= 1 << 0,
39062306a36Sopenharmony_ci	SCAN_REQUEST_FAST	= 1 << 1,
39162306a36Sopenharmony_ci};
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci/**
39462306a36Sopenharmony_ci * struct iwl_sap_notif_conn_status - payload of %SAP_MSG_NOTIF_CSME_CONN_STATUS
39562306a36Sopenharmony_ci * @hdr: The SAP header
39662306a36Sopenharmony_ci * @link_prot_state: Non-zero if link protection is active.
39762306a36Sopenharmony_ci * @scan_request: See &enum iwl_sap_scan_request.
39862306a36Sopenharmony_ci * @conn_info: Information about the connection.
39962306a36Sopenharmony_ci */
40062306a36Sopenharmony_cistruct iwl_sap_notif_conn_status {
40162306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
40262306a36Sopenharmony_ci	__le32 link_prot_state;
40362306a36Sopenharmony_ci	__le32 scan_request;
40462306a36Sopenharmony_ci	struct iwl_sap_notif_connection_info conn_info;
40562306a36Sopenharmony_ci} __packed;
40662306a36Sopenharmony_ci
40762306a36Sopenharmony_ci/**
40862306a36Sopenharmony_ci * enum iwl_sap_radio_state_bitmap - used for %SAP_MSG_NOTIF_RADIO_STATE
40962306a36Sopenharmony_ci * @SAP_SW_RFKILL_DEASSERTED: If set, SW RfKill is de-asserted
41062306a36Sopenharmony_ci * @SAP_HW_RFKILL_DEASSERTED: If set, HW RfKill is de-asserted
41162306a36Sopenharmony_ci *
41262306a36Sopenharmony_ci * If both bits are set, then the radio is on.
41362306a36Sopenharmony_ci */
41462306a36Sopenharmony_cienum iwl_sap_radio_state_bitmap {
41562306a36Sopenharmony_ci	SAP_SW_RFKILL_DEASSERTED	= 1 << 0,
41662306a36Sopenharmony_ci	SAP_HW_RFKILL_DEASSERTED	= 1 << 1,
41762306a36Sopenharmony_ci};
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci/**
42062306a36Sopenharmony_ci * enum iwl_sap_notif_host_suspends_bitmap - used for %SAP_MSG_NOTIF_HOST_SUSPENDS
42162306a36Sopenharmony_ci * @SAP_OFFER_NIC: TBD
42262306a36Sopenharmony_ci * @SAP_FILTER_CONFIGURED: TBD
42362306a36Sopenharmony_ci * @SAP_NLO_CONFIGURED: TBD
42462306a36Sopenharmony_ci * @SAP_HOST_OWNS_NIC: TBD
42562306a36Sopenharmony_ci * @SAP_LINK_PROTECTED: TBD
42662306a36Sopenharmony_ci */
42762306a36Sopenharmony_cienum iwl_sap_notif_host_suspends_bitmap {
42862306a36Sopenharmony_ci	SAP_OFFER_NIC		= 1 << 0,
42962306a36Sopenharmony_ci	SAP_FILTER_CONFIGURED	= 1 << 1,
43062306a36Sopenharmony_ci	SAP_NLO_CONFIGURED	= 1 << 2,
43162306a36Sopenharmony_ci	SAP_HOST_OWNS_NIC	= 1 << 3,
43262306a36Sopenharmony_ci	SAP_LINK_PROTECTED	= 1 << 4,
43362306a36Sopenharmony_ci};
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci/**
43662306a36Sopenharmony_ci * struct iwl_sap_notif_country_code - payload of %SAP_MSG_NOTIF_COUNTRY_CODE
43762306a36Sopenharmony_ci * @hdr: The SAP header
43862306a36Sopenharmony_ci * @mcc: The country code.
43962306a36Sopenharmony_ci * @source_id: TBD
44062306a36Sopenharmony_ci * @reserved: For alignment.
44162306a36Sopenharmony_ci * @diff_time: TBD
44262306a36Sopenharmony_ci */
44362306a36Sopenharmony_cistruct iwl_sap_notif_country_code {
44462306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
44562306a36Sopenharmony_ci	__le16 mcc;
44662306a36Sopenharmony_ci	u8 source_id;
44762306a36Sopenharmony_ci	u8 reserved;
44862306a36Sopenharmony_ci	__le32 diff_time;
44962306a36Sopenharmony_ci} __packed;
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci/**
45262306a36Sopenharmony_ci * struct iwl_sap_notif_host_link_up - payload of %SAP_MSG_NOTIF_HOST_LINK_UP
45362306a36Sopenharmony_ci * @hdr: The SAP header
45462306a36Sopenharmony_ci * @conn_info: Information about the connection.
45562306a36Sopenharmony_ci * @colloc_channel: The collocated channel
45662306a36Sopenharmony_ci * @colloc_band: The band of the collocated channel.
45762306a36Sopenharmony_ci * @reserved: For alignment.
45862306a36Sopenharmony_ci * @colloc_bssid: The collocated BSSID.
45962306a36Sopenharmony_ci * @reserved1: For alignment.
46062306a36Sopenharmony_ci */
46162306a36Sopenharmony_cistruct iwl_sap_notif_host_link_up {
46262306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
46362306a36Sopenharmony_ci	struct iwl_sap_notif_connection_info conn_info;
46462306a36Sopenharmony_ci	u8 colloc_channel;
46562306a36Sopenharmony_ci	u8 colloc_band;
46662306a36Sopenharmony_ci	__le16 reserved;
46762306a36Sopenharmony_ci	u8 colloc_bssid[6];
46862306a36Sopenharmony_ci	__le16 reserved1;
46962306a36Sopenharmony_ci} __packed;
47062306a36Sopenharmony_ci
47162306a36Sopenharmony_ci/**
47262306a36Sopenharmony_ci * enum iwl_sap_notif_link_down_type - used in &struct iwl_sap_notif_host_link_down
47362306a36Sopenharmony_ci * @HOST_LINK_DOWN_TYPE_NONE: TBD
47462306a36Sopenharmony_ci * @HOST_LINK_DOWN_TYPE_TEMPORARY: TBD
47562306a36Sopenharmony_ci * @HOST_LINK_DOWN_TYPE_LONG: TBD
47662306a36Sopenharmony_ci */
47762306a36Sopenharmony_cienum iwl_sap_notif_link_down_type {
47862306a36Sopenharmony_ci	HOST_LINK_DOWN_TYPE_NONE,
47962306a36Sopenharmony_ci	HOST_LINK_DOWN_TYPE_TEMPORARY,
48062306a36Sopenharmony_ci	HOST_LINK_DOWN_TYPE_LONG,
48162306a36Sopenharmony_ci};
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci/**
48462306a36Sopenharmony_ci * struct iwl_sap_notif_host_link_down - payload for %SAP_MSG_NOTIF_HOST_LINK_DOWN
48562306a36Sopenharmony_ci * @hdr: The SAP header
48662306a36Sopenharmony_ci * @type: See &enum iwl_sap_notif_link_down_type.
48762306a36Sopenharmony_ci * @reserved: For alignment.
48862306a36Sopenharmony_ci * @reason_valid: If 0, ignore the next field.
48962306a36Sopenharmony_ci * @reason: The reason of the disconnection.
49062306a36Sopenharmony_ci */
49162306a36Sopenharmony_cistruct iwl_sap_notif_host_link_down {
49262306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
49362306a36Sopenharmony_ci	u8 type;
49462306a36Sopenharmony_ci	u8 reserved[2];
49562306a36Sopenharmony_ci	u8 reason_valid;
49662306a36Sopenharmony_ci	__le32 reason;
49762306a36Sopenharmony_ci} __packed;
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ci/**
50062306a36Sopenharmony_ci * struct iwl_sap_notif_host_nic_info - payload for %SAP_MSG_NOTIF_NIC_INFO
50162306a36Sopenharmony_ci * @hdr: The SAP header
50262306a36Sopenharmony_ci * @mac_address: The MAC address as configured to the interface.
50362306a36Sopenharmony_ci * @nvm_address: The MAC address as configured in the NVM.
50462306a36Sopenharmony_ci */
50562306a36Sopenharmony_cistruct iwl_sap_notif_host_nic_info {
50662306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
50762306a36Sopenharmony_ci	u8 mac_address[6];
50862306a36Sopenharmony_ci	u8 nvm_address[6];
50962306a36Sopenharmony_ci} __packed;
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ci/**
51262306a36Sopenharmony_ci * struct iwl_sap_notif_dw - payload is a dw
51362306a36Sopenharmony_ci * @hdr: The SAP header.
51462306a36Sopenharmony_ci * @dw: The payload.
51562306a36Sopenharmony_ci */
51662306a36Sopenharmony_cistruct iwl_sap_notif_dw {
51762306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
51862306a36Sopenharmony_ci	__le32 dw;
51962306a36Sopenharmony_ci} __packed;
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_ci/**
52262306a36Sopenharmony_ci * struct iwl_sap_notif_sar_limits - payload for %SAP_MSG_NOTIF_SAR_LIMITS
52362306a36Sopenharmony_ci * @hdr: The SAP header
52462306a36Sopenharmony_ci * @sar_chain_info_table: Tx power limits.
52562306a36Sopenharmony_ci */
52662306a36Sopenharmony_cistruct iwl_sap_notif_sar_limits {
52762306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
52862306a36Sopenharmony_ci	__le16 sar_chain_info_table[2][5];
52962306a36Sopenharmony_ci} __packed;
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_ci/**
53262306a36Sopenharmony_ci * enum iwl_sap_nvm_caps - capabilities for NVM SAP
53362306a36Sopenharmony_ci * @SAP_NVM_CAPS_LARI_SUPPORT: Lari is supported
53462306a36Sopenharmony_ci * @SAP_NVM_CAPS_11AX_SUPPORT: 11AX is supported
53562306a36Sopenharmony_ci */
53662306a36Sopenharmony_cienum iwl_sap_nvm_caps {
53762306a36Sopenharmony_ci	SAP_NVM_CAPS_LARI_SUPPORT	= BIT(0),
53862306a36Sopenharmony_ci	SAP_NVM_CAPS_11AX_SUPPORT	= BIT(1),
53962306a36Sopenharmony_ci};
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ci/**
54262306a36Sopenharmony_ci * struct iwl_sap_nvm - payload for %SAP_MSG_NOTIF_NVM
54362306a36Sopenharmony_ci * @hdr: The SAP header.
54462306a36Sopenharmony_ci * @hw_addr: The MAC address
54562306a36Sopenharmony_ci * @n_hw_addrs: The number of MAC addresses
54662306a36Sopenharmony_ci * @reserved: For alignment.
54762306a36Sopenharmony_ci * @radio_cfg: The radio configuration.
54862306a36Sopenharmony_ci * @caps: See &enum iwl_sap_nvm_caps.
54962306a36Sopenharmony_ci * @nvm_version: The version of the NVM.
55062306a36Sopenharmony_ci * @channels: The data for each channel.
55162306a36Sopenharmony_ci */
55262306a36Sopenharmony_cistruct iwl_sap_nvm {
55362306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
55462306a36Sopenharmony_ci	u8 hw_addr[6];
55562306a36Sopenharmony_ci	u8 n_hw_addrs;
55662306a36Sopenharmony_ci	u8 reserved;
55762306a36Sopenharmony_ci	__le32 radio_cfg;
55862306a36Sopenharmony_ci	__le32 caps;
55962306a36Sopenharmony_ci	__le32 nvm_version;
56062306a36Sopenharmony_ci	__le32 channels[110];
56162306a36Sopenharmony_ci} __packed;
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci/**
56462306a36Sopenharmony_ci * enum iwl_sap_eth_filter_flags - used in &struct iwl_sap_eth_filter
56562306a36Sopenharmony_ci * @SAP_ETH_FILTER_STOP: Do not process further filters.
56662306a36Sopenharmony_ci * @SAP_ETH_FILTER_COPY: Copy the packet to the CSME.
56762306a36Sopenharmony_ci * @SAP_ETH_FILTER_ENABLED: If false, the filter should be ignored.
56862306a36Sopenharmony_ci */
56962306a36Sopenharmony_cienum iwl_sap_eth_filter_flags {
57062306a36Sopenharmony_ci	SAP_ETH_FILTER_STOP    = BIT(0),
57162306a36Sopenharmony_ci	SAP_ETH_FILTER_COPY    = BIT(1),
57262306a36Sopenharmony_ci	SAP_ETH_FILTER_ENABLED = BIT(2),
57362306a36Sopenharmony_ci};
57462306a36Sopenharmony_ci
57562306a36Sopenharmony_ci/**
57662306a36Sopenharmony_ci * struct iwl_sap_eth_filter - a L2 filter
57762306a36Sopenharmony_ci * @mac_address: Address to filter.
57862306a36Sopenharmony_ci * @flags: See &enum iwl_sap_eth_filter_flags.
57962306a36Sopenharmony_ci */
58062306a36Sopenharmony_cistruct iwl_sap_eth_filter {
58162306a36Sopenharmony_ci	u8 mac_address[6];
58262306a36Sopenharmony_ci	u8 flags;
58362306a36Sopenharmony_ci} __packed;
58462306a36Sopenharmony_ci
58562306a36Sopenharmony_ci/**
58662306a36Sopenharmony_ci * enum iwl_sap_flex_filter_flags - used in &struct iwl_sap_flex_filter
58762306a36Sopenharmony_ci * @SAP_FLEX_FILTER_COPY: Pass UDP / TCP packets to CSME.
58862306a36Sopenharmony_ci * @SAP_FLEX_FILTER_ENABLED: If false, the filter should be ignored.
58962306a36Sopenharmony_ci * @SAP_FLEX_FILTER_IPV4: Filter requires match on the IP address as well.
59062306a36Sopenharmony_ci * @SAP_FLEX_FILTER_IPV6: Filter requires match on the IP address as well.
59162306a36Sopenharmony_ci * @SAP_FLEX_FILTER_TCP: Filter should be applied on TCP packets.
59262306a36Sopenharmony_ci * @SAP_FLEX_FILTER_UDP: Filter should be applied on UDP packets.
59362306a36Sopenharmony_ci */
59462306a36Sopenharmony_cienum iwl_sap_flex_filter_flags {
59562306a36Sopenharmony_ci	SAP_FLEX_FILTER_COPY		= BIT(0),
59662306a36Sopenharmony_ci	SAP_FLEX_FILTER_ENABLED		= BIT(1),
59762306a36Sopenharmony_ci	SAP_FLEX_FILTER_IPV6		= BIT(2),
59862306a36Sopenharmony_ci	SAP_FLEX_FILTER_IPV4		= BIT(3),
59962306a36Sopenharmony_ci	SAP_FLEX_FILTER_TCP		= BIT(4),
60062306a36Sopenharmony_ci	SAP_FLEX_FILTER_UDP		= BIT(5),
60162306a36Sopenharmony_ci};
60262306a36Sopenharmony_ci
60362306a36Sopenharmony_ci/**
60462306a36Sopenharmony_ci * struct iwl_sap_flex_filter -
60562306a36Sopenharmony_ci * @src_port: Source port in network format.
60662306a36Sopenharmony_ci * @dst_port: Destination port in network format.
60762306a36Sopenharmony_ci * @flags: Flags and protocol, see &enum iwl_sap_flex_filter_flags.
60862306a36Sopenharmony_ci * @reserved: For alignment.
60962306a36Sopenharmony_ci */
61062306a36Sopenharmony_cistruct iwl_sap_flex_filter {
61162306a36Sopenharmony_ci	__be16 src_port;
61262306a36Sopenharmony_ci	__be16 dst_port;
61362306a36Sopenharmony_ci	u8 flags;
61462306a36Sopenharmony_ci	u8 reserved;
61562306a36Sopenharmony_ci} __packed;
61662306a36Sopenharmony_ci
61762306a36Sopenharmony_ci/**
61862306a36Sopenharmony_ci * enum iwl_sap_ipv4_filter_flags - used in &struct iwl_sap_ipv4_filter
61962306a36Sopenharmony_ci * @SAP_IPV4_FILTER_ICMP_PASS: Pass ICMP packets to CSME.
62062306a36Sopenharmony_ci * @SAP_IPV4_FILTER_ICMP_COPY: Pass ICMP packets to host.
62162306a36Sopenharmony_ci * @SAP_IPV4_FILTER_ARP_REQ_PASS: Pass ARP requests to CSME.
62262306a36Sopenharmony_ci * @SAP_IPV4_FILTER_ARP_REQ_COPY: Pass ARP requests to host.
62362306a36Sopenharmony_ci * @SAP_IPV4_FILTER_ARP_RESP_PASS: Pass ARP responses to CSME.
62462306a36Sopenharmony_ci * @SAP_IPV4_FILTER_ARP_RESP_COPY: Pass ARP responses to host.
62562306a36Sopenharmony_ci */
62662306a36Sopenharmony_cienum iwl_sap_ipv4_filter_flags {
62762306a36Sopenharmony_ci	SAP_IPV4_FILTER_ICMP_PASS	= BIT(0),
62862306a36Sopenharmony_ci	SAP_IPV4_FILTER_ICMP_COPY	= BIT(1),
62962306a36Sopenharmony_ci	SAP_IPV4_FILTER_ARP_REQ_PASS	= BIT(2),
63062306a36Sopenharmony_ci	SAP_IPV4_FILTER_ARP_REQ_COPY	= BIT(3),
63162306a36Sopenharmony_ci	SAP_IPV4_FILTER_ARP_RESP_PASS	= BIT(4),
63262306a36Sopenharmony_ci	SAP_IPV4_FILTER_ARP_RESP_COPY	= BIT(5),
63362306a36Sopenharmony_ci};
63462306a36Sopenharmony_ci
63562306a36Sopenharmony_ci/**
63662306a36Sopenharmony_ci * struct iwl_sap_ipv4_filter-
63762306a36Sopenharmony_ci * @ipv4_addr: The IP address to filer.
63862306a36Sopenharmony_ci * @flags: See &enum iwl_sap_ipv4_filter_flags.
63962306a36Sopenharmony_ci */
64062306a36Sopenharmony_cistruct iwl_sap_ipv4_filter {
64162306a36Sopenharmony_ci	__be32 ipv4_addr;
64262306a36Sopenharmony_ci	__le32 flags;
64362306a36Sopenharmony_ci} __packed;
64462306a36Sopenharmony_ci
64562306a36Sopenharmony_ci/**
64662306a36Sopenharmony_ci * enum iwl_sap_ipv6_filter_flags -
64762306a36Sopenharmony_ci * @SAP_IPV6_ADDR_FILTER_COPY: Pass packets to the host.
64862306a36Sopenharmony_ci * @SAP_IPV6_ADDR_FILTER_ENABLED: If false, the filter should be ignored.
64962306a36Sopenharmony_ci */
65062306a36Sopenharmony_cienum iwl_sap_ipv6_filter_flags {
65162306a36Sopenharmony_ci	SAP_IPV6_ADDR_FILTER_COPY	= BIT(0),
65262306a36Sopenharmony_ci	SAP_IPV6_ADDR_FILTER_ENABLED	= BIT(1),
65362306a36Sopenharmony_ci};
65462306a36Sopenharmony_ci
65562306a36Sopenharmony_ci/**
65662306a36Sopenharmony_ci * struct iwl_sap_ipv6_filter -
65762306a36Sopenharmony_ci * @addr_lo24: Lowest 24 bits of the IPv6 address.
65862306a36Sopenharmony_ci * @flags: See &enum iwl_sap_ipv6_filter_flags.
65962306a36Sopenharmony_ci */
66062306a36Sopenharmony_cistruct iwl_sap_ipv6_filter {
66162306a36Sopenharmony_ci	u8 addr_lo24[3];
66262306a36Sopenharmony_ci	u8 flags;
66362306a36Sopenharmony_ci} __packed;
66462306a36Sopenharmony_ci
66562306a36Sopenharmony_ci/**
66662306a36Sopenharmony_ci * enum iwl_sap_icmpv6_filter_flags -
66762306a36Sopenharmony_ci * @SAP_ICMPV6_FILTER_ENABLED: If false, the filter should be ignored.
66862306a36Sopenharmony_ci * @SAP_ICMPV6_FILTER_COPY: Pass packets to the host.
66962306a36Sopenharmony_ci */
67062306a36Sopenharmony_cienum iwl_sap_icmpv6_filter_flags {
67162306a36Sopenharmony_ci	SAP_ICMPV6_FILTER_ENABLED	= BIT(0),
67262306a36Sopenharmony_ci	SAP_ICMPV6_FILTER_COPY		= BIT(1),
67362306a36Sopenharmony_ci};
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci/**
67662306a36Sopenharmony_ci * enum iwl_sap_vlan_filter_flags -
67762306a36Sopenharmony_ci * @SAP_VLAN_FILTER_VLAN_ID_MSK: TBD
67862306a36Sopenharmony_ci * @SAP_VLAN_FILTER_ENABLED: If false, the filter should be ignored.
67962306a36Sopenharmony_ci */
68062306a36Sopenharmony_cienum iwl_sap_vlan_filter_flags {
68162306a36Sopenharmony_ci	SAP_VLAN_FILTER_VLAN_ID_MSK	= 0x0FFF,
68262306a36Sopenharmony_ci	SAP_VLAN_FILTER_ENABLED		= BIT(15),
68362306a36Sopenharmony_ci};
68462306a36Sopenharmony_ci
68562306a36Sopenharmony_ci/**
68662306a36Sopenharmony_ci * struct iwl_sap_oob_filters - Out of band filters (for RX only)
68762306a36Sopenharmony_ci * @flex_filters: Array of &struct iwl_sap_flex_filter.
68862306a36Sopenharmony_ci * @icmpv6_flags: See &enum iwl_sap_icmpv6_filter_flags.
68962306a36Sopenharmony_ci * @ipv6_filters: Array of &struct iwl_sap_ipv6_filter.
69062306a36Sopenharmony_ci * @eth_filters: Array of &struct iwl_sap_eth_filter.
69162306a36Sopenharmony_ci * @reserved: For alignment.
69262306a36Sopenharmony_ci * @ipv4_filter: &struct iwl_sap_ipv4_filter.
69362306a36Sopenharmony_ci * @vlan: See &enum iwl_sap_vlan_filter_flags.
69462306a36Sopenharmony_ci */
69562306a36Sopenharmony_cistruct iwl_sap_oob_filters {
69662306a36Sopenharmony_ci	struct iwl_sap_flex_filter flex_filters[14];
69762306a36Sopenharmony_ci	__le32 icmpv6_flags;
69862306a36Sopenharmony_ci	struct iwl_sap_ipv6_filter ipv6_filters[4];
69962306a36Sopenharmony_ci	struct iwl_sap_eth_filter eth_filters[5];
70062306a36Sopenharmony_ci	u8 reserved;
70162306a36Sopenharmony_ci	struct iwl_sap_ipv4_filter ipv4_filter;
70262306a36Sopenharmony_ci	__le16 vlan[4];
70362306a36Sopenharmony_ci} __packed;
70462306a36Sopenharmony_ci
70562306a36Sopenharmony_ci/**
70662306a36Sopenharmony_ci * struct iwl_sap_csme_filters - payload of %SAP_MSG_NOTIF_CSME_FILTERS
70762306a36Sopenharmony_ci * @hdr: The SAP header.
70862306a36Sopenharmony_ci * @mode: Not used.
70962306a36Sopenharmony_ci * @mac_address: Not used.
71062306a36Sopenharmony_ci * @reserved: For alignment.
71162306a36Sopenharmony_ci * @cbfilters: Not used.
71262306a36Sopenharmony_ci * @filters: Out of band filters.
71362306a36Sopenharmony_ci */
71462306a36Sopenharmony_cistruct iwl_sap_csme_filters {
71562306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
71662306a36Sopenharmony_ci	__le32 mode;
71762306a36Sopenharmony_ci	u8 mac_address[6];
71862306a36Sopenharmony_ci	__le16 reserved;
71962306a36Sopenharmony_ci	u8 cbfilters[1728];
72062306a36Sopenharmony_ci	struct iwl_sap_oob_filters filters;
72162306a36Sopenharmony_ci} __packed;
72262306a36Sopenharmony_ci
72362306a36Sopenharmony_ci#define CB_TX_DHCP_FILT_IDX 30
72462306a36Sopenharmony_ci/**
72562306a36Sopenharmony_ci * struct iwl_sap_cb_data - header to be added for transmitted packets.
72662306a36Sopenharmony_ci * @hdr: The SAP header.
72762306a36Sopenharmony_ci * @reserved: Not used.
72862306a36Sopenharmony_ci * @to_me_filt_status: The filter that matches. Bit %CB_TX_DHCP_FILT_IDX should
72962306a36Sopenharmony_ci *	be set for DHCP (the only packet that uses this header).
73062306a36Sopenharmony_ci * @reserved2: Not used.
73162306a36Sopenharmony_ci * @data_len: The length of the payload.
73262306a36Sopenharmony_ci * @payload: The payload of the transmitted packet.
73362306a36Sopenharmony_ci */
73462306a36Sopenharmony_cistruct iwl_sap_cb_data {
73562306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
73662306a36Sopenharmony_ci	__le32 reserved[7];
73762306a36Sopenharmony_ci	__le32 to_me_filt_status;
73862306a36Sopenharmony_ci	__le32 reserved2;
73962306a36Sopenharmony_ci	__le32 data_len;
74062306a36Sopenharmony_ci	u8 payload[];
74162306a36Sopenharmony_ci};
74262306a36Sopenharmony_ci
74362306a36Sopenharmony_ci/**
74462306a36Sopenharmony_ci * struct iwl_sap_pldr_data - payload of %SAP_MSG_NOTIF_PLDR
74562306a36Sopenharmony_ci * @hdr: The SAP header.
74662306a36Sopenharmony_ci * @version: SAP message version
74762306a36Sopenharmony_ci */
74862306a36Sopenharmony_cistruct iwl_sap_pldr_data {
74962306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
75062306a36Sopenharmony_ci	__le32 version;
75162306a36Sopenharmony_ci} __packed;
75262306a36Sopenharmony_ci
75362306a36Sopenharmony_ci/**
75462306a36Sopenharmony_ci * enum iwl_sap_pldr_status -
75562306a36Sopenharmony_ci * @SAP_PLDR_STATUS_SUCCESS: PLDR started/ended successfully
75662306a36Sopenharmony_ci * @SAP_PLDR_STATUS_FAILURE: PLDR failed to start/end
75762306a36Sopenharmony_ci */
75862306a36Sopenharmony_cienum iwl_sap_pldr_status {
75962306a36Sopenharmony_ci	SAP_PLDR_STATUS_SUCCESS	= 0,
76062306a36Sopenharmony_ci	SAP_PLDR_STATUS_FAILURE	= 1,
76162306a36Sopenharmony_ci};
76262306a36Sopenharmony_ci
76362306a36Sopenharmony_ci/*
76462306a36Sopenharmony_ci * struct iwl_sap_pldr_end_data - payload of %SAP_MSG_NOTIF_PLDR_END
76562306a36Sopenharmony_ci * @hdr: The SAP header.
76662306a36Sopenharmony_ci * @version: SAP message version
76762306a36Sopenharmony_ci * @status: PLDR end status
76862306a36Sopenharmony_ci */
76962306a36Sopenharmony_cistruct iwl_sap_pldr_end_data {
77062306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
77162306a36Sopenharmony_ci	__le32 version;
77262306a36Sopenharmony_ci	__le32 status;
77362306a36Sopenharmony_ci} __packed;
77462306a36Sopenharmony_ci
77562306a36Sopenharmony_ci/*
77662306a36Sopenharmony_ci * struct iwl_sap_pldr_ack_data - payload of %SAP_MSG_NOTIF_PLDR_ACK
77762306a36Sopenharmony_ci * @version: SAP message version
77862306a36Sopenharmony_ci * @status: CSME accept/refuse to the PLDR request
77962306a36Sopenharmony_ci */
78062306a36Sopenharmony_cistruct iwl_sap_pldr_ack_data {
78162306a36Sopenharmony_ci	struct iwl_sap_hdr hdr;
78262306a36Sopenharmony_ci	__le32 version;
78362306a36Sopenharmony_ci	__le32 status;
78462306a36Sopenharmony_ci} __packed;
78562306a36Sopenharmony_ci
78662306a36Sopenharmony_ci#endif /* __sap_h__ */
787