| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rmixl_obio.c,v 1.1.2.7 2009/11/18 01:14:49 cliff Exp $ */ | | 1 | /* $NetBSD: rmixl_obio.c,v 1.1.2.8 2009/12/14 07:18:26 cliff Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. | | 4 | * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. | | 7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -30,27 +30,27 @@ | | | @@ -30,27 +30,27 @@ |
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
35 | * POSSIBILITY OF SUCH DAMAGE. | | 35 | * POSSIBILITY OF SUCH DAMAGE. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | /* | | 38 | /* |
39 | * On-board device autoconfiguration support for RMI {XLP, XLR, XLS} chips | | 39 | * On-board device autoconfiguration support for RMI {XLP, XLR, XLS} chips |
40 | */ | | 40 | */ |
41 | | | 41 | |
42 | #include <sys/cdefs.h> | | 42 | #include <sys/cdefs.h> |
43 | __KERNEL_RCSID(0, "$NetBSD: rmixl_obio.c,v 1.1.2.7 2009/11/18 01:14:49 cliff Exp $"); | | 43 | __KERNEL_RCSID(0, "$NetBSD: rmixl_obio.c,v 1.1.2.8 2009/12/14 07:18:26 cliff Exp $"); |
44 | | | 44 | |
45 | #include "locators.h" | | 45 | #include "locators.h" |
46 | #include "obio.h" | | 46 | #include "obio.h" |
47 | #include "pci.h" | | 47 | #include "pci.h" |
48 | | | 48 | |
49 | #include <sys/param.h> | | 49 | #include <sys/param.h> |
50 | #include <sys/systm.h> | | 50 | #include <sys/systm.h> |
51 | #include <sys/device.h> | | 51 | #include <sys/device.h> |
52 | #include <sys/extent.h> | | 52 | #include <sys/extent.h> |
53 | #include <sys/malloc.h> | | 53 | #include <sys/malloc.h> |
54 | | | 54 | |
55 | #define _MIPS_BUS_DMA_PRIVATE | | 55 | #define _MIPS_BUS_DMA_PRIVATE |
56 | #include <machine/bus.h> | | 56 | #include <machine/bus.h> |
| @@ -131,70 +131,76 @@ obio_print(void *aux, const char *pnp) | | | @@ -131,70 +131,76 @@ obio_print(void *aux, const char *pnp) |
131 | aprint_normal(" mult %d", obio->obio_mult); | | 131 | aprint_normal(" mult %d", obio->obio_mult); |
132 | if (obio->obio_intr != OBIOCF_INTR_DEFAULT) | | 132 | if (obio->obio_intr != OBIOCF_INTR_DEFAULT) |
133 | aprint_normal(" intr %d", obio->obio_intr); | | 133 | aprint_normal(" intr %d", obio->obio_intr); |
134 | | | 134 | |
135 | return (UNCONF); | | 135 | return (UNCONF); |
136 | } | | 136 | } |
137 | | | 137 | |
138 | static int | | 138 | static int |
139 | obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) | | 139 | obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) |
140 | { | | 140 | { |
141 | struct obio_softc *sc = device_private(parent); | | 141 | struct obio_softc *sc = device_private(parent); |
142 | struct obio_attach_args obio; | | 142 | struct obio_attach_args obio; |
143 | | | 143 | |
144 | obio.obio_bst = sc->sc_bst; | | 144 | obio.obio_eb_bst = sc->sc_eb_bst; |
| | | 145 | obio.obio_el_bst = sc->sc_el_bst; |
145 | obio.obio_addr = cf->cf_loc[OBIOCF_ADDR]; | | 146 | obio.obio_addr = cf->cf_loc[OBIOCF_ADDR]; |
146 | obio.obio_size = cf->cf_loc[OBIOCF_SIZE]; | | 147 | obio.obio_size = cf->cf_loc[OBIOCF_SIZE]; |
147 | obio.obio_mult = cf->cf_loc[OBIOCF_MULT]; | | 148 | obio.obio_mult = cf->cf_loc[OBIOCF_MULT]; |
148 | obio.obio_intr = cf->cf_loc[OBIOCF_INTR]; | | 149 | obio.obio_intr = cf->cf_loc[OBIOCF_INTR]; |
149 | obio.obio_29bit_dmat = sc->sc_29bit_dmat; | | 150 | obio.obio_29bit_dmat = sc->sc_29bit_dmat; |
150 | obio.obio_32bit_dmat = sc->sc_32bit_dmat; | | 151 | obio.obio_32bit_dmat = sc->sc_32bit_dmat; |
151 | obio.obio_64bit_dmat = sc->sc_64bit_dmat; | | 152 | obio.obio_64bit_dmat = sc->sc_64bit_dmat; |
152 | | | 153 | |
153 | if (config_match(parent, cf, &obio) > 0) | | 154 | if (config_match(parent, cf, &obio) > 0) |
154 | config_attach(parent, cf, &obio, obio_print); | | 155 | config_attach(parent, cf, &obio, obio_print); |
155 | | | 156 | |
156 | return 0; | | 157 | return 0; |
157 | } | | 158 | } |
158 | | | 159 | |
159 | static void | | 160 | static void |
160 | obio_bus_init(struct obio_softc *sc) | | 161 | obio_bus_init(struct obio_softc *sc) |
161 | { | | 162 | { |
162 | struct rmixl_config *rcp = &rmixl_configuration; | | 163 | struct rmixl_config *rcp = &rmixl_configuration; |
163 | static int done = 0; | | 164 | static int done = 0; |
164 | | | 165 | |
165 | if (done) | | 166 | if (done) |
166 | return; | | 167 | return; |
167 | done = 1; | | 168 | done = 1; |
168 | | | 169 | |
169 | /* obio (devio) space */ | | 170 | /* obio (devio) space, Big Endian */ |
170 | if (rcp->rc_obio_memt.bs_cookie == 0) | | 171 | if (rcp->rc_obio_eb_memt.bs_cookie == 0) |
171 | rmixl_obio_bus_mem_init(&rcp->rc_obio_memt, rcp); | | 172 | rmixl_obio_eb_bus_mem_init(&rcp->rc_obio_eb_memt, rcp); |
| | | 173 | |
| | | 174 | /* obio (devio) space, Little Endian */ |
| | | 175 | if (rcp->rc_obio_el_memt.bs_cookie == 0) |
| | | 176 | rmixl_obio_el_bus_mem_init(&rcp->rc_obio_el_memt, rcp); |
172 | | | 177 | |
173 | /* dma space for addr < 512MB */ | | 178 | /* dma space for addr < 512MB */ |
174 | if (rcp->rc_29bit_dmat._cookie == 0) | | 179 | if (rcp->rc_29bit_dmat._cookie == 0) |
175 | obio_dma_init_29(&rcp->rc_29bit_dmat); | | 180 | obio_dma_init_29(&rcp->rc_29bit_dmat); |
176 | #ifdef NOTYET | | 181 | #ifdef NOTYET |
177 | /* dma space for addr < 4GB */ | | 182 | /* dma space for addr < 4GB */ |
178 | if (rcp->rc_32bit_dmat._cookie == 0) | | 183 | if (rcp->rc_32bit_dmat._cookie == 0) |
179 | obio_dma_init_32(&rcp->rc_32bit_dmat); | | 184 | obio_dma_init_32(&rcp->rc_32bit_dmat); |
180 | /* dma space for all memory, including >= 4GB */ | | 185 | /* dma space for all memory, including >= 4GB */ |
181 | if (rcp->rc_64bit_dmat._cookie == 0) | | 186 | if (rcp->rc_64bit_dmat._cookie == 0) |
182 | obio_dma_init_64(&rcp->rc_64bit_dmat); | | 187 | obio_dma_init_64(&rcp->rc_64bit_dmat); |
183 | #endif | | 188 | #endif |
184 | | | 189 | |
185 | sc->sc_base = (bus_addr_t)rcp->rc_io_pbase; | | 190 | sc->sc_base = (bus_addr_t)rcp->rc_io_pbase; |
186 | sc->sc_size = (bus_size_t)RMIXL_IO_DEV_SIZE; | | 191 | sc->sc_size = (bus_size_t)RMIXL_IO_DEV_SIZE; |
187 | sc->sc_bst = (bus_space_tag_t)&rcp->rc_obio_memt; | | 192 | sc->sc_eb_bst = (bus_space_tag_t)&rcp->rc_obio_eb_memt; |
| | | 193 | sc->sc_el_bst = (bus_space_tag_t)&rcp->rc_obio_el_memt; |
188 | sc->sc_29bit_dmat = &rcp->rc_29bit_dmat; | | 194 | sc->sc_29bit_dmat = &rcp->rc_29bit_dmat; |
189 | #ifdef NOTYET | | 195 | #ifdef NOTYET |
190 | sc->sc_32bit_dmat = &rcp->rc_32bit_dmat; | | 196 | sc->sc_32bit_dmat = &rcp->rc_32bit_dmat; |
191 | sc->sc_64bit_dmat = &rcp->rc_64bit_dmat; | | 197 | sc->sc_64bit_dmat = &rcp->rc_64bit_dmat; |
192 | #else | | 198 | #else |
193 | sc->sc_32bit_dmat = NULL; | | 199 | sc->sc_32bit_dmat = NULL; |
194 | sc->sc_64bit_dmat = NULL; | | 200 | sc->sc_64bit_dmat = NULL; |
195 | #endif | | 201 | #endif |
196 | } | | 202 | } |
197 | | | 203 | |
198 | static void | | 204 | static void |
199 | obio_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, | | 205 | obio_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, |
200 | bus_size_t len, int ops) | | 206 | bus_size_t len, int ops) |