blob: 559e921a6bbafa082df673fa9989ea44d4a23427 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * S390 version
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02003 * Copyright IBM Corp. 1999
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/page.h>
13
14#define IO_SPACE_LIMIT 0xffffffff
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016/*
17 * Change virtual addresses to physical addresses and vv.
18 * These are pretty trivial
19 */
Adrian Bunk4448aaf2005-11-08 21:34:42 -080020static inline unsigned long virt_to_phys(volatile void * address)
Linus Torvalds1da177e2005-04-16 15:20:36 -070021{
22 unsigned long real_address;
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020023 asm volatile(
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020024 " lra %0,0(%1)\n"
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020025 " jz 0f\n"
26 " la %0,0\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 "0:"
Martin Schwidefsky94c12cc2006-09-28 16:56:43 +020028 : "=a" (real_address) : "a" (address) : "cc");
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 return real_address;
30}
31
Adrian Bunk4448aaf2005-11-08 21:34:42 -080032static inline void * phys_to_virt(unsigned long address)
Linus Torvalds1da177e2005-04-16 15:20:36 -070033{
Martin Schwidefsky022ae412007-02-12 15:49:57 +010034 return (void *) address;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035}
36
Michael Holzheub2a68c22012-05-09 16:27:36 +020037void *xlate_dev_mem_ptr(unsigned long phys);
38void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40/*
41 * Convert a virtual cached pointer to an uncached pointer
42 */
43#define xlate_dev_kmem_ptr(p) p
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#endif