]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/ppc-pseries-bsr-4k.patch
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / ppc-pseries-bsr-4k.patch
CommitLineData
2cb7cef9
BS
1Subject: Unable to Use Small BSR register on Power LPAR
2From: Sonny Rao <sonnyrao@us.ibm.com>
3References: 443673 - LTC49749
4
5Fix the BSR driver to allow small BSR devices on a 64k page kernel.
6Previously the driver would reject the mmap since the size was smaller
7than PAGESIZE. This patch adds a check for this case and uses remap_4k_pfn().
8
9Also, take out code to set vm_flags, as the remap_pfn functions will
10do this for us.
11
12Signed-off-by: Sonny Rao <sonnyrao@us.ibm.com>
13Signed-off-by: Olaf Hering <olh@suse.de>
14
15---
16 drivers/char/bsr.c | 20 ++++++++++++++------
17 1 file changed, 14 insertions(+), 6 deletions(-)
18
19--- a/drivers/char/bsr.c
20+++ b/drivers/char/bsr.c
21@@ -27,6 +27,7 @@
22 #include <linux/cdev.h>
23 #include <linux/list.h>
24 #include <linux/mm.h>
25+#include <asm/pgtable.h>
26 #include <asm/io.h>
27
28 /*
29@@ -115,15 +116,22 @@ static int bsr_mmap(struct file *filp, s
30 {
31 unsigned long size = vma->vm_end - vma->vm_start;
32 struct bsr_dev *dev = filp->private_data;
33+ int ret;
34
35- if (size > dev->bsr_len || (size & (PAGE_SIZE-1)))
36- return -EINVAL;
37-
38- vma->vm_flags |= (VM_IO | VM_DONTEXPAND);
39 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
40
41- if (io_remap_pfn_range(vma, vma->vm_start, dev->bsr_addr >> PAGE_SHIFT,
42- size, vma->vm_page_prot))
43+ /* check for the case of a small BSR device and map one 4k page for it*/
44+ if (dev->bsr_len < PAGE_SIZE && size == PAGE_SIZE)
45+ ret = remap_4k_pfn(vma, vma->vm_start, dev->bsr_addr >> 12,
46+ vma->vm_page_prot);
47+ else if (size <= dev->bsr_len)
48+ ret = io_remap_pfn_range(vma, vma->vm_start,
49+ dev->bsr_addr >> PAGE_SHIFT,
50+ size, vma->vm_page_prot);
51+ else
52+ return -EINVAL;
53+
54+ if (ret)
55 return -EAGAIN;
56
57 return 0;