xref: /onnv-gate/usr/src/uts/common/sys/bofi_impl.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_BOFI_IMPL_H
28*0Sstevel@tonic-gate #define	_SYS_BOFI_IMPL_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef __cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate struct bofi_errent {
37*0Sstevel@tonic-gate 	struct bofi_errent *next;	/* next on in-use chain */
38*0Sstevel@tonic-gate 	struct bofi_errent *cnext;	/* next on clone chain */
39*0Sstevel@tonic-gate 	struct bofi_errent *cprev;	/* prev on clone chain */
40*0Sstevel@tonic-gate 	struct bofi_errdef errdef;
41*0Sstevel@tonic-gate 	struct bofi_errstate errstate;
42*0Sstevel@tonic-gate 	caddr_t name;
43*0Sstevel@tonic-gate 	struct acc_log_elem *logbase;
44*0Sstevel@tonic-gate 	uint_t state;
45*0Sstevel@tonic-gate 	kcondvar_t cv;
46*0Sstevel@tonic-gate 	ddi_softintr_t softintr_id;
47*0Sstevel@tonic-gate };
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate /*
50*0Sstevel@tonic-gate  * values for state
51*0Sstevel@tonic-gate  */
52*0Sstevel@tonic-gate #define	BOFI_DEV_ACTIVE 1
53*0Sstevel@tonic-gate #define	BOFI_NEW_MESSAGE 2
54*0Sstevel@tonic-gate #define	BOFI_MESSAGE_WAIT 4
55*0Sstevel@tonic-gate #define	BOFI_DEBUG 8
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate #define	BOFI_NLINKS 8192
58*0Sstevel@tonic-gate 
59*0Sstevel@tonic-gate struct bofi_link {
60*0Sstevel@tonic-gate 	struct bofi_link *link;	/* next on shadow handle chain */
61*0Sstevel@tonic-gate 	struct bofi_errent *errentp;	/* pointer to corresponding errent */
62*0Sstevel@tonic-gate };
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate struct bofi_shadow {
65*0Sstevel@tonic-gate 	union {
66*0Sstevel@tonic-gate 		struct dvma_ops dvma_ops;
67*0Sstevel@tonic-gate 		ddi_acc_impl_t acc;
68*0Sstevel@tonic-gate 		struct {
69*0Sstevel@tonic-gate 			uint_t (*int_handler)(caddr_t, caddr_t);
70*0Sstevel@tonic-gate 			caddr_t int_handler_arg1;
71*0Sstevel@tonic-gate 			caddr_t int_handler_arg2;
72*0Sstevel@tonic-gate 		} intr;
73*0Sstevel@tonic-gate 	} save;
74*0Sstevel@tonic-gate 	struct bofi_shadow *next;	/* next on inuse chain */
75*0Sstevel@tonic-gate 	struct bofi_shadow *prev;	/* prev on inuse chain */
76*0Sstevel@tonic-gate 	struct bofi_shadow *hnext;	/* next on hhash chain */
77*0Sstevel@tonic-gate 	struct bofi_shadow *hprev;	/* prev on hhash chain */
78*0Sstevel@tonic-gate 	struct bofi_shadow *dnext;	/* next on dhash chain */
79*0Sstevel@tonic-gate 	struct bofi_shadow *dprev;	/* prev on dhash chain */
80*0Sstevel@tonic-gate 	struct bofi_link *link;	/* errdef chain */
81*0Sstevel@tonic-gate 	uint_t type;
82*0Sstevel@tonic-gate 	union {
83*0Sstevel@tonic-gate 		ddi_dma_handle_t dma_handle;
84*0Sstevel@tonic-gate 		ddi_acc_handle_t acc_handle;
85*0Sstevel@tonic-gate 	} hdl;
86*0Sstevel@tonic-gate 	uint32_t bofi_inum;
87*0Sstevel@tonic-gate 	dev_info_t *dip;
88*0Sstevel@tonic-gate 	char name[NAMESIZE];		/* as returned by ddi_get_name() */
89*0Sstevel@tonic-gate 	int instance;		/* as returned by ddi_get_instance() */
90*0Sstevel@tonic-gate 	int rnumber;
91*0Sstevel@tonic-gate 	offset_t offset;
92*0Sstevel@tonic-gate 	offset_t len;
93*0Sstevel@tonic-gate 	caddr_t addr;
94*0Sstevel@tonic-gate 	caddr_t mapaddr;
95*0Sstevel@tonic-gate 	caddr_t origaddr;
96*0Sstevel@tonic-gate 	caddr_t allocaddr;
97*0Sstevel@tonic-gate 	uint_t flags;
98*0Sstevel@tonic-gate 	struct bofi_shadow **hparrayp;
99*0Sstevel@tonic-gate 	int hilevel;
100*0Sstevel@tonic-gate 	ddi_umem_cookie_t umem_cookie;
101*0Sstevel@tonic-gate };
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate /*
104*0Sstevel@tonic-gate  * values for type
105*0Sstevel@tonic-gate  */
106*0Sstevel@tonic-gate #define	BOFI_ACC_HDL 1
107*0Sstevel@tonic-gate #define	BOFI_DMA_HDL 2
108*0Sstevel@tonic-gate #define	BOFI_INT_HDL 3
109*0Sstevel@tonic-gate #define	BOFI_NULL    4
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate #ifdef __cplusplus
112*0Sstevel@tonic-gate }
113*0Sstevel@tonic-gate #endif
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate #endif	/* _SYS_BOFI_IMPL_H */
116