root/include/asm-alpha/io.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. inb_local
  2. outb_local
  3. inb
  4. inw
  5. outb
  6. outw
  7. outl
  8. readb
  9. readw
  10. readl
  11. writeb
  12. writew
  13. writel

   1 #ifndef __ALPHA_IO_H
   2 #define __ALPHA_IO_H
   3 
   4 /*
   5  * Defines for the AlphaPC EISA IO and memory address space.
   6  */
   7 
   8 #ifndef mb
   9 #define mb() __asm__ __volatile__("mb": : :"memory")
  10 #endif
  11 
  12 /*
  13  * NOTE! Currently it never uses the HAE register, so these work only
  14  * for the low 25 bits of EISA addressing.  That covers all of the IO
  15  * address space (16 bits), and most of the "normal" EISA memory space.
  16  * I'll fix it eventually, but I'll need to come up with a clean way
  17  * to handle races with interrupt services wanting to change HAE...
  18  */
  19 
  20 /*
  21  * NOTE 2! The memory operations do not set any memory barriers, as it's
  22  * not needed for cases like a frame buffer that is essentially memory-like.
  23  * You need to do them by hand if the operations depend on ordering.
  24  *
  25  * Similarly, the port IO operations do a "mb" only after a write operation:
  26  * if an mb is needed before (as in the case of doing memory mapped IO
  27  * first, and then a port IO operation to the same device), it needs to be
  28  * done by hand.
  29  *
  30  * After the above has bitten me 100 times, I'll give up and just do the
  31  * mb all the time, but right now I'm hoping this will work out.  Avoiding
  32  * mb's may potentially be a noticeable speed improvement, but I can't
  33  * honestly say I've tested it.
  34  *
  35  * Handling interrupts that need to do mb's to synchronize to non-interrupts
  36  * is another fun race area.  Don't do it (because if you do, I'll have to
  37  * do *everything* with interrupts disabled, ugh).
  38  */
  39 
  40 /*
  41  * Virtual -> physical identity mapping starts at this offset
  42  */
  43 #define IDENT_ADDR      (0xfffffc0000000000UL)
  44 
  45 /*
  46  * EISA Interrupt Acknowledge address
  47  */
  48 #define EISA_INTA               (IDENT_ADDR + 0x100000000UL)
  49 
  50 /*
  51  * FEPROM addresses
  52  */
  53 #define EISA_FEPROM0            (IDENT_ADDR + 0x180000000UL)
  54 #define EISA_FEPROM1            (IDENT_ADDR + 0x1A0000000UL)
  55 
  56 /*
  57  * VL82C106 base address
  58  */
  59 #define EISA_VL82C106           (IDENT_ADDR + 0x1C0000000UL)
  60 
  61 /*
  62  * EISA "Host Address Extension" address (bits 25-31 of the EISA address)
  63  */
  64 #define EISA_HAE                (IDENT_ADDR + 0x1D0000000UL)
  65 
  66 /*
  67  * "SYSCTL" register address
  68  */
  69 #define EISA_SYSCTL             (IDENT_ADDR + 0x1E0000000UL)
  70 
  71 /*
  72  * "spare" register address
  73  */
  74 #define EISA_SPARE              (IDENT_ADDR + 0x1F0000000UL)
  75 
  76 /*
  77  * EISA memory address offset
  78  */
  79 #define EISA_MEM                (IDENT_ADDR + 0x200000000UL)
  80 
  81 /*
  82  * EISA IO address offset
  83  */
  84 #define EISA_IO                 (IDENT_ADDR + 0x300000000UL)
  85 
  86 /*
  87  * IO functions
  88  *
  89  * The "local" functions are those that don't go out to the EISA bus,
  90  * but instead act on the VL82C106 chip directly.. This is mainly the
  91  * keyboard, RTC,  printer and first two serial lines..
  92  */
  93 extern inline unsigned long inb_local(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
  94 {
  95         long result = *(volatile int *) ((addr << 9) + EISA_VL82C106);
  96         return 0xffUL & result;
  97 }
  98 
  99 extern inline void outb_local(unsigned char b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 100 {
 101         *(volatile unsigned int *) ((addr << 9) + EISA_VL82C106) = b;
 102         mb();
 103 }
 104 
 105 extern inline unsigned long inb(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 106 {
 107         long result = *(volatile int *) ((addr << 7) + EISA_IO + 0x00);
 108         result >>= (addr & 3) * 8;
 109         return 0xffUL & result;
 110 }
 111 
 112 extern inline unsigned long inw(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 113 {
 114         long result = *(volatile int *) ((addr << 7) + EISA_IO + 0x20);
 115         result >>= (addr & 3) * 8;
 116         return 0xffffUL & result;
 117 }
 118 
 119 extern inline unsigned long inl(unsigned long addr)
 120 {
 121         return *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x60);
 122 }
 123 
 124 extern inline void outb(unsigned char b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 125 {
 126         *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x00) = b * 0x01010101;
 127         mb();
 128 }
 129 
 130 extern inline void outw(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 131 {
 132         *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x20) = b * 0x00010001;
 133         mb();
 134 }
 135 
 136 extern inline void outl(unsigned int b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 137 {
 138         *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x60) = b;
 139         mb();
 140 }
 141 
 142 /*
 143  * Memory functions
 144  */
 145 extern inline unsigned long readb(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 146 {
 147         long result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x00);
 148         result >>= (addr & 3) * 8;
 149         return 0xffUL & result;
 150 }
 151 
 152 extern inline unsigned long readw(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 153 {
 154         long result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x20);
 155         result >>= (addr & 3) * 8;
 156         return 0xffffUL & result;
 157 }
 158 
 159 extern inline unsigned long readl(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 160 {
 161         return *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60);
 162 }
 163 
 164 extern inline void writeb(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 165 {
 166         *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x00) = b * 0x01010101;
 167 }
 168 
 169 extern inline void writew(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 170 {
 171         *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x20) = b * 0x00010001;
 172 }
 173 
 174 extern inline void writel(unsigned int b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 175 {
 176         *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60) = b;
 177 }
 178 
 179 #endif

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