1/* $OpenBSD: dma_sbus.c,v 1.12 2005/03/03 01:41:45 miod Exp $ */
2/* $NetBSD: dma_sbus.c,v 1.5 2000/07/09 20:57:42 pk Exp $ */
3
4/*-
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
--- 49 unchanged lines hidden (view full) ---
58 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 */
64
65#include <sys/cdefs.h>
66__FBSDID("$FreeBSD: head/sys/sparc64/sbus/dma_sbus.c 155067 2006-01-30 21:43:14Z marius $");
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/bus.h>
71#include <sys/kernel.h>
72#include <sys/module.h>
73#include <sys/resource.h>
74#include <sys/rman.h>
--- 33 unchanged lines hidden (view full) ---
108static ofw_bus_get_devinfo_t dma_get_devinfo;
109
110static struct dma_devinfo *dma_setup_dinfo(device_t, struct dma_softc *,
111 phandle_t);
112static void dma_destroy_dinfo(struct dma_devinfo *);
113static int dma_print_res(struct dma_devinfo *);
114
115static device_method_t dma_methods[] = {
116 /* Device interface */
117 DEVMETHOD(device_probe, dma_probe),
118 DEVMETHOD(device_attach, dma_attach),
119 DEVMETHOD(device_shutdown, bus_generic_shutdown),
120 DEVMETHOD(device_suspend, bus_generic_suspend),
121 DEVMETHOD(device_resume, bus_generic_resume),
122
123 /* Bus interface */
124 DEVMETHOD(bus_print_child, dma_print_child),
--- 29 unchanged lines hidden (view full) ---
154static int
155dma_probe(device_t dev)
156{
157 const char *name;
158
159 name = ofw_bus_get_name(dev);
160 if (strcmp(name, "espdma") == 0 || strcmp(name, "dma") == 0 ||
161 strcmp(name, "ledma") == 0) {
162 device_set_desc_copy(dev, name);
163 return (0);
164 }
165 return (ENXIO);
166}
167
168static int
169dma_attach(device_t dev)
170{
171 struct dma_softc *dsc;
172 struct lsi64854_softc *lsc;
173 struct dma_devinfo *ddi;
--- 49 unchanged lines hidden (view full) ---
223 lsc->sc_channel = L64854_CHANNEL_ENET;
224 } else {
225 device_printf(dev, "unsupported DMA channel\n");
226 error = ENXIO;
227 goto fail_lres;
228 }
229
230 error = bus_dma_tag_create(
231 NULL, /* parent */
232 PAGE_SIZE, 0, /* alignment, boundary */
233 BUS_SPACE_MAXADDR, /* lowaddr */
234 BUS_SPACE_MAXADDR, /* highaddr */
235 NULL, NULL, /* filter, filterarg */
236 BUS_SPACE_MAXSIZE_32BIT, /* maxsize */
237 0, /* nsegments */
238 BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
239 0, /* flags */
240 NULL, NULL, /* no locking */
--- 182 unchanged lines hidden ---
2/* $NetBSD: dma_sbus.c,v 1.5 2000/07/09 20:57:42 pk Exp $ */
3
4/*-
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
--- 49 unchanged lines hidden (view full) ---
58 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 */
64
65#include <sys/cdefs.h>
66__FBSDID("$FreeBSD: head/sys/sparc64/sbus/dma_sbus.c 155067 2006-01-30 21:43:14Z marius $");
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/bus.h>
71#include <sys/kernel.h>
72#include <sys/module.h>
73#include <sys/resource.h>
74#include <sys/rman.h>
--- 33 unchanged lines hidden (view full) ---
108static ofw_bus_get_devinfo_t dma_get_devinfo;
109
110static struct dma_devinfo *dma_setup_dinfo(device_t, struct dma_softc *,
111 phandle_t);
112static void dma_destroy_dinfo(struct dma_devinfo *);
113static int dma_print_res(struct dma_devinfo *);
114
115static device_method_t dma_methods[] = {
116 /* Device interface */
117 DEVMETHOD(device_probe, dma_probe),
118 DEVMETHOD(device_attach, dma_attach),
119 DEVMETHOD(device_shutdown, bus_generic_shutdown),
120 DEVMETHOD(device_suspend, bus_generic_suspend),
121 DEVMETHOD(device_resume, bus_generic_resume),
122
123 /* Bus interface */
124 DEVMETHOD(bus_print_child, dma_print_child),
--- 29 unchanged lines hidden (view full) ---
154static int
155dma_probe(device_t dev)
156{
157 const char *name;
158
159 name = ofw_bus_get_name(dev);
160 if (strcmp(name, "espdma") == 0 || strcmp(name, "dma") == 0 ||
161 strcmp(name, "ledma") == 0) {
162 device_set_desc_copy(dev, name);
163 return (0);
164 }
165 return (ENXIO);
166}
167
168static int
169dma_attach(device_t dev)
170{
171 struct dma_softc *dsc;
172 struct lsi64854_softc *lsc;
173 struct dma_devinfo *ddi;
--- 49 unchanged lines hidden (view full) ---
223 lsc->sc_channel = L64854_CHANNEL_ENET;
224 } else {
225 device_printf(dev, "unsupported DMA channel\n");
226 error = ENXIO;
227 goto fail_lres;
228 }
229
230 error = bus_dma_tag_create(
231 NULL, /* parent */
232 PAGE_SIZE, 0, /* alignment, boundary */
233 BUS_SPACE_MAXADDR, /* lowaddr */
234 BUS_SPACE_MAXADDR, /* highaddr */
235 NULL, NULL, /* filter, filterarg */
236 BUS_SPACE_MAXSIZE_32BIT, /* maxsize */
237 0, /* nsegments */
238 BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
239 0, /* flags */
240 NULL, NULL, /* no locking */
--- 182 unchanged lines hidden ---