1 /* $OpenBSD: cissvar.h,v 1.7 2007/03/22 16:55:31 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 scsi_link *sc_link_raw;
33 struct timeout sc_hb;
34 void *sc_ih;
35 void *sc_sh;
36 struct proc *sc_thread;
37 int sc_flush;
38 struct ksensor *sensors;
39 struct ksensordev sensordev;
40
41 u_int sc_flags;
42 #define CISS_BIO 0x0001
43 int ccblen, maxcmd, maxsg, nbus, ndrives, maxunits;
44 ciss_queue_head sc_free_ccb, sc_ccbq, sc_ccbdone;
45
46 bus_space_tag_t iot;
47 bus_space_handle_t ioh, cfg_ioh;
48 bus_dma_tag_t dmat;
49 bus_dmamap_t cmdmap;
50 bus_dma_segment_t cmdseg[1];
51 void *ccbs;
52 void *scratch;
53
54 struct ciss_config cfg;
55 int cfgoff;
56 u_int32_t iem;
57 u_int32_t heartbeat;
58 struct ciss_ld **sc_lds;
59 };
60
61 struct ciss_rawsoftc {
62 struct scsi_link sc_link;
63 struct ciss_softc *sc_softc;
64 u_int8_t sc_channel;
65 };
66
67 /* XXX These have to become spinlocks in case of fine SMP */
68 #define CISS_LOCK(sc) splbio()
69 #define CISS_UNLOCK(sc, lock) splx(lock)
70 #define CISS_LOCK_SCRATCH(sc) splbio()
71 #define CISS_UNLOCK_SCRATCH(sc, lock) splx(lock)
72 typedef int ciss_lock_t;
73
74 int ciss_attach(struct ciss_softc *sc);
75 int ciss_intr(void *v);