1
2
3
4
5
6#ifndef _COREDUMP_H_
7#define _COREDUMP_H_
8
9#include "core.h"
10
11#define ATH10K_FW_CRASH_DUMP_VERSION 1
12
13
14
15
16
17enum ath10k_fw_crash_dump_type {
18 ATH10K_FW_CRASH_DUMP_REGISTERS = 0,
19 ATH10K_FW_CRASH_DUMP_CE_DATA = 1,
20
21
22 ATH10K_FW_CRASH_DUMP_RAM_DATA = 2,
23
24 ATH10K_FW_CRASH_DUMP_MAX,
25};
26
27struct ath10k_tlv_dump_data {
28
29 __le32 type;
30
31
32 __le32 tlv_len;
33
34
35 u8 tlv_data[];
36} __packed;
37
38struct ath10k_dump_file_data {
39
40
41
42 char df_magic[16];
43
44 __le32 len;
45
46
47 __le32 version;
48
49
50
51 guid_t guid;
52
53 __le32 chip_id;
54
55
56 __le32 bus_type;
57
58 __le32 target_version;
59 __le32 fw_version_major;
60 __le32 fw_version_minor;
61 __le32 fw_version_release;
62 __le32 fw_version_build;
63 __le32 phy_capability;
64 __le32 hw_min_tx_power;
65 __le32 hw_max_tx_power;
66 __le32 ht_cap_info;
67 __le32 vht_cap_info;
68 __le32 num_rf_chains;
69
70
71 char fw_ver[ETHTOOL_FWVERS_LEN];
72
73
74
75
76 __le64 tv_sec;
77
78
79 __le64 tv_nsec;
80
81
82 __le32 kernel_ver_code;
83
84
85 char kernel_ver[64];
86
87
88 u8 unused[128];
89
90
91 u8 data[];
92} __packed;
93
94struct ath10k_dump_ram_data_hdr {
95
96 __le32 region_type;
97
98 __le32 start;
99
100
101 __le32 length;
102
103 u8 data[];
104};
105
106
107#define ATH10K_MAGIC_NOT_COPIED 0xAA
108
109
110enum ath10k_mem_region_type {
111 ATH10K_MEM_REGION_TYPE_REG = 1,
112 ATH10K_MEM_REGION_TYPE_DRAM = 2,
113 ATH10K_MEM_REGION_TYPE_AXI = 3,
114 ATH10K_MEM_REGION_TYPE_IRAM1 = 4,
115 ATH10K_MEM_REGION_TYPE_IRAM2 = 5,
116 ATH10K_MEM_REGION_TYPE_IOSRAM = 6,
117 ATH10K_MEM_REGION_TYPE_IOREG = 7,
118 ATH10K_MEM_REGION_TYPE_MSA = 8,
119};
120
121
122
123
124
125
126
127
128
129
130struct ath10k_mem_section {
131 u32 start;
132 u32 end;
133};
134
135
136
137
138
139
140struct ath10k_mem_region {
141 enum ath10k_mem_region_type type;
142 u32 start;
143 u32 len;
144
145 const char *name;
146
147 struct {
148 const struct ath10k_mem_section *sections;
149 u32 size;
150 } section_table;
151};
152
153
154
155
156struct ath10k_hw_mem_layout {
157 u32 hw_id;
158 u32 hw_rev;
159 enum ath10k_bus bus;
160
161 struct {
162 const struct ath10k_mem_region *regions;
163 int size;
164 } region_table;
165};
166
167
168extern unsigned long ath10k_coredump_mask;
169
170#ifdef CONFIG_DEV_COREDUMP
171
172int ath10k_coredump_submit(struct ath10k *ar);
173struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);
174int ath10k_coredump_create(struct ath10k *ar);
175int ath10k_coredump_register(struct ath10k *ar);
176void ath10k_coredump_unregister(struct ath10k *ar);
177void ath10k_coredump_destroy(struct ath10k *ar);
178
179const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar);
180
181#else
182
183static inline int ath10k_coredump_submit(struct ath10k *ar)
184{
185 return 0;
186}
187
188static inline struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
189{
190 return NULL;
191}
192
193static inline int ath10k_coredump_create(struct ath10k *ar)
194{
195 return 0;
196}
197
198static inline int ath10k_coredump_register(struct ath10k *ar)
199{
200 return 0;
201}
202
203static inline void ath10k_coredump_unregister(struct ath10k *ar)
204{
205}
206
207static inline void ath10k_coredump_destroy(struct ath10k *ar)
208{
209}
210
211static inline const struct ath10k_hw_mem_layout *
212ath10k_coredump_get_mem_layout(struct ath10k *ar)
213{
214 return NULL;
215}
216
217#endif
218
219#endif
220