Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / ic / siisatavar.h
blob6fb146deec60f90e1335db9b0538def1f997ea02
1 /* $NetBSD: siisatavar.h,v 1.4 2009/07/04 20:36:57 jakllsch Exp $ */
3 /* from ahcisatavar.h */
5 /*
6 * Copyright (c) 2006 Manuel Bouyer.
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.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 /*-
31 * Copyright (c) 2007, 2008, 2009 Jonathan A. Kollasch.
32 * All rights reserved.
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
43 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
44 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
47 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
52 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _IC_SIISATAVAR_H_
57 #define _IC_SIISATAVAR_H_
59 #include <dev/ic/siisatareg.h>
60 #include <dev/ata/atavar.h>
62 #define DEBUG_INTR 0x01
63 #define DEBUG_XFERS 0x02
64 #define DEBUG_FUNCS 0x08
65 #define DEBUG_PROBE 0x10
66 #define DEBUG_DETACH 0x20
67 #define DEBUG_DEBUG 0x80000000
68 #ifdef SIISATA_DEBUG
69 extern int siisata_debug_mask;
70 #define SIISATA_DEBUG_PRINT(args, level) \
71 if (siisata_debug_mask & (level)) \
72 printf args
73 #else
74 #define SIISATA_DEBUG_PRINT(args, level)
75 #endif
77 struct siisata_softc {
78 struct atac_softc sc_atac;
79 bus_space_tag_t sc_grt;
80 bus_space_handle_t sc_grh;
81 bus_size_t sc_grs;
82 bus_space_tag_t sc_prt;
83 bus_space_handle_t sc_prh;
84 bus_size_t sc_prs;
85 bus_dma_tag_t sc_dmat;
87 struct ata_channel *sc_chanarray[SIISATA_MAX_PORTS];
88 struct siisata_channel {
89 struct ata_channel ata_channel;
90 bus_space_handle_t sch_scontrol;
91 bus_space_handle_t sch_sstatus;
92 bus_space_handle_t sch_serror;
94 /* command activation PRBs */
95 bus_dmamap_t sch_prbd;
96 struct siisata_prb *sch_prb[SIISATA_MAX_SLOTS];
97 bus_addr_t sch_bus_prb[SIISATA_MAX_SLOTS];
99 bus_dmamap_t sch_datad[SIISATA_MAX_SLOTS];
101 uint32_t sch_active_slots;
102 } sc_channels[SIISATA_MAX_PORTS];
105 #define SIISATANAME(sc) (device_xname((sc)->sc_atac.atac_dev))
107 #define GRREAD(sc, reg) bus_space_read_4((sc)->sc_grt, (sc)->sc_grh, (reg))
108 #define GRWRITE(sc, reg, val) bus_space_write_4((sc)->sc_grt, (sc)->sc_grh, (reg), (val))
109 #define PRREAD(sc, reg) bus_space_read_4((sc)->sc_prt, (sc)->sc_prh, (reg))
110 #define PRWRITE(sc, reg, val) bus_space_write_4((sc)->sc_prt, (sc)->sc_prh, (reg), (val))
112 #define SIISATA_PRB_SYNC(sc, schp, slot, op) bus_dmamap_sync((sc)->sc_dmat, \
113 (schp)->sch_prbd, slot * SIISATA_CMD_SIZE, SIISATA_CMD_SIZE, (op))
115 #define SIISATA_NON_NCQ_SLOT 27
117 void siisata_attach(struct siisata_softc *);
118 int siisata_detach(struct siisata_softc *, int);
119 void siisata_resume(struct siisata_softc *);
120 int siisata_intr(void *);
122 #endif /* !_IC_SIISATAVAR_H_ */