summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/pci_pci.c
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2002-11-13 09:42:25 +0000
committermdodd <mdodd@FreeBSD.org>2002-11-13 09:42:25 +0000
commita119655a5eabbd7a97cb8c6c9bf5fc40162a093b (patch)
tree1bb56cbedb94d5388c97601ce119710c4f54b1e7 /sys/dev/pci/pci_pci.c
parent3a3ea4b9da163734beeae9bf5721de675d528502 (diff)
downloadFreeBSD-src-a119655a5eabbd7a97cb8c6c9bf5fc40162a093b.zip
FreeBSD-src-a119655a5eabbd7a97cb8c6c9bf5fc40162a093b.tar.gz
Convert kernel compile option PCI_ALLOW_UNSUPPORTED_IO_RANGE to
a loader tunable hw.pci.allow_unsupported_io_range. Submitted by: Hiten Pandya <hiten@angelica.unixdaemons.com> Approved by: re (murray)
Diffstat (limited to 'sys/dev/pci/pci_pci.c')
-rw-r--r--sys/dev/pci/pci_pci.c82
1 files changed, 49 insertions, 33 deletions
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 3ffc3e4..c28e998 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -38,6 +38,7 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
+#include <sys/sysctl.h>
#include <machine/resource.h>
@@ -90,6 +91,18 @@ devclass_t pcib_devclass;
DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, 0, 0);
/*
+ * sysctl and tunable vars
+ */
+static int pci_allow_unsupported_io_range = 0;
+TUNABLE_INT("hw.pci.allow_unsupported_io_range",
+ (int *)&pci_allow_unsupported_io_range);
+SYSCTL_DECL(_hw_pci);
+SYSCTL_INT(_hw_pci, OID_AUTO, allow_unsupported_io_range, CTLFLAG_RD,
+ &pci_allow_unsupported_io_range, 0,
+ "Allows the PCI Bridge to pass through an unsupported memory range "
+ "assigned by the BIOS.");
+
+/*
* Generic device interface
*/
static int
@@ -288,21 +301,23 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
switch (type) {
case SYS_RES_IOPORT:
if (!pcib_is_isa_io(start)) {
-#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
- if (start < sc->iobase)
- start = sc->iobase;
- if (end > sc->iolimit)
- end = sc->iolimit;
- if (end < start)
- start = 0;
-#else
- if (start < sc->iobase)
- printf("start (%lx) < sc->iobase (%x)\n", start, sc->iobase);
- if (end > sc->iolimit)
- printf("end (%lx) > sc->iolimit (%x)\n", end, sc->iolimit);
- if (end < start)
- printf("end (%lx) < start (%lx)\n", end, start);
-#endif
+ if (!pci_allow_unsupported_io_range) {
+ if (start < sc->iobase)
+ start = sc->iobase;
+ if (end > sc->iolimit)
+ end = sc->iolimit;
+ if (end < start)
+ start = 0;
+ } else {
+ if (start < sc->iobase)
+ printf("start (%lx) < sc->iobase (%x)\n", start,
+ sc->iobase);
+ if (end > sc->iolimit)
+ printf("end (%lx) > sc->iolimit (%x)\n",
+ end, sc->iolimit);
+ if (end < start)
+ printf("end (%lx) < start (%lx)\n", end, start);
+ }
}
if (!pcib_is_isa_io(start) &&
((start < sc->iobase) || (end > sc->iolimit))) {
@@ -325,21 +340,23 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
*/
case SYS_RES_MEMORY:
if (!pcib_is_isa_mem(start)) {
-#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
- if (start < sc->membase && end >= sc->membase)
- start = sc->membase;
- if (end > sc->memlimit)
- end = sc->memlimit;
- if (end < start)
- start = 0;
-#else
- if (start < sc->membase && end > sc->membase)
- printf("start (%lx) < sc->membase (%x)\n", start, sc->membase);
- if (end > sc->memlimit)
- printf("end (%lx) > sc->memlimit (%x)\n", end, sc->memlimit);
- if (end < start)
- printf("end (%lx) < start (%lx)\n", end, start);
-#endif
+ if (!pci_allow_unsupported_io_range) {
+ if (start < sc->membase && end >= sc->membase)
+ start = sc->membase;
+ if (end > sc->memlimit)
+ end = sc->memlimit;
+ if (end < start)
+ start = 0;
+ } else {
+ if (start < sc->membase && end > sc->membase)
+ printf("start (%lx) < sc->membase (%x)\n",
+ start, sc->membase);
+ if (end > sc->memlimit)
+ printf("end (%lx) > sc->memlimit (%x)\n",
+ end, sc->memlimit);
+ if (end < start)
+ printf("end (%lx) < start (%lx)\n", end, start);
+ }
}
if (!pcib_is_isa_mem(start) &&
(((start < sc->membase) || (end > sc->memlimit)) &&
@@ -351,9 +368,8 @@ pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
device_get_name(child), device_get_unit(child), start,
end, sc->membase, sc->memlimit, sc->pmembase,
sc->pmemlimit);
-#ifndef PCI_ALLOW_UNSUPPORTED_IO_RANGE
- return(NULL);
-#endif
+ if (!pci_allow_unsupported_io_range)
+ return (NULL);
}
if (bootverbose)
device_printf(sc->dev, "device %s%d requested decoded memory range 0x%lx-0x%lx\n",
OpenPOWER on IntegriCloud