1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _LINUX_IO_H
19#define _LINUX_IO_H
20
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/bug.h>
24#include <linux/err.h>
25#include <asm/io.h>
26#include <asm/page.h>
27
28struct device;
29struct resource;
30
31__visible void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
32void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
33
34#ifdef CONFIG_MMU
35int ioremap_page_range(unsigned long addr, unsigned long end,
36 phys_addr_t phys_addr, pgprot_t prot);
37#else
38static inline int ioremap_page_range(unsigned long addr, unsigned long end,
39 phys_addr_t phys_addr, pgprot_t prot)
40{
41 return 0;
42}
43#endif
44
45#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
46void __init ioremap_huge_init(void);
47int arch_ioremap_pud_supported(void);
48int arch_ioremap_pmd_supported(void);
49#else
50static inline void ioremap_huge_init(void) { }
51#endif
52
53
54
55
56#ifdef CONFIG_HAS_IOPORT_MAP
57void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
58 unsigned int nr);
59void devm_ioport_unmap(struct device *dev, void __iomem *addr);
60#else
61static inline void __iomem *devm_ioport_map(struct device *dev,
62 unsigned long port,
63 unsigned int nr)
64{
65 return NULL;
66}
67
68static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
69{
70}
71#endif
72
73#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
74
75void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
76 resource_size_t size);
77void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
78 resource_size_t size);
79void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
80 resource_size_t size);
81void devm_iounmap(struct device *dev, void __iomem *addr);
82int check_signature(const volatile void __iomem *io_addr,
83 const unsigned char *signature, int length);
84void devm_ioremap_release(struct device *dev, void *res);
85
86void *devm_memremap(struct device *dev, resource_size_t offset,
87 size_t size, unsigned long flags);
88void devm_memunmap(struct device *dev, void *addr);
89
90void *__devm_memremap_pages(struct device *dev, struct resource *res);
91
92#ifdef CONFIG_ZONE_DEVICE
93void *devm_memremap_pages(struct device *dev, struct resource *res);
94#else
95static inline void *devm_memremap_pages(struct device *dev, struct resource *res)
96{
97
98
99
100
101
102 WARN_ON_ONCE(1);
103 return ERR_PTR(-ENXIO);
104}
105#endif
106
107
108
109
110
111
112#ifndef arch_has_dev_port
113#define arch_has_dev_port() (1)
114#endif
115
116
117
118
119
120
121
122
123
124
125
126
127#ifndef arch_phys_wc_add
128static inline int __must_check arch_phys_wc_add(unsigned long base,
129 unsigned long size)
130{
131 return 0;
132}
133
134static inline void arch_phys_wc_del(int handle)
135{
136}
137
138#define arch_phys_wc_add arch_phys_wc_add
139#ifndef arch_phys_wc_index
140static inline int arch_phys_wc_index(int handle)
141{
142 return -1;
143}
144#define arch_phys_wc_index arch_phys_wc_index
145#endif
146#endif
147
148enum {
149
150 MEMREMAP_WB = 1 << 0,
151 MEMREMAP_WT = 1 << 1,
152};
153
154void *memremap(resource_size_t offset, size_t size, unsigned long flags);
155void memunmap(void *addr);
156
157#endif
158