About variable "IOPortBase"

belcon zhao belcon.zhao at siliconmotion.com.cn
Thu Mar 27 00:15:08 PDT 2008


Hi all,

Finally, got this question fixed.

> --- xc.old/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
> 2005-09-20 02:38:26.000000000 +0800
> +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
> 2006-08-31 18:34:13.000000000 +0800
> @@ -542,7 +542,7 @@
> Bool
> xf86EnableIO(void)
> {
> -#if defined(__powerpc__)
> +#if defined(__powerpc__) || defined(__mips__)
> int fd;
> unsigned int ioBase_phys;
> #endif
> @@ -582,6 +582,25 @@
> ioperm(0x40,4,0); /* trap access to the timer chip */
> ioperm(0x60,4,0); /* trap access to the keyboard controller */
> # endif
> +#else
> +
> + fd = open("/dev/mem", O_RDWR);
> + if (IOPortBase == NULL) {
> + IOPortBase = (volatile unsigned char *)mmap(0, 0x20000,
> + PROT_READ | PROT_WRITE, MAP_SHARED, fd,
> + 0x1fd00000);
> + }
> + close(fd);
> +
> #endif
> ExtendedEnabled = TRUE;

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.
Now, Xorg works.



On Wed, 2008-03-26 at 23:11 -0400, Michael Lorenz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> 
> On Mar 26, 2008, at 22:56, belcon zhao wrote:
> 
> > 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?
> 
> I don't know about linux but what you need is:
> - - figure out at which physical address your PCI host bridge puts IO  
> space
> - - mmap() it, on linux you'd probably use /dev/mem for that
> - - set IOPortBase accordingly
> 
> Xorg probably doesn't know about your particular hardware and you  
> didn't give any details either. As far as I can tell the problem  
> isn't MIPS, it's accessing IO space on your machine. On MIPS that  
> would be memory-mapped somewhere. I can't tell you where, you need   
> to figure that out on your own or tell us what exactly you're dealing  
> with.
> 
> have fun
> Michael
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (Darwin)
> 
> iQEVAwUBR+sQgMpnzkX8Yg2nAQIhbggAkjwL3FgJLM1arnjWOkdzC7+uVJS9zDiQ
> vFPdr9mcMqryXT+t2h6arg7jzcHDZqgwg2h++ew1/Az1dSKQYxlaZ8ZqPaNL4XD0
> lEZ4hRU+m2LnK4CjYWmJlcooX6hUmB2qd7tA6t4zo8J4lUr4gcdp2FSJ/Qxe8yT3
> 8rWE2/z45WkkogOpznyPBxB0bOghYnwHLwb6Ltq0pPHdCtpfQIThx+LfEQealfwH
> hkDbtyYfRMJt1Ru5Cpm9PNNl0ZRts34i3VBbxtPdhzAMBibfCbmEzerjGjzlq1Ke
> 0fhWNH3cHCAQ3R2gxlyXt2api+cNrpKjTdC9nZO5GkIleV0nCUScdQ==
> =RqnM
> -----END PGP SIGNATURE-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20080327/16147dab/attachment.html>


More information about the xorg mailing list