op_x86_model.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * @file op_x86_model.h
  3. * interface to x86 model-specific MSR operations
  4. *
  5. * @remark Copyright 2002 OProfile authors
  6. * @remark Read the file COPYING
  7. *
  8. * @author Graydon Hoare
  9. * @author Robert Richter <robert.richter@amd.com>
  10. */
  11. #ifndef OP_X86_MODEL_H
  12. #define OP_X86_MODEL_H
  13. #include <asm/types.h>
  14. #include <asm/perf_counter.h>
  15. struct op_msr {
  16. unsigned long addr;
  17. u64 saved;
  18. };
  19. struct op_msrs {
  20. struct op_msr *counters;
  21. struct op_msr *controls;
  22. struct op_msr *multiplex;
  23. };
  24. struct pt_regs;
  25. struct oprofile_operations;
  26. /* The model vtable abstracts the differences between
  27. * various x86 CPU models' perfctr support.
  28. */
  29. struct op_x86_model_spec {
  30. unsigned int num_counters;
  31. unsigned int num_controls;
  32. unsigned int num_virt_counters;
  33. unsigned int num_virt_controls;
  34. u64 reserved;
  35. u16 event_mask;
  36. int (*init)(struct oprofile_operations *ops);
  37. void (*exit)(void);
  38. void (*fill_in_addresses)(struct op_msrs * const msrs);
  39. void (*setup_ctrs)(struct op_x86_model_spec const *model,
  40. struct op_msrs const * const msrs);
  41. int (*check_ctrs)(struct pt_regs * const regs,
  42. struct op_msrs const * const msrs);
  43. void (*start)(struct op_msrs const * const msrs);
  44. void (*stop)(struct op_msrs const * const msrs);
  45. void (*shutdown)(struct op_msrs const * const msrs);
  46. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  47. void (*switch_ctrl)(struct op_x86_model_spec const *model,
  48. struct op_msrs const * const msrs);
  49. #endif
  50. };
  51. struct op_counter_config;
  52. extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
  53. struct op_counter_config *counter_config);
  54. extern int op_x86_phys_to_virt(int phys);
  55. extern struct op_x86_model_spec const op_ppro_spec;
  56. extern struct op_x86_model_spec const op_p4_spec;
  57. extern struct op_x86_model_spec const op_p4_ht2_spec;
  58. extern struct op_x86_model_spec const op_amd_spec;
  59. extern struct op_x86_model_spec op_arch_perfmon_spec;
  60. #endif /* OP_X86_MODEL_H */