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