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