xref: /titanic_44/usr/src/uts/common/sys/bofi_impl.h (revision a38ddfee9c8c6b6c5a2947ff52fd2338362a4444)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 struct bofi_errent {
36 	struct bofi_errent *next;	/* next on in-use chain */
37 	struct bofi_errent *cnext;	/* next on clone chain */
38 	struct bofi_errent *cprev;	/* prev on clone chain */
39 	struct bofi_errdef errdef;
40 	struct bofi_errstate errstate;
41 	caddr_t name;
42 	struct acc_log_elem *logbase;
43 	uint_t state;
44 	kcondvar_t cv;
45 	ddi_softintr_t softintr_id;
46 };
47 
48 /*
49  * values for state
50  */
51 #define	BOFI_DEV_ACTIVE 1
52 #define	BOFI_NEW_MESSAGE 2
53 #define	BOFI_MESSAGE_WAIT 4
54 #define	BOFI_DEBUG 8
55 
56 #define	BOFI_NLINKS 8192
57 
58 struct bofi_link {
59 	struct bofi_link *link;	/* next on shadow handle chain */
60 	struct bofi_errent *errentp;	/* pointer to corresponding errent */
61 };
62 
63 struct bofi_shadow {
64 	union {
65 		struct dvma_ops dvma_ops;
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