blob: 28664ee0abc1a467a0b4e87d8310d56932d88fd5 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * S390 version
4 * Copyright IBM Corp. 1999
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
13#include <linux/kernel.h>
14#include <asm/page.h>
Olivier Deprez157378f2022-04-04 15:47:50 +020015#include <asm/pgtable.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000016#include <asm/pci_io.h>
17
18#define xlate_dev_mem_ptr xlate_dev_mem_ptr
19void *xlate_dev_mem_ptr(phys_addr_t phys);
20#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
21void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
22
23/*
24 * Convert a virtual cached pointer to an uncached pointer
25 */
26#define xlate_dev_kmem_ptr(p) p
27
28#define IO_SPACE_LIMIT 0
29
Olivier Deprez157378f2022-04-04 15:47:50 +020030void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot);
31void __iomem *ioremap(phys_addr_t addr, size_t size);
32void __iomem *ioremap_wc(phys_addr_t addr, size_t size);
33void __iomem *ioremap_wt(phys_addr_t addr, size_t size);
David Brazdil0f672f62019-12-10 10:32:29 +000034void iounmap(volatile void __iomem *addr);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000035
36static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
37{
38 return NULL;
39}
40
41static inline void ioport_unmap(void __iomem *p)
42{
43}
44
45#ifdef CONFIG_PCI
46
47/*
48 * s390 needs a private implementation of pci_iomap since ioremap with its
49 * offset parameter isn't sufficient. That's because BAR spaces are not
50 * disjunctive on s390 so we need the bar parameter of pci_iomap to find
51 * the corresponding device and create the mapping cookie.
52 */
53#define pci_iomap pci_iomap
David Brazdil0f672f62019-12-10 10:32:29 +000054#define pci_iomap_range pci_iomap_range
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000055#define pci_iounmap pci_iounmap
David Brazdil0f672f62019-12-10 10:32:29 +000056#define pci_iomap_wc pci_iomap_wc
57#define pci_iomap_wc_range pci_iomap_wc_range
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000058
Olivier Deprez157378f2022-04-04 15:47:50 +020059#define ioremap ioremap
60#define ioremap_wt ioremap_wt
61#define ioremap_wc ioremap_wc
62
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000063#define memcpy_fromio(dst, src, count) zpci_memcpy_fromio(dst, src, count)
64#define memcpy_toio(dst, src, count) zpci_memcpy_toio(dst, src, count)
65#define memset_io(dst, val, count) zpci_memset_io(dst, val, count)
66
David Brazdil0f672f62019-12-10 10:32:29 +000067#define mmiowb() zpci_barrier()
68
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000069#define __raw_readb zpci_read_u8
70#define __raw_readw zpci_read_u16
71#define __raw_readl zpci_read_u32
72#define __raw_readq zpci_read_u64
73#define __raw_writeb zpci_write_u8
74#define __raw_writew zpci_write_u16
75#define __raw_writel zpci_write_u32
76#define __raw_writeq zpci_write_u64
77
78#endif /* CONFIG_PCI */
79
80#include <asm-generic/io.h>
81
82#endif