Re: [Linux-fbdev-devel] Re: [PATCH] fbdev: Fix IO access in rivafb

From: Guido Guenther
Date: Sat Nov 13 2004 - 08:02:02 EST

On Fri, Nov 12, 2004 at 11:32:07AM -0800, Linus Torvalds wrote:
> On Fri, 12 Nov 2004, Guido Guenther wrote:
> >
> > O.k., it was the __raw_{write,read}b which broke things, not the
> > "alignment". This one works:
> All right, that's as expected. However, it does seem to point out that the
> riva driver depends on _different_ memory ordering guarantees for the
> 8-bit accesses as opposed to the other ones. Whee. Can you say "UGGLEE"?

Aglie. This scared me too, so I had another look. It seems P{V,C}IO
areas are only accessed using VGA_{RD,WR}8 macros. NV_{RW,WR}08 are
never actually used directly. So this patch makes at least usage
consistent. VGA_{RD,WR}8 to access "I/O areas" in an ordered way. NV_*
for the rest. Please apply.
-- Guido

--- linux-2.6.10-rc1-mm5/drivers/video/riva/riva_hw.orig.2 2004-11-13 12:24:48.000000000 +0100
+++ linux-2.6.10-rc1-mm5/drivers/video/riva/riva_hw.h 2004-11-13 12:24:56.000000000 +0100
@@ -75,15 +75,15 @@
#include <asm/io.h>

-#define NV_WR08(p,i,d) (writeb((d), (void __iomem *)(p) + (i)))
-#define NV_RD08(p,i) (readb((void __iomem *)(p) + (i)))
+#define NV_WR08(p,i,d) (__raw_writeb((d), (void __iomem *)(p) + (i)))
+#define NV_RD08(p,i) (__raw_readb((void __iomem *)(p) + (i)))
#define NV_WR16(p,i,d) (__raw_writew((d), (void __iomem *)(p) + (i)))
#define NV_RD16(p,i) (__raw_readw((void __iomem *)(p) + (i)))
#define NV_WR32(p,i,d) (__raw_writel((d), (void __iomem *)(p) + (i)))
#define NV_RD32(p,i) (__raw_readl((void __iomem *)(p) + (i)))

-#define VGA_WR08(p,i,d) NV_WR08(p,i,d)
-#define VGA_RD08(p,i) NV_RD08(p,i)
+#define VGA_WR08(p,i,d) (writeb((d), (void __iomem *)(p) + (i)))
+#define VGA_RD08(p,i) (readb((void __iomem *)(p) + (i)))

* Define different architectures.

Signed-Off-By: Guido Guenther <agx@xxxxxxxxxxx>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at