blob: f81a0975cbea0efb88db7b8a123072f125f80e10 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/asm-s390/io.h
3 *
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 *
8 * Derived from "include/asm-i386/io.h"
9 */
10
11#ifndef _S390_IO_H
12#define _S390_IO_H
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <asm/page.h>
15
16#define IO_SPACE_LIMIT 0xffffffff
17
Linus Torvalds1da177e2005-04-16 15:20:36 -070018/*
19 * Change virtual addresses to physical addresses and vv.
20 * These are pretty trivial
21 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -080022static inline unsigned long virt_to_phys(volatile void * address)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023{
24 unsigned long real_address;
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020025 asm volatile(
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020026 " lra %0,0(%1)\n"
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020027 " jz 0f\n"
28 " la %0,0\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 "0:"
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020030 : "=a" (real_address) : "a" (address) : "cc");
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 return real_address;
32}
33
Adrian Bunk4448aaf2005-11-08 21:34:42 -080034static inline void * phys_to_virt(unsigned long address)
Linus Torvalds1da177e2005-04-16 15:20:36 -070035{
Martin Schwidefsky022ae412007-02-12 15:49:57 +010036 return (void *) address;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037}
38
Michael Holzheub2a68c22012-05-09 16:27:36 +020039void *xlate_dev_mem_ptr(unsigned long phys);
40void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42/*
43 * Convert a virtual cached pointer to an uncached pointer
44 */
45#define xlate_dev_kmem_ptr(p) p
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#endif