blob: 75c2d5e729c9b5727dd3ab771b5d49a95077bd83 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2011, 2014-2015 The Linux Foundation. All rights reserved.
3 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#ifndef _DBGLOG_COMMON_H_
20#define _DBGLOG_COMMON_H_
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include "dbglog_id.h"
27#include "dbglog.h"
28
29#define MAX_DBG_MSGS 256
30
31#define ATH6KL_FWLOG_PAYLOAD_SIZE 1500
32
33#define DBGLOG_PRINT_PREFIX "FWLOG: "
34
35/* Handy Macros to read data length and type from FW */
36#define WLAN_DIAG_0_TYPE_S 0
37#define WLAN_DIAG_0_TYPE 0x000000ff
38#define WLAN_DIAG_0_TYPE_GET(x) WMI_F_MS(x, WLAN_DIAG_0_TYPE)
39#define WLAN_DIAG_0_TYPE_SET(x, y) WMI_F_RMW(x, y, WLAN_DIAG_0_TYPE)
40/* bits 8-15 reserved */
41
42/* length includes the size of wlan_diag_data */
43#define WLAN_DIAG_0_LEN_S 16
44#define WLAN_DIAG_0_LEN 0xffff0000
45#define WLAN_DIAG_0_LEN_GET(x) WMI_F_MS(x, WLAN_DIAG_0_LEN)
46#define WLAN_DIAG_0_LEN_SET(x, y) WMI_F_RMW(x, y, WLAN_DIAG_0_LEN)
47
48#define CNSS_DIAG_SLEEP_INTERVAL 5 /* In secs */
49
50#define ATH6KL_FWLOG_MAX_ENTRIES 20
51#define ATH6KL_FWLOG_PAYLOAD_SIZE 1500
52
53#define DIAG_WLAN_DRIVER_UNLOADED 6
54#define DIAG_WLAN_DRIVER_LOADED 7
55#define DIAG_TYPE_LOGS 1
56#define DIAG_TYPE_EVENTS 2
57
58typedef enum {
59 DBGLOG_PROCESS_DEFAULT = 0,
60 DBGLOG_PROCESS_PRINT_RAW, /* print them in debug view */
61 DBGLOG_PROCESS_POOL_RAW, /* user buffer pool to save them */
62 DBGLOG_PROCESS_NET_RAW, /* user buffer pool to save them */
63 DBGLOG_PROCESS_MAX,
64} dbglog_process_t;
65
66enum cnss_diag_type {
67 DIAG_TYPE_FW_EVENT, /* send fw event- to diag */
68 DIAG_TYPE_FW_LOG, /* send log event- to diag */
69 DIAG_TYPE_FW_DEBUG_MSG, /* send dbg message- to diag */
70 DIAG_TYPE_INIT_REQ, /* cnss_diag initialization- from diag */
71 DIAG_TYPE_FW_MSG, /* fw msg command-to diag */
72 DIAG_TYPE_HOST_MSG, /* host command-to diag */
73 DIAG_TYPE_CRASH_INJECT, /*crash inject-from diag */
74 DIAG_TYPE_DBG_LEVEL, /* DBG LEVEL-from diag */
75};
76
77enum wlan_diag_config_type {
78 DIAG_VERSION_INFO,
79};
80
81enum wlan_diag_frame_type {
82 WLAN_DIAG_TYPE_CONFIG,
83 WLAN_DIAG_TYPE_EVENT,
84 WLAN_DIAG_TYPE_LOG,
85 WLAN_DIAG_TYPE_MSG,
86 WLAN_DIAG_TYPE_LEGACY_MSG,
87};
88
89/* log/event are always 32-bit aligned. Padding is inserted after
90 * optional payload to satisify this requirement */
91struct wlan_diag_data {
92 unsigned int word0; /* type, length */
93 unsigned int target_time;
94 unsigned int code; /* Diag log or event Code */
95 uint8_t payload[0];
96};
97
98struct dbglog_slot {
99 unsigned int diag_type;
100 unsigned int timestamp;
101 unsigned int length;
102 unsigned int dropped;
103 /* max ATH6KL_FWLOG_PAYLOAD_SIZE bytes */
104 uint8_t payload[0];
105} __packed;
106
107typedef struct event_report_s {
108 unsigned int diag_type;
109 unsigned short event_id;
110 unsigned short length;
111} event_report_t;
112
113/*
114 * Custom debug_print handlers
115 * Args:
116 * module Id
117 * vap id
118 * debug msg id
119 * Time stamp
120 * no of arguments
121 * pointer to the buffer holding the args
122 */
123typedef A_BOOL (*module_dbg_print)(A_UINT32, A_UINT16, A_UINT32,
124 A_UINT32, A_UINT16, A_UINT32 *);
125
126/** Register module specific dbg print*/
127void dbglog_reg_modprint(A_UINT32 mod_id, module_dbg_print printfn);
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif /* _DBGLOG_COMMON_H_ */