-unmap port range after probe, so that the attach function has
a chance to map it again -minor cleanup
This commit is contained in:
parent
3e9d8d6772
commit
d1506371f5
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: atppc_isa.c,v 1.4 2004/01/25 11:35:46 jdolecek Exp $ */
|
||||
/* $NetBSD: atppc_isa.c,v 1.5 2004/01/28 13:51:16 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Alcove - Nicolas Souchu
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: atppc_isa.c,v 1.4 2004/01/25 11:35:46 jdolecek Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: atppc_isa.c,v 1.5 2004/01/28 13:51:16 drochner Exp $");
|
||||
|
||||
#include "opt_atppc.h"
|
||||
|
||||
|
@ -96,11 +96,12 @@ CFATTACH_DECL(atppc_isa, sizeof(struct atppc_isa_softc), atppc_isa_probe,
|
|||
* lpt_isa_probe() in lpt.c and atppc_detect_port() from FreeBSD's ppc.c.
|
||||
*/
|
||||
static int
|
||||
atppc_isa_probe(struct device * parent, struct cfdata * cf, void * aux)
|
||||
atppc_isa_probe(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
bus_space_handle_t ioh;
|
||||
struct isa_attach_args * ia = aux;
|
||||
struct isa_attach_args *ia = aux;
|
||||
bus_space_tag_t iot = ia->ia_iot;
|
||||
int rval = 0;
|
||||
|
||||
if (ia->ia_nio < 1)
|
||||
return (0);
|
||||
|
@ -112,25 +113,28 @@ atppc_isa_probe(struct device * parent, struct cfdata * cf, void * aux)
|
|||
if (bus_space_map(iot, ia->ia_io[0].ir_addr, IO_LPTSIZE, 0, &ioh))
|
||||
return (0);
|
||||
|
||||
if (atppc_detect_port(iot, ioh) != 0)
|
||||
return (0);
|
||||
if (atppc_detect_port(iot, ioh) == 0)
|
||||
rval = 1;
|
||||
|
||||
ia->ia_nio = 1;
|
||||
ia->ia_io[0].ir_size = IO_LPTSIZE;
|
||||
ia->ia_nirq = 1;
|
||||
ia->ia_ndrq = 1;
|
||||
ia->ia_niomem = 0;
|
||||
bus_space_unmap(iot, ioh, IO_LPTSIZE);
|
||||
|
||||
return (1);
|
||||
if (rval) {
|
||||
ia->ia_nio = 1;
|
||||
ia->ia_io[0].ir_size = IO_LPTSIZE;
|
||||
ia->ia_nirq = 1;
|
||||
ia->ia_ndrq = 1;
|
||||
ia->ia_niomem = 0;
|
||||
}
|
||||
return (rval);
|
||||
}
|
||||
|
||||
/* Attach function: attach and configure parallel port controller on isa bus. */
|
||||
static void
|
||||
atppc_isa_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct atppc_isa_softc * sc = (struct atppc_isa_softc *)self;
|
||||
struct atppc_softc * lsc = (struct atppc_softc *)self;
|
||||
struct isa_attach_args * ia = aux;
|
||||
struct atppc_isa_softc *sc = (struct atppc_isa_softc *)self;
|
||||
struct atppc_softc *lsc = &sc->sc_atppc;
|
||||
struct isa_attach_args *ia = aux;
|
||||
|
||||
printf(": AT Parallel Port\n");
|
||||
|
||||
|
@ -197,45 +201,45 @@ static int
|
|||
atppc_isa_dma_start(struct atppc_softc *lsc, void *buf, u_int nbytes,
|
||||
u_int8_t mode)
|
||||
{
|
||||
struct atppc_isa_softc * sc = (struct atppc_isa_softc *) lsc;
|
||||
struct atppc_isa_softc *sc = (struct atppc_isa_softc *)lsc;
|
||||
|
||||
return atppc_isadma_start(sc->sc_ic, sc->sc_drq, buf, nbytes, mode);
|
||||
}
|
||||
|
||||
/* Stop DMA operation over ISA bus */
|
||||
static int
|
||||
atppc_isa_dma_finish(struct atppc_softc * lsc)
|
||||
atppc_isa_dma_finish(struct atppc_softc *lsc)
|
||||
{
|
||||
struct atppc_isa_softc * sc = (struct atppc_isa_softc *) lsc;
|
||||
struct atppc_isa_softc *sc = (struct atppc_isa_softc *)lsc;
|
||||
|
||||
return atppc_isadma_finish(sc->sc_ic, sc->sc_drq);
|
||||
}
|
||||
|
||||
/* Abort DMA operation over ISA bus */
|
||||
static int
|
||||
atppc_isa_dma_abort(struct atppc_softc * lsc)
|
||||
atppc_isa_dma_abort(struct atppc_softc *lsc)
|
||||
{
|
||||
struct atppc_isa_softc * sc = (struct atppc_isa_softc *) lsc;
|
||||
struct atppc_isa_softc *sc = (struct atppc_isa_softc *)lsc;
|
||||
|
||||
return atppc_isadma_abort(sc->sc_ic, sc->sc_drq);
|
||||
}
|
||||
|
||||
/* Allocate memory for DMA over ISA bus */
|
||||
static int
|
||||
atppc_isa_dma_malloc(struct device * dev, caddr_t * buf, bus_addr_t * bus_addr,
|
||||
atppc_isa_dma_malloc(struct device *dev, caddr_t *buf, bus_addr_t *bus_addr,
|
||||
bus_size_t size)
|
||||
{
|
||||
struct atppc_isa_softc * sc = (struct atppc_isa_softc *) dev;
|
||||
struct atppc_isa_softc *sc = (struct atppc_isa_softc *)dev;
|
||||
|
||||
return atppc_isadma_malloc(sc->sc_ic, sc->sc_drq, buf, bus_addr, size);
|
||||
}
|
||||
|
||||
/* Free memory allocated by atppc_isa_dma_malloc() */
|
||||
static void
|
||||
atppc_isa_dma_free(struct device * dev, caddr_t * buf, bus_addr_t * bus_addr,
|
||||
atppc_isa_dma_free(struct device *dev, caddr_t *buf, bus_addr_t *bus_addr,
|
||||
bus_size_t size)
|
||||
{
|
||||
struct atppc_isa_softc * sc = (struct atppc_isa_softc *) dev;
|
||||
struct atppc_isa_softc *sc = (struct atppc_isa_softc *)dev;
|
||||
|
||||
return atppc_isadma_free(sc->sc_ic, sc->sc_drq, buf, bus_addr, size);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue