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