fadump.h (2df173d9e85d9e2c6a8933c63f0c034accff7e0f) fadump.h (ebaeb5ae24379b5b635dc1d1fa6df904bc95b4d9)
1/*
2 * Firmware Assisted dump header file.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 51 unchanged lines hidden (view full) ---

60/* FAD commands */
61#define FADUMP_REGISTER 1
62#define FADUMP_UNREGISTER 2
63#define FADUMP_INVALIDATE 3
64
65/* Dump status flag */
66#define FADUMP_ERROR_FLAG 0x2000
67
1/*
2 * Firmware Assisted dump header file.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *

--- 51 unchanged lines hidden (view full) ---

60/* FAD commands */
61#define FADUMP_REGISTER 1
62#define FADUMP_UNREGISTER 2
63#define FADUMP_INVALIDATE 3
64
65/* Dump status flag */
66#define FADUMP_ERROR_FLAG 0x2000
67
68#define FADUMP_CPU_ID_MASK ((1UL << 32) - 1)
69
70#define CPU_UNKNOWN (~((u32)0))
71
72/* Utility macros */
73#define SKIP_TO_NEXT_CPU(reg_entry) \
74({ \
75 while (reg_entry->reg_id != REG_ID("CPUEND")) \
76 reg_entry++; \
77 reg_entry++; \
78})
79
68/* Kernel Dump section info */
69struct fadump_section {
70 u32 request_flag;
71 u16 source_data_type;
72 u16 error_flags;
73 u64 source_address;
74 u64 source_len;
75 u64 bytes_dumped;

--- 38 unchanged lines hidden (view full) ---

114 unsigned long hpte_region_size;
115 unsigned long boot_memory_size;
116 unsigned long reserve_dump_area_start;
117 unsigned long reserve_dump_area_size;
118 /* cmd line option during boot */
119 unsigned long reserve_bootvar;
120
121 unsigned long fadumphdr_addr;
80/* Kernel Dump section info */
81struct fadump_section {
82 u32 request_flag;
83 u16 source_data_type;
84 u16 error_flags;
85 u64 source_address;
86 u64 source_len;
87 u64 bytes_dumped;

--- 38 unchanged lines hidden (view full) ---

126 unsigned long hpte_region_size;
127 unsigned long boot_memory_size;
128 unsigned long reserve_dump_area_start;
129 unsigned long reserve_dump_area_size;
130 /* cmd line option during boot */
131 unsigned long reserve_bootvar;
132
133 unsigned long fadumphdr_addr;
134 unsigned long cpu_notes_buf;
135 unsigned long cpu_notes_buf_size;
136
122 int ibm_configure_kernel_dump;
123
124 unsigned long fadump_enabled:1;
125 unsigned long fadump_supported:1;
126 unsigned long dump_active:1;
127 unsigned long dump_registered:1;
128};
129

--- 8 unchanged lines hidden (view full) ---

138 u64 val = 0;
139 int i;
140
141 for (i = 0; i < sizeof(val); i++)
142 val = (*str) ? (val << 8) | *str++ : val << 8;
143 return val;
144}
145#define STR_TO_HEX(x) str_to_u64(x)
137 int ibm_configure_kernel_dump;
138
139 unsigned long fadump_enabled:1;
140 unsigned long fadump_supported:1;
141 unsigned long dump_active:1;
142 unsigned long dump_registered:1;
143};
144

--- 8 unchanged lines hidden (view full) ---

153 u64 val = 0;
154 int i;
155
156 for (i = 0; i < sizeof(val); i++)
157 val = (*str) ? (val << 8) | *str++ : val << 8;
158 return val;
159}
160#define STR_TO_HEX(x) str_to_u64(x)
161#define REG_ID(x) str_to_u64(x)
146
147#define FADUMP_CRASH_INFO_MAGIC STR_TO_HEX("FADMPINF")
162
163#define FADUMP_CRASH_INFO_MAGIC STR_TO_HEX("FADMPINF")
164#define REGSAVE_AREA_MAGIC STR_TO_HEX("REGSAVE")
148
165
166/* The firmware-assisted dump format.
167 *
168 * The register save area is an area in the partition's memory used to preserve
169 * the register contents (CPU state data) for the active CPUs during a firmware
170 * assisted dump. The dump format contains register save area header followed
171 * by register entries. Each list of registers for a CPU starts with
172 * "CPUSTRT" and ends with "CPUEND".
173 */
174
175/* Register save area header. */
176struct fadump_reg_save_area_header {
177 u64 magic_number;
178 u32 version;
179 u32 num_cpu_offset;
180};
181
182/* Register entry. */
183struct fadump_reg_entry {
184 u64 reg_id;
185 u64 reg_value;
186};
187
149/* fadump crash info structure */
150struct fadump_crash_info_header {
151 u64 magic_number;
152 u64 elfcorehdr_addr;
188/* fadump crash info structure */
189struct fadump_crash_info_header {
190 u64 magic_number;
191 u64 elfcorehdr_addr;
192 u32 crashing_cpu;
193 struct pt_regs regs;
194 struct cpumask cpu_online_mask;
153};
154
155/* Crash memory ranges */
156#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2)
157
158struct fad_crash_memory_ranges {
159 unsigned long long base;
160 unsigned long long size;
161};
162
163extern int early_init_dt_scan_fw_dump(unsigned long node,
164 const char *uname, int depth, void *data);
165extern int fadump_reserve_mem(void);
166extern int setup_fadump(void);
167extern int is_fadump_active(void);
195};
196
197/* Crash memory ranges */
198#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2)
199
200struct fad_crash_memory_ranges {
201 unsigned long long base;
202 unsigned long long size;
203};
204
205extern int early_init_dt_scan_fw_dump(unsigned long node,
206 const char *uname, int depth, void *data);
207extern int fadump_reserve_mem(void);
208extern int setup_fadump(void);
209extern int is_fadump_active(void);
210extern void crash_fadump(struct pt_regs *, const char *);
168#else /* CONFIG_FA_DUMP */
169static inline int is_fadump_active(void) { return 0; }
211#else /* CONFIG_FA_DUMP */
212static inline int is_fadump_active(void) { return 0; }
213static inline void crash_fadump(struct pt_regs *regs, const char *str) { }
170#endif
171#endif
214#endif
215#endif