dbglog_common.h 4.0 KB

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