xref: /netbsd-src/sys/dev/ic/cissvar.h (revision ce2c90c7c172d95d2402a5b3d96d8f8e6d138a21)
1 /*	$NetBSD: cissvar.h,v 1.1 2006/03/21 20:42:14 he Exp $	*/
2 /*	$OpenBSD: cissvar.h,v 1.2 2005/09/07 04:00:16 mickey Exp $	*/
3 
4 /*
5  * Copyright (c) 2005 Michael Shalayeff
6  * All rights reserved.
7  *
8  * Permission to use, copy, modify, and distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
17  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
18  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 struct ciss_softc {
22 	/* Generic device info. */
23 	struct device		sc_dev;
24 	bus_space_handle_t	sc_ioh;
25 	bus_space_tag_t		sc_iot;
26 	bus_dma_tag_t		sc_dmat;
27 	void			*sc_ih;
28 	void			*sc_sh;		/* shutdown hook */
29 	struct proc		*sc_thread;
30 	int			sc_flush;
31 
32 	struct scsipi_channel	sc_channel;
33 	struct scsipi_channel	*sc_channel_raw;
34 	struct scsipi_adapter	sc_adapter;
35 	struct scsipi_adapter	*sc_adapter_raw;
36 	struct callout		sc_hb;
37 
38 	u_int	sc_flags;
39 	int ccblen, maxcmd, maxsg, nbus, ndrives, maxunits;
40 	ciss_queue_head	sc_free_ccb, sc_ccbq, sc_ccbdone;
41 
42 	bus_dmamap_t		cmdmap;
43 	bus_dma_segment_t	cmdseg[1];
44 	caddr_t			ccbs;
45 	void			*scratch;
46 
47 	bus_space_handle_t	cfg_ioh;
48 
49 	struct ciss_config cfg;
50 	int cfgoff;
51 	u_int32_t iem;
52 	u_int32_t heartbeat;
53 };
54 
55 struct ciss_rawsoftc {
56 	struct ciss_softc *sc_softc;
57 	u_int8_t	sc_channel;
58 };
59 
60 /* XXX These have to become spinlocks in case of fine SMP */
61 #define	CISS_LOCK(sc) splbio()
62 #define	CISS_UNLOCK(sc, lock) splx(lock)
63 #define	CISS_LOCK_SCRATCH(sc) splbio()
64 #define	CISS_UNLOCK_SCRATCH(sc, lock) splx(lock)
65 typedef	int ciss_lock_t;
66 
67 int	ciss_attach(struct ciss_softc *sc);
68 int	ciss_intr(void *v);
69