forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/openrisc/mm/ioremap.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * OpenRISC ioremap.c
34 *
....@@ -8,20 +9,14 @@
89 * Modifications for the OpenRISC architecture:
910 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
1011 * 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.
1612 */
1713
1814 #include <linux/vmalloc.h>
1915 #include <linux/io.h>
16
+#include <linux/pgtable.h>
2017 #include <asm/pgalloc.h>
21
-#include <asm/kmap_types.h>
2218 #include <asm/fixmap.h>
2319 #include <asm/bug.h>
24
-#include <asm/pgtable.h>
2520 #include <linux/sched.h>
2621 #include <asm/tlbflush.h>
2722
....@@ -38,8 +33,7 @@
3833 * have to convert them into an offset in a page-aligned mapping, but the
3934 * caller shouldn't need to know that small detail.
4035 */
41
-void __iomem *__ref
42
-__ioremap(phys_addr_t addr, unsigned long size, pgprot_t prot)
36
+void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size)
4337 {
4438 phys_addr_t p;
4539 unsigned long v;
....@@ -70,7 +64,8 @@
7064 fixmaps_used += (size >> PAGE_SHIFT);
7165 }
7266
73
- if (ioremap_page_range(v, v + size, p, prot)) {
67
+ if (ioremap_page_range(v, v + size, p,
68
+ __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI))) {
7469 if (likely(mem_init_done))
7570 vfree(area->addr);
7671 else
....@@ -80,7 +75,7 @@
8075
8176 return (void __iomem *)(offset + (char *)v);
8277 }
83
-EXPORT_SYMBOL(__ioremap);
78
+EXPORT_SYMBOL(ioremap);
8479
8580 void iounmap(void *addr)
8681 {
....@@ -118,18 +113,18 @@
118113 * the memblock infrastructure.
119114 */
120115
121
-pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm,
122
- unsigned long address)
116
+pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm)
123117 {
124118 pte_t *pte;
125119
126120 if (likely(mem_init_done)) {
127
- pte = (pte_t *) __get_free_page(GFP_KERNEL);
121
+ pte = (pte_t *)get_zeroed_page(GFP_KERNEL);
128122 } else {
129
- pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
123
+ pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
124
+ if (!pte)
125
+ panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
126
+ __func__, PAGE_SIZE, PAGE_SIZE);
130127 }
131128
132
- if (pte)
133
- clear_page(pte);
134129 return pte;
135130 }