1*25cf1a30Sjl /*
2*25cf1a30Sjl  * CDDL HEADER START
3*25cf1a30Sjl  *
4*25cf1a30Sjl  * The contents of this file are subject to the terms of the
5*25cf1a30Sjl  * Common Development and Distribution License (the "License").
6*25cf1a30Sjl  * You may not use this file except in compliance with the License.
7*25cf1a30Sjl  *
8*25cf1a30Sjl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*25cf1a30Sjl  * or http://www.opensolaris.org/os/licensing.
10*25cf1a30Sjl  * See the License for the specific language governing permissions
11*25cf1a30Sjl  * and limitations under the License.
12*25cf1a30Sjl  *
13*25cf1a30Sjl  * When distributing Covered Code, include this CDDL HEADER in each
14*25cf1a30Sjl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*25cf1a30Sjl  * If applicable, add the following below this CDDL HEADER, with the
16*25cf1a30Sjl  * fields enclosed by brackets "[]" replaced with your own identifying
17*25cf1a30Sjl  * information: Portions Copyright [yyyy] [name of copyright owner]
18*25cf1a30Sjl  *
19*25cf1a30Sjl  * CDDL HEADER END
20*25cf1a30Sjl  */
21*25cf1a30Sjl /*
22*25cf1a30Sjl  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*25cf1a30Sjl  * Use is subject to license terms.
24*25cf1a30Sjl  */
25*25cf1a30Sjl 
26*25cf1a30Sjl #ifndef	_SYS_PCMU_COUNTERS_H
27*25cf1a30Sjl #define	_SYS_PCMU_COUNTERS_H
28*25cf1a30Sjl 
29*25cf1a30Sjl #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*25cf1a30Sjl 
31*25cf1a30Sjl #ifdef	__cplusplus
32*25cf1a30Sjl extern "C" {
33*25cf1a30Sjl #endif
34*25cf1a30Sjl 
35*25cf1a30Sjl #define	NUM_OF_PICS	2
36*25cf1a30Sjl 
37*25cf1a30Sjl /*
38*25cf1a30Sjl  * used to build array of event-names and pcr-mask values
39*25cf1a30Sjl  */
40*25cf1a30Sjl typedef struct pcmu_kev_mask {
41*25cf1a30Sjl 	char *event_name;			/* Event name */
42*25cf1a30Sjl 	uint64_t pcr_mask;			/* PCR mask */
43*25cf1a30Sjl } pcmu_kev_mask_t;
44*25cf1a30Sjl 
45*25cf1a30Sjl typedef struct pcmu_ksinfo {
46*25cf1a30Sjl 	uint8_t	pic_no_evs;			/* number of events */
47*25cf1a30Sjl 	uint8_t	pic_shift[NUM_OF_PICS];		/* PIC shift */
48*25cf1a30Sjl 	kstat_t	*pic_name_ksp[NUM_OF_PICS];	/* kstat names */
49*25cf1a30Sjl } pcmu_ksinfo_t;
50*25cf1a30Sjl 
51*25cf1a30Sjl typedef struct pcmu_cntr_addr {
52*25cf1a30Sjl 	uint64_t	*pcr_addr;
53*25cf1a30Sjl 	uint64_t	*pic_addr;
54*25cf1a30Sjl } pcmu_cntr_addr_t;
55*25cf1a30Sjl 
56*25cf1a30Sjl typedef struct pcmu_cntr_pa {
57*25cf1a30Sjl 	uint64_t	pcr_pa;
58*25cf1a30Sjl 	uint64_t	pic_pa;
59*25cf1a30Sjl } pcmu_cntr_pa_t;
60*25cf1a30Sjl 
61*25cf1a30Sjl /*
62*25cf1a30Sjl  * Prototypes.
63*25cf1a30Sjl  */
64*25cf1a30Sjl extern void pcmu_create_name_kstat(char *, pcmu_ksinfo_t *, pcmu_kev_mask_t *);
65*25cf1a30Sjl extern void pcmu_delete_name_kstat(pcmu_ksinfo_t *);
66*25cf1a30Sjl extern kstat_t *pcmu_create_cntr_kstat(pcmu_t *, char *, int,
67*25cf1a30Sjl 	int (*update)(kstat_t *, int), void *);
68*25cf1a30Sjl extern int pcmu_cntr_kstat_update(kstat_t *, int);
69*25cf1a30Sjl extern int pcmu_cntr_kstat_pa_update(kstat_t *, int);
70*25cf1a30Sjl extern void pcmu_kstat_create(pcmu_t *);
71*25cf1a30Sjl extern void pcmu_kstat_destroy(pcmu_t *);
72*25cf1a30Sjl extern void pcmu_rem_upstream_kstat(pcmu_t *);
73*25cf1a30Sjl 
74*25cf1a30Sjl #ifdef	__cplusplus
75*25cf1a30Sjl }
76*25cf1a30Sjl #endif
77*25cf1a30Sjl 
78*25cf1a30Sjl #endif	/* _SYS_PCMU_COUNTERS_H */
79