diff options
Diffstat (limited to 'arch/parisc/lib/iomap.c')
-rw-r--r-- | arch/parisc/lib/iomap.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/arch/parisc/lib/iomap.c b/arch/parisc/lib/iomap.c index 290a62e7120b..01bec8fcbd0d 100644 --- a/arch/parisc/lib/iomap.c +++ b/arch/parisc/lib/iomap.c | |||
@@ -43,10 +43,14 @@ | |||
43 | struct iomap_ops { | 43 | struct iomap_ops { |
44 | unsigned int (*read8)(void __iomem *); | 44 | unsigned int (*read8)(void __iomem *); |
45 | unsigned int (*read16)(void __iomem *); | 45 | unsigned int (*read16)(void __iomem *); |
46 | unsigned int (*read16be)(void __iomem *); | ||
46 | unsigned int (*read32)(void __iomem *); | 47 | unsigned int (*read32)(void __iomem *); |
48 | unsigned int (*read32be)(void __iomem *); | ||
47 | void (*write8)(u8, void __iomem *); | 49 | void (*write8)(u8, void __iomem *); |
48 | void (*write16)(u16, void __iomem *); | 50 | void (*write16)(u16, void __iomem *); |
51 | void (*write16be)(u16, void __iomem *); | ||
49 | void (*write32)(u32, void __iomem *); | 52 | void (*write32)(u32, void __iomem *); |
53 | void (*write32be)(u32, void __iomem *); | ||
50 | void (*read8r)(void __iomem *, void *, unsigned long); | 54 | void (*read8r)(void __iomem *, void *, unsigned long); |
51 | void (*read16r)(void __iomem *, void *, unsigned long); | 55 | void (*read16r)(void __iomem *, void *, unsigned long); |
52 | void (*read32r)(void __iomem *, void *, unsigned long); | 56 | void (*read32r)(void __iomem *, void *, unsigned long); |
@@ -122,9 +126,13 @@ static void ioport_write32r(void __iomem *addr, const void *s, unsigned long n) | |||
122 | static const struct iomap_ops ioport_ops = { | 126 | static const struct iomap_ops ioport_ops = { |
123 | ioport_read8, | 127 | ioport_read8, |
124 | ioport_read16, | 128 | ioport_read16, |
129 | ioport_read16, | ||
130 | ioport_read32, | ||
125 | ioport_read32, | 131 | ioport_read32, |
126 | ioport_write8, | 132 | ioport_write8, |
127 | ioport_write16, | 133 | ioport_write16, |
134 | ioport_write16, | ||
135 | ioport_write32, | ||
128 | ioport_write32, | 136 | ioport_write32, |
129 | ioport_read8r, | 137 | ioport_read8r, |
130 | ioport_read16r, | 138 | ioport_read16r, |
@@ -146,11 +154,21 @@ static unsigned int iomem_read16(void __iomem *addr) | |||
146 | return readw(addr); | 154 | return readw(addr); |
147 | } | 155 | } |
148 | 156 | ||
157 | static unsigned int iomem_read16be(void __iomem *addr) | ||
158 | { | ||
159 | return __raw_readw(addr); | ||
160 | } | ||
161 | |||
149 | static unsigned int iomem_read32(void __iomem *addr) | 162 | static unsigned int iomem_read32(void __iomem *addr) |
150 | { | 163 | { |
151 | return readl(addr); | 164 | return readl(addr); |
152 | } | 165 | } |
153 | 166 | ||
167 | static unsigned int iomem_read32be(void __iomem *addr) | ||
168 | { | ||
169 | return __raw_readl(addr); | ||
170 | } | ||
171 | |||
154 | static void iomem_write8(u8 datum, void __iomem *addr) | 172 | static void iomem_write8(u8 datum, void __iomem *addr) |
155 | { | 173 | { |
156 | writeb(datum, addr); | 174 | writeb(datum, addr); |
@@ -161,11 +179,21 @@ static void iomem_write16(u16 datum, void __iomem *addr) | |||
161 | writew(datum, addr); | 179 | writew(datum, addr); |
162 | } | 180 | } |
163 | 181 | ||
182 | static void iomem_write16be(u16 datum, void __iomem *addr) | ||
183 | { | ||
184 | __raw_writew(datum, addr); | ||
185 | } | ||
186 | |||
164 | static void iomem_write32(u32 datum, void __iomem *addr) | 187 | static void iomem_write32(u32 datum, void __iomem *addr) |
165 | { | 188 | { |
166 | writel(datum, addr); | 189 | writel(datum, addr); |
167 | } | 190 | } |
168 | 191 | ||
192 | static void iomem_write32be(u32 datum, void __iomem *addr) | ||
193 | { | ||
194 | __raw_writel(datum, addr); | ||
195 | } | ||
196 | |||
169 | static void iomem_read8r(void __iomem *addr, void *dst, unsigned long count) | 197 | static void iomem_read8r(void __iomem *addr, void *dst, unsigned long count) |
170 | { | 198 | { |
171 | while (count--) { | 199 | while (count--) { |
@@ -217,10 +245,14 @@ static void iomem_write32r(void __iomem *addr, const void *s, unsigned long n) | |||
217 | static const struct iomap_ops iomem_ops = { | 245 | static const struct iomap_ops iomem_ops = { |
218 | iomem_read8, | 246 | iomem_read8, |
219 | iomem_read16, | 247 | iomem_read16, |
248 | iomem_read16be, | ||
220 | iomem_read32, | 249 | iomem_read32, |
250 | iomem_read32be, | ||
221 | iomem_write8, | 251 | iomem_write8, |
222 | iomem_write16, | 252 | iomem_write16, |
253 | iomem_write16be, | ||
223 | iomem_write32, | 254 | iomem_write32, |
255 | iomem_write32be, | ||
224 | iomem_read8r, | 256 | iomem_read8r, |
225 | iomem_read16r, | 257 | iomem_read16r, |
226 | iomem_read32r, | 258 | iomem_read32r, |
@@ -253,6 +285,13 @@ unsigned int ioread16(void __iomem *addr) | |||
253 | return le16_to_cpup((u16 *)addr); | 285 | return le16_to_cpup((u16 *)addr); |
254 | } | 286 | } |
255 | 287 | ||
288 | unsigned int ioread16be(void __iomem *addr) | ||
289 | { | ||
290 | if (unlikely(INDIRECT_ADDR(addr))) | ||
291 | return iomap_ops[ADDR_TO_REGION(addr)]->read16be(addr); | ||
292 | return *((u16 *)addr); | ||
293 | } | ||
294 | |||
256 | unsigned int ioread32(void __iomem *addr) | 295 | unsigned int ioread32(void __iomem *addr) |
257 | { | 296 | { |
258 | if (unlikely(INDIRECT_ADDR(addr))) | 297 | if (unlikely(INDIRECT_ADDR(addr))) |
@@ -260,6 +299,13 @@ unsigned int ioread32(void __iomem *addr) | |||
260 | return le32_to_cpup((u32 *)addr); | 299 | return le32_to_cpup((u32 *)addr); |
261 | } | 300 | } |
262 | 301 | ||
302 | unsigned int ioread32be(void __iomem *addr) | ||
303 | { | ||
304 | if (unlikely(INDIRECT_ADDR(addr))) | ||
305 | return iomap_ops[ADDR_TO_REGION(addr)]->read32be(addr); | ||
306 | return *((u32 *)addr); | ||
307 | } | ||
308 | |||
263 | void iowrite8(u8 datum, void __iomem *addr) | 309 | void iowrite8(u8 datum, void __iomem *addr) |
264 | { | 310 | { |
265 | if (unlikely(INDIRECT_ADDR(addr))) { | 311 | if (unlikely(INDIRECT_ADDR(addr))) { |
@@ -278,6 +324,15 @@ void iowrite16(u16 datum, void __iomem *addr) | |||
278 | } | 324 | } |
279 | } | 325 | } |
280 | 326 | ||
327 | void iowrite16be(u16 datum, void __iomem *addr) | ||
328 | { | ||
329 | if (unlikely(INDIRECT_ADDR(addr))) { | ||
330 | iomap_ops[ADDR_TO_REGION(addr)]->write16be(datum, addr); | ||
331 | } else { | ||
332 | *((u16 *)addr) = datum; | ||
333 | } | ||
334 | } | ||
335 | |||
281 | void iowrite32(u32 datum, void __iomem *addr) | 336 | void iowrite32(u32 datum, void __iomem *addr) |
282 | { | 337 | { |
283 | if (unlikely(INDIRECT_ADDR(addr))) { | 338 | if (unlikely(INDIRECT_ADDR(addr))) { |
@@ -287,6 +342,15 @@ void iowrite32(u32 datum, void __iomem *addr) | |||
287 | } | 342 | } |
288 | } | 343 | } |
289 | 344 | ||
345 | void iowrite32be(u32 datum, void __iomem *addr) | ||
346 | { | ||
347 | if (unlikely(INDIRECT_ADDR(addr))) { | ||
348 | iomap_ops[ADDR_TO_REGION(addr)]->write32be(datum, addr); | ||
349 | } else { | ||
350 | *((u32 *)addr) = datum; | ||
351 | } | ||
352 | } | ||
353 | |||
290 | /* Repeating interfaces */ | 354 | /* Repeating interfaces */ |
291 | 355 | ||
292 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) | 356 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) |
@@ -406,10 +470,14 @@ void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | |||
406 | 470 | ||
407 | EXPORT_SYMBOL(ioread8); | 471 | EXPORT_SYMBOL(ioread8); |
408 | EXPORT_SYMBOL(ioread16); | 472 | EXPORT_SYMBOL(ioread16); |
473 | EXPORT_SYMBOL(ioread16be); | ||
409 | EXPORT_SYMBOL(ioread32); | 474 | EXPORT_SYMBOL(ioread32); |
475 | EXPORT_SYMBOL(ioread32be); | ||
410 | EXPORT_SYMBOL(iowrite8); | 476 | EXPORT_SYMBOL(iowrite8); |
411 | EXPORT_SYMBOL(iowrite16); | 477 | EXPORT_SYMBOL(iowrite16); |
478 | EXPORT_SYMBOL(iowrite16be); | ||
412 | EXPORT_SYMBOL(iowrite32); | 479 | EXPORT_SYMBOL(iowrite32); |
480 | EXPORT_SYMBOL(iowrite32be); | ||
413 | EXPORT_SYMBOL(ioread8_rep); | 481 | EXPORT_SYMBOL(ioread8_rep); |
414 | EXPORT_SYMBOL(ioread16_rep); | 482 | EXPORT_SYMBOL(ioread16_rep); |
415 | EXPORT_SYMBOL(ioread32_rep); | 483 | EXPORT_SYMBOL(ioread32_rep); |