<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.14.3">
</HEAD>
<BODY>
Hi, all<BR>
<BR>
Just find that Xorg compiled xf86EnableIO() of hw/xfree86/os-support/linux/lnx_video.c. IOPortBase wasn't initialized in that file. That's why IOPortBase is 0. So, it should be compiling mistake. Did I do extra work while compile Xorg with mips?<BR>
<BR>
<BR>
Regards,<BR>
Belcon<BR>
<BR>
<BR>
On Thu, 2008-03-27 at 10:05 +0800, belcon zhao wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">Hi all,</FONT><BR>
<BR>
<FONT COLOR="#000000"> I compiled Xorg server from source code. My linux distribution is Debians and CPU is mipsel. I have tried source packages from freedesktop and debians. But xorg crashed when I tried to make it work. I just found it happened while graphic chip driver call outb(), which is defined as below:</FONT><BR>
<BR>
<FONT COLOR="#000000">static __inline__ void</FONT><BR>
<FONT COLOR="#000000">outb(unsigned PORT_SIZE port, unsigned char val)</FONT><BR>
<FONT COLOR="#000000">{</FONT><BR>
<FONT COLOR="#000000"> *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;</FONT><BR>
<FONT COLOR="#000000">}.</FONT><BR>
<BR>
<FONT COLOR="#000000">IOPortBase is defined in the same head file "hw/xfree86/common/compiler.h"</FONT><BR>
<FONT COLOR="#000000">I had grepped IOPortBase in the whole source code and I got below:</FONT><BR>
<BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: IOPortBase = base;</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: IOPortBase = base;</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: IOPortBase = (unsigned int)-1;</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: * space (e.g. 0x3B0), but IOPortBase is expected to map to</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: IOPortBase = (unsigned int)xf86MapInfoMap(memInfoP,</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: IOPortBase = (unsigned int)base;</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: if (IOPortBase == (unsigned int)-1)</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: munmap((caddr_t)IOPortBase, 0x400);</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/os-support/bsd/arm_video.c: IOPortBase = (unsigned int)-1;</FONT><BR>
<BR>
<FONT COLOR="#000000">hw/xfree86/common/compiler.h:unsigned int IOPortBase; /* Memory mapped I/O port area */</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/common/compiler.h: *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/common/compiler.h: *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/common/compiler.h: *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/common/compiler.h: return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase);</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/common/compiler.h: return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase);</FONT><BR>
<FONT COLOR="#000000">hw/xfree86/common/compiler.h: return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase);</FONT><BR>
<BR>
<FONT COLOR="#000000">To the file arm_video.c, only the first line worked others are remarked. The first line is in the function:</FONT><BR>
<BR>
<FONT COLOR="#000000">#if defined(USE_ARC_MMAP) || defined(__arm32__)</FONT><BR>
<BR>
<FONT COLOR="#000000">Bool</FONT><BR>
<FONT COLOR="#000000">xf86EnableIO()</FONT><BR>
<FONT COLOR="#000000">{</FONT><BR>
<FONT COLOR="#000000"> int fd;</FONT><BR>
<FONT COLOR="#000000"> pointer base;</FONT><BR>
<BR>
<FONT COLOR="#000000"> if (ExtendedEnabled)</FONT><BR>
<FONT COLOR="#000000"> return TRUE;</FONT><BR>
<BR>
<FONT COLOR="#000000"> if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {</FONT><BR>
<FONT COLOR="#000000"> /* Try to map a page at the pccons I/O space */</FONT><BR>
<FONT COLOR="#000000"> base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE,</FONT><BR>
<FONT COLOR="#000000"> MAP_FLAGS, fd, (off_t)0x0000);</FONT><BR>
<BR>
<FONT COLOR="#000000"> if (base != (pointer)-1) {</FONT><BR>
<FONT COLOR="#000000"> IOPortBase = base;</FONT><BR>
<FONT COLOR="#000000"> }</FONT><BR>
<FONT COLOR="#000000"> else {</FONT><BR>
<FONT COLOR="#000000"> xf86Msg(X_WARNING,"EnableIO: failed to mmap %s (%s)\n",</FONT><BR>
<FONT COLOR="#000000"> "/dev/ttyC0", strerror(errno));</FONT><BR>
<FONT COLOR="#000000"> return FALSE;</FONT><BR>
<FONT COLOR="#000000"> }</FONT><BR>
<FONT COLOR="#000000"> }</FONT><BR>
<FONT COLOR="#000000"> else {</FONT><BR>
<FONT COLOR="#000000"> xf86Msg("EnableIO: failed to open %s (%s)\n",</FONT><BR>
<FONT COLOR="#000000"> "/dev/ttyC0", strerror(errno));</FONT><BR>
<FONT COLOR="#000000"> return FALSE;</FONT><BR>
<FONT COLOR="#000000"> }</FONT><BR>
<BR>
<FONT COLOR="#000000"> ExtendedEnabled = TRUE;</FONT><BR>
<BR>
<FONT COLOR="#000000"> return TRUE;</FONT><BR>
<FONT COLOR="#000000">}</FONT><BR>
<BR>
<FONT COLOR="#000000">Since there is "#if defined(USE_ARC_MMAP) || defined(__arm32__)", I am not sure that this function had been compiled into Xorg. </FONT><BR>
<FONT COLOR="#000000">I just test this </FONT><BR>
<FONT COLOR="#000000">#include <stdio.h></FONT><BR>
<FONT COLOR="#000000">int main(void)</FONT><BR>
<FONT COLOR="#000000">{</FONT><BR>
<FONT COLOR="#000000">#if defined(__mips__)</FONT><BR>
<FONT COLOR="#000000"> printf("mips\n");</FONT><BR>
<FONT COLOR="#000000">#elif defined(__arm32__)</FONT><BR>
<FONT COLOR="#000000"> printf("arm32\n");</FONT><BR>
<FONT COLOR="#000000">#else</FONT><BR>
<FONT COLOR="#000000"> printf("hehe\n");</FONT><BR>
<FONT COLOR="#000000">#endif</FONT><BR>
<FONT COLOR="#000000"> return 0;</FONT><BR>
<FONT COLOR="#000000">}</FONT><BR>
<FONT COLOR="#000000">and it just show "mips". So I am afraid that the function xf86EnableIO() which assigned value to IOPortBase wouldn't been compiled into Xorg.</FONT><BR>
<BR>
<FONT COLOR="#000000">IOPortBase is 0 if I use my own Xorg.</FONT><BR>
<BR>
<FONT COLOR="#000000">I also tried the default Xorg which works fine. IOPortBase is not 0.</FONT><BR>
<BR>
<FONT COLOR="#000000">I compiled Xorg with "--enable-debug --prefix=/root/belcon".</FONT><BR>
<BR>
<FONT COLOR="#000000">Any one has any ideas? Maybe it is just something related to "./configure".</FONT><BR>
<BR>
<FONT COLOR="#000000">Regards,</FONT><BR>
<FONT COLOR="#000000"> Belcon</FONT><BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<FONT COLOR="#000000">Below is gdb output:</FONT><BR>
<BR>
<BR>
<FONT COLOR="#000000">gdb hw/xfree86/Xorg </FONT><BR>
<FONT COLOR="#000000">GNU gdb 6.4.90-debian</FONT><BR>
<FONT COLOR="#000000">Copyright (C) 2006 Free Software Foundation, Inc.</FONT><BR>
<FONT COLOR="#000000">GDB is free software, covered by the GNU General Public License, and you are</FONT><BR>
<FONT COLOR="#000000">welcome to change it and/or distribute copies of it under certain conditions.</FONT><BR>
<FONT COLOR="#000000">Type "show copying" to see the conditions.</FONT><BR>
<FONT COLOR="#000000">There is absolutely no warranty for GDB. Type "show warranty" for details.</FONT><BR>
<FONT COLOR="#000000">This GDB was configured as "mipsel-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".</FONT><BR>
<BR>
<FONT COLOR="#000000">(gdb) run</FONT><BR>
<FONT COLOR="#000000">Starting program: /root/belcon/xorg-server-1.1.1/hw/xfree86/Xorg </FONT><BR>
<FONT COLOR="#000000">_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6</FONT><BR>
<FONT COLOR="#000000">_XSERVTransOpen: transport open failed for inet6/debian:0</FONT><BR>
<FONT COLOR="#000000">_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6</FONT><BR>
<BR>
<FONT COLOR="#000000">X Window System Version 7.1.1</FONT><BR>
<FONT COLOR="#000000">Release Date: 12 May 2006</FONT><BR>
<FONT COLOR="#000000">X Protocol Version 11, Revision 0, Release 7.1.1</FONT><BR>
<FONT COLOR="#000000">Build Operating System: Linux 2.6.18.1 mips64 </FONT><BR>
<FONT COLOR="#000000">Current Operating System: Linux debian 2.6.18.1 #3 Mon Sep 3 12:52:27 CST 2007 mips64</FONT><BR>
<FONT COLOR="#000000">Build Date: 21 March 2008</FONT><BR>
<FONT COLOR="#000000"> Before reporting problems, check <A HREF="http://wiki.x.org">http://wiki.x.org</A></FONT><BR>
<FONT COLOR="#000000"> to make sure that you have the latest version.</FONT><BR>
<FONT COLOR="#000000">Module Loader present</FONT><BR>
<FONT COLOR="#000000">Markers: (--) probed, (**) from config file, (==) default setting,</FONT><BR>
<FONT COLOR="#000000"> (++) from command line, (!!) notice, (II) informational,</FONT><BR>
<FONT COLOR="#000000"> (WW) warning, (EE) error, (NI) not implemented, (??) unknown.</FONT><BR>
<FONT COLOR="#000000">(==) Log file: "/root/belcon//var/log/Xorg.0.log", Time: Mon Mar 24 14:18:39 2008</FONT><BR>
<FONT COLOR="#000000">(==) Using config file: "/etc/X11/xorg.conf"</FONT><BR>
<FONT COLOR="#000000">[tcsetpgrp failed in terminal_inferior: 不允许的操作]</FONT><BR>
<FONT COLOR="#000000">(EE) Silicon MotionlcdWidth = 1280</FONT><BR>
<FONT COLOR="#000000">LCD Base = 0</FONT><BR>
<FONT COLOR="#000000">FBOffset is 0x0</FONT><BR>
<BR>
<FONT COLOR="#000000">Program received signal SIGSEGV, Segmentation fault.</FONT><BR>
<FONT COLOR="#000000">SMI_SaveScreen (pScreen=<value optimized out>, mode=<value optimized out>)</FONT><BR>
<FONT COLOR="#000000"> at /usr/include/xorg/compiler.h:916</FONT><BR>
<FONT COLOR="#000000">916 *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;</FONT><BR>
<FONT COLOR="#000000">(gdb) print IOPortBase</FONT><BR>
<FONT COLOR="#000000">$1 = 0</FONT><BR>
<FONT COLOR="#000000">(gdb) bt f</FONT><BR>
<FONT COLOR="#000000">#0 SMI_SaveScreen (pScreen=<value optimized out>, mode=<value optimized out>)</FONT><BR>
<FONT COLOR="#000000"> at /usr/include/xorg/compiler.h:916</FONT><BR>
<FONT COLOR="#000000"> seq1 = <value optimized out></FONT><BR>
<FONT COLOR="#000000"> pScrn = <value optimized out></FONT><BR>
<FONT COLOR="#000000"> on = 1</FONT><BR>
<FONT COLOR="#000000"> pSmi = (SMIPtr) 0x64a280</FONT><BR>
<FONT COLOR="#000000">#1 0x0042ef10 in SaveScreens (on=2, mode=0) at window.c:3386</FONT><BR>
<FONT COLOR="#000000"> i = 0</FONT><BR>
<FONT COLOR="#000000"> what = 1</FONT><BR>
<FONT COLOR="#000000"> type = 1</FONT><BR>
<FONT COLOR="#000000">#2 0x00423d00 in main (argc=1, argv=0x7f80bab4, envp=<value optimized out>)</FONT><BR>
<FONT COLOR="#000000"> at main.c:434</FONT><BR>
<FONT COLOR="#000000"> pScreen = <value optimized out></FONT><BR>
<FONT COLOR="#000000"> i = 1</FONT><BR>
<FONT COLOR="#000000"> error = 6412720</FONT><BR>
<FONT COLOR="#000000"> xauthfile = <value optimized out></FONT><BR>
<FONT COLOR="#000000"> alwaysCheckForInput = {0, 1}</FONT><BR>
<BR>
<PRE>
<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">xorg mailing list</FONT>
<FONT COLOR="#000000"><A HREF="mailto:xorg@lists.freedesktop.org">xorg@lists.freedesktop.org</A></FONT>
<FONT COLOR="#000000"><A HREF="http://lists.freedesktop.org/mailman/listinfo/xorg">http://lists.freedesktop.org/mailman/listinfo/xorg</A></FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>