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#pragma ident	"%Z%%M%	%I%	%E% SMI"
35
36#ifdef	__cplusplus
37extern "C" {
38#endif
39
40#include <sys/sunddi.h>
41
42#define	SUCCESS	0
43#define	FAILURE	-1
44
45#define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
46
47/* Used for data structure retrieval during kstat update. */
48typedef struct n2piu_ksinfo {
49	kstat_t		*cntr_ksp;
50	struct n2piupc	*n2piupc_p;
51	n2piu_grp_t	*grp_p;
52} n2piu_ksinfo_t;
53
54/* State structure. */
55typedef struct n2piupc {
56	dev_info_t	*n2piupc_dip;
57	cntr_handle_t	n2piupc_handle;
58	void *		n2piupc_biterr_p;
59	n2piu_ksinfo_t	*n2piupc_ksinfo_p[NUM_GRPS];
60} n2piupc_t;
61
62/* Debugging facility. */
63#ifdef DEBUG
64extern int n2piupc_debug;
65#define	N2PIUPC_DBG1 if (n2piupc_debug >= 1) printf
66#define	N2PIUPC_DBG2 if (n2piupc_debug >= 2) printf
67#else
68#define	N2PIUPC_DBG1 0 &&
69#define	N2PIUPC_DBG2 0 &&
70#endif	/* DEBUG */
71
72
73/* Function definitions exported among different modules. */
74extern int n2piupc_kstat_init();
75extern void n2piupc_kstat_fini();
76extern int n2piupc_kstat_attach(n2piupc_t *n2piupc_p);
77extern void n2piupc_kstat_detach(n2piupc_t *n2piupc_p);
78
79#ifdef	__cplusplus
80}
81#endif
82
83#endif	/* _N2PIUPC_H */
84