Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 | 2 | /* |
1da177e4 | 3 | * S390 version |
a53c8fab | 4 | * Copyright IBM Corp. 1999 |
1da177e4 LT |
5 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) |
6 | * | |
7 | * Derived from "include/asm-i386/io.h" | |
8 | */ | |
9 | ||
10 | #ifndef _S390_IO_H | |
11 | #define _S390_IO_H | |
12 | ||
cd248341 | 13 | #include <linux/kernel.h> |
1da177e4 | 14 | #include <asm/page.h> |
b02002cc | 15 | #include <asm/pgtable.h> |
cd248341 | 16 | #include <asm/pci_io.h> |
1da177e4 | 17 | |
576ebd74 | 18 | #define xlate_dev_mem_ptr xlate_dev_mem_ptr |
4707a341 TR |
19 | void *xlate_dev_mem_ptr(phys_addr_t phys); |
20 | #define unxlate_dev_mem_ptr unxlate_dev_mem_ptr | |
21 | void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr); | |
1da177e4 | 22 | |
cd248341 JG |
23 | #define IO_SPACE_LIMIT 0 |
24 | ||
b43b3fff BH |
25 | /* |
26 | * I/O memory mapping functions. | |
27 | */ | |
28 | #define ioremap_prot ioremap_prot | |
29 | #define iounmap iounmap | |
30 | ||
31 | #define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL) | |
32 | ||
33 | #define ioremap_wc(addr, size) \ | |
34 | ioremap_prot((addr), (size), pgprot_val(pgprot_writecombine(PAGE_KERNEL))) | |
35 | #define ioremap_wt(addr, size) \ | |
36 | ioremap_prot((addr), (size), pgprot_val(pgprot_writethrough(PAGE_KERNEL))) | |
cd248341 | 37 | |
99e97b71 FB |
38 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) |
39 | { | |
40 | return NULL; | |
41 | } | |
42 | ||
43 | static inline void ioport_unmap(void __iomem *p) | |
44 | { | |
45 | } | |
46 | ||
7e9710af LG |
47 | #ifdef CONFIG_PCI |
48 | ||
cd248341 JG |
49 | /* |
50 | * s390 needs a private implementation of pci_iomap since ioremap with its | |
51 | * offset parameter isn't sufficient. That's because BAR spaces are not | |
52 | * disjunctive on s390 so we need the bar parameter of pci_iomap to find | |
53 | * the corresponding device and create the mapping cookie. | |
54 | */ | |
55 | #define pci_iomap pci_iomap | |
71ba41c9 | 56 | #define pci_iomap_range pci_iomap_range |
cd248341 | 57 | #define pci_iounmap pci_iounmap |
71ba41c9 SO |
58 | #define pci_iomap_wc pci_iomap_wc |
59 | #define pci_iomap_wc_range pci_iomap_wc_range | |
cd248341 JG |
60 | |
61 | #define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count) | |
62 | #define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count) | |
63 | #define memset_io(dst, val, count) zpci_memset_io(dst, val, count) | |
64 | ||
71ba41c9 SO |
65 | #define mmiowb() zpci_barrier() |
66 | ||
cd248341 JG |
67 | #define __raw_readb zpci_read_u8 |
68 | #define __raw_readw zpci_read_u16 | |
69 | #define __raw_readl zpci_read_u32 | |
70 | #define __raw_readq zpci_read_u64 | |
71 | #define __raw_writeb zpci_write_u8 | |
72 | #define __raw_writew zpci_write_u16 | |
73 | #define __raw_writel zpci_write_u32 | |
74 | #define __raw_writeq zpci_write_u64 | |
75 | ||
6ae798cb JG |
76 | /* combine single writes by using store-block insn */ |
77 | static inline void __iowrite32_copy(void __iomem *to, const void *from, | |
78 | size_t count) | |
79 | { | |
80 | zpci_memcpy_toio(to, from, count * 4); | |
81 | } | |
82 | #define __iowrite32_copy __iowrite32_copy | |
83 | ||
e7bc47b1 JG |
84 | static inline void __iowrite64_copy(void __iomem *to, const void *from, |
85 | size_t count) | |
86 | { | |
87 | zpci_memcpy_toio(to, from, count * 8); | |
88 | } | |
89 | #define __iowrite64_copy __iowrite64_copy | |
90 | ||
cd248341 JG |
91 | #endif /* CONFIG_PCI */ |
92 | ||
93 | #include <asm-generic/io.h> | |
94 | ||
1da177e4 | 95 | #endif |