diff options
author | non <non@FreeBSD.org> | 2001-02-25 14:01:05 +0000 |
---|---|---|
committer | non <non@FreeBSD.org> | 2001-02-25 14:01:05 +0000 |
commit | 616fd772d1ff52f7be49c8c668a6095fa8cdf0cf (patch) | |
tree | 332cc2d84a65b699a0e79409eeebdbd2cfcc8478 /sys/dev/nsp | |
parent | 69c64365e594d4895efab2beaf9a1c9d32081733 (diff) | |
download | FreeBSD-src-616fd772d1ff52f7be49c8c668a6095fa8cdf0cf.zip FreeBSD-src-616fd772d1ff52f7be49c8c668a6095fa8cdf0cf.tar.gz |
o Check the size of I/O window handed by parent bus.
o Check if it is in PIO_MODE when memory window is not handed.
Diffstat (limited to 'sys/dev/nsp')
-rw-r--r-- | sys/dev/nsp/nsp_pccard.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/nsp/nsp_pccard.c b/sys/dev/nsp/nsp_pccard.c index 2603ceb..afc3be2 100644 --- a/sys/dev/nsp/nsp_pccard.c +++ b/sys/dev/nsp/nsp_pccard.c @@ -134,12 +134,16 @@ static int nsp_alloc_resource(DEVPORT_PDEVICE dev) { struct nsp_softc *sc = device_get_softc(dev); - u_long maddr, msize; + u_long ioaddr, iosize, maddr, msize; int error; + error = bus_get_resource(dev, SYS_RES_IOPORT, 0, &ioaddr, &iosize); + if (error || iosize < NSP_IOSIZE) + return(ENOMEM); + sc->port_rid = 0; sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, - 0, ~0, NSP_IOSIZE,RF_ACTIVE); + 0, ~0, 0, RF_ACTIVE); if (sc->port_res == NULL) { nsp_release_resource(dev); return(ENOMEM); @@ -153,18 +157,19 @@ nsp_alloc_resource(DEVPORT_PDEVICE dev) return(ENOMEM); } - /* no need to allocate memory if PIO mode */ - if ((DEVPORT_PDEVFLAGS(dev) & PIO_MODE) != 0) { - return(0); - } - error = bus_get_resource(dev, SYS_RES_MEMORY, 0, &maddr, &msize); if (error) { return(0); /* XXX */ } - /* no need to allocate memory if not configured */ + /* No need to allocate memory if not configured and it's in PIO mode */ if (maddr == 0 || msize == 0) { + if ((DEVPORT_PDEVFLAGS(dev) & PIO_MODE) == 0) { + printf("Memory window was not configured. Configure or use in PIO mode."); + nsp_release_resource(dev); + return(ENOMEM); + } + /* no need to allocate memory if PIO mode */ return(0); } |