.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * OpenRISC ioremap.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
8 | 9 | * Modifications for the OpenRISC architecture: |
---|
9 | 10 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> |
---|
10 | 11 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> |
---|
11 | | - * |
---|
12 | | - * This program is free software; you can redistribute it and/or |
---|
13 | | - * modify it under the terms of the GNU General Public License |
---|
14 | | - * as published by the Free Software Foundation; either version |
---|
15 | | - * 2 of the License, or (at your option) any later version. |
---|
16 | 12 | */ |
---|
17 | 13 | |
---|
18 | 14 | #include <linux/vmalloc.h> |
---|
19 | 15 | #include <linux/io.h> |
---|
| 16 | +#include <linux/pgtable.h> |
---|
20 | 17 | #include <asm/pgalloc.h> |
---|
21 | 18 | #include <asm/kmap_types.h> |
---|
22 | 19 | #include <asm/fixmap.h> |
---|
23 | 20 | #include <asm/bug.h> |
---|
24 | | -#include <asm/pgtable.h> |
---|
25 | 21 | #include <linux/sched.h> |
---|
26 | 22 | #include <asm/tlbflush.h> |
---|
27 | 23 | |
---|
.. | .. |
---|
38 | 34 | * have to convert them into an offset in a page-aligned mapping, but the |
---|
39 | 35 | * caller shouldn't need to know that small detail. |
---|
40 | 36 | */ |
---|
41 | | -void __iomem *__ref |
---|
42 | | -__ioremap(phys_addr_t addr, unsigned long size, pgprot_t prot) |
---|
| 37 | +void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size) |
---|
43 | 38 | { |
---|
44 | 39 | phys_addr_t p; |
---|
45 | 40 | unsigned long v; |
---|
.. | .. |
---|
70 | 65 | fixmaps_used += (size >> PAGE_SHIFT); |
---|
71 | 66 | } |
---|
72 | 67 | |
---|
73 | | - if (ioremap_page_range(v, v + size, p, prot)) { |
---|
| 68 | + if (ioremap_page_range(v, v + size, p, |
---|
| 69 | + __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI))) { |
---|
74 | 70 | if (likely(mem_init_done)) |
---|
75 | 71 | vfree(area->addr); |
---|
76 | 72 | else |
---|
.. | .. |
---|
80 | 76 | |
---|
81 | 77 | return (void __iomem *)(offset + (char *)v); |
---|
82 | 78 | } |
---|
83 | | -EXPORT_SYMBOL(__ioremap); |
---|
| 79 | +EXPORT_SYMBOL(ioremap); |
---|
84 | 80 | |
---|
85 | 81 | void iounmap(void *addr) |
---|
86 | 82 | { |
---|
.. | .. |
---|
118 | 114 | * the memblock infrastructure. |
---|
119 | 115 | */ |
---|
120 | 116 | |
---|
121 | | -pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm, |
---|
122 | | - unsigned long address) |
---|
| 117 | +pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm) |
---|
123 | 118 | { |
---|
124 | 119 | pte_t *pte; |
---|
125 | 120 | |
---|
126 | 121 | if (likely(mem_init_done)) { |
---|
127 | | - pte = (pte_t *) __get_free_page(GFP_KERNEL); |
---|
| 122 | + pte = (pte_t *)get_zeroed_page(GFP_KERNEL); |
---|
128 | 123 | } else { |
---|
129 | | - pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE)); |
---|
| 124 | + pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE); |
---|
| 125 | + if (!pte) |
---|
| 126 | + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", |
---|
| 127 | + __func__, PAGE_SIZE, PAGE_SIZE); |
---|
130 | 128 | } |
---|
131 | 129 | |
---|
132 | | - if (pte) |
---|
133 | | - clear_page(pte); |
---|
134 | 130 | return pte; |
---|
135 | 131 | } |
---|