linux/drivers/net/wireless/ath/ath6kl/core.h

/*
 * Copyright (c) 2010-2011 Atheros Communications Inc.
 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef CORE_H
#define CORE_H

#include <linux/etherdevice.h>
#include <linux/rtnetlink.h>
#include <linux/firmware.h>
#include <linux/sched.h>
#include <linux/circ_buf.h>
#include <net/cfg80211.h>
#include "htc.h"
#include "wmi.h"
#include "bmi.h"
#include "target.h"

#define MAX_ATH6KL
#define ATH6KL_MAX_RX_BUFFERS
#define ATH6KL_BUFFER_SIZE
#define ATH6KL_MAX_AMSDU_RX_BUFFERS
#define ATH6KL_AMSDU_REFILL_THRESHOLD
#define ATH6KL_AMSDU_BUFFER_SIZE
#define MAX_MSDU_SUBFRAME_PAYLOAD_LEN
#define MIN_MSDU_SUBFRAME_PAYLOAD_LEN

#define USER_SAVEDKEYS_STAT_INIT
#define USER_SAVEDKEYS_STAT_RUN

#define ATH6KL_TX_TIMEOUT
#define ATH6KL_MAX_ENDPOINTS
#define MAX_NODE_NUM

#define ATH6KL_APSD_ALL_FRAME
#define ATH6KL_APSD_NUM_OF_AC
#define ATH6KL_APSD_FRAME_MASK

/* Extra bytes for htc header alignment */
#define ATH6KL_HTC_ALIGN_BYTES

/* MAX_HI_COOKIE_NUM are reserved for high priority traffic */
#define MAX_DEF_COOKIE_NUM
#define MAX_HI_COOKIE_NUM
#define MAX_COOKIE_NUM

#define MAX_DEFAULT_SEND_QUEUE_DEPTH

#define DISCON_TIMER_INTVAL

/* Channel dwell time in fg scan */
#define ATH6KL_FG_SCAN_INTERVAL

/* includes also the null byte */
#define ATH6KL_FIRMWARE_MAGIC

enum ath6kl_fw_ie_type {};

enum ath6kl_fw_capability {};

#define ATH6KL_CAPABILITY_LEN

struct ath6kl_fw_ie {};

enum ath6kl_hw_flags {};

#define ATH6KL_FW_API2_FILE
#define ATH6KL_FW_API3_FILE
#define ATH6KL_FW_API4_FILE
#define ATH6KL_FW_API5_FILE

/* AR6003 1.0 definitions */
#define AR6003_HW_1_0_VERSION

/* AR6003 2.0 definitions */
#define AR6003_HW_2_0_VERSION
#define AR6003_HW_2_0_PATCH_DOWNLOAD_ADDRESS
#define AR6003_HW_2_0_FW_DIR
#define AR6003_HW_2_0_OTP_FILE
#define AR6003_HW_2_0_FIRMWARE_FILE
#define AR6003_HW_2_0_TCMD_FIRMWARE_FILE
#define AR6003_HW_2_0_PATCH_FILE
#define AR6003_HW_2_0_BOARD_DATA_FILE
#define AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE

/* AR6003 3.0 definitions */
#define AR6003_HW_2_1_1_VERSION
#define AR6003_HW_2_1_1_FW_DIR
#define AR6003_HW_2_1_1_OTP_FILE
#define AR6003_HW_2_1_1_FIRMWARE_FILE
#define AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE
#define AR6003_HW_2_1_1_UTF_FIRMWARE_FILE
#define AR6003_HW_2_1_1_TESTSCRIPT_FILE
#define AR6003_HW_2_1_1_PATCH_FILE
#define AR6003_HW_2_1_1_BOARD_DATA_FILE
#define AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE

/* AR6004 1.0 definitions */
#define AR6004_HW_1_0_VERSION
#define AR6004_HW_1_0_FW_DIR
#define AR6004_HW_1_0_FIRMWARE_FILE
#define AR6004_HW_1_0_BOARD_DATA_FILE
#define AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE

/* AR6004 1.1 definitions */
#define AR6004_HW_1_1_VERSION
#define AR6004_HW_1_1_FW_DIR
#define AR6004_HW_1_1_FIRMWARE_FILE
#define AR6004_HW_1_1_BOARD_DATA_FILE
#define AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE

/* AR6004 1.2 definitions */
#define AR6004_HW_1_2_VERSION
#define AR6004_HW_1_2_FW_DIR
#define AR6004_HW_1_2_FIRMWARE_FILE
#define AR6004_HW_1_2_BOARD_DATA_FILE
#define AR6004_HW_1_2_DEFAULT_BOARD_DATA_FILE

/* AR6004 1.3 definitions */
#define AR6004_HW_1_3_VERSION
#define AR6004_HW_1_3_FW_DIR
#define AR6004_HW_1_3_FIRMWARE_FILE
#define AR6004_HW_1_3_TCMD_FIRMWARE_FILE
#define AR6004_HW_1_3_UTF_FIRMWARE_FILE
#define AR6004_HW_1_3_TESTSCRIPT_FILE
#define AR6004_HW_1_3_BOARD_DATA_FILE
#define AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE

/* AR6004 3.0 definitions */
#define AR6004_HW_3_0_VERSION
#define AR6004_HW_3_0_FW_DIR
#define AR6004_HW_3_0_FIRMWARE_FILE
#define AR6004_HW_3_0_TCMD_FIRMWARE_FILE
#define AR6004_HW_3_0_UTF_FIRMWARE_FILE
#define AR6004_HW_3_0_TESTSCRIPT_FILE
#define AR6004_HW_3_0_BOARD_DATA_FILE
#define AR6004_HW_3_0_DEFAULT_BOARD_DATA_FILE

/* Per STA data, used in AP mode */
#define STA_PS_AWAKE
#define STA_PS_SLEEP
#define STA_PS_POLLED
#define STA_PS_APSD_TRIGGER
#define STA_PS_APSD_EOSP

/* HTC TX packet tagging definitions */
#define ATH6KL_CONTROL_PKT_TAG
#define ATH6KL_DATA_PKT_TAG

#define AR6003_CUST_DATA_SIZE

#define AGGR_WIN_IDX(x, y)
#define AGGR_INCR_IDX(x, y)
#define AGGR_DCRM_IDX(x, y)
#define ATH6KL_MAX_SEQ_NO
#define ATH6KL_NEXT_SEQ_NO(x)

#define NUM_OF_TIDS
#define AGGR_SZ_DEFAULT

#define AGGR_WIN_SZ_MIN
#define AGGR_WIN_SZ_MAX

#define TID_WINDOW_SZ(_x)

#define AGGR_NUM_OF_FREE_NETBUFS

#define AGGR_RX_TIMEOUT

#define WMI_TIMEOUT

#define MBOX_YIELD_LIMIT

#define ATH6KL_DEFAULT_LISTEN_INTVAL
#define ATH6KL_DEFAULT_BMISS_TIME
#define ATH6KL_MAX_WOW_LISTEN_INTL
#define ATH6KL_MAX_BMISS_TIME

/* configuration lags */
/*
 * ATH6KL_CONF_IGNORE_ERP_BARKER: Ignore the barker premable in
 * ERP IE of beacon to determine the short premable support when
 * sending (Re)Assoc req.
 * ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN: Don't send the power
 * module state transition failure events which happen during
 * scan, to the host.
 */
#define ATH6KL_CONF_IGNORE_ERP_BARKER
#define ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN
#define ATH6KL_CONF_ENABLE_11N
#define ATH6KL_CONF_ENABLE_TX_BURST
#define ATH6KL_CONF_UART_DEBUG

#define P2P_WILDCARD_SSID_LEN

enum wlan_low_pwr_state {};

enum sme_state {};

struct skb_hold_q {};

struct rxtid {};

struct rxtid_stats {};

struct aggr_info_conn {};

struct aggr_info {};

struct ath6kl_wep_key {};

#define ATH6KL_KEY_SEQ_LEN

struct ath6kl_key {};

struct ath6kl_node_mapping {};

struct ath6kl_cookie {};

struct ath6kl_mgmt_buff {};

struct ath6kl_sta {};

struct ath6kl_version {};

struct ath6kl_bmi {};

struct target_stats {};

struct ath6kl_mbox_info {};

/*
 * 802.11i defines an extended IV for use with non-WEP ciphers.
 * When the EXTIV bit is set in the key id byte an additional
 * 4 bytes immediately follow the IV for TKIP.  For CCMP the
 * EXTIV bit is likewise set but the 8 bytes represent the
 * CCMP header rather than IV+extended-IV.
 */

#define ATH6KL_KEYBUF_SIZE
#define ATH6KL_MICBUF_SIZE

#define ATH6KL_KEY_XMIT
#define ATH6KL_KEY_RECV
#define ATH6KL_KEY_DEFAULT

/* Initial group key for AP mode */
struct ath6kl_req_key {};

enum ath6kl_hif_type {};

enum ath6kl_htc_type {};

/* Max number of filters that hw supports */
#define ATH6K_MAX_MC_FILTERS_PER_LIST
struct ath6kl_mc_filter {};

struct ath6kl_htcap {};

/*
 * Driver's maximum limit, note that some firmwares support only one vif
 * and the runtime (current) limit must be checked from ar->vif_max.
 */
#define ATH6KL_VIF_MAX

/* vif flags info */
enum ath6kl_vif_state {};

struct ath6kl_vif {};

static inline struct ath6kl_vif *ath6kl_vif_from_wdev(struct wireless_dev *wdev)
{}

#define WOW_LIST_ID
#define WOW_HOST_REQ_DELAY

#define ATH6KL_SCHED_SCAN_RESULT_DELAY

/* Flag info */
enum ath6kl_dev_state {};

enum ath6kl_state {};

/* Fw error recovery */
#define ATH6KL_HB_RESP_MISS_THRES

enum ath6kl_fw_err {};

struct ath6kl {};

static inline struct ath6kl *ath6kl_priv(struct net_device *dev)
{}

static inline u32 ath6kl_get_hi_item_addr(struct ath6kl *ar,
					  u32 item_offset)
{}

int ath6kl_configure_target(struct ath6kl *ar);
void ath6kl_detect_error(unsigned long ptr);
void disconnect_timer_handler(struct timer_list *t);
void init_netdev(struct net_device *dev);
void ath6kl_cookie_init(struct ath6kl *ar);
void ath6kl_cookie_cleanup(struct ath6kl *ar);
void ath6kl_rx(struct htc_target *target, struct htc_packet *packet);
void ath6kl_tx_complete(struct htc_target *context,
			struct list_head *packet_queue);
enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
					       struct htc_packet *packet);
void ath6kl_stop_txrx(struct ath6kl *ar);
void ath6kl_cleanup_amsdu_rxbufs(struct ath6kl *ar);
int ath6kl_diag_write32(struct ath6kl *ar, u32 address, __le32 value);
int ath6kl_diag_write(struct ath6kl *ar, u32 address, void *data, u32 length);
int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value);
int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length);
int ath6kl_read_fwlogs(struct ath6kl *ar);
void ath6kl_init_profile_info(struct ath6kl_vif *vif);
void ath6kl_tx_data_cleanup(struct ath6kl *ar);

struct ath6kl_cookie *ath6kl_alloc_cookie(struct ath6kl *ar);
void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie);
netdev_tx_t ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev);

struct aggr_info *aggr_init(struct ath6kl_vif *vif);
void aggr_conn_init(struct ath6kl_vif *vif, struct aggr_info *aggr_info,
		    struct aggr_info_conn *aggr_conn);
void ath6kl_rx_refill(struct htc_target *target,
		      enum htc_endpoint_id endpoint);
void ath6kl_refill_amsdu_rxbufs(struct ath6kl *ar, int count);
struct htc_packet *ath6kl_alloc_amsdu_rxbuf(struct htc_target *target,
					    enum htc_endpoint_id endpoint,
					    int len);
void aggr_module_destroy(struct aggr_info *aggr_info);
void aggr_reset_state(struct aggr_info_conn *aggr_conn);

struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 *node_addr);
struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid);

void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver,
			enum wmi_phy_cap cap);
int ath6kl_control_tx(void *devt, struct sk_buff *skb,
		      enum htc_endpoint_id eid);
void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel,
			  u8 *bssid, u16 listen_int,
			  u16 beacon_int, enum network_type net_type,
			  u8 beacon_ie_len, u8 assoc_req_len,
			  u8 assoc_resp_len, u8 *assoc_info);
void ath6kl_connect_ap_mode_bss(struct ath6kl_vif *vif, u16 channel);
void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr,
				u8 keymgmt, u8 ucipher, u8 auth,
				u8 assoc_req_len, u8 *assoc_info, u8 apsd_info);
void ath6kl_disconnect_event(struct ath6kl_vif *vif, u8 reason,
			     u8 *bssid, u8 assoc_resp_len,
			     u8 *assoc_info, u16 prot_reason_status);
void ath6kl_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, bool ismcast);
void ath6kl_txpwr_rx_evt(void *devt, u8 tx_pwr);
void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status);
void ath6kl_tgt_stats_event(struct ath6kl_vif *vif, u8 *ptr, u32 len);
void ath6kl_indicate_tx_activity(void *devt, u8 traffic_class, bool active);
enum htc_endpoint_id ath6kl_ac2_endpoint_id(void *devt, u8 ac);

void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid);

void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif);
void ath6kl_disconnect(struct ath6kl_vif *vif);
void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid);
void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid, u16 seq_no,
			     u8 win_sz);
void ath6kl_wakeup_event(void *dev);

void ath6kl_init_control_info(struct ath6kl_vif *vif);
struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar);
void ath6kl_cfg80211_vif_stop(struct ath6kl_vif *vif, bool wmi_ready);
int ath6kl_init_hw_start(struct ath6kl *ar);
int ath6kl_init_hw_stop(struct ath6kl *ar);
int ath6kl_init_fetch_firmwares(struct ath6kl *ar);
int ath6kl_init_hw_params(struct ath6kl *ar);

void ath6kl_check_wow_status(struct ath6kl *ar);

void ath6kl_core_tx_complete(struct ath6kl *ar, struct sk_buff *skb);
void ath6kl_core_rx_complete(struct ath6kl *ar, struct sk_buff *skb, u8 pipe);

struct ath6kl *ath6kl_core_create(struct device *dev);
int ath6kl_core_init(struct ath6kl *ar, enum ath6kl_htc_type htc_type);
void ath6kl_core_cleanup(struct ath6kl *ar);
void ath6kl_core_destroy(struct ath6kl *ar);

/* Fw error recovery */
void ath6kl_init_hw_restart(struct ath6kl *ar);
void ath6kl_recovery_err_notify(struct ath6kl *ar, enum ath6kl_fw_err reason);
void ath6kl_recovery_hb_event(struct ath6kl *ar, u32 cookie);
void ath6kl_recovery_init(struct ath6kl *ar);
void ath6kl_recovery_cleanup(struct ath6kl *ar);
void ath6kl_recovery_suspend(struct ath6kl *ar);
void ath6kl_recovery_resume(struct ath6kl *ar);
#endif /* CORE_H */