xref: /illumos-gate/usr/src/uts/common/sys/bofi_impl.h (revision 808cb8d3)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5cecfa358Sstephh  * Common Development and Distribution License (the "License").
6cecfa358Sstephh  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22cecfa358Sstephh  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_BOFI_IMPL_H
277c478bd9Sstevel@tonic-gate #define	_SYS_BOFI_IMPL_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef __cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate struct bofi_errent {
347c478bd9Sstevel@tonic-gate 	struct bofi_errent *next;	/* next on in-use chain */
357c478bd9Sstevel@tonic-gate 	struct bofi_errent *cnext;	/* next on clone chain */
367c478bd9Sstevel@tonic-gate 	struct bofi_errent *cprev;	/* prev on clone chain */
377c478bd9Sstevel@tonic-gate 	struct bofi_errdef errdef;
387c478bd9Sstevel@tonic-gate 	struct bofi_errstate errstate;
397c478bd9Sstevel@tonic-gate 	caddr_t name;
407c478bd9Sstevel@tonic-gate 	struct acc_log_elem *logbase;
417c478bd9Sstevel@tonic-gate 	uint_t state;
427c478bd9Sstevel@tonic-gate 	kcondvar_t cv;
437c478bd9Sstevel@tonic-gate 	ddi_softintr_t softintr_id;
447c478bd9Sstevel@tonic-gate };
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * values for state
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate #define	BOFI_DEV_ACTIVE 1
507c478bd9Sstevel@tonic-gate #define	BOFI_NEW_MESSAGE 2
517c478bd9Sstevel@tonic-gate #define	BOFI_MESSAGE_WAIT 4
527c478bd9Sstevel@tonic-gate #define	BOFI_DEBUG 8
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #define	BOFI_NLINKS 8192
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate struct bofi_link {
577c478bd9Sstevel@tonic-gate 	struct bofi_link *link;	/* next on shadow handle chain */
587c478bd9Sstevel@tonic-gate 	struct bofi_errent *errentp;	/* pointer to corresponding errent */
597c478bd9Sstevel@tonic-gate };
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate struct bofi_shadow {
627c478bd9Sstevel@tonic-gate 	union {
63*808cb8d3SRichard Lowe #ifdef __sparc
647c478bd9Sstevel@tonic-gate 		struct dvma_ops dvma_ops;
65*808cb8d3SRichard Lowe #endif
667c478bd9Sstevel@tonic-gate 		ddi_acc_impl_t acc;
677c478bd9Sstevel@tonic-gate 		struct {
687c478bd9Sstevel@tonic-gate 			uint_t (*int_handler)(caddr_t, caddr_t);
697c478bd9Sstevel@tonic-gate 			caddr_t int_handler_arg1;
707c478bd9Sstevel@tonic-gate 			caddr_t int_handler_arg2;
717c478bd9Sstevel@tonic-gate 		} intr;
727c478bd9Sstevel@tonic-gate 	} save;
737c478bd9Sstevel@tonic-gate 	struct bofi_shadow *next;	/* next on inuse chain */
747c478bd9Sstevel@tonic-gate 	struct bofi_shadow *prev;	/* prev on inuse chain */
757c478bd9Sstevel@tonic-gate 	struct bofi_shadow *hnext;	/* next on hhash chain */
767c478bd9Sstevel@tonic-gate 	struct bofi_shadow *hprev;	/* prev on hhash chain */
777c478bd9Sstevel@tonic-gate 	struct bofi_shadow *dnext;	/* next on dhash chain */
787c478bd9Sstevel@tonic-gate 	struct bofi_shadow *dprev;	/* prev on dhash chain */
797c478bd9Sstevel@tonic-gate 	struct bofi_link *link;	/* errdef chain */
807c478bd9Sstevel@tonic-gate 	uint_t type;
817c478bd9Sstevel@tonic-gate 	union {
827c478bd9Sstevel@tonic-gate 		ddi_dma_handle_t dma_handle;
837c478bd9Sstevel@tonic-gate 		ddi_acc_handle_t acc_handle;
847c478bd9Sstevel@tonic-gate 	} hdl;
857c478bd9Sstevel@tonic-gate 	uint32_t bofi_inum;
867c478bd9Sstevel@tonic-gate 	dev_info_t *dip;
877c478bd9Sstevel@tonic-gate 	char name[NAMESIZE];		/* as returned by ddi_get_name() */
887c478bd9Sstevel@tonic-gate 	int instance;		/* as returned by ddi_get_instance() */
897c478bd9Sstevel@tonic-gate 	int rnumber;
907c478bd9Sstevel@tonic-gate 	offset_t offset;
917c478bd9Sstevel@tonic-gate 	offset_t len;
927c478bd9Sstevel@tonic-gate 	caddr_t addr;
937c478bd9Sstevel@tonic-gate 	caddr_t mapaddr;
947c478bd9Sstevel@tonic-gate 	caddr_t origaddr;
957c478bd9Sstevel@tonic-gate 	caddr_t allocaddr;
967c478bd9Sstevel@tonic-gate 	uint_t flags;
97cecfa358Sstephh 	int map_flags;
98cecfa358Sstephh 	page_t *map_pp;
99cecfa358Sstephh 	page_t **map_pplist;
1007c478bd9Sstevel@tonic-gate 	struct bofi_shadow **hparrayp;
1017c478bd9Sstevel@tonic-gate 	int hilevel;
1027c478bd9Sstevel@tonic-gate 	ddi_umem_cookie_t umem_cookie;
1037c478bd9Sstevel@tonic-gate };
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate /*
1067c478bd9Sstevel@tonic-gate  * values for type
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate #define	BOFI_ACC_HDL 1
1097c478bd9Sstevel@tonic-gate #define	BOFI_DMA_HDL 2
1107c478bd9Sstevel@tonic-gate #define	BOFI_INT_HDL 3
1117c478bd9Sstevel@tonic-gate #define	BOFI_NULL    4
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1147c478bd9Sstevel@tonic-gate }
1157c478bd9Sstevel@tonic-gate #endif
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate #endif	/* _SYS_BOFI_IMPL_H */
118