op_x86_model.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/intel_arch_perfmon.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. };
  23. struct pt_regs;
  24. struct oprofile_operations;
  25. /* The model vtable abstracts the differences between
  26. * various x86 CPU models' perfctr support.
  27. */
  28. struct op_x86_model_spec {
  29. unsigned int num_counters;
  30. unsigned int num_controls;
  31. u64 reserved;
  32. u16 event_mask;
  33. int (*init)(struct oprofile_operations *ops);
  34. void (*exit)(void);
  35. void (*fill_in_addresses)(struct op_msrs * const msrs);
  36. void (*setup_ctrs)(struct op_x86_model_spec const *model,
  37. struct op_msrs const * const msrs);
  38. int (*check_ctrs)(struct pt_regs * const regs,
  39. struct op_msrs const * const msrs);
  40. void (*start)(struct op_msrs const * const msrs);
  41. void (*stop)(struct op_msrs const * const msrs);
  42. void (*shutdown)(struct op_msrs const * const msrs);
  43. };
  44. struct op_counter_config;
  45. extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
  46. struct op_counter_config *counter_config);
  47. extern struct op_x86_model_spec const op_ppro_spec;
  48. extern struct op_x86_model_spec const op_p4_spec;
  49. extern struct op_x86_model_spec const op_p4_ht2_spec;
  50. extern struct op_x86_model_spec const op_amd_spec;
  51. extern struct op_x86_model_spec op_arch_perfmon_spec;
  52. #endif /* OP_X86_MODEL_H */