On 2002.04.24 12:41 Michel D�nzer wrote:
> On Wed, 2002-04-24 at 10:52, Jos� Fonseca wrote:
> > On 2002.04.24 09:34 Michel D�nzer wrote:
> > > ...
> > >
> > > Anyway, MACH64_{READ,WRITE} will likely have to be changed to use
> > > {in,out}_le32 (in mach64_drv.h) for it to work on PPC.
> > >
> >
> > As Peter managed to get everything to compile, yesterday I was looking
> > into this but when looking at r128_drv.h but it only used the
> > le32_to_cpu/cpu_to_le32 macros for Alpha.
>
> Look again. :)
>
Oops! I saw exactly the other way around. :o)
> While r128 currently has only cpu_to_le32 and le32_to_cpu, I think
> {in,out}_le32 would be better because they are designed for MMIO and
> preserve the order of memory/bus access. In fact, I propose to use them
> for MMIO in all drivers on all architectures.
>
So your suggestion (taking R128 code as an example) would be to change
this:
#define R128_READ(reg) le32_to_cpu( R128_DEREF( reg ) )
#define R128_WRITE(reg,val) \
do { \
R128_DEREF( reg ) = cpu_to_le32( val ); \
} while (0)
to this instead:
#define R128_READ(reg) in_le32( R128_ADDR( reg ) )
#define R128_WRITE(reg,val) \
do { \
out_le32( R128_ADDR( reg ), val ); \
} while (0)
if I understood properly the {in,out}_le32 usage.
> > I guesses that for MMIO operation this wouldn't be necessary in
> PowerPC
> > after all, as is the case of Mach64. Is this so? If so in which
> > situations is it necessary to account for endian machines?
>
> PCI is little endian so normally all access to a PCI device is little
> endian. While most current graphics chip offer big endian apertures for
> the framebuffer and registers, it's usually better and cleaner to use
> the little endian aperture for the latter, in particular if not all
> registers are 32 bit wide. At least PPC can load and store in little
> endian so performance is not an issue.
>
Ok. Thanks for the enlightenment.
> -- Earthling Michel D�nzer (MrCooper)/ Debian GNU/Linux (powerpc)
> developer
> XFree86 and DRI project member / CS student, Free Software enthusiast
Jos� Fonseca
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel