PERFORCE change 75921 for review

Marcel Moolenaar marcel at FreeBSD.org
Sun Apr 24 21:59:33 PDT 2005


http://perforce.freebsd.org/chv.cgi?CH=75921

Change 75921 by marcel at marcel_nfs on 2005/04/25 04:59:01

	Allow VGA resources across PCI-PCI bridges. Required to
	support a PCI based VGA driver with the VGA hardware
	behind a PCI-PCI bridge.

Affected files ...

.. //depot/projects/tty/sys/dev/pci/pci_pci.c#8 edit

Differences ...

==== //depot/projects/tty/sys/dev/pci/pci_pci.c#8 (text+ko) ====

@@ -293,6 +293,23 @@
 	return (sc->iobase > 0 && sc->iobase < sc->iolimit);
 }
 
+static __inline int
+is_vga_resource(int type, u_long start, u_long end)
+{
+	switch (type) {
+	case SYS_RES_IOPORT:
+		if ((start >= 0x3b0 && end < 0x3bc) ||
+		    (start >= 0x3c0 && end < 0x3dc))
+			return (1);
+		break;
+	case SYS_RES_MEMORY:
+		if (start >= 0xa0000 && end < 0xc0000)
+			return (1);
+		break;
+	}
+	return (0);
+}
+
 /*
  * We have to trap resource allocation requests and ensure that the bridge
  * is set up to, or capable of handling them.
@@ -313,6 +330,11 @@
 		if (!pcib_is_io_open(sc))
 			break;
 		ok = (start >= sc->iobase && end <= sc->iolimit);
+
+		/* Make sure we allow access to VGA ports. */
+		if (!ok)
+			ok = is_vga_resource(type, start, end);
+
 		if ((sc->flags & PCIB_SUBTRACTIVE) == 0) {
 			if (!ok) {
 				if (start < sc->iobase)
@@ -357,6 +379,11 @@
 			ok = ok || (start >= sc->membase && end <= sc->memlimit);
 		if (pcib_is_prefetch_open(sc))
 			ok = ok || (start >= sc->pmembase && end <= sc->pmemlimit);
+
+		/* Make sure we allow access to VGA memory. */
+		if (!ok)
+			ok = is_vga_resource(type, start, end);
+
 		if ((sc->flags & PCIB_SUBTRACTIVE) == 0) {
 			if (!ok) {
 				ok = 1;


More information about the p4-projects mailing list