2005-11-16 03:49:02 +03:00
|
|
|
/* $NetBSD: dma_obio.c,v 1.9 2005/11/16 00:49:03 uwe Exp $ */
|
1994-11-20 23:51:32 +03:00
|
|
|
|
1997-10-05 22:15:51 +04:00
|
|
|
/*-
|
1998-08-30 00:49:35 +04:00
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
1997-02-27 04:16:19 +03:00
|
|
|
* All rights reserved.
|
1996-09-28 05:49:06 +04:00
|
|
|
*
|
1997-10-05 22:15:51 +04:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
1998-08-30 00:49:35 +04:00
|
|
|
* by Paul Kranenburg.
|
1997-10-05 22:15:51 +04:00
|
|
|
*
|
1994-09-18 03:48:32 +04:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
1998-08-30 00:49:35 +04:00
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
1997-10-05 22:15:51 +04:00
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
1994-09-18 03:48:32 +04:00
|
|
|
*
|
1997-10-05 22:15:51 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
1994-09-18 03:48:32 +04:00
|
|
|
*/
|
|
|
|
|
2003-07-15 04:04:39 +04:00
|
|
|
#include <sys/cdefs.h>
|
2005-11-16 03:49:02 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: dma_obio.c,v 1.9 2005/11/16 00:49:03 uwe Exp $");
|
2003-07-15 04:04:39 +04:00
|
|
|
|
1998-08-30 00:49:35 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/malloc.h>
|
1997-02-27 04:16:19 +03:00
|
|
|
|
1998-08-30 00:49:35 +04:00
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/autoconf.h>
|
|
|
|
#include <machine/cpu.h>
|
1994-09-18 03:48:32 +04:00
|
|
|
|
1998-08-30 00:49:35 +04:00
|
|
|
#include <dev/sbus/sbusvar.h>
|
|
|
|
|
|
|
|
#include <dev/ic/lsi64854reg.h>
|
|
|
|
#include <dev/ic/lsi64854var.h>
|
|
|
|
|
2005-11-16 03:49:02 +03:00
|
|
|
int dmamatch_obio(struct device *, struct cfdata *, void *);
|
|
|
|
void dmaattach_obio(struct device *, struct device *, void *);
|
1998-08-30 00:49:35 +04:00
|
|
|
|
2002-10-01 22:57:48 +04:00
|
|
|
CFATTACH_DECL(dma_obio, sizeof(struct lsi64854_softc),
|
2002-10-02 20:02:08 +04:00
|
|
|
dmamatch_obio, dmaattach_obio, NULL, NULL);
|
1994-09-18 03:48:32 +04:00
|
|
|
|
1998-08-30 00:49:35 +04:00
|
|
|
int
|
2005-11-16 03:49:02 +03:00
|
|
|
dmamatch_obio(struct device *parent, struct cfdata *cf, void *aux)
|
1998-08-30 00:49:35 +04:00
|
|
|
{
|
|
|
|
union obio_attach_args *uoba = aux;
|
|
|
|
struct obio4_attach_args *oba;
|
|
|
|
|
|
|
|
if (uoba->uoba_isobio4 == 0)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
oba = &uoba->uoba_oba4;
|
2002-03-11 19:27:01 +03:00
|
|
|
return (bus_space_probe(oba->oba_bustag, oba->oba_paddr,
|
1998-08-30 00:49:35 +04:00
|
|
|
4, /* probe size */
|
|
|
|
0, /* offset */
|
|
|
|
0, /* flags */
|
|
|
|
NULL, NULL));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-11-16 03:49:02 +03:00
|
|
|
dmaattach_obio(struct device *parent, struct device *self, void *aux)
|
1998-08-30 00:49:35 +04:00
|
|
|
{
|
|
|
|
union obio_attach_args *uoba = aux;
|
|
|
|
struct obio4_attach_args *oba = &uoba->uoba_oba4;
|
|
|
|
struct lsi64854_softc *sc = (void *)self;
|
|
|
|
|
|
|
|
sc->sc_bustag = oba->oba_bustag;
|
|
|
|
sc->sc_dmatag = oba->oba_dmatag;
|
|
|
|
|
2002-03-11 19:27:01 +03:00
|
|
|
if (bus_space_map(oba->oba_bustag, oba->oba_paddr,
|
2005-11-16 03:49:02 +03:00
|
|
|
4 * sizeof(uint32_t),
|
2002-03-11 19:27:01 +03:00
|
|
|
0, &sc->sc_regs) != 0) {
|
1998-08-30 00:49:35 +04:00
|
|
|
printf("dmaattach_obio: cannot map registers\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-04-13 03:01:00 +04:00
|
|
|
/* Any point in setting `sc_burst' to anything here? */
|
|
|
|
sc->sc_channel = L64854_CHANNEL_SCSI;
|
1998-08-30 00:49:35 +04:00
|
|
|
lsi64854_attach(sc);
|
|
|
|
}
|