xref: /openbsd-src/sys/dev/ic/cissvar.h (revision 7380a3a4a351f983b5d3883fb573b3d8305f20b9)
1*7380a3a4Skrw /*	$OpenBSD: cissvar.h,v 1.16 2020/07/22 13:16:04 krw Exp $	*/
21ff04ec8Smickey 
31ff04ec8Smickey /*
4250d44c9Smickey  * Copyright (c) 2005,2006 Michael Shalayeff
51ff04ec8Smickey  * All rights reserved.
61ff04ec8Smickey  *
71ff04ec8Smickey  * Permission to use, copy, modify, and distribute this software for any
81ff04ec8Smickey  * purpose with or without fee is hereby granted, provided that the above
91ff04ec8Smickey  * copyright notice and this permission notice appear in all copies.
101ff04ec8Smickey  *
111ff04ec8Smickey  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
121ff04ec8Smickey  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
131ff04ec8Smickey  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
141ff04ec8Smickey  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
151ff04ec8Smickey  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
161ff04ec8Smickey  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
171ff04ec8Smickey  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
181ff04ec8Smickey  */
191ff04ec8Smickey 
2027515a6bSderaadt #include <sys/sensors.h>
21250d44c9Smickey 
22250d44c9Smickey struct ciss_ld {
23250d44c9Smickey 	struct ciss_blink bling;	/* a copy of blink state */
2491c0f63aSmickey 	char	xname[16];		/* copy of the sdN name */
25250d44c9Smickey 	int	ndrives;
26250d44c9Smickey 	u_int8_t tgts[1];
27250d44c9Smickey };
28250d44c9Smickey 
291ff04ec8Smickey struct ciss_softc {
301ff04ec8Smickey 	struct device	sc_dev;
311ff04ec8Smickey 	struct timeout	sc_hb;
321ff04ec8Smickey 	void		*sc_ih;
332b009ea6Smickey 	int		sc_flush;
34275cbf62Sderaadt 	struct ksensor	*sensors;
35275cbf62Sderaadt 	struct ksensordev sensordev;
361ff04ec8Smickey 
371ff04ec8Smickey 	u_int	sc_flags;
38cc8f077fSkrw #define	CISS_BIO	0x0001
391ff04ec8Smickey 	int ccblen, maxcmd, maxsg, nbus, ndrives, maxunits;
4062e42149Sdlg 	struct ciss_ccb_list sc_free_ccb;
41af5c2af9Sdlg 	struct mutex	sc_free_ccb_mtx;
42d276dd40Sdlg 	struct scsi_iopool sc_iopool;
431ff04ec8Smickey 
441ff04ec8Smickey 	bus_space_tag_t	iot;
451ff04ec8Smickey 	bus_space_handle_t ioh, cfg_ioh;
461ff04ec8Smickey 	bus_dma_tag_t	dmat;
471ff04ec8Smickey 	bus_dmamap_t	cmdmap;
481ff04ec8Smickey 	bus_dma_segment_t cmdseg[1];
491ff04ec8Smickey 	void		*ccbs;
501ff04ec8Smickey 	void		*scratch;
511ff04ec8Smickey 
521ff04ec8Smickey 	struct ciss_config cfg;
531ff04ec8Smickey 	int cfgoff;
541ff04ec8Smickey 	u_int32_t iem;
551ff04ec8Smickey 	u_int32_t heartbeat;
5608568b74Shalex 	int       fibrillation;
57250d44c9Smickey 	struct ciss_ld **sc_lds;
581ff04ec8Smickey };
591ff04ec8Smickey 
602b009ea6Smickey /* XXX These have to become spinlocks in case of fine SMP */
611ff04ec8Smickey #define	CISS_LOCK(sc) splbio()
621ff04ec8Smickey #define	CISS_UNLOCK(sc, lock) splx(lock)
632b009ea6Smickey #define	CISS_LOCK_SCRATCH(sc) splbio()
642b009ea6Smickey #define	CISS_UNLOCK_SCRATCH(sc, lock) splx(lock)
651ff04ec8Smickey typedef	int ciss_lock_t;
661ff04ec8Smickey 
671ff04ec8Smickey int	ciss_attach(struct ciss_softc *sc);
681ff04ec8Smickey int	ciss_intr(void *v);
69c06fda6dSderaadt void	ciss_shutdown(void *v);
70