summaryrefslogtreecommitdiff
path: root/linux/r128_drv.h
diff options
context:
space:
mode:
authorMichel Daenzer <michel@daenzer.net>2000-08-09 00:01:52 +0000
committerMichel Daenzer <michel@daenzer.net>2000-08-09 00:01:52 +0000
commit40e7e8de2f60f4af6014bb828dc9f55994adcf8f (patch)
tree9bebe285f17f1a7d911be3276926e8dfff16f521 /linux/r128_drv.h
parent8b9363d1b1f7bc40fb68261f7659dea5124f2821 (diff)
Diffstat (limited to 'linux/r128_drv.h')
-rw-r--r--linux/r128_drv.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/linux/r128_drv.h b/linux/r128_drv.h
index 5b15dddf..91ad9f53 100644
--- a/linux/r128_drv.h
+++ b/linux/r128_drv.h
@@ -197,6 +197,43 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new);
#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */
+#ifdef __powerpc__
+
+static __inline__ void
+WriteMmio32Le(void *base, const unsigned long offset,
+ const unsigned long val)
+{
+ __asm__ __volatile__(
+ "stwbrx %1,%2,%3\n\t"
+ : "=m" (*(volatile unsigned char *)(base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ unsigned int
+ReadMmio32Le(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);
+}
+
+#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle))
+#define R128_ADDR(reg) (R128_BASE(reg) + reg)
+
+#define R128_READ(reg) ReadMmio32Le(R128_BASE(reg),reg)
+#define R128_WRITE(reg,val) WriteMmio32Le(R128_BASE(reg),reg,val)
+
+#define R128_DEREF8(reg) *(__volatile__ char *)R128_ADDR(reg)
+#define R128_READ8(reg) R128_DEREF8(reg)
+#define R128_WRITE8(reg,val) do { R128_DEREF8(reg) = val; } while (0)
+
+#else /* ! __powerpc__ */
+
#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle))
#define R128_ADDR(reg) (R128_BASE(reg) + reg)
@@ -208,6 +245,8 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new);
#define R128_READ8(reg) R128_DEREF8(reg)
#define R128_WRITE8(reg,val) do { R128_DEREF8(reg) = val; } while (0)
+#endif /* __powerpc__ */
+
#define R128_WRITE_PLL(addr,val) \
do { \
R128_WRITE8(R128_CLOCK_CNTL_INDEX, ((addr) & 0x1f) | R128_PLL_WR_EN); \