/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2002-2009 Sam Leffler, Errno Consulting4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer,11* without modification.12* 2. Redistributions in binary form must reproduce at minimum a disclaimer13* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any14* redistribution must be conditioned upon including a substantially15* similar Disclaimer requirement for further binary redistribution.16*17* NO WARRANTY18* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY21* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL22* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,23* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF24* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS25* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER26* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)27* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF28* THE POSSIBILITY OF SUCH DAMAGES.29*/30#ifndef __IF_ATH_DEBUG_H__31#define __IF_ATH_DEBUG_H__3233#ifdef ATH_DEBUG3435enum {36ATH_DEBUG_XMIT = 0x000000001ULL, /* basic xmit operation */37ATH_DEBUG_XMIT_DESC = 0x000000002ULL, /* xmit descriptors */38ATH_DEBUG_RECV = 0x000000004ULL, /* basic recv operation */39ATH_DEBUG_RECV_DESC = 0x000000008ULL, /* recv descriptors */40ATH_DEBUG_RATE = 0x000000010ULL, /* rate control */41ATH_DEBUG_RESET = 0x000000020ULL, /* reset processing */42ATH_DEBUG_MODE = 0x000000040ULL, /* mode init/setup */43ATH_DEBUG_BEACON = 0x000000080ULL, /* beacon handling */44ATH_DEBUG_WATCHDOG = 0x000000100ULL, /* watchdog timeout */45ATH_DEBUG_INTR = 0x000001000ULL, /* ISR */46ATH_DEBUG_TX_PROC = 0x000002000ULL, /* tx ISR proc */47ATH_DEBUG_RX_PROC = 0x000004000ULL, /* rx ISR proc */48ATH_DEBUG_BEACON_PROC = 0x000008000ULL, /* beacon ISR proc */49ATH_DEBUG_CALIBRATE = 0x000010000ULL, /* periodic calibration */50ATH_DEBUG_KEYCACHE = 0x000020000ULL, /* key cache management */51ATH_DEBUG_STATE = 0x000040000ULL, /* 802.11 state transitions */52ATH_DEBUG_NODE = 0x000080000ULL, /* node management */53ATH_DEBUG_LED = 0x000100000ULL, /* led management */54ATH_DEBUG_FF = 0x000200000ULL, /* fast frames */55ATH_DEBUG_DFS = 0x000400000ULL, /* DFS processing */56ATH_DEBUG_TDMA = 0x000800000ULL, /* TDMA processing */57ATH_DEBUG_TDMA_TIMER = 0x001000000ULL, /* TDMA timer processing */58ATH_DEBUG_REGDOMAIN = 0x002000000ULL, /* regulatory processing */59ATH_DEBUG_SW_TX = 0x004000000ULL, /* per-packet software TX */60ATH_DEBUG_SW_TX_BAW = 0x008000000ULL, /* BAW handling */61ATH_DEBUG_SW_TX_CTRL = 0x010000000ULL, /* queue control */62ATH_DEBUG_SW_TX_AGGR = 0x020000000ULL, /* aggregate TX */63ATH_DEBUG_SW_TX_RETRIES = 0x040000000ULL, /* software TX retries */64ATH_DEBUG_FATAL = 0x080000000ULL, /* fatal errors */65ATH_DEBUG_SW_TX_BAR = 0x100000000ULL, /* BAR TX */66ATH_DEBUG_EDMA_RX = 0x200000000ULL, /* RX EDMA state */67ATH_DEBUG_SW_TX_FILT = 0x400000000ULL, /* SW TX FF */68ATH_DEBUG_NODE_PWRSAVE = 0x800000000ULL, /* node powersave */69ATH_DEBUG_DIVERSITY = 0x1000000000ULL, /* Diversity logic */70ATH_DEBUG_PWRSAVE = 0x2000000000ULL,71ATH_DEBUG_BTCOEX = 0x4000000000ULL, /* BT Coex */72ATH_DEBUG_QUIETIE = 0x8000000000ULL, /* Quiet time handling */7374ATH_DEBUG_ANY = 0xffffffffffffffffULL75};7677enum {78ATH_KTR_RXPROC = 0x00000001,79ATH_KTR_TXPROC = 0x00000002,80ATH_KTR_TXCOMP = 0x00000004,81ATH_KTR_SWQ = 0x00000008,82ATH_KTR_INTERRUPTS = 0x00000010,83ATH_KTR_ERROR = 0x00000020,84ATH_KTR_NODE = 0x00000040,85ATH_KTR_TX = 0x00000080,86};8788#define ATH_KTR(_sc, _km, _kf, ...) do { \89if (sc->sc_ktrdebug & (_km)) \90CTR##_kf(KTR_DEV, __VA_ARGS__); \91} while (0)9293extern uint64_t ath_debug;9495#define IFF_DUMPPKTS(sc, m) (sc->sc_debug & (m))96#define DPRINTF(sc, m, ...) do { \97if (sc->sc_debug & (m)) \98device_printf(sc->sc_dev, __VA_ARGS__); \99} while (0)100#define KEYPRINTF(sc, ix, hk, mac) do { \101if (sc->sc_debug & ATH_DEBUG_KEYCACHE) \102ath_keyprint(sc, __func__, ix, hk, mac); \103} while (0)104105extern void ath_printrxbuf(struct ath_softc *, const struct ath_buf *bf,106u_int ix, int);107extern void ath_printtxbuf(struct ath_softc *, const struct ath_buf *bf,108u_int qnum, u_int ix, int done);109extern void ath_printtxstatbuf(struct ath_softc *sc, const struct ath_buf *bf,110const uint32_t *ds, u_int qnum, u_int ix, int done);111#else /* ATH_DEBUG */112#define ATH_KTR(_sc, _km, _kf, ...) do { } while (0)113114#define IFF_DUMPPKTS(sc, m) (0)115#define DPRINTF(sc, m, fmt, ...) do { \116(void) sc; \117} while (0)118#define KEYPRINTF(sc, k, ix, mac) do { \119(void) sc; \120} while (0)121#endif /* ATH_DEBUG */122123#endif124125126