xref: /titanic_41/usr/src/uts/sun4u/sys/pci/pci_counters.h (revision dd49f125507979bb2ab505a8daf2a46d1be27051)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_PCI_COUNTERS_H
28 #define	_SYS_PCI_COUNTERS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	NUM_OF_PICS	2
37 
38 /*
39  * used to build array of event-names and pcr-mask values
40  */
41 typedef struct pci_kev_mask {
42 	char *event_name;
43 	uint64_t pcr_mask;
44 } pci_kev_mask_t;
45 
46 typedef struct pci_ksinfo {
47 	uint8_t	pic_no_evs;	/* number of events */
48 	uint8_t	pic_shift[NUM_OF_PICS];
49 	kstat_t	*pic_name_ksp[NUM_OF_PICS];
50 } pci_ksinfo_t;
51 
52 typedef struct pci_cntr_addr {
53 	uint64_t	*pcr_addr;
54 	uint64_t	*pic_addr;
55 } pci_cntr_addr_t;
56 
57 typedef struct pci_cntr_pa {
58 	uint64_t	pcr_pa;
59 	uint64_t	pic_pa;
60 } pci_cntr_pa_t;
61 
62 extern void pci_create_name_kstat(char *, pci_ksinfo_t *, pci_kev_mask_t *);
63 extern void pci_delete_name_kstat(pci_ksinfo_t *);
64 
65 extern kstat_t *pci_create_cntr_kstat(pci_t *, char *, int,
66 	int (*update)(kstat_t *, int), void *);
67 
68 extern int pci_cntr_kstat_update(kstat_t *, int);
69 extern int pci_cntr_kstat_pa_update(kstat_t *, int);
70 
71 extern void pci_kstat_create(pci_t *);
72 extern void pci_kstat_destroy(pci_t *);
73 extern void pci_rem_upstream_kstat(pci_t *);
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _SYS_PCI_COUNTERS_H */
80