18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * The PowerPC (32/64) specific defines / externs for KGDB.  Based on
38c2ecf20Sopenharmony_ci * the previous 32bit and 64bit specific files, which had the following
48c2ecf20Sopenharmony_ci * copyrights:
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com)
78c2ecf20Sopenharmony_ci * PPC Mods (C) 2004 Tom Rini (trini@mvista.com)
88c2ecf20Sopenharmony_ci * PPC Mods (C) 2003 John Whitney (john.whitney@timesys.com)
98c2ecf20Sopenharmony_ci * PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu)
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
138c2ecf20Sopenharmony_ci * Author: Tom Rini <trini@kernel.crashing.org>
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * 2006 (c) MontaVista Software, Inc. This file is licensed under
168c2ecf20Sopenharmony_ci * the terms of the GNU General Public License version 2. This program
178c2ecf20Sopenharmony_ci * is licensed "as is" without any warranty of any kind, whether express
188c2ecf20Sopenharmony_ci * or implied.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci#ifdef __KERNEL__
218c2ecf20Sopenharmony_ci#ifndef __POWERPC_KGDB_H__
228c2ecf20Sopenharmony_ci#define __POWERPC_KGDB_H__
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define BREAK_INSTR_SIZE	4
278c2ecf20Sopenharmony_ci#define BUFMAX			((NUMREGBYTES * 2) + 512)
288c2ecf20Sopenharmony_ci#define OUTBUFMAX		((NUMREGBYTES * 2) + 512)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define BREAK_INSTR		0x7d821008	/* twge r2, r2 */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistatic inline void arch_kgdb_breakpoint(void)
338c2ecf20Sopenharmony_ci{
348c2ecf20Sopenharmony_ci	asm(stringify_in_c(.long BREAK_INSTR));
358c2ecf20Sopenharmony_ci}
368c2ecf20Sopenharmony_ci#define CACHE_FLUSH_IS_SAFE	1
378c2ecf20Sopenharmony_ci#define DBG_MAX_REG_NUM     70
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* The number bytes of registers we have to save depends on a few
408c2ecf20Sopenharmony_ci * things.  For 64bit we default to not including vector registers and
418c2ecf20Sopenharmony_ci * vector state registers. */
428c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC64
438c2ecf20Sopenharmony_ci/*
448c2ecf20Sopenharmony_ci * 64 bit (8 byte) registers:
458c2ecf20Sopenharmony_ci *   32 gpr, 32 fpr, nip, msr, link, ctr
468c2ecf20Sopenharmony_ci * 32 bit (4 byte) registers:
478c2ecf20Sopenharmony_ci *   ccr, xer, fpscr
488c2ecf20Sopenharmony_ci */
498c2ecf20Sopenharmony_ci#define NUMREGBYTES		((68 * 8) + (3 * 4))
508c2ecf20Sopenharmony_ci#define NUMCRITREGBYTES		184
518c2ecf20Sopenharmony_ci#else /* CONFIG_PPC32 */
528c2ecf20Sopenharmony_ci/* On non-E500 family PPC32 we determine the size by picking the last
538c2ecf20Sopenharmony_ci * register we need, but on E500 we skip sections so we list what we
548c2ecf20Sopenharmony_ci * need to store, and add it up. */
558c2ecf20Sopenharmony_ci#ifndef CONFIG_E500
568c2ecf20Sopenharmony_ci#define MAXREG			(PT_FPSCR+1)
578c2ecf20Sopenharmony_ci#else
588c2ecf20Sopenharmony_ci/* 32 GPRs (8 bytes), nip, msr, ccr, link, ctr, xer, acc (8 bytes), spefscr*/
598c2ecf20Sopenharmony_ci#define MAXREG                 ((32*2)+6+2+1)
608c2ecf20Sopenharmony_ci#endif
618c2ecf20Sopenharmony_ci#define NUMREGBYTES		(MAXREG * sizeof(int))
628c2ecf20Sopenharmony_ci/* CR/LR, R1, R2, R13-R31 inclusive. */
638c2ecf20Sopenharmony_ci#define NUMCRITREGBYTES		(23 * sizeof(int))
648c2ecf20Sopenharmony_ci#endif /* 32/64 */
658c2ecf20Sopenharmony_ci#endif /* !(__ASSEMBLY__) */
668c2ecf20Sopenharmony_ci#endif /* !__POWERPC_KGDB_H__ */
678c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
68