[PATCH v3 06/20] staging: wfx: import HIF API headers

From: Jerome Pouiller
Date: Thu Sep 19 2019 - 10:26:14 EST


From: JÃrÃme Pouiller <jerome.pouiller@xxxxxxxxxx>

These files are shared with firmware sources. Only a subset of these
definitions are used by driver but, for now, it is easier to import all.

API defines 3 kinds of messages:
- Requests (req) are sent from host to chip
- Confirmations (cnf) are sent by chip and are always in reply to a
request
- Indications (ind) are spontaneous message from chip to host

One request normally generate one confirmation. There are a few
exceptions to this rule:
- "shutdown" request is not acknowledged
- multiple tx request can be acknowledged a unique "multi-tx"
confirmation

In add, API defines MIB. They are sub-structures for write_mib and
read_mib API.

Note that all numbers in API have to be little endian when sent/received
from/to chip (I didn't declared them with __le32 because driver also use
them internally).

Signed-off-by: JÃrÃme Pouiller <jerome.pouiller@xxxxxxxxxx>
---
drivers/staging/wfx/hif_api_cmd.h | 681 ++++++++++++++++++++++++++
drivers/staging/wfx/hif_api_general.h | 437 +++++++++++++++++
drivers/staging/wfx/hif_api_mib.h | 558 +++++++++++++++++++++
3 files changed, 1676 insertions(+)
create mode 100644 drivers/staging/wfx/hif_api_cmd.h
create mode 100644 drivers/staging/wfx/hif_api_general.h
create mode 100644 drivers/staging/wfx/hif_api_mib.h

diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h
new file mode 100644
index 000000000000..7c5d1ea6098d
--- /dev/null
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -0,0 +1,681 @@
+/* SPDX-License-Identifier: Apache-2.0 */
+/*
+ * WFx hardware interface definitions
+ *
+ * Copyright (c) 2018-2019, Silicon Laboratories Inc.
+ */
+
+#ifndef WFX_HIF_API_CMD_H
+#define WFX_HIF_API_CMD_H
+
+#include "hif_api_general.h"
+
+#define HIF_NUM_AC 4
+
+#define HIF_API_SSID_SIZE API_SSID_SIZE
+
+enum hif_requests_ids {
+ HIF_REQ_ID_RESET = 0x0a,
+ HIF_REQ_ID_READ_MIB = 0x05,
+ HIF_REQ_ID_WRITE_MIB = 0x06,
+ HIF_REQ_ID_START_SCAN = 0x07,
+ HIF_REQ_ID_STOP_SCAN = 0x08,
+ HIF_REQ_ID_TX = 0x04,
+ HIF_REQ_ID_JOIN = 0x0b,
+ HIF_REQ_ID_SET_PM_MODE = 0x10,
+ HIF_REQ_ID_SET_BSS_PARAMS = 0x11,
+ HIF_REQ_ID_ADD_KEY = 0x0c,
+ HIF_REQ_ID_REMOVE_KEY = 0x0d,
+ HIF_REQ_ID_EDCA_QUEUE_PARAMS = 0x13,
+ HIF_REQ_ID_START = 0x17,
+ HIF_REQ_ID_BEACON_TRANSMIT = 0x18,
+ HIF_REQ_ID_UPDATE_IE = 0x1b,
+ HIF_REQ_ID_MAP_LINK = 0x1c,
+};
+
+enum hif_confirmations_ids {
+ HIF_CNF_ID_RESET = 0x0a,
+ HIF_CNF_ID_READ_MIB = 0x05,
+ HIF_CNF_ID_WRITE_MIB = 0x06,
+ HIF_CNF_ID_START_SCAN = 0x07,
+ HIF_CNF_ID_STOP_SCAN = 0x08,
+ HIF_CNF_ID_TX = 0x04,
+ HIF_CNF_ID_MULTI_TRANSMIT = 0x1e,
+ HIF_CNF_ID_JOIN = 0x0b,
+ HIF_CNF_ID_SET_PM_MODE = 0x10,
+ HIF_CNF_ID_SET_BSS_PARAMS = 0x11,
+ HIF_CNF_ID_ADD_KEY = 0x0c,
+ HIF_CNF_ID_REMOVE_KEY = 0x0d,
+ HIF_CNF_ID_EDCA_QUEUE_PARAMS = 0x13,
+ HIF_CNF_ID_START = 0x17,
+ HIF_CNF_ID_BEACON_TRANSMIT = 0x18,
+ HIF_CNF_ID_UPDATE_IE = 0x1b,
+ HIF_CNF_ID_MAP_LINK = 0x1c,
+};
+
+enum hif_indications_ids {
+ HIF_IND_ID_RX = 0x84,
+ HIF_IND_ID_SCAN_CMPL = 0x86,
+ HIF_IND_ID_JOIN_COMPLETE = 0x8f,
+ HIF_IND_ID_SET_PM_MODE_CMPL = 0x89,
+ HIF_IND_ID_SUSPEND_RESUME_TX = 0x8c,
+ HIF_IND_ID_EVENT = 0x85
+};
+
+union hif_commands_ids {
+ enum hif_requests_ids request;
+ enum hif_confirmations_ids confirmation;
+ enum hif_indications_ids indication;
+};
+
+enum hif_status {
+ HIF_STATUS_SUCCESS = 0x0,
+ HIF_STATUS_FAILURE = 0x1,
+ HIF_INVALID_PARAMETER = 0x2,
+ HIF_STATUS_WARNING = 0x3,
+ HIF_ERROR_UNSUPPORTED_MSG_ID = 0x4,
+ HIF_STATUS_DECRYPTFAILURE = 0x10,
+ HIF_STATUS_MICFAILURE = 0x11,
+ HIF_STATUS_NO_KEY_FOUND = 0x12,
+ HIF_STATUS_RETRY_EXCEEDED = 0x13,
+ HIF_STATUS_TX_LIFETIME_EXCEEDED = 0x14,
+ HIF_REQUEUE = 0x15,
+ HIF_STATUS_REFUSED = 0x16,
+ HIF_STATUS_BUSY = 0x17
+};
+
+struct hif_reset_flags {
+ uint8_t reset_stat:1;
+ uint8_t reset_all_int:1;
+ uint8_t reserved1:6;
+ uint8_t reserved2[3];
+} __packed;
+
+struct hif_req_reset {
+ struct hif_reset_flags reset_flags;
+} __packed;
+
+struct hif_cnf_reset {
+ uint32_t status;
+} __packed;
+
+struct hif_req_read_mib {
+ uint16_t mib_id;
+ uint16_t reserved;
+} __packed;
+
+struct hif_cnf_read_mib {
+ uint32_t status;
+ uint16_t mib_id;
+ uint16_t length;
+ uint8_t mib_data[];
+} __packed;
+
+struct hif_req_write_mib {
+ uint16_t mib_id;
+ uint16_t length;
+ uint8_t mib_data[];
+} __packed;
+
+struct hif_cnf_write_mib {
+ uint32_t status;
+} __packed;
+
+struct hif_ie_flags {
+ uint8_t beacon:1;
+ uint8_t probe_resp:1;
+ uint8_t probe_req:1;
+ uint8_t reserved1:5;
+ uint8_t reserved2;
+} __packed;
+
+struct hif_ie_tlv {
+ uint8_t type;
+ uint8_t length;
+ uint8_t data[];
+} __packed;
+
+struct hif_req_update_ie {
+ struct hif_ie_flags ie_flags;
+ uint16_t num_i_es;
+ struct hif_ie_tlv ie[];
+} __packed;
+
+struct hif_cnf_update_ie {
+ uint32_t status;
+} __packed;
+
+struct hif_scan_type {
+ uint8_t type:1;
+ uint8_t mode:1;
+ uint8_t reserved:6;
+} __packed;
+
+struct hif_scan_flags {
+ uint8_t fbg:1;
+ uint8_t reserved1:1;
+ uint8_t pre:1;
+ uint8_t reserved2:5;
+} __packed;
+
+struct hif_auto_scan_param {
+ uint16_t interval;
+ uint8_t reserved;
+ int8_t rssi_thr;
+} __packed;
+
+struct hif_ssid_def {
+ uint32_t ssid_length;
+ uint8_t ssid[HIF_API_SSID_SIZE];
+} __packed;
+
+#define HIF_API_MAX_NB_SSIDS 2
+#define HIF_API_MAX_NB_CHANNELS 14
+
+struct hif_req_start_scan {
+ uint8_t band;
+ struct hif_scan_type scan_type;
+ struct hif_scan_flags scan_flags;
+ uint8_t max_transmit_rate;
+ struct hif_auto_scan_param auto_scan_param;
+ uint8_t num_of_probe_requests;
+ uint8_t probe_delay;
+ uint8_t num_of_ssi_ds;
+ uint8_t num_of_channels;
+ uint32_t min_channel_time;
+ uint32_t max_channel_time;
+ int32_t tx_power_level;
+ uint8_t ssid_and_channel_lists[];
+} __packed;
+
+struct hif_start_scan_req_cstnbssid_body {
+ uint8_t band;
+ struct hif_scan_type scan_type;
+ struct hif_scan_flags scan_flags;
+ uint8_t max_transmit_rate;
+ struct hif_auto_scan_param auto_scan_param;
+ uint8_t num_of_probe_requests;
+ uint8_t probe_delay;
+ uint8_t num_of_ssi_ds;
+ uint8_t num_of_channels;
+ uint32_t min_channel_time;
+ uint32_t max_channel_time;
+ int32_t tx_power_level;
+ struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS];
+ uint8_t channel_list[];
+} __packed;
+
+struct hif_cnf_start_scan {
+ uint32_t status;
+} __packed;
+
+struct hif_cnf_stop_scan {
+ uint32_t status;
+} __packed;
+
+enum hif_pm_mode_status {
+ HIF_PM_MODE_ACTIVE = 0x0,
+ HIF_PM_MODE_PS = 0x1,
+ HIF_PM_MODE_UNDETERMINED = 0x2
+};
+
+struct hif_ind_scan_cmpl {
+ uint32_t status;
+ uint8_t pm_mode;
+ uint8_t num_channels_completed;
+ uint16_t reserved;
+} __packed;
+
+enum hif_queue_id {
+ HIF_QUEUE_ID_BACKGROUND = 0x0,
+ HIF_QUEUE_ID_BESTEFFORT = 0x1,
+ HIF_QUEUE_ID_VIDEO = 0x2,
+ HIF_QUEUE_ID_VOICE = 0x3
+};
+
+enum hif_frame_format {
+ HIF_FRAME_FORMAT_NON_HT = 0x0,
+ HIF_FRAME_FORMAT_MIXED_FORMAT_HT = 0x1,
+ HIF_FRAME_FORMAT_GF_HT_11N = 0x2
+};
+
+enum hif_stbc {
+ HIF_STBC_NOT_ALLOWED = 0x0,
+ HIF_STBC_ALLOWED = 0x1
+};
+
+struct hif_queue {
+ uint8_t queue_id:2;
+ uint8_t peer_sta_id:4;
+ uint8_t reserved:2;
+} __packed;
+
+struct hif_data_flags {
+ uint8_t more:1;
+ uint8_t fc_offset:3;
+ uint8_t reserved:4;
+} __packed;
+
+struct hif_tx_flags {
+ uint8_t start_exp:1;
+ uint8_t reserved:3;
+ uint8_t retry_policy_index:4;
+} __packed;
+
+struct hif_ht_tx_parameters {
+ uint8_t frame_format:4;
+ uint8_t fec_coding:1;
+ uint8_t short_gi:1;
+ uint8_t reserved1:1;
+ uint8_t stbc:1;
+ uint8_t reserved2;
+ uint8_t aggregation:1;
+ uint8_t reserved3:7;
+ uint8_t reserved4;
+} __packed;
+
+struct hif_req_tx {
+ uint32_t packet_id;
+ uint8_t max_tx_rate;
+ struct hif_queue queue_id;
+ struct hif_data_flags data_flags;
+ struct hif_tx_flags tx_flags;
+ uint32_t reserved;
+ uint32_t expire_time;
+ struct hif_ht_tx_parameters ht_tx_parameters;
+ uint8_t frame[];
+} __packed;
+
+enum hif_qos_ackplcy {
+ HIF_QOS_ACKPLCY_NORMAL = 0x0,
+ HIF_QOS_ACKPLCY_TXNOACK = 0x1,
+ HIF_QOS_ACKPLCY_NOEXPACK = 0x2,
+ HIF_QOS_ACKPLCY_BLCKACK = 0x3
+};
+
+struct hif_tx_result_flags {
+ uint8_t aggr:1;
+ uint8_t requeue:1;
+ uint8_t ack_policy:2;
+ uint8_t txop_limit:1;
+ uint8_t reserved1:3;
+ uint8_t reserved2;
+} __packed;
+
+struct hif_cnf_tx {
+ uint32_t status;
+ uint32_t packet_id;
+ uint8_t txed_rate;
+ uint8_t ack_failures;
+ struct hif_tx_result_flags tx_result_flags;
+ uint32_t media_delay;
+ uint32_t tx_queue_delay;
+} __packed;
+
+struct hif_cnf_multi_transmit {
+ uint32_t num_tx_confs;
+ struct hif_cnf_tx tx_conf_payload[];
+} __packed;
+
+enum hif_ri_flags_encrypt {
+ HIF_RI_FLAGS_UNENCRYPTED = 0x0,
+ HIF_RI_FLAGS_WEP_ENCRYPTED = 0x1,
+ HIF_RI_FLAGS_TKIP_ENCRYPTED = 0x2,
+ HIF_RI_FLAGS_AES_ENCRYPTED = 0x3,
+ HIF_RI_FLAGS_WAPI_ENCRYPTED = 0x4
+};
+
+struct hif_rx_flags {
+ uint8_t encryp:3;
+ uint8_t in_aggr:1;
+ uint8_t first_aggr:1;
+ uint8_t last_aggr:1;
+ uint8_t defrag:1;
+ uint8_t beacon:1;
+ uint8_t tim:1;
+ uint8_t bitmap:1;
+ uint8_t match_ssid:1;
+ uint8_t match_bssid:1;
+ uint8_t more:1;
+ uint8_t reserved1:1;
+ uint8_t ht:1;
+ uint8_t stbc:1;
+ uint8_t match_uc_addr:1;
+ uint8_t match_mc_addr:1;
+ uint8_t match_bc_addr:1;
+ uint8_t key_type:1;
+ uint8_t key_index:4;
+ uint8_t reserved2:1;
+ uint8_t peer_sta_id:4;
+ uint8_t reserved3:2;
+ uint8_t reserved4:1;
+} __packed;
+
+struct hif_ind_rx {
+ uint32_t status;
+ uint16_t channel_number;
+ uint8_t rxed_rate;
+ uint8_t rcpi_rssi;
+ struct hif_rx_flags rx_flags;
+ uint8_t frame[];
+} __packed;
+
+
+struct hif_req_edca_queue_params {
+ uint8_t queue_id;
+ uint8_t reserved1;
+ uint8_t aifsn;
+ uint8_t reserved2;
+ uint16_t cw_min;
+ uint16_t cw_max;
+ uint16_t tx_op_limit;
+ uint16_t allowed_medium_time;
+ uint32_t reserved3;
+} __packed;
+
+struct hif_cnf_edca_queue_params {
+ uint32_t status;
+} __packed;
+
+enum hif_ap_mode {
+ HIF_MODE_IBSS = 0x0,
+ HIF_MODE_BSS = 0x1
+};
+
+enum hif_preamble {
+ HIF_PREAMBLE_LONG = 0x0,
+ HIF_PREAMBLE_SHORT = 0x1,
+ HIF_PREAMBLE_SHORT_LONG12 = 0x2
+};
+
+struct hif_join_flags {
+ uint8_t reserved1:2;
+ uint8_t force_no_beacon:1;
+ uint8_t force_with_ind:1;
+ uint8_t reserved2:4;
+} __packed;
+
+struct hif_req_join {
+ uint8_t mode;
+ uint8_t band;
+ uint16_t channel_number;
+ uint8_t bssid[ETH_ALEN];
+ uint16_t atim_window;
+ uint8_t preamble_type;
+ uint8_t probe_for_join;
+ uint8_t reserved;
+ struct hif_join_flags join_flags;
+ uint32_t ssid_length;
+ uint8_t ssid[HIF_API_SSID_SIZE];
+ uint32_t beacon_interval;
+ uint32_t basic_rate_set;
+} __packed;
+
+struct hif_cnf_join {
+ uint32_t status;
+} __packed;
+
+struct hif_ind_join_complete {
+ uint32_t status;
+} __packed;
+
+struct hif_bss_flags {
+ uint8_t lost_count_only:1;
+ uint8_t reserved:7;
+} __packed;
+
+struct hif_req_set_bss_params {
+ struct hif_bss_flags bss_flags;
+ uint8_t beacon_lost_count;
+ uint16_t aid;
+ uint32_t operational_rate_set;
+} __packed;
+
+struct hif_cnf_set_bss_params {
+ uint32_t status;
+} __packed;
+
+struct hif_pm_mode {
+ uint8_t enter_psm:1;
+ uint8_t reserved:6;
+ uint8_t fast_psm:1;
+} __packed;
+
+struct hif_req_set_pm_mode {
+ struct hif_pm_mode pm_mode;
+ uint8_t fast_psm_idle_period;
+ uint8_t ap_psm_change_period;
+ uint8_t min_auto_ps_poll_period;
+} __packed;
+
+struct hif_cnf_set_pm_mode {
+ uint32_t status;
+} __packed;
+
+struct hif_ind_set_pm_mode_cmpl {
+ uint32_t status;
+ uint8_t pm_mode;
+ uint8_t reserved[3];
+} __packed;
+
+
+struct hif_req_start {
+ uint8_t mode;
+ uint8_t band;
+ uint16_t channel_number;
+ uint32_t reserved1;
+ uint32_t beacon_interval;
+ uint8_t dtim_period;
+ uint8_t preamble_type;
+ uint8_t reserved2;
+ uint8_t ssid_length;
+ uint8_t ssid[HIF_API_SSID_SIZE];
+ uint32_t basic_rate_set;
+} __packed;
+
+struct hif_cnf_start {
+ uint32_t status;
+} __packed;
+
+enum hif_beacon {
+ HIF_BEACON_STOP = 0x0,
+ HIF_BEACON_START = 0x1
+};
+
+struct hif_req_beacon_transmit {
+ uint8_t enable_beaconing;
+ uint8_t reserved[3];
+} __packed;
+
+struct hif_cnf_beacon_transmit {
+ uint32_t status;
+} __packed;
+
+enum hif_sta_map_direction {
+ HIF_STA_MAP = 0x0,
+ HIF_STA_UNMAP = 0x1
+};
+
+struct hif_map_link_flags {
+ uint8_t map_direction:1;
+ uint8_t mfpc:1;
+ uint8_t reserved:6;
+} __packed;
+
+struct hif_req_map_link {
+ uint8_t mac_addr[ETH_ALEN];
+ struct hif_map_link_flags map_link_flags;
+ uint8_t peer_sta_id;
+} __packed;
+
+struct hif_cnf_map_link {
+ uint32_t status;
+} __packed;
+
+struct hif_suspend_resume_flags {
+ uint8_t resume:1;
+ uint8_t reserved1:2;
+ uint8_t bc_mc_only:1;
+ uint8_t reserved2:4;
+ uint8_t reserved3;
+} __packed;
+
+struct hif_ind_suspend_resume_tx {
+ struct hif_suspend_resume_flags suspend_resume_flags;
+ uint16_t peer_sta_set;
+} __packed;
+
+
+#define MAX_KEY_ENTRIES 24
+#define HIF_API_WEP_KEY_DATA_SIZE 16
+#define HIF_API_TKIP_KEY_DATA_SIZE 16
+#define HIF_API_RX_MIC_KEY_SIZE 8
+#define HIF_API_TX_MIC_KEY_SIZE 8
+#define HIF_API_AES_KEY_DATA_SIZE 16
+#define HIF_API_WAPI_KEY_DATA_SIZE 16
+#define HIF_API_MIC_KEY_DATA_SIZE 16
+#define HIF_API_IGTK_KEY_DATA_SIZE 16
+#define HIF_API_RX_SEQUENCE_COUNTER_SIZE 8
+#define HIF_API_IPN_SIZE 8
+
+enum hif_key_type {
+ HIF_KEY_TYPE_WEP_DEFAULT = 0x0,
+ HIF_KEY_TYPE_WEP_PAIRWISE = 0x1,
+ HIF_KEY_TYPE_TKIP_GROUP = 0x2,
+ HIF_KEY_TYPE_TKIP_PAIRWISE = 0x3,
+ HIF_KEY_TYPE_AES_GROUP = 0x4,
+ HIF_KEY_TYPE_AES_PAIRWISE = 0x5,
+ HIF_KEY_TYPE_WAPI_GROUP = 0x6,
+ HIF_KEY_TYPE_WAPI_PAIRWISE = 0x7,
+ HIF_KEY_TYPE_IGTK_GROUP = 0x8,
+ HIF_KEY_TYPE_NONE = 0x9
+};
+
+struct hif_wep_pairwise_key {
+ uint8_t peer_address[ETH_ALEN];
+ uint8_t reserved;
+ uint8_t key_length;
+ uint8_t key_data[HIF_API_WEP_KEY_DATA_SIZE];
+} __packed;
+
+struct hif_wep_group_key {
+ uint8_t key_id;
+ uint8_t key_length;
+ uint8_t reserved[2];
+ uint8_t key_data[HIF_API_WEP_KEY_DATA_SIZE];
+} __packed;
+
+struct hif_tkip_pairwise_key {
+ uint8_t peer_address[ETH_ALEN];
+ uint8_t reserved[2];
+ uint8_t tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE];
+ uint8_t rx_mic_key[HIF_API_RX_MIC_KEY_SIZE];
+ uint8_t tx_mic_key[HIF_API_TX_MIC_KEY_SIZE];
+} __packed;
+
+struct hif_tkip_group_key {
+ uint8_t tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE];
+ uint8_t rx_mic_key[HIF_API_RX_MIC_KEY_SIZE];
+ uint8_t key_id;
+ uint8_t reserved[3];
+ uint8_t rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE];
+} __packed;
+
+struct hif_aes_pairwise_key {
+ uint8_t peer_address[ETH_ALEN];
+ uint8_t reserved[2];
+ uint8_t aes_key_data[HIF_API_AES_KEY_DATA_SIZE];
+} __packed;
+
+struct hif_aes_group_key {
+ uint8_t aes_key_data[HIF_API_AES_KEY_DATA_SIZE];
+ uint8_t key_id;
+ uint8_t reserved[3];
+ uint8_t rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE];
+} __packed;
+
+struct hif_wapi_pairwise_key {
+ uint8_t peer_address[ETH_ALEN];
+ uint8_t key_id;
+ uint8_t reserved;
+ uint8_t wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE];
+ uint8_t mic_key_data[HIF_API_MIC_KEY_DATA_SIZE];
+} __packed;
+
+struct hif_wapi_group_key {
+ uint8_t wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE];
+ uint8_t mic_key_data[HIF_API_MIC_KEY_DATA_SIZE];
+ uint8_t key_id;
+ uint8_t reserved[3];
+} __packed;
+
+struct hif_igtk_group_key {
+ uint8_t igtk_key_data[HIF_API_IGTK_KEY_DATA_SIZE];
+ uint8_t key_id;
+ uint8_t reserved[3];
+ uint8_t ipn[HIF_API_IPN_SIZE];
+} __packed;
+
+union hif_privacy_key_data {
+ struct hif_wep_pairwise_key wep_pairwise_key;
+ struct hif_wep_group_key wep_group_key;
+ struct hif_tkip_pairwise_key tkip_pairwise_key;
+ struct hif_tkip_group_key tkip_group_key;
+ struct hif_aes_pairwise_key aes_pairwise_key;
+ struct hif_aes_group_key aes_group_key;
+ struct hif_wapi_pairwise_key wapi_pairwise_key;
+ struct hif_wapi_group_key wapi_group_key;
+ struct hif_igtk_group_key igtk_group_key;
+};
+
+struct hif_req_add_key {
+ uint8_t type;
+ uint8_t entry_index;
+ uint8_t int_id:2;
+ uint8_t reserved1:6;
+ uint8_t reserved2;
+ union hif_privacy_key_data key;
+} __packed;
+
+struct hif_cnf_add_key {
+ uint32_t status;
+} __packed;
+
+struct hif_req_remove_key {
+ uint8_t entry_index;
+ uint8_t reserved[3];
+} __packed;
+
+struct hif_cnf_remove_key {
+ uint32_t status;
+} __packed;
+
+enum hif_event_ind {
+ HIF_EVENT_IND_BSSLOST = 0x1,
+ HIF_EVENT_IND_BSSREGAINED = 0x2,
+ HIF_EVENT_IND_RCPI_RSSI = 0x3,
+ HIF_EVENT_IND_PS_MODE_ERROR = 0x4,
+ HIF_EVENT_IND_INACTIVITY = 0x5
+};
+
+enum hif_ps_mode_error {
+ HIF_PS_ERROR_NO_ERROR = 0,
+ HIF_PS_ERROR_AP_NOT_RESP_TO_POLL = 1,
+ HIF_PS_ERROR_AP_NOT_RESP_TO_UAPSD_TRIGGER = 2,
+ HIF_PS_ERROR_AP_SENT_UNICAST_IN_DOZE = 3,
+ HIF_PS_ERROR_AP_NO_DATA_AFTER_TIM = 4
+};
+
+union hif_event_data {
+ uint8_t rcpi_rssi;
+ uint32_t ps_mode_error;
+ uint32_t peer_sta_set;
+};
+
+struct hif_ind_event {
+ uint32_t event_id;
+ union hif_event_data event_data;
+} __packed;
+
+
+#endif
diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h
new file mode 100644
index 000000000000..d885b55d2882
--- /dev/null
+++ b/drivers/staging/wfx/hif_api_general.h
@@ -0,0 +1,437 @@
+/* SPDX-License-Identifier: Apache-2.0 */
+/*
+ * WFx hardware interface definitions
+ *
+ * Copyright (c) 2018-2019, Silicon Laboratories Inc.
+ */
+
+#ifndef WFX_HIF_API_GENERAL_H
+#define WFX_HIF_API_GENERAL_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#include <linux/if_ether.h>
+#else
+#include <net/ethernet.h>
+#include <stdint.h>
+#define __packed __attribute__((__packed__))
+#endif
+
+#define API_SSID_SIZE 32
+
+#define HIF_ID_IS_INDICATION 0x80
+#define HIF_COUNTER_MAX 7
+
+struct hif_msg {
+ uint16_t len;
+ uint8_t id;
+ uint8_t reserved:1;
+ uint8_t interface:2;
+ uint8_t seqnum:3;
+ uint8_t encrypted:2;
+ uint8_t body[];
+} __packed;
+
+enum hif_general_requests_ids {
+ HIF_REQ_ID_CONFIGURATION = 0x09,
+ HIF_REQ_ID_CONTROL_GPIO = 0x26,
+ HIF_REQ_ID_SET_SL_MAC_KEY = 0x27,
+ HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS = 0x28,
+ HIF_REQ_ID_SL_CONFIGURE = 0x29,
+ HIF_REQ_ID_PREVENT_ROLLBACK = 0x2a,
+ HIF_REQ_ID_PTA_SETTINGS = 0x2b,
+ HIF_REQ_ID_PTA_PRIORITY = 0x2c,
+ HIF_REQ_ID_PTA_STATE = 0x2d,
+ HIF_REQ_ID_SHUT_DOWN = 0x32,
+};
+
+enum hif_general_confirmations_ids {
+ HIF_CNF_ID_CONFIGURATION = 0x09,
+ HIF_CNF_ID_CONTROL_GPIO = 0x26,
+ HIF_CNF_ID_SET_SL_MAC_KEY = 0x27,
+ HIF_CNF_ID_SL_EXCHANGE_PUB_KEYS = 0x28,
+ HIF_CNF_ID_SL_CONFIGURE = 0x29,
+ HIF_CNF_ID_PREVENT_ROLLBACK = 0x2a,
+ HIF_CNF_ID_PTA_SETTINGS = 0x2b,
+ HIF_CNF_ID_PTA_PRIORITY = 0x2c,
+ HIF_CNF_ID_PTA_STATE = 0x2d,
+ HIF_CNF_ID_SHUT_DOWN = 0x32,
+};
+
+enum hif_general_indications_ids {
+ HIF_IND_ID_EXCEPTION = 0xe0,
+ HIF_IND_ID_STARTUP = 0xe1,
+ HIF_IND_ID_WAKEUP = 0xe2,
+ HIF_IND_ID_GENERIC = 0xe3,
+ HIF_IND_ID_ERROR = 0xe4,
+ HIF_IND_ID_SL_EXCHANGE_PUB_KEYS = 0xe5
+};
+
+enum hif_hi_status {
+ HI_STATUS_SUCCESS = 0x0000,
+ HI_STATUS_FAILURE = 0x0001,
+ HI_INVALID_PARAMETER = 0x0002,
+ HI_STATUS_GPIO_WARNING = 0x0003,
+ HI_ERROR_UNSUPPORTED_MSG_ID = 0x0004,
+ SL_MAC_KEY_STATUS_SUCCESS = 0x005A,
+ SL_MAC_KEY_STATUS_FAILED_KEY_ALREADY_BURNED = 0x006B,
+ SL_MAC_KEY_STATUS_FAILED_RAM_MODE_NOT_ALLOWED = 0x007C,
+ SL_MAC_KEY_STATUS_FAILED_UNKNOWN_MODE = 0x008D,
+ SL_PUB_KEY_EXCHANGE_STATUS_SUCCESS = 0x009E,
+ SL_PUB_KEY_EXCHANGE_STATUS_FAILED = 0x00AF,
+ PREVENT_ROLLBACK_CNF_SUCCESS = 0x1234,
+ PREVENT_ROLLBACK_CNF_WRONG_MAGIC_WORD = 0x1256
+};
+
+enum hif_api_rate_index {
+ API_RATE_INDEX_B_1MBPS = 0,
+ API_RATE_INDEX_B_2MBPS = 1,
+ API_RATE_INDEX_B_5P5MBPS = 2,
+ API_RATE_INDEX_B_11MBPS = 3,
+ API_RATE_INDEX_PBCC_22MBPS = 4,
+ API_RATE_INDEX_PBCC_33MBPS = 5,
+ API_RATE_INDEX_G_6MBPS = 6,
+ API_RATE_INDEX_G_9MBPS = 7,
+ API_RATE_INDEX_G_12MBPS = 8,
+ API_RATE_INDEX_G_18MBPS = 9,
+ API_RATE_INDEX_G_24MBPS = 10,
+ API_RATE_INDEX_G_36MBPS = 11,
+ API_RATE_INDEX_G_48MBPS = 12,
+ API_RATE_INDEX_G_54MBPS = 13,
+ API_RATE_INDEX_N_6P5MBPS = 14,
+ API_RATE_INDEX_N_13MBPS = 15,
+ API_RATE_INDEX_N_19P5MBPS = 16,
+ API_RATE_INDEX_N_26MBPS = 17,
+ API_RATE_INDEX_N_39MBPS = 18,
+ API_RATE_INDEX_N_52MBPS = 19,
+ API_RATE_INDEX_N_58P5MBPS = 20,
+ API_RATE_INDEX_N_65MBPS = 21,
+ API_RATE_NUM_ENTRIES = 22
+};
+
+
+enum hif_fw_type {
+ HIF_FW_TYPE_ETF = 0x0,
+ HIF_FW_TYPE_WFM = 0x1,
+ HIF_FW_TYPE_WSM = 0x2
+};
+
+struct hif_capabilities {
+ uint8_t link_mode:2;
+ uint8_t reserved1:6;
+ uint8_t reserved2;
+ uint8_t reserved3;
+ uint8_t reserved4;
+} __packed;
+
+struct hif_otp_regul_sel_mode_info {
+ uint8_t region_sel_mode:4;
+ uint8_t reserved:4;
+} __packed;
+
+struct hif_otp_phy_info {
+ uint8_t phy1_region:3;
+ uint8_t phy0_region:3;
+ uint8_t otp_phy_ver:2;
+} __packed;
+
+#define API_OPN_SIZE 14
+#define API_UID_SIZE 8
+#define API_DISABLED_CHANNEL_LIST_SIZE 2
+#define API_FIRMWARE_LABEL_SIZE 128
+
+struct hif_ind_startup {
+ uint32_t status;
+ uint16_t hardware_id;
+ uint8_t opn[API_OPN_SIZE];
+ uint8_t uid[API_UID_SIZE];
+ uint16_t num_inp_ch_bufs;
+ uint16_t size_inp_ch_buf;
+ uint8_t num_links_ap;
+ uint8_t num_interfaces;
+ uint8_t mac_addr[2][ETH_ALEN];
+ uint8_t api_version_minor;
+ uint8_t api_version_major;
+ struct hif_capabilities capabilities;
+ uint8_t firmware_build;
+ uint8_t firmware_minor;
+ uint8_t firmware_major;
+ uint8_t firmware_type;
+ uint8_t disabled_channel_list[API_DISABLED_CHANNEL_LIST_SIZE];
+ struct hif_otp_regul_sel_mode_info regul_sel_mode_info;
+ struct hif_otp_phy_info otp_phy_info;
+ uint32_t supported_rate_mask;
+ uint8_t firmware_label[API_FIRMWARE_LABEL_SIZE];
+} __packed;
+
+struct hif_ind_wakeup {
+} __packed;
+
+struct hif_req_configuration {
+ uint16_t length;
+ uint8_t pds_data[];
+} __packed;
+
+struct hif_cnf_configuration {
+ uint32_t status;
+} __packed;
+
+enum hif_gpio_mode {
+ HIF_GPIO_MODE_D0 = 0x0,
+ HIF_GPIO_MODE_D1 = 0x1,
+ HIF_GPIO_MODE_OD0 = 0x2,
+ HIF_GPIO_MODE_OD1 = 0x3,
+ HIF_GPIO_MODE_TRISTATE = 0x4,
+ HIF_GPIO_MODE_TOGGLE = 0x5,
+ HIF_GPIO_MODE_READ = 0x6
+};
+
+struct hif_req_control_gpio {
+ uint8_t gpio_label;
+ uint8_t gpio_mode;
+} __packed;
+
+enum hif_gpio_error {
+ HIF_GPIO_ERROR_0 = 0x0,
+ HIF_GPIO_ERROR_1 = 0x1,
+ HIF_GPIO_ERROR_2 = 0x2
+};
+
+struct hif_cnf_control_gpio {
+ uint32_t status;
+ uint32_t value;
+} __packed;
+
+enum hif_generic_indication_type {
+ HIF_GENERIC_INDICATION_TYPE_RAW = 0x0,
+ HIF_GENERIC_INDICATION_TYPE_STRING = 0x1,
+ HIF_GENERIC_INDICATION_TYPE_RX_STATS = 0x2
+};
+
+struct hif_rx_stats {
+ uint32_t nb_rx_frame;
+ uint32_t nb_crc_frame;
+ uint32_t per_total;
+ uint32_t throughput;
+ uint32_t nb_rx_by_rate[API_RATE_NUM_ENTRIES];
+ uint16_t per[API_RATE_NUM_ENTRIES];
+ int16_t snr[API_RATE_NUM_ENTRIES];
+ int16_t rssi[API_RATE_NUM_ENTRIES];
+ int16_t cfo[API_RATE_NUM_ENTRIES];
+ uint32_t date;
+ uint32_t pwr_clk_freq;
+ uint8_t is_ext_pwr_clk;
+ int8_t current_temp;
+} __packed;
+
+union hif_indication_data {
+ struct hif_rx_stats rx_stats;
+ uint8_t raw_data[1];
+};
+
+struct hif_ind_generic {
+ uint32_t indication_type;
+ union hif_indication_data indication_data;
+} __packed;
+
+
+#define HIF_EXCEPTION_DATA_SIZE 124
+
+struct hif_ind_exception {
+ uint8_t data[HIF_EXCEPTION_DATA_SIZE];
+} __packed;
+
+
+enum hif_error {
+ HIF_ERROR_FIRMWARE_ROLLBACK = 0x0,
+ HIF_ERROR_FIRMWARE_DEBUG_ENABLED = 0x1,
+ HIF_ERROR_OUTDATED_SESSION_KEY = 0x2,
+ HIF_ERROR_INVALID_SESSION_KEY = 0x3,
+ HIF_ERROR_OOR_VOLTAGE = 0x4,
+ HIF_ERROR_PDS_VERSION = 0x5,
+ HIF_ERROR_OOR_TEMPERATURE = 0x6,
+ HIF_ERROR_REQ_DURING_KEY_EXCHANGE = 0x7,
+ HIF_ERROR_MULTI_TX_CNF_SECURELINK = 0x8,
+ HIF_ERROR_SECURELINK_OVERFLOW = 0x9,
+ HIF_ERROR_SECURELINK_DECRYPTION = 0xa
+};
+
+struct hif_ind_error {
+ uint32_t type;
+ uint8_t data[];
+} __packed;
+
+enum hif_secure_link_state {
+ SEC_LINK_UNAVAILABLE = 0x0,
+ SEC_LINK_RESERVED = 0x1,
+ SEC_LINK_EVAL = 0x2,
+ SEC_LINK_ENFORCED = 0x3
+};
+
+enum hif_sl_encryption_type {
+ NO_ENCRYPTION = 0,
+ TX_ENCRYPTION = 1,
+ RX_ENCRYPTION = 2,
+ HP_ENCRYPTION = 3
+};
+
+struct hif_sl_msg_hdr {
+ uint32_t seqnum:30;
+ uint32_t encrypted:2;
+} __packed;
+
+struct hif_sl_msg {
+ struct hif_sl_msg_hdr hdr;
+ uint16_t len;
+ uint8_t payload[];
+} __packed;
+
+#define AES_CCM_TAG_SIZE 16
+
+struct hif_sl_tag {
+ uint8_t tag[16];
+} __packed;
+
+enum hif_sl_mac_key_dest {
+ SL_MAC_KEY_DEST_OTP = 0x78,
+ SL_MAC_KEY_DEST_RAM = 0x87
+};
+
+#define API_KEY_VALUE_SIZE 32
+
+struct hif_req_set_sl_mac_key {
+ uint8_t otp_or_ram;
+ uint8_t key_value[API_KEY_VALUE_SIZE];
+} __packed;
+
+struct hif_cnf_set_sl_mac_key {
+ uint32_t status;
+} __packed;
+
+#define API_HOST_PUB_KEY_SIZE 32
+#define API_HOST_PUB_KEY_MAC_SIZE 64
+
+enum hif_sl_session_key_alg {
+ HIF_SL_CURVE25519 = 0x01,
+ HIF_SL_KDF = 0x02
+};
+
+struct hif_req_sl_exchange_pub_keys {
+ uint8_t algorithm:2;
+ uint8_t reserved1:6;
+ uint8_t reserved2[3];
+ uint8_t host_pub_key[API_HOST_PUB_KEY_SIZE];
+ uint8_t host_pub_key_mac[API_HOST_PUB_KEY_MAC_SIZE];
+} __packed;
+
+struct hif_cnf_sl_exchange_pub_keys {
+ uint32_t status;
+} __packed;
+
+#define API_NCP_PUB_KEY_SIZE 32
+#define API_NCP_PUB_KEY_MAC_SIZE 64
+
+struct hif_ind_sl_exchange_pub_keys {
+ uint32_t status;
+ uint8_t ncp_pub_key[API_NCP_PUB_KEY_SIZE];
+ uint8_t ncp_pub_key_mac[API_NCP_PUB_KEY_MAC_SIZE];
+} __packed;
+
+#define API_ENCR_BMP_SIZE 32
+
+struct hif_req_sl_configure {
+ uint8_t encr_bmp[API_ENCR_BMP_SIZE];
+ uint8_t disable_session_key_protection:1;
+ uint8_t reserved1:7;
+ uint8_t reserved2[3];
+} __packed;
+
+struct hif_cnf_sl_configure {
+ uint32_t status;
+} __packed;
+
+struct hif_req_prevent_rollback {
+ uint32_t magic_word;
+} __packed;
+
+struct hif_cnf_prevent_rollback {
+ uint32_t status;
+} __packed;
+
+enum hif_pta_mode {
+ PTA_1W_WLAN_MASTER = 0,
+ PTA_1W_COEX_MASTER = 1,
+ PTA_2W = 2,
+ PTA_3W = 3,
+ PTA_4W = 4
+};
+
+enum hif_signal_level {
+ SIGNAL_LOW = 0,
+ SIGNAL_HIGH = 1
+};
+
+enum hif_coex_type {
+ COEX_TYPE_GENERIC = 0,
+ COEX_TYPE_BLE = 1
+};
+
+enum hif_grant_state {
+ NO_GRANT = 0,
+ GRANT = 1
+};
+
+struct hif_req_pta_settings {
+ uint8_t pta_mode;
+ uint8_t request_signal_active_level;
+ uint8_t priority_signal_active_level;
+ uint8_t freq_signal_active_level;
+ uint8_t grant_signal_active_level;
+ uint8_t coex_type;
+ uint8_t default_grant_state;
+ uint8_t simultaneous_rx_accesses;
+ uint8_t priority_sampling_time;
+ uint8_t tx_rx_sampling_time;
+ uint8_t freq_sampling_time;
+ uint8_t grant_valid_time;
+ uint8_t fem_control_time;
+ uint8_t first_slot_time;
+ uint16_t periodic_tx_rx_sampling_time;
+ uint16_t coex_quota;
+ uint16_t wlan_quota;
+} __packed;
+
+struct hif_cnf_pta_settings {
+ uint32_t status;
+} __packed;
+
+enum hif_pta_priority {
+ HIF_PTA_PRIORITY_COEX_MAXIMIZED = 0x00000562,
+ HIF_PTA_PRIORITY_COEX_HIGH = 0x00000462,
+ HIF_PTA_PRIORITY_BALANCED = 0x00001461,
+ HIF_PTA_PRIORITY_WLAN_HIGH = 0x00001851,
+ HIF_PTA_PRIORITY_WLAN_MAXIMIZED = 0x00001A51
+};
+
+struct hif_req_pta_priority {
+ uint32_t priority;
+} __packed;
+
+struct hif_cnf_pta_priority {
+ uint32_t status;
+} __packed;
+
+enum hif_pta_state {
+ PTA_OFF = 0,
+ PTA_ON = 1
+};
+
+struct hif_req_pta_state {
+ uint32_t pta_state;
+} __packed;
+
+struct hif_cnf_pta_state {
+ uint32_t status;
+} __packed;
+
+#endif
diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h
new file mode 100644
index 000000000000..3c56ef2978a2
--- /dev/null
+++ b/drivers/staging/wfx/hif_api_mib.h
@@ -0,0 +1,558 @@
+/* SPDX-License-Identifier: Apache-2.0 */
+/*
+ * WFx hardware interface definitions
+ *
+ * Copyright (c) 2018-2019, Silicon Laboratories Inc.
+ */
+
+#ifndef WFX_HIF_API_MIB_H
+#define WFX_HIF_API_MIB_H
+
+#include "hif_api_general.h"
+
+#define HIF_API_IPV4_ADDRESS_SIZE 4
+#define HIF_API_IPV6_ADDRESS_SIZE 16
+
+enum hif_mib_ids {
+ HIF_MIB_ID_GL_OPERATIONAL_POWER_MODE = 0x2000,
+ HIF_MIB_ID_GL_BLOCK_ACK_INFO = 0x2001,
+ HIF_MIB_ID_GL_SET_MULTI_MSG = 0x2002,
+ HIF_MIB_ID_CCA_CONFIG = 0x2003,
+ HIF_MIB_ID_ETHERTYPE_DATAFRAME_CONDITION = 0x2010,
+ HIF_MIB_ID_PORT_DATAFRAME_CONDITION = 0x2011,
+ HIF_MIB_ID_MAGIC_DATAFRAME_CONDITION = 0x2012,
+ HIF_MIB_ID_MAC_ADDR_DATAFRAME_CONDITION = 0x2013,
+ HIF_MIB_ID_IPV4_ADDR_DATAFRAME_CONDITION = 0x2014,
+ HIF_MIB_ID_IPV6_ADDR_DATAFRAME_CONDITION = 0x2015,
+ HIF_MIB_ID_UC_MC_BC_DATAFRAME_CONDITION = 0x2016,
+ HIF_MIB_ID_CONFIG_DATA_FILTER = 0x2017,
+ HIF_MIB_ID_SET_DATA_FILTERING = 0x2018,
+ HIF_MIB_ID_ARP_IP_ADDRESSES_TABLE = 0x2019,
+ HIF_MIB_ID_NS_IP_ADDRESSES_TABLE = 0x201A,
+ HIF_MIB_ID_RX_FILTER = 0x201B,
+ HIF_MIB_ID_BEACON_FILTER_TABLE = 0x201C,
+ HIF_MIB_ID_BEACON_FILTER_ENABLE = 0x201D,
+ HIF_MIB_ID_GRP_SEQ_COUNTER = 0x2030,
+ HIF_MIB_ID_TSF_COUNTER = 0x2031,
+ HIF_MIB_ID_STATISTICS_TABLE = 0x2032,
+ HIF_MIB_ID_COUNTERS_TABLE = 0x2033,
+ HIF_MIB_ID_MAX_TX_POWER_LEVEL = 0x2034,
+ HIF_MIB_ID_EXTENDED_COUNTERS_TABLE = 0x2035,
+ HIF_MIB_ID_DOT11_MAC_ADDRESS = 0x2040,
+ HIF_MIB_ID_DOT11_MAX_TRANSMIT_MSDU_LIFETIME = 0x2041,
+ HIF_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME = 0x2042,
+ HIF_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID = 0x2043,
+ HIF_MIB_ID_DOT11_RTS_THRESHOLD = 0x2044,
+ HIF_MIB_ID_SLOT_TIME = 0x2045,
+ HIF_MIB_ID_CURRENT_TX_POWER_LEVEL = 0x2046,
+ HIF_MIB_ID_NON_ERP_PROTECTION = 0x2047,
+ HIF_MIB_ID_TEMPLATE_FRAME = 0x2048,
+ HIF_MIB_ID_BEACON_WAKEUP_PERIOD = 0x2049,
+ HIF_MIB_ID_RCPI_RSSI_THRESHOLD = 0x204A,
+ HIF_MIB_ID_BLOCK_ACK_POLICY = 0x204B,
+ HIF_MIB_ID_OVERRIDE_INTERNAL_TX_RATE = 0x204C,
+ HIF_MIB_ID_SET_ASSOCIATION_MODE = 0x204D,
+ HIF_MIB_ID_SET_UAPSD_INFORMATION = 0x204E,
+ HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY = 0x204F,
+ HIF_MIB_ID_PROTECTED_MGMT_POLICY = 0x2050,
+ HIF_MIB_ID_SET_HT_PROTECTION = 0x2051,
+ HIF_MIB_ID_KEEP_ALIVE_PERIOD = 0x2052,
+ HIF_MIB_ID_ARP_KEEP_ALIVE_PERIOD = 0x2053,
+ HIF_MIB_ID_INACTIVITY_TIMER = 0x2054,
+ HIF_MIB_ID_INTERFACE_PROTECTION = 0x2055,
+ HIF_MIB_ID_BEACON_STATS = 0x2056,
+};
+
+#define HIF_OP_POWER_MODE_MASK 0xf
+
+enum hif_op_power_mode {
+ HIF_OP_POWER_MODE_ACTIVE = 0x0,
+ HIF_OP_POWER_MODE_DOZE = 0x1,
+ HIF_OP_POWER_MODE_QUIESCENT = 0x2
+};
+
+struct hif_mib_gl_operational_power_mode {
+ uint8_t power_mode:4;
+ uint8_t reserved1:3;
+ uint8_t wup_ind_activation:1;
+ uint8_t reserved2[3];
+} __packed;
+
+struct hif_mib_gl_block_ack_info {
+ uint8_t rx_buffer_size;
+ uint8_t rx_max_num_agreements;
+ uint8_t tx_buffer_size;
+ uint8_t tx_max_num_agreements;
+} __packed;
+
+struct hif_mib_gl_set_multi_msg {
+ uint8_t enable_multi_tx_conf:1;
+ uint8_t reserved1:7;
+ uint8_t reserved2[3];
+} __packed;
+
+enum hif_cca_thr_mode {
+ HIF_CCA_THR_MODE_RELATIVE = 0x0,
+ HIF_CCA_THR_MODE_ABSOLUTE = 0x1
+};
+
+struct hif_mib_gl_cca_config {
+ uint8_t cca_thr_mode;
+ uint8_t reserved[3];
+} __packed;
+
+#define MAX_NUMBER_DATA_FILTERS 0xA
+
+#define MAX_NUMBER_IPV4_ADDR_CONDITIONS 0x4
+#define MAX_NUMBER_IPV6_ADDR_CONDITIONS 0x4
+#define MAX_NUMBER_MAC_ADDR_CONDITIONS 0x4
+#define MAX_NUMBER_UC_MC_BC_CONDITIONS 0x4
+#define MAX_NUMBER_ETHER_TYPE_CONDITIONS 0x4
+#define MAX_NUMBER_PORT_CONDITIONS 0x4
+#define MAX_NUMBER_MAGIC_CONDITIONS 0x4
+#define MAX_NUMBER_ARP_CONDITIONS 0x2
+#define MAX_NUMBER_NS_CONDITIONS 0x2
+
+struct hif_mib_ethertype_data_frame_condition {
+ uint8_t condition_idx;
+ uint8_t reserved;
+ uint16_t ether_type;
+} __packed;
+
+enum hif_udp_tcp_protocol {
+ HIF_PROTOCOL_UDP = 0x0,
+ HIF_PROTOCOL_TCP = 0x1,
+ HIF_PROTOCOL_BOTH_UDP_TCP = 0x2
+};
+
+enum hif_which_port {
+ HIF_PORT_DST = 0x0,
+ HIF_PORT_SRC = 0x1,
+ HIF_PORT_SRC_OR_DST = 0x2
+};
+
+struct hif_mib_ports_data_frame_condition {
+ uint8_t condition_idx;
+ uint8_t protocol;
+ uint8_t which_port;
+ uint8_t reserved1;
+ uint16_t port_number;
+ uint8_t reserved2[2];
+} __packed;
+
+#define HIF_API_MAGIC_PATTERN_SIZE 32
+
+struct hif_mib_magic_data_frame_condition {
+ uint8_t condition_idx;
+ uint8_t offset;
+ uint8_t magic_pattern_length;
+ uint8_t reserved;
+ uint8_t magic_pattern[HIF_API_MAGIC_PATTERN_SIZE];
+} __packed;
+
+enum hif_mac_addr_type {
+ HIF_MAC_ADDR_A1 = 0x0,
+ HIF_MAC_ADDR_A2 = 0x1,
+ HIF_MAC_ADDR_A3 = 0x2
+};
+
+struct hif_mib_mac_addr_data_frame_condition {
+ uint8_t condition_idx;
+ uint8_t address_type;
+ uint8_t mac_address[ETH_ALEN];
+} __packed;
+
+enum hif_ip_addr_mode {
+ HIF_IP_ADDR_SRC = 0x0,
+ HIF_IP_ADDR_DST = 0x1
+};
+
+struct hif_mib_ipv4_addr_data_frame_condition {
+ uint8_t condition_idx;
+ uint8_t address_mode;
+ uint8_t reserved[2];
+ uint8_t i_pv4_address[HIF_API_IPV4_ADDRESS_SIZE];
+} __packed;
+
+struct hif_mib_ipv6_addr_data_frame_condition {
+ uint8_t condition_idx;
+ uint8_t address_mode;
+ uint8_t reserved[2];
+ uint8_t i_pv6_address[HIF_API_IPV6_ADDRESS_SIZE];
+} __packed;
+
+union hif_addr_type {
+ uint8_t value;
+ struct {
+ uint8_t type_unicast:1;
+ uint8_t type_multicast:1;
+ uint8_t type_broadcast:1;
+ uint8_t reserved:5;
+ } bits;
+};
+
+struct hif_mib_uc_mc_bc_data_frame_condition {
+ uint8_t condition_idx;
+ union hif_addr_type param;
+ uint8_t reserved[2];
+} __packed;
+
+struct hif_mib_config_data_filter {
+ uint8_t filter_idx;
+ uint8_t enable;
+ uint8_t reserved1[2];
+ uint8_t eth_type_cond;
+ uint8_t port_cond;
+ uint8_t magic_cond;
+ uint8_t mac_cond;
+ uint8_t ipv4_cond;
+ uint8_t ipv6_cond;
+ uint8_t uc_mc_bc_cond;
+ uint8_t reserved2;
+} __packed;
+
+struct hif_mib_set_data_filtering {
+ uint8_t default_filter;
+ uint8_t enable;
+ uint8_t reserved[2];
+} __packed;
+
+enum hif_arp_ns_frame_treatment {
+ HIF_ARP_NS_FILTERING_DISABLE = 0x0,
+ HIF_ARP_NS_FILTERING_ENABLE = 0x1,
+ HIF_ARP_NS_REPLY_ENABLE = 0x2
+};
+
+struct hif_mib_arp_ip_addr_table {
+ uint8_t condition_idx;
+ uint8_t arp_enable;
+ uint8_t reserved[2];
+ uint8_t ipv4_address[HIF_API_IPV4_ADDRESS_SIZE];
+} __packed;
+
+struct hif_mib_ns_ip_addr_table {
+ uint8_t condition_idx;
+ uint8_t ns_enable;
+ uint8_t reserved[2];
+ uint8_t ipv6_address[HIF_API_IPV6_ADDRESS_SIZE];
+} __packed;
+
+struct hif_mib_rx_filter {
+ uint8_t reserved1:1;
+ uint8_t bssid_filter:1;
+ uint8_t reserved2:1;
+ uint8_t fwd_probe_req:1;
+ uint8_t keep_alive_filter:1;
+ uint8_t reserved3:3;
+ uint8_t reserved4[3];
+} __packed;
+
+#define HIF_API_OUI_SIZE 3
+#define HIF_API_MATCH_DATA_SIZE 3
+
+struct hif_ie_table_entry {
+ uint8_t ie_id;
+ uint8_t has_changed:1;
+ uint8_t no_longer:1;
+ uint8_t has_appeared:1;
+ uint8_t reserved:1;
+ uint8_t num_match_data:4;
+ uint8_t oui[HIF_API_OUI_SIZE];
+ uint8_t match_data[HIF_API_MATCH_DATA_SIZE];
+} __packed;
+
+struct hif_mib_bcn_filter_table {
+ uint32_t num_of_info_elmts;
+ struct hif_ie_table_entry ie_table[];
+} __packed;
+
+enum hif_beacon_filter {
+ HIF_BEACON_FILTER_DISABLE = 0x0,
+ HIF_BEACON_FILTER_ENABLE = 0x1,
+ HIF_BEACON_FILTER_AUTO_ERP = 0x2
+};
+
+struct hif_mib_bcn_filter_enable {
+ uint32_t enable;
+ uint32_t bcn_count;
+} __packed;
+
+struct hif_mib_group_seq_counter {
+ uint32_t bits4716;
+ uint16_t bits1500;
+ uint16_t reserved;
+} __packed;
+
+struct hif_mib_tsf_counter {
+ uint32_t tsf_counterlo;
+ uint32_t tsf_counterhi;
+} __packed;
+
+struct hif_mib_stats_table {
+ int16_t latest_snr;
+ uint8_t latest_rcpi;
+ int8_t latest_rssi;
+} __packed;
+
+struct hif_mib_extended_count_table {
+ uint32_t count_plcp_errors;
+ uint32_t count_fcs_errors;
+ uint32_t count_tx_packets;
+ uint32_t count_rx_packets;
+ uint32_t count_rx_packet_errors;
+ uint32_t count_rx_decryption_failures;
+ uint32_t count_rx_mic_failures;
+ uint32_t count_rx_no_key_failures;
+ uint32_t count_tx_multicast_frames;
+ uint32_t count_tx_frames_success;
+ uint32_t count_tx_frame_failures;
+ uint32_t count_tx_frames_retried;
+ uint32_t count_tx_frames_multi_retried;
+ uint32_t count_rx_frame_duplicates;
+ uint32_t count_rts_success;
+ uint32_t count_rts_failures;
+ uint32_t count_ack_failures;
+ uint32_t count_rx_multicast_frames;
+ uint32_t count_rx_frames_success;
+ uint32_t count_rx_cmacicv_errors;
+ uint32_t count_rx_cmac_replays;
+ uint32_t count_rx_mgmt_ccmp_replays;
+ uint32_t count_rx_bipmic_errors;
+ uint32_t count_rx_beacon;
+ uint32_t count_miss_beacon;
+ uint32_t reserved[15];
+} __packed;
+
+struct hif_mib_count_table {
+ uint32_t count_plcp_errors;
+ uint32_t count_fcs_errors;
+ uint32_t count_tx_packets;
+ uint32_t count_rx_packets;
+ uint32_t count_rx_packet_errors;
+ uint32_t count_rx_decryption_failures;
+ uint32_t count_rx_mic_failures;
+ uint32_t count_rx_no_key_failures;
+ uint32_t count_tx_multicast_frames;
+ uint32_t count_tx_frames_success;
+ uint32_t count_tx_frame_failures;
+ uint32_t count_tx_frames_retried;
+ uint32_t count_tx_frames_multi_retried;
+ uint32_t count_rx_frame_duplicates;
+ uint32_t count_rts_success;
+ uint32_t count_rts_failures;
+ uint32_t count_ack_failures;
+ uint32_t count_rx_multicast_frames;
+ uint32_t count_rx_frames_success;
+ uint32_t count_rx_cmacicv_errors;
+ uint32_t count_rx_cmac_replays;
+ uint32_t count_rx_mgmt_ccmp_replays;
+ uint32_t count_rx_bipmic_errors;
+} __packed;
+
+struct hif_mib_max_tx_power_level {
+ int32_t max_tx_power_level_rf_port1;
+ int32_t max_tx_power_level_rf_port2;
+} __packed;
+
+struct hif_mib_beacon_stats {
+ int32_t latest_tbtt_diff;
+ uint32_t reserved[4];
+} __packed;
+
+struct hif_mib_mac_address {
+ uint8_t mac_addr[ETH_ALEN];
+ uint16_t reserved;
+} __packed;
+
+struct hif_mib_dot11_max_transmit_msdu_lifetime {
+ uint32_t max_life_time;
+} __packed;
+
+struct hif_mib_dot11_max_receive_lifetime {
+ uint32_t max_life_time;
+} __packed;
+
+struct hif_mib_wep_default_key_id {
+ uint8_t wep_default_key_id;
+ uint8_t reserved[3];
+} __packed;
+
+struct hif_mib_dot11_rts_threshold {
+ uint32_t threshold;
+} __packed;
+
+struct hif_mib_slot_time {
+ uint32_t slot_time;
+} __packed;
+
+struct hif_mib_current_tx_power_level {
+ int32_t power_level;
+} __packed;
+
+struct hif_mib_non_erp_protection {
+ uint8_t use_cts_to_self:1;
+ uint8_t reserved1:7;
+ uint8_t reserved2[3];
+} __packed;
+
+enum hif_tx_mode {
+ HIF_TX_MODE_MIXED = 0x0,
+ HIF_TX_MODE_GREENFIELD = 0x1
+};
+
+enum hif_tmplt {
+ HIF_TMPLT_PRBREQ = 0x0,
+ HIF_TMPLT_BCN = 0x1,
+ HIF_TMPLT_NULL = 0x2,
+ HIF_TMPLT_QOSNUL = 0x3,
+ HIF_TMPLT_PSPOLL = 0x4,
+ HIF_TMPLT_PRBRES = 0x5,
+ HIF_TMPLT_ARP = 0x6,
+ HIF_TMPLT_NA = 0x7
+};
+
+#define HIF_API_MAX_TEMPLATE_FRAME_SIZE 700
+
+struct hif_mib_template_frame {
+ uint8_t frame_type;
+ uint8_t init_rate:7;
+ uint8_t mode:1;
+ uint16_t frame_length;
+ uint8_t frame[HIF_API_MAX_TEMPLATE_FRAME_SIZE];
+} __packed;
+
+struct hif_mib_beacon_wake_up_period {
+ uint8_t wakeup_period_min;
+ uint8_t receive_dtim:1;
+ uint8_t reserved1:7;
+ uint8_t wakeup_period_max;
+ uint8_t reserved2;
+} __packed;
+
+struct hif_mib_rcpi_rssi_threshold {
+ uint8_t detection:1;
+ uint8_t rcpi_rssi:1;
+ uint8_t upperthresh:1;
+ uint8_t lowerthresh:1;
+ uint8_t reserved:4;
+ uint8_t lower_threshold;
+ uint8_t upper_threshold;
+ uint8_t rolling_average_count;
+} __packed;
+
+#define DEFAULT_BA_MAX_RX_BUFFER_SIZE 16
+
+struct hif_mib_block_ack_policy {
+ uint8_t block_ack_tx_tid_policy;
+ uint8_t reserved1;
+ uint8_t block_ack_rx_tid_policy;
+ uint8_t block_ack_rx_max_buffer_size;
+} __packed;
+
+struct hif_mib_override_int_rate {
+ uint8_t internal_tx_rate;
+ uint8_t non_erp_internal_tx_rate;
+ uint8_t reserved[2];
+} __packed;
+
+enum hif_mpdu_start_spacing {
+ HIF_MPDU_START_SPACING_NO_RESTRIC = 0x0,
+ HIF_MPDU_START_SPACING_QUARTER = 0x1,
+ HIF_MPDU_START_SPACING_HALF = 0x2,
+ HIF_MPDU_START_SPACING_ONE = 0x3,
+ HIF_MPDU_START_SPACING_TWO = 0x4,
+ HIF_MPDU_START_SPACING_FOUR = 0x5,
+ HIF_MPDU_START_SPACING_EIGHT = 0x6,
+ HIF_MPDU_START_SPACING_SIXTEEN = 0x7
+};
+
+struct hif_mib_set_association_mode {
+ uint8_t preambtype_use:1;
+ uint8_t mode:1;
+ uint8_t rateset:1;
+ uint8_t spacing:1;
+ uint8_t reserved:4;
+ uint8_t preamble_type;
+ uint8_t mixed_or_greenfield_type;
+ uint8_t mpdu_start_spacing;
+ uint32_t basic_rate_set;
+} __packed;
+
+struct hif_mib_set_uapsd_information {
+ uint8_t trig_bckgrnd:1;
+ uint8_t trig_be:1;
+ uint8_t trig_video:1;
+ uint8_t trig_voice:1;
+ uint8_t reserved1:4;
+ uint8_t deliv_bckgrnd:1;
+ uint8_t deliv_be:1;
+ uint8_t deliv_video:1;
+ uint8_t deliv_voice:1;
+ uint8_t reserved2:4;
+ uint16_t min_auto_trigger_interval;
+ uint16_t max_auto_trigger_interval;
+ uint16_t auto_trigger_step;
+} __packed;
+
+struct hif_mib_tx_rate_retry_policy {
+ uint8_t policy_index;
+ uint8_t short_retry_count;
+ uint8_t long_retry_count;
+ uint8_t first_rate_sel:2;
+ uint8_t terminate:1;
+ uint8_t count_init:1;
+ uint8_t reserved1:4;
+ uint8_t rate_recovery_count;
+ uint8_t reserved2[3];
+ uint8_t rates[12];
+} __packed;
+
+#define HIF_MIB_NUM_TX_RATE_RETRY_POLICIES 16
+
+struct hif_mib_set_tx_rate_retry_policy {
+ uint8_t num_tx_rate_policies;
+ uint8_t reserved[3];
+ struct hif_mib_tx_rate_retry_policy tx_rate_retry_policy[];
+} __packed;
+
+struct hif_mib_protected_mgmt_policy {
+ uint8_t pmf_enable:1;
+ uint8_t unpmf_allowed:1;
+ uint8_t host_enc_auth_frames:1;
+ uint8_t reserved1:5;
+ uint8_t reserved2[3];
+} __packed;
+
+struct hif_mib_set_ht_protection {
+ uint8_t dual_cts_prot:1;
+ uint8_t reserved1:7;
+ uint8_t reserved2[3];
+} __packed;
+
+struct hif_mib_keep_alive_period {
+ uint16_t keep_alive_period;
+ uint8_t reserved[2];
+} __packed;
+
+struct hif_mib_arp_keep_alive_period {
+ uint16_t arp_keep_alive_period;
+ uint8_t encr_type;
+ uint8_t reserved;
+ uint8_t sender_ipv4_address[HIF_API_IPV4_ADDRESS_SIZE];
+ uint8_t target_ipv4_address[HIF_API_IPV4_ADDRESS_SIZE];
+} __packed;
+
+struct hif_mib_inactivity_timer {
+ uint8_t min_active_time;
+ uint8_t max_active_time;
+ uint16_t reserved;
+} __packed;
+
+struct hif_mib_interface_protection {
+ uint8_t use_cts_prot:1;
+ uint8_t reserved1:7;
+ uint8_t reserved2[3];
+} __packed;
+
+
+#endif
--
2.20.1