root/include/asm-alpha/io.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. set_hae
  2. virt_to_phys
  3. phys_to_virt

   1 #ifndef __ALPHA_IO_H
   2 #define __ALPHA_IO_H
   3 
   4 #include <linux/config.h>
   5 
   6 #include <asm/system.h>
   7 
   8 /*
   9  * The hae (hardware address extension) register is used to
  10  * access high IO addresses. To avoid doing an external cycle
  11  * every time we need to set the hae, we have a hae cache in
  12  * memory. The kernel entry code makes sure that the hae is
  13  * preserved across interrupts, so it is safe to set the hae
  14  * once and then depend on it staying the same in kernel code.
  15  */
  16 extern struct hae {
  17         unsigned long   cache;
  18         unsigned long   *reg;
  19 } hae;
  20 
  21 /*
  22  * Virtual -> physical identity mapping starts at this offset
  23  */
  24 #define IDENT_ADDR      (0xfffffc0000000000UL)
  25 
  26 #ifdef __KERNEL__
  27 
  28 /*
  29  * We try to avoid hae updates (thus the cache), but when we
  30  * do need to update the hae, we need to do it atomically, so
  31  * that any interrupts wouldn't get confused with the hae
  32  * register not being up-to-date with respect to the hardware
  33  * value.
  34  */
  35 extern inline void set_hae(unsigned long new_hae)
     /* [previous][next][first][last][top][bottom][index][help] */
  36 {
  37         unsigned long ipl = swpipl(7);
  38         hae.cache = new_hae;
  39         *hae.reg = new_hae;
  40         mb();
  41         setipl(ipl);
  42 }
  43 
  44 /*
  45  * Change virtual addresses to physical addresses and vv.
  46  */
  47 extern inline unsigned long virt_to_phys(volatile void * address)
     /* [previous][next][first][last][top][bottom][index][help] */
  48 {
  49         return 0xffffffffUL & (unsigned long) address;
  50 }
  51 
  52 extern inline void * phys_to_virt(unsigned long address)
     /* [previous][next][first][last][top][bottom][index][help] */
  53 {
  54         return (void *) (address + IDENT_ADDR);
  55 }
  56 
  57 #else /* !__KERNEL__ */
  58 
  59 /*
  60  * Define actual functions in private name-space so it's easier to
  61  * accomodate things like XFree or svgalib that like to define their
  62  * own versions of inb etc.
  63  */
  64 extern unsigned int _inb (unsigned long port);
  65 extern unsigned int _inw (unsigned long port);
  66 extern unsigned int _inl (unsigned long port);
  67 extern void _outb (unsigned char b,unsigned long port);
  68 extern void _outw (unsigned short w,unsigned long port);
  69 extern void _outl (unsigned int l,unsigned long port);
  70 
  71 #ifndef inb
  72 # define inb(p) _inb((p))
  73 # define inw(p) _inw((p))
  74 # define inl(p) _inl((p))
  75 # define outb(b,p) _outb((b),(p))
  76 # define outw(w,p) _outw((w),(p))
  77 # define outl(l,p) _outl((l),(p))
  78 #endif
  79 
  80 #endif /* !__KERNEL__ */
  81 
  82 /*
  83  * There are different version of the alpha motherboards: the
  84  * "interesting" (read: slightly braindead) Jensen type hardware
  85  * and the PCI version
  86  */
  87 #if defined(CONFIG_ALPHA_LCA)
  88 # include <asm/lca.h>           /* get chip-specific definitions */
  89 #elif defined(CONFIG_ALPHA_APECS)
  90 # include <asm/apecs.h>         /* get chip-specific definitions */
  91 #else
  92 # include <asm/jensen.h>
  93 #endif
  94 
  95 #ifdef __KERNEL__
  96 
  97 /*
  98  * String version of IO memory access ops:
  99  */
 100 extern void memcpy_fromio(void *, unsigned long, unsigned long);
 101 extern void memcpy_toio(unsigned long, void *, unsigned long);
 102 extern void memset_io(unsigned long, int, unsigned long);
 103 
 104 /*
 105  * String versions of in/out ops:
 106  */
 107 extern void insb (unsigned long port, void *src, unsigned long count);
 108 extern void insw (unsigned long port, void *src, unsigned long count);
 109 extern void insl (unsigned long port, void *src, unsigned long count);
 110 extern void outsb (unsigned long port, void *dst, unsigned long count);
 111 extern void outsw (unsigned long port, void *dst, unsigned long count);
 112 extern void outsl (unsigned long port, void *dst, unsigned long count);
 113 
 114 /*
 115  * The "address" in IO memory space is not clearly either a integer or a
 116  * pointer. We will accept both, thus the casts.
 117  */
 118 #define readb(addr) ((unsigned char) (readb)((unsigned long)(addr)))
 119 #define readw(addr) ((unsigned short) (readw)((unsigned long)(addr)))
 120 #define readl(addr) ((unsigned int) (readl)((unsigned long)(addr)))
 121 
 122 #define writeb(b,addr) (writeb)((b),(unsigned long)(addr))
 123 #define writew(w,addr) (writew)((w),(unsigned long)(addr))
 124 #define writel(l,addr) (writel)((l),(unsigned long)(addr))
 125 
 126 #define memset_io(addr,c,len)           (memset_io)((unsigned long)(addr),(c),(len))
 127 #define memcpy_fromio(to,from,len)      (memcpy_fromio)((to),(unsigned long)(from),(len))
 128 #define memcpy_toio(to,from,len)        (memcpy_toio)((unsigned long)(to),(from),(len))
 129 
 130 #endif /* __KERNEL__ */
 131 
 132 #endif

/* [previous][next][first][last][top][bottom][index][help] */