Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Nov 2002 22:09:10 -0500
From:      Hiten Pandya <hiten@angelica.unixdaemons.com>
To:        "Matthew N. Dodd" <winter@jurai.net>
Cc:        Terry Lambert <tlambert2@mindspring.com>, freebsd-current@FreeBSD.ORG
Subject:   Re: Will official-NVIDIA-driver for 4.7 work with -CURRENT ?
Message-ID:  <20021108220909.A85237@angelica.unixdaemons.com>
In-Reply-To: <20021108174356.L35807-100000@sasami.jurai.net>; from winter@jurai.net on Fri, Nov 08, 2002 at 05:45:00PM -0500
References:  <3DCC3CC0.5DE547CC@mindspring.com> <20021108174356.L35807-100000@sasami.jurai.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Nov 08, 2002 at 05:45:00PM -0500, Matthew N. Dodd wrote the words in effect of:
> On Fri, 8 Nov 2002, Terry Lambert wrote:
> > "Matthew N. Dodd" wrote:
> > > Recompile your kernel with
> > >
> > > options PCI_ALLOW_UNSUPPORTED_IO_RANGE
> >
> > Given the number of times that this comes up, can we change that to
> > "PCI_ALLOW_ACTUALLY_SUPPORTED_IO_RANGE_WHICH_IS_NON_DEFAULT_TO_BE_ANNOYING"
> > ?
> 
> I think the plan is to make this option a loader tunable and make the
> conditional in the pci code "bitchy" and then fix the larger problem with
> IO ranges.

Hi there.

I have made a basic patch, which took me about 10 minutes to do so.
Basically, it removes the option PCI_ALLOW_UNSUPPORTED_IO_RANGE, and
replaces it with a loader tunable.  This is no different from imp's
change to make PCI_ENABLE_IO_MODES a l-tunable.  But this time, I do not
have a sysctl to show the _readonly_ value, this is because the hw.pci
node leaves in pci.c and I am unsure of how to tackle that.  I have not
tested this patch, so consider it experimental.

Also.  If this patch works, then we will have to remove the
PCI_ALLOW_UNSUPPORTED_I0_RANGE from ``options'' files and add entries
for hw.pci.enable_io_modes and this loader tunable to the loader(8)
manual page or some such.

Patch also available at:
http://www.unixdaemons.com/~hiten/work/diffs/pci_pci.patch

Cheers.

P.S.  hw.pci should moved somewhere global, but donno how this can be
done or even if it is possible to do.

-- 
Hiten Pandya
hiten@unixdaemons.com, hiten@uk.FreeBSD.org, hiten@softweyr.com

--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pci_pci.patch"

--- /home/hiten/pci_pci.c	Fri Nov  8 17:25:52 2002
+++ /sys/dev/pci/pci_pci.c	Fri Nov  8 19:11:03 2002
@@ -38,6 +38,9 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
+#if 0
+#include <sys/sysctl.h>
+#endif
 
 #include <machine/resource.h>
 
@@ -90,6 +93,18 @@
 DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, 0, 0);
 
 /*
+ * sysctl and tunable vars
+ */
+int pci_allow_unsupported_io_range = 1;
+TUNABLE_INT("hw.pci.allow_unsupported_io_range",
+	(int *)&pci_allow_unsupported_io_range);
+#if 0
+SYSCTL_INT(_hw_pci, OID_AUTO, allow_unsupported_io_range, CTLFLAG_RD,
+	&pci_allow_unsupported_io_range, 1,
+	"Allows the PCI Bridge to pass through an unsupported memory range"
+	"assigned by the BIOS.");
+#endif
+/*
  * Generic device interface
  */
 static int
@@ -288,21 +303,23 @@
 	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 +342,23 @@
 	     */
 	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 +370,8 @@
 			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",

--vkogqOf2sHV7VnPd--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021108220909.A85237>