xref: /openbsd-src/sys/dev/ic/cissvar.h (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1 /*	$OpenBSD: cissvar.h,v 1.15 2013/05/30 16:15:02 deraadt Exp $	*/
2 
3 /*
4  * Copyright (c) 2005,2006 Michael Shalayeff
5  * All rights reserved.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
16  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include <sys/sensors.h>
21 
22 struct ciss_ld {
23 	struct ciss_blink bling;	/* a copy of blink state */
24 	char	xname[16];		/* copy of the sdN name */
25 	int	ndrives;
26 	u_int8_t tgts[1];
27 };
28 
29 struct ciss_softc {
30 	struct device	sc_dev;
31 	struct scsi_link sc_link;
32 	struct timeout	sc_hb;
33 	void		*sc_ih;
34 	int		sc_flush;
35 	struct ksensor	*sensors;
36 	struct ksensordev sensordev;
37 
38 	u_int	sc_flags;
39 #define	CISS_BIO	0x0001
40 	int ccblen, maxcmd, maxsg, nbus, ndrives, maxunits;
41 	struct ciss_ccb_list sc_free_ccb;
42 	struct mutex	sc_free_ccb_mtx;
43 	struct scsi_iopool sc_iopool;
44 
45 	bus_space_tag_t	iot;
46 	bus_space_handle_t ioh, cfg_ioh;
47 	bus_dma_tag_t	dmat;
48 	bus_dmamap_t	cmdmap;
49 	bus_dma_segment_t cmdseg[1];
50 	void		*ccbs;
51 	void		*scratch;
52 
53 	struct ciss_config cfg;
54 	int cfgoff;
55 	u_int32_t iem;
56 	u_int32_t heartbeat;
57 	int       fibrillation;
58 	struct ciss_ld **sc_lds;
59 };
60 
61 /* XXX These have to become spinlocks in case of fine SMP */
62 #define	CISS_LOCK(sc) splbio()
63 #define	CISS_UNLOCK(sc, lock) splx(lock)
64 #define	CISS_LOCK_SCRATCH(sc) splbio()
65 #define	CISS_UNLOCK_SCRATCH(sc, lock) splx(lock)
66 typedef	int ciss_lock_t;
67 
68 int	ciss_attach(struct ciss_softc *sc);
69 int	ciss_intr(void *v);
70 void	ciss_shutdown(void *v);
71