xref: /illumos-gate/usr/src/uts/common/sys/bofi_impl.h (revision 808cb8d36905312922b9739f76ba5b13a7d18144)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_BOFI_IMPL_H
27 #define	_SYS_BOFI_IMPL_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct bofi_errent {
34 	struct bofi_errent *next;	/* next on in-use chain */
35 	struct bofi_errent *cnext;	/* next on clone chain */
36 	struct bofi_errent *cprev;	/* prev on clone chain */
37 	struct bofi_errdef errdef;
38 	struct bofi_errstate errstate;
39 	caddr_t name;
40 	struct acc_log_elem *logbase;
41 	uint_t state;
42 	kcondvar_t cv;
43 	ddi_softintr_t softintr_id;
44 };
45 
46 /*
47  * values for state
48  */
49 #define	BOFI_DEV_ACTIVE 1
50 #define	BOFI_NEW_MESSAGE 2
51 #define	BOFI_MESSAGE_WAIT 4
52 #define	BOFI_DEBUG 8
53 
54 #define	BOFI_NLINKS 8192
55 
56 struct bofi_link {
57 	struct bofi_link *link;	/* next on shadow handle chain */
58 	struct bofi_errent *errentp;	/* pointer to corresponding errent */
59 };
60 
61 struct bofi_shadow {
62 	union {
63 #ifdef __sparc
64 		struct dvma_ops dvma_ops;
65 #endif
66 		ddi_acc_impl_t acc;
67 		struct {
68 			uint_t (*int_handler)(caddr_t, caddr_t);
69 			caddr_t int_handler_arg1;
70 			caddr_t int_handler_arg2;
71 		} intr;
72 	} save;
73 	struct bofi_shadow *next;	/* next on inuse chain */
74 	struct bofi_shadow *prev;	/* prev on inuse chain */
75 	struct bofi_shadow *hnext;	/* next on hhash chain */
76 	struct bofi_shadow *hprev;	/* prev on hhash chain */
77 	struct bofi_shadow *dnext;	/* next on dhash chain */
78 	struct bofi_shadow *dprev;	/* prev on dhash chain */
79 	struct bofi_link *link;	/* errdef chain */
80 	uint_t type;
81 	union {
82 		ddi_dma_handle_t dma_handle;
83 		ddi_acc_handle_t acc_handle;
84 	} hdl;
85 	uint32_t bofi_inum;
86 	dev_info_t *dip;
87 	char name[NAMESIZE];		/* as returned by ddi_get_name() */
88 	int instance;		/* as returned by ddi_get_instance() */
89 	int rnumber;
90 	offset_t offset;
91 	offset_t len;
92 	caddr_t addr;
93 	caddr_t mapaddr;
94 	caddr_t origaddr;
95 	caddr_t allocaddr;
96 	uint_t flags;
97 	int map_flags;
98 	page_t *map_pp;
99 	page_t **map_pplist;
100 	struct bofi_shadow **hparrayp;
101 	int hilevel;
102 	ddi_umem_cookie_t umem_cookie;
103 };
104 
105 /*
106  * values for type
107  */
108 #define	BOFI_ACC_HDL 1
109 #define	BOFI_DMA_HDL 2
110 #define	BOFI_INT_HDL 3
111 #define	BOFI_NULL    4
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif	/* _SYS_BOFI_IMPL_H */
118