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 void __sethae (unsigned long addr);      /* syscall */
  65 extern void _sethae (unsigned long addr);       /* cached version */
  66 
  67 #endif /* !__KERNEL__ */
  68 
  69 /*
  70  * There are different version of the Alpha PC motherboards:
  71  */
  72 #if defined(CONFIG_ALPHA_LCA)
  73 # include <asm/lca.h>           /* get chip-specific definitions */
  74 #elif defined(CONFIG_ALPHA_APECS)
  75 # include <asm/apecs.h>         /* get chip-specific definitions */
  76 #elif defined(CONFIG_ALPHA_ALCOR)
  77 # include <asm/alcor.h>         /* get chip-specific definitions */
  78 #else
  79 # include <asm/jensen.h>
  80 #endif
  81 
  82 /*
  83  * The convention used for inb/outb etc. is that names starting with
  84  * two underscores are the inline versions, names starting with a
  85  * single underscore are proper functions, and names starting with a
  86  * letter are macros that map in some way to inline or proper function
  87  * versions.  Not all that pretty, but before you change it, be sure
  88  * to convince yourself that it won't break anything (in particular
  89  * module support).
  90  */
  91 extern unsigned int     _inb (unsigned long port);
  92 extern unsigned int     _inw (unsigned long port);
  93 extern unsigned int     _inl (unsigned long port);
  94 extern void             _outb (unsigned char b,unsigned long port);
  95 extern void             _outw (unsigned short w,unsigned long port);
  96 extern void             _outl (unsigned int l,unsigned long port);
  97 extern unsigned long    _readb(unsigned long addr);
  98 extern unsigned long    _readw(unsigned long addr);
  99 extern unsigned long    _readl(unsigned long addr);
 100 extern void             _writeb(unsigned char b, unsigned long addr);
 101 extern void             _writew(unsigned short b, unsigned long addr);
 102 extern void             _writel(unsigned int b, unsigned long addr);
 103 
 104 /*
 105  * The platform header files may define some of these macros to use
 106  * the inlined versions where appropriate.  These macros may also be
 107  * redefined by userlevel programs.
 108  */
 109 #ifndef inb
 110 # define inb(p)         _inb((p))
 111 #endif
 112 #ifndef inw
 113 # define inw(p)         _inw((p))
 114 #endif
 115 #ifndef inl
 116 # define inl(p)         _inl((p))
 117 #endif
 118 #ifndef outb
 119 # define outb(b,p)      _outb((b),(p))
 120 #endif
 121 #ifndef outw
 122 # define outw(w,p)      _outw((w),(p))
 123 #endif
 124 #ifndef outl
 125 # define outl(l,p)      _outl((l),(p))
 126 #endif
 127 
 128 #ifndef inb_p
 129 # define inb_p          inb
 130 #endif
 131 #ifndef inw_p
 132 # define inw_p          inw
 133 #endif
 134 #ifndef inl_p
 135 # define inl_p          inl
 136 #endif
 137 #ifndef outb_p
 138 # define outb_p         outb
 139 #endif
 140 #ifndef outw_p
 141 # define outw_p         outw
 142 #endif
 143 #ifndef outl_p
 144 # define outl_p         outl
 145 #endif
 146 
 147 #ifndef inw_p
 148 # define inw_p          inw
 149 #endif
 150 #ifndef outw_p
 151 # define outw_p         outw
 152 #endif
 153 
 154 #ifndef inl_p
 155 # define inl_p          inl
 156 #endif
 157 #ifndef outl_p
 158 # define outl_p         outl
 159 #endif
 160 
 161 /*
 162  * The "address" in IO memory space is not clearly either a integer or a
 163  * pointer. We will accept both, thus the casts.
 164  */
 165 #ifndef readb
 166 # define readb(a)       _readb((unsigned long)(a))
 167 #endif
 168 #ifndef readw
 169 # define readw(a)       _readw((unsigned long)(a))
 170 #endif
 171 #ifndef readl
 172 # define readl(a)       _readl((unsigned long)(a))
 173 #endif
 174 #ifndef writeb
 175 # define writeb(v,a)    _writeb((v),(unsigned long)(a))
 176 #endif
 177 #ifndef writew
 178 # define writew(v,a)    _writew((v),(unsigned long)(a))
 179 #endif
 180 #ifndef writel
 181 # define writel(v,a)    _writel((v),(unsigned long)(a))
 182 #endif
 183 
 184 #ifdef __KERNEL__
 185 
 186 /*
 187  * String version of IO memory access ops:
 188  */
 189 extern void _memcpy_fromio(void *, unsigned long, unsigned long);
 190 extern void _memcpy_toio(unsigned long, void *, unsigned long);
 191 extern void _memset_io(unsigned long, int, unsigned long);
 192 
 193 #define memcpy_fromio(to,from,len)      _memcpy_fromio((to),(unsigned long)(from),(len))
 194 #define memcpy_toio(to,from,len)        _memcpy_toio((unsigned long)(to),(from),(len))
 195 #define memset_io(addr,c,len)           _memset_io((unsigned long)(addr),(c),(len))
 196 
 197 /*
 198  * String versions of in/out ops:
 199  */
 200 extern void insb (unsigned long port, void *dst, unsigned long count);
 201 extern void insw (unsigned long port, void *dst, unsigned long count);
 202 extern void insl (unsigned long port, void *dst, unsigned long count);
 203 extern void outsb (unsigned long port, const void *src, unsigned long count);
 204 extern void outsw (unsigned long port, const void *src, unsigned long count);
 205 extern void outsl (unsigned long port, const void *src, unsigned long count);
 206 
 207 /*
 208  * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and 
 209  * just copy it. The net code will then do the checksum later. Presently 
 210  * only used by some shared memory 8390 ethernet cards anyway.
 211  */
 212 
 213 #define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
 214 
 215 #endif /* __KERNEL__ */
 216 
 217 #endif

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