root/arch/alpha/lib/io.c

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

DEFINITIONS

This source file includes following definitions.
  1. __bus_inb
  2. __bus_outb
  3. inb
  4. inw
  5. inl
  6. outb
  7. outw
  8. outl
  9. readb
  10. readw
  11. readl
  12. writeb
  13. writew
  14. writel
  15. insw
  16. insl
  17. outsw
  18. outsl

   1 /*
   2  * Alpha IO and memory functions.. Just expand the inlines in the header
   3  * files..
   4  */
   5 #include <linux/kernel.h>
   6 
   7 #include <asm/io.h>
   8 
   9 /* 
  10  * Jensen has a separate "local" and "bus" IO space for
  11  * byte-wide IO.
  12  */
  13 #ifdef __is_local
  14 #undef __bus_inb
  15 unsigned int __bus_inb(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  16 {
  17         return ___bus_inb(addr);
  18 }
  19 
  20 #undef __bus_outb
  21 void __bus_outb(unsigned char b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  22 {
  23         ___bus_outb(b, addr);
  24 }
  25 #endif
  26 
  27 #undef inb
  28 unsigned int inb(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  29 {
  30         return __inb(addr);
  31 }
  32 
  33 #undef inw
  34 unsigned int inw(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  35 {
  36         return __inw(addr);
  37 }
  38 
  39 #undef inl
  40 unsigned int inl(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  41 {
  42         return __inl(addr);
  43 }
  44 
  45 
  46 #undef outb
  47 void outb(unsigned char b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  48 {
  49         __outb(b, addr);
  50 }
  51 
  52 #undef outw
  53 void outw(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  54 {
  55         __outw(b, addr);
  56 }
  57 
  58 #undef outl
  59 void outl(unsigned int b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  60 {
  61         __outl(b, addr);
  62 }
  63 
  64 
  65 #undef readb
  66 unsigned long readb(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  67 {
  68         return __readb(addr);
  69 }
  70 
  71 #undef readw
  72 unsigned long readw(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  73 {
  74         return __readw(addr);
  75 }
  76 
  77 #undef readl
  78 unsigned long readl(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  79 {
  80         return __readl(addr);
  81 }
  82 
  83 
  84 #undef writeb
  85 void writeb(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  86 {
  87         __writeb(b, addr);
  88 }
  89 
  90 #undef writew
  91 void writew(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  92 {
  93         __writew(b, addr);
  94 }
  95 
  96 #undef writel
  97 void writel(unsigned int b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  98 {
  99         __writel(b, addr);
 100 }
 101 
 102 /*
 103  * Read COUNT 16-bit words from port PORT into memory starting at
 104  * SRC.  SRC must be at least short aligned.  This is used by the
 105  * IDE driver to read disk sectors.  Performance is important, but
 106  * the interfaces seems to be slow: just using the inlined version
 107  * of the inw() breaks things.
 108  */
 109 #undef insw
 110 void insw (unsigned long port, void *dst, unsigned long count)
     /* [previous][next][first][last][top][bottom][index][help] */
 111 {
 112         unsigned int *ip, w;
 113 
 114         if (((unsigned long)dst) & 0x3) {
 115                 if (((unsigned long)dst) & 0x1) {
 116                         panic("insw: memory not short aligned");
 117                 }
 118                 *(unsigned short*)dst = inw(port);
 119                 dst += 2;
 120                 --count;
 121         }
 122 
 123         ip = dst;
 124         while (count >= 2) {
 125                 w  = inw(port);
 126                 w |= inw(port) << 16;
 127                 count -= 2;
 128                 *ip++ = w;
 129         }
 130 
 131         if (count) {
 132                 w = inw(port);
 133                 *(unsigned short*)ip = w;
 134         }
 135 }
 136 
 137 
 138 /*
 139  * Read COUNT 32-bit words from port PORT into memory starting at
 140  * SRC.  SRC must be at least word aligned.  This is used by the
 141  * IDE driver to read disk sectors.  Performance is important, but
 142  * the interfaces seems to be slow: just using the inlined version
 143  * of the inw() breaks things.
 144  */
 145 #undef insl
 146 void insl (unsigned long port, void *dst, unsigned long count)
     /* [previous][next][first][last][top][bottom][index][help] */
 147 {
 148         unsigned int *ip, w;
 149 
 150         if (((unsigned long)dst) & 0x3) {
 151                 panic("insl: memory not aligned");
 152         }
 153 
 154         ip = dst;
 155         while (count > 0) {
 156                 w  = inw(port);
 157                 --count;
 158                 *ip++ = w;
 159         }
 160 }
 161 
 162 
 163 /*
 164  * Like insw but in the opposite direction.  This is used by the IDE
 165  * driver to write disk sectors.  Performance is important, but the
 166  * interfaces seems to be slow: just using the inlined version of the
 167  * outw() breaks things.
 168  */
 169 #undef outsw
 170 void outsw (unsigned long port, void *src, unsigned long count)
     /* [previous][next][first][last][top][bottom][index][help] */
 171 {
 172         unsigned int *ip, w;
 173 
 174         if (((unsigned long)src) & 0x3) {
 175                 if (((unsigned long)src) & 0x1) {
 176                         panic("outsw: memory not short aligned");
 177                 }
 178                 outw(*(unsigned short*)src, port);
 179                 src += 2;
 180                 --count;
 181         }
 182 
 183         ip = src;
 184         while (count >= 2) {
 185                 w = *ip++;
 186                 count -= 2;
 187                 outw(w >>  0, port);
 188                 outw(w >> 16, port);
 189         }
 190 
 191         if (count) {
 192                 outw(*(unsigned short*)ip, port);
 193         }
 194 }
 195 
 196 
 197 /*
 198  * Like insl but in the opposite direction.  This is used by the IDE
 199  * driver to write disk sectors.  Performance is important, but the
 200  * interfaces seems to be slow: just using the inlined version of the
 201  * outw() breaks things.
 202  */
 203 #undef outsw
 204 void outsl (unsigned long port, void *src, unsigned long count)
     /* [previous][next][first][last][top][bottom][index][help] */
 205 {
 206         unsigned int *ip, w;
 207 
 208         if (((unsigned long)src) & 0x3) {
 209                 panic("outsw: memory not aligned");
 210         }
 211 
 212         ip = src;
 213         while (count > 0) {
 214                 w = *ip++;
 215                 --count;
 216                 outw(w, port);
 217         }
 218 }

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