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