22 #include <asm/unaligned.h>
25 #define __SLOW_DOWN_IO do { } while (0)
26 #define SLOW_DOWN_IO do { } while (0)
28 #define __IA64_UNCACHED_OFFSET RGN_BASE(RGN_UNCACHED)
35 #define IO_SPACE_LIMIT 0xffffffffffffffffUL
37 #define MAX_IO_SPACES_BITS 8
38 #define MAX_IO_SPACES (1UL << MAX_IO_SPACES_BITS)
39 #define IO_SPACE_BITS 24
40 #define IO_SPACE_SIZE (1UL << IO_SPACE_BITS)
42 #define IO_SPACE_NR(port) ((port) >> IO_SPACE_BITS)
43 #define IO_SPACE_BASE(space) ((space) << IO_SPACE_BITS)
44 #define IO_SPACE_PORT(port) ((port) & (IO_SPACE_SIZE - 1))
46 #define IO_SPACE_SPARSE_ENCODING(p) ((((p) >> 2) << 12) | ((p) & 0xfff))
66 #define PIO_OFFSET (1UL << (MAX_IO_SPACES_BITS + IO_SPACE_BITS))
67 #define PIO_MASK (PIO_OFFSET - 1)
68 #define PIO_RESERVED __IA64_UNCACHED_OFFSET
69 #define HAVE_ARCH_PIO_SIZE
71 #include <asm/intrinsics.h>
72 #include <asm/machvec.h>
79 static inline unsigned long
91 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
100 #define bus_to_virt phys_to_virt
101 #define virt_to_bus virt_to_phys
102 #define page_to_bus page_to_phys
110 #define __ia64_mf_a() ia64_mfa()
121 static inline void ___ia64_mmiowb(
void)
127 __ia64_mk_io_addr (
unsigned long port)
142 #define __ia64_inb ___ia64_inb
143 #define __ia64_inw ___ia64_inw
144 #define __ia64_inl ___ia64_inl
145 #define __ia64_outb ___ia64_outb
146 #define __ia64_outw ___ia64_outw
147 #define __ia64_outl ___ia64_outl
148 #define __ia64_readb ___ia64_readb
149 #define __ia64_readw ___ia64_readw
150 #define __ia64_readl ___ia64_readl
151 #define __ia64_readq ___ia64_readq
152 #define __ia64_readb_relaxed ___ia64_readb
153 #define __ia64_readw_relaxed ___ia64_readw
154 #define __ia64_readl_relaxed ___ia64_readl
155 #define __ia64_readq_relaxed ___ia64_readq
156 #define __ia64_writeb ___ia64_writeb
157 #define __ia64_writew ___ia64_writew
158 #define __ia64_writel ___ia64_writel
159 #define __ia64_writeq ___ia64_writeq
160 #define __ia64_mmiowb ___ia64_mmiowb
170 static inline unsigned int
171 ___ia64_inb (
unsigned long port)
173 volatile unsigned char *
addr = __ia64_mk_io_addr(port);
181 static inline unsigned int
182 ___ia64_inw (
unsigned long port)
184 volatile unsigned short *
addr = __ia64_mk_io_addr(port);
192 static inline unsigned int
193 ___ia64_inl (
unsigned long port)
195 volatile unsigned int *
addr = __ia64_mk_io_addr(port);
204 ___ia64_outb (
unsigned char val,
unsigned long port)
206 volatile unsigned char *
addr = __ia64_mk_io_addr(port);
213 ___ia64_outw (
unsigned short val,
unsigned long port)
215 volatile unsigned short *
addr = __ia64_mk_io_addr(port);
222 ___ia64_outl (
unsigned int val,
unsigned long port)
224 volatile unsigned int *
addr = __ia64_mk_io_addr(port);
231 __insb (
unsigned long port,
void *
dst,
unsigned long count)
233 unsigned char *
dp =
dst;
240 __insw (
unsigned long port,
void *dst,
unsigned long count)
242 unsigned short *dp =
dst;
249 __insl (
unsigned long port,
void *dst,
unsigned long count)
251 unsigned int *dp =
dst;
258 __outsb (
unsigned long port,
const void *
src,
unsigned long count)
260 const unsigned char *
sp =
src;
267 __outsw (
unsigned long port,
const void *src,
unsigned long count)
269 const unsigned short *sp =
src;
276 __outsl (
unsigned long port,
const void *src,
unsigned long count)
278 const unsigned int *sp =
src;
289 #define __inb platform_inb
290 #define __inw platform_inw
291 #define __inl platform_inl
292 #define __outb platform_outb
293 #define __outw platform_outw
294 #define __outl platform_outl
295 #define __mmiowb platform_mmiowb
297 #define inb(p) __inb(p)
298 #define inw(p) __inw(p)
299 #define inl(p) __inl(p)
300 #define insb(p,d,c) __insb(p,d,c)
301 #define insw(p,d,c) __insw(p,d,c)
302 #define insl(p,d,c) __insl(p,d,c)
303 #define outb(v,p) __outb(v,p)
304 #define outw(v,p) __outw(v,p)
305 #define outl(v,p) __outl(v,p)
306 #define outsb(p,s,c) __outsb(p,s,c)
307 #define outsw(p,s,c) __outsw(p,s,c)
308 #define outsl(p,s,c) __outsl(p,s,c)
309 #define mmiowb() __mmiowb()
319 static inline unsigned char
322 return *(
volatile unsigned char __force *)addr;
325 static inline unsigned short
328 return *(
volatile unsigned short __force *)addr;
331 static inline unsigned int
334 return *(
volatile unsigned int __force *) addr;
337 static inline unsigned long
340 return *(
volatile unsigned long __force *) addr;
346 *(
volatile unsigned char __force *) addr = val;
352 *(
volatile unsigned short __force *) addr = val;
358 *(
volatile unsigned int __force *) addr = val;
364 *(
volatile unsigned long __force *) addr = val;
367 #define __readb platform_readb
368 #define __readw platform_readw
369 #define __readl platform_readl
370 #define __readq platform_readq
371 #define __readb_relaxed platform_readb_relaxed
372 #define __readw_relaxed platform_readw_relaxed
373 #define __readl_relaxed platform_readl_relaxed
374 #define __readq_relaxed platform_readq_relaxed
376 #define readb(a) __readb((a))
377 #define readw(a) __readw((a))
378 #define readl(a) __readl((a))
379 #define readq(a) __readq((a))
380 #define readb_relaxed(a) __readb_relaxed((a))
381 #define readw_relaxed(a) __readw_relaxed((a))
382 #define readl_relaxed(a) __readl_relaxed((a))
383 #define readq_relaxed(a) __readq_relaxed((a))
384 #define __raw_readb readb
385 #define __raw_readw readw
386 #define __raw_readl readl
387 #define __raw_readq readq
388 #define __raw_readb_relaxed readb_relaxed
389 #define __raw_readw_relaxed readw_relaxed
390 #define __raw_readl_relaxed readl_relaxed
391 #define __raw_readq_relaxed readq_relaxed
392 #define writeb(v,a) __writeb((v), (a))
393 #define writew(v,a) __writew((v), (a))
394 #define writel(v,a) __writel((v), (a))
395 #define writeq(v,a) __writeq((v), (a))
396 #define __raw_writeb writeb
397 #define __raw_writew writew
398 #define __raw_writel writel
399 #define __raw_writeq writeq
430 return ioremap(phys_addr, size);