1 /* $NetBSD: siisatavar.h,v 1.2.4.2 2009/09/28 00:22:36 snj Exp $ */
2
3 /* from ahcisatavar.h */
4
5 /*
6 * Copyright (c) 2006 Manuel Bouyer.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Manuel Bouyer.
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
35 /*-
36 * Copyright (c) 2007, 2008, 2009 Jonathan A. Kollasch.
37 * All rights reserved.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
49 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
50 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
51 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
52 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 *
59 */
60
61 #ifndef _IC_SIISATAVAR_H_
62 #define _IC_SIISATAVAR_H_
63
64 #include <dev/ic/siisatareg.h>
65 #include <dev/ata/atavar.h>
66
67 #define DEBUG_INTR 0x01
68 #define DEBUG_XFERS 0x02
69 #define DEBUG_FUNCS 0x08
70 #define DEBUG_PROBE 0x10
71 #define DEBUG_DETACH 0x20
72 #define DEBUG_DEBUG 0x80000000
73 #ifdef SIISATA_DEBUG
74 extern int siisata_debug_mask;
75 #define SIISATA_DEBUG_PRINT(args, level) \
76 if (siisata_debug_mask & (level)) \
77 printf args
78 #else
79 #define SIISATA_DEBUG_PRINT(args, level)
80 #endif
81
82 struct siisata_softc {
83 struct atac_softc sc_atac;
84 bus_space_tag_t sc_grt;
85 bus_space_handle_t sc_grh;
86 bus_size_t sc_grs;
87 bus_space_tag_t sc_prt;
88 bus_space_handle_t sc_prh;
89 bus_size_t sc_prs;
90 bus_dma_tag_t sc_dmat;
91
92 struct ata_channel *sc_chanarray[SIISATA_MAX_PORTS];
93 struct siisata_channel {
94 struct ata_channel ata_channel;
95 bus_space_handle_t sch_scontrol;
96 bus_space_handle_t sch_sstatus;
97 bus_space_handle_t sch_serror;
98
99 /* command activation PRBs */
100 bus_dmamap_t sch_prbd;
101 struct siisata_prb *sch_prb[SIISATA_MAX_SLOTS];
102 bus_addr_t sch_bus_prb[SIISATA_MAX_SLOTS];
103
104 bus_dmamap_t sch_datad[SIISATA_MAX_SLOTS];
105
106 uint32_t sch_active_slots;
107 } sc_channels[SIISATA_MAX_PORTS];
108 };
109
110 #define SIISATANAME(sc) (device_xname((sc)->sc_atac.atac_dev))
111
112 #define GRREAD(sc, reg) bus_space_read_4((sc)->sc_grt, (sc)->sc_grh, (reg))
113 #define GRWRITE(sc, reg, val) bus_space_write_4((sc)->sc_grt, (sc)->sc_grh, (reg), (val))
114 #define PRREAD(sc, reg) bus_space_read_4((sc)->sc_prt, (sc)->sc_prh, (reg))
115 #define PRWRITE(sc, reg, val) bus_space_write_4((sc)->sc_prt, (sc)->sc_prh, (reg), (val))
116
117 #define SIISATA_PRB_SYNC(sc, schp, slot, op) bus_dmamap_sync((sc)->sc_dmat, \
118 (schp)->sch_prbd, slot * SIISATA_CMD_SIZE, SIISATA_CMD_SIZE, (op))
119
120 #define SIISATA_NON_NCQ_SLOT 27
121
122 void siisata_attach(struct siisata_softc *);
123 int siisata_detach(struct siisata_softc *, int);
124 void siisata_resume(struct siisata_softc *);
125 int siisata_intr(void *);
126
127 #endif /* !_IC_SIISATAVAR_H_ */
Cache object: dfd418260cb510f0a59bf19cbffda09c
|