1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 /* 3 * Copyright (c) 2020 The Linux Foundation. All rights reserved. 4 * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 5 */ 6 #ifndef _ATH11K_COREDUMP_H_ 7 #define _ATH11K_COREDUMP_H_ 8 9 #if defined(__FreeBSD__) 10 #include <linux/uuid.h> 11 #endif 12 13 #define ATH11K_FW_CRASH_DUMP_V2 2 14 15 enum ath11k_fw_crash_dump_type { 16 FW_CRASH_DUMP_PAGING_DATA, 17 FW_CRASH_DUMP_RDDM_DATA, 18 FW_CRASH_DUMP_REMOTE_MEM_DATA, 19 FW_CRASH_DUMP_PAGEABLE_DATA, 20 FW_CRASH_DUMP_M3_DUMP, 21 FW_CRASH_DUMP_NONE, 22 23 /* keep last */ 24 FW_CRASH_DUMP_TYPE_MAX, 25 }; 26 27 #define COREDUMP_TLV_HDR_SIZE 8 28 29 struct ath11k_tlv_dump_data { 30 /* see ath11k_fw_crash_dump_type above */ 31 __le32 type; 32 33 /* in bytes */ 34 __le32 tlv_len; 35 36 /* pad to 32-bit boundaries as needed */ 37 u8 tlv_data[]; 38 } __packed; 39 40 struct ath11k_dump_file_data { 41 /* "ATH11K-FW-DUMP" */ 42 char df_magic[16]; 43 /* total dump len in bytes */ 44 __le32 len; 45 /* file dump version */ 46 __le32 version; 47 /* pci device id */ 48 __le32 chip_id; 49 /* qrtr instance id */ 50 __le32 qrtr_id; 51 /* pci domain id */ 52 __le32 bus_id; 53 guid_t guid; 54 /* time-of-day stamp */ 55 __le64 tv_sec; 56 /* time-of-day stamp, nano-seconds */ 57 __le64 tv_nsec; 58 /* room for growth w/out changing binary format */ 59 u8 unused[128]; 60 u8 data[]; 61 } __packed; 62 63 #ifdef CONFIG_DEV_COREDUMP 64 enum ath11k_fw_crash_dump_type ath11k_coredump_get_dump_type(int type); 65 void ath11k_coredump_upload(struct work_struct *work); 66 void ath11k_coredump_collect(struct ath11k_base *ab); 67 #else 68 static inline enum ath11k_coredump_get_dump_type(int type)69ath11k_fw_crash_dump_type ath11k_coredump_get_dump_type(int type) 70 { 71 return FW_CRASH_DUMP_TYPE_MAX; 72 } 73 ath11k_coredump_upload(struct work_struct * work)74static inline void ath11k_coredump_upload(struct work_struct *work) 75 { 76 } 77 ath11k_coredump_collect(struct ath11k_base * ab)78static inline void ath11k_coredump_collect(struct ath11k_base *ab) 79 { 80 } 81 #endif 82 83 #endif 84