xref: /onnv-gate/usr/src/uts/common/sys/bofi_impl.h (revision 3971:ad0c51c3d2f2)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3971Sstephh  * Common Development and Distribution License (the "License").
6*3971Sstephh  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*3971Sstephh  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_BOFI_IMPL_H
270Sstevel@tonic-gate #define	_SYS_BOFI_IMPL_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef __cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate struct bofi_errent {
360Sstevel@tonic-gate 	struct bofi_errent *next;	/* next on in-use chain */
370Sstevel@tonic-gate 	struct bofi_errent *cnext;	/* next on clone chain */
380Sstevel@tonic-gate 	struct bofi_errent *cprev;	/* prev on clone chain */
390Sstevel@tonic-gate 	struct bofi_errdef errdef;
400Sstevel@tonic-gate 	struct bofi_errstate errstate;
410Sstevel@tonic-gate 	caddr_t name;
420Sstevel@tonic-gate 	struct acc_log_elem *logbase;
430Sstevel@tonic-gate 	uint_t state;
440Sstevel@tonic-gate 	kcondvar_t cv;
450Sstevel@tonic-gate 	ddi_softintr_t softintr_id;
460Sstevel@tonic-gate };
470Sstevel@tonic-gate 
480Sstevel@tonic-gate /*
490Sstevel@tonic-gate  * values for state
500Sstevel@tonic-gate  */
510Sstevel@tonic-gate #define	BOFI_DEV_ACTIVE 1
520Sstevel@tonic-gate #define	BOFI_NEW_MESSAGE 2
530Sstevel@tonic-gate #define	BOFI_MESSAGE_WAIT 4
540Sstevel@tonic-gate #define	BOFI_DEBUG 8
550Sstevel@tonic-gate 
560Sstevel@tonic-gate #define	BOFI_NLINKS 8192
570Sstevel@tonic-gate 
580Sstevel@tonic-gate struct bofi_link {
590Sstevel@tonic-gate 	struct bofi_link *link;	/* next on shadow handle chain */
600Sstevel@tonic-gate 	struct bofi_errent *errentp;	/* pointer to corresponding errent */
610Sstevel@tonic-gate };
620Sstevel@tonic-gate 
630Sstevel@tonic-gate struct bofi_shadow {
640Sstevel@tonic-gate 	union {
650Sstevel@tonic-gate 		struct dvma_ops dvma_ops;
660Sstevel@tonic-gate 		ddi_acc_impl_t acc;
670Sstevel@tonic-gate 		struct {
680Sstevel@tonic-gate 			uint_t (*int_handler)(caddr_t, caddr_t);
690Sstevel@tonic-gate 			caddr_t int_handler_arg1;
700Sstevel@tonic-gate 			caddr_t int_handler_arg2;
710Sstevel@tonic-gate 		} intr;
720Sstevel@tonic-gate 	} save;
730Sstevel@tonic-gate 	struct bofi_shadow *next;	/* next on inuse chain */
740Sstevel@tonic-gate 	struct bofi_shadow *prev;	/* prev on inuse chain */
750Sstevel@tonic-gate 	struct bofi_shadow *hnext;	/* next on hhash chain */
760Sstevel@tonic-gate 	struct bofi_shadow *hprev;	/* prev on hhash chain */
770Sstevel@tonic-gate 	struct bofi_shadow *dnext;	/* next on dhash chain */
780Sstevel@tonic-gate 	struct bofi_shadow *dprev;	/* prev on dhash chain */
790Sstevel@tonic-gate 	struct bofi_link *link;	/* errdef chain */
800Sstevel@tonic-gate 	uint_t type;
810Sstevel@tonic-gate 	union {
820Sstevel@tonic-gate 		ddi_dma_handle_t dma_handle;
830Sstevel@tonic-gate 		ddi_acc_handle_t acc_handle;
840Sstevel@tonic-gate 	} hdl;
850Sstevel@tonic-gate 	uint32_t bofi_inum;
860Sstevel@tonic-gate 	dev_info_t *dip;
870Sstevel@tonic-gate 	char name[NAMESIZE];		/* as returned by ddi_get_name() */
880Sstevel@tonic-gate 	int instance;		/* as returned by ddi_get_instance() */
890Sstevel@tonic-gate 	int rnumber;
900Sstevel@tonic-gate 	offset_t offset;
910Sstevel@tonic-gate 	offset_t len;
920Sstevel@tonic-gate 	caddr_t addr;
930Sstevel@tonic-gate 	caddr_t mapaddr;
940Sstevel@tonic-gate 	caddr_t origaddr;
950Sstevel@tonic-gate 	caddr_t allocaddr;
960Sstevel@tonic-gate 	uint_t flags;
97*3971Sstephh 	int map_flags;
98*3971Sstephh 	page_t *map_pp;
99*3971Sstephh 	page_t **map_pplist;
1000Sstevel@tonic-gate 	struct bofi_shadow **hparrayp;
1010Sstevel@tonic-gate 	int hilevel;
1020Sstevel@tonic-gate 	ddi_umem_cookie_t umem_cookie;
1030Sstevel@tonic-gate };
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate /*
1060Sstevel@tonic-gate  * values for type
1070Sstevel@tonic-gate  */
1080Sstevel@tonic-gate #define	BOFI_ACC_HDL 1
1090Sstevel@tonic-gate #define	BOFI_DMA_HDL 2
1100Sstevel@tonic-gate #define	BOFI_INT_HDL 3
1110Sstevel@tonic-gate #define	BOFI_NULL    4
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate #ifdef __cplusplus
1140Sstevel@tonic-gate }
1150Sstevel@tonic-gate #endif
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate #endif	/* _SYS_BOFI_IMPL_H */
118