xref: /netbsd-src/sys/dev/ic/cissvar.h (revision 5cd050e7496430a21bd7f9477139ab498ad0a4be)
1*5cd050e7Sjdolecek /*	$NetBSD: cissvar.h,v 1.11 2020/07/15 14:33:58 jdolecek Exp $	*/
26b629de2Schristos /*	$OpenBSD: cissvar.h,v 1.15 2013/05/30 16:15:02 deraadt Exp $	*/
377c27ad0She 
477c27ad0She /*
56b629de2Schristos  * Copyright (c) 2005,2006 Michael Shalayeff
677c27ad0She  * All rights reserved.
777c27ad0She  *
877c27ad0She  * Permission to use, copy, modify, and distribute this software for any
977c27ad0She  * purpose with or without fee is hereby granted, provided that the above
1077c27ad0She  * copyright notice and this permission notice appear in all copies.
1177c27ad0She  *
1277c27ad0She  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1377c27ad0She  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1477c27ad0She  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1577c27ad0She  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1677c27ad0She  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
1777c27ad0She  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
1877c27ad0She  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1977c27ad0She  */
2077c27ad0She 
2172715a9aSmhitch #include <sys/mutex.h>
2272715a9aSmhitch #include <sys/condvar.h>
2372715a9aSmhitch 
2472715a9aSmhitch #include <dev/sysmon/sysmonvar.h>
2572715a9aSmhitch #include <sys/envsys.h>
2672715a9aSmhitch 
27e9096488Sjoerg #include "opt_ciss.h"
28e9096488Sjoerg 
2972715a9aSmhitch struct ciss_ld {
3072715a9aSmhitch 	struct ciss_blink bling;	/* a copy of blink state */
3172715a9aSmhitch 	char	xname[16];		/* copy of the sdN name */
3272715a9aSmhitch 	int	ndrives;
3372715a9aSmhitch 	u_int8_t tgts[1];
3472715a9aSmhitch };
3572715a9aSmhitch 
3677c27ad0She struct ciss_softc {
3777c27ad0She 	/* Generic device info. */
38cbab9cadSchs 	device_t		sc_dev;
3972715a9aSmhitch 	kmutex_t		sc_mutex;
4072715a9aSmhitch 	kmutex_t		sc_mutex_scratch;
4177c27ad0She 	bus_space_handle_t	sc_ioh;
4277c27ad0She 	bus_space_tag_t		sc_iot;
4377c27ad0She 	bus_dma_tag_t		sc_dmat;
4477c27ad0She 	void			*sc_ih;
4577c27ad0She 	void			*sc_sh;		/* shutdown hook */
4677c27ad0She 	struct proc		*sc_thread;
4777c27ad0She 	int			sc_flush;
4877c27ad0She 
4977c27ad0She 	struct scsipi_channel	sc_channel;
5077c27ad0She 	struct scsipi_adapter	sc_adapter;
5177c27ad0She 	struct callout		sc_hb;
5277c27ad0She 
5377c27ad0She 	u_int	sc_flags;
5477c27ad0She 	int ccblen, maxcmd, maxsg, nbus, ndrives, maxunits;
55b1ab9c34Sjdolecek 	ciss_queue_head		sc_free_ccb;
5672715a9aSmhitch 	kcondvar_t		sc_condvar;
5777c27ad0She 
5877c27ad0She 	bus_dmamap_t		cmdmap;
5977c27ad0She 	bus_dma_segment_t	cmdseg[1];
6053524e44Schristos 	void *			ccbs;
6177c27ad0She 	void			*scratch;
6272715a9aSmhitch 	u_int			sc_waitflag;
6377c27ad0She 
6477c27ad0She 	bus_space_handle_t	cfg_ioh;
6577c27ad0She 
66c5924423Sjdolecek 	struct ciss_perf_config	perfcfg;
67c5924423Sjdolecek 	bus_dmamap_t		replymap;
68c5924423Sjdolecek 	bus_dma_segment_t	replyseg[1];
69c5924423Sjdolecek 	uint64_t		*perf_reply;
70c5924423Sjdolecek 	int			perf_rqidx, perf_cycle;
71c5924423Sjdolecek #define	CISS_IS_PERF(sc)	((sc)->perf_reply != NULL)
72c5924423Sjdolecek 
736b629de2Schristos 	int fibrillation;
7477c27ad0She 	struct ciss_config cfg;
75c5924423Sjdolecek #define CISS_PERF_SUPPORTED(sc)	((sc)->cfg.methods & CISS_METH_PERF)
7677c27ad0She 	int cfgoff;
7777c27ad0She 	u_int32_t iem;
7877c27ad0She 	u_int32_t heartbeat;
7972715a9aSmhitch 	struct ciss_ld **sc_lds;
8072715a9aSmhitch 
8172715a9aSmhitch 	/* scsi ioctl from sd device */
82529e91fcScegger 	int			(*sc_ioctl)(device_t, u_long, void *);
8372715a9aSmhitch 
8472715a9aSmhitch 	struct sysmon_envsys    *sc_sme;
8572715a9aSmhitch 	envsys_data_t		*sc_sensor;
8677c27ad0She };
8777c27ad0She 
8877c27ad0She struct ciss_rawsoftc {
8977c27ad0She 	struct ciss_softc *sc_softc;
9077c27ad0She 	u_int8_t	sc_channel;
9177c27ad0She };
9277c27ad0She 
9377c27ad0She int	ciss_attach(struct ciss_softc *sc);
94c5924423Sjdolecek int	ciss_intr_simple_intx(void *v);
95c5924423Sjdolecek int	ciss_intr_perf_intx(void *v);
96c5924423Sjdolecek int	ciss_intr_perf_msi(void *v);
97