18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _PPC64_KDUMP_H
38c2ecf20Sopenharmony_ci#define _PPC64_KDUMP_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm/page.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define KDUMP_KERNELBASE	0x2000000
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/* How many bytes to reserve at zero for kdump. The reserve limit should
108c2ecf20Sopenharmony_ci * be greater or equal to the trampoline's end address.
118c2ecf20Sopenharmony_ci * Reserve to the end of the FWNMI area, see head_64.S */
128c2ecf20Sopenharmony_ci#define KDUMP_RESERVE_LIMIT	0x10000 /* 64K */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifdef CONFIG_CRASH_DUMP
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * On PPC64 translation is disabled during trampoline setup, so we use
188c2ecf20Sopenharmony_ci * physical addresses. Though on PPC32 translation is already enabled,
198c2ecf20Sopenharmony_ci * so we can't do the same. Luckily create_trampoline() creates relative
208c2ecf20Sopenharmony_ci * branches, so we can just add the PAGE_OFFSET and don't worry about it.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci#ifdef __powerpc64__
238c2ecf20Sopenharmony_ci#define KDUMP_TRAMPOLINE_START	0x0100
248c2ecf20Sopenharmony_ci#define KDUMP_TRAMPOLINE_END	0x3000
258c2ecf20Sopenharmony_ci#else
268c2ecf20Sopenharmony_ci#define KDUMP_TRAMPOLINE_START	(0x0100 + PAGE_OFFSET)
278c2ecf20Sopenharmony_ci#define KDUMP_TRAMPOLINE_END	(0x3000 + PAGE_OFFSET)
288c2ecf20Sopenharmony_ci#endif /* __powerpc64__ */
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define KDUMP_MIN_TCE_ENTRIES	2048
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#endif /* CONFIG_CRASH_DUMP */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#if defined(CONFIG_CRASH_DUMP) && !defined(CONFIG_NONSTATIC_KERNEL)
378c2ecf20Sopenharmony_ciextern void reserve_kdump_trampoline(void);
388c2ecf20Sopenharmony_ciextern void setup_kdump_trampoline(void);
398c2ecf20Sopenharmony_ci#else
408c2ecf20Sopenharmony_ci/* !CRASH_DUMP || !NONSTATIC_KERNEL */
418c2ecf20Sopenharmony_cistatic inline void reserve_kdump_trampoline(void) { ; }
428c2ecf20Sopenharmony_cistatic inline void setup_kdump_trampoline(void) { ; }
438c2ecf20Sopenharmony_ci#endif
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#endif /* __PPC64_KDUMP_H */
48