dbglog_common.h 4.1 KB

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