Make the DMA controller a separate device attached to intio. Intio
devices can use the DMA controller too.
This commit is contained in:
parent
75851dc4ed
commit
85dbe5f6c5
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.88 2002/11/22 12:21:01 wiz Exp $
|
||||
# $NetBSD: GENERIC,v 1.89 2002/12/22 00:17:13 gmcgarry Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
@ -22,7 +22,7 @@ include "arch/hp300/conf/std.hp300"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.88 $"
|
||||
#ident "GENERIC-$Revision: 1.89 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -164,6 +164,7 @@ intio0 at mainbus0 # internal i/o space
|
||||
dio0 at mainbus0 # DIO/DIO-II bus
|
||||
|
||||
rtc* at intio? # real-time clock (not optional)
|
||||
dma* at intio? # DMA controller
|
||||
hil* at intio? # Human Interface Loop
|
||||
options UK_KEYBOARD # include United Kingdom HIL keymap
|
||||
options SE_KEYBOARD # include Swedish HIL keymap
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: INSTALL,v 1.8 2002/09/18 02:43:58 lukem Exp $
|
||||
# $NetBSD: INSTALL,v 1.9 2002/12/22 00:17:14 gmcgarry Exp $
|
||||
#
|
||||
# INSTALL machine description file
|
||||
#
|
||||
@ -121,6 +121,9 @@ dio0 at mainbus0 # DIO/DIO-II bus
|
||||
# Real-time clock (not optional)
|
||||
rtc* at intio?
|
||||
|
||||
# DMA controller
|
||||
dma* at intio?
|
||||
|
||||
# Human Interface Loop
|
||||
hil* at intio?
|
||||
#options UK_KEYBOARD # include United Kingdom HIL keymap
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.hp300,v 1.62 2002/11/05 07:41:18 chs Exp $
|
||||
# $NetBSD: files.hp300,v 1.63 2002/12/22 00:17:14 gmcgarry Exp $
|
||||
#
|
||||
# hp300-specific configuration info
|
||||
|
||||
@ -55,6 +55,11 @@ attach hil at intio
|
||||
file arch/hp300/dev/hil.c hil needs-flag
|
||||
file arch/hp300/dev/hil_keymaps.c hil
|
||||
|
||||
# 98620 DMA controller
|
||||
device dma { }
|
||||
attach dma at intio
|
||||
file arch/hp300/dev/dma.c dma
|
||||
|
||||
# Apollo Utilility Chip (a.k.a. "Frodo") found on 4xx workstations
|
||||
device frodo { offset = -1 }
|
||||
attach frodo at intio
|
||||
@ -130,11 +135,11 @@ file arch/hp300/dev/if_le.c le
|
||||
# HP-IB interfaces
|
||||
define hpibdev { }
|
||||
|
||||
device nhpib: hpibdev
|
||||
device nhpib: hpibdev, dma
|
||||
attach nhpib at dio
|
||||
file arch/hp300/dev/nhpib.c nhpib
|
||||
|
||||
device fhpib: hpibdev
|
||||
device fhpib: hpibdev, dma
|
||||
attach fhpib at dio
|
||||
file arch/hp300/dev/fhpib.c fhpib
|
||||
|
||||
@ -200,7 +205,6 @@ file arch/hp300/hp300/procfs_machdep.c procfs
|
||||
file arch/hp300/hp300/softintr.c
|
||||
file arch/hp300/hp300/trap.c
|
||||
file arch/hp300/hp300/disksubr.c
|
||||
file arch/hp300/dev/dma.c
|
||||
file arch/m68k/m68k/cacheops.c
|
||||
file arch/m68k/m68k/db_memrw.c ddb | kgdb
|
||||
file arch/m68k/m68k/kgdb_machdep.c kgdb
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dio.c,v 1.19 2002/10/02 05:15:49 thorpej Exp $ */
|
||||
/* $NetBSD: dio.c,v 1.20 2002/12/22 00:17:15 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.19 2002/10/02 05:15:49 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.20 2002/12/22 00:17:15 gmcgarry Exp $");
|
||||
|
||||
#define _HP300_INTR_H_PRIVATE
|
||||
|
||||
@ -100,9 +100,9 @@ dioattach(parent, self, aux)
|
||||
caddr_t pa, va;
|
||||
int scode, scmax, didmap, scodesize;
|
||||
|
||||
printf("\n");
|
||||
|
||||
scmax = DIO_SCMAX(machineid);
|
||||
printf(": ");
|
||||
dmainit();
|
||||
|
||||
for (scode = 0; scode < scmax; ) {
|
||||
if (DIO_INHOLE(scode)) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dma.c,v 1.27 2002/10/20 02:37:25 chs Exp $ */
|
||||
/* $NetBSD: dma.c,v 1.28 2002/12/22 00:17:15 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
@ -76,23 +76,22 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.27 2002/10/20 02:37:25 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.28 2002/12/22 00:17:15 gmcgarry Exp $");
|
||||
|
||||
#include <machine/hp300spu.h> /* XXX param.h includes cpu.h */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/frame.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <m68k/cacheops.h>
|
||||
|
||||
#include <hp300/dev/intiovar.h>
|
||||
#include <hp300/dev/dmareg.h>
|
||||
#include <hp300/dev/dmavar.h>
|
||||
|
||||
@ -121,6 +120,10 @@ struct dma_channel {
|
||||
};
|
||||
|
||||
struct dma_softc {
|
||||
struct device sc_dev;
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
|
||||
struct dmareg *sc_dmareg; /* pointer to our hardware */
|
||||
struct dma_channel sc_chan[NDMACHAN]; /* 2 channels */
|
||||
TAILQ_HEAD(, dmaqueue) sc_queue; /* job queue */
|
||||
@ -128,7 +131,7 @@ struct dma_softc {
|
||||
char sc_type; /* A, B, or C */
|
||||
int sc_ipl; /* our interrupt level */
|
||||
void *sc_ih; /* interrupt cookie */
|
||||
} dma_softc;
|
||||
};
|
||||
|
||||
/* types */
|
||||
#define DMA_B 0
|
||||
@ -139,6 +142,12 @@ struct dma_softc {
|
||||
#define DMAF_VCFLUSH 0x02
|
||||
#define DMAF_NOINTR 0x04
|
||||
|
||||
int dmamatch(struct device *, struct cfdata *, void *);
|
||||
void dmaattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(dma, sizeof(struct dma_softc),
|
||||
dmamatch, dmaattach, NULL, NULL);
|
||||
|
||||
int dmaintr __P((void *));
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -158,21 +167,50 @@ long dmaword[NDMACHAN];
|
||||
long dmalword[NDMACHAN];
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the DMA engine, called by dioattach()
|
||||
*/
|
||||
void
|
||||
dmainit()
|
||||
static struct dma_softc *dma_softc;
|
||||
|
||||
int
|
||||
dmamatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct dma_softc *sc = &dma_softc;
|
||||
struct dmareg *dma;
|
||||
struct intio_attach_args *ia = aux;
|
||||
static int dmafound = 0; /* can only have one */
|
||||
|
||||
if (strcmp("dma", ia->ia_modname) != 0 || dmafound)
|
||||
return (0);
|
||||
|
||||
dmafound = 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
dmaattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct dma_softc *sc = (struct dma_softc *)self;
|
||||
struct intio_attach_args *ia = aux;
|
||||
struct dma_channel *dc;
|
||||
struct dmareg *dma;
|
||||
int i;
|
||||
char rev;
|
||||
|
||||
/* There's just one. */
|
||||
sc->sc_dmareg = (struct dmareg *)DMA_BASE;
|
||||
dma = sc->sc_dmareg;
|
||||
dma_softc = sc;
|
||||
|
||||
sc->sc_bst = ia->ia_bst;
|
||||
if (bus_space_map(sc->sc_bst, ia->ia_iobase, INTIO_DEVSIZE, 0,
|
||||
&sc->sc_bsh)) {
|
||||
printf("%s: can't map registers\n", sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
dma = (struct dmareg *)bus_space_vaddr(sc->sc_bst, sc->sc_bsh);
|
||||
sc->sc_dmareg = dma;
|
||||
|
||||
/*
|
||||
* Determine the DMA type. A DMA_A or DMA_B will fail the
|
||||
@ -220,7 +258,7 @@ dmainit()
|
||||
callout_reset(&sc->sc_debug_ch, 30 * hz, dmatimeout, sc);
|
||||
#endif
|
||||
|
||||
printf("98620%c, 2 channels, %d bit DMA\n",
|
||||
printf(": 98620%c, 2 channels, %d-bit DMA\n",
|
||||
rev, (rev == 'B') ? 16 : 32);
|
||||
|
||||
/*
|
||||
@ -237,7 +275,7 @@ dmainit()
|
||||
void
|
||||
dmacomputeipl()
|
||||
{
|
||||
struct dma_softc *sc = &dma_softc;
|
||||
struct dma_softc *sc = dma_softc;
|
||||
|
||||
if (sc->sc_ih != NULL)
|
||||
intr_disestablish(sc->sc_ih);
|
||||
@ -254,7 +292,7 @@ int
|
||||
dmareq(dq)
|
||||
struct dmaqueue *dq;
|
||||
{
|
||||
struct dma_softc *sc = &dma_softc;
|
||||
struct dma_softc *sc = dma_softc;
|
||||
int i, chan, s;
|
||||
|
||||
#if 1
|
||||
@ -299,7 +337,7 @@ dmafree(dq)
|
||||
struct dmaqueue *dq;
|
||||
{
|
||||
int unit = dq->dq_chan;
|
||||
struct dma_softc *sc = &dma_softc;
|
||||
struct dma_softc *sc = dma_softc;
|
||||
struct dma_channel *dc = &sc->sc_chan[unit];
|
||||
struct dmaqueue *dn;
|
||||
int chan, s;
|
||||
@ -372,7 +410,7 @@ dmago(unit, addr, count, flags)
|
||||
int count;
|
||||
int flags;
|
||||
{
|
||||
struct dma_softc *sc = &dma_softc;
|
||||
struct dma_softc *sc = dma_softc;
|
||||
struct dma_channel *dc = &sc->sc_chan[unit];
|
||||
char *dmaend = NULL;
|
||||
int seg, tcount;
|
||||
@ -516,7 +554,7 @@ void
|
||||
dmastop(unit)
|
||||
int unit;
|
||||
{
|
||||
struct dma_softc *sc = &dma_softc;
|
||||
struct dma_softc *sc = dma_softc;
|
||||
struct dma_channel *dc = &sc->sc_chan[unit];
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: intio.c,v 1.12 2002/10/02 05:15:53 thorpej Exp $ */
|
||||
/* $NetBSD: intio.c,v 1.13 2002/12/22 00:17:15 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.12 2002/10/02 05:15:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.13 2002/12/22 00:17:15 gmcgarry Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -65,6 +65,7 @@ CFATTACH_DECL(intio, sizeof(struct device),
|
||||
const struct intio_builtins intio_3xx_builtins[] = {
|
||||
{ "rtc", 0x020000, -1},
|
||||
{ "hil", 0x028000, 1},
|
||||
{ "dma", 0x100000, 1},
|
||||
{ "fb", 0x160000, -1},
|
||||
};
|
||||
#define nintio_3xx_builtins \
|
||||
@ -76,6 +77,7 @@ const struct intio_builtins intio_4xx_builtins[] = {
|
||||
{ "rtc", 0x020000, -1},
|
||||
{ "frodo", 0x01c000, 5},
|
||||
{ "hil", 0x028000, 1},
|
||||
{ "dma", 0x100000, 1},
|
||||
};
|
||||
#define nintio_4xx_builtins \
|
||||
(sizeof(intio_4xx_builtins) / sizeof(intio_4xx_builtins[0]))
|
||||
|
Loading…
Reference in New Issue
Block a user