1 // SPDX-License-Identifier: GPL-2.0-or-later
4 #include <linux/slab.h>
5 #include <linux/mmzone.h>
6 #include <linux/vmalloc.h>
7 #include <asm/io-workarounds.h>
9 unsigned long ioremap_bot
;
10 EXPORT_SYMBOL(ioremap_bot
);
12 void __iomem
*ioremap(phys_addr_t addr
, unsigned long size
)
14 pgprot_t prot
= pgprot_noncached(PAGE_KERNEL
);
15 void *caller
= __builtin_return_address(0);
18 return iowa_ioremap(addr
, size
, prot
, caller
);
19 return __ioremap_caller(addr
, size
, prot
, caller
);
21 EXPORT_SYMBOL(ioremap
);
23 void __iomem
*ioremap_wc(phys_addr_t addr
, unsigned long size
)
25 pgprot_t prot
= pgprot_noncached_wc(PAGE_KERNEL
);
26 void *caller
= __builtin_return_address(0);
29 return iowa_ioremap(addr
, size
, prot
, caller
);
30 return __ioremap_caller(addr
, size
, prot
, caller
);
32 EXPORT_SYMBOL(ioremap_wc
);
34 void __iomem
*ioremap_coherent(phys_addr_t addr
, unsigned long size
)
36 pgprot_t prot
= pgprot_cached(PAGE_KERNEL
);
37 void *caller
= __builtin_return_address(0);
40 return iowa_ioremap(addr
, size
, prot
, caller
);
41 return __ioremap_caller(addr
, size
, prot
, caller
);
44 void __iomem
*ioremap_prot(phys_addr_t addr
, size_t size
, unsigned long flags
)
46 pte_t pte
= __pte(flags
);
47 void *caller
= __builtin_return_address(0);
49 /* writeable implies dirty for kernel addresses */
51 pte
= pte_mkdirty(pte
);
54 return iowa_ioremap(addr
, size
, pte_pgprot(pte
), caller
);
55 return __ioremap_caller(addr
, size
, pte_pgprot(pte
), caller
);
57 EXPORT_SYMBOL(ioremap_prot
);
59 int early_ioremap_range(unsigned long ea
, phys_addr_t pa
,
60 unsigned long size
, pgprot_t prot
)
64 for (i
= 0; i
< size
; i
+= PAGE_SIZE
) {
65 int err
= map_kernel_page(ea
+ i
, pa
+ i
, pgprot_nx(prot
));
67 if (WARN_ON_ONCE(err
)) /* Should clean up */