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 _ATH12K_COREDUMP_H_
7 #define _ATH12K_COREDUMP_H_
8
9 #define ATH12K_FW_CRASH_DUMP_V2 2
10
11 enum ath12k_fw_crash_dump_type {
12 FW_CRASH_DUMP_PAGING_DATA,
13 FW_CRASH_DUMP_RDDM_DATA,
14 FW_CRASH_DUMP_REMOTE_MEM_DATA,
15 FW_CRASH_DUMP_PAGEABLE_DATA,
16 FW_CRASH_DUMP_M3_DUMP,
17 FW_CRASH_DUMP_NONE,
18 FW_CRASH_DUMP_MLO_GLOBAL_DATA,
19
20 /* keep last */
21 FW_CRASH_DUMP_TYPE_MAX,
22 };
23
24 #define COREDUMP_TLV_HDR_SIZE 8
25
26 struct ath12k_tlv_dump_data {
27 /* see ath11k_fw_crash_dump_type above */
28 __le32 type;
29
30 /* in bytes */
31 __le32 tlv_len;
32
33 /* pad to 32-bit boundaries as needed */
34 u8 tlv_data[];
35 } __packed;
36
37 struct ath12k_dump_file_data {
38 /* "ATH12K-FW-DUMP" */
39 char df_magic[16];
40 /* total dump len in bytes */
41 __le32 len;
42 /* file dump version */
43 __le32 version;
44 /* pci device id */
45 __le32 chip_id;
46 /* qrtr instance id */
47 __le32 qrtr_id;
48 /* pci domain id */
49 __le32 bus_id;
50 guid_t guid;
51 /* time-of-day stamp */
52 __le64 tv_sec;
53 /* time-of-day stamp, nano-seconds */
54 __le64 tv_nsec;
55 /* room for growth w/out changing binary format */
56 u8 unused[128];
57 u8 data[];
58 } __packed;
59
60 #ifdef CONFIG_ATH12K_COREDUMP
61 enum ath12k_fw_crash_dump_type ath12k_coredump_get_dump_type
62 (enum ath12k_qmi_target_mem type);
63 void ath12k_coredump_upload(struct work_struct *work);
64 void ath12k_coredump_collect(struct ath12k_base *ab);
65 #else
ath12k_coredump_get_dump_type(enum ath12k_qmi_target_mem type)66 static inline enum ath12k_fw_crash_dump_type ath12k_coredump_get_dump_type
67 (enum ath12k_qmi_target_mem type)
68 {
69 return FW_CRASH_DUMP_TYPE_MAX;
70 }
71
ath12k_coredump_upload(struct work_struct * work)72 static inline void ath12k_coredump_upload(struct work_struct *work)
73 {
74 }
75
ath12k_coredump_collect(struct ath12k_base * ab)76 static inline void ath12k_coredump_collect(struct ath12k_base *ab)
77 {
78 }
79 #endif
80
81 #endif
82