Re: S3 864 xserver work

Michael <[email protected]> Fri, 9 Jan 2009 16:28:29 -0500
Newsgroups gmane.os.netbsd.devel.x11,gmane.os.netbsd.ports.prep,gmane.os.netbsd.ports.powerpc
Message-ID <[email protected]>
Hello,

On Jan 9, 2009, at 12:15 PM, KIYOHARA Takashi wrote:

> patchs:
>  ftp://ftp.netbsd.org/pub/NetBSD/misc/kiyohara/xserver/

Index: vga_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/vga_pci.c,v
retrieving revision 1.44
diff -u -r1.44 vga_pci.c
--- vga_pci.c	3 Aug 2008 02:12:22 -0000	1.44
+++ vga_pci.c	26 Nov 2008 04:24:53 -0000
@@ -350,6 +350,17 @@
  		return (bus_space_mmap(vc->hdl.vh_memt, IOM_BEGIN,
  		    (offset - IOM_BEGIN), prot, 0));

+	/* allow mapping of IO space */
+#ifdef PCI_MAGIC_IO_RANGE
+	if (offset >= PCI_MAGIC_IO_RANGE &&
+	    (offset < PCI_MAGIC_IO_RANGE + 0x10000))
+		return (bus_space_mmap(vc->hdl.vh_iot,
+		    offset - PCI_MAGIC_IO_RANGE, 0, prot, 0));
+#else
+	if (offset < 0x10000)
+		return (bus_space_mmap(vc->hdl.vh_iot, offset, 0, prot, 0));
+#endif	/* PCI_MAGIC_IO_RANGE */
+
  	/* Range not found. */
  	return (-1);
  }

The #else branch is highly problematic - the wsfb driver expects  
framebuffer memory at offset 0, if you put the PCI IO space there all  
hell will break loose if anyone ever tries to use wsfb.
I'd recommend leaving the #else branch out entirely, otherwise you'd  
screw up archs that don't use PCI_MAGIC_IO_RANGE. The rest looks good  
though.

I'll look at the other patches later.

Thanks for working on this!

have fun
Michael

[demime 1.01d removed an attachment of type application/pgp-signature which had a name of PGP.sig]