diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-s390/io.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-s390/io.h')
-rw-r--r-- | include/asm-s390/io.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h new file mode 100644 index 000000000000..8188fdc9884f --- /dev/null +++ b/include/asm-s390/io.h | |||
@@ -0,0 +1,123 @@ | |||
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 | |||
16 | #include <linux/vmalloc.h> | ||
17 | #include <asm/page.h> | ||
18 | |||
19 | #define IO_SPACE_LIMIT 0xffffffff | ||
20 | |||
21 | #define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x))) | ||
22 | |||
23 | /* | ||
24 | * Change virtual addresses to physical addresses and vv. | ||
25 | * These are pretty trivial | ||
26 | */ | ||
27 | extern inline unsigned long virt_to_phys(volatile void * address) | ||
28 | { | ||
29 | unsigned long real_address; | ||
30 | __asm__ ( | ||
31 | #ifndef __s390x__ | ||
32 | " lra %0,0(%1)\n" | ||
33 | " jz 0f\n" | ||
34 | " sr %0,%0\n" | ||
35 | #else /* __s390x__ */ | ||
36 | " lrag %0,0(%1)\n" | ||
37 | " jz 0f\n" | ||
38 | " slgr %0,%0\n" | ||
39 | #endif /* __s390x__ */ | ||
40 | "0:" | ||
41 | : "=a" (real_address) : "a" (address) : "cc" ); | ||
42 | return real_address; | ||
43 | } | ||
44 | |||
45 | extern inline void * phys_to_virt(unsigned long address) | ||
46 | { | ||
47 | return __io_virt(address); | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * Change "struct page" to physical address. | ||
52 | */ | ||
53 | #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) | ||
54 | |||
55 | extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); | ||
56 | |||
57 | extern inline void * ioremap (unsigned long offset, unsigned long size) | ||
58 | { | ||
59 | return __ioremap(offset, size, 0); | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * This one maps high address device memory and turns off caching for that area. | ||
64 | * it's useful if some control registers are in such an area and write combining | ||
65 | * or read caching is not desirable: | ||
66 | */ | ||
67 | extern inline void * ioremap_nocache (unsigned long offset, unsigned long size) | ||
68 | { | ||
69 | return __ioremap(offset, size, 0); | ||
70 | } | ||
71 | |||
72 | extern void iounmap(void *addr); | ||
73 | |||
74 | /* | ||
75 | * IO bus memory addresses are also 1:1 with the physical address | ||
76 | */ | ||
77 | #define virt_to_bus virt_to_phys | ||
78 | #define bus_to_virt phys_to_virt | ||
79 | |||
80 | /* | ||
81 | * readX/writeX() are used to access memory mapped devices. On some | ||
82 | * architectures the memory mapped IO stuff needs to be accessed | ||
83 | * differently. | ||
84 | */ | ||
85 | |||
86 | #define readb(addr) (*(volatile unsigned char *) __io_virt(addr)) | ||
87 | #define readw(addr) (*(volatile unsigned short *) __io_virt(addr)) | ||
88 | #define readl(addr) (*(volatile unsigned int *) __io_virt(addr)) | ||
89 | |||
90 | #define readb_relaxed(addr) readb(addr) | ||
91 | #define readw_relaxed(addr) readw(addr) | ||
92 | #define readl_relaxed(addr) readl(addr) | ||
93 | |||
94 | #define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b)) | ||
95 | #define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b)) | ||
96 | #define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b)) | ||
97 | |||
98 | #define memset_io(a,b,c) memset(__io_virt(a),(b),(c)) | ||
99 | #define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c)) | ||
100 | #define memcpy_toio(a,b,c) memcpy(__io_virt(a),(b),(c)) | ||
101 | |||
102 | #define inb_p(addr) readb(addr) | ||
103 | #define inb(addr) readb(addr) | ||
104 | |||
105 | #define outb(x,addr) ((void) writeb(x,addr)) | ||
106 | #define outb_p(x,addr) outb(x,addr) | ||
107 | |||
108 | #define mmiowb() | ||
109 | |||
110 | /* | ||
111 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
112 | * access | ||
113 | */ | ||
114 | #define xlate_dev_mem_ptr(p) __va(p) | ||
115 | |||
116 | /* | ||
117 | * Convert a virtual cached pointer to an uncached pointer | ||
118 | */ | ||
119 | #define xlate_dev_kmem_ptr(p) p | ||
120 | |||
121 | #endif /* __KERNEL__ */ | ||
122 | |||
123 | #endif | ||