PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_amd64_priv.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2004-2006 Hewlett-Packard Development Company, L.P.
3 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
17 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * This file is part of libpfm, a performance monitoring support library for
23 * applications on Linux.
24 */
25#ifndef __PFMLIB_AMD64_PRIV_H__
26#define __PFMLIB_AMD64_PRIV_H__
27
28/*
29 * PERFSEL/PERFCTR include IBS registers:
30 *
31 * PMCs PMDs
32 *
33 * PERFCTRS 6 6
34 * IBS FETCH 1 3
35 * IBS OP 1 7
36 *
37 * total 8 16
38 */
39#define PMU_AMD64_NUM_PERFSEL 8 /* number of PMCs defined */
40#define PMU_AMD64_NUM_PERFCTR 16 /* number of PMDs defined */
41#define PMU_AMD64_NUM_COUNTERS 4 /* number of EvtSel/EvtCtr */
42#define PMU_AMD64_NUM_COUNTERS_F15H 6 /* number of EvtSel/EvtCtr */
43#define PMU_AMD64_COUNTER_WIDTH 48 /* hw counter bit width */
44#define PMU_AMD64_CNT_MASK_MAX 4 /* max cnt_mask value */
45#define PMU_AMD64_IBSFETCHCTL_PMC 6 /* IBS: fetch PMC base */
46#define PMU_AMD64_IBSFETCHCTL_PMD 6 /* IBS: fetch PMD base */
47#define PMU_AMD64_IBSOPCTL_PMC 7 /* IBS: op PMC base */
48#define PMU_AMD64_IBSOPCTL_PMD 9 /* IBS: op PMD base */
49
50#define PFMLIB_AMD64_MAX_UMASK 13
51
52typedef struct {
53 char *pme_uname; /* unit mask name */
54 char *pme_udesc; /* event/umask description */
55 unsigned int pme_ucode; /* unit mask code */
56 unsigned int pme_uflags; /* unit mask flags */
58
59typedef struct {
60 char *pme_name; /* event name */
61 char *pme_desc; /* event description */
62 pme_amd64_umask_t pme_umasks[PFMLIB_AMD64_MAX_UMASK]; /* umask desc */
63 unsigned int pme_code; /* event code */
64 unsigned int pme_numasks; /* number of umasks */
65 unsigned int pme_flags; /* flags */
67
68typedef enum {
83
84static const char *amd64_rev_strs[]= {
85 "?", "?",
86 /* K8 */
87 "B", "C", "D", "E", "F", "G",
88 /* Family 10h */
89 "B", "C", "D", "E",
90 /* Family 15h */
91 "B",
92};
93
94static const char *amd64_cpu_strs[] = {
95 "AMD64 (unknown model)",
96 "AMD64 (K7)",
97 "AMD64 (K8 RevB)",
98 "AMD64 (K8 RevC)",
99 "AMD64 (K8 RevD)",
100 "AMD64 (K8 RevE)",
101 "AMD64 (K8 RevF)",
102 "AMD64 (K8 RevG)",
103 "AMD64 (Family 10h RevB, Barcelona)",
104 "AMD64 (Family 10h RevC, Shanghai)",
105 "AMD64 (Family 10h RevD, Istanbul)",
106 "AMD64 (Family 10h RevE)",
107 "AMD64 (Family 15h RevB)",
108};
109
110/*
111 * pme_flags values
112 */
113#define PFMLIB_AMD64_UMASK_COMBO 0x1 /* unit mask can be combined */
114#define PFMLIB_AMD64_FROM_REV(rev) ((rev)<<8)
115#define PFMLIB_AMD64_TILL_REV(rev) ((rev)<<16)
116#define PFMLIB_AMD64_NOT_SUPP 0x1ff00
117#define PFMLIB_AMD64_TILL_K8_REV_C PFMLIB_AMD64_TILL_REV(AMD64_K8_REV_C)
118#define PFMLIB_AMD64_K8_REV_D PFMLIB_AMD64_FROM_REV(AMD64_K8_REV_D)
119#define PFMLIB_AMD64_K8_REV_E PFMLIB_AMD64_FROM_REV(AMD64_K8_REV_E)
120#define PFMLIB_AMD64_TILL_K8_REV_E PFMLIB_AMD64_TILL_REV(AMD64_K8_REV_E)
121#define PFMLIB_AMD64_K8_REV_F PFMLIB_AMD64_FROM_REV(AMD64_K8_REV_F)
122#define PFMLIB_AMD64_TILL_FAM10H_REV_B PFMLIB_AMD64_TILL_REV(AMD64_FAM10H_REV_B)
123#define PFMLIB_AMD64_FAM10H_REV_C PFMLIB_AMD64_FROM_REV(AMD64_FAM10H_REV_C)
124#define PFMLIB_AMD64_TILL_FAM10H_REV_C PFMLIB_AMD64_TILL_REV(AMD64_FAM10H_REV_C)
125#define PFMLIB_AMD64_FAM10H_REV_D PFMLIB_AMD64_FROM_REV(AMD64_FAM10H_REV_D)
126
127static inline int from_revision(unsigned int flags)
128{
129 return ((flags) >> 8) & 0xff;
130}
131
132static inline int till_revision(unsigned int flags)
133{
134 int till = (((flags)>>16) & 0xff);
135 if (!till)
136 return 0xff;
137 return till;
138}
139
140#endif /* __PFMLIB_AMD64_PRIV_H__ */
static int from_revision(unsigned int flags)
static const char * amd64_cpu_strs[]
#define PFMLIB_AMD64_MAX_UMASK
static const char * amd64_rev_strs[]
amd64_rev_t
@ AMD64_K8_REV_E
@ AMD64_FAM10H_REV_D
@ AMD64_FAM10H_REV_B
@ AMD64_FAM10H_REV_C
@ AMD64_K8_REV_F
@ AMD64_K8_REV_C
@ AMD64_CPU_UN
@ AMD64_K7
@ AMD64_FAM10H_REV_E
@ AMD64_FAM15H_REV_B
@ AMD64_K8_REV_D
@ AMD64_K8_REV_G
@ AMD64_K8_REV_B
static int till_revision(unsigned int flags)
unsigned int pme_code
char * pme_name
char * pme_desc
unsigned int pme_flags
unsigned int pme_numasks
unsigned int pme_ucode
unsigned int pme_uflags