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