ppcdebug.h 3.9 KB

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