162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2012 Broadcom Corporation
362306a36Sopenharmony_ci * Copyright (c) 2012 Canonical Ltd.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
662306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
762306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1062306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1162306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
1262306a36Sopenharmony_ci * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1362306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
1462306a36Sopenharmony_ci * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1562306a36Sopenharmony_ci * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci#ifndef _BRCMS_DEBUG_H_
1862306a36Sopenharmony_ci#define _BRCMS_DEBUG_H_
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#include <linux/device.h>
2162306a36Sopenharmony_ci#include <linux/bcma/bcma.h>
2262306a36Sopenharmony_ci#include <net/cfg80211.h>
2362306a36Sopenharmony_ci#include <net/mac80211.h>
2462306a36Sopenharmony_ci#include "main.h"
2562306a36Sopenharmony_ci#include "mac80211_if.h"
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci__printf(2, 3)
2862306a36Sopenharmony_civoid __brcms_info(struct device *dev, const char *fmt, ...);
2962306a36Sopenharmony_ci__printf(2, 3)
3062306a36Sopenharmony_civoid __brcms_warn(struct device *dev, const char *fmt, ...);
3162306a36Sopenharmony_ci__printf(2, 3)
3262306a36Sopenharmony_civoid __brcms_err(struct device *dev, const char *fmt, ...);
3362306a36Sopenharmony_ci__printf(2, 3)
3462306a36Sopenharmony_civoid __brcms_crit(struct device *dev, const char *fmt, ...);
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING)
3762306a36Sopenharmony_ci__printf(4, 5)
3862306a36Sopenharmony_civoid __brcms_dbg(struct device *dev, u32 level, const char *func,
3962306a36Sopenharmony_ci		 const char *fmt, ...);
4062306a36Sopenharmony_ci#else
4162306a36Sopenharmony_cistatic inline __printf(4, 5)
4262306a36Sopenharmony_civoid __brcms_dbg(struct device *dev, u32 level, const char *func,
4362306a36Sopenharmony_ci		 const char *fmt, ...)
4462306a36Sopenharmony_ci{
4562306a36Sopenharmony_ci}
4662306a36Sopenharmony_ci#endif
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/*
4962306a36Sopenharmony_ci * Debug macros cannot be used when wlc is uninitialized. Generally
5062306a36Sopenharmony_ci * this means any code that could run before brcms_c_attach() has
5162306a36Sopenharmony_ci * returned successfully probably shouldn't use the following macros.
5262306a36Sopenharmony_ci */
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define brcms_dbg(core, l, f, a...)	__brcms_dbg(&(core)->dev, l, __func__, f, ##a)
5562306a36Sopenharmony_ci#define brcms_info(core, f, a...)	__brcms_info(&(core)->dev, f, ##a)
5662306a36Sopenharmony_ci#define brcms_warn(core, f, a...)	__brcms_warn(&(core)->dev, f, ##a)
5762306a36Sopenharmony_ci#define brcms_err(core, f, a...)	__brcms_err(&(core)->dev, f, ##a)
5862306a36Sopenharmony_ci#define brcms_crit(core, f, a...)	__brcms_crit(&(core)->dev, f, ##a)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define brcms_dbg_info(core, f, a...)		brcms_dbg(core, BRCM_DL_INFO, f, ##a)
6162306a36Sopenharmony_ci#define brcms_dbg_mac80211(core, f, a...)	brcms_dbg(core, BRCM_DL_MAC80211, f, ##a)
6262306a36Sopenharmony_ci#define brcms_dbg_rx(core, f, a...)		brcms_dbg(core, BRCM_DL_RX, f, ##a)
6362306a36Sopenharmony_ci#define brcms_dbg_tx(core, f, a...)		brcms_dbg(core, BRCM_DL_TX, f, ##a)
6462306a36Sopenharmony_ci#define brcms_dbg_int(core, f, a...)		brcms_dbg(core, BRCM_DL_INT, f, ##a)
6562306a36Sopenharmony_ci#define brcms_dbg_dma(core, f, a...)		brcms_dbg(core, BRCM_DL_DMA, f, ##a)
6662306a36Sopenharmony_ci#define brcms_dbg_ht(core, f, a...)		brcms_dbg(core, BRCM_DL_HT, f, ##a)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_cistruct brcms_pub;
6962306a36Sopenharmony_civoid brcms_debugfs_init(void);
7062306a36Sopenharmony_civoid brcms_debugfs_exit(void);
7162306a36Sopenharmony_civoid brcms_debugfs_attach(struct brcms_pub *drvr);
7262306a36Sopenharmony_civoid brcms_debugfs_detach(struct brcms_pub *drvr);
7362306a36Sopenharmony_cistruct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr);
7462306a36Sopenharmony_civoid brcms_debugfs_create_files(struct brcms_pub *drvr);
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#endif /* _BRCMS_DEBUG_H_ */
77