18cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/**
28cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * @file op_x86_model.h
38cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * interface to x86 model-specific MSR operations
48cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *
58cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * @remark Copyright 2002 OProfile authors
68cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * @remark Read the file COPYING
78cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *
88cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * @author Graydon Hoare
98cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
108cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
118cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#ifndef OP_X86_MODEL_H
128cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define OP_X86_MODEL_H
138cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
148cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#include "oprofile.h"
158cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
168cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddstruct op_saved_msr {
178cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	uint high;
188cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	uint low;
198cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd};
208cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
218cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddstruct op_msr_group {
228cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	uint * addrs;
238cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	struct op_saved_msr * saved;
248cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd};
258cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
268cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddstruct op_msrs {
278cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	struct op_msr_group counters;
288cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	struct op_msr_group controls;
298cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd};
308cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
318cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddstruct pt_regs;
328cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
338cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddstruct op_x86_model_spec {
348cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	uint const num_counters;
358cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	uint const num_controls;
368cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	void (*fill_in_addresses)(struct op_msrs * const msrs);
378cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	void (*setup_ctrs)(struct op_msrs const * const msrs);
388cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	void (*check_ctrs)(uint const cpu,
398cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd		struct op_msrs const * const msrs,
408cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd		struct pt_regs * const regs);
418cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	void (*start)(struct op_msrs const * const msrs);
428cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	void (*stop)(struct op_msrs const * const msrs);
438cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd};
448cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
458cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddextern struct op_x86_model_spec const op_ppro_spec;
468cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddextern struct op_x86_model_spec const op_athlon_spec;
478cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddextern struct op_x86_model_spec const op_p4_spec;
488cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#ifdef HT_SUPPORT
498cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddextern struct op_x86_model_spec const op_p4_ht2_spec;
508cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#endif
518cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
528cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#endif /* OP_X86_MODEL_H */
53