1 /* SPDX-License-Identifier: ISC */
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
12 #define ATH10K_FW_CRASH_DUMP_VERSION 1
15 * enum ath10k_fw_crash_dump_type - types of data in the dump file
16 * @ATH10K_FW_CRASH_DUMP_REGISTERS: Register crash dump in binary format
17 * @ATH10K_FW_CRASH_DUMP_CE_DATA: Copy Engine crash dump data
18 * @ATH10K_FW_CRASH_DUMP_RAM_DATA: RAM crash dump data, contains multiple
19 * struct ath10k_dump_ram_data_hdr
20 * @ATH10K_FW_CRASH_DUMP_MAX: Maximum enumeration
22 enum ath10k_fw_crash_dump_type
{
23 ATH10K_FW_CRASH_DUMP_REGISTERS
= 0,
24 ATH10K_FW_CRASH_DUMP_CE_DATA
= 1,
26 /* contains multiple struct ath10k_dump_ram_data_hdr */
27 ATH10K_FW_CRASH_DUMP_RAM_DATA
= 2,
29 ATH10K_FW_CRASH_DUMP_MAX
,
32 struct ath10k_tlv_dump_data
{
33 /* see ath10k_fw_crash_dump_type above */
39 /* pad to 32-bit boundaries as needed */
43 struct ath10k_dump_file_data
{
44 /* dump file information */
46 /* "ATH10K-FW-DUMP" */
51 /* file dump version */
54 /* some info we can get from ath10k struct that might help */
60 /* 0 for now, in place for later hardware */
63 __le32 target_version
;
64 __le32 fw_version_major
;
65 __le32 fw_version_minor
;
66 __le32 fw_version_release
;
67 __le32 fw_version_build
;
68 __le32 phy_capability
;
69 __le32 hw_min_tx_power
;
70 __le32 hw_max_tx_power
;
75 /* firmware version string */
76 char fw_ver
[ETHTOOL_FWVERS_LEN
];
78 /* Kernel related information */
80 /* time-of-day stamp */
83 /* time-of-day stamp, nano-seconds */
86 /* LINUX_VERSION_CODE */
87 __le32 kernel_ver_code
;
92 /* room for growth w/out changing binary format */
95 /* struct ath10k_tlv_dump_data + more */
99 struct ath10k_dump_ram_data_hdr
{
100 /* enum ath10k_mem_region_type */
105 /* length of payload data, not including this header */
111 /* magic number to fill the holes not copied due to sections in regions */
112 #define ATH10K_MAGIC_NOT_COPIED 0xAA
114 /* part of user space ABI */
115 enum ath10k_mem_region_type
{
116 ATH10K_MEM_REGION_TYPE_REG
= 1,
117 ATH10K_MEM_REGION_TYPE_DRAM
= 2,
118 ATH10K_MEM_REGION_TYPE_AXI
= 3,
119 ATH10K_MEM_REGION_TYPE_IRAM1
= 4,
120 ATH10K_MEM_REGION_TYPE_IRAM2
= 5,
121 ATH10K_MEM_REGION_TYPE_IOSRAM
= 6,
122 ATH10K_MEM_REGION_TYPE_IOREG
= 7,
123 ATH10K_MEM_REGION_TYPE_MSA
= 8,
126 /* Define a section of the region which should be copied. As not all parts
127 * of the memory is possible to copy, for example some of the registers can
128 * be like that, sections can be used to define what is safe to copy.
130 * To minimize the size of the array, the list must obey the format:
131 * '{start0,stop0},{start1,stop1},{start2,stop2}....' The values below must
132 * also obey to 'start0 < stop0 < start1 < stop1 < start2 < ...', otherwise
133 * we may encounter error in the dump processing.
135 struct ath10k_mem_section
{
140 /* One region of a memory layout. If the sections field is null entire
141 * region is copied. If sections is non-null only the areas specified in
142 * sections are copied and rest of the areas are filled with
143 * ATH10K_MAGIC_NOT_COPIED.
145 struct ath10k_mem_region
{
146 enum ath10k_mem_region_type type
;
153 const struct ath10k_mem_section
*sections
;
158 /* Contains the memory layout of a hardware version identified with the
159 * hardware id, split into regions.
161 struct ath10k_hw_mem_layout
{
167 const struct ath10k_mem_region
*regions
;
172 /* FIXME: where to put this? */
173 extern unsigned long ath10k_coredump_mask
;
175 #ifdef CONFIG_DEV_COREDUMP
177 int ath10k_coredump_submit(struct ath10k
*ar
);
178 struct ath10k_fw_crash_data
*ath10k_coredump_new(struct ath10k
*ar
);
179 int ath10k_coredump_create(struct ath10k
*ar
);
180 int ath10k_coredump_register(struct ath10k
*ar
);
181 void ath10k_coredump_unregister(struct ath10k
*ar
);
182 void ath10k_coredump_destroy(struct ath10k
*ar
);
184 const struct ath10k_hw_mem_layout
*_ath10k_coredump_get_mem_layout(struct ath10k
*ar
);
185 const struct ath10k_hw_mem_layout
*ath10k_coredump_get_mem_layout(struct ath10k
*ar
);
187 #else /* CONFIG_DEV_COREDUMP */
189 static inline int ath10k_coredump_submit(struct ath10k
*ar
)
194 static inline struct ath10k_fw_crash_data
*ath10k_coredump_new(struct ath10k
*ar
)
199 static inline int ath10k_coredump_create(struct ath10k
*ar
)
204 static inline int ath10k_coredump_register(struct ath10k
*ar
)
209 static inline void ath10k_coredump_unregister(struct ath10k
*ar
)
213 static inline void ath10k_coredump_destroy(struct ath10k
*ar
)
217 static inline const struct ath10k_hw_mem_layout
*
218 ath10k_coredump_get_mem_layout(struct ath10k
*ar
)
223 static inline const struct ath10k_hw_mem_layout
*
224 _ath10k_coredump_get_mem_layout(struct ath10k
*ar
)
229 #endif /* CONFIG_DEV_COREDUMP */
231 #endif /* _COREDUMP_H_ */