ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ppc64 / ppcdebug.h
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_SIGNALXMON    PPCDBG_BITVAL(10)
43 #define PPCDBG_BINFMT32      PPCDBG_BITVAL(11)
44 #define PPCDBG_BINFMT64      PPCDBG_BITVAL(12)
45 #define PPCDBG_BINFMTXMON    PPCDBG_BITVAL(13)
46 #define PPCDBG_BINFMT_32ADDR PPCDBG_BITVAL(14)
47 #define PPCDBG_ALIGNFIXUP    PPCDBG_BITVAL(15)
48 #define PPCDBG_TCEINIT       PPCDBG_BITVAL(16)
49 #define PPCDBG_TCE           PPCDBG_BITVAL(17)
50 #define PPCDBG_PHBINIT       PPCDBG_BITVAL(18)
51 #define PPCDBG_SMP           PPCDBG_BITVAL(19)
52 #define PPCDBG_BOOT          PPCDBG_BITVAL(20)
53 #define PPCDBG_BUSWALK       PPCDBG_BITVAL(21)
54 #define PPCDBG_PROM          PPCDBG_BITVAL(22)
55 #define PPCDBG_RTAS          PPCDBG_BITVAL(23)
56 #define PPCDBG_HTABSTRESS    PPCDBG_BITVAL(62)
57 #define PPCDBG_HTABSIZE      PPCDBG_BITVAL(63)
58 #define PPCDBG_NONE          (0UL)
59 #define PPCDBG_ALL           (0xffffffffUL)
60
61 /* The default initial value for the debug switch */
62 #define PPC_DEBUG_DEFAULT    0 
63 /* #define PPC_DEBUG_DEFAULT    PPCDBG_ALL        */
64
65 #define PPCDBG_NUM_FLAGS     64
66
67 #ifdef WANT_PPCDBG_TAB
68 /* A table of debug switch names to allow name lookup in xmon 
69  * (and whoever else wants it.
70  */
71 char *trace_names[PPCDBG_NUM_FLAGS] = {
72         /* Known debug names */
73         "mminit",       "mm",
74         "syscall32",    "syscall32_ni", "syscall32x",   "syscall32m",
75         "syscall64",    "syscall64_ni", "syscall64x",
76         "signal",       "signal_xmon",
77         "binfmt32",     "binfmt64",     "binfmt_xmon",  "binfmt_32addr",
78         "alignfixup",   "tceinit",      "tce",          "phb_init",     
79         "smp",          "boot",         "buswalk",      "prom",
80         "rtas"
81 };
82 #else
83 extern char *trace_names[64];
84 #endif /* WANT_PPCDBG_TAB */
85
86 #ifdef CONFIG_PPCDBG
87 /* Macro to conditionally print debug based on debug_switch */
88 #define PPCDBG(...) udbg_ppcdbg(__VA_ARGS__)
89
90 /* Macro to conditionally call a debug routine based on debug_switch */
91 #define PPCDBGCALL(FLAGS,FUNCTION) ifppcdebug(FLAGS) FUNCTION
92
93 /* Macros to test for debug states */
94 #define ifppcdebug(FLAGS) if (udbg_ifdebug(FLAGS))
95 #define ppcdebugset(FLAGS) (udbg_ifdebug(FLAGS))
96 #define PPCDBG_BINFMT (test_thread_flag(TIF_32BIT) ? PPCDBG_BINFMT32 : PPCDBG_BINFMT64)
97
98 #else
99 #define PPCDBG(...) do {;} while (0)
100 #define PPCDBGCALL(FLAGS,FUNCTION) do {;} while (0)
101 #define ifppcdebug(...) if (0)
102 #define ppcdebugset(FLAGS) (0)
103 #endif /* CONFIG_PPCDBG */
104
105 #endif /*__PPCDEBUG_H */