18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2011 Atheros Communications Inc. 38c2ecf20Sopenharmony_ci * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 68c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 78c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 108c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 118c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 128c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 138c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 148c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 158c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#ifndef DEBUG_H 198c2ecf20Sopenharmony_ci#define DEBUG_H 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include "hif.h" 228c2ecf20Sopenharmony_ci#include "trace.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cienum ATH6K_DEBUG_MASK { 258c2ecf20Sopenharmony_ci ATH6KL_DBG_CREDIT = BIT(0), 268c2ecf20Sopenharmony_ci /* hole */ 278c2ecf20Sopenharmony_ci ATH6KL_DBG_WLAN_TX = BIT(2), /* wlan tx */ 288c2ecf20Sopenharmony_ci ATH6KL_DBG_WLAN_RX = BIT(3), /* wlan rx */ 298c2ecf20Sopenharmony_ci ATH6KL_DBG_BMI = BIT(4), /* bmi tracing */ 308c2ecf20Sopenharmony_ci ATH6KL_DBG_HTC = BIT(5), 318c2ecf20Sopenharmony_ci ATH6KL_DBG_HIF = BIT(6), 328c2ecf20Sopenharmony_ci ATH6KL_DBG_IRQ = BIT(7), /* interrupt processing */ 338c2ecf20Sopenharmony_ci /* hole */ 348c2ecf20Sopenharmony_ci /* hole */ 358c2ecf20Sopenharmony_ci ATH6KL_DBG_WMI = BIT(10), /* wmi tracing */ 368c2ecf20Sopenharmony_ci ATH6KL_DBG_TRC = BIT(11), /* generic func tracing */ 378c2ecf20Sopenharmony_ci ATH6KL_DBG_SCATTER = BIT(12), /* hif scatter tracing */ 388c2ecf20Sopenharmony_ci ATH6KL_DBG_WLAN_CFG = BIT(13), /* cfg80211 i/f file tracing */ 398c2ecf20Sopenharmony_ci ATH6KL_DBG_RAW_BYTES = BIT(14), /* dump tx/rx frames */ 408c2ecf20Sopenharmony_ci ATH6KL_DBG_AGGR = BIT(15), /* aggregation */ 418c2ecf20Sopenharmony_ci ATH6KL_DBG_SDIO = BIT(16), 428c2ecf20Sopenharmony_ci ATH6KL_DBG_SDIO_DUMP = BIT(17), 438c2ecf20Sopenharmony_ci ATH6KL_DBG_BOOT = BIT(18), /* driver init and fw boot */ 448c2ecf20Sopenharmony_ci ATH6KL_DBG_WMI_DUMP = BIT(19), 458c2ecf20Sopenharmony_ci ATH6KL_DBG_SUSPEND = BIT(20), 468c2ecf20Sopenharmony_ci ATH6KL_DBG_USB = BIT(21), 478c2ecf20Sopenharmony_ci ATH6KL_DBG_USB_BULK = BIT(22), 488c2ecf20Sopenharmony_ci ATH6KL_DBG_RECOVERY = BIT(23), 498c2ecf20Sopenharmony_ci ATH6KL_DBG_ANY = 0xffffffff /* enable all logs */ 508c2ecf20Sopenharmony_ci}; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciextern unsigned int debug_mask; 538c2ecf20Sopenharmony_ci__printf(2, 3) void ath6kl_printk(const char *level, const char *fmt, ...); 548c2ecf20Sopenharmony_ci__printf(1, 2) void ath6kl_info(const char *fmt, ...); 558c2ecf20Sopenharmony_ci__printf(1, 2) void ath6kl_err(const char *fmt, ...); 568c2ecf20Sopenharmony_ci__printf(1, 2) void ath6kl_warn(const char *fmt, ...); 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cienum ath6kl_war { 598c2ecf20Sopenharmony_ci ATH6KL_WAR_INVALID_RATE, 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciint ath6kl_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#ifdef CONFIG_ATH6KL_DEBUG 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci__printf(2, 3) 678c2ecf20Sopenharmony_civoid ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...); 688c2ecf20Sopenharmony_civoid ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask, 698c2ecf20Sopenharmony_ci const char *msg, const char *prefix, 708c2ecf20Sopenharmony_ci const void *buf, size_t len); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_civoid ath6kl_dump_registers(struct ath6kl_device *dev, 738c2ecf20Sopenharmony_ci struct ath6kl_irq_proc_registers *irq_proc_reg, 748c2ecf20Sopenharmony_ci struct ath6kl_irq_enable_reg *irq_en_reg); 758c2ecf20Sopenharmony_civoid dump_cred_dist_stats(struct htc_target *target); 768c2ecf20Sopenharmony_civoid ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len); 778c2ecf20Sopenharmony_civoid ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war); 788c2ecf20Sopenharmony_ciint ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf, 798c2ecf20Sopenharmony_ci size_t len); 808c2ecf20Sopenharmony_civoid ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive); 818c2ecf20Sopenharmony_civoid ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout); 828c2ecf20Sopenharmony_civoid ath6kl_debug_init(struct ath6kl *ar); 838c2ecf20Sopenharmony_ciint ath6kl_debug_init_fs(struct ath6kl *ar); 848c2ecf20Sopenharmony_civoid ath6kl_debug_cleanup(struct ath6kl *ar); 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#else 878c2ecf20Sopenharmony_ci__printf(2, 3) 888c2ecf20Sopenharmony_cistatic inline void ath6kl_dbg(enum ATH6K_DEBUG_MASK dbg_mask, 898c2ecf20Sopenharmony_ci const char *fmt, ...) 908c2ecf20Sopenharmony_ci{ 918c2ecf20Sopenharmony_ci} 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cistatic inline void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask, 948c2ecf20Sopenharmony_ci const char *msg, const char *prefix, 958c2ecf20Sopenharmony_ci const void *buf, size_t len) 968c2ecf20Sopenharmony_ci{ 978c2ecf20Sopenharmony_ci} 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_cistatic inline void ath6kl_dump_registers(struct ath6kl_device *dev, 1008c2ecf20Sopenharmony_ci struct ath6kl_irq_proc_registers *irq_proc_reg, 1018c2ecf20Sopenharmony_ci struct ath6kl_irq_enable_reg *irq_en_reg) 1028c2ecf20Sopenharmony_ci{ 1038c2ecf20Sopenharmony_ci} 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_cistatic inline void dump_cred_dist_stats(struct htc_target *target) 1068c2ecf20Sopenharmony_ci{ 1078c2ecf20Sopenharmony_ci} 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cistatic inline void ath6kl_debug_fwlog_event(struct ath6kl *ar, 1108c2ecf20Sopenharmony_ci const void *buf, size_t len) 1118c2ecf20Sopenharmony_ci{ 1128c2ecf20Sopenharmony_ci} 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_cistatic inline void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) 1158c2ecf20Sopenharmony_ci{ 1168c2ecf20Sopenharmony_ci} 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_cistatic inline int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, 1198c2ecf20Sopenharmony_ci const void *buf, size_t len) 1208c2ecf20Sopenharmony_ci{ 1218c2ecf20Sopenharmony_ci return 0; 1228c2ecf20Sopenharmony_ci} 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cistatic inline void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive) 1258c2ecf20Sopenharmony_ci{ 1268c2ecf20Sopenharmony_ci} 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_cistatic inline void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, 1298c2ecf20Sopenharmony_ci u8 timeout) 1308c2ecf20Sopenharmony_ci{ 1318c2ecf20Sopenharmony_ci} 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistatic inline void ath6kl_debug_init(struct ath6kl *ar) 1348c2ecf20Sopenharmony_ci{ 1358c2ecf20Sopenharmony_ci} 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_cistatic inline int ath6kl_debug_init_fs(struct ath6kl *ar) 1388c2ecf20Sopenharmony_ci{ 1398c2ecf20Sopenharmony_ci return 0; 1408c2ecf20Sopenharmony_ci} 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_cistatic inline void ath6kl_debug_cleanup(struct ath6kl *ar) 1438c2ecf20Sopenharmony_ci{ 1448c2ecf20Sopenharmony_ci} 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci#endif 1478c2ecf20Sopenharmony_ci#endif 148