xref: /illumos-gate/usr/src/uts/sun4v/io/n2piupc/n2piupc.h (revision fd2e3606)
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_H
28 #define	_N2PIUPC_H
29 
30 /*
31  * Definitions which deal with things other than registers.
32  */
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #include <sys/sunddi.h>
39 
40 #define	SUCCESS	0
41 #define	FAILURE	-1
42 
43 #define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
44 
45 /* Used for data structure retrieval during kstat update. */
46 typedef struct n2piu_ksinfo {
47 	kstat_t		*cntr_ksp;
48 	struct n2piupc	*n2piupc_p;
49 	n2piu_grp_t	*grp_p;
50 } n2piu_ksinfo_t;
51 
52 /* State structure. */
53 typedef struct n2piupc {
54 	dev_info_t	*n2piupc_dip;
55 	cntr_handle_t	n2piupc_handle;
56 	void *		n2piupc_biterr_p;
57 	n2piu_ksinfo_t	*n2piupc_ksinfo_p[NUM_GRPS];
58 } n2piupc_t;
59 
60 /* Debugging facility. */
61 #ifdef DEBUG
62 extern int n2piupc_debug;
63 #define	N2PIUPC_DBG1 if (n2piupc_debug >= 1) printf
64 #define	N2PIUPC_DBG2 if (n2piupc_debug >= 2) printf
65 #else
66 #define	N2PIUPC_DBG1(...)
67 #define	N2PIUPC_DBG2(...)
68 #endif	/* DEBUG */
69 
70 
71 /* Function definitions exported among different modules. */
72 extern int n2piupc_kstat_init();
73 extern void n2piupc_kstat_fini();
74 extern int n2piupc_kstat_attach(n2piupc_t *n2piupc_p);
75 extern void n2piupc_kstat_detach(n2piupc_t *n2piupc_p);
76 
77 #ifdef	__cplusplus
78 }
79 #endif
80 
81 #endif	/* _N2PIUPC_H */
82