xref: /illumos-gate/usr/src/uts/common/sys/bofi_impl.h (revision b0bb0d63258be430b0e22afcb1581974bd7b568e)
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 		struct dvma_ops dvma_ops;
64 		ddi_acc_impl_t acc;
65 		struct {
66 			uint_t (*int_handler)(caddr_t, caddr_t);
67 			caddr_t int_handler_arg1;
68 			caddr_t int_handler_arg2;
69 		} intr;
70 	} save;
71 	struct bofi_shadow *next;	/* next on inuse chain */
72 	struct bofi_shadow *prev;	/* prev on inuse chain */
73 	struct bofi_shadow *hnext;	/* next on hhash chain */
74 	struct bofi_shadow *hprev;	/* prev on hhash chain */
75 	struct bofi_shadow *dnext;	/* next on dhash chain */
76 	struct bofi_shadow *dprev;	/* prev on dhash chain */
77 	struct bofi_link *link;	/* errdef chain */
78 	uint_t type;
79 	union {
80 		ddi_dma_handle_t dma_handle;
81 		ddi_acc_handle_t acc_handle;
82 	} hdl;
83 	uint32_t bofi_inum;
84 	dev_info_t *dip;
85 	char name[NAMESIZE];		/* as returned by ddi_get_name() */
86 	int instance;		/* as returned by ddi_get_instance() */
87 	int rnumber;
88 	offset_t offset;
89 	offset_t len;
90 	caddr_t addr;
91 	caddr_t mapaddr;
92 	caddr_t origaddr;
93 	caddr_t allocaddr;
94 	uint_t flags;
95 	int map_flags;
96 	page_t *map_pp;
97 	page_t **map_pplist;
98 	struct bofi_shadow **hparrayp;
99 	int hilevel;
100 	ddi_umem_cookie_t umem_cookie;
101 };
102 
103 /*
104  * values for type
105  */
106 #define	BOFI_ACC_HDL 1
107 #define	BOFI_DMA_HDL 2
108 #define	BOFI_INT_HDL 3
109 #define	BOFI_NULL    4
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif	/* _SYS_BOFI_IMPL_H */
116