diff options
Diffstat (limited to 'include/linux/io-mapping.h')
| -rw-r--r-- | include/linux/io-mapping.h | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index 97eb928b4924..8cdcc2a199ad 100644 --- a/include/linux/io-mapping.h +++ b/include/linux/io-mapping.h | |||
| @@ -19,9 +19,9 @@ | |||
| 19 | #define _LINUX_IO_MAPPING_H | 19 | #define _LINUX_IO_MAPPING_H |
| 20 | 20 | ||
| 21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 22 | #include <linux/slab.h> | ||
| 22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
| 23 | #include <asm/page.h> | 24 | #include <asm/page.h> |
| 24 | #include <asm/iomap.h> | ||
| 25 | 25 | ||
| 26 | /* | 26 | /* |
| 27 | * The io_mapping mechanism provides an abstraction for mapping | 27 | * The io_mapping mechanism provides an abstraction for mapping |
| @@ -32,6 +32,8 @@ | |||
| 32 | 32 | ||
| 33 | #ifdef CONFIG_HAVE_ATOMIC_IOMAP | 33 | #ifdef CONFIG_HAVE_ATOMIC_IOMAP |
| 34 | 34 | ||
| 35 | #include <asm/iomap.h> | ||
| 36 | |||
| 35 | struct io_mapping { | 37 | struct io_mapping { |
| 36 | resource_size_t base; | 38 | resource_size_t base; |
| 37 | unsigned long size; | 39 | unsigned long size; |
| @@ -77,8 +79,9 @@ io_mapping_free(struct io_mapping *mapping) | |||
| 77 | } | 79 | } |
| 78 | 80 | ||
| 79 | /* Atomic map/unmap */ | 81 | /* Atomic map/unmap */ |
| 80 | static inline void * | 82 | static inline void __iomem * |
| 81 | io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) | 83 | io_mapping_map_atomic_wc(struct io_mapping *mapping, |
| 84 | unsigned long offset) | ||
| 82 | { | 85 | { |
| 83 | resource_size_t phys_addr; | 86 | resource_size_t phys_addr; |
| 84 | unsigned long pfn; | 87 | unsigned long pfn; |
| @@ -86,16 +89,16 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) | |||
| 86 | BUG_ON(offset >= mapping->size); | 89 | BUG_ON(offset >= mapping->size); |
| 87 | phys_addr = mapping->base + offset; | 90 | phys_addr = mapping->base + offset; |
| 88 | pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); | 91 | pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); |
| 89 | return iomap_atomic_prot_pfn(pfn, KM_USER0, mapping->prot); | 92 | return iomap_atomic_prot_pfn(pfn, mapping->prot); |
| 90 | } | 93 | } |
| 91 | 94 | ||
| 92 | static inline void | 95 | static inline void |
| 93 | io_mapping_unmap_atomic(void *vaddr) | 96 | io_mapping_unmap_atomic(void __iomem *vaddr) |
| 94 | { | 97 | { |
| 95 | iounmap_atomic(vaddr, KM_USER0); | 98 | iounmap_atomic(vaddr); |
| 96 | } | 99 | } |
| 97 | 100 | ||
| 98 | static inline void * | 101 | static inline void __iomem * |
| 99 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | 102 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) |
| 100 | { | 103 | { |
| 101 | resource_size_t phys_addr; | 104 | resource_size_t phys_addr; |
| @@ -107,7 +110,7 @@ io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | |||
| 107 | } | 110 | } |
| 108 | 111 | ||
| 109 | static inline void | 112 | static inline void |
| 110 | io_mapping_unmap(void *vaddr) | 113 | io_mapping_unmap(void __iomem *vaddr) |
| 111 | { | 114 | { |
| 112 | iounmap(vaddr); | 115 | iounmap(vaddr); |
| 113 | } | 116 | } |
| @@ -121,36 +124,37 @@ struct io_mapping; | |||
| 121 | static inline struct io_mapping * | 124 | static inline struct io_mapping * |
| 122 | io_mapping_create_wc(resource_size_t base, unsigned long size) | 125 | io_mapping_create_wc(resource_size_t base, unsigned long size) |
| 123 | { | 126 | { |
| 124 | return (struct io_mapping *) ioremap_wc(base, size); | 127 | return (struct io_mapping __force *) ioremap_wc(base, size); |
| 125 | } | 128 | } |
| 126 | 129 | ||
| 127 | static inline void | 130 | static inline void |
| 128 | io_mapping_free(struct io_mapping *mapping) | 131 | io_mapping_free(struct io_mapping *mapping) |
| 129 | { | 132 | { |
| 130 | iounmap(mapping); | 133 | iounmap((void __force __iomem *) mapping); |
| 131 | } | 134 | } |
| 132 | 135 | ||
| 133 | /* Atomic map/unmap */ | 136 | /* Atomic map/unmap */ |
| 134 | static inline void * | 137 | static inline void __iomem * |
| 135 | io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) | 138 | io_mapping_map_atomic_wc(struct io_mapping *mapping, |
| 139 | unsigned long offset) | ||
| 136 | { | 140 | { |
| 137 | return ((char *) mapping) + offset; | 141 | return ((char __force __iomem *) mapping) + offset; |
| 138 | } | 142 | } |
| 139 | 143 | ||
| 140 | static inline void | 144 | static inline void |
| 141 | io_mapping_unmap_atomic(void *vaddr) | 145 | io_mapping_unmap_atomic(void __iomem *vaddr) |
| 142 | { | 146 | { |
| 143 | } | 147 | } |
| 144 | 148 | ||
| 145 | /* Non-atomic map/unmap */ | 149 | /* Non-atomic map/unmap */ |
| 146 | static inline void * | 150 | static inline void __iomem * |
| 147 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | 151 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) |
| 148 | { | 152 | { |
| 149 | return ((char *) mapping) + offset; | 153 | return ((char __force __iomem *) mapping) + offset; |
| 150 | } | 154 | } |
| 151 | 155 | ||
| 152 | static inline void | 156 | static inline void |
| 153 | io_mapping_unmap(void *vaddr) | 157 | io_mapping_unmap(void __iomem *vaddr) |
| 154 | { | 158 | { |
| 155 | } | 159 | } |
| 156 | 160 | ||
