wrperfmon.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Definitions for use with the Alpha wrperfmon PAL call.
  3. */
  4. #ifndef __ALPHA_WRPERFMON_H
  5. #define __ALPHA_WRPERFMON_H
  6. /* Following commands are implemented on all CPUs */
  7. #define PERFMON_CMD_DISABLE 0
  8. #define PERFMON_CMD_ENABLE 1
  9. #define PERFMON_CMD_DESIRED_EVENTS 2
  10. #define PERFMON_CMD_LOGGING_OPTIONS 3
  11. /* Following commands on EV5/EV56/PCA56 only */
  12. #define PERFMON_CMD_INT_FREQ 4
  13. #define PERFMON_CMD_ENABLE_CLEAR 7
  14. /* Following commands are on EV5 and better CPUs */
  15. #define PERFMON_CMD_READ 5
  16. #define PERFMON_CMD_WRITE 6
  17. /* Following command are on EV6 and better CPUs */
  18. #define PERFMON_CMD_ENABLE_WRITE 7
  19. /* Following command are on EV67 and better CPUs */
  20. #define PERFMON_CMD_I_STAT 8
  21. #define PERFMON_CMD_PMPC 9
  22. /* EV5/EV56/PCA56 Counters */
  23. #define EV5_PCTR_0 (1UL<<0)
  24. #define EV5_PCTR_1 (1UL<<1)
  25. #define EV5_PCTR_2 (1UL<<2)
  26. #define EV5_PCTR_0_COUNT_SHIFT 48
  27. #define EV5_PCTR_1_COUNT_SHIFT 32
  28. #define EV5_PCTR_2_COUNT_SHIFT 16
  29. #define EV5_PCTR_0_COUNT_MASK 0xffffUL
  30. #define EV5_PCTR_1_COUNT_MASK 0xffffUL
  31. #define EV5_PCTR_2_COUNT_MASK 0x3fffUL
  32. /* EV6 Counters */
  33. #define EV6_PCTR_0 (1UL<<0)
  34. #define EV6_PCTR_1 (1UL<<1)
  35. #define EV6_PCTR_0_COUNT_SHIFT 28
  36. #define EV6_PCTR_1_COUNT_SHIFT 6
  37. #define EV6_PCTR_0_COUNT_MASK 0xfffffUL
  38. #define EV6_PCTR_1_COUNT_MASK 0xfffffUL
  39. /* EV67 (and subsequent) counters */
  40. #define EV67_PCTR_0 (1UL<<0)
  41. #define EV67_PCTR_1 (1UL<<1)
  42. #define EV67_PCTR_0_COUNT_SHIFT 28
  43. #define EV67_PCTR_1_COUNT_SHIFT 6
  44. #define EV67_PCTR_0_COUNT_MASK 0xfffffUL
  45. #define EV67_PCTR_1_COUNT_MASK 0xfffffUL
  46. /*
  47. * The Alpha Architecure Handbook, vers. 4 (1998) appears to have a misprint
  48. * in Table E-23 regarding the bits that set the event PCTR 1 counts.
  49. * Hopefully what we have here is correct.
  50. */
  51. #define EV6_PCTR_0_EVENT_MASK 0x10UL
  52. #define EV6_PCTR_1_EVENT_MASK 0x0fUL
  53. /* EV6 Events */
  54. #define EV6_PCTR_0_CYCLES (0UL << 4)
  55. #define EV6_PCTR_0_INSTRUCTIONS (1UL << 4)
  56. #define EV6_PCTR_1_CYCLES 0
  57. #define EV6_PCTR_1_BRANCHES 1
  58. #define EV6_PCTR_1_BRANCH_MISPREDICTS 2
  59. #define EV6_PCTR_1_DTB_SINGLE_MISSES 3
  60. #define EV6_PCTR_1_DTB_DOUBLE_MISSES 4
  61. #define EV6_PCTR_1_ITB_MISSES 5
  62. #define EV6_PCTR_1_UNALIGNED_TRAPS 6
  63. #define EV6_PCTR_1_REPLY_TRAPS 7
  64. /* From the Alpha Architecture Reference Manual, 4th edn., 2002 */
  65. #define EV67_PCTR_MODE_MASK 0x10UL
  66. #define EV67_PCTR_EVENT_MASK 0x0CUL
  67. #define EV67_PCTR_MODE_PROFILEME (1UL<<4)
  68. #define EV67_PCTR_MODE_AGGREGATE (0UL<<4)
  69. #define EV67_PCTR_INSTR_CYCLES (0UL<<2)
  70. #define EV67_PCTR_CYCLES_UNDEF (1UL<<2)
  71. #define EV67_PCTR_INSTR_BCACHEMISS (2UL<<2)
  72. #define EV67_PCTR_CYCLES_MBOX (3UL<<2)
  73. #endif