[PATCH] xfree86: Add Loongson MIPS support
Matt Kraai
kraai at ftbfs.org
Thu Oct 13 20:26:18 PDT 2011
On Wed, Oct 12, 2011 at 05:15:57PM +0200, Mark Kettenis wrote:
> > Date: Wed, 12 Oct 2011 07:48:00 -0700
> > From: Alan Coopersmith <alan.coopersmith at oracle.com>
> >
> > On 10/11/11 11:58 PM, Matt Kraai wrote:
> > > +#elif defined(__mips__)
> > > + fd = open("/dev/mem", O_RDWR);
> > > + IOPortBase = (volatile unsigned char *)mmap(0, 0x20000,
> > > + PROT_READ | PROT_WRITE, MAP_SHARED, fd,
> > > + 0x1fd00000);
> > > + if (IOPortBase == MAP_FAILED) {
> > > + xf86Msg(X_WARNING,
> > > + "xf86EnableIOPorts: Failed to map iobase (%s)\n",
> > > + strerror(errno));
> > > + return FALSE;
> > > + }
> > > + close(fd);
> > > + xf86Msg(X_WARNING,
> > > + "xf86EnableIOPorts: map iobase (%x)\n",
> > > + IOPortBase);
> >
> > This is almost an exact copy of the existing powerpc code - is it really
> > necessary to duplicate it all instead of just doing something more like:
> >
> > #if defined(__powerpc__)
> > ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
> > #elif defined(__mips__)
> > ioBase_phys = 0x1fd00000;
> > #endif
> >
> > and then sharing the rest of the code?
Unfortunately, just doing this doesn't work. The MIPS code uses
IOPortBase whereas the PowerPC code uses ioBase. Would renaming one
to the other be acceptable? If so, which is preferable?
> Also, that code is pretty much going to be made obsolete by Jeremy
> Huddleston's pci bus cleanup diff. A better approach would be to
> convert the relevant drivers for loongson to use the new pci_io_xxx
> interfaces in libpciaccess instead of the raw in/out calls.
My system uses the siliconmotion driver. Would I need to start with
the instructions at
http://www.x.org/wiki/PciReworkHowto
and then replace the raw in/out calls?
--
Matt Kraai
https://ftbfs.org/kraai
More information about the xorg-devel
mailing list