Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 14 | #ifdef __KERNEL__ |
| 15 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <asm/page.h> |
| 17 | |
| 18 | #define IO_SPACE_LIMIT 0xffffffff |
| 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | /* |
| 21 | * Change virtual addresses to physical addresses and vv. |
| 22 | * These are pretty trivial |
| 23 | */ |
Adrian Bunk | 4448aaf | 2005-11-08 21:34:42 -0800 | [diff] [blame] | 24 | static inline unsigned long virt_to_phys(volatile void * address) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | { |
| 26 | unsigned long real_address; |
Martin Schwidefsky | 94c12cc | 2006-09-28 16:56:43 +0200 | [diff] [blame] | 27 | asm volatile( |
Martin Schwidefsky | 94c12cc | 2006-09-28 16:56:43 +0200 | [diff] [blame] | 28 | " lra %0,0(%1)\n" |
Martin Schwidefsky | 94c12cc | 2006-09-28 16:56:43 +0200 | [diff] [blame] | 29 | " jz 0f\n" |
| 30 | " la %0,0\n" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | "0:" |
Martin Schwidefsky | 94c12cc | 2006-09-28 16:56:43 +0200 | [diff] [blame] | 32 | : "=a" (real_address) : "a" (address) : "cc"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | return real_address; |
| 34 | } |
| 35 | |
Adrian Bunk | 4448aaf | 2005-11-08 21:34:42 -0800 | [diff] [blame] | 36 | static inline void * phys_to_virt(unsigned long address) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | { |
Martin Schwidefsky | 022ae41 | 2007-02-12 15:49:57 +0100 | [diff] [blame] | 38 | return (void *) address; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | } |
| 40 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | /* |
| 42 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
| 43 | * access |
| 44 | */ |
| 45 | #define xlate_dev_mem_ptr(p) __va(p) |
| 46 | |
| 47 | /* |
| 48 | * Convert a virtual cached pointer to an uncached pointer |
| 49 | */ |
| 50 | #define xlate_dev_kmem_ptr(p) p |
| 51 | |
| 52 | #endif /* __KERNEL__ */ |
| 53 | |
| 54 | #endif |