diff options
-rw-r--r-- | arch/sparc/mm/generic.c | 10 | ||||
-rw-r--r-- | arch/sparc64/mm/generic.c | 15 | ||||
-rw-r--r-- | include/asm-sparc64/pgtable.h | 10 |
3 files changed, 19 insertions, 16 deletions
diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c index 0410bae681f8..2cb0728cee05 100644 --- a/arch/sparc/mm/generic.c +++ b/arch/sparc/mm/generic.c | |||
@@ -32,9 +32,7 @@ static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigne | |||
32 | if (end > PMD_SIZE) | 32 | if (end > PMD_SIZE) |
33 | end = PMD_SIZE; | 33 | end = PMD_SIZE; |
34 | do { | 34 | do { |
35 | pte_t oldpage = *pte; | 35 | set_pte_at(mm, address, pte, mk_pte_io(offset, prot, space)); |
36 | pte_clear(mm, address, pte); | ||
37 | set_pte(pte, mk_pte_io(offset, prot, space)); | ||
38 | address += PAGE_SIZE; | 36 | address += PAGE_SIZE; |
39 | offset += PAGE_SIZE; | 37 | offset += PAGE_SIZE; |
40 | pte++; | 38 | pte++; |
@@ -63,7 +61,7 @@ static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned | |||
63 | } | 61 | } |
64 | 62 | ||
65 | int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | 63 | int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, |
66 | unsigned long pfn, unsigned long size, pgprot_t prot) | 64 | unsigned long pfn, unsigned long size, pgprot_t prot) |
67 | { | 65 | { |
68 | int error = 0; | 66 | int error = 0; |
69 | pgd_t * dir; | 67 | pgd_t * dir; |
@@ -74,7 +72,9 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | |||
74 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; | 72 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; |
75 | 73 | ||
76 | /* See comment in mm/memory.c remap_pfn_range */ | 74 | /* See comment in mm/memory.c remap_pfn_range */ |
77 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_UNPAGED; | 75 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; |
76 | vma->vm_pgoff = (offset >> PAGE_SHIFT) | | ||
77 | ((unsigned long)space << 28UL); | ||
78 | 78 | ||
79 | prot = __pgprot(pg_iobits); | 79 | prot = __pgprot(pg_iobits); |
80 | offset -= from; | 80 | offset -= from; |
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c index 8fd4cb1f050a..d9396c1721cd 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 | * |
@@ -126,9 +135,13 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, | |||
126 | struct mm_struct *mm = vma->vm_mm; | 135 | struct mm_struct *mm = vma->vm_mm; |
127 | int space = GET_IOSPACE(pfn); | 136 | int space = GET_IOSPACE(pfn); |
128 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; | 137 | unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; |
138 | unsigned long phys_base; | ||
139 | |||
140 | phys_base = offset | (((unsigned long) space) << 32UL); | ||
129 | 141 | ||
130 | /* See comment in mm/memory.c remap_pfn_range */ | 142 | /* See comment in mm/memory.c remap_pfn_range */ |
131 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_UNPAGED; | 143 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; |
144 | vma->vm_pgoff = phys_base >> PAGE_SHIFT; | ||
132 | 145 | ||
133 | prot = __pgprot(pg_iobits); | 146 | prot = __pgprot(pg_iobits); |
134 | offset -= from; | 147 | offset -= from; |
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 9a02879b235d..f0a9b44d3eb5 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -348,16 +348,6 @@ extern unsigned long find_ecache_flush_span(unsigned long size); | |||
348 | struct vm_area_struct; | 348 | struct vm_area_struct; |
349 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | 349 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); |
350 | 350 | ||
351 | /* Make a non-present pseudo-TTE. */ | ||
352 | static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space) | ||
353 | { | ||
354 | pte_t pte; | ||
355 | pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) & | ||
356 | ~(unsigned long)_PAGE_CACHE); | ||
357 | pte_val(pte) |= (((unsigned long)space) << 32); | ||
358 | return pte; | ||
359 | } | ||
360 | |||
361 | /* Encode and de-code a swap entry */ | 351 | /* Encode and de-code a swap entry */ |
362 | #define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL) | 352 | #define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL) |
363 | #define __swp_offset(entry) ((entry).val >> (PAGE_SHIFT + 8UL)) | 353 | #define __swp_offset(entry) ((entry).val >> (PAGE_SHIFT + 8UL)) |