diff options
Diffstat (limited to 'include/linux/io-mapping.h')
| -rw-r--r-- | include/linux/io-mapping.h | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index 97eb928b4924..7fb592793738 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,10 @@ 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, | ||
| 85 | int slot) | ||
| 82 | { | 86 | { |
| 83 | resource_size_t phys_addr; | 87 | resource_size_t phys_addr; |
| 84 | unsigned long pfn; | 88 | unsigned long pfn; |
| @@ -86,16 +90,16 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) | |||
| 86 | BUG_ON(offset >= mapping->size); | 90 | BUG_ON(offset >= mapping->size); |
| 87 | phys_addr = mapping->base + offset; | 91 | phys_addr = mapping->base + offset; |
| 88 | pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); | 92 | pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); |
| 89 | return iomap_atomic_prot_pfn(pfn, KM_USER0, mapping->prot); | 93 | return iomap_atomic_prot_pfn(pfn, slot, mapping->prot); |
| 90 | } | 94 | } |
| 91 | 95 | ||
| 92 | static inline void | 96 | static inline void |
| 93 | io_mapping_unmap_atomic(void *vaddr) | 97 | io_mapping_unmap_atomic(void __iomem *vaddr, int slot) |
| 94 | { | 98 | { |
| 95 | iounmap_atomic(vaddr, KM_USER0); | 99 | iounmap_atomic(vaddr, slot); |
| 96 | } | 100 | } |
| 97 | 101 | ||
| 98 | static inline void * | 102 | static inline void __iomem * |
| 99 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | 103 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) |
| 100 | { | 104 | { |
| 101 | resource_size_t phys_addr; | 105 | resource_size_t phys_addr; |
| @@ -107,7 +111,7 @@ io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | |||
| 107 | } | 111 | } |
| 108 | 112 | ||
| 109 | static inline void | 113 | static inline void |
| 110 | io_mapping_unmap(void *vaddr) | 114 | io_mapping_unmap(void __iomem *vaddr) |
| 111 | { | 115 | { |
| 112 | iounmap(vaddr); | 116 | iounmap(vaddr); |
| 113 | } | 117 | } |
| @@ -121,36 +125,38 @@ struct io_mapping; | |||
| 121 | static inline struct io_mapping * | 125 | static inline struct io_mapping * |
| 122 | io_mapping_create_wc(resource_size_t base, unsigned long size) | 126 | io_mapping_create_wc(resource_size_t base, unsigned long size) |
| 123 | { | 127 | { |
| 124 | return (struct io_mapping *) ioremap_wc(base, size); | 128 | return (struct io_mapping __force *) ioremap_wc(base, size); |
| 125 | } | 129 | } |
| 126 | 130 | ||
| 127 | static inline void | 131 | static inline void |
| 128 | io_mapping_free(struct io_mapping *mapping) | 132 | io_mapping_free(struct io_mapping *mapping) |
| 129 | { | 133 | { |
| 130 | iounmap(mapping); | 134 | iounmap((void __force __iomem *) mapping); |
| 131 | } | 135 | } |
| 132 | 136 | ||
| 133 | /* Atomic map/unmap */ | 137 | /* Atomic map/unmap */ |
| 134 | static inline void * | 138 | static inline void __iomem * |
| 135 | io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) | 139 | io_mapping_map_atomic_wc(struct io_mapping *mapping, |
| 140 | unsigned long offset, | ||
| 141 | int slot) | ||
| 136 | { | 142 | { |
| 137 | return ((char *) mapping) + offset; | 143 | return ((char __force __iomem *) mapping) + offset; |
| 138 | } | 144 | } |
| 139 | 145 | ||
| 140 | static inline void | 146 | static inline void |
| 141 | io_mapping_unmap_atomic(void *vaddr) | 147 | io_mapping_unmap_atomic(void __iomem *vaddr, int slot) |
| 142 | { | 148 | { |
| 143 | } | 149 | } |
| 144 | 150 | ||
| 145 | /* Non-atomic map/unmap */ | 151 | /* Non-atomic map/unmap */ |
| 146 | static inline void * | 152 | static inline void __iomem * |
| 147 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | 153 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) |
| 148 | { | 154 | { |
| 149 | return ((char *) mapping) + offset; | 155 | return ((char __force __iomem *) mapping) + offset; |
| 150 | } | 156 | } |
| 151 | 157 | ||
| 152 | static inline void | 158 | static inline void |
| 153 | io_mapping_unmap(void *vaddr) | 159 | io_mapping_unmap(void __iomem *vaddr) |
| 154 | { | 160 | { |
| 155 | } | 161 | } |
| 156 | 162 | ||
