| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

pfmlib_i386_p6.h
Go to the documentation of this file.
1 /*
2 * Intel Pentium II/Pentium Pro/Pentium III/Pentium M PMU specific types and definitions
3 *
4 * Copyright (c) 2005-2007 Hewlett-Packard Development Company, L.P.
5 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11 * of the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 #ifndef __PFMLIB_I386_P6_H__
25 #define __PFMLIB_I386_P6_H__
26
27 #include <perfmon/pfmlib.h>
28
29 /*
30 * privilege level mask usage for i386-p6:
31 *
32 * PFM_PLM0 = OS (kernel, hypervisor, ..)
33 * PFM_PLM1 = unused (ignored)
34 * PFM_PLM2 = unused (ignored)
35 * PFM_PLM3 = USR (user level)
36 */
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #define PMU_I386_P6_NUM_COUNTERS 2 /* total numbers of EvtSel/EvtCtr */
43 #define PMU_I386_P6_NUM_PERFSEL 2 /* total number of EvtSel defined */
44 #define PMU_I386_P6_NUM_PERFCTR 2 /* total number of EvtCtr defined */
45 #define PMU_I386_P6_COUNTER_WIDTH 32 /* hardware counter bit width */
46
47 /*
48 * This structure provides a detailed way to setup a PMC register.
49 * Once value is loaded, it must be copied (via pmu_reg) to the
50 * perfmon_req_t and passed to the kernel via perfmonctl().
51 */
52 typedef union {
53 unsigned long val; /* complete register value */
54 struct {
55 unsigned long sel_event_mask:8; /* event mask */
56 unsigned long sel_unit_mask:8; /* unit mask */
57 unsigned long sel_usr:1; /* user level */
58 unsigned long sel_os:1; /* system level */
59 unsigned long sel_edge:1; /* edge detec */
60 unsigned long sel_pc:1; /* pin control */
61 unsigned long sel_int:1; /* enable APIC intr */
62 unsigned long sel_res1:1; /* reserved */
63 unsigned long sel_en:1; /* enable */
64 unsigned long sel_inv:1; /* invert counter mask */
65 unsigned long sel_cnt_mask:8; /* counter mask */
66 } perfsel;
67 } pfm_i386_p6_sel_reg_t;
68
69 typedef union {
70 uint64_t val; /* counter value */
71 /* counting perfctr register */
72 struct {
73 unsigned long ctr_count:32; /* 32-bit hardware counter */
74 unsigned long ctr_res1:32; /* reserved */
75 } perfctr;
76 } pfm_i386_p6_ctr_reg_t;
77
78 typedef enum {
79 PFM_I386_P6_CNT_MASK_0,
80 PFM_I386_P6_CNT_MASK_1,
81 PFM_I386_P6_CNT_MASK_2,
82 PFM_I386_P6_CNT_MASK_3
83 } pfm_i386_p6_cnt_mask_t;
84
85 typedef struct {
86 pfm_i386_p6_cnt_mask_t cnt_mask; /* threshold (cnt_mask) */
87 unsigned int flags; /* counter specific flag */
88 } pfmlib_i386_p6_counter_t;
89
90 #define PFM_I386_P6_SEL_INV 0x1 /* inverse */
91 #define PFM_I386_P6_SEL_EDGE 0x2 /* edge detect */
92
93 /*
94 * P6-specific parameters for the library
95 */
96 typedef struct {
97 pfmlib_i386_p6_counter_t pfp_i386_p6_counters[PMU_I386_P6_NUM_COUNTERS]; /* extended counter features */
98 uint64_t reserved[4]; /* for future use */
99 } pfmlib_i386_p6_input_param_t;
100
101 typedef struct {
102 uint64_t reserved[8]; /* for future use */
103 } pfmlib_i386_p6_output_param_t;
104
105 #ifdef __cplusplus /* extern C */
106 }
107 #endif
108
109 #endif /* __PFMLIB_I386_P6_H__ */
PFM_I386_P6_CNT_MASK_0
Definition: pfmlib_i386_p6.h:79
pfm_i386_p6_ctr_reg_t::val
uint64_t val
Definition: pfmlib_i386_p6.h:70
PFM_I386_P6_CNT_MASK_2
Definition: pfmlib_i386_p6.h:81
pfm_i386_p6_ctr_reg_t
Definition: pfmlib_i386_p6.h:69
pfm_i386_p6_sel_reg_t::val
unsigned long val
Definition: pfmlib_i386_p6.h:53
pfm_i386_p6_sel_reg_t
Definition: pfmlib_i386_p6.h:52
pfmlib_i386_p6_counter_t::flags
unsigned int flags
Definition: pfmlib_i386_p6.h:87
uint64_t
unsigned long long uint64_t
Definition: instrset.h:144
PFM_I386_P6_CNT_MASK_1
Definition: pfmlib_i386_p6.h:80
pfmlib_i386_p6_output_param_t
Definition: pfmlib_i386_p6.h:101
pfmlib_i386_p6_input_param_t
Definition: pfmlib_i386_p6.h:96
pfmlib_i386_p6_counter_t::cnt_mask
pfm_i386_p6_cnt_mask_t cnt_mask
Definition: pfmlib_i386_p6.h:86
PFM_I386_P6_CNT_MASK_3
Definition: pfmlib_i386_p6.h:82
pfmlib.h
pfm_i386_p6_cnt_mask_t
pfm_i386_p6_cnt_mask_t
Definition: pfmlib_i386_p6.h:78
PMU_I386_P6_NUM_COUNTERS
#define PMU_I386_P6_NUM_COUNTERS
Definition: pfmlib_i386_p6.h:42
pfmlib_i386_p6_counter_t
Definition: pfmlib_i386_p6.h:85