summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-02-18 17:35:03 +0000
committerimp <imp@FreeBSD.org>2005-02-18 17:35:03 +0000
commitbae04706aeb81e31b15d2472626ff950be3e0392 (patch)
treeec71010ed2ddb61ab7359938e234cdffd8435b7d /sys/dev/pci
parenteebf9afbbaa0fc68ff9231510190b60736f0670e (diff)
downloadFreeBSD-src-bae04706aeb81e31b15d2472626ff950be3e0392.zip
FreeBSD-src-bae04706aeb81e31b15d2472626ff950be3e0392.tar.gz
For the I/O port case, we need to set ok to 1 if we have what looks
like a valid range. We already do this in the memory case (although the code there is somewhat different than the I/o case because we have to deal with different kinds of memory). Since most laptops don't have non-subtractive bridges, this wasn't seen in practice. Evidentally the Compaq R3000 hits this problem with PC Cards. Some minor style fixes while I'm here. Submitted by: Jung-uk Kim
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pci_pci.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 43114d7..c246542 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -299,7 +299,7 @@ pcib_is_io_open(struct pcib_softc *sc)
*/
struct resource *
pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
- u_long start, u_long end, u_long count, u_int flags)
+ u_long start, u_long end, u_long count, u_int flags)
{
struct pcib_softc *sc = device_get_softc(dev);
int ok;
@@ -319,6 +319,8 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
start = sc->iobase;
if (end > sc->iolimit)
end = sc->iolimit;
+ if (start < end)
+ ok = 1;
}
} else {
ok = 1;
@@ -330,20 +332,22 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
#endif
}
if (end < start) {
- device_printf(dev, "ioport: end (%lx) < start (%lx)\n", end, start);
+ device_printf(dev, "ioport: end (%lx) < start (%lx)\n",
+ end, start);
start = 0;
end = 0;
ok = 0;
}
if (!ok) {
- device_printf(dev, "device %s requested unsupported I/O "
+ device_printf(dev, "%s requested unsupported I/O "
"range 0x%lx-0x%lx (decoding 0x%x-0x%x)\n",
device_get_nameunit(child), start, end,
sc->iobase, sc->iolimit);
return (NULL);
}
if (bootverbose)
- device_printf(dev, "device %s requested decoded I/O range 0x%lx-0x%lx\n",
+ device_printf(dev,
+ "%s requested I/O range 0x%lx-0x%lx: in range\n",
device_get_nameunit(child), start, end);
break;
@@ -394,14 +398,15 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
#endif
}
if (end < start) {
- device_printf(dev, "memory: end (%lx) < start (%lx)\n", end, start);
+ device_printf(dev, "memory: end (%lx) < start (%lx)\n",
+ end, start);
start = 0;
end = 0;
ok = 0;
}
if (!ok && bootverbose)
device_printf(dev,
- "device %s requested unsupported memory range "
+ "%s requested unsupported memory range "
"0x%lx-0x%lx (decoding 0x%x-0x%x, 0x%x-0x%x)\n",
device_get_nameunit(child), start, end,
sc->membase, sc->memlimit, sc->pmembase,
@@ -409,7 +414,8 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
if (!ok)
return (NULL);
if (bootverbose)
- device_printf(dev,"device %s requested decoded memory range 0x%lx-0x%lx\n",
+ device_printf(dev,"%s requested memory range "
+ "0x%lx-0x%lx: good\n",
device_get_nameunit(child), start, end);
break;
@@ -419,7 +425,8 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
/*
* Bridge is OK decoding this resource, so pass it up.
*/
- return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags));
+ return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
+ count, flags));
}
/*
OpenPOWER on IntegriCloud