xref: /openbsd/sys/dev/ic/cissvar.h (revision 7380a3a4)
1 /*	$OpenBSD: cissvar.h,v 1.16 2020/07/22 13:16:04 krw 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 timeout	sc_hb;
32 	void		*sc_ih;
33 	int		sc_flush;
34 	struct ksensor	*sensors;
35 	struct ksensordev sensordev;
36 
37 	u_int	sc_flags;
38 #define	CISS_BIO	0x0001
39 	int ccblen, maxcmd, maxsg, nbus, ndrives, maxunits;
40 	struct ciss_ccb_list sc_free_ccb;
41 	struct mutex	sc_free_ccb_mtx;
42 	struct scsi_iopool sc_iopool;
43 
44 	bus_space_tag_t	iot;
45 	bus_space_handle_t ioh, cfg_ioh;
46 	bus_dma_tag_t	dmat;
47 	bus_dmamap_t	cmdmap;
48 	bus_dma_segment_t cmdseg[1];
49 	void		*ccbs;
50 	void		*scratch;
51 
52 	struct ciss_config cfg;
53 	int cfgoff;
54 	u_int32_t iem;
55 	u_int32_t heartbeat;
56 	int       fibrillation;
57 	struct ciss_ld **sc_lds;
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 void	ciss_shutdown(void *v);
70