xref: /illumos-gate/usr/src/uts/sun4u/opl/sys/pcicmu/pcmu_counters.h (revision bac580724643c7779231d57696e30d2b4056d372)
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  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_PCMU_COUNTERS_H
27 #define	_SYS_PCMU_COUNTERS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	NUM_OF_PICS	2
36 
37 /*
38  * used to build array of event-names and pcr-mask values
39  */
40 typedef struct pcmu_kev_mask {
41 	char *event_name;			/* Event name */
42 	uint64_t pcr_mask;			/* PCR mask */
43 } pcmu_kev_mask_t;
44 
45 typedef struct pcmu_ksinfo {
46 	uint8_t	pic_no_evs;			/* number of events */
47 	uint8_t	pic_shift[NUM_OF_PICS];		/* PIC shift */
48 	kstat_t	*pic_name_ksp[NUM_OF_PICS];	/* kstat names */
49 } pcmu_ksinfo_t;
50 
51 typedef struct pcmu_cntr_addr {
52 	uint64_t	*pcr_addr;
53 	uint64_t	*pic_addr;
54 } pcmu_cntr_addr_t;
55 
56 typedef struct pcmu_cntr_pa {
57 	uint64_t	pcr_pa;
58 	uint64_t	pic_pa;
59 } pcmu_cntr_pa_t;
60 
61 /*
62  * Prototypes.
63  */
64 extern void pcmu_create_name_kstat(char *, pcmu_ksinfo_t *, pcmu_kev_mask_t *);
65 extern void pcmu_delete_name_kstat(pcmu_ksinfo_t *);
66 extern kstat_t *pcmu_create_cntr_kstat(pcmu_t *, char *, int,
67 	int (*update)(kstat_t *, int), void *);
68 extern int pcmu_cntr_kstat_update(kstat_t *, int);
69 extern int pcmu_cntr_kstat_pa_update(kstat_t *, int);
70 extern void pcmu_kstat_create(pcmu_t *);
71 extern void pcmu_kstat_destroy(pcmu_t *);
72 extern void pcmu_rem_upstream_kstat(pcmu_t *);
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* _SYS_PCMU_COUNTERS_H */
79