PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_gen_mips64.h
Go to the documentation of this file.
1/*
2 * Generic MIPS64 PMU specific types and definitions
3 *
4 * Contributed by Philip Mucci <mucci@cs.utk.edu> based on code from
5 * Copyright (c) 2005-2006 Hewlett-Packard Development Company, L.P.
6 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 * of the Software, and to permit persons to whom the Software is furnished to do so,
13 * subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in all
16 * copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26#ifndef __PFMLIB_GEN_MIPS64_H__
27#define __PFMLIB_GEN_MIPS64_H__
28
29#include <endian.h> /* MIPS are bi-endian */
30
31#include <perfmon/pfmlib.h>
32/*
33 * privilege level mask usage for MIPS:
34 *
35 * PFM_PLM0 = KERNEL
36 * PFM_PLM1 = SUPERVISOR
37 * PFM_PLM2 = INTERRUPT
38 * PFM_PLM3 = USER
39 */
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#define PMU_GEN_MIPS64_NUM_COUNTERS 4 /* total numbers of EvtSel/EvtCtr */
46#define PMU_GEN_MIPS64_COUNTER_WIDTH 32 /* hardware counter bit width */
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 * It needs to be adjusted based on endianess
53 */
54#if __BYTE_ORDER == __LITTLE_ENDIAN
55
56typedef union {
57 uint64_t val; /* complete register value */
58 struct {
59 unsigned long sel_exl:1; /* int level */
60 unsigned long sel_os:1; /* system level */
61 unsigned long sel_sup:1; /* supervisor level */
62 unsigned long sel_usr:1; /* user level */
63 unsigned long sel_int:1; /* enable intr */
64 unsigned long sel_event_mask:5; /* event mask */
65 unsigned long sel_res1:22; /* reserved */
66 unsigned long sel_res2:32; /* reserved */
67 } perfsel;
69
70#elif __BYTE_ORDER == __BIG_ENDIAN
71
72typedef union {
73 uint64_t val; /* complete register value */
74 struct {
75 unsigned long sel_res2:32; /* reserved */
76 unsigned long sel_res1:22; /* reserved */
77 unsigned long sel_event_mask:5; /* event mask */
78 unsigned long sel_int:1; /* enable intr */
79 unsigned long sel_usr:1; /* user level */
80 unsigned long sel_sup:1; /* supervisor level */
81 unsigned long sel_os:1; /* system level */
82 unsigned long sel_exl:1; /* int level */
83 } perfsel;
85
86#else
87#error "cannot determine endianess"
88#endif
89
90typedef union {
91 uint64_t val; /* counter value */
92 /* counting perfctr register */
93 struct {
94 unsigned long ctr_count:32; /* 32-bit hardware counter */
95 } perfctr;
97
98typedef struct {
99 unsigned int cnt_mask; /* threshold ([4-255] are reserved) */
100 unsigned int flags; /* counter specific flag */
102
103/*
104 * MIPS64 specific parameters for the library
105 */
106typedef struct {
107 pfmlib_gen_mips64_counter_t pfp_gen_mips64_counters[PMU_GEN_MIPS64_NUM_COUNTERS]; /* extended counter features */
108 uint64_t reserved[4]; /* for future use */
110
111typedef struct {
112 uint64_t reserved[8]; /* for future use */
114
115#ifdef __cplusplus /* extern C */
116}
117#endif
118
119#endif /* __PFMLIB_GEN_MIPS64_H__ */
uint16_t reserved
#define sel_event_mask
Definition: pfmlib_amd64.c:40
#define sel_usr
Definition: pfmlib_amd64.c:42
#define sel_os
Definition: pfmlib_amd64.c:43
#define sel_int
Definition: pfmlib_amd64.c:46
#define sel_sup
#define sel_exl
#define PMU_GEN_MIPS64_NUM_COUNTERS