io.h 2.2 KB
Newer Older
L
Linus Torvalds 已提交
1 2
/*
 *  S390 version
3
 *    Copyright IBM Corp. 1999
L
Linus Torvalds 已提交
4 5 6 7 8 9 10 11
 *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
 *
 *  Derived from "include/asm-i386/io.h"
 */

#ifndef _S390_IO_H
#define _S390_IO_H

J
Jan Glauber 已提交
12
#include <linux/kernel.h>
L
Linus Torvalds 已提交
13
#include <asm/page.h>
J
Jan Glauber 已提交
14
#include <asm/pci_io.h>
L
Linus Torvalds 已提交
15 16 17 18 19

/*
 * Change virtual addresses to physical addresses and vv.
 * These are pretty trivial
 */
20
static inline unsigned long virt_to_phys(volatile void * address)
L
Linus Torvalds 已提交
21 22
{
	unsigned long real_address;
23 24 25 26
	asm volatile(
		 "	lra	%0,0(%1)\n"
		 "	jz	0f\n"
		 "	la	%0,0\n"
J
Jan Glauber 已提交
27
		 "0:"
28
		 : "=a" (real_address) : "a" (address) : "cc");
J
Jan Glauber 已提交
29
	return real_address;
L
Linus Torvalds 已提交
30
}
J
Jan Glauber 已提交
31
#define virt_to_phys virt_to_phys
L
Linus Torvalds 已提交
32

33
static inline void * phys_to_virt(unsigned long address)
L
Linus Torvalds 已提交
34
{
35
	return (void *) address;
L
Linus Torvalds 已提交
36 37
}

38 39
void *xlate_dev_mem_ptr(unsigned long phys);
void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
L
Linus Torvalds 已提交
40 41 42 43 44 45

/*
 * Convert a virtual cached pointer to an uncached pointer
 */
#define xlate_dev_kmem_ptr(p)	p

J
Jan Glauber 已提交
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
#define IO_SPACE_LIMIT 0

#ifdef CONFIG_PCI

#define ioremap_nocache(addr, size)	ioremap(addr, size)
#define ioremap_wc			ioremap_nocache

static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
{
	return (void __iomem *) offset;
}

static inline void iounmap(volatile void __iomem *addr)
{
}

/*
 * s390 needs a private implementation of pci_iomap since ioremap with its
 * offset parameter isn't sufficient. That's because BAR spaces are not
 * disjunctive on s390 so we need the bar parameter of pci_iomap to find
 * the corresponding device and create the mapping cookie.
 */
#define pci_iomap pci_iomap
#define pci_iounmap pci_iounmap

#define memcpy_fromio(dst, src, count)	zpci_memcpy_fromio(dst, src, count)
#define memcpy_toio(dst, src, count)	zpci_memcpy_toio(dst, src, count)
#define memset_io(dst, val, count)	zpci_memset_io(dst, val, count)

#define __raw_readb	zpci_read_u8
#define __raw_readw	zpci_read_u16
#define __raw_readl	zpci_read_u32
#define __raw_readq	zpci_read_u64
#define __raw_writeb	zpci_write_u8
#define __raw_writew	zpci_write_u16
#define __raw_writel	zpci_write_u32
#define __raw_writeq	zpci_write_u64

84 85 86 87 88
#define readb_relaxed	readb
#define readw_relaxed	readw
#define readl_relaxed	readl
#define readq_relaxed	readq

J
Jan Glauber 已提交
89 90 91 92
#endif /* CONFIG_PCI */

#include <asm-generic/io.h>

L
Linus Torvalds 已提交
93
#endif