xref: /linux/drivers/net/wireless/ath/ath11k/coredump.h (revision 1a9239bb4253f9076b5b4b2a1a4e8d7defd77a95)
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 #define ATH11K_FW_CRASH_DUMP_V2      2
10 
11 enum ath11k_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 
19 	/* keep last */
20 	FW_CRASH_DUMP_TYPE_MAX,
21 };
22 
23 #define COREDUMP_TLV_HDR_SIZE 8
24 
25 struct ath11k_tlv_dump_data {
26 	/* see ath11k_fw_crash_dump_type above */
27 	__le32 type;
28 
29 	/* in bytes */
30 	__le32 tlv_len;
31 
32 	/* pad to 32-bit boundaries as needed */
33 	u8 tlv_data[];
34 } __packed;
35 
36 struct ath11k_dump_file_data {
37 	/* "ATH11K-FW-DUMP" */
38 	char df_magic[16];
39 	/* total dump len in bytes */
40 	__le32 len;
41 	/* file dump version */
42 	__le32 version;
43 	/* pci device id */
44 	__le32 chip_id;
45 	/* qrtr instance id */
46 	__le32 qrtr_id;
47 	/* pci domain id */
48 	__le32 bus_id;
49 	guid_t guid;
50 	/* time-of-day stamp */
51 	__le64 tv_sec;
52 	/* time-of-day stamp, nano-seconds */
53 	__le64 tv_nsec;
54 	/* room for growth w/out changing binary format */
55 	u8 unused[128];
56 	u8 data[];
57 } __packed;
58 
59 #ifdef CONFIG_DEV_COREDUMP
60 enum ath11k_fw_crash_dump_type ath11k_coredump_get_dump_type(int type);
61 void ath11k_coredump_upload(struct work_struct *work);
62 void ath11k_coredump_collect(struct ath11k_base *ab);
63 #else
64 static inline enum
ath11k_coredump_get_dump_type(int type)65 ath11k_fw_crash_dump_type ath11k_coredump_get_dump_type(int type)
66 {
67 	return FW_CRASH_DUMP_TYPE_MAX;
68 }
69 
ath11k_coredump_upload(struct work_struct * work)70 static inline void ath11k_coredump_upload(struct work_struct *work)
71 {
72 }
73 
ath11k_coredump_collect(struct ath11k_base * ab)74 static inline void ath11k_coredump_collect(struct ath11k_base *ab)
75 {
76 }
77 #endif
78 
79 #endif
80