1*4882a593Smuzhiyun #ifndef _DHD_BUZZZ_H_INCLUDED_ 2*4882a593Smuzhiyun #define _DHD_BUZZZ_H_INCLUDED_ 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun */ 5*4882a593Smuzhiyun * Copyright (C) 2020, Broadcom. 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Unless you and Broadcom execute a separate written software license 8*4882a593Smuzhiyun * agreement governing use of this software, this software is licensed to you 9*4882a593Smuzhiyun * under the terms of the GNU General Public License version 2 (the "GPL"), 10*4882a593Smuzhiyun * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11*4882a593Smuzhiyun * following added to such license: 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * As a special exception, the copyright holders of this software give you 14*4882a593Smuzhiyun * permission to link this software with independent modules, and to copy and 15*4882a593Smuzhiyun * distribute the resulting executable under terms of your choice, provided that 16*4882a593Smuzhiyun * you also meet, for each linked independent module, the terms and conditions of 17*4882a593Smuzhiyun * the license of that module. An independent module is a module which is not 18*4882a593Smuzhiyun * derived from this software. The special exception does not apply to any 19*4882a593Smuzhiyun * modifications of the software. 20*4882a593Smuzhiyun * 21*4882a593Smuzhiyun * 22*4882a593Smuzhiyun * <<Broadcom-WL-IPTag/Open:>> 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * $Id$ 25*4882a593Smuzhiyun */ 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun #if defined(DHD_BUZZZ_LOG_ENABLED) 28*4882a593Smuzhiyun /* 29*4882a593Smuzhiyun * Broadcom proprietary logging system. Deleted performance counters. 30*4882a593Smuzhiyun */ 31*4882a593Smuzhiyun void dhd_buzzz_attach(void); 32*4882a593Smuzhiyun void dhd_buzzz_detach(void); 33*4882a593Smuzhiyun void dhd_buzzz_panic(uint32 crash); 34*4882a593Smuzhiyun void dhd_buzzz_dump(void); 35*4882a593Smuzhiyun void dhd_buzzz_log_disable(void); 36*4882a593Smuzhiyun void dhd_buzzz_crash(void); 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun void dhd_buzzz_log0(uint32 evt_id); 39*4882a593Smuzhiyun void dhd_buzzz_log1(uint32 evt_id, uint32 arg1); 40*4882a593Smuzhiyun void dhd_buzzz_log2(uint32 evt_id, uint32 arg1, uintptr arg2); 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun void dhd_buzzz_fmt_reg(uint32 id, char * fmt); 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun extern void* dhd_os_create_buzzz_thread(void); 45*4882a593Smuzhiyun extern void dhd_os_destroy_buzzz_thread(void *thr_hdl); 46*4882a593Smuzhiyun extern void dhd_os_sched_buzzz_thread(void *thr_hdl); 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun #undef BUZZZ_EVT 49*4882a593Smuzhiyun #define BUZZZ_EVT(ID) BUZZZ_EVT__## ID, 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun #undef BUZZZ_FMT 52*4882a593Smuzhiyun #define BUZZZ_FMT(ID, format) \ 53*4882a593Smuzhiyun dhd_buzzz_fmt_reg(BUZZZ_EVT__## ID, "\t" format); 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun typedef enum buzzz_evt_id 56*4882a593Smuzhiyun { 57*4882a593Smuzhiyun BUZZZ_EVT__DHD = 100, /* BUZZZ_EVT(DHD) */ 58*4882a593Smuzhiyun BUZZZ_EVT(GENERAL_LOCK) 59*4882a593Smuzhiyun BUZZZ_EVT(GENERAL_UNLOCK) 60*4882a593Smuzhiyun BUZZZ_EVT(FLOWRING_LOCK) 61*4882a593Smuzhiyun BUZZZ_EVT(FLOWRING_UNLOCK) 62*4882a593Smuzhiyun BUZZZ_EVT(FLOWID_LOCK) 63*4882a593Smuzhiyun BUZZZ_EVT(FLOWID_UNLOCK) 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun BUZZZ_EVT(START_XMIT_BGN) 66*4882a593Smuzhiyun BUZZZ_EVT(START_XMIT_END) 67*4882a593Smuzhiyun BUZZZ_EVT(PROCESS_CTRL_BGN) 68*4882a593Smuzhiyun BUZZZ_EVT(PROCESS_CTRL_END) 69*4882a593Smuzhiyun BUZZZ_EVT(UPDATE_TXFLOWRINGS_BGN) 70*4882a593Smuzhiyun BUZZZ_EVT(UPDATE_TXFLOWRINGS_END) 71*4882a593Smuzhiyun BUZZZ_EVT(PROCESS_TXCPL_BGN) 72*4882a593Smuzhiyun BUZZZ_EVT(PROCESS_TXCPL_END) 73*4882a593Smuzhiyun BUZZZ_EVT(PROCESS_RXCPL_BGN) 74*4882a593Smuzhiyun BUZZZ_EVT(PROCESS_RXCPL_END) 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun BUZZZ_EVT(GET_SRC_ADDR) 77*4882a593Smuzhiyun BUZZZ_EVT(WRITE_COMPLETE) 78*4882a593Smuzhiyun BUZZZ_EVT(ALLOC_RING_SPACE) 79*4882a593Smuzhiyun BUZZZ_EVT(ALLOC_RING_SPACE_RET) 80*4882a593Smuzhiyun BUZZZ_EVT(ALLOC_RING_SPACE_FAIL) 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun BUZZZ_EVT(PKTID_MAP_CLEAR) 83*4882a593Smuzhiyun BUZZZ_EVT(PKTID_NOT_AVAILABLE) 84*4882a593Smuzhiyun BUZZZ_EVT(PKTID_MAP_RSV) 85*4882a593Smuzhiyun BUZZZ_EVT(PKTID_MAP_SAVE) 86*4882a593Smuzhiyun BUZZZ_EVT(PKTID_MAP_ALLOC) 87*4882a593Smuzhiyun BUZZZ_EVT(PKTID_MAP_FREE) 88*4882a593Smuzhiyun BUZZZ_EVT(LOCKER_INUSE_ABORT) 89*4882a593Smuzhiyun BUZZZ_EVT(BUFFER_TYPE_ABORT1) 90*4882a593Smuzhiyun BUZZZ_EVT(BUFFER_TYPE_ABORT2) 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun BUZZZ_EVT(UPD_READ_IDX) 93*4882a593Smuzhiyun BUZZZ_EVT(STORE_RXCPLN_RD) 94*4882a593Smuzhiyun BUZZZ_EVT(EARLY_UPD_RXCPLN_RD) 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun BUZZZ_EVT(POST_TXDATA) 97*4882a593Smuzhiyun BUZZZ_EVT(RETURN_RXBUF) 98*4882a593Smuzhiyun BUZZZ_EVT(RXBUF_POST) 99*4882a593Smuzhiyun BUZZZ_EVT(RXBUF_POST_EVENT) 100*4882a593Smuzhiyun BUZZZ_EVT(RXBUF_POST_IOCTL) 101*4882a593Smuzhiyun BUZZZ_EVT(RXBUF_POST_CTRL_PKTGET_FAIL) 102*4882a593Smuzhiyun BUZZZ_EVT(RXBUF_POST_PKTGET_FAIL) 103*4882a593Smuzhiyun BUZZZ_EVT(RXBUF_POST_PKTID_FAIL) 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun BUZZZ_EVT(DHD_DUPLICATE_ALLOC) 106*4882a593Smuzhiyun BUZZZ_EVT(DHD_DUPLICATE_FREE) 107*4882a593Smuzhiyun BUZZZ_EVT(DHD_TEST_IS_ALLOC) 108*4882a593Smuzhiyun BUZZZ_EVT(DHD_TEST_IS_FREE) 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROT_IOCT_BGN) 111*4882a593Smuzhiyun BUZZZ_EVT(DHDMSGBUF_CMPLT_BGN) 112*4882a593Smuzhiyun BUZZZ_EVT(DHDMSGBUF_CMPLT_END) 113*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROT_IOCT_END) 114*4882a593Smuzhiyun BUZZZ_EVT(DHD_FILLUP_IOCT_REQST_BGN) 115*4882a593Smuzhiyun BUZZZ_EVT(DHD_FILLUP_IOCT_REQST_END) 116*4882a593Smuzhiyun BUZZZ_EVT(DHD_MSGBUF_RXBUF_POST_IOCTLRESP_BUFS_BGN) 117*4882a593Smuzhiyun BUZZZ_EVT(DHD_MSGBUF_RXBUF_POST_IOCTLRESP_BUFS_END) 118*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROT_IOCTCMPLT_PROCESS_ONE) 119*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROT_IOCTCMPLT_PROCESS_TWO) 120*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROT_EVENT_PROCESS_BGN) 121*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROT_EVENT_PROCESS_END) 122*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROT_D2H_SYNC_LIVELOCK) 123*4882a593Smuzhiyun BUZZZ_EVT(DHD_IOCTL_BUFPOST) 124*4882a593Smuzhiyun BUZZZ_EVT(DHD_EVENT_BUFPOST) 125*4882a593Smuzhiyun BUZZZ_EVT(DHD_PROC_MSG_TYPE) 126*4882a593Smuzhiyun BUZZZ_EVT(DHD_BUS_RXCTL_ONE) 127*4882a593Smuzhiyun BUZZZ_EVT(DHD_BUS_RXCTL_TWO) 128*4882a593Smuzhiyun } buzzz_evt_id_t; 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun static inline void dhd_buzzz_fmt_init(void) 131*4882a593Smuzhiyun { 132*4882a593Smuzhiyun BUZZZ_FMT(DHD, "DHD events") 133*4882a593Smuzhiyun BUZZZ_FMT(GENERAL_LOCK, "+++LOCK GENERAL flags<0x%08x>") 134*4882a593Smuzhiyun BUZZZ_FMT(GENERAL_UNLOCK, "---UNLK GENERAL flags<0x%08x>") 135*4882a593Smuzhiyun BUZZZ_FMT(FLOWRING_LOCK, "+++LOCK FLOWRING flags<0x%08x>") 136*4882a593Smuzhiyun BUZZZ_FMT(FLOWRING_UNLOCK, "---UNLK FLOWRING flags<0x%08x>") 137*4882a593Smuzhiyun BUZZZ_FMT(FLOWID_LOCK, "+++LOCK FLOWID flags<0x%08x>") 138*4882a593Smuzhiyun BUZZZ_FMT(FLOWID_UNLOCK, "---UNLK FLOWID flags<0x%08x>") 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun BUZZZ_FMT(START_XMIT_BGN, "{ dhd_start_xmit() ifidx<%u> skb<0x%p>") 141*4882a593Smuzhiyun BUZZZ_FMT(START_XMIT_END, "} dhd_start_xmit()") 142*4882a593Smuzhiyun BUZZZ_FMT(PROCESS_CTRL_BGN, "{ dhd_prot_process_ctrlbuf()") 143*4882a593Smuzhiyun BUZZZ_FMT(PROCESS_CTRL_END, "} dhd_prot_process_ctrlbuf()") 144*4882a593Smuzhiyun BUZZZ_FMT(UPDATE_TXFLOWRINGS_BGN, "{ dhd_update_txflowrings()"); 145*4882a593Smuzhiyun BUZZZ_FMT(UPDATE_TXFLOWRINGS_END, "} dhd_update_txflowrings()"); 146*4882a593Smuzhiyun BUZZZ_FMT(PROCESS_TXCPL_BGN, "{ dhd_prot_process_msgbuf_txcpl()") 147*4882a593Smuzhiyun BUZZZ_FMT(PROCESS_TXCPL_END, "} dhd_prot_process_msgbuf_txcpl()") 148*4882a593Smuzhiyun BUZZZ_FMT(PROCESS_RXCPL_BGN, "{ dhd_prot_process_msgbuf_rxcpl()") 149*4882a593Smuzhiyun BUZZZ_FMT(PROCESS_RXCPL_END, "} dhd_prot_process_msgbuf_rxcpl()") 150*4882a593Smuzhiyun 151*4882a593Smuzhiyun BUZZZ_FMT(GET_SRC_ADDR, "bytes<%u> @<0x%p> prot_get_src_addr()") 152*4882a593Smuzhiyun BUZZZ_FMT(WRITE_COMPLETE, "WR<%u> prot_ring_write_complete") 153*4882a593Smuzhiyun BUZZZ_FMT(ALLOC_RING_SPACE, "{ dhd_alloc_ring_space nitems<%d>") 154*4882a593Smuzhiyun BUZZZ_FMT(ALLOC_RING_SPACE_RET, "} dhd_alloc_ring_space() alloc<%d> @<0x%p>") 155*4882a593Smuzhiyun BUZZZ_FMT(ALLOC_RING_SPACE_FAIL, "FAILURE } dhd_alloc_ring_space() alloc<%d>") 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun BUZZZ_FMT(PKTID_MAP_CLEAR, "pktid map clear") 158*4882a593Smuzhiyun BUZZZ_FMT(PKTID_NOT_AVAILABLE, "FAILURE pktid pool depletion failures<%u>") 159*4882a593Smuzhiyun BUZZZ_FMT(PKTID_MAP_RSV, "pktid<%u> pkt<0x%p> dhd_pktid_map_reserve()") 160*4882a593Smuzhiyun BUZZZ_FMT(PKTID_MAP_SAVE, "pktid<%u> pkt<0x%p> dhd_pktid_map_save()") 161*4882a593Smuzhiyun BUZZZ_FMT(PKTID_MAP_ALLOC, "pktid<%u> pkt<0x%p> dhd_pktid_map_alloc()") 162*4882a593Smuzhiyun BUZZZ_FMT(PKTID_MAP_FREE, "pktid<%u> pkt<0x%p> dhd_pktid_map_free()") 163*4882a593Smuzhiyun BUZZZ_FMT(LOCKER_INUSE_ABORT, "ASSERT pktid<%u> pkt<0x%p> locker->inuse") 164*4882a593Smuzhiyun BUZZZ_FMT(BUFFER_TYPE_ABORT1, "ASSERT pktid<%u> pkt<0x%p> locker->dma") 165*4882a593Smuzhiyun BUZZZ_FMT(BUFFER_TYPE_ABORT2, "ASSERT locker->dma<%u> buf_type<%u>") 166*4882a593Smuzhiyun 167*4882a593Smuzhiyun BUZZZ_FMT(UPD_READ_IDX, "RD<%u> prot_upd_read_idx()") 168*4882a593Smuzhiyun BUZZZ_FMT(STORE_RXCPLN_RD, "RD<%u> prot_store_rxcpln_read_idx()") 169*4882a593Smuzhiyun BUZZZ_FMT(EARLY_UPD_RXCPLN_RD, "RD<%u> prot_early_upd_rxcpln_read_idx()") 170*4882a593Smuzhiyun 171*4882a593Smuzhiyun BUZZZ_FMT(POST_TXDATA, "flr<%u> pkt<0x%p> dhd_prot_txdata()") 172*4882a593Smuzhiyun BUZZZ_FMT(RETURN_RXBUF, "cnt<%u> dhd_prot_return_rxbuf()"); 173*4882a593Smuzhiyun BUZZZ_FMT(RXBUF_POST, "cnt<%u> dhd_prot_rxbufpost()"); 174*4882a593Smuzhiyun BUZZZ_FMT(RXBUF_POST_EVENT, "event dhd_prot_rxbufpost_ctrl()"); 175*4882a593Smuzhiyun BUZZZ_FMT(RXBUF_POST_IOCTL, "ioctl dhd_prot_rxbufpost_ctrl()"); 176*4882a593Smuzhiyun BUZZZ_FMT(RXBUF_POST_CTRL_PKTGET_FAIL, "FAILURE pktget dhd_prot_rxbufpost_ctrl()"); 177*4882a593Smuzhiyun BUZZZ_FMT(RXBUF_POST_PKTGET_FAIL, "FAILURE pktget loop<%u> dhd_prot_rxbufpost()") 178*4882a593Smuzhiyun BUZZZ_FMT(RXBUF_POST_PKTID_FAIL, "FAILURE pktid loop<%u> dhd_prot_rxbufpost()") 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun BUZZZ_FMT(DHD_DUPLICATE_ALLOC, "ASSERT dhd_pktid_audit(%u) DHD_DUPLICATE_ALLOC") 181*4882a593Smuzhiyun BUZZZ_FMT(DHD_DUPLICATE_FREE, "ASSERT dhd_pktid_audit(%u) DHD_DUPLICATE_FREE") 182*4882a593Smuzhiyun BUZZZ_FMT(DHD_TEST_IS_ALLOC, "ASSERT dhd_pktid_audit(%u) DHD_TEST_IS_ALLOC") 183*4882a593Smuzhiyun BUZZZ_FMT(DHD_TEST_IS_FREE, "ASSERT dhd_pktid_audit(%u) DHD_TEST_IS_FREE") 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROT_IOCT_BGN, "{ dhd_prot_ioct pending<%u> thread<0x%p>") 186*4882a593Smuzhiyun BUZZZ_FMT(DHDMSGBUF_CMPLT_BGN, "{ dhdmsgbuf_cmplt bus::retlen<%u> bus::pktid<%u>") 187*4882a593Smuzhiyun BUZZZ_FMT(DHDMSGBUF_CMPLT_END, "} dhdmsgbuf_cmplt resp_len<%d> pktid<%u>") 188*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROT_IOCT_END, "} dhd_prot_ioct pending<%u> thread<0x%p>") 189*4882a593Smuzhiyun BUZZZ_FMT(DHD_FILLUP_IOCT_REQST_BGN, "{ dhd_fillup_ioct_reqst_ptrbased cmd<%u> transid<%u>") 190*4882a593Smuzhiyun BUZZZ_FMT(DHD_FILLUP_IOCT_REQST_END, 191*4882a593Smuzhiyun "} dhd_fillup_ioct_reqst_ptrbased transid<%u> bus::pktid<%u>") 192*4882a593Smuzhiyun BUZZZ_FMT(DHD_MSGBUF_RXBUF_POST_IOCTLRESP_BUFS_BGN, 193*4882a593Smuzhiyun "{ dhd_msgbuf_rxbuf_post_ioctlresp_bufs cur_posted<%u> bus::pktid<%u>") 194*4882a593Smuzhiyun BUZZZ_FMT(DHD_MSGBUF_RXBUF_POST_IOCTLRESP_BUFS_END, 195*4882a593Smuzhiyun "} dhd_msgbuf_rxbuf_post_ioctlresp_bufs cur_posted<%u> bus::pktid<%u>") 196*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROT_IOCTCMPLT_PROCESS_ONE, 197*4882a593Smuzhiyun "{ dhd_prot_ioctlcmplt_process cmd<%d> transid<%d>") 198*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROT_IOCTCMPLT_PROCESS_TWO, 199*4882a593Smuzhiyun "} dhd_prot_ioctlcmplt_process resplen<%u> pktid<%u>") 200*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROT_EVENT_PROCESS_BGN, "{ dhd_prot_event_process pktid<%u>") 201*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROT_EVENT_PROCESS_END, "} dhd_prot_event_process buflen<%u> pkt<0x%p>") 202*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROT_D2H_SYNC_LIVELOCK, " dhd_prot_d2h_sync_livelock seqnum<%u>") 203*4882a593Smuzhiyun BUZZZ_FMT(DHD_IOCTL_BUFPOST, " dhd_prot_rxbufpost_ctrl ioctl pktid<%u> phyaddr<0x%x>") 204*4882a593Smuzhiyun BUZZZ_FMT(DHD_EVENT_BUFPOST, " dhd_prot_rxbufpost_ctrl event pktid<%u> phyaddr<0x%x>") 205*4882a593Smuzhiyun BUZZZ_FMT(DHD_PROC_MSG_TYPE, " dhd_process_msgtype msg<0x%x> epoch<%u>") 206*4882a593Smuzhiyun BUZZZ_FMT(DHD_BUS_RXCTL_ONE, "dhd_bus_rxctl prev resplen<%u> pktid<%u>") 207*4882a593Smuzhiyun BUZZZ_FMT(DHD_BUS_RXCTL_TWO, "dhd_bus_rxctl cur resplen<%u> pktid<%u>") 208*4882a593Smuzhiyun } 209*4882a593Smuzhiyun 210*4882a593Smuzhiyun #define BUZZZ_LOG(ID, N, ARG...) dhd_buzzz_log ##N(BUZZZ_EVT__ ##ID, ##ARG) 211*4882a593Smuzhiyun 212*4882a593Smuzhiyun #else /* DHD_BUZZZ_LOG_ENABLED */ 213*4882a593Smuzhiyun /* 214*4882a593Smuzhiyun * Broadcom logging system - Empty implementaiton 215*4882a593Smuzhiyun */ 216*4882a593Smuzhiyun 217*4882a593Smuzhiyun #define dhd_buzzz_attach() do { /* noop */ } while (0) 218*4882a593Smuzhiyun #define dhd_buzzz_detach() do { /* noop */ } while (0) 219*4882a593Smuzhiyun #define dhd_buzzz_panic(x) do { /* noop */ } while (0) 220*4882a593Smuzhiyun #define BUZZZ_LOG(ID, N, ARG...) do { /* noop */ } while (0) 221*4882a593Smuzhiyun 222*4882a593Smuzhiyun #endif /* DHD_BUZZZ_LOG_ENABLED */ 223*4882a593Smuzhiyun 224*4882a593Smuzhiyun #endif /* _DHD_BUZZZ_H_INCLUDED_ */ 225