MAINTAINERS: Remove Noralf Trønnes as driver maintainer
[drm/drm-misc.git] / drivers / net / wireless / mediatek / mt76 / mt7915 / coredump.h
blob709f8e9c795cbe1dbfe6f24fe584eec66b4d7514
1 /* SPDX-License-Identifier: ISC */
2 /* Copyright (C) 2022 MediaTek Inc. */
4 #ifndef _COREDUMP_H_
5 #define _COREDUMP_H_
7 #include "mt7915.h"
9 struct trace {
10 u32 id;
11 u32 timestamp;
14 struct mt7915_coredump {
15 char magic[16];
17 u32 len;
19 guid_t guid;
21 /* time-of-day stamp */
22 u64 tv_sec;
23 /* time-of-day stamp, nano-seconds */
24 u64 tv_nsec;
25 /* kernel version */
26 char kernel[64];
27 /* firmware version */
28 char fw_ver[ETHTOOL_FWVERS_LEN];
30 u32 device_id;
32 /* exception state */
33 char fw_state[12];
35 u32 last_msg_id;
36 u32 eint_info_idx;
37 u32 irq_info_idx;
38 u32 sched_info_idx;
40 /* schedule info */
41 char trace_sched[32];
42 struct {
43 struct trace t;
44 u32 pc;
45 } sched[60];
47 /* irq info */
48 char trace_irq[32];
49 struct trace irq[60];
51 /* task queue status */
52 char task_qid[32];
53 struct {
54 u32 read;
55 u32 write;
56 } taskq[2];
58 /* task stack info */
59 char task_info[32];
60 struct {
61 u32 start;
62 u32 end;
63 u32 size;
64 } taski[2];
66 /* firmware context */
67 char fw_context[24];
68 struct {
69 u32 idx;
70 u32 handler;
71 } context;
73 /* link registers calltrace */
74 u32 call_stack[16];
76 /* memory content */
77 u8 data[];
78 } __packed;
80 struct mt7915_coredump_mem {
81 u32 len;
82 u8 data[];
83 } __packed;
85 struct mt7915_mem_hdr {
86 u32 start;
87 u32 len;
88 u8 data[];
91 struct mt7915_mem_region {
92 u32 start;
93 size_t len;
95 const char *name;
98 #ifdef CONFIG_DEV_COREDUMP
100 const struct mt7915_mem_region *
101 mt7915_coredump_get_mem_layout(struct mt7915_dev *dev, u32 *num);
102 struct mt7915_crash_data *mt7915_coredump_new(struct mt7915_dev *dev);
103 int mt7915_coredump_submit(struct mt7915_dev *dev);
104 int mt7915_coredump_register(struct mt7915_dev *dev);
105 void mt7915_coredump_unregister(struct mt7915_dev *dev);
107 #else /* CONFIG_DEV_COREDUMP */
109 static inline const struct mt7915_mem_region *
110 mt7915_coredump_get_mem_layout(struct mt7915_dev *dev, u32 *num)
112 return NULL;
115 static inline int mt7915_coredump_submit(struct mt7915_dev *dev)
117 return 0;
120 static inline struct mt7915_crash_data *mt7915_coredump_new(struct mt7915_dev *dev)
122 return NULL;
125 static inline int mt7915_coredump_register(struct mt7915_dev *dev)
127 return 0;
130 static inline void mt7915_coredump_unregister(struct mt7915_dev *dev)
134 #endif /* CONFIG_DEV_COREDUMP */
136 #endif /* _COREDUMP_H_ */