1 #ifndef __PPCDEBUG_H 2 #define __PPCDEBUG_H 3 /******************************************************************** 4 * Author: Adam Litke, IBM Corp 5 * (c) 2001 6 * 7 * This file contains definitions and macros for a runtime debugging 8 * system for ppc64 (This should also work on 32 bit with a few 9 * adjustments. 10 * 11 * This program is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; either version 14 * 2 of the License, or (at your option) any later version. 15 * 16 ********************************************************************/ 17 18 #include <linux/config.h> 19 #include <asm/udbg.h> 20 #include <stdarg.h> 21 22 #define PPCDBG_BITVAL(X) ((1UL)<<((unsigned long)(X))) 23 24 /* Defined below are the bit positions of various debug flags in the 25 * debug_switch variable (defined in naca.h). 26 * -- When adding new values, please enter them into trace names below -- 27 * 28 * Values 62 & 63 can be used to stress the hardware page table management 29 * code. They must be set statically, any attempt to change them dynamically 30 * would be a very bad idea. 31 */ 32 #define PPCDBG_MMINIT PPCDBG_BITVAL(0) 33 #define PPCDBG_MM PPCDBG_BITVAL(1) 34 #define PPCDBG_SYS32 PPCDBG_BITVAL(2) 35 #define PPCDBG_SYS32NI PPCDBG_BITVAL(3) 36 #define PPCDBG_SYS32X PPCDBG_BITVAL(4) 37 #define PPCDBG_SYS32M PPCDBG_BITVAL(5) 38 #define PPCDBG_SYS64 PPCDBG_BITVAL(6) 39 #define PPCDBG_SYS64NI PPCDBG_BITVAL(7) 40 #define PPCDBG_SYS64X PPCDBG_BITVAL(8) 41 #define PPCDBG_SIGNAL PPCDBG_BITVAL(9) 42 #define PPCDBG_SIGNAL64 PPCDBG_BITVAL(10) 43 #define PPCDBG_SIGNALXMON PPCDBG_BITVAL(11) 44 #define PPCDBG_BINFMT32 PPCDBG_BITVAL(12) 45 #define PPCDBG_BINFMT64 PPCDBG_BITVAL(13) 46 #define PPCDBG_BINFMTXMON PPCDBG_BITVAL(14) 47 #define PPCDBG_BINFMT_32ADDR PPCDBG_BITVAL(15) 48 #define PPCDBG_ALIGNFIXUP PPCDBG_BITVAL(16) 49 #define PPCDBG_TCEINIT PPCDBG_BITVAL(17) 50 #define PPCDBG_TCE PPCDBG_BITVAL(18) 51 #define PPCDBG_PHBINIT PPCDBG_BITVAL(19) 52 #define PPCDBG_SMP PPCDBG_BITVAL(20) 53 #define PPCDBG_BOOT PPCDBG_BITVAL(21) 54 #define PPCDBG_BUSWALK PPCDBG_BITVAL(22) 55 #define PPCDBG_PROM PPCDBG_BITVAL(23) 56 #define PPCDBG_RTAS PPCDBG_BITVAL(24) 57 #define PPCDBG_HTABSTRESS PPCDBG_BITVAL(62) 58 #define PPCDBG_HTABSIZE PPCDBG_BITVAL(63) 59 #define PPCDBG_NONE (0UL) 60 #define PPCDBG_ALL (0xffffffffUL) 61 62 #define PPCDBG_NUM_FLAGS 64 63 64 /* The default initial value for the debug switch */ 65 #if 0 66 # define PPC_DEBUG_DEFAULT PPCDBG_ALL 67 #else 68 # define PPC_DEBUG_DEFAULT PPCDBG_NONE 69 #endif 70 71 #ifdef WANT_PPCDBG_TAB 72 /* A table of debug switch names to allow name lookup in xmon 73 * (and whoever else wants it. 74 */ 75 char *trace_names[PPCDBG_NUM_FLAGS] = { 76 /* Known debug names */ 77 "mminit", "mm", 78 "syscall32", "syscall32_ni", "syscall32x", "syscall32m", 79 "syscall64", "syscall64_ni", "syscall64x", 80 "signal", "signal64", "signal_xmon", 81 "binfmt32", "binfmt64", "binfmt_xmon", "binfmt_32addr", 82 "alignfixup", "tceinit", "tce", "phb_init", 83 "smp", "boot", "buswalk", "prom", 84 "rtas" 85 }; 86 #else 87 extern char *trace_names[64]; 88 #endif /* WANT_PPCDBG_TAB */ 89 90 #ifdef CONFIG_PPCDBG 91 /* Macro to conditionally print debug based on debug_switch */ 92 #define PPCDBG(...) udbg_ppcdbg(__VA_ARGS__) 93 94 /* Macro to conditionally call a debug routine based on debug_switch */ 95 #define PPCDBGCALL(FLAGS,FUNCTION) ifppcdebug(FLAGS) FUNCTION 96 97 /* Macros to test for debug states */ 98 #define ifppcdebug(FLAGS) if (udbg_ifdebug(FLAGS)) 99 #define ppcdebugset(FLAGS) (udbg_ifdebug(FLAGS)) 100 #define PPCDBG_BINFMT ((current->thread.flags & PPC_FLAG_32BIT) ? PPCDBG_BINFMT32 : PPCDBG_BINFMT64) 101 102 #ifdef CONFIG_XMON 103 #define PPCDBG_ENTER_DEBUGGER() xmon(0) 104 #define PPCDBG_ENTER_DEBUGGER_REGS(X) xmon(X) 105 #endif 106 107 #else 108 #define PPCDBG(...) do {;} while (0) 109 #define PPCDBGCALL(FLAGS,FUNCTION) do {;} while (0) 110 #define ifppcdebug(...) if (0) 111 #define ppcdebugset(FLAGS) (0) 112 #endif /* CONFIG_PPCDBG */ 113 114 #ifndef PPCDBG_ENTER_DEBUGGER 115 #define PPCDBG_ENTER_DEBUGGER() do {;} while(0) 116 #endif 117 118 #ifndef PPCDBG_ENTER_DEBUGGER_REGS 119 #define PPCDBG_ENTER_DEBUGGER_REGS(A) do {;} while(0) 120 #endif 121 122 #endif /*__PPCDEBUG_H */ 123