n2piupc.h revision 3299:8139b10ae6b7
1131087Smarcel/*
2131087Smarcel * CDDL HEADER START
3131087Smarcel *
4131087Smarcel * The contents of this file are subject to the terms of the
5131087Smarcel * Common Development and Distribution License (the "License").
6131087Smarcel * You may not use this file except in compliance with the License.
7131087Smarcel *
8131087Smarcel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9131087Smarcel * or http://www.opensolaris.org/os/licensing.
10131087Smarcel * See the License for the specific language governing permissions
11131087Smarcel * and limitations under the License.
12131087Smarcel *
13131087Smarcel * When distributing Covered Code, include this CDDL HEADER in each
14224687Smarius * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15131087Smarcel * If applicable, add the following below this CDDL HEADER, with the
16131087Smarcel * fields enclosed by brackets "[]" replaced with your own identifying
17131087Smarcel * information: Portions Copyright [yyyy] [name of copyright owner]
18131087Smarcel *
19131087Smarcel * CDDL HEADER END
20131087Smarcel */
21131087Smarcel
22131087Smarcel/*
23131087Smarcel * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24131087Smarcel * Use is subject to license terms.
25131087Smarcel */
26131087Smarcel
27131087Smarcel#ifndef	_N2PIUPC_H
28131087Smarcel#define	_N2PIUPC_H
29131087Smarcel
30131087Smarcel/*
31131087Smarcel * Definitions which deal with things other than registers.
32131087Smarcel */
33131087Smarcel
34131087Smarcel#pragma ident	"%Z%%M%	%I%	%E% SMI"
35131087Smarcel
36131087Smarcel#ifdef	__cplusplus
37131087Smarcelextern "C" {
38131087Smarcel#endif
39131087Smarcel
40131087Smarcel#include <sys/sunddi.h>
41131087Smarcel
42131087Smarcel#define	SUCCESS	0
43131087Smarcel#define	FAILURE	-1
44131087Smarcel
45131087Smarcel#define	NAMEINST(dip)	ddi_driver_name(dip), ddi_get_instance(dip)
46131087Smarcel
47131087Smarcel/* Used for data structure retrieval during kstat update. */
48131087Smarceltypedef struct n2piu_ksinfo {
49131087Smarcel	kstat_t		*cntr_ksp;
50131087Smarcel	struct n2piupc	*n2piupc_p;
51131087Smarcel	n2piu_grp_t	*grp_p;
52131087Smarcel} n2piu_ksinfo_t;
53131087Smarcel
54131087Smarcel/* State structure. */
55131087Smarceltypedef struct n2piupc {
56131087Smarcel	dev_info_t	*n2piupc_dip;
57131087Smarcel	cntr_handle_t	n2piupc_handle;
58131087Smarcel	void *		n2piupc_biterr_p;
59131087Smarcel	n2piu_ksinfo_t	*n2piupc_ksinfo_p[NUM_GRPS];
60131087Smarcel} n2piupc_t;
61131087Smarcel
62131087Smarcel/* Debugging facility. */
63131087Smarcel#ifdef DEBUG
64131087Smarcelextern int n2piupc_debug;
65131087Smarcel#define	N2PIUPC_DBG1 if (n2piupc_debug >= 1) printf
66131087Smarcel#define	N2PIUPC_DBG2 if (n2piupc_debug >= 2) printf
67131087Smarcel#else
68131087Smarcel#define	N2PIUPC_DBG1 0 &&
69131087Smarcel#define	N2PIUPC_DBG2 0 &&
70131087Smarcel#endif	/* DEBUG */
71131087Smarcel
72131087Smarcel
73131087Smarcel/* Function definitions exported among different modules. */
74131087Smarcelextern int n2piupc_kstat_init();
75131087Smarcelextern void n2piupc_kstat_fini();
76131087Smarcelextern int n2piupc_kstat_attach(n2piupc_t *n2piupc_p);
77131087Smarcelextern void n2piupc_kstat_detach(n2piupc_t *n2piupc_p);
78131087Smarcel
79131087Smarcel#ifdef	__cplusplus
80131087Smarcel}
81131087Smarcel#endif
82131087Smarcel
83131087Smarcel#endif	/* _N2PIUPC_H */
84131087Smarcel