Port-prep archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: S3 864 xserver work



Hello,

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


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

Attachment: PGP.sig
Description: This is a digitally signed message part



Home | Main Index | Thread Index | Old Index