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