Subject: X on CATS
To: None <tech-x11@netbsd.org>
From: Nick Hudson <skrll@netbsd.org>
List: tech-x11
Date: 11/12/2004 14:41:39
--Boundary-00=_juMlBpj9EYulIw5
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I've managed to get X built from src/x11 working on my CATS with a ATI
Technologies Mach64 VT in it. In doing so I've need to make various changes
some of which I not sure are 100% correct.

Unless someone suggests I do something different I'll commit this in a week or 
so.

My questions are

- Should the change to int10/generic.c be, err, more generic, ie. unaligned
  accesses are not allowed on the majority of platforms.

- Is defining PCVT_SUPPORT the right thing to do, or should WSCONS_SUPPORT be 
  sprinkled in the right places?

I'm happy with the IOPortBase change as this is inline with the ppc ioBase 
variable.

Nick

--Boundary-00=_juMlBpj9EYulIw5
Content-Type: text/x-diff;
  charset="us-ascii";
  name="src.x11.diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="src.x11.diffs"

Index: x11/Xserver/hw/xfree86/bin/kbd_mode/Makefile
===================================================================
RCS file: /cvsroot/src/x11/Xserver/hw/xfree86/bin/kbd_mode/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- x11/Xserver/hw/xfree86/bin/kbd_mode/Makefile	26 Dec 2003 05:23:15 -0000	1.1
+++ x11/Xserver/hw/xfree86/bin/kbd_mode/Makefile	12 Nov 2004 14:23:55 -0000
@@ -20,6 +20,10 @@
 
 CPPFLAGS+=	-DWSCONS_SUPPORT
 
+.if ${MACHINE} == "cats"
+CPPFLAGS+=	-DPCVT_SUPPORT
+.endif
+
 .if ${MACHINE} == "i386"
 CPPFLAGS+=	-DPCCONS_SUPPORT -DPCVT_SUPPORT
 .endif
Index: x11/Xserver/hw/xfree86/bin/xf86cfg/Makefile
===================================================================
RCS file: /cvsroot/src/x11/Xserver/hw/xfree86/bin/xf86cfg/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- x11/Xserver/hw/xfree86/bin/xf86cfg/Makefile	28 Mar 2004 15:19:30 -0000	1.4
+++ x11/Xserver/hw/xfree86/bin/xf86cfg/Makefile	12 Nov 2004 14:23:55 -0000
@@ -37,6 +37,10 @@
 		-DPROJECT_ROOT=\"/usr/X11R6\" \
 		-DXF86CONFIGDIR=\"/etc/X11\" -DWSCONS_SUPPORT
 
+.if ${MACHINE} == "cats"
+CPPFLAGS+=	-DPCVT_SUPPORT
+.endif
+		
 .if ${MACHINE} == "i386"
 CPPFLAGS+=	-DPCCONS_SUPPORT -DPCVT_SUPPORT
 .endif
Index: x11/Xserver/hw/xfree86/bin/xf86config/Makefile
===================================================================
RCS file: /cvsroot/src/x11/Xserver/hw/xfree86/bin/xf86config/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- x11/Xserver/hw/xfree86/bin/xf86config/Makefile	17 Mar 2004 23:19:48 -0000	1.4
+++ x11/Xserver/hw/xfree86/bin/xf86config/Makefile	12 Nov 2004 14:23:56 -0000
@@ -17,6 +17,10 @@
 		-DXVERSION="${XVERSION}" \
 		-DWSCONS_SUPPORT
 
+.if ${MACHINE} == "cats"
+CPPFLAGS+=	-DPCVT_SUPPORT
+.endif
+
 .if ${MACHINE} == "i386"
 CPPFLAGS+=	-DPCCONS_SUPPORT -DPCVT_SUPPORT
 .endif
Index: x11/Xserver/hw/xfree86/xf86/Makefile
===================================================================
RCS file: /cvsroot/src/x11/Xserver/hw/xfree86/xf86/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- x11/Xserver/hw/xfree86/xf86/Makefile	6 Mar 2004 03:31:08 -0000	1.5
+++ x11/Xserver/hw/xfree86/xf86/Makefile	12 Nov 2004 14:23:58 -0000
@@ -60,6 +60,10 @@
 CPPFLAGS+=	${X11FLAGS.EXTENSION} ${X11FLAGS.OS_DEFINES} \
 		-DXFree86LOADER -DWSCONS_SUPPORT
 
+.if ${MACHINE} == "cats"
+CPPFLAGS+=	-DPCVT_SUPPORT
+.endif
+
 .if ${MACHINE} == "i386"
 CPPFLAGS+=	-DPCCONS_SUPPORT -DPCVT_SUPPORT
 .endif
Index: x11/Xserver/hw/xfree86/xf86_os/Makefile
===================================================================
RCS file: /cvsroot/src/x11/Xserver/hw/xfree86/xf86_os/Makefile,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 Makefile
--- x11/Xserver/hw/xfree86/xf86_os/Makefile	11 May 2004 13:25:26 -0000	1.7.2.1
+++ x11/Xserver/hw/xfree86/xf86_os/Makefile	12 Nov 2004 14:23:58 -0000
@@ -47,7 +47,7 @@
 .if ${MACHINE} == "cats"
 SRCS.bsd+=      arm_video.c bsdResource.c pm_noop.c agp_noop.c ioperm_noop.c
 .for _FN in ${SRCS.bsd}
-CPPFLAGS.${_FN}=        -DWSCONS_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC
+CPPFLAGS.${_FN}=        -DPCVT_SUPPORT -DWSCONS_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC
 .endfor
 .endif
 
Index: x11/bin/xdm/config/Makefile
===================================================================
RCS file: /cvsroot/src/x11/bin/xdm/config/Makefile,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 Makefile
--- x11/bin/xdm/config/Makefile	27 Jun 2004 13:15:00 -0000	1.5.2.2
+++ x11/bin/xdm/config/Makefile	12 Nov 2004 14:24:02 -0000
@@ -9,7 +9,7 @@
 				-DXDM_BWPIXMAP=XFree86bw.xpm
 
 # native only gives DEFAULTVT for i386 and amd64.
-.if ${MACHINE} == "i386" || ${MACHINE} == "amd64"
+.if ${MACHINE} == "i386" || ${MACHINE} == "amd64" || ${MACHINE} == "cats"
 DEFAULTVT=vt05
 .else
 DEFAULTVT=	# defined empty

--Boundary-00=_juMlBpj9EYulIw5
Content-Type: text/x-diff;
  charset="us-ascii";
  name="xsrc.diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="xsrc.diffs"

Index: xfree/xc/programs/Xserver/hw/xfree86/common/compiler.h
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/common/compiler.h,v
retrieving revision 1.17
diff -u -r1.17 compiler.h
--- xfree/xc/programs/Xserver/hw/xfree86/common/compiler.h	28 Mar 2004 14:58:22 -0000	1.17
+++ xfree/xc/programs/Xserver/hw/xfree86/common/compiler.h	12 Nov 2004 14:29:55 -0000
@@ -923,7 +923,7 @@
 #define PORT_SIZE short
 #endif
 
-unsigned int IOPortBase;  /* Memory mapped I/O port area */
+extern unsigned int IOPortBase;  /* Memory mapped I/O port area */
 
 static __inline__ void
 outb(unsigned PORT_SIZE port, unsigned char val)
Index: xfree/xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v
retrieving revision 1.2
diff -u -r1.2 AsmMacros.h
--- xfree/xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h	3 Aug 2002 21:59:11 -0000	1.2
+++ xfree/xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h	12 Nov 2004 14:29:56 -0000
@@ -131,7 +131,7 @@
 }
 #else
 #if defined(__arm32__) || defined(__arm__)
-unsigned int IOPortBase;  /* Memory mapped I/O port area */
+extern unsigned int IOPortBase;  /* Memory mapped I/O port area */
 
 static __inline__ void
 outb(port, val)
Index: xfree/xc/programs/Xserver/hw/xfree86/int10/generic.c
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/int10/generic.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 generic.c
--- xfree/xc/programs/Xserver/hw/xfree86/int10/generic.c	5 Mar 2004 14:29:15 -0000	1.1.1.7
+++ xfree/xc/programs/Xserver/hw/xfree86/int10/generic.c	12 Nov 2004 14:30:03 -0000
@@ -498,24 +498,30 @@
 static CARD16
 read_w(xf86Int10InfoPtr pInt, int addr)
 {
+#if !defined(__arm__)
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
     if (OFF(addr + 1) > 0)
 	return V_ADDR_RW(addr);
 #endif
+#else
     return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8);
+#endif
 }
 
 static CARD32
 read_l(xf86Int10InfoPtr pInt, int addr)
 {
+#if !defined(__arm__)
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
     if (OFF(addr + 3) > 2)
 	return V_ADDR_RL(addr);
 #endif
+#else
     return V_ADDR_RB(addr) |
 	   (V_ADDR_RB(addr + 1) << 8) |
 	   (V_ADDR_RB(addr + 2) << 16) |
 	   (V_ADDR_RB(addr + 3) << 24);
+#endif
 }
 
 static void
@@ -527,25 +533,31 @@
 static void
 write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
 {
+#if !defined(__arm__)
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
     if (OFF(addr + 1) > 0)
       { V_ADDR_WW(addr, val); }
 #endif
+#else
     V_ADDR_WB(addr, val);
     V_ADDR_WB(addr + 1, val >> 8);
+#endif
 }
 
 static void
 write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
 {
+#if !defined(__arm__)
 #if X_BYTE_ORDER == X_LITTLE_ENDIAN
     if (OFF(addr + 3) > 2)
       { V_ADDR_WL(addr, val); }
 #endif
+#else
     V_ADDR_WB(addr, val);
     V_ADDR_WB(addr + 1, val >> 8);
     V_ADDR_WB(addr + 2, val >> 16);
     V_ADDR_WB(addr + 3, val >> 24);
+#endif
 }
 
 pointer
Index: xfree/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v
retrieving revision 1.7
diff -u -r1.7 xf86sym.c
--- xfree/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c	14 Oct 2004 12:39:21 -0000	1.7
+++ xfree/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c	12 Nov 2004 14:30:04 -0000
@@ -205,6 +205,8 @@
 #endif
 
 #if defined(__arm__) && defined(__NetBSD__)
+extern unsigned int IOPortBase;
+
 /* pull in the softfloat functions */
 extern float __addsf3 (float, float);
 extern double __adddf3 (double, double);
@@ -237,6 +239,7 @@
 extern int __gtdf2(double, double);
 extern double __negdf2(double);
 
+#pragma weak IOPortBase
 #pragma weak __addsf3
 #pragma weak __adddf3
 #pragma weak __subsf3
@@ -1181,6 +1184,7 @@
 
 #if defined(__NetBSD__)
 #if defined(__arm__)
+    SYMFUNC(IOPortBase)
     SYMFUNC(__addsf3)
     SYMFUNC(__adddf3)
     SYMFUNC(__subsf3)
Index: xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c
===================================================================
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c,v
retrieving revision 1.4
diff -u -r1.4 arm_video.c
--- xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c	10 Mar 2004 22:54:26 -0000	1.4
+++ xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c	12 Nov 2004 14:30:05 -0000
@@ -251,6 +251,7 @@
 #define	DEV_MEM_IOSIZE	0x00010000
 
 static Bool     ExtendedEnabled = FALSE;
+unsigned int IOPortBase;
 static unsigned int IOPortBase2;
 
 void

--Boundary-00=_juMlBpj9EYulIw5--