kernel: Fix s390 absolute memory access for /dev/mem
[deliverable/linux.git] / arch / s390 / include / asm / io.h
CommitLineData
1da177e4 1/*
1da177e4 2 * S390 version
a53c8fab 3 * Copyright IBM Corp. 1999
1da177e4
LT
4 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
5 *
6 * Derived from "include/asm-i386/io.h"
7 */
8
9#ifndef _S390_IO_H
10#define _S390_IO_H
11
cd248341 12#include <linux/kernel.h>
1da177e4 13#include <asm/page.h>
cd248341 14#include <asm/pci_io.h>
1da177e4 15
1da177e4
LT
16/*
17 * Change virtual addresses to physical addresses and vv.
18 * These are pretty trivial
19 */
4448aaf0 20static inline unsigned long virt_to_phys(volatile void * address)
1da177e4
LT
21{
22 unsigned long real_address;
94c12cc7 23 asm volatile(
94c12cc7 24 " lra %0,0(%1)\n"
94c12cc7
MS
25 " jz 0f\n"
26 " la %0,0\n"
cd248341 27 "0:"
94c12cc7 28 : "=a" (real_address) : "a" (address) : "cc");
cd248341 29 return real_address;
1da177e4 30}
cd248341 31#define virt_to_phys virt_to_phys
1da177e4 32
4448aaf0 33static inline void * phys_to_virt(unsigned long address)
1da177e4 34{
022ae414 35 return (void *) address;
1da177e4
LT
36}
37
b2a68c23 38void *xlate_dev_mem_ptr(unsigned long phys);
576ebd74 39#define xlate_dev_mem_ptr xlate_dev_mem_ptr
b2a68c23 40void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
1da177e4
LT
41
42/*
43 * Convert a virtual cached pointer to an uncached pointer
44 */
45#define xlate_dev_kmem_ptr(p) p
46
cd248341
JG
47#define IO_SPACE_LIMIT 0
48
49#ifdef CONFIG_PCI
50
51#define ioremap_nocache(addr, size) ioremap(addr, size)
52#define ioremap_wc ioremap_nocache
53
cd248341
JG
54static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
55{
56 return (void __iomem *) offset;
57}
58
59static inline void iounmap(volatile void __iomem *addr)
60{
61}
62
63/*
64 * s390 needs a private implementation of pci_iomap since ioremap with its
65 * offset parameter isn't sufficient. That's because BAR spaces are not
66 * disjunctive on s390 so we need the bar parameter of pci_iomap to find
67 * the corresponding device and create the mapping cookie.
68 */
69#define pci_iomap pci_iomap
70#define pci_iounmap pci_iounmap
71
72#define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count)
73#define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count)
74#define memset_io(dst, val, count) zpci_memset_io(dst, val, count)
75
76#define __raw_readb zpci_read_u8
77#define __raw_readw zpci_read_u16
78#define __raw_readl zpci_read_u32
79#define __raw_readq zpci_read_u64
80#define __raw_writeb zpci_write_u8
81#define __raw_writew zpci_write_u16
82#define __raw_writel zpci_write_u32
83#define __raw_writeq zpci_write_u64
84
478740a1
HC
85#define readb_relaxed readb
86#define readw_relaxed readw
87#define readl_relaxed readl
88#define readq_relaxed readq
89
cd248341
JG
90#endif /* CONFIG_PCI */
91
92#include <asm-generic/io.h>
93
1da177e4 94#endif
This page took 0.635127 seconds and 5 git commands to generate.