162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _PPC64_KDUMP_H
362306a36Sopenharmony_ci#define _PPC64_KDUMP_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <asm/page.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#define KDUMP_KERNELBASE	0x2000000
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/* How many bytes to reserve at zero for kdump. The reserve limit should
1062306a36Sopenharmony_ci * be greater or equal to the trampoline's end address.
1162306a36Sopenharmony_ci * Reserve to the end of the FWNMI area, see head_64.S */
1262306a36Sopenharmony_ci#define KDUMP_RESERVE_LIMIT	0x10000 /* 64K */
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#ifdef CONFIG_CRASH_DUMP
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci * On PPC64 translation is disabled during trampoline setup, so we use
1862306a36Sopenharmony_ci * physical addresses. Though on PPC32 translation is already enabled,
1962306a36Sopenharmony_ci * so we can't do the same. Luckily create_trampoline() creates relative
2062306a36Sopenharmony_ci * branches, so we can just add the PAGE_OFFSET and don't worry about it.
2162306a36Sopenharmony_ci */
2262306a36Sopenharmony_ci#ifdef __powerpc64__
2362306a36Sopenharmony_ci#define KDUMP_TRAMPOLINE_START	0x0100
2462306a36Sopenharmony_ci#define KDUMP_TRAMPOLINE_END	0x3000
2562306a36Sopenharmony_ci#else
2662306a36Sopenharmony_ci#define KDUMP_TRAMPOLINE_START	(0x0100 + PAGE_OFFSET)
2762306a36Sopenharmony_ci#define KDUMP_TRAMPOLINE_END	(0x3000 + PAGE_OFFSET)
2862306a36Sopenharmony_ci#endif /* __powerpc64__ */
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define KDUMP_MIN_TCE_ENTRIES	2048
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#endif /* CONFIG_CRASH_DUMP */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#ifndef __ASSEMBLY__
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#if defined(CONFIG_CRASH_DUMP) && !defined(CONFIG_NONSTATIC_KERNEL)
3762306a36Sopenharmony_ciextern void reserve_kdump_trampoline(void);
3862306a36Sopenharmony_ciextern void setup_kdump_trampoline(void);
3962306a36Sopenharmony_ci#else
4062306a36Sopenharmony_ci/* !CRASH_DUMP || !NONSTATIC_KERNEL */
4162306a36Sopenharmony_cistatic inline void reserve_kdump_trampoline(void) { ; }
4262306a36Sopenharmony_cistatic inline void setup_kdump_trampoline(void) { ; }
4362306a36Sopenharmony_ci#endif
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#endif /* __ASSEMBLY__ */
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#endif /* __PPC64_KDUMP_H */
48