[PATCH 2.6.10-rc3-mm1] m32r: Support pgprot_noncached()
From: Hirokazu Takata
Date: Wed Dec 15 2004 - 05:58:48 EST
Hello,
This patch updates include/asm-m32r/pgtable.h to add pgprot_noncached().
It is required to fix a problem of an userspace application, which mmaps
io registers.
This patch also modifies drivers/video/fbmem.c to support noncachable
framebuffer access for m32r.
In this routine, pgprot_writecombine() is used hopefully, even though
the current m32r never does write-combining or write-coalescing...
Please apply this.
* include/asm-m32r/pgtable.h
(pgprot_noncached, pgprot_writecombine): Newly added.
* drivers/video/fbmem.c (fb_mmap): Add m32r support.
Thanks,
Signed-off-by: Mamoru Sakugawa <sakugawa@xxxxxxxxxxxxxx>
Signed-off-by: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
---
drivers/video/fbmem.c | 3 ++-
include/asm-m32r/pgtable.h | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff -ruNp a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
--- a/include/asm-m32r/pgtable.h 2004-12-15 12:56:47.000000000 +0900
+++ b/include/asm-m32r/pgtable.h 2004-12-15 18:15:30.000000000 +0900
@@ -341,6 +341,19 @@ static __inline__ void ptep_mkdirty(pte_
}
/*
+ * Macro and implementation to make a page protection as uncachable.
+ */
+static __inline__ pgprot_t pgprot_noncached(pgprot_t _prot)
+{
+ unsigned long prot = pgprot_val(_prot);
+
+ prot |= _PAGE_NONCACHABLE;
+ return __pgprot(prot);
+}
+
+#define pgprot_writecombine(prot) pgprot_noncached(prot)
+
+/*
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
*/
diff -ruNp a/drivers/video/fbmem.c b/drivers/video/fbmem.c
--- a/drivers/video/fbmem.c 2004-12-15 12:56:38.000000000 +0900
+++ b/drivers/video/fbmem.c 2004-12-15 18:17:50.000000000 +0900
@@ -938,7 +938,8 @@ fb_mmap(struct file *file, struct vm_are
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
#elif defined(__hppa__)
pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
-#elif defined(__ia64__) || defined(__arm__) || defined(__sh__)
+#elif defined(__ia64__) || defined(__arm__) || defined(__sh__) || \
+ defined(__m32r__)
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
#else
#warning What do we have to do here??
--
Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Linux/M32R Project: http://www.linux-m32r.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/