diff options
Diffstat (limited to 'arch/sparc64/mm/generic.c')
-rw-r--r-- | arch/sparc64/mm/generic.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c index 8fd4cb1f050a..580b63da836b 100644 --- a/arch/sparc64/mm/generic.c +++ b/arch/sparc64/mm/generic.c | |||
@@ -15,6 +15,15 @@ | |||
15 | #include <asm/page.h> | 15 | #include <asm/page.h> |
16 | #include <asm/tlbflush.h> | 16 | #include <asm/tlbflush.h> |
17 | 17 | ||
18 | static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space) | ||
19 | { | ||
20 | pte_t pte; | ||
21 | pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) & | ||
22 | ~(unsigned long)_PAGE_CACHE); | ||
23 | pte_val(pte) |= (((unsigned long)space) << 32); | ||
24 | return pte; | ||
25 | } | ||
26 | |||
18 | /* Remap IO memory, the same way as remap_pfn_range(), but use | 27 | /* Remap IO memory, the same way as remap_pfn_range(), but use |
19 | * the obio memory space. | 28 | * the obio memory space. |
20 | * | 29 | * |
@@ -68,6 +77,7 @@ static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, | |||
68 | BUG_ON(!pte_none(*pte)); | 77 | BUG_ON(!pte_none(*pte)); |
69 | set_pte_at(mm, address, pte, entry); | 78 | set_pte_at(mm, address, pte, entry); |
70 | address += PAGE_SIZE; | 79 | address += PAGE_SIZE; |
80 | pte_val(entry) += PAGE_SIZE; | ||
71 | pte++; | 81 | pte++; |
72 | } while (address < curend); | 82 | } while (address < curend); |
73 | } while (address < end); | 83 | } while (address < end); |
@@ -126,9 +136,13 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | |||
126 | struct mm_struct *mm = vma->vm_mm; | 136 | struct mm_struct *mm = vma->vm_mm; |
127 | int space = GET_IOSPACE(pfn); | 137 | int space = GET_IOSPACE(pfn); |
128 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; | 138 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; |
139 | unsigned long phys_base; | ||
140 | |||
141 | phys_base = offset | (((unsigned long) space) << 32UL); | ||
129 | 142 | ||
130 | /* See comment in mm/memory.c remap_pfn_range */ | 143 | /* See comment in mm/memory.c remap_pfn_range */ |
131 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_UNPAGED; | 144 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; |
145 | vma->vm_pgoff = phys_base >> PAGE_SHIFT; | ||
132 | 146 | ||
133 | prot = __pgprot(pg_iobits); | 147 | prot = __pgprot(pg_iobits); |
134 | offset -= from; | 148 | offset -= from; |