<!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>
Finally, got this question fixed.<BR>
<BR>
<TT><FONT COLOR="#737373">> --- xc.old/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c</FONT></TT><BR>
<TT><FONT COLOR="#737373">> 2005-09-20 02:38:26.000000000 +0800</FONT></TT><BR>
<TT><FONT COLOR="#737373">> +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c</FONT></TT><BR>
<TT><FONT COLOR="#737373">> 2006-08-31 18:34:13.000000000 +0800</FONT></TT><BR>
<TT><FONT COLOR="#737373">> @@ -542,7 +542,7 @@</FONT></TT><BR>
<TT><FONT COLOR="#737373">> Bool</FONT></TT><BR>
<TT><FONT COLOR="#737373">> xf86EnableIO(void)</FONT></TT><BR>
<TT><FONT COLOR="#737373">> {</FONT></TT><BR>
<TT><FONT COLOR="#737373">> -#if defined(__powerpc__)</FONT></TT><BR>
<TT><FONT COLOR="#737373">> +#if defined(__powerpc__) || defined(__mips__)</FONT></TT><BR>
<TT><FONT COLOR="#737373">> int fd;</FONT></TT><BR>
<TT><FONT COLOR="#737373">> unsigned int ioBase_phys;</FONT></TT><BR>
<TT><FONT COLOR="#737373">> #endif</FONT></TT><BR>
<TT><FONT COLOR="#737373">> @@ -582,6 +582,25 @@</FONT></TT><BR>
<TT><FONT COLOR="#737373">> ioperm(0x40,4,0); /* trap access to the timer chip */</FONT></TT><BR>
<TT><FONT COLOR="#737373">> ioperm(0x60,4,0); /* trap access to the keyboard controller */</FONT></TT><BR>
<TT><FONT COLOR="#737373">> # endif</FONT></TT><BR>
<TT><FONT COLOR="#737373">> +#else</FONT></TT><BR>
<TT><FONT COLOR="#737373">> +</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + fd = open("/dev/mem", O_RDWR);</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + if (IOPortBase == NULL) {</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + IOPortBase = (volatile unsigned char *)mmap(0, 0x20000,</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + PROT_READ | PROT_WRITE, MAP_SHARED, fd,</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + 0x1fd00000);</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + }</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + close(fd);</FONT></TT><BR>
<TT><FONT COLOR="#737373">> +</FONT></TT><BR>
<TT><FONT COLOR="#737373">> #endif</FONT></TT><BR>
<TT><FONT COLOR="#737373">> ExtendedEnabled = TRUE;</FONT></TT><BR>
<BR>
It is very clear that compiled Xorg with MIPS, IOPortBase hasn't been initialized while it is used by outb() and inb(). Don't know why.<BR>
Now, Xorg works.<BR>
<BR>
<BR>
<BR>
On Wed, 2008-03-26 at 23:11 -0400, Michael Lorenz wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">-----BEGIN PGP SIGNED MESSAGE-----</FONT>
<FONT COLOR="#000000">Hash: SHA1</FONT>

<FONT COLOR="#000000">Hello,</FONT>

<FONT COLOR="#000000">On Mar 26, 2008, at 22:56, belcon zhao wrote:</FONT>

<FONT COLOR="#000000">> Just find that Xorg compiled xf86EnableIO() of hw/xfree86/os- </FONT>
<FONT COLOR="#000000">> support/linux/lnx_video.c. IOPortBase wasn't initialized in that  </FONT>
<FONT COLOR="#000000">> file. That's why IOPortBase is 0. So, it should be compiling  </FONT>
<FONT COLOR="#000000">> mistake. Did I do extra work while compile Xorg with mips?</FONT>

<FONT COLOR="#000000">I don't know about linux but what you need is:</FONT>
<FONT COLOR="#000000">- - figure out at which physical address your PCI host bridge puts IO  </FONT>
<FONT COLOR="#000000">space</FONT>
<FONT COLOR="#000000">- - mmap() it, on linux you'd probably use /dev/mem for that</FONT>
<FONT COLOR="#000000">- - set IOPortBase accordingly</FONT>

<FONT COLOR="#000000">Xorg probably doesn't know about your particular hardware and you  </FONT>
<FONT COLOR="#000000">didn't give any details either. As far as I can tell the problem  </FONT>
<FONT COLOR="#000000">isn't MIPS, it's accessing IO space on your machine. On MIPS that  </FONT>
<FONT COLOR="#000000">would be memory-mapped somewhere. I can't tell you where, you need   </FONT>
<FONT COLOR="#000000">to figure that out on your own or tell us what exactly you're dealing  </FONT>
<FONT COLOR="#000000">with.</FONT>

<FONT COLOR="#000000">have fun</FONT>
<FONT COLOR="#000000">Michael</FONT>

<FONT COLOR="#000000">-----BEGIN PGP SIGNATURE-----</FONT>
<FONT COLOR="#000000">Version: GnuPG v1.4.7 (Darwin)</FONT>

<FONT COLOR="#000000">iQEVAwUBR+sQgMpnzkX8Yg2nAQIhbggAkjwL3FgJLM1arnjWOkdzC7+uVJS9zDiQ</FONT>
<FONT COLOR="#000000">vFPdr9mcMqryXT+t2h6arg7jzcHDZqgwg2h++ew1/Az1dSKQYxlaZ8ZqPaNL4XD0</FONT>
<FONT COLOR="#000000">lEZ4hRU+m2LnK4CjYWmJlcooX6hUmB2qd7tA6t4zo8J4lUr4gcdp2FSJ/Qxe8yT3</FONT>
<FONT COLOR="#000000">8rWE2/z45WkkogOpznyPBxB0bOghYnwHLwb6Ltq0pPHdCtpfQIThx+LfEQealfwH</FONT>
<FONT COLOR="#000000">hkDbtyYfRMJt1Ru5Cpm9PNNl0ZRts34i3VBbxtPdhzAMBibfCbmEzerjGjzlq1Ke</FONT>
<FONT COLOR="#000000">0fhWNH3cHCAQ3R2gxlyXt2api+cNrpKjTdC9nZO5GkIleV0nCUScdQ==</FONT>
<FONT COLOR="#000000">=RqnM</FONT>
<FONT COLOR="#000000">-----END PGP SIGNATURE-----</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>