xref: /titanic_51/usr/src/uts/sun4v/io/n2piupc/n2piupc_acc.h (revision ea1a228c80597366447774aa1988868492330eb5)
1*ea1a228cSschwartz /*
2*ea1a228cSschwartz  * CDDL HEADER START
3*ea1a228cSschwartz  *
4*ea1a228cSschwartz  * The contents of this file are subject to the terms of the
5*ea1a228cSschwartz  * Common Development and Distribution License (the "License").
6*ea1a228cSschwartz  * You may not use this file except in compliance with the License.
7*ea1a228cSschwartz  *
8*ea1a228cSschwartz  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ea1a228cSschwartz  * or http://www.opensolaris.org/os/licensing.
10*ea1a228cSschwartz  * See the License for the specific language governing permissions
11*ea1a228cSschwartz  * and limitations under the License.
12*ea1a228cSschwartz  *
13*ea1a228cSschwartz  * When distributing Covered Code, include this CDDL HEADER in each
14*ea1a228cSschwartz  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ea1a228cSschwartz  * If applicable, add the following below this CDDL HEADER, with the
16*ea1a228cSschwartz  * fields enclosed by brackets "[]" replaced with your own identifying
17*ea1a228cSschwartz  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ea1a228cSschwartz  *
19*ea1a228cSschwartz  * CDDL HEADER END
20*ea1a228cSschwartz  */
21*ea1a228cSschwartz 
22*ea1a228cSschwartz /*
23*ea1a228cSschwartz  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*ea1a228cSschwartz  * Use is subject to license terms.
25*ea1a228cSschwartz  */
26*ea1a228cSschwartz 
27*ea1a228cSschwartz #ifndef	_N2PIUPC_ACC_H
28*ea1a228cSschwartz #define	_N2PIUPC_ACC_H
29*ea1a228cSschwartz 
30*ea1a228cSschwartz #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*ea1a228cSschwartz 
32*ea1a228cSschwartz /*
33*ea1a228cSschwartz  * Hypervisor and function definitions needed to access the device.
34*ea1a228cSschwartz  */
35*ea1a228cSschwartz 
36*ea1a228cSschwartz #ifdef	__cplusplus
37*ea1a228cSschwartz extern "C" {
38*ea1a228cSschwartz #endif
39*ea1a228cSschwartz 
40*ea1a228cSschwartz 
41*ea1a228cSschwartz #ifndef _ASM
42*ea1a228cSschwartz 
43*ea1a228cSschwartz #include <sys/types.h>
44*ea1a228cSschwartz #include <sys/hypervisor_api.h>
45*ea1a228cSschwartz 
46*ea1a228cSschwartz typedef uint64_t cntr_handle_t;
47*ea1a228cSschwartz 
48*ea1a228cSschwartz extern int n2piupc_get_perfreg(cntr_handle_t handle, int regid, uint64_t *data);
49*ea1a228cSschwartz extern int n2piupc_set_perfreg(cntr_handle_t handle, int regid, uint64_t data);
50*ea1a228cSschwartz 
51*ea1a228cSschwartz #endif /* _ASM */
52*ea1a228cSschwartz 
53*ea1a228cSschwartz 
54*ea1a228cSschwartz /*
55*ea1a228cSschwartz  * N2 PIU API hypervisor group number.
56*ea1a228cSschwartz  */
57*ea1a228cSschwartz #define	N2PIU_PERF_COUNTER_GROUP_ID	0x0203
58*ea1a228cSschwartz 
59*ea1a228cSschwartz /*
60*ea1a228cSschwartz  * N2 PIU performance counter fasttraps.
61*ea1a228cSschwartz  */
62*ea1a228cSschwartz #define	N2PIU_GET_PERFREG	0x140
63*ea1a228cSschwartz #define	N2PIU_SET_PERFREG	0x141
64*ea1a228cSschwartz 
65*ea1a228cSschwartz /*
66*ea1a228cSschwartz  * Performance counter register definitions.
67*ea1a228cSschwartz  */
68*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_IMU_SEL	0
69*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_IMU_CNT0	1
70*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_IMU_CNT1	2
71*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_MMU_SEL	3
72*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_MMU_CNT0	4
73*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_MMU_CNT1	5
74*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_PEU_SEL	6
75*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_PEU_CNT0	7
76*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_PEU_CNT1	8
77*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_PEU_CNT2	9
78*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_BITERR_CNT1	10
79*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_BITERR_CNT2	11
80*ea1a228cSschwartz 
81*ea1a228cSschwartz #define	HVIO_N2PIU_PERFREG_NUM_REGS	(HVIO_N2PIU_PERFREG_BITERR_CNT2 + 1)
82*ea1a228cSschwartz 
83*ea1a228cSschwartz #ifdef	__cplusplus
84*ea1a228cSschwartz }
85*ea1a228cSschwartz #endif
86*ea1a228cSschwartz 
87*ea1a228cSschwartz #endif	/* _N2PIUPC_ACC_H */
88