0001
0002
0003
0004
0005
0006 #ifndef _COREDUMP_H_
0007 #define _COREDUMP_H_
0008
0009 #include "core.h"
0010
0011 #define ATH10K_FW_CRASH_DUMP_VERSION 1
0012
0013
0014
0015
0016
0017 enum ath10k_fw_crash_dump_type {
0018 ATH10K_FW_CRASH_DUMP_REGISTERS = 0,
0019 ATH10K_FW_CRASH_DUMP_CE_DATA = 1,
0020
0021
0022 ATH10K_FW_CRASH_DUMP_RAM_DATA = 2,
0023
0024 ATH10K_FW_CRASH_DUMP_MAX,
0025 };
0026
0027 struct ath10k_tlv_dump_data {
0028
0029 __le32 type;
0030
0031
0032 __le32 tlv_len;
0033
0034
0035 u8 tlv_data[];
0036 } __packed;
0037
0038 struct ath10k_dump_file_data {
0039
0040
0041
0042 char df_magic[16];
0043
0044 __le32 len;
0045
0046
0047 __le32 version;
0048
0049
0050
0051 guid_t guid;
0052
0053 __le32 chip_id;
0054
0055
0056 __le32 bus_type;
0057
0058 __le32 target_version;
0059 __le32 fw_version_major;
0060 __le32 fw_version_minor;
0061 __le32 fw_version_release;
0062 __le32 fw_version_build;
0063 __le32 phy_capability;
0064 __le32 hw_min_tx_power;
0065 __le32 hw_max_tx_power;
0066 __le32 ht_cap_info;
0067 __le32 vht_cap_info;
0068 __le32 num_rf_chains;
0069
0070
0071 char fw_ver[ETHTOOL_FWVERS_LEN];
0072
0073
0074
0075
0076 __le64 tv_sec;
0077
0078
0079 __le64 tv_nsec;
0080
0081
0082 __le32 kernel_ver_code;
0083
0084
0085 char kernel_ver[64];
0086
0087
0088 u8 unused[128];
0089
0090
0091 u8 data[];
0092 } __packed;
0093
0094 struct ath10k_dump_ram_data_hdr {
0095
0096 __le32 region_type;
0097
0098 __le32 start;
0099
0100
0101 __le32 length;
0102
0103 u8 data[];
0104 };
0105
0106
0107 #define ATH10K_MAGIC_NOT_COPIED 0xAA
0108
0109
0110 enum ath10k_mem_region_type {
0111 ATH10K_MEM_REGION_TYPE_REG = 1,
0112 ATH10K_MEM_REGION_TYPE_DRAM = 2,
0113 ATH10K_MEM_REGION_TYPE_AXI = 3,
0114 ATH10K_MEM_REGION_TYPE_IRAM1 = 4,
0115 ATH10K_MEM_REGION_TYPE_IRAM2 = 5,
0116 ATH10K_MEM_REGION_TYPE_IOSRAM = 6,
0117 ATH10K_MEM_REGION_TYPE_IOREG = 7,
0118 ATH10K_MEM_REGION_TYPE_MSA = 8,
0119 };
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130 struct ath10k_mem_section {
0131 u32 start;
0132 u32 end;
0133 };
0134
0135
0136
0137
0138
0139
0140 struct ath10k_mem_region {
0141 enum ath10k_mem_region_type type;
0142 u32 start;
0143 u32 len;
0144
0145 const char *name;
0146
0147 struct {
0148 const struct ath10k_mem_section *sections;
0149 u32 size;
0150 } section_table;
0151 };
0152
0153
0154
0155
0156 struct ath10k_hw_mem_layout {
0157 u32 hw_id;
0158 u32 hw_rev;
0159 enum ath10k_bus bus;
0160
0161 struct {
0162 const struct ath10k_mem_region *regions;
0163 int size;
0164 } region_table;
0165 };
0166
0167
0168 extern unsigned long ath10k_coredump_mask;
0169
0170 #ifdef CONFIG_DEV_COREDUMP
0171
0172 int ath10k_coredump_submit(struct ath10k *ar);
0173 struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);
0174 int ath10k_coredump_create(struct ath10k *ar);
0175 int ath10k_coredump_register(struct ath10k *ar);
0176 void ath10k_coredump_unregister(struct ath10k *ar);
0177 void ath10k_coredump_destroy(struct ath10k *ar);
0178
0179 const struct ath10k_hw_mem_layout *_ath10k_coredump_get_mem_layout(struct ath10k *ar);
0180 const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar);
0181
0182 #else
0183
0184 static inline int ath10k_coredump_submit(struct ath10k *ar)
0185 {
0186 return 0;
0187 }
0188
0189 static inline struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
0190 {
0191 return NULL;
0192 }
0193
0194 static inline int ath10k_coredump_create(struct ath10k *ar)
0195 {
0196 return 0;
0197 }
0198
0199 static inline int ath10k_coredump_register(struct ath10k *ar)
0200 {
0201 return 0;
0202 }
0203
0204 static inline void ath10k_coredump_unregister(struct ath10k *ar)
0205 {
0206 }
0207
0208 static inline void ath10k_coredump_destroy(struct ath10k *ar)
0209 {
0210 }
0211
0212 static inline const struct ath10k_hw_mem_layout *
0213 ath10k_coredump_get_mem_layout(struct ath10k *ar)
0214 {
0215 return NULL;
0216 }
0217
0218 static inline const struct ath10k_hw_mem_layout *
0219 _ath10k_coredump_get_mem_layout(struct ath10k *ar)
0220 {
0221 return NULL;
0222 }
0223
0224 #endif
0225
0226 #endif