xref: /onnv-gate/usr/src/uts/sun4v/io/n2piupc/n2piupc.h (revision 3299:8139b10ae6b7)
1*3299Sschwartz /*
2*3299Sschwartz  * CDDL HEADER START
3*3299Sschwartz  *
4*3299Sschwartz  * The contents of this file are subject to the terms of the
5*3299Sschwartz  * Common Development and Distribution License (the "License").
6*3299Sschwartz  * You may not use this file except in compliance with the License.
7*3299Sschwartz  *
8*3299Sschwartz  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3299Sschwartz  * or http://www.opensolaris.org/os/licensing.
10*3299Sschwartz  * See the License for the specific language governing permissions
11*3299Sschwartz  * and limitations under the License.
12*3299Sschwartz  *
13*3299Sschwartz  * When distributing Covered Code, include this CDDL HEADER in each
14*3299Sschwartz  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3299Sschwartz  * If applicable, add the following below this CDDL HEADER, with the
16*3299Sschwartz  * fields enclosed by brackets "[]" replaced with your own identifying
17*3299Sschwartz  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3299Sschwartz  *
19*3299Sschwartz  * CDDL HEADER END
20*3299Sschwartz  */
21*3299Sschwartz 
22*3299Sschwartz /*
23*3299Sschwartz  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*3299Sschwartz  * Use is subject to license terms.
25*3299Sschwartz  */
26*3299Sschwartz 
27*3299Sschwartz #ifndef	_N2PIUPC_H
28*3299Sschwartz #define	_N2PIUPC_H
29*3299Sschwartz 
30*3299Sschwartz /*
31*3299Sschwartz  * Definitions which deal with things other than registers.
32*3299Sschwartz  */
33*3299Sschwartz 
34*3299Sschwartz #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*3299Sschwartz 
36*3299Sschwartz #ifdef	__cplusplus
37*3299Sschwartz extern "C" {
38*3299Sschwartz #endif
39*3299Sschwartz 
40*3299Sschwartz #include <sys/sunddi.h>
41*3299Sschwartz 
42*3299Sschwartz #define	SUCCESS	0
43*3299Sschwartz #define	FAILURE	-1
44*3299Sschwartz 
45*3299Sschwartz #define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
46*3299Sschwartz 
47*3299Sschwartz /* Used for data structure retrieval during kstat update. */
48*3299Sschwartz typedef struct n2piu_ksinfo {
49*3299Sschwartz 	kstat_t		*cntr_ksp;
50*3299Sschwartz 	struct n2piupc	*n2piupc_p;
51*3299Sschwartz 	n2piu_grp_t	*grp_p;
52*3299Sschwartz } n2piu_ksinfo_t;
53*3299Sschwartz 
54*3299Sschwartz /* State structure. */
55*3299Sschwartz typedef struct n2piupc {
56*3299Sschwartz 	dev_info_t	*n2piupc_dip;
57*3299Sschwartz 	cntr_handle_t	n2piupc_handle;
58*3299Sschwartz 	void *		n2piupc_biterr_p;
59*3299Sschwartz 	n2piu_ksinfo_t	*n2piupc_ksinfo_p[NUM_GRPS];
60*3299Sschwartz } n2piupc_t;
61*3299Sschwartz 
62*3299Sschwartz /* Debugging facility. */
63*3299Sschwartz #ifdef DEBUG
64*3299Sschwartz extern int n2piupc_debug;
65*3299Sschwartz #define	N2PIUPC_DBG1 if (n2piupc_debug >= 1) printf
66*3299Sschwartz #define	N2PIUPC_DBG2 if (n2piupc_debug >= 2) printf
67*3299Sschwartz #else
68*3299Sschwartz #define	N2PIUPC_DBG1 0 &&
69*3299Sschwartz #define	N2PIUPC_DBG2 0 &&
70*3299Sschwartz #endif	/* DEBUG */
71*3299Sschwartz 
72*3299Sschwartz 
73*3299Sschwartz /* Function definitions exported among different modules. */
74*3299Sschwartz extern int n2piupc_kstat_init();
75*3299Sschwartz extern void n2piupc_kstat_fini();
76*3299Sschwartz extern int n2piupc_kstat_attach(n2piupc_t *n2piupc_p);
77*3299Sschwartz extern void n2piupc_kstat_detach(n2piupc_t *n2piupc_p);
78*3299Sschwartz 
79*3299Sschwartz #ifdef	__cplusplus
80*3299Sschwartz }
81*3299Sschwartz #endif
82*3299Sschwartz 
83*3299Sschwartz #endif	/* _N2PIUPC_H */
84