| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Based on arch/arm/mm/ioremap.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Hacked to allow all architectures to build, and various cleanups |
|---|
| 7 | 8 | * by Russell King |
|---|
| 8 | 9 | * Copyright (C) 2012 ARM Ltd. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 12 | | - * published by the Free Software Foundation. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * You should have received a copy of the GNU General Public License |
|---|
| 20 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 21 | 10 | */ |
|---|
| 22 | 11 | |
|---|
| 23 | 12 | #include <linux/export.h> |
|---|
| 24 | 13 | #include <linux/mm.h> |
|---|
| 25 | 14 | #include <linux/vmalloc.h> |
|---|
| 26 | 15 | #include <linux/io.h> |
|---|
| 16 | +#include <linux/memblock.h> |
|---|
| 27 | 17 | |
|---|
| 28 | 18 | #include <asm/fixmap.h> |
|---|
| 29 | 19 | #include <asm/tlbflush.h> |
|---|
| 30 | | -#include <asm/pgalloc.h> |
|---|
| 31 | 20 | |
|---|
| 32 | 21 | static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size, |
|---|
| 33 | 22 | pgprot_t prot, void *caller) |
|---|
| .. | .. |
|---|
| 80 | 69 | } |
|---|
| 81 | 70 | EXPORT_SYMBOL(__ioremap); |
|---|
| 82 | 71 | |
|---|
| 83 | | -void __iounmap(volatile void __iomem *io_addr) |
|---|
| 72 | +void iounmap(volatile void __iomem *io_addr) |
|---|
| 84 | 73 | { |
|---|
| 85 | 74 | unsigned long addr = (unsigned long)io_addr & PAGE_MASK; |
|---|
| 86 | 75 | |
|---|
| .. | .. |
|---|
| 91 | 80 | if (is_vmalloc_addr((void *)addr)) |
|---|
| 92 | 81 | vunmap((void *)addr); |
|---|
| 93 | 82 | } |
|---|
| 94 | | -EXPORT_SYMBOL(__iounmap); |
|---|
| 83 | +EXPORT_SYMBOL(iounmap); |
|---|
| 95 | 84 | |
|---|
| 96 | 85 | void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size) |
|---|
| 97 | 86 | { |
|---|
| .. | .. |
|---|
| 111 | 100 | { |
|---|
| 112 | 101 | early_ioremap_setup(); |
|---|
| 113 | 102 | } |
|---|
| 103 | + |
|---|
| 104 | +bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size, |
|---|
| 105 | + unsigned long flags) |
|---|
| 106 | +{ |
|---|
| 107 | + unsigned long pfn = PHYS_PFN(offset); |
|---|
| 108 | + |
|---|
| 109 | + return memblock_is_map_memory(pfn); |
|---|
| 110 | +} |
|---|