aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc/io.h
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-12-06 17:31:30 -0500
committerLen Brown <len.brown@intel.com>2005-12-06 17:31:30 -0500
commit3d5271f9883cba7b54762bc4fe027d4172f06db7 (patch)
treeab8a881a14478598a0c8bda0d26c62cdccfffd6d /include/asm-ppc/io.h
parent378b2556f4e09fa6f87ff0cb5c4395ff28257d02 (diff)
parent9115a6c787596e687df03010d97fccc5e0762506 (diff)
Pull release into acpica branch
Diffstat (limited to 'include/asm-ppc/io.h')
-rw-r--r--include/asm-ppc/io.h60
1 files changed, 35 insertions, 25 deletions
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 7eb7cf6360bd..84ac6e258eef 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -8,6 +8,7 @@
8 8
9#include <asm/page.h> 9#include <asm/page.h>
10#include <asm/byteorder.h> 10#include <asm/byteorder.h>
11#include <asm/synch.h>
11#include <asm/mmu.h> 12#include <asm/mmu.h>
12 13
13#define SIO_CONFIG_RA 0x398 14#define SIO_CONFIG_RA 0x398
@@ -56,7 +57,7 @@ extern unsigned long pci_dram_offset;
56 * is actually performed (i.e. the data has come back) before we start 57 * is actually performed (i.e. the data has come back) before we start
57 * executing any following instructions. 58 * executing any following instructions.
58 */ 59 */
59extern inline int in_8(volatile unsigned char __iomem *addr) 60extern inline int in_8(const volatile unsigned char __iomem *addr)
60{ 61{
61 int ret; 62 int ret;
62 63
@@ -72,7 +73,7 @@ extern inline void out_8(volatile unsigned char __iomem *addr, int val)
72 __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); 73 __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
73} 74}
74 75
75extern inline int in_le16(volatile unsigned short __iomem *addr) 76extern inline int in_le16(const volatile unsigned short __iomem *addr)
76{ 77{
77 int ret; 78 int ret;
78 79
@@ -83,7 +84,7 @@ extern inline int in_le16(volatile unsigned short __iomem *addr)
83 return ret; 84 return ret;
84} 85}
85 86
86extern inline int in_be16(volatile unsigned short __iomem *addr) 87extern inline int in_be16(const volatile unsigned short __iomem *addr)
87{ 88{
88 int ret; 89 int ret;
89 90
@@ -104,7 +105,7 @@ extern inline void out_be16(volatile unsigned short __iomem *addr, int val)
104 __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); 105 __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
105} 106}
106 107
107extern inline unsigned in_le32(volatile unsigned __iomem *addr) 108extern inline unsigned in_le32(const volatile unsigned __iomem *addr)
108{ 109{
109 unsigned ret; 110 unsigned ret;
110 111
@@ -115,7 +116,7 @@ extern inline unsigned in_le32(volatile unsigned __iomem *addr)
115 return ret; 116 return ret;
116} 117}
117 118
118extern inline unsigned in_be32(volatile unsigned __iomem *addr) 119extern inline unsigned in_be32(const volatile unsigned __iomem *addr)
119{ 120{
120 unsigned ret; 121 unsigned ret;
121 122
@@ -139,7 +140,7 @@ extern inline void out_be32(volatile unsigned __iomem *addr, int val)
139#define readb(addr) in_8((volatile u8 *)(addr)) 140#define readb(addr) in_8((volatile u8 *)(addr))
140#define writeb(b,addr) out_8((volatile u8 *)(addr), (b)) 141#define writeb(b,addr) out_8((volatile u8 *)(addr), (b))
141#else 142#else
142static inline __u8 readb(volatile void __iomem *addr) 143static inline __u8 readb(const volatile void __iomem *addr)
143{ 144{
144 return in_8(addr); 145 return in_8(addr);
145} 146}
@@ -150,11 +151,11 @@ static inline void writeb(__u8 b, volatile void __iomem *addr)
150#endif 151#endif
151 152
152#if defined(CONFIG_APUS) 153#if defined(CONFIG_APUS)
153static inline __u16 readw(volatile void __iomem *addr) 154static inline __u16 readw(const volatile void __iomem *addr)
154{ 155{
155 return *(__force volatile __u16 *)(addr); 156 return *(__force volatile __u16 *)(addr);
156} 157}
157static inline __u32 readl(volatile void __iomem *addr) 158static inline __u32 readl(const volatile void __iomem *addr)
158{ 159{
159 return *(__force volatile __u32 *)(addr); 160 return *(__force volatile __u32 *)(addr);
160} 161}
@@ -173,11 +174,11 @@ static inline void writel(__u32 b, volatile void __iomem *addr)
173#define writew(b,addr) out_le16((volatile u16 *)(addr),(b)) 174#define writew(b,addr) out_le16((volatile u16 *)(addr),(b))
174#define writel(b,addr) out_le32((volatile u32 *)(addr),(b)) 175#define writel(b,addr) out_le32((volatile u32 *)(addr),(b))
175#else 176#else
176static inline __u16 readw(volatile void __iomem *addr) 177static inline __u16 readw(const volatile void __iomem *addr)
177{ 178{
178 return in_le16(addr); 179 return in_le16(addr);
179} 180}
180static inline __u32 readl(volatile void __iomem *addr) 181static inline __u32 readl(const volatile void __iomem *addr)
181{ 182{
182 return in_le32(addr); 183 return in_le32(addr);
183} 184}
@@ -236,9 +237,9 @@ static inline void __raw_writel(__u32 b, volatile void __iomem *addr)
236#define outsl(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl)) 237#define outsl(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl))
237 238
238/* 239/*
239 * On powermacs, we will get a machine check exception if we 240 * On powermacs and 8xx we will get a machine check exception
240 * try to read data from a non-existent I/O port. Because the 241 * if we try to read data from a non-existent I/O port. Because
241 * machine check is an asynchronous exception, it isn't 242 * the machine check is an asynchronous exception, it isn't
242 * well-defined which instruction SRR0 will point to when the 243 * well-defined which instruction SRR0 will point to when the
243 * exception occurs. 244 * exception occurs.
244 * With the sequence below (twi; isync; nop), we have found that 245 * With the sequence below (twi; isync; nop), we have found that
@@ -257,7 +258,7 @@ extern __inline__ unsigned int name(unsigned int port) \
257{ \ 258{ \
258 unsigned int x; \ 259 unsigned int x; \
259 __asm__ __volatile__( \ 260 __asm__ __volatile__( \
260 op " %0,0,%1\n" \ 261 "0:" op " %0,0,%1\n" \
261 "1: twi 0,%0,0\n" \ 262 "1: twi 0,%0,0\n" \
262 "2: isync\n" \ 263 "2: isync\n" \
263 "3: nop\n" \ 264 "3: nop\n" \
@@ -268,6 +269,7 @@ extern __inline__ unsigned int name(unsigned int port) \
268 ".previous\n" \ 269 ".previous\n" \
269 ".section __ex_table,\"a\"\n" \ 270 ".section __ex_table,\"a\"\n" \
270 " .align 2\n" \ 271 " .align 2\n" \
272 " .long 0b,5b\n" \
271 " .long 1b,5b\n" \ 273 " .long 1b,5b\n" \
272 " .long 2b,5b\n" \ 274 " .long 2b,5b\n" \
273 " .long 3b,5b\n" \ 275 " .long 3b,5b\n" \
@@ -281,11 +283,12 @@ extern __inline__ unsigned int name(unsigned int port) \
281extern __inline__ void name(unsigned int val, unsigned int port) \ 283extern __inline__ void name(unsigned int val, unsigned int port) \
282{ \ 284{ \
283 __asm__ __volatile__( \ 285 __asm__ __volatile__( \
284 op " %0,0,%1\n" \ 286 "0:" op " %0,0,%1\n" \
285 "1: sync\n" \ 287 "1: sync\n" \
286 "2:\n" \ 288 "2:\n" \
287 ".section __ex_table,\"a\"\n" \ 289 ".section __ex_table,\"a\"\n" \
288 " .align 2\n" \ 290 " .align 2\n" \
291 " .long 0b,2b\n" \
289 " .long 1b,2b\n" \ 292 " .long 1b,2b\n" \
290 ".previous" \ 293 ".previous" \
291 : : "r" (val), "r" (port + ___IO_BASE)); \ 294 : : "r" (val), "r" (port + ___IO_BASE)); \
@@ -440,16 +443,6 @@ extern inline void * phys_to_virt(unsigned long address)
440#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 443#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
441#define page_to_bus(page) (page_to_phys(page) + PCI_DRAM_OFFSET) 444#define page_to_bus(page) (page_to_phys(page) + PCI_DRAM_OFFSET)
442 445
443/*
444 * Enforce In-order Execution of I/O:
445 * Acts as a barrier to ensure all previous I/O accesses have
446 * completed before any further ones are issued.
447 */
448extern inline void eieio(void)
449{
450 __asm__ __volatile__ ("eieio" : : : "memory");
451}
452
453/* Enforce in-order execution of data I/O. 446/* Enforce in-order execution of data I/O.
454 * No distinction between read/write on PPC; use eieio for all three. 447 * No distinction between read/write on PPC; use eieio for all three.
455 */ 448 */
@@ -552,6 +545,23 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
552#include <asm/mpc8260_pci9.h> 545#include <asm/mpc8260_pci9.h>
553#endif 546#endif
554 547
548#ifdef CONFIG_NOT_COHERENT_CACHE
549
550#define dma_cache_inv(_start,_size) \
551 invalidate_dcache_range(_start, (_start + _size))
552#define dma_cache_wback(_start,_size) \
553 clean_dcache_range(_start, (_start + _size))
554#define dma_cache_wback_inv(_start,_size) \
555 flush_dcache_range(_start, (_start + _size))
556
557#else
558
559#define dma_cache_inv(_start,_size) do { } while (0)
560#define dma_cache_wback(_start,_size) do { } while (0)
561#define dma_cache_wback_inv(_start,_size) do { } while (0)
562
563#endif
564
555/* 565/*
556 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 566 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
557 * access 567 * access