[Xquartz-changes] xserver: Branch 'master' - 16 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Sun Sep 26 09:51:12 PDT 2010


 dix/privates.c                          |   33 +-
 doc/xml/Xserver-spec.xml                |   12 
 hw/xfree86/common/compiler.h            |  416 +++++++++++++++++++++++++++++++-
 hw/xfree86/common/xf86Config.c          |   13 -
 hw/xfree86/common/xf86Configure.c       |  115 +-------
 hw/xfree86/common/xf86Globals.c         |    4 
 hw/xfree86/common/xf86Priv.h            |    3 
 hw/xfree86/common/xf86pciBus.c          |   49 +++
 hw/xfree86/common/xf86pciBus.h          |    3 
 hw/xfree86/common/xf86sbusBus.c         |   29 ++
 hw/xfree86/common/xf86sbusBus.h         |    4 
 hw/xfree86/dri/dri.c                    |    2 
 hw/xfree86/int10/helper_exec.c          |    5 
 hw/xfree86/modes/xf86Cursors.c          |    8 
 hw/xfree86/modes/xf86EdidModes.c        |    4 
 hw/xfree86/modes/xf86Modes.c            |   14 -
 hw/xfree86/modes/xf86RandR12.c          |   36 --
 hw/xfree86/os-support/bus/Makefile.am   |    5 
 hw/xfree86/os-support/bus/Pci.c         |   11 
 hw/xfree86/os-support/bus/Pci.h         |    5 
 hw/xfree86/os-support/bus/linuxPci.c    |    4 
 hw/xfree86/os-support/linux/lnx_video.c |    5 
 hw/xfree86/vgahw/vgaHW.h                |    2 
 include/privates.h                      |   51 +++
 include/servermd.h                      |   21 +
 mi/midispcur.c                          |   42 +--
 26 files changed, 633 insertions(+), 263 deletions(-)

New commits:
commit 58bd317e29f4abf7f950891339d2a6a78ddf7903
Author: Macpaul Lin <macpaul at andestech.com>
Date:   Tue Sep 21 15:13:34 2010 +0800

    xfree86: nds32: add nds32 support for compiler related mmio codes
    
    Add nds32 support for compiler related mmio codes.
    It includes byte-swap or non-swap operations.
    
    Signed-off-by: Macpaul Lin <macpaul at andestech.com>
    Acked-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index d037c84..958f8d0 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -1018,6 +1018,355 @@ xf_outl(unsigned short port, unsigned int val)
 #define outw xf_outw
 #define outl xf_outl
 
+#   elif defined(__nds32__)
+
+/*
+ * Assume all port access are aligned.  We need to revise this implementation
+ * if there is unaligned port access.  For ldq_u, ldl_u, ldw_u, stq_u, stl_u and
+ * stw_u, they are assumed unaligned.
+ */
+
+#define barrier()		/* no barrier */
+
+#define PORT_SIZE long
+
+static __inline__ unsigned char
+xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
+{
+	return *(volatile unsigned char *)((unsigned char *)base + offset) ;
+}
+
+static __inline__ void
+xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
+	       const unsigned int val)
+{
+	*(volatile unsigned char *)((unsigned char *)base + offset) = val ;
+	barrier();
+}
+
+static __inline__ void
+xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
+		 const unsigned int val)
+{
+	*(volatile unsigned char *)((unsigned char *)base + offset) = val ;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16Swap(__volatile__ void *base, const unsigned long offset)
+{
+	unsigned long addr = ((unsigned long)base) + offset;
+	unsigned short ret;
+
+	__asm__ __volatile__(
+	           "lhi %0, [%1];\n\t"
+	           "wsbh %0, %0;\n\t"
+			     : "=r" (ret)
+			     : "r" (addr));
+	return ret;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16(__volatile__ void *base, const unsigned long offset)
+{
+	return *(volatile unsigned short *)((char *)base + offset) ;
+}
+
+static __inline__ void
+xf86WriteMmio16Swap(__volatile__ void *base, const unsigned long offset,
+		  const unsigned int val)
+{
+	unsigned long addr = ((unsigned long)base) + offset;
+
+	__asm__ __volatile__(
+	           "wsbh %0, %0;\n\t"
+	           "shi %0, [%1];\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+	barrier();
+}
+
+static __inline__ void
+xf86WriteMmio16(__volatile__ void *base, const unsigned long offset,
+		  const unsigned int val)
+{
+	*(volatile unsigned short *)((unsigned char *)base + offset) = val ;
+	barrier();
+}
+
+static __inline__ void
+xf86WriteMmio16SwapNB(__volatile__ void *base, const unsigned long offset,
+		    const unsigned int val)
+{
+	unsigned long addr = ((unsigned long)base) + offset;
+
+	__asm__ __volatile__(
+	           "wsbh %0, %0;\n\t"
+	           "shi %0, [%1];\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+}
+
+static __inline__ void
+xf86WriteMmio16NB(__volatile__ void *base, const unsigned long offset,
+		    const unsigned int val)
+{
+	*(volatile unsigned short *)((unsigned char *)base + offset) = val ;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32Swap(__volatile__ void *base, const unsigned long offset)
+{
+	unsigned long addr = ((unsigned long)base) + offset;
+	unsigned int ret;
+
+	__asm__ __volatile__(
+	           "lwi %0, [%1];\n\t"
+	           "wsbh %0, %0;\n\t"
+				  "rotri %0, %0, 16;\n\t"
+			     : "=r" (ret)
+			     : "r" (addr));
+	return ret;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32(__volatile__ void *base, const unsigned long offset)
+{
+	return *(volatile unsigned int *)((unsigned char *)base + offset) ;
+}
+
+static __inline__ void
+xf86WriteMmio32Swap(__volatile__ void *base, const unsigned long offset,
+		  const unsigned int val)
+{
+	unsigned long addr = ((unsigned long)base) + offset;
+
+	__asm__ __volatile__(
+	           "wsbh %0, %0;\n\t"
+	           "rotri %0, %0, 16;\n\t"
+				  "swi %0, [%1];\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+	barrier();
+}
+
+static __inline__ void
+xf86WriteMmio32(__volatile__ void *base, const unsigned long offset,
+		  const unsigned int val)
+{
+	*(volatile unsigned int *)((unsigned char *)base + offset) = val ;
+	barrier();
+}
+
+static __inline__ void
+xf86WriteMmio32SwapNB(__volatile__ void *base, const unsigned long offset,
+		    const unsigned int val)
+{
+	unsigned long addr = ((unsigned long)base) + offset;
+
+	__asm__ __volatile__(
+	           "wsbh %0, %0;\n\t"
+				  "rotri %0, %0, 16;\n\t"
+				  "swi %0, [%1];\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+}
+
+static __inline__ void
+xf86WriteMmio32NB(__volatile__ void *base, const unsigned long offset,
+		    const unsigned int val)
+{
+	*(volatile unsigned int *)((unsigned char *)base + offset) = val ;
+}
+
+#    if defined(NDS32_MMIO_SWAP)
+static __inline__ void
+outb(unsigned PORT_SIZE port, unsigned char val)
+{
+   xf86WriteMmio8(IOPortBase, port, val);
+}
+
+static __inline__ void
+outw(unsigned PORT_SIZE port, unsigned short val)
+{
+   xf86WriteMmio16Swap(IOPortBase, port, val);
+}
+
+static __inline__ void
+outl(unsigned PORT_SIZE port, unsigned int val)
+{
+   xf86WriteMmio32Swap(IOPortBase, port, val);
+}
+
+static __inline__ unsigned int
+inb(unsigned PORT_SIZE port)
+{
+   return xf86ReadMmio8(IOPortBase, port);
+}
+
+static __inline__ unsigned int
+inw(unsigned PORT_SIZE port)
+{
+   return xf86ReadMmio16Swap(IOPortBase, port);
+}
+
+static __inline__ unsigned int
+inl(unsigned PORT_SIZE port)
+{
+   return xf86ReadMmio32Swap(IOPortBase, port);
+}
+
+static __inline__ unsigned long ldq_u(unsigned long *p)
+{
+	unsigned long addr = (unsigned long)p;
+	unsigned int ret;
+
+	__asm__ __volatile__(
+				  "lmw.bi %0, [%1], %0, 0;\n\t"
+	           "wsbh %0, %0;\n\t"
+				  "rotri %0, %0, 16;\n\t"
+			     : "=r" (ret)
+			     : "r" (addr));
+	return ret;
+}
+
+static __inline__ unsigned long ldl_u(unsigned int *p)
+{
+	unsigned long addr = (unsigned long)p;
+	unsigned int ret;
+
+	__asm__ __volatile__(
+				  "lmw.bi %0, [%1], %0, 0;\n\t"
+	           "wsbh %0, %0;\n\t"
+				  "rotri %0, %0, 16;\n\t"
+			     : "=r" (ret)
+			     : "r" (addr));
+	return ret;
+}
+
+static __inline__ void stq_u(unsigned long val, unsigned long *p)
+{
+	unsigned long addr = (unsigned long)p;
+
+	__asm__ __volatile__(
+	           "wsbh %0, %0;\n\t"
+				  "rotri %0, %0, 16;\n\t"
+				  "smw.bi %0, [%1], %0, 0;\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+}
+
+static __inline__ void stl_u(unsigned long val, unsigned int *p)
+{
+	unsigned long addr = (unsigned long)p;
+
+	__asm__ __volatile__(
+	           "wsbh %0, %0;\n\t"
+				  "rotri %0, %0, 16;\n\t"
+				  "smw.bi %0, [%1], %0, 0;\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+}
+
+#    else /* !NDS32_MMIO_SWAP */
+static __inline__ void
+outb(unsigned PORT_SIZE port, unsigned char val)
+{
+	*(volatile unsigned char*)(((unsigned PORT_SIZE)(port))) = val;
+	barrier();
+}
+
+static __inline__ void
+outw(unsigned PORT_SIZE port, unsigned short val)
+{
+	*(volatile unsigned short*)(((unsigned PORT_SIZE)(port))) = val;
+	barrier();
+}
+
+static __inline__ void
+outl(unsigned PORT_SIZE port, unsigned int val)
+{
+	*(volatile unsigned int*)(((unsigned PORT_SIZE)(port))) = val;
+	barrier();
+}
+static __inline__ unsigned int
+inb(unsigned PORT_SIZE port)
+{
+	return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port)));
+}
+
+static __inline__ unsigned int
+inw(unsigned PORT_SIZE port)
+{
+	return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port)));
+}
+
+static __inline__ unsigned int
+inl(unsigned PORT_SIZE port)
+{
+	return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port)));
+}
+
+static __inline__ unsigned long ldq_u(unsigned long *p)
+{
+	unsigned long addr = (unsigned long)p;
+	unsigned int ret;
+
+	__asm__ __volatile__(
+				  "lmw.bi %0, [%1], %0, 0;\n\t"
+			     : "=r" (ret)
+			     : "r" (addr));
+	return ret;
+}
+
+static __inline__ unsigned long ldl_u(unsigned int *p)
+{
+	unsigned long addr = (unsigned long)p;
+	unsigned int ret;
+
+	__asm__ __volatile__(
+				  "lmw.bi %0, [%1], %0, 0;\n\t"
+			     : "=r" (ret)
+			     : "r" (addr));
+	return ret;
+}
+
+
+static __inline__ void stq_u(unsigned long val, unsigned long *p)
+{
+	unsigned long addr = (unsigned long)p;
+
+	__asm__ __volatile__(
+				  "smw.bi %0, [%1], %0, 0;\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+}
+
+static __inline__ void stl_u(unsigned long val, unsigned int *p)
+{
+	unsigned long addr = (unsigned long)p;
+
+	__asm__ __volatile__(
+				  "smw.bi %0, [%1], %0, 0;\n\t"
+			     : /* No outputs */
+			     : "r" (val), "r" (addr));
+}
+#    endif /* NDS32_MMIO_SWAP */
+
+#    if (((X_BYTE_ORDER == X_BIG_ENDIAN) && !defined(NDS32_MMIO_SWAP)) || ((X_BYTE_ORDER != X_BIG_ENDIAN) && defined(NDS32_MMIO_SWAP)))
+#    define ldw_u(p)	((*(unsigned char *)(p)) << 8 | \
+			(*((unsigned char *)(p)+1)))
+#    define stw_u(v,p)	(*(unsigned char *)(p)) = ((v) >> 8); \
+				(*((unsigned char *)(p)+1)) = (v)
+#    else
+#    define ldw_u(p)	((*(unsigned char *)(p)) | \
+			(*((unsigned char *)(p)+1)<<8))
+#    define stw_u(v,p)	(*(unsigned char *)(p)) = (v); \
+				(*((unsigned char *)(p)+1)) = ((v) >> 8)
+#    endif
+
+#    define mem_barrier()         /* XXX: nop for now */
+#    define write_mem_barrier()   /* XXX: nop for now */
+
 #   else /* ix86 */
 
 #    if !defined(__SUNPRO_C)
@@ -1338,6 +1687,67 @@ extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
 #  define MMIO_MOVE32(base, offset, val) \
        xf86WriteMmio32Be(base, offset, (CARD32)(val))
 
+# elif defined(__nds32__)
+ /*
+  * we provide byteswapping and no byteswapping functions here
+  * with no byteswapping as default; when endianness of CPU core
+  * and I/O devices don't match, byte swapping is necessary
+  * drivers that need byteswapping should define NDS32_MMIO_SWAP
+  */
+#  define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+#  define MMIO_OUT8(base, offset, val) \
+    xf86WriteMmio8(base, offset, (CARD8)(val))
+#  define MMIO_ONB8(base, offset, val) \
+    xf86WriteMmioNB8(base, offset, (CARD8)(val))
+
+#  if defined(NDS32_MMIO_SWAP) /* byteswapping */
+#   define MMIO_IN16(base, offset) xf86ReadMmio16Swap(base, offset)
+#   define MMIO_IN32(base, offset) xf86ReadMmio32Swap(base, offset)
+#   define MMIO_OUT16(base, offset, val) \
+    xf86WriteMmio16Swap(base, offset, (CARD16)(val))
+#   define MMIO_OUT32(base, offset, val) \
+    xf86WriteMmio32Swap(base, offset, (CARD32)(val))
+#   define MMIO_ONB16(base, offset, val) \
+    xf86WriteMmioNB16Swap(base, offset, (CARD16)(val))
+#   define MMIO_ONB32(base, offset, val) \
+    xf86WriteMmioNB32Swap(base, offset, (CARD32)(val))
+#  else /* no byteswapping is the default */
+#   define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
+#   define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
+#   define MMIO_OUT16(base, offset, val) \
+     xf86WriteMmio16(base, offset, (CARD16)(val))
+#   define MMIO_OUT32(base, offset, val) \
+     xf86WriteMmio32(base, offset, (CARD32)(val))
+#   define MMIO_ONB16(base, offset, val) \
+     xf86WriteMmioNB16(base, offset, (CARD16)(val))
+#   define MMIO_ONB32(base, offset, val) \
+     xf86WriteMmioNB32(base, offset, (CARD32)(val))
+#  endif
+
+#  define MMIO_MOVE32(base, offset, val) \
+       xf86WriteMmio32(base, offset, (CARD32)(val))
+
+#ifdef N1213_HC /* for NDS32 N1213 hardcore */
+static __inline__ void nds32_flush_icache(char *addr)
+{
+	__asm__ volatile (
+		"isync %0;"
+		"msync;"
+		"isb;"
+		"cctl %0,L1I_VA_INVAL;"
+		"isb;"
+		: : "r"(addr) : "memory");
+}
+#else
+static __inline__ void nds32_flush_icache(char *addr)
+{
+	__asm__ volatile (
+		"isync %0;"
+		"isb;"
+		: : "r"(addr) : "memory");
+}
+#endif
+
 # else /* !__alpha__ && !__powerpc__ && !__sparc__ */
 
 #  define MMIO_IN8(base, offset) \
commit 28e6de66b42062a885ba38416387f2dbc15707fd
Author: Macpaul Lin <macpaul at andestech.com>
Date:   Tue Sep 21 15:13:33 2010 +0800

    xfree86: nds32: add nds32 support for compiler specific codes
    
    Add nds32 definitions and related assembly codes to compiler header files.
    
    Signed-off-by: Macpaul Lin <macpaul at andestech.com>
    Acked-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index ded71ee..d037c84 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -103,7 +103,7 @@
 # if defined(NO_INLINE) || defined(DO_PROTOTYPES)
 
 #  if !defined(__arm__)
-#   if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) \
+#   if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
       && !(defined(__alpha__) && defined(linux)) \
       && !(defined(__ia64__) && defined(linux)) \
 
@@ -114,7 +114,7 @@ extern _X_EXPORT unsigned int inb(unsigned short);
 extern _X_EXPORT unsigned int inw(unsigned short);
 extern _X_EXPORT unsigned int inl(unsigned short);
 
-#   else /* __sparc__,  __arm32__, __alpha__*/
+#   else /* __sparc__,  __arm32__, __alpha__, __nds32__ */
 
 extern _X_EXPORT void outb(unsigned long, unsigned char);
 extern _X_EXPORT void outw(unsigned long, unsigned short);
@@ -123,7 +123,7 @@ extern _X_EXPORT unsigned int inb(unsigned long);
 extern _X_EXPORT unsigned int inw(unsigned long);
 extern _X_EXPORT unsigned int inl(unsigned long);
 
-#   endif /* __sparc__,  __arm32__, __alpha__ */
+#   endif /* __sparc__,  __arm32__, __alpha__, __nds32__ */
 #  endif /* __arm__ */
 
 #  if defined(__powerpc__) && !defined(__OpenBSD__)
commit 2b24b2bd859a4b4b8ccaf3b7d1b529dcda2d3b94
Author: Macpaul Lin <macpaul at andestech.com>
Date:   Tue Sep 21 15:13:32 2010 +0800

    xfree86: nds32: add nds32 definition for vgaHW support.
    
    Add __nds32__ definitions for vgaHW support.
    
    Signed-off-by: Macpaul Lin <macpaul at andestech.com>
    Acked-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/vgahw/vgaHW.h b/hw/xfree86/vgahw/vgaHW.h
index 7e63492..b31c007 100644
--- a/hw/xfree86/vgahw/vgaHW.h
+++ b/hw/xfree86/vgahw/vgaHW.h
@@ -174,7 +174,7 @@ typedef struct _vgaHWRec {
 #define BITS_PER_GUN 6
 #define COLORMAP_SIZE 256
 
-#if defined(__powerpc__) || defined(__arm__) || defined(__s390__)
+#if defined(__powerpc__) || defined(__arm__) || defined(__s390__) || defined(__nds32__)
 #define DACDelay(hw) /* No legacy VGA support */
 #else
 #define DACDelay(hw)							      \
commit 22376aa7aa44464636b12ee1d61b94e52ca02b0f
Author: Macpaul Lin <macpaul at andestech.com>
Date:   Tue Sep 21 15:13:31 2010 +0800

    xfree86: nds32: add nds32 definition for support linux video related io.
    
    Add __nds32__ definitions for supporing correct io method for lnx_video.c
    
    Signed-off-by: Macpaul Lin <macpaul at andestech.com>
    Acked-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index bdd2639..b97757c 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -61,6 +61,7 @@ static Bool ExtendedEnabled = FALSE;
       !defined(__mc68000__) && \
       !defined(__sparc__) && \
       !defined(__mips__) && \
+      !defined(__nds32__) && \
       !defined(__arm__)
 
 /*
@@ -519,7 +520,7 @@ xf86EnableIO(void)
 #endif
 	}
 	close(fd);
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__)
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
         if (ioperm(0, 1024, 1) || iopl(3)) {
                 if (errno == ENODEV)
                         ErrorF("xf86EnableIOPorts: no I/O ports found\n");
@@ -546,7 +547,7 @@ xf86DisableIO(void)
 #if defined(__powerpc__)
 	munmap(ioBase, 0x20000);
 	ioBase = NULL;
-#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__)
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) && !defined(__nds32__)
 	iopl(0);
 	ioperm(0, 1024, 0);
 #endif
commit d52799f67f590b0f91b521cd2bdf5a5a8a229c96
Author: Macpaul Lin <macpaul at andestech.com>
Date:   Tue Sep 21 15:13:30 2010 +0800

    xfree86: nds32: add nds32 related definitions into include headers.
    
    Add MSB/LSB related definitions into include/servermd.h
    
    Signed-off-by: Macpaul Lin <macpaul at andestech.com>
    Acked-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/servermd.h b/include/servermd.h
index e1d644e..271d936 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -84,6 +84,27 @@ SOFTWARE.
 
 #endif /* __arm32__ */
 
+#if defined(__nds32__)
+
+#define IMAGE_BYTE_ORDER	LSBFirst
+
+#if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
+# define BITMAP_BIT_ORDER	MSBFirst
+#else
+# define BITMAP_BIT_ORDER	LSBFirst
+#endif
+
+#if defined(XF86MONOVGA) || defined(XF86VGA16)
+# define BITMAP_SCANLINE_UNIT	8
+#endif
+
+#define GLYPHPADBYTES		4
+#define GETLEFTBITS_ALIGNMENT	1
+#define LARGE_INSTRUCTION_CACHE
+#define AVOID_MEMORY_READ
+
+#endif /* __nds32__ */
+
 #if defined __hppa__
 
 #define IMAGE_BYTE_ORDER	MSBFirst
commit 98197d931b266674557b52b4a7099c6470114e55
Merge: 01ad372... 402942c...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 23 15:30:37 2010 -0700

    Merge remote branch 'jamey/for-keith'

commit 402942cdbc518395a2943fd226b9f3071f24d39f
Author: Jamey Sharp <jamey at minilop.net>
Date:   Fri Sep 17 02:11:44 2010 +0200

    Introduce per-object per-screen privates.
    
    This replaces dixCreatePrivateKey and the only uses, which were in
    midispcur.
    
    Commit by Jamey Sharp and Josh Triplett.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Josh Triplett <josh at joshtriplett.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/privates.c b/dix/privates.c
index 17e1050..687fa7a 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -237,28 +237,35 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size)
     return TRUE;
 }
 
-/*
- * Allocate a new private key.
- *
- * This manages the storage of the key object itself, freeing it when the
- * privates system is restarted at server reset time. All other keys
- * are expected to be statically allocated as the privates must be
- * reset after all objects have been freed
- */
-DevPrivateKey
-dixCreatePrivateKey(DevPrivateType type, unsigned size)
+Bool
+dixRegisterScreenPrivateKey(DevScreenPrivateKey screenKey, ScreenPtr pScreen, DevPrivateType type, unsigned size)
 {
     DevPrivateKey	key;
 
+    if (!dixRegisterPrivateKey(&screenKey->screenKey, PRIVATE_SCREEN, 0))
+	return FALSE;
+    key = dixGetPrivate(&pScreen->devPrivates, &screenKey->screenKey);
+    if (key != NULL) {
+	assert(key->size == size);
+	assert(key->type == type);
+	return TRUE;
+    }
     key = calloc(sizeof (DevPrivateKeyRec), 1);
     if (!key)
-	return NULL;
+	return FALSE;
     if (!dixRegisterPrivateKey(key, type, size)) {
 	free(key);
-	return NULL;
+	return FALSE;
     }
     key->allocated = TRUE;
-    return key;
+    dixSetPrivate(&pScreen->devPrivates, &screenKey->screenKey, key);
+    return TRUE;
+}
+
+DevPrivateKey
+_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen)
+{
+    return dixGetPrivate(&pScreen->devPrivates, &key->screenKey);
 }
 
 /*
diff --git a/doc/xml/Xserver-spec.xml b/doc/xml/Xserver-spec.xml
index 563705f..4811a30 100644
--- a/doc/xml/Xserver-spec.xml
+++ b/doc/xml/Xserver-spec.xml
@@ -4854,16 +4854,16 @@ If the function is called more than once on the same key, all calls must use
 the same value for <type>size</type> or the server will abort.</para>
 
 <para>
-To request private space and have the server manage the key, use
+To request per-screen private space in an object, use
 <blockquote><programlisting>
-	DevPrivateKey dixCreatePrivateKey(DevPrivateType type, unsigned size);
+	Bool dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size);
 </programlisting></blockquote>
 The <parameter>type</parameter> and <parameter>size</parameter> arguments are
 the same as those to <function>dixRegisterPrivateKey</function> but this
-function allocates a <type>DevPrivateKeyRec</type> and returns a pointer to it
-instead of requiring the caller to pass a pointer to an existing structure.
-The server will free it automatically when the privates system is restarted
-at server reset time.</para>
+function ensures the given <parameter>key</parameter> exists on objects of
+the specified type with distinct storage for the given
+<parameter>pScreen</parameter>. The key is usable on ScreenPrivate variants
+that are otherwise equivalent to the following Private functions.</para>
 
 <para>
 To attach a piece of private data to an object, use:
diff --git a/include/privates.h b/include/privates.h
index d3c0e13..9fb6ae8 100644
--- a/include/privates.h
+++ b/include/privates.h
@@ -65,6 +65,10 @@ typedef struct _DevPrivateKeyRec {
     struct _DevPrivateKeyRec	*next;
 } DevPrivateKeyRec, *DevPrivateKey;
 
+typedef struct _DevScreenPrivateKeyRec {
+    DevPrivateKeyRec	screenKey;
+} DevScreenPrivateKeyRec, *DevScreenPrivateKey;
+
 /*
  * Let drivers know how to initialize private keys
  */
@@ -100,17 +104,6 @@ dixPrivateKeyRegistered(DevPrivateKey key)
 }
 
 /*
- * Allocate a new private key.
- *
- * This manages the storage of the key object itself, freeing it when the
- * privates system is restarted at server reset time. All other keys
- * are expected to be statically allocated as the privates must be
- * reset after all objects have been freed
- */
-extern _X_EXPORT DevPrivateKey
-dixCreatePrivateKey(DevPrivateType type, unsigned size);
-
-/*
  * Get the address of the private storage.
  *
  * For keys with pre-defined storage, this gets the base of that storage
@@ -180,6 +173,42 @@ dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
     return (pointer *)dixGetPrivateAddr(privates, key);
 }
 
+extern _X_EXPORT Bool
+dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size);
+
+extern _X_EXPORT DevPrivateKey
+_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen);
+
+static inline void *
+dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+{
+    return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
+}
+
+static inline void *
+dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+{
+    return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
+}
+
+static inline void
+dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, pointer val)
+{
+    return dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
+}
+
+static inline pointer
+dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+{
+    return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
+}
+
+static inline pointer *
+dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
+{
+    return dixLookupPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
+}
+
 /*
  * Allocates private data separately from main object.
  *
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 323ee02..48feb88 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -56,6 +56,10 @@ in this Software without prior written authorization from The Open Group.
 /* per-screen private data */
 static DevPrivateKeyRec miDCScreenKeyRec;
 #define miDCScreenKey (&miDCScreenKeyRec)
+static DevScreenPrivateKeyRec miDCCursorBitsKeyRec;
+#define miDCCursorBitsKey (&miDCCursorBitsKeyRec)
+static DevScreenPrivateKeyRec miDCDeviceKeyRec;
+#define miDCDeviceKey (&miDCDeviceKeyRec)
 
 static Bool	miDCCloseScreen(int index, ScreenPtr pScreen);
 
@@ -71,8 +75,8 @@ typedef struct {
 
 #define miGetDCDevice(dev, screen) \
  ((DevHasCursor(dev)) ? \
-  (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCDeviceKey(screen)) : \
-  (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCDeviceKey(screen)))
+  (miDCBufferPtr)dixLookupScreenPrivate(&dev->devPrivates, miDCDeviceKey, screen) : \
+  (miDCBufferPtr)dixLookupScreenPrivate(&dev->u.master->devPrivates, miDCDeviceKey, screen))
 
 /* 
  * The core pointer buffer will point to the index of the virtual core pointer
@@ -80,13 +84,9 @@ typedef struct {
  */
 typedef struct {
     CloseScreenProcPtr	CloseScreen;
-    DevPrivateKey	device_key;
-    DevPrivateKey	cursor_bits_key;
 } miDCScreenRec, *miDCScreenPtr;
 
 #define miGetDCScreen(s)	((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey)))
-#define miDCDeviceKey(s) 	(miGetDCScreen(s)->device_key)
-#define miDCCursorBitsKey(s)	(miGetDCScreen(s)->cursor_bits_key)
 
 /* per-cursor per-screen private data */
 typedef struct {
@@ -102,19 +102,15 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
 {
     miDCScreenPtr   pScreenPriv;
 
-    if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0))
+    if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0) ||
+        !dixRegisterScreenPrivateKey(&miDCCursorBitsKeyRec, pScreen, PRIVATE_CURSOR_BITS, 0) ||
+        !dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE, 0))
 	return FALSE;
 
     pScreenPriv = malloc(sizeof (miDCScreenRec));
     if (!pScreenPriv)
 	return FALSE;
 
-    pScreenPriv->cursor_bits_key = dixCreatePrivateKey(PRIVATE_CURSOR_BITS, 0);
-    pScreenPriv->device_key = dixCreatePrivateKey(PRIVATE_DEVICE, 0);
-    if (!pScreenPriv->cursor_bits_key || !pScreenPriv->device_key) {
-	free(pScreenPriv);
-	return FALSE;
-    }
     pScreenPriv->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = miDCCloseScreen;
 
@@ -144,7 +140,7 @@ Bool
 miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
 {
     if (pCursor->bits->refcnt <= 1)
-	dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), NULL);
+	dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, NULL);
     return TRUE;
 }
 
@@ -243,7 +239,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
 	    free((pointer) pPriv);
 	    return NULL;
 	}
-	dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), pPriv);
+	dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, pPriv);
 	return pPriv;
     }
     pPriv->pPicture = 0;
@@ -261,7 +257,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
 	free((pointer) pPriv);
 	return NULL;
     }
-    dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), pPriv);
+    dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, pPriv);
 
     /* create the two sets of bits, clipping as appropriate */
 
@@ -305,8 +301,8 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
 {
     miDCCursorPtr   pPriv;
 
-    pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
-					    miDCCursorBitsKey(pScreen));
+    pPriv = (miDCCursorPtr)dixLookupScreenPrivate(&pCursor->bits->devPrivates,
+						  miDCCursorBitsKey, pScreen);
     if (pPriv && (pCursor->bits->refcnt <= 1))
     {
 	if (pPriv->sourceBits)
@@ -318,7 +314,7 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
 	    FreePicture (pPriv->pPicture, 0);
 #endif
 	free((pointer) pPriv);
-	dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), NULL);
+	dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, NULL);
     }
     return TRUE;
 }
@@ -406,8 +402,8 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
     miDCBufferPtr   pBuffer;
     WindowPtr	    pWin;
 
-    pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
-					    miDCCursorBitsKey(pScreen));
+    pPriv = (miDCCursorPtr)dixLookupScreenPrivate(&pCursor->bits->devPrivates,
+						  miDCCursorBitsKey, pScreen);
     if (!pPriv)
     {
 	pPriv = miDCRealize(pScreen, pCursor);
@@ -523,7 +519,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
         if (!pBuffer)
             goto failure;
 
-        dixSetPrivate(&pDev->devPrivates, miDCDeviceKey(pScreen), pBuffer);
+        dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, pBuffer);
         pWin = pScreen->root;
 
         pBuffer->pSourceGC = miDCMakeGC(pWin);
@@ -589,7 +585,7 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
                 if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
 
                 free(pBuffer);
-                dixSetPrivate(&pDev->devPrivates, miDCDeviceKey(pScreen), NULL);
+                dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, NULL);
             }
         }
     }
commit e4d4d6ddd52801cf0b0b253d9ba3bdabfa9a9d8d
Author: Jamey Sharp <jamey at minilop.net>
Date:   Fri Sep 17 02:18:10 2010 +0200

    Xserver need not be compatible with old versions of xserver.
    
    Delete time-traveling multiple personality disorder from the server.
    
    Gaetan notes:
    
        There were a couple of drivers containing an unknown version of the
        modes/parser code. This was done in server 1.2 time frame because it
        was released without mode code. It was barely or not maintained
        afterwards. There are currently no video drivers with a copy of the
        modes code.
    
    Most of these ifdefs were introduced in commit
    a8d760f567b19268329c4682495caa591f08a854, where Aaron wrote,
    
        This change uses XORG_VERSION_CURRENT < 7.0 to mean "server newer
        than 1.2" since XORG_VERSION current went backwards at some point.
    
    Alan explains that:
    
        In Xorg 1.3, when we first released an Xorg server release decoupled
        from the katamari release schedule.  (1.0 through 1.2 were released
        as part of X11R7.0 through 7.2, while 1.3 came out between X11R7.2 &
        7.3.)
    
    Commit by Jamey Sharp and Josh Triplett.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Josh Triplett <josh at joshtriplett.org>
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 6b2ae97..ab07b60 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -227,11 +227,7 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
     CursorPtr		cursor = xf86_config->cursor;
     int			c;
     CARD8		*bits = cursor ?
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
         dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen))
-#else
-        cursor->devPriv[screen->myNum]
-#endif
       : NULL;
 
     /* Save ARGB versions of these colors */
@@ -630,11 +626,7 @@ xf86_reload_cursors (ScreenPtr screen)
 
     if (cursor)
     {
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
 	void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen));
-#else
-	void *src = cursor->devPriv[screen->myNum];
-#endif
 #ifdef ARGB_CURSOR
 	if (cursor->bits->argb && cursor_info->LoadCursorARGB)
 	    (*cursor_info->LoadCursorARGB) (scrn, cursor);
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 8f4d04f..c367749 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -636,7 +636,6 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
     return Mode;
 }
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
 static DisplayModePtr
 DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
 {
@@ -665,7 +664,6 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
 
     return modes;
 }
-#endif
 
 static const struct {
     short w;
@@ -1021,12 +1019,10 @@ static void handle_detailed_modes(struct detailed_monitor_section *det_mon,
                                           p->quirks, p->timing_level,p->rb);
         p->Modes = xf86ModesAdd(p->Modes, Mode);
         break;
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     case DS_CVT:
         Mode = DDCModesFromCVT(p->DDC->scrnIndex, det_mon->section.cvt);
         p->Modes = xf86ModesAdd(p->Modes, Mode);
         break;
-#endif
     case DS_EST_III:
 	Mode = DDCModesFromEstIII(det_mon->section.est_iii);
 	p->Modes = xf86ModesAdd(p->Modes, Mode);
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 05f4319..51eb4c9 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -38,14 +38,6 @@
 
 extern XF86ConfigPtr xf86configptr;
 
-/*
- * This is the version number where we epoched.  These files get copied
- * into drivers that want to use this setup infrastructure on pre-1.3
- * servers, so when that happens they need to define these symbols
- * themselves.  However, _in_ the server, we basically always define them now.
- */
-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
-
 /**
  * Calculates the horizontal sync rate of a mode.
  */
@@ -326,7 +318,6 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
 		   mode->VTotal, flags, xf86ModeHSync(mode));
     free(flags);
 }
-#endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
 
 /**
  * Marks as bad any modes with unsupported flags.
@@ -503,12 +494,7 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 
     for (mode = modeList; mode != NULL; mode = mode->next) {
 	if (xf86ModeBandwidth(mode, depth) > bandwidth)
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
 	    mode->status = MODE_BANDWIDTH;
-#else
-	    /* MODE_BANDWIDTH didn't exist in xserver 1.2 */
-	    mode->status = MODE_BAD;
-#endif
     }
 }
 
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 043ceee..dd2bdac 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -69,21 +69,12 @@ static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
 #endif
 
 static int xf86RandR12Generation;
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
 
 static DevPrivateKeyRec xf86RandR12KeyRec;
 static DevPrivateKey xf86RandR12Key;
 #define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
     dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
 
-#else /* XORG_VERSION_CURRENT < 7.0 */
-
-static int xf86RandR12Index;
-#define XF86RANDRINFO(p) \
-    ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
-
-#endif /* XORG_VERSION_CURRENT < 7.0 */
-
 
 static int
 xf86RandR12ModeRefresh (DisplayModePtr mode)
@@ -690,17 +681,13 @@ xf86RandR12ScreenSetSize (ScreenPtr	pScreen,
     Bool		ret = FALSE;
     int                 c;
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     if (xf86RandR12Key) {
-#endif
         if (randrp->virtualX == -1 || randrp->virtualY == -1)
         {
 	    randrp->virtualX = pScrn->virtualX;
 	    randrp->virtualY = pScrn->virtualY;
         }
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     }
-#endif
     if (pRoot && pScrn->vtSema)
 	(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
 
@@ -843,10 +830,8 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
 				  mmHeight);
     }
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     if (xf86RandR12Key == NULL)
 	return TRUE;
-#endif
 
     if (randrp->virtualX == -1 || randrp->virtualY == -1)
     {
@@ -882,13 +867,9 @@ xf86RandR12Init (ScreenPtr pScreen)
     if (xf86RandR12Generation != serverGeneration)
 	xf86RandR12Generation = serverGeneration;
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     xf86RandR12Key = &xf86RandR12KeyRec;
     if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0))
 	return FALSE;
-#else
-    xf86RandR12Index = AllocateScreenPrivateIndex();
-#endif
 
     randrp = malloc(sizeof (XF86RandRInfoRec));
     if (!randrp)
@@ -914,11 +895,7 @@ xf86RandR12Init (ScreenPtr pScreen)
 
     randrp->maxX = randrp->maxY = 0;
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
-#else
-    pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
-#endif
 
 #if RANDR_12_INTERFACE
     if (!xf86RandR12Init12 (pScreen))
@@ -932,10 +909,8 @@ xf86RandR12CloseScreen (ScreenPtr pScreen)
 {
     XF86RandRInfoPtr	randrp;
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     if (xf86RandR12Key == NULL)
 	return;
-#endif
 
     randrp = XF86RANDRINFO(pScreen);
 #if RANDR_12_INTERFACE
@@ -955,10 +930,8 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
     xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
 #endif
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     if (xf86RandR12Key == NULL)
 	return;
-#endif
 
     randrp = XF86RANDRINFO(pScreen);
 #if RANDR_12_INTERFACE
@@ -981,10 +954,8 @@ xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms)
     xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
 #endif
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     if (xf86RandR12Key == NULL)
 	return;
-#endif
 
     randrp = XF86RANDRINFO(pScreen);
 #if RANDR_13_INTERFACE
@@ -1599,10 +1570,8 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
     ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
     xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     if (xf86RandR12Key == NULL)
 	return TRUE;
-#endif
 
     for (c = 0; c < config->num_crtc; c++)
         xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
@@ -1624,13 +1593,8 @@ xf86RandR12TellChanged (ScreenPtr pScreen)
     xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
     int			c;
 
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
     if (xf86RandR12Key == NULL)
 	return;
-#else
-    if (!XF86RANDRINFO(pScreen))
-	return;
-#endif
 
     xf86RandR12SetInfo12 (pScreen);
     for (c = 0; c < config->num_crtc; c++)
commit 01ad3725a8d0a8958720b81d19598a08c072ccee
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Jun 1 20:37:54 2010 +0300

    xfree86: delete useless "Primary device is not PCI" message
    
    The primary device being PCI or not has no effect on the server working. This
    message is superfluous.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 7f8823a..3e9c455 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1307,15 +1307,10 @@ xf86PciMatchDriver(char* matches[], int nmatches) {
     }
 
     pci_iterator_destroy(iter);
-
-    if (!info) {
-	ErrorF("Primary device is not PCI\n");
-    }
 #ifdef __linux__
-    else {
+    if (info)
 	matchDriverFromFiles(matches, info->vendor_id, info->device_id);
-    }
-#endif /* __linux__ */
+#endif
 
     for (i = 0; (i < nmatches) && (matches[i]); i++) {
 	/* find end of matches list */
commit 7360235ecca25af29bb2d99a8e46d5b259ad1b1e
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon May 31 18:20:57 2010 +0300

    xfree86: bus: assign PCI_SOURCES with the actual source files
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am
index 106b237..643cb25 100644
--- a/hw/xfree86/os-support/bus/Makefile.am
+++ b/hw/xfree86/os-support/bus/Makefile.am
@@ -1,7 +1,7 @@
 noinst_LTLIBRARIES = libbus.la
 sdk_HEADERS = xf86Pci.h
 
-PCI_SOURCES =
+PCI_SOURCES = Pci.c Pci.h
 
 if XORG_BUS_LINUXPCI
 PCI_SOURCES += linuxPci.c
@@ -16,7 +16,7 @@ PLATFORM_SOURCES = Sbus.c
 sdk_HEADERS += xf86Sbus.h
 endif
 
-libbus_la_SOURCES = Pci.c Pci.h $(PCI_SOURCES) $(PLATFORM_SOURCES)
+libbus_la_SOURCES = $(PCI_SOURCES) $(PLATFORM_SOURCES)
 
 INCLUDES = $(XORG_INCS)
 
commit 18b2d2e8bd056266410226d779752e7933847b6b
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon May 31 18:09:50 2010 +0300

    xfree86: bus: move macros from common PCI header to private file
    
    Only int10/helper_exec.c is using them.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 8f47afe..55ab058 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -462,6 +462,11 @@ Mem_wl(CARD32 addr, CARD32 val)
 
 static CARD32 PciCfg1Addr = 0;
 
+#define PCI_DOM_FROM_TAG(tag)  (((tag) >> 24) & (PCI_DOM_MASK))
+#define PCI_BUS_FROM_TAG(tag)  (((tag) >> 16) & (PCI_DOMBUS_MASK))
+#define PCI_DEV_FROM_TAG(tag)  (((tag) & 0x0000f800u) >> 11)
+#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
+
 #define PCI_OFFSET(x) ((x) & 0x000000ff)
 #define PCI_TAG(x)    ((x) & 0x7fffff00)
 
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index e001c30..3493013 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -133,11 +133,6 @@
 
 #define PCI_MAKE_BUS(d,b)    ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu))
 
-#define PCI_DOM_FROM_TAG(tag)  (((tag) >> 24) & (PCI_DOM_MASK))
-#define PCI_BUS_FROM_TAG(tag)  (((tag) >> 16) & (PCI_DOMBUS_MASK))
-#define PCI_DEV_FROM_TAG(tag)  (((tag) & 0x0000f800u) >> 11)
-#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
-
 #define PCI_DOM_FROM_BUS(bus)  (((bus) >> 8) & (PCI_DOM_MASK))
 #define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
 #define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u)
commit 17a23f9ba8fa95f3e15afba7de22a12fe60bacfb
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Sep 10 19:18:42 2010 +0300

    xfree86: dri: remove unused PCI macro
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 61bbe9a..fe99a2d 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -71,8 +71,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "inputstr.h"
 #include "xf86VGAarbiter.h"
 
-#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
-
 static int DRIEntPrivIndex = -1;
 static DevPrivateKeyRec DRIScreenPrivKeyRec;
 #define DRIScreenPrivKey (&DRIScreenPrivKeyRec)
commit fc3ab84de7b5692f0db2b282ab0ed8e5a61d1fce
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Sep 10 19:16:30 2010 +0300

    xfree86: configure: move buses references to their own location
    
    This patch makes xf86Configure.c free of PCI and SBUS code, moving to a more
    meaningful location.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Mark Kettenis <kettenis at openbsd.org>

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index da654f0..7235c61 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -34,6 +34,7 @@
 #define IN_XSERVER
 #include "Configint.h"
 #include "xf86DDC.h"
+#include "xf86pciBus.h"
 #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
 #include "xf86Bus.h"
 #include "xf86Sbus.h"
@@ -71,85 +72,6 @@ static char *DFLT_MOUSE_DEV = "/dev/mouse";
 static char *DFLT_MOUSE_PROTO = "auto";
 #endif
 
-static Bool
-bus_pci_configure(void *busData)
-{
-    int i;
-    struct pci_device * pVideo = NULL;
-
-	pVideo = (struct pci_device *) busData;
-	for (i = 0;  i < nDevToConfig;  i++)
-	    if (DevToConfig[i].pVideo &&
-		(DevToConfig[i].pVideo->domain == pVideo->domain) &&
-		(DevToConfig[i].pVideo->bus == pVideo->bus) &&
-		(DevToConfig[i].pVideo->dev == pVideo->dev) &&
-		(DevToConfig[i].pVideo->func == pVideo->func))
-		return 0;
-
-	return 1;
-}
-
-static Bool
-bus_sbus_configure(void *busData)
-{
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-    int i;
-
-    for (i = 0;  i < nDevToConfig;  i++)
-        if (DevToConfig[i].sVideo &&
-        DevToConfig[i].sVideo->fbNum == ((sbusDevicePtr) busData)->fbNum)
-            return 0;
-
-#endif
-    return 1;
-}
-
-static void
-bus_pci_newdev_configure(void *busData, int i, int *chipset)
-{
-	char busnum[8];
-    struct pci_device * pVideo = NULL;
-
-    pVideo = (struct pci_device *) busData;
-
-	DevToConfig[i].pVideo = pVideo;
-
-	DevToConfig[i].GDev.busID = xnfalloc(16);
-	xf86FormatPciBusNumber(pVideo->bus, busnum);
-	sprintf(DevToConfig[i].GDev.busID, "PCI:%s:%d:%d",
-	    busnum, pVideo->dev, pVideo->func);
-
-	DevToConfig[i].GDev.chipID = pVideo->device_id;
-	DevToConfig[i].GDev.chipRev = pVideo->revision;
-
-	if (*chipset < 0) {
-	    *chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
-	}
-}
-
-static void
-bus_sbus_newdev_configure(void *busData, int i)
-{
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-	char *promPath = NULL;
-	DevToConfig[i].sVideo = (sbusDevicePtr) busData;
-	DevToConfig[i].GDev.identifier = DevToConfig[i].sVideo->descr;
-	if (sparcPromInit() >= 0) {
-	    promPath = sparcPromNode2Pathname(&DevToConfig[i].sVideo->node);
-	    sparcPromClose();
-	}
-	if (promPath) {
-	    DevToConfig[i].GDev.busID = xnfalloc(strlen(promPath) + 6);
-	    sprintf(DevToConfig[i].GDev.busID, "SBUS:%s", promPath);
-	    free(promPath);
-	} else {
-	    DevToConfig[i].GDev.busID = xnfalloc(12);
-	    sprintf(DevToConfig[i].GDev.busID, "SBUS:fb%d",
-                                DevToConfig[i].sVideo->fbNum);
-	}
-#endif
-}
-
 /*
  * This is called by the driver, either through xf86Match???Instances() or
  * directly.  We allocate a GDevRec and fill it in as much as we can, letting
@@ -164,20 +86,23 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
 	return NULL;
 
     /* Check for duplicates */
-    switch (bus) {
-        case BUS_PCI:
-            ret = bus_pci_configure(busData);
-	        break;
-        case BUS_SBUS:
-            ret = bus_sbus_configure(busData);
-	        break;
-        default:
-	        return NULL;
+    for (i = 0;  i < nDevToConfig;  i++) {
+        switch (bus) {
+            case BUS_PCI:
+                ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
+                break;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+            case BUS_SBUS:
+                ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
+                break;
+#endif
+            default:
+                return NULL;
+        }
+        if (ret == 0)
+            goto out;
     }
 
-    if (ret == 0)
-        goto out;
-
     /* Allocate new structure occurrence */
     i = nDevToConfig++;
     DevToConfig =
@@ -195,11 +120,15 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
 
     switch (bus) {
         case BUS_PCI:
-            bus_pci_newdev_configure(busData, i, &chipset);
+            xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
+                                   &DevToConfig[i].GDev, &chipset);
 	        break;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
         case BUS_SBUS:
-            bus_sbus_newdev_configure(busData, i);
+            xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
+                                    &DevToConfig[i].GDev);
 	        break;
+#endif
         default:
 	        break;
     }
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 46aa23a..7f8823a 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1327,3 +1327,38 @@ xf86PciMatchDriver(char* matches[], int nmatches) {
 
     return i;
 }
+
+Bool
+xf86PciConfigure(void *busData, struct pci_device *pDev)
+{
+    struct pci_device * pVideo = NULL;
+
+    pVideo = (struct pci_device *) busData;
+    if (pDev &&
+        (pDev->domain == pVideo->domain) &&
+        (pDev->bus == pVideo->bus) &&
+        (pDev->dev == pVideo->dev) &&
+        (pDev->func == pVideo->func))
+        return 0;
+
+    return 1;
+}
+
+void
+xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
+                         GDevRec *GDev, int *chipset)
+{
+    char busnum[8];
+
+    pVideo = (struct pci_device *) busData;
+
+    GDev->busID = xnfalloc(16);
+    xf86FormatPciBusNumber(pVideo->bus, busnum);
+    sprintf(GDev->busID, "PCI:%s:%d:%d", busnum, pVideo->dev, pVideo->func);
+
+    GDev->chipID = pVideo->device_id;
+    GDev->chipRev = pVideo->revision;
+
+    if (*chipset < 0)
+        *chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
+}
diff --git a/hw/xfree86/common/xf86pciBus.h b/hw/xfree86/common/xf86pciBus.h
index 3f02b93..e625e51 100644
--- a/hw/xfree86/common/xf86pciBus.h
+++ b/hw/xfree86/common/xf86pciBus.h
@@ -38,5 +38,8 @@ Bool xf86PciAddMatchingDev(DriverPtr drvp);
 Bool xf86PciProbeDev(DriverPtr drvp);
 void xf86PciIsolateDevice(char *argument);
 int xf86PciMatchDriver(char* matches[], int nmatches);
+Bool xf86PciConfigure(void *busData, struct pci_device *pDev);
+void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
+                            GDevRec *GDev, int *chipset);
 
 #endif /* _XF86_PCI_BUS_H */
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index fe3f0a8..d7c928b 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -685,3 +685,32 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
     return xf86HandleColormaps(pScreen, 256, 8,
 			       xf86SbusCmapLoadPalette, NULL, 0);
 }
+
+Bool
+xf86SbusConfigure(void *busData, sbusDevicePtr sBus)
+{
+    if (sBus && sBus->fbNum == ((sbusDevicePtr) busData)->fbNum)
+        return 0;
+    return 1;
+}
+
+void
+xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec *GDev)
+{
+    char *promPath = NULL;
+
+    sBus = (sbusDevicePtr) busData;
+    GDev->identifier = sBus->descr;
+    if (sparcPromInit() >= 0) {
+        promPath = sparcPromNode2Pathname(&sBus->node);
+        sparcPromClose();
+    }
+    if (promPath) {
+        GDev->busID = xnfalloc(strlen(promPath) + 6);
+        sprintf(GDev->busID, "SBUS:%s", promPath);
+        free(promPath);
+    } else {
+        GDev->busID = xnfalloc(12);
+        sprintf(GDev->busID, "SBUS:fb%d", sBus->fbNum);
+    }
+}
diff --git a/hw/xfree86/common/xf86sbusBus.h b/hw/xfree86/common/xf86sbusBus.h
index 5cdb095..66a96e3 100644
--- a/hw/xfree86/common/xf86sbusBus.h
+++ b/hw/xfree86/common/xf86sbusBus.h
@@ -97,4 +97,8 @@ extern _X_EXPORT char * sparcPromNode2Pathname(sbusPromNodePtr pnode);
 extern _X_EXPORT int sparcPromPathname2Node(const char *pathName);
 extern _X_EXPORT char *sparcDriverName(void);
 
+extern Bool xf86SbusConfigure(void *busData, sbusDevicePtr sBus);
+extern void xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus,
+                                    GDevRec *GDev);
+
 #endif /* _XF86_SBUSBUS_H */
commit 49b817501f97d55480063c0b62544b3af75b4b7c
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Jun 1 16:16:53 2010 +0300

    xfree86: bus: remove xfree86 and few other references from OS files
    
    Conceptually, os-support should have only a basic set of OS helpers which
    wouldn't mix with any DDX common structure (e.g. windowing structures, etc)
    
    This patch removes some xfree86-only and a few other unused references from
    os-support/bus.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index a0a597d..fe4850e 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -124,19 +124,8 @@
 #include <xorg-config.h>
 #endif
 
-#include <errno.h>
-#include <signal.h>
-#include "compiler.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#define XF86_OS_PRIVS
-#include "xf86_OSproc.h"
 #include "Pci.h"
 
-#include <pciaccess.h>
-
-/* Global data */
-
 PCITAG
 pciTag(int busnum, int devnum, int funcnum)
 {
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 289315e..fcfdbcb 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -49,12 +49,8 @@
 #endif
 
 #include <stdio.h>
-#include "compiler.h"
-#include "xf86.h"
-#include "xf86Priv.h"
 #include "xf86_OSlib.h"
 #include "Pci.h"
-#include <dirent.h>
 
 static const struct pci_id_match match_host_bridge = {
     PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
commit d9c682a5e250677883c4d375ca84cf184ee19d77
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 30 21:35:23 2010 +0300

    xfree86: bus: remove useless automake variable
    
    Leftover that was missed in f7abe05b.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am
index 92a519b..106b237 100644
--- a/hw/xfree86/os-support/bus/Makefile.am
+++ b/hw/xfree86/os-support/bus/Makefile.am
@@ -16,8 +16,7 @@ PLATFORM_SOURCES = Sbus.c
 sdk_HEADERS += xf86Sbus.h
 endif
 
-libbus_la_SOURCES = Pci.c Pci.h $(PCI_SOURCES) $(PLATFORM_PCI_SOURCES) \
-                    $(PLATFORM_SOURCES)
+libbus_la_SOURCES = Pci.c Pci.h $(PCI_SOURCES) $(PLATFORM_SOURCES)
 
 INCLUDES = $(XORG_INCS)
 
commit a7efeda8a56a540542e056a426e89cfc053a4162
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Sun May 30 19:12:31 2010 +0300

    xfree86: use xf86PciIsolateDevice to get PCI config information
    
    Make xf86IsolateDevice private on PCI common file.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 28786ba..6743b10 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -60,7 +60,7 @@
 #include "configProcs.h"
 #include "globals.h"
 #include "extension.h"
-#include "Pci.h"
+#include "xf86pciBus.h"
 
 #include "xf86Xinput.h"
 extern DeviceAssocRec mouse_assoc;
@@ -2535,18 +2535,11 @@ xf86HandleConfigFile(Bool autoconfig)
            scanptr = xf86ConfigLayout.screens->screen->device->busID;
     }
     if (scanptr) {
-       int bus, device, func;
        if (strncmp(scanptr, "PCI:", 4) != 0) {
            xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
                               "\tIgnoring IsolateDevice option.\n");
-       } else if (sscanf(scanptr, "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
-           xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
-           xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
-           xf86IsolateDevice.dev = device;
-           xf86IsolateDevice.func = func;
-           xf86Msg(X_INFO,
-                   "Isolating PCI bus \"%d:%d:%d\"\n", bus, device, func);
-       }
+       } else
+           xf86PciIsolateDevice(scanptr);
     }
 
     /* Now process everything else */
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 43665d1..781ee49 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -198,7 +198,3 @@ Bool xf86VidModeAllowNonLocal = FALSE;
 RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
 Bool xf86inSuspend = FALSE;
 Bool xorgHWAccess = FALSE;
-
-struct pci_slot_match xf86IsolateDevice = {
-    PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
-};
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index b5e7a45..08c0fa9 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -35,8 +35,6 @@
 #ifndef _XF86PRIV_H
 #define _XF86PRIV_H
 
-#include <pciaccess.h>
-
 #include "xf86Privstr.h"
 #include "propertyst.h"
 #include "input.h"
@@ -72,7 +70,6 @@ extern _X_EXPORT  rgb xf86Weight;
 extern _X_EXPORT  Bool xf86FlipPixels;
 extern _X_EXPORT  Gamma xf86Gamma;
 extern _X_EXPORT  char *xf86ServerName;
-extern _X_EXPORT  struct pci_slot_match xf86IsolateDevice;
 
 /* Other parameters */
 
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 74016af..46aa23a 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -76,6 +76,11 @@ Bool pciSlotClaimed = FALSE;
     (((c) & 0x00ffff00) \
 	 == ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8)))
 
+
+static struct pci_slot_match xf86IsolateDevice = {
+    PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
+};
+
 void
 xf86FormatPciBusNumber(int busnum, char *buffer)
 {


More information about the Xquartz-changes mailing list