From 2666c578a6cecf647431d1e3a8388ce820123f4b Mon Sep 17 00:00:00 2001 From: Jason Downs Date: Thu, 25 Dec 1997 12:06:50 +0000 Subject: Real DRQ usage tracking. --- sys/dev/isa/isa.c | 10 +++++++--- sys/dev/isa/isadma.c | 16 +--------------- sys/dev/isa/isadmavar.h | 3 +-- sys/dev/isa/isapnp.c | 4 ++-- sys/dev/isa/isavar.h | 14 +++++++++++++- 5 files changed, 24 insertions(+), 23 deletions(-) (limited to 'sys') diff --git a/sys/dev/isa/isa.c b/sys/dev/isa/isa.c index 057ac452207..3d7516f46d7 100644 --- a/sys/dev/isa/isa.c +++ b/sys/dev/isa/isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isa.c,v 1.23 1997/12/21 14:41:23 downsj Exp $ */ +/* $OpenBSD: isa.c,v 1.24 1997/12/25 12:06:47 downsj Exp $ */ /* $NetBSD: isa.c,v 1.85 1996/05/14 00:31:04 thorpej Exp $ */ /*- @@ -152,14 +152,18 @@ isascan(parent, match) config_attach(parent, dev, &ia2, isaprint); dev = config_make_softc(parent, cf); ia2 = ia; + + isa_drq_alloc(sc, ia.ia_drq); } free(dev, M_DEVBUF); return; } - if ((*cf->cf_attach->ca_match)(parent, dev, &ia) > 0) + if ((*cf->cf_attach->ca_match)(parent, dev, &ia) > 0) { config_attach(parent, dev, &ia, isaprint); - else + + isa_drq_alloc(sc, ia.ia_drq); + } else free(dev, M_DEVBUF); } diff --git a/sys/dev/isa/isadma.c b/sys/dev/isa/isadma.c index 8d854b4b381..141323ed8c8 100644 --- a/sys/dev/isa/isadma.c +++ b/sys/dev/isa/isadma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isadma.c,v 1.15 1997/12/21 14:41:23 downsj Exp $ */ +/* $OpenBSD: isadma.c,v 1.16 1997/12/25 12:06:47 downsj Exp $ */ /* $NetBSD: isadma.c,v 1.19 1996/04/29 20:03:26 christos Exp $ */ #include @@ -128,20 +128,6 @@ isadma_release(chan) di->inuse = 0; } -int -isadma_isdrqfree(chan) - int chan; -{ - struct dma_info *di; -#ifdef DIAGNOSTIC - if (chan < 0 || chan > 7) - panic("isadma_release: channel out of range"); -#endif - di = dma_info + chan; - - return (di->inuse); -} - /* * isadma_cascade(): program 8237 DMA controller channel to accept * external dma control by a board. diff --git a/sys/dev/isa/isadmavar.h b/sys/dev/isa/isadmavar.h index 9e424edc959..3e8a153632b 100644 --- a/sys/dev/isa/isadmavar.h +++ b/sys/dev/isa/isadmavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isadmavar.h,v 1.9 1997/12/21 14:41:24 downsj Exp $ */ +/* $OpenBSD: isadmavar.h,v 1.10 1997/12/25 12:06:48 downsj Exp $ */ /* $NetBSD: isadmavar.h,v 1.4 1996/03/01 04:08:46 mycroft Exp $ */ #define DMAMODE_WRITE 0 @@ -26,7 +26,6 @@ void isadma_copyfrombuf __P((caddr_t, vm_size_t, int, struct isadma_seg *)); int isadma_acquire __P((int)); void isadma_release __P((int)); -int isadma_isdrqfree __P((int)); void isadma_cascade __P((int)); void isadma_start __P((caddr_t, vm_size_t, int, int)); void isadma_abort __P((int)); diff --git a/sys/dev/isa/isapnp.c b/sys/dev/isa/isapnp.c index 5c888ce9f15..016d737a72d 100644 --- a/sys/dev/isa/isapnp.c +++ b/sys/dev/isa/isapnp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isapnp.c,v 1.13 1997/12/25 09:22:38 downsj Exp $ */ +/* $OpenBSD: isapnp.c,v 1.14 1997/12/25 12:06:48 downsj Exp $ */ /* $NetBSD: isapnp.c,v 1.9.4.3 1997/10/29 00:40:43 thorpej Exp $ */ /* @@ -270,7 +270,7 @@ isapnp_alloc_drq(isa, i) } for (b = 0; b < 16; b++) - if ((i->bits & (1 << b)) && isadma_isdrqfree(b)) { + if ((i->bits & (1 << b)) && isa_drq_isfree(isa, b)) { i->num = b; return 0; } diff --git a/sys/dev/isa/isavar.h b/sys/dev/isa/isavar.h index dfa2b092e9c..40123a5a2b7 100644 --- a/sys/dev/isa/isavar.h +++ b/sys/dev/isa/isavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isavar.h,v 1.24 1997/12/25 09:22:44 downsj Exp $ */ +/* $OpenBSD: isavar.h,v 1.25 1997/12/25 12:06:49 downsj Exp $ */ /* $NetBSD: isavar.h,v 1.24 1996/10/21 22:41:11 thorpej Exp $ */ /* $NetBSD: isapnpvar.h,v 1.5.4.2 1997/10/29 00:40:49 thorpej Exp $ */ @@ -282,8 +282,20 @@ struct isa_softc { * via isa_attach_args. */ bus_space_handle_t sc_delaybah; + + int8_t sc_drq; /* DRQ usage tracking */ }; +/* + * Macros for sc_drq access. + */ +#define isa_drq_alloc(_sc, _drq) \ + (((struct isa_softc *)(_sc))->sc_drq |= (1 << (_drq))) +#define isa_drq_free(_sc, _drq) \ + (((struct isa_softc *)(_sc))->sc_drq &= ~(1 << (_drq))) +#define isa_drq_isfree(_sc, _drq) \ + !((((struct isa_softc *)(_sc))->sc_drq << (_drq)) & 1) + #define cf_iobase cf_loc[0] #define cf_iosize cf_loc[1] #define cf_maddr cf_loc[2] -- cgit v1.2.3