Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 <linux/types.h> | |
20 | #include <asm/udbg.h> | |
21 | #include <stdarg.h> | |
22 | ||
23 | #define PPCDBG_BITVAL(X) ((1UL)<<((unsigned long)(X))) | |
24 | ||
25 | /* Defined below are the bit positions of various debug flags in the | |
26 | * ppc64_debug_switch variable. | |
27 | * -- When adding new values, please enter them into trace names below -- | |
28 | * | |
29 | * Values 62 & 63 can be used to stress the hardware page table management | |
30 | * code. They must be set statically, any attempt to change them dynamically | |
31 | * would be a very bad idea. | |
32 | */ | |
33 | #define PPCDBG_MMINIT PPCDBG_BITVAL(0) | |
34 | #define PPCDBG_MM PPCDBG_BITVAL(1) | |
35 | #define PPCDBG_SYS32 PPCDBG_BITVAL(2) | |
36 | #define PPCDBG_SYS32NI PPCDBG_BITVAL(3) | |
37 | #define PPCDBG_SYS32X PPCDBG_BITVAL(4) | |
38 | #define PPCDBG_SYS32M PPCDBG_BITVAL(5) | |
39 | #define PPCDBG_SYS64 PPCDBG_BITVAL(6) | |
40 | #define PPCDBG_SYS64NI PPCDBG_BITVAL(7) | |
41 | #define PPCDBG_SYS64X PPCDBG_BITVAL(8) | |
42 | #define PPCDBG_SIGNAL PPCDBG_BITVAL(9) | |
43 | #define PPCDBG_SIGNALXMON PPCDBG_BITVAL(10) | |
44 | #define PPCDBG_BINFMT32 PPCDBG_BITVAL(11) | |
45 | #define PPCDBG_BINFMT64 PPCDBG_BITVAL(12) | |
46 | #define PPCDBG_BINFMTXMON PPCDBG_BITVAL(13) | |
47 | #define PPCDBG_BINFMT_32ADDR PPCDBG_BITVAL(14) | |
48 | #define PPCDBG_ALIGNFIXUP PPCDBG_BITVAL(15) | |
49 | #define PPCDBG_TCEINIT PPCDBG_BITVAL(16) | |
50 | #define PPCDBG_TCE PPCDBG_BITVAL(17) | |
51 | #define PPCDBG_PHBINIT PPCDBG_BITVAL(18) | |
52 | #define PPCDBG_SMP PPCDBG_BITVAL(19) | |
53 | #define PPCDBG_BOOT PPCDBG_BITVAL(20) | |
54 | #define PPCDBG_BUSWALK PPCDBG_BITVAL(21) | |
55 | #define PPCDBG_PROM PPCDBG_BITVAL(22) | |
56 | #define PPCDBG_RTAS PPCDBG_BITVAL(23) | |
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 | /* The default initial value for the debug switch */ | |
63 | #define PPC_DEBUG_DEFAULT 0 | |
64 | /* #define PPC_DEBUG_DEFAULT PPCDBG_ALL */ | |
65 | ||
66 | #define PPCDBG_NUM_FLAGS 64 | |
67 | ||
68 | extern u64 ppc64_debug_switch; | |
69 | ||
70 | #ifdef WANT_PPCDBG_TAB | |
71 | /* A table of debug switch names to allow name lookup in xmon | |
72 | * (and whoever else wants it. | |
73 | */ | |
74 | char *trace_names[PPCDBG_NUM_FLAGS] = { | |
75 | /* Known debug names */ | |
76 | "mminit", "mm", | |
77 | "syscall32", "syscall32_ni", "syscall32x", "syscall32m", | |
78 | "syscall64", "syscall64_ni", "syscall64x", | |
79 | "signal", "signal_xmon", | |
80 | "binfmt32", "binfmt64", "binfmt_xmon", "binfmt_32addr", | |
81 | "alignfixup", "tceinit", "tce", "phb_init", | |
82 | "smp", "boot", "buswalk", "prom", | |
83 | "rtas" | |
84 | }; | |
85 | #else | |
86 | extern char *trace_names[64]; | |
87 | #endif /* WANT_PPCDBG_TAB */ | |
88 | ||
89 | #ifdef CONFIG_PPCDBG | |
90 | /* Macro to conditionally print debug based on debug_switch */ | |
91 | #define PPCDBG(...) udbg_ppcdbg(__VA_ARGS__) | |
92 | ||
93 | /* Macro to conditionally call a debug routine based on debug_switch */ | |
94 | #define PPCDBGCALL(FLAGS,FUNCTION) ifppcdebug(FLAGS) FUNCTION | |
95 | ||
96 | /* Macros to test for debug states */ | |
97 | #define ifppcdebug(FLAGS) if (udbg_ifdebug(FLAGS)) | |
98 | #define ppcdebugset(FLAGS) (udbg_ifdebug(FLAGS)) | |
99 | #define PPCDBG_BINFMT (test_thread_flag(TIF_32BIT) ? PPCDBG_BINFMT32 : PPCDBG_BINFMT64) | |
100 | ||
101 | #else | |
102 | #define PPCDBG(...) do {;} while (0) | |
103 | #define PPCDBGCALL(FLAGS,FUNCTION) do {;} while (0) | |
104 | #define ifppcdebug(...) if (0) | |
105 | #define ppcdebugset(FLAGS) (0) | |
106 | #endif /* CONFIG_PPCDBG */ | |
107 | ||
108 | #endif /*__PPCDEBUG_H */ |