- Fix typo

- Clean up some macros
main
Kevin E Martin 2001-04-06 17:53:32 +00:00
parent 908d32f84c
commit 0e7f6c0726
2 changed files with 40 additions and 23 deletions

View File

@ -386,26 +386,37 @@ extern int r128_cce_indirect( struct inode *inode, struct file *filp,
#define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg ) #define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg )
#ifdef __alpha__ #ifdef __alpha__
#define R128_READ(reg) (_R128_READ((u32 *)R128_ADDR(reg))) #define R128_READ(reg) (_R128_READ((u32 *)R128_ADDR(reg)))
static inline u32 _R128_READ(u32 *addr) { static inline u32 _R128_READ(u32 *addr)
{
mb(); mb();
return *(volatile u32 *)addr; return *(volatile u32 *)addr;
} }
#define R128_WRITE(reg,val) \ #define R128_WRITE(reg,val) \
do { wmb(); R128_DEREF(reg) = val; } while (0) do { \
wmb(); \
R128_DEREF(reg) = val; \
} while (0)
#else #else
#define R128_READ(reg) le32_to_cpu( R128_DEREF( reg ) ) #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) #define R128_WRITE(reg,val) \
do { \
R128_DEREF( reg ) = cpu_to_le32( val ); \
} while (0)
#endif #endif
#define R128_DEREF8(reg) *(volatile u8 *)R128_ADDR( reg ) #define R128_DEREF8(reg) *(volatile u8 *)R128_ADDR( reg )
#ifdef __alpha__ #ifdef __alpha__
#define R128_READ8(reg) _R128_READ8((u8 *)R128_ADDR(reg)) #define R128_READ8(reg) _R128_READ8((u8 *)R128_ADDR(reg))
static inline u8 _R128_READ8(u8 *addr) { static inline u8 _R128_READ8(u8 *addr)
{
mb(); mb();
return *(volatile u8 *)addr; return *(volatile u8 *)addr;
} }
#define R128_WRITE8(reg,val) \ #define R128_WRITE8(reg,val) \
do { wmb(); R128_DEREF8(reg) = val; } while (0) do { \
wmb(); \
R128_DEREF8(reg) = val; \
} while (0)
#else #else
#define R128_READ8(reg) R128_DEREF8( reg ) #define R128_READ8(reg) R128_DEREF8( reg )
#define R128_WRITE8(reg,val) do { R128_DEREF8( reg ) = val; } while (0) #define R128_WRITE8(reg,val) do { R128_DEREF8( reg ) = val; } while (0)
@ -413,7 +424,8 @@ static inline u8 _R128_READ8(u8 *addr) {
#define R128_WRITE_PLL(addr,val) \ #define R128_WRITE_PLL(addr,val) \
do { \ do { \
R128_WRITE8(R128_CLOCK_CNTL_INDEX, ((addr) & 0x1f) | R128_PLL_WR_EN); \ R128_WRITE8(R128_CLOCK_CNTL_INDEX, \
((addr) & 0x1f) | R128_PLL_WR_EN); \
R128_WRITE(R128_CLOCK_CNTL_DATA, (val)); \ R128_WRITE(R128_CLOCK_CNTL_DATA, (val)); \
} while (0) } while (0)

View File

@ -521,13 +521,15 @@ extern int radeon_cp_indirect( struct inode *inode, struct file *filp,
#define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR( reg ) #define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR( reg )
#ifdef __alpha__ #ifdef __alpha__
#define RADEON_READ(reg) (_RADEON_READ((u32 *)RADEON_ADDR( reg ))) #define RADEON_READ(reg) (_RADEON_READ((u32 *)RADEON_ADDR( reg )))
static inline u32 _RADEON_READ(u32 *addr) { static inline u32 _RADEON_READ(u32 *addr)
{
mb(); mb();
return *(volatile u32 *)addr; return *(volatile u32 *)addr;
} }
#define RADEON_WRITE(reg,val) do { \ #define RADEON_WRITE(reg,val) \
wmb(); do { \
RADEON_DEREF(reg) = val; wmb(); \
RADEON_DEREF(reg) = val; \
} while (0) } while (0)
#else #else
#define RADEON_READ(reg) RADEON_DEREF( reg ) #define RADEON_READ(reg) RADEON_DEREF( reg )
@ -537,20 +539,23 @@ static inline u32 _RADEON_READ(u32 *addr) {
#define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR( reg ) #define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR( reg )
#ifdef __alpha__ #ifdef __alpha__
#define RADEON_READ8(reg) _RADEON_READ8((u8 *)RADEON_ADDR( reg )) #define RADEON_READ8(reg) _RADEON_READ8((u8 *)RADEON_ADDR( reg ))
static inline u8 _RADEON_READ8(u8 *addr) { static inline u8 _RADEON_READ8(u8 *addr)
{
mb(); mb();
return *(volatile u8 *)addr; return *(volatile u8 *)addr;
} }
#define RADEON_WRITE8(reg,val) do { \ #define RADEON_WRITE8(reg,val) \
wmb(); do { \
RADEON_DEREF8( reg ) = val; wmb(); \
RADEON_DEREF8( reg ) = val; \
} while (0) } while (0)
#else #else
#define RADEON_READ8(reg) RADEON_DEREF8( reg ) #define RADEON_READ8(reg) RADEON_DEREF8( reg )
#define RADEON_WRITE8(reg, val) do { RADEON_DEREF8( reg ) = val; } while (0) #define RADEON_WRITE8(reg, val) do { RADEON_DEREF8( reg ) = val; } while (0)
#endif #endif
#define RADEON_WRITE_PLL( addr, val ) do { \ #define RADEON_WRITE_PLL( addr, val ) \
do { \
RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \ RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \
((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \
RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \ RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \