18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2008-2009 Atheros Communications Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef ATH_H
188c2ecf20Sopenharmony_ci#define ATH_H
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <linux/etherdevice.h>
218c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
228c2ecf20Sopenharmony_ci#include <linux/if_ether.h>
238c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
248c2ecf20Sopenharmony_ci#include <net/mac80211.h>
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*
278c2ecf20Sopenharmony_ci * The key cache is used for h/w cipher state and also for
288c2ecf20Sopenharmony_ci * tracking station state such as the current tx antenna.
298c2ecf20Sopenharmony_ci * We also setup a mapping table between key cache slot indices
308c2ecf20Sopenharmony_ci * and station state to short-circuit node lookups on rx.
318c2ecf20Sopenharmony_ci * Different parts have different size key caches.  We handle
328c2ecf20Sopenharmony_ci * up to ATH_KEYMAX entries (could dynamically allocate state).
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define	ATH_KEYMAX	        128     /* max key cache size we handle */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistruct ath_ani {
378c2ecf20Sopenharmony_ci	bool caldone;
388c2ecf20Sopenharmony_ci	unsigned int longcal_timer;
398c2ecf20Sopenharmony_ci	unsigned int shortcal_timer;
408c2ecf20Sopenharmony_ci	unsigned int resetcal_timer;
418c2ecf20Sopenharmony_ci	unsigned int checkani_timer;
428c2ecf20Sopenharmony_ci	struct timer_list timer;
438c2ecf20Sopenharmony_ci};
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistruct ath_cycle_counters {
468c2ecf20Sopenharmony_ci	u32 cycles;
478c2ecf20Sopenharmony_ci	u32 rx_busy;
488c2ecf20Sopenharmony_ci	u32 rx_frame;
498c2ecf20Sopenharmony_ci	u32 tx_frame;
508c2ecf20Sopenharmony_ci};
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cienum ath_device_state {
538c2ecf20Sopenharmony_ci	ATH_HW_UNAVAILABLE,
548c2ecf20Sopenharmony_ci	ATH_HW_INITIALIZED,
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cienum ath_op_flags {
588c2ecf20Sopenharmony_ci	ATH_OP_INVALID,
598c2ecf20Sopenharmony_ci	ATH_OP_BEACONS,
608c2ecf20Sopenharmony_ci	ATH_OP_ANI_RUN,
618c2ecf20Sopenharmony_ci	ATH_OP_PRIM_STA_VIF,
628c2ecf20Sopenharmony_ci	ATH_OP_HW_RESET,
638c2ecf20Sopenharmony_ci	ATH_OP_SCANNING,
648c2ecf20Sopenharmony_ci	ATH_OP_MULTI_CHANNEL,
658c2ecf20Sopenharmony_ci	ATH_OP_WOW_ENABLED,
668c2ecf20Sopenharmony_ci};
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cienum ath_bus_type {
698c2ecf20Sopenharmony_ci	ATH_PCI,
708c2ecf20Sopenharmony_ci	ATH_AHB,
718c2ecf20Sopenharmony_ci	ATH_USB,
728c2ecf20Sopenharmony_ci};
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_cistruct reg_dmn_pair_mapping {
758c2ecf20Sopenharmony_ci	u16 reg_domain;
768c2ecf20Sopenharmony_ci	u16 reg_5ghz_ctl;
778c2ecf20Sopenharmony_ci	u16 reg_2ghz_ctl;
788c2ecf20Sopenharmony_ci};
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cistruct ath_regulatory {
818c2ecf20Sopenharmony_ci	char alpha2[2];
828c2ecf20Sopenharmony_ci	enum nl80211_dfs_regions region;
838c2ecf20Sopenharmony_ci	u16 country_code;
848c2ecf20Sopenharmony_ci	u16 max_power_level;
858c2ecf20Sopenharmony_ci	u16 current_rd;
868c2ecf20Sopenharmony_ci	int16_t power_limit;
878c2ecf20Sopenharmony_ci	struct reg_dmn_pair_mapping *regpair;
888c2ecf20Sopenharmony_ci};
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_cienum ath_crypt_caps {
918c2ecf20Sopenharmony_ci	ATH_CRYPT_CAP_CIPHER_AESCCM		= BIT(0),
928c2ecf20Sopenharmony_ci	ATH_CRYPT_CAP_MIC_COMBINED		= BIT(1),
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_cistruct ath_keyval {
968c2ecf20Sopenharmony_ci	u8 kv_type;
978c2ecf20Sopenharmony_ci	u8 kv_pad;
988c2ecf20Sopenharmony_ci	u16 kv_len;
998c2ecf20Sopenharmony_ci	struct_group(kv_values,
1008c2ecf20Sopenharmony_ci		u8 kv_val[16]; /* TK */
1018c2ecf20Sopenharmony_ci		u8 kv_mic[8]; /* Michael MIC key */
1028c2ecf20Sopenharmony_ci		u8 kv_txmic[8]; /* Michael MIC TX key (used only if the hardware
1038c2ecf20Sopenharmony_ci				 * supports both MIC keys in the same key cache entry;
1048c2ecf20Sopenharmony_ci				 * in that case, kv_mic is the RX key) */
1058c2ecf20Sopenharmony_ci	);
1068c2ecf20Sopenharmony_ci};
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_cienum ath_cipher {
1098c2ecf20Sopenharmony_ci	ATH_CIPHER_WEP = 0,
1108c2ecf20Sopenharmony_ci	ATH_CIPHER_AES_OCB = 1,
1118c2ecf20Sopenharmony_ci	ATH_CIPHER_AES_CCM = 2,
1128c2ecf20Sopenharmony_ci	ATH_CIPHER_CKIP = 3,
1138c2ecf20Sopenharmony_ci	ATH_CIPHER_TKIP = 4,
1148c2ecf20Sopenharmony_ci	ATH_CIPHER_CLR = 5,
1158c2ecf20Sopenharmony_ci	ATH_CIPHER_MIC = 127
1168c2ecf20Sopenharmony_ci};
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/**
1198c2ecf20Sopenharmony_ci * struct ath_ops - Register read/write operations
1208c2ecf20Sopenharmony_ci *
1218c2ecf20Sopenharmony_ci * @read: Register read
1228c2ecf20Sopenharmony_ci * @multi_read: Multiple register read
1238c2ecf20Sopenharmony_ci * @write: Register write
1248c2ecf20Sopenharmony_ci * @enable_write_buffer: Enable multiple register writes
1258c2ecf20Sopenharmony_ci * @write_flush: flush buffered register writes and disable buffering
1268c2ecf20Sopenharmony_ci */
1278c2ecf20Sopenharmony_cistruct ath_ops {
1288c2ecf20Sopenharmony_ci	unsigned int (*read)(void *, u32 reg_offset);
1298c2ecf20Sopenharmony_ci	void (*multi_read)(void *, u32 *addr, u32 *val, u16 count);
1308c2ecf20Sopenharmony_ci	void (*write)(void *, u32 val, u32 reg_offset);
1318c2ecf20Sopenharmony_ci	void (*enable_write_buffer)(void *);
1328c2ecf20Sopenharmony_ci	void (*write_flush) (void *);
1338c2ecf20Sopenharmony_ci	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
1348c2ecf20Sopenharmony_ci	void (*enable_rmw_buffer)(void *);
1358c2ecf20Sopenharmony_ci	void (*rmw_flush) (void *);
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci};
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_cistruct ath_common;
1408c2ecf20Sopenharmony_cistruct ath_bus_ops;
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_cistruct ath_ps_ops {
1438c2ecf20Sopenharmony_ci	void (*wakeup)(struct ath_common *common);
1448c2ecf20Sopenharmony_ci	void (*restore)(struct ath_common *common);
1458c2ecf20Sopenharmony_ci};
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_cistruct ath_common {
1488c2ecf20Sopenharmony_ci	void *ah;
1498c2ecf20Sopenharmony_ci	void *priv;
1508c2ecf20Sopenharmony_ci	struct ieee80211_hw *hw;
1518c2ecf20Sopenharmony_ci	int debug_mask;
1528c2ecf20Sopenharmony_ci	enum ath_device_state state;
1538c2ecf20Sopenharmony_ci	unsigned long op_flags;
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	struct ath_ani ani;
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci	u16 cachelsz;
1588c2ecf20Sopenharmony_ci	u16 curaid;
1598c2ecf20Sopenharmony_ci	u8 macaddr[ETH_ALEN];
1608c2ecf20Sopenharmony_ci	u8 curbssid[ETH_ALEN] __aligned(2);
1618c2ecf20Sopenharmony_ci	u8 bssidmask[ETH_ALEN];
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci	u32 rx_bufsize;
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	u32 keymax;
1668c2ecf20Sopenharmony_ci	DECLARE_BITMAP(keymap, ATH_KEYMAX);
1678c2ecf20Sopenharmony_ci	DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX);
1688c2ecf20Sopenharmony_ci	DECLARE_BITMAP(ccmp_keymap, ATH_KEYMAX);
1698c2ecf20Sopenharmony_ci	enum ath_crypt_caps crypt_caps;
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci	unsigned int clockrate;
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci	spinlock_t cc_lock;
1748c2ecf20Sopenharmony_ci	struct ath_cycle_counters cc_ani;
1758c2ecf20Sopenharmony_ci	struct ath_cycle_counters cc_survey;
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	struct ath_regulatory regulatory;
1788c2ecf20Sopenharmony_ci	struct ath_regulatory reg_world_copy;
1798c2ecf20Sopenharmony_ci	const struct ath_ops *ops;
1808c2ecf20Sopenharmony_ci	const struct ath_bus_ops *bus_ops;
1818c2ecf20Sopenharmony_ci	const struct ath_ps_ops *ps_ops;
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci	bool btcoex_enabled;
1848c2ecf20Sopenharmony_ci	bool disable_ani;
1858c2ecf20Sopenharmony_ci	bool bt_ant_diversity;
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	int last_rssi;
1888c2ecf20Sopenharmony_ci	struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
1898c2ecf20Sopenharmony_ci};
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_cistatic inline const struct ath_ps_ops *ath_ps_ops(struct ath_common *common)
1928c2ecf20Sopenharmony_ci{
1938c2ecf20Sopenharmony_ci	return common->ps_ops;
1948c2ecf20Sopenharmony_ci}
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cistruct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
1978c2ecf20Sopenharmony_ci				u32 len,
1988c2ecf20Sopenharmony_ci				gfp_t gfp_mask);
1998c2ecf20Sopenharmony_cibool ath_is_mybeacon(struct ath_common *common, struct ieee80211_hdr *hdr);
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_civoid ath_hw_setbssidmask(struct ath_common *common);
2028c2ecf20Sopenharmony_civoid ath_key_delete(struct ath_common *common, u8 hw_key_idx);
2038c2ecf20Sopenharmony_ciint ath_key_config(struct ath_common *common,
2048c2ecf20Sopenharmony_ci			  struct ieee80211_vif *vif,
2058c2ecf20Sopenharmony_ci			  struct ieee80211_sta *sta,
2068c2ecf20Sopenharmony_ci			  struct ieee80211_key_conf *key);
2078c2ecf20Sopenharmony_cibool ath_hw_keyreset(struct ath_common *common, u16 entry);
2088c2ecf20Sopenharmony_cibool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac);
2098c2ecf20Sopenharmony_civoid ath_hw_cycle_counters_update(struct ath_common *common);
2108c2ecf20Sopenharmony_ciint32_t ath_hw_get_listen_time(struct ath_common *common);
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci__printf(3, 4)
2138c2ecf20Sopenharmony_civoid ath_printk(const char *level, const struct ath_common *common,
2148c2ecf20Sopenharmony_ci		const char *fmt, ...);
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci#define ath_emerg(common, fmt, ...)				\
2178c2ecf20Sopenharmony_ci	ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
2188c2ecf20Sopenharmony_ci#define ath_alert(common, fmt, ...)				\
2198c2ecf20Sopenharmony_ci	ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
2208c2ecf20Sopenharmony_ci#define ath_crit(common, fmt, ...)				\
2218c2ecf20Sopenharmony_ci	ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
2228c2ecf20Sopenharmony_ci#define ath_err(common, fmt, ...)				\
2238c2ecf20Sopenharmony_ci	ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
2248c2ecf20Sopenharmony_ci#define ath_warn(common, fmt, ...)				\
2258c2ecf20Sopenharmony_ci	ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
2268c2ecf20Sopenharmony_ci#define ath_notice(common, fmt, ...)				\
2278c2ecf20Sopenharmony_ci	ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
2288c2ecf20Sopenharmony_ci#define ath_info(common, fmt, ...)				\
2298c2ecf20Sopenharmony_ci	ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci/**
2328c2ecf20Sopenharmony_ci * enum ath_debug_level - atheros wireless debug level
2338c2ecf20Sopenharmony_ci *
2348c2ecf20Sopenharmony_ci * @ATH_DBG_RESET: reset processing
2358c2ecf20Sopenharmony_ci * @ATH_DBG_QUEUE: hardware queue management
2368c2ecf20Sopenharmony_ci * @ATH_DBG_EEPROM: eeprom processing
2378c2ecf20Sopenharmony_ci * @ATH_DBG_CALIBRATE: periodic calibration
2388c2ecf20Sopenharmony_ci * @ATH_DBG_INTERRUPT: interrupt processing
2398c2ecf20Sopenharmony_ci * @ATH_DBG_REGULATORY: regulatory processing
2408c2ecf20Sopenharmony_ci * @ATH_DBG_ANI: adaptive noise immunitive processing
2418c2ecf20Sopenharmony_ci * @ATH_DBG_XMIT: basic xmit operation
2428c2ecf20Sopenharmony_ci * @ATH_DBG_BEACON: beacon handling
2438c2ecf20Sopenharmony_ci * @ATH_DBG_CONFIG: configuration of the hardware
2448c2ecf20Sopenharmony_ci * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
2458c2ecf20Sopenharmony_ci * @ATH_DBG_PS: power save processing
2468c2ecf20Sopenharmony_ci * @ATH_DBG_HWTIMER: hardware timer handling
2478c2ecf20Sopenharmony_ci * @ATH_DBG_BTCOEX: bluetooth coexistance
2488c2ecf20Sopenharmony_ci * @ATH_DBG_BSTUCK: stuck beacons
2498c2ecf20Sopenharmony_ci * @ATH_DBG_MCI: Message Coexistence Interface, a private protocol
2508c2ecf20Sopenharmony_ci *	used exclusively for WLAN-BT coexistence starting from
2518c2ecf20Sopenharmony_ci *	AR9462.
2528c2ecf20Sopenharmony_ci * @ATH_DBG_DFS: radar datection
2538c2ecf20Sopenharmony_ci * @ATH_DBG_WOW: Wake on Wireless
2548c2ecf20Sopenharmony_ci * @ATH_DBG_DYNACK: dynack handling
2558c2ecf20Sopenharmony_ci * @ATH_DBG_SPECTRAL_SCAN: FFT spectral scan
2568c2ecf20Sopenharmony_ci * @ATH_DBG_ANY: enable all debugging
2578c2ecf20Sopenharmony_ci *
2588c2ecf20Sopenharmony_ci * The debug level is used to control the amount and type of debugging output
2598c2ecf20Sopenharmony_ci * we want to see. Each driver has its own method for enabling debugging and
2608c2ecf20Sopenharmony_ci * modifying debug level states -- but this is typically done through a
2618c2ecf20Sopenharmony_ci * module parameter 'debug' along with a respective 'debug' debugfs file
2628c2ecf20Sopenharmony_ci * entry.
2638c2ecf20Sopenharmony_ci */
2648c2ecf20Sopenharmony_cienum ATH_DEBUG {
2658c2ecf20Sopenharmony_ci	ATH_DBG_RESET		= 0x00000001,
2668c2ecf20Sopenharmony_ci	ATH_DBG_QUEUE		= 0x00000002,
2678c2ecf20Sopenharmony_ci	ATH_DBG_EEPROM		= 0x00000004,
2688c2ecf20Sopenharmony_ci	ATH_DBG_CALIBRATE	= 0x00000008,
2698c2ecf20Sopenharmony_ci	ATH_DBG_INTERRUPT	= 0x00000010,
2708c2ecf20Sopenharmony_ci	ATH_DBG_REGULATORY	= 0x00000020,
2718c2ecf20Sopenharmony_ci	ATH_DBG_ANI		= 0x00000040,
2728c2ecf20Sopenharmony_ci	ATH_DBG_XMIT		= 0x00000080,
2738c2ecf20Sopenharmony_ci	ATH_DBG_BEACON		= 0x00000100,
2748c2ecf20Sopenharmony_ci	ATH_DBG_CONFIG		= 0x00000200,
2758c2ecf20Sopenharmony_ci	ATH_DBG_FATAL		= 0x00000400,
2768c2ecf20Sopenharmony_ci	ATH_DBG_PS		= 0x00000800,
2778c2ecf20Sopenharmony_ci	ATH_DBG_BTCOEX		= 0x00001000,
2788c2ecf20Sopenharmony_ci	ATH_DBG_WMI		= 0x00002000,
2798c2ecf20Sopenharmony_ci	ATH_DBG_BSTUCK		= 0x00004000,
2808c2ecf20Sopenharmony_ci	ATH_DBG_MCI		= 0x00008000,
2818c2ecf20Sopenharmony_ci	ATH_DBG_DFS		= 0x00010000,
2828c2ecf20Sopenharmony_ci	ATH_DBG_WOW		= 0x00020000,
2838c2ecf20Sopenharmony_ci	ATH_DBG_CHAN_CTX	= 0x00040000,
2848c2ecf20Sopenharmony_ci	ATH_DBG_DYNACK		= 0x00080000,
2858c2ecf20Sopenharmony_ci	ATH_DBG_SPECTRAL_SCAN	= 0x00100000,
2868c2ecf20Sopenharmony_ci	ATH_DBG_ANY		= 0xffffffff
2878c2ecf20Sopenharmony_ci};
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci#define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
2908c2ecf20Sopenharmony_ci#define ATH_DBG_MAX_LEN 512
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci#ifdef CONFIG_ATH_DEBUG
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci#define ath_dbg(common, dbg_mask, fmt, ...)				\
2958c2ecf20Sopenharmony_cido {									\
2968c2ecf20Sopenharmony_ci	if ((common)->debug_mask & ATH_DBG_##dbg_mask)			\
2978c2ecf20Sopenharmony_ci		ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__);	\
2988c2ecf20Sopenharmony_ci} while (0)
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
3018c2ecf20Sopenharmony_ci#define ATH_DBG_WARN_ON_ONCE(foo) WARN_ON_ONCE(foo)
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci#else
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_cistatic inline  __attribute__ ((format (printf, 3, 4)))
3068c2ecf20Sopenharmony_civoid _ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,
3078c2ecf20Sopenharmony_ci	     const char *fmt, ...)
3088c2ecf20Sopenharmony_ci{
3098c2ecf20Sopenharmony_ci}
3108c2ecf20Sopenharmony_ci#define ath_dbg(common, dbg_mask, fmt, ...)				\
3118c2ecf20Sopenharmony_ci	_ath_dbg(common, ATH_DBG_##dbg_mask, fmt, ##__VA_ARGS__)
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci#define ATH_DBG_WARN(foo, arg...) do {} while (0)
3148c2ecf20Sopenharmony_ci#define ATH_DBG_WARN_ON_ONCE(foo) ({				\
3158c2ecf20Sopenharmony_ci	int __ret_warn_once = !!(foo);				\
3168c2ecf20Sopenharmony_ci	unlikely(__ret_warn_once);				\
3178c2ecf20Sopenharmony_ci})
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#endif /* CONFIG_ATH_DEBUG */
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci/** Returns string describing opmode, or NULL if unknown mode. */
3228c2ecf20Sopenharmony_ci#ifdef CONFIG_ATH_DEBUG
3238c2ecf20Sopenharmony_ciconst char *ath_opmode_to_string(enum nl80211_iftype opmode);
3248c2ecf20Sopenharmony_ci#else
3258c2ecf20Sopenharmony_cistatic inline const char *ath_opmode_to_string(enum nl80211_iftype opmode)
3268c2ecf20Sopenharmony_ci{
3278c2ecf20Sopenharmony_ci	return "UNKNOWN";
3288c2ecf20Sopenharmony_ci}
3298c2ecf20Sopenharmony_ci#endif
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ciextern const char *ath_bus_type_strings[];
3328c2ecf20Sopenharmony_cistatic inline const char *ath_bus_type_to_string(enum ath_bus_type bustype)
3338c2ecf20Sopenharmony_ci{
3348c2ecf20Sopenharmony_ci	return ath_bus_type_strings[bustype];
3358c2ecf20Sopenharmony_ci}
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci#endif /* ATH_H */
338