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 /* We don't use IO slowdowns on the alpha, but.. */
   9 #define __SLOW_DOWN_IO  do { } while (0)
  10 #define SLOW_DOWN_IO    do { } while (0)
  11 
  12 /*
  13  * The hae (hardware address extension) register is used to
  14  * access high IO addresses. To avoid doing an external cycle
  15  * every time we need to set the hae, we have a hae cache in
  16  * memory. The kernel entry code makes sure that the hae is
  17  * preserved across interrupts, so it is safe to set the hae
  18  * once and then depend on it staying the same in kernel code.
  19  */
  20 extern struct hae {
  21         unsigned long   cache;
  22         unsigned long   *reg;
  23 } hae;
  24 
  25 /*
  26  * Virtual -> physical identity mapping starts at this offset
  27  */
  28 #define IDENT_ADDR      (0xfffffc0000000000UL)
  29 
  30 #ifdef __KERNEL__
  31 
  32 /*
  33  * We try to avoid hae updates (thus the cache), but when we
  34  * do need to update the hae, we need to do it atomically, so
  35  * that any interrupts wouldn't get confused with the hae
  36  * register not being up-to-date with respect to the hardware
  37  * value.
  38  */
  39 extern inline void set_hae(unsigned long new_hae)
     /* [previous][next][first][last][top][bottom][index][help] */
  40 {
  41         unsigned long ipl = swpipl(7);
  42         hae.cache = new_hae;
  43         *hae.reg = new_hae;
  44         mb();
  45         setipl(ipl);
  46 }
  47 
  48 /*
  49  * Change virtual addresses to physical addresses and vv.
  50  */
  51 extern inline unsigned long virt_to_phys(volatile void * address)
     /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53         return 0xffffffffUL & (unsigned long) address;
  54 }
  55 
  56 extern inline void * phys_to_virt(unsigned long address)
     /* [previous][next][first][last][top][bottom][index][help] */
  57 {
  58         return (void *) (address + IDENT_ADDR);
  59 }
  60 
  61 #else /* !__KERNEL__ */
  62 
  63 /*
  64  * Define actual functions in private name-space so it's easier to
  65  * accommodate things like XFree or svgalib that like to define their
  66  * own versions of inb etc.
  67  */
  68 extern void __sethae (unsigned long addr);      /* syscall */
  69 extern void _sethae (unsigned long addr);       /* cached version */
  70 
  71 #endif /* !__KERNEL__ */
  72 
  73 /*
  74  * There are different version of the Alpha PC motherboards:
  75  */
  76 #if defined(CONFIG_ALPHA_LCA)
  77 # include <asm/lca.h>           /* get chip-specific definitions */
  78 #elif defined(CONFIG_ALPHA_APECS)
  79 # include <asm/apecs.h>         /* get chip-specific definitions */
  80 #elif defined(CONFIG_ALPHA_ALCOR)
  81 # include <asm/alcor.h>         /* get chip-specific definitions */
  82 #else
  83 # include <asm/jensen.h>
  84 #endif
  85 
  86 /*
  87  * The convention used for inb/outb etc. is that names starting with
  88  * two underscores are the inline versions, names starting with a
  89  * single underscore are proper functions, and names starting with a
  90  * letter are macros that map in some way to inline or proper function
  91  * versions.  Not all that pretty, but before you change it, be sure
  92  * to convince yourself that it won't break anything (in particular
  93  * module support).
  94  */
  95 extern unsigned int     _inb (unsigned long port);
  96 extern unsigned int     _inw (unsigned long port);
  97 extern unsigned int     _inl (unsigned long port);
  98 extern void             _outb (unsigned char b,unsigned long port);
  99 extern void             _outw (unsigned short w,unsigned long port);
 100 extern void             _outl (unsigned int l,unsigned long port);
 101 extern unsigned long    _readb(unsigned long addr);
 102 extern unsigned long    _readw(unsigned long addr);
 103 extern unsigned long    _readl(unsigned long addr);
 104 extern void             _writeb(unsigned char b, unsigned long addr);
 105 extern void             _writew(unsigned short b, unsigned long addr);
 106 extern void             _writel(unsigned int b, unsigned long addr);
 107 
 108 /*
 109  * The platform header files may define some of these macros to use
 110  * the inlined versions where appropriate.  These macros may also be
 111  * redefined by userlevel programs.
 112  */
 113 #ifndef inb
 114 # define inb(p)         _inb((p))
 115 #endif
 116 #ifndef inw
 117 # define inw(p)         _inw((p))
 118 #endif
 119 #ifndef inl
 120 # define inl(p)         _inl((p))
 121 #endif
 122 #ifndef outb
 123 # define outb(b,p)      _outb((b),(p))
 124 #endif
 125 #ifndef outw
 126 # define outw(w,p)      _outw((w),(p))
 127 #endif
 128 #ifndef outl
 129 # define outl(l,p)      _outl((l),(p))
 130 #endif
 131 
 132 #ifndef inb_p
 133 # define inb_p          inb
 134 #endif
 135 #ifndef inw_p
 136 # define inw_p          inw
 137 #endif
 138 #ifndef inl_p
 139 # define inl_p          inl
 140 #endif
 141 
 142 #ifndef outb_p
 143 # define outb_p         outb
 144 #endif
 145 #ifndef outw_p
 146 # define outw_p         outw
 147 #endif
 148 #ifndef outl_p
 149 # define outl_p         outl
 150 #endif
 151 
 152 /*
 153  * The "address" in IO memory space is not clearly either a integer or a
 154  * pointer. We will accept both, thus the casts.
 155  */
 156 #ifndef readb
 157 # define readb(a)       _readb((unsigned long)(a))
 158 #endif
 159 #ifndef readw
 160 # define readw(a)       _readw((unsigned long)(a))
 161 #endif
 162 #ifndef readl
 163 # define readl(a)       _readl((unsigned long)(a))
 164 #endif
 165 #ifndef writeb
 166 # define writeb(v,a)    _writeb((v),(unsigned long)(a))
 167 #endif
 168 #ifndef writew
 169 # define writew(v,a)    _writew((v),(unsigned long)(a))
 170 #endif
 171 #ifndef writel
 172 # define writel(v,a)    _writel((v),(unsigned long)(a))
 173 #endif
 174 
 175 #ifdef __KERNEL__
 176 
 177 /*
 178  * String version of IO memory access ops:
 179  */
 180 extern void _memcpy_fromio(void *, unsigned long, unsigned long);
 181 extern void _memcpy_toio(unsigned long, void *, unsigned long);
 182 extern void _memset_io(unsigned long, int, unsigned long);
 183 
 184 #define memcpy_fromio(to,from,len)      _memcpy_fromio((to),(unsigned long)(from),(len))
 185 #define memcpy_toio(to,from,len)        _memcpy_toio((unsigned long)(to),(from),(len))
 186 #define memset_io(addr,c,len)           _memset_io((unsigned long)(addr),(c),(len))
 187 
 188 /*
 189  * String versions of in/out ops:
 190  */
 191 extern void insb (unsigned long port, void *dst, unsigned long count);
 192 extern void insw (unsigned long port, void *dst, unsigned long count);
 193 extern void insl (unsigned long port, void *dst, unsigned long count);
 194 extern void outsb (unsigned long port, const void *src, unsigned long count);
 195 extern void outsw (unsigned long port, const void *src, unsigned long count);
 196 extern void outsl (unsigned long port, const void *src, unsigned long count);
 197 
 198 /*
 199  * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and 
 200  * just copy it. The net code will then do the checksum later. Presently 
 201  * only used by some shared memory 8390 ethernet cards anyway.
 202  */
 203 
 204 #define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
 205 
 206 #endif /* __KERNEL__ */
 207 
 208 #endif

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