On Fri, 2005-01-14 at 16:34 +0100, Jerome Glisse wrote: > > Anyway i wanted to ask mesa folks how to make a real > proper patch. The fact is that INREG & OUTREG in > server/radeon_macros.h have to do endian swapping. > Moreover the swapping is only needed for r300, isn't it ? > So do we need to have our own copy of radeon_macros.h > insted of using the one from dri/radeon/ ?
No. Try this patch, which is quite ugly though, most of this shouldn't be in driver specific code IMHO. -- Earthling Michel DÃnzer | Debian (powerpc), X and DRI developer Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer
Index: ./src/mesa/drivers/dri/radeon/server/radeon_macros.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/server/radeon_macros.h,v retrieving revision 1.2 diff -p -u -r1.2 radeon_macros.h --- ./src/mesa/drivers/dri/radeon/server/radeon_macros.h 6 Aug 2003 18:11:00 -0000 1.2 +++ ./src/mesa/drivers/dri/radeon/server/radeon_macros.h 14 Jan 2005 17:19:03 -0000 @@ -41,13 +41,34 @@ #define _RADEON_MACROS_H_ +#ifdef __powerpc__ + +static __inline__ unsigned int +MMIO_IN32(__volatile__ void *base, const unsigned long offset) +{ + register unsigned int val; + __asm__ __volatile__( + "lwbrx %0,%1,%2\n\t" + "eieio" + : "=r" (val) + : "b" (base), "r" (offset), + "m" (*((volatile unsigned char *)base+offset))); + return val; +} + +#else + +# define MMIO_IN32(base, offset) \ + LE32_TO_CPU(*(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset))) + +#endif + # define MMIO_IN8(base, offset) \ *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) # define MMIO_IN16(base, offset) \ *(volatile unsigned short *)(void *)(((unsigned char*)(base)) + (offset)) -# define MMIO_IN32(base, offset) \ - *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) + # define MMIO_OUT8(base, offset, val) \ *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) = (val) # define MMIO_OUT16(base, offset, val) \ @@ -55,7 +76,6 @@ # define MMIO_OUT32(base, offset, val) \ *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) = (val) - /* Memory mapped register access macros */ #define INREG8(addr) MMIO_IN8(RADEONMMIO, addr) #define INREG16(addr) MMIO_IN16(RADEONMMIO, addr)