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