The Gaudi Framework  v30r3 (a5ef0a68)
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;
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;
77 
78 typedef enum {
84 
85 typedef struct {
86  pfm_i386_p6_cnt_mask_t cnt_mask; /* threshold (cnt_mask) */
87  unsigned int flags; /* counter specific flag */
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 */
100 
101 typedef struct {
102  uint64_t reserved[8]; /* for future use */
104 
105 #ifdef __cplusplus /* extern C */
106 }
107 #endif
108 
109 #endif /* __PFMLIB_I386_P6_H__ */
unsigned long long uint64_t
Definition: instrset.h:143
pfm_i386_p6_cnt_mask_t cnt_mask
pfm_i386_p6_cnt_mask_t
#define PMU_I386_P6_NUM_COUNTERS