18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2012 Broadcom Corporation 38c2ecf20Sopenharmony_ci * Copyright (c) 2012 Canonical Ltd. 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 ANY 128c2ecf20Sopenharmony_ci * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 138c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 148c2ecf20Sopenharmony_ci * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 158c2ecf20Sopenharmony_ci * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci#ifndef _BRCMS_DEBUG_H_ 188c2ecf20Sopenharmony_ci#define _BRCMS_DEBUG_H_ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include <linux/device.h> 218c2ecf20Sopenharmony_ci#include <linux/bcma/bcma.h> 228c2ecf20Sopenharmony_ci#include <net/cfg80211.h> 238c2ecf20Sopenharmony_ci#include <net/mac80211.h> 248c2ecf20Sopenharmony_ci#include "main.h" 258c2ecf20Sopenharmony_ci#include "mac80211_if.h" 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci__printf(2, 3) 288c2ecf20Sopenharmony_civoid __brcms_info(struct device *dev, const char *fmt, ...); 298c2ecf20Sopenharmony_ci__printf(2, 3) 308c2ecf20Sopenharmony_civoid __brcms_warn(struct device *dev, const char *fmt, ...); 318c2ecf20Sopenharmony_ci__printf(2, 3) 328c2ecf20Sopenharmony_civoid __brcms_err(struct device *dev, const char *fmt, ...); 338c2ecf20Sopenharmony_ci__printf(2, 3) 348c2ecf20Sopenharmony_civoid __brcms_crit(struct device *dev, const char *fmt, ...); 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING) 378c2ecf20Sopenharmony_ci__printf(4, 5) 388c2ecf20Sopenharmony_civoid __brcms_dbg(struct device *dev, u32 level, const char *func, 398c2ecf20Sopenharmony_ci const char *fmt, ...); 408c2ecf20Sopenharmony_ci#else 418c2ecf20Sopenharmony_cistatic inline __printf(4, 5) 428c2ecf20Sopenharmony_civoid __brcms_dbg(struct device *dev, u32 level, const char *func, 438c2ecf20Sopenharmony_ci const char *fmt, ...) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci} 468c2ecf20Sopenharmony_ci#endif 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* 498c2ecf20Sopenharmony_ci * Debug macros cannot be used when wlc is uninitialized. Generally 508c2ecf20Sopenharmony_ci * this means any code that could run before brcms_c_attach() has 518c2ecf20Sopenharmony_ci * returned successfully probably shouldn't use the following macros. 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define brcms_dbg(core, l, f, a...) __brcms_dbg(&(core)->dev, l, __func__, f, ##a) 558c2ecf20Sopenharmony_ci#define brcms_info(core, f, a...) __brcms_info(&(core)->dev, f, ##a) 568c2ecf20Sopenharmony_ci#define brcms_warn(core, f, a...) __brcms_warn(&(core)->dev, f, ##a) 578c2ecf20Sopenharmony_ci#define brcms_err(core, f, a...) __brcms_err(&(core)->dev, f, ##a) 588c2ecf20Sopenharmony_ci#define brcms_crit(core, f, a...) __brcms_crit(&(core)->dev, f, ##a) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define brcms_dbg_info(core, f, a...) brcms_dbg(core, BRCM_DL_INFO, f, ##a) 618c2ecf20Sopenharmony_ci#define brcms_dbg_mac80211(core, f, a...) brcms_dbg(core, BRCM_DL_MAC80211, f, ##a) 628c2ecf20Sopenharmony_ci#define brcms_dbg_rx(core, f, a...) brcms_dbg(core, BRCM_DL_RX, f, ##a) 638c2ecf20Sopenharmony_ci#define brcms_dbg_tx(core, f, a...) brcms_dbg(core, BRCM_DL_TX, f, ##a) 648c2ecf20Sopenharmony_ci#define brcms_dbg_int(core, f, a...) brcms_dbg(core, BRCM_DL_INT, f, ##a) 658c2ecf20Sopenharmony_ci#define brcms_dbg_dma(core, f, a...) brcms_dbg(core, BRCM_DL_DMA, f, ##a) 668c2ecf20Sopenharmony_ci#define brcms_dbg_ht(core, f, a...) brcms_dbg(core, BRCM_DL_HT, f, ##a) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_cistruct brcms_pub; 698c2ecf20Sopenharmony_civoid brcms_debugfs_init(void); 708c2ecf20Sopenharmony_civoid brcms_debugfs_exit(void); 718c2ecf20Sopenharmony_civoid brcms_debugfs_attach(struct brcms_pub *drvr); 728c2ecf20Sopenharmony_civoid brcms_debugfs_detach(struct brcms_pub *drvr); 738c2ecf20Sopenharmony_cistruct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr); 748c2ecf20Sopenharmony_civoid brcms_debugfs_create_files(struct brcms_pub *drvr); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#endif /* _BRCMS_DEBUG_H_ */ 77