xref: /openbmc/linux/arch/powerpc/include/asm/kgdb.h (revision 688de017)
1b8b572e1SStephen Rothwell /*
2b8b572e1SStephen Rothwell  * The PowerPC (32/64) specific defines / externs for KGDB.  Based on
3b8b572e1SStephen Rothwell  * the previous 32bit and 64bit specific files, which had the following
4b8b572e1SStephen Rothwell  * copyrights:
5b8b572e1SStephen Rothwell  *
6b8b572e1SStephen Rothwell  * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com)
7b8b572e1SStephen Rothwell  * PPC Mods (C) 2004 Tom Rini (trini@mvista.com)
8b8b572e1SStephen Rothwell  * PPC Mods (C) 2003 John Whitney (john.whitney@timesys.com)
9b8b572e1SStephen Rothwell  * PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu)
10b8b572e1SStephen Rothwell  *
11b8b572e1SStephen Rothwell  *
12b8b572e1SStephen Rothwell  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
13b8b572e1SStephen Rothwell  * Author: Tom Rini <trini@kernel.crashing.org>
14b8b572e1SStephen Rothwell  *
15b8b572e1SStephen Rothwell  * 2006 (c) MontaVista Software, Inc. This file is licensed under
16b8b572e1SStephen Rothwell  * the terms of the GNU General Public License version 2. This program
17b8b572e1SStephen Rothwell  * is licensed "as is" without any warranty of any kind, whether express
18b8b572e1SStephen Rothwell  * or implied.
19b8b572e1SStephen Rothwell  */
20b8b572e1SStephen Rothwell #ifdef __KERNEL__
21b8b572e1SStephen Rothwell #ifndef __POWERPC_KGDB_H__
22b8b572e1SStephen Rothwell #define __POWERPC_KGDB_H__
23b8b572e1SStephen Rothwell 
24b8b572e1SStephen Rothwell #ifndef __ASSEMBLY__
25b8b572e1SStephen Rothwell 
26b8b572e1SStephen Rothwell #define BREAK_INSTR_SIZE	4
27b8b572e1SStephen Rothwell #define BUFMAX			((NUMREGBYTES * 2) + 512)
28b8b572e1SStephen Rothwell #define OUTBUFMAX		((NUMREGBYTES * 2) + 512)
29fb978ca2SChristophe Leroy 
30fb978ca2SChristophe Leroy #define BREAK_INSTR		0x7d821008	/* twge r2, r2 */
31fb978ca2SChristophe Leroy 
arch_kgdb_breakpoint(void)32b8b572e1SStephen Rothwell static inline void arch_kgdb_breakpoint(void)
33b8b572e1SStephen Rothwell {
34fb978ca2SChristophe Leroy 	asm(stringify_in_c(.long BREAK_INSTR));
35b8b572e1SStephen Rothwell }
36b8b572e1SStephen Rothwell #define CACHE_FLUSH_IS_SAFE	1
37ff10b88bSDongdong Deng #define DBG_MAX_REG_NUM     70
38b8b572e1SStephen Rothwell 
39b8b572e1SStephen Rothwell /* The number bytes of registers we have to save depends on a few
40b8b572e1SStephen Rothwell  * things.  For 64bit we default to not including vector registers and
41b8b572e1SStephen Rothwell  * vector state registers. */
42b8b572e1SStephen Rothwell #ifdef CONFIG_PPC64
43b8b572e1SStephen Rothwell /*
44b8b572e1SStephen Rothwell  * 64 bit (8 byte) registers:
45b8b572e1SStephen Rothwell  *   32 gpr, 32 fpr, nip, msr, link, ctr
46b8b572e1SStephen Rothwell  * 32 bit (4 byte) registers:
47b8b572e1SStephen Rothwell  *   ccr, xer, fpscr
48b8b572e1SStephen Rothwell  */
49b8b572e1SStephen Rothwell #define NUMREGBYTES		((68 * 8) + (3 * 4))
50b8b572e1SStephen Rothwell #define NUMCRITREGBYTES		184
51b8b572e1SStephen Rothwell #else /* CONFIG_PPC32 */
52b8b572e1SStephen Rothwell /* On non-E500 family PPC32 we determine the size by picking the last
53b8b572e1SStephen Rothwell  * register we need, but on E500 we skip sections so we list what we
54b8b572e1SStephen Rothwell  * need to store, and add it up. */
55*688de017SChristophe Leroy #ifndef CONFIG_PPC_E500
56b8b572e1SStephen Rothwell #define MAXREG			(PT_FPSCR+1)
57b8b572e1SStephen Rothwell #else
58b8b572e1SStephen Rothwell /* 32 GPRs (8 bytes), nip, msr, ccr, link, ctr, xer, acc (8 bytes), spefscr*/
59b8b572e1SStephen Rothwell #define MAXREG                 ((32*2)+6+2+1)
60b8b572e1SStephen Rothwell #endif
61b8b572e1SStephen Rothwell #define NUMREGBYTES		(MAXREG * sizeof(int))
62b8b572e1SStephen Rothwell /* CR/LR, R1, R2, R13-R31 inclusive. */
63b8b572e1SStephen Rothwell #define NUMCRITREGBYTES		(23 * sizeof(int))
64b8b572e1SStephen Rothwell #endif /* 32/64 */
65b8b572e1SStephen Rothwell #endif /* !(__ASSEMBLY__) */
66b8b572e1SStephen Rothwell #endif /* !__POWERPC_KGDB_H__ */
67b8b572e1SStephen Rothwell #endif /* __KERNEL__ */
68