summaryrefslogtreecommitdiffstats
path: root/sys/dev/stg/tmc18c30_pccard.c
diff options
context:
space:
mode:
authornon <non@FreeBSD.org>2001-02-25 14:01:46 +0000
committernon <non@FreeBSD.org>2001-02-25 14:01:46 +0000
commit2f2e24d1af024d942727a0a6dcb0404968a4f1b0 (patch)
treea99e7cc265edb75318eb35ffb039248826785a2c /sys/dev/stg/tmc18c30_pccard.c
parent616fd772d1ff52f7be49c8c668a6095fa8cdf0cf (diff)
downloadFreeBSD-src-2f2e24d1af024d942727a0a6dcb0404968a4f1b0.zip
FreeBSD-src-2f2e24d1af024d942727a0a6dcb0404968a4f1b0.tar.gz
o Check the size of I/O window handed by parent bus.
Diffstat (limited to 'sys/dev/stg/tmc18c30_pccard.c')
-rw-r--r--sys/dev/stg/tmc18c30_pccard.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/stg/tmc18c30_pccard.c b/sys/dev/stg/tmc18c30_pccard.c
index 7798b48..fb3cd0d 100644
--- a/sys/dev/stg/tmc18c30_pccard.c
+++ b/sys/dev/stg/tmc18c30_pccard.c
@@ -138,12 +138,17 @@ static int
stg_alloc_resource(DEVPORT_PDEVICE dev)
{
struct stg_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 < STGIOSZ) {
+ return(ENOMEM);
+ }
+
sc->port_rid = 0;
sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid,
- 0, ~0, STGIOSZ, RF_ACTIVE);
+ 0, ~0, 0, RF_ACTIVE);
if (sc->port_res == NULL) {
stg_release_resource(dev);
return(ENOMEM);
OpenPOWER on IntegriCloud