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