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