root/include/asm-alpha/jensen.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __local_inb
  2. __local_outb
  3. __inb
  4. __outb
  5. __is_local
  6. inb
  7. outb
  8. inw
  9. outw
  10. outl
  11. readb
  12. readw
  13. readl
  14. writeb
  15. writew
  16. writel

   1 #ifndef __ALPHA_JENSEN_H
   2 #define __ALPHA_JENSEN_H
   3 
   4 /*
   5  * Defines for the AlphaPC EISA IO and memory address space.
   6  */
   7 
   8 /*
   9  * NOTE! Currently it never uses the HAE register, so these work only
  10  * for the low 25 bits of EISA addressing.  That covers all of the IO
  11  * address space (16 bits), and most of the "normal" EISA memory space.
  12  * I'll fix it eventually, but I'll need to come up with a clean way
  13  * to handle races with interrupt services wanting to change HAE...
  14  */
  15 
  16 /*
  17  * NOTE 2! The memory operations do not set any memory barriers, as it's
  18  * not needed for cases like a frame buffer that is essentially memory-like.
  19  * You need to do them by hand if the operations depend on ordering.
  20  *
  21  * Similarly, the port IO operations do a "mb" only after a write operation:
  22  * if an mb is needed before (as in the case of doing memory mapped IO
  23  * first, and then a port IO operation to the same device), it needs to be
  24  * done by hand.
  25  *
  26  * After the above has bitten me 100 times, I'll give up and just do the
  27  * mb all the time, but right now I'm hoping this will work out.  Avoiding
  28  * mb's may potentially be a noticeable speed improvement, but I can't
  29  * honestly say I've tested it.
  30  *
  31  * Handling interrupts that need to do mb's to synchronize to non-interrupts
  32  * is another fun race area.  Don't do it (because if you do, I'll have to
  33  * do *everything* with interrupts disabled, ugh).
  34  */
  35 
  36 /*
  37  * Virtual -> physical identity mapping starts at this offset
  38  */
  39 #define IDENT_ADDR      (0xfffffc0000000000UL)
  40 
  41 /*
  42  * EISA Interrupt Acknowledge address
  43  */
  44 #define EISA_INTA               (IDENT_ADDR + 0x100000000UL)
  45 
  46 /*
  47  * FEPROM addresses
  48  */
  49 #define EISA_FEPROM0            (IDENT_ADDR + 0x180000000UL)
  50 #define EISA_FEPROM1            (IDENT_ADDR + 0x1A0000000UL)
  51 
  52 /*
  53  * VL82C106 base address
  54  */
  55 #define EISA_VL82C106           (IDENT_ADDR + 0x1C0000000UL)
  56 
  57 /*
  58  * EISA "Host Address Extension" address (bits 25-31 of the EISA address)
  59  */
  60 #define EISA_HAE                (IDENT_ADDR + 0x1D0000000UL)
  61 
  62 /*
  63  * "SYSCTL" register address
  64  */
  65 #define EISA_SYSCTL             (IDENT_ADDR + 0x1E0000000UL)
  66 
  67 /*
  68  * "spare" register address
  69  */
  70 #define EISA_SPARE              (IDENT_ADDR + 0x1F0000000UL)
  71 
  72 /*
  73  * EISA memory address offset
  74  */
  75 #define EISA_MEM                (IDENT_ADDR + 0x200000000UL)
  76 
  77 /*
  78  * EISA IO address offset
  79  */
  80 #define EISA_IO                 (IDENT_ADDR + 0x300000000UL)
  81 
  82 /*
  83  * IO functions
  84  *
  85  * The "local" functions are those that don't go out to the EISA bus,
  86  * but instead act on the VL82C106 chip directly.. This is mainly the
  87  * keyboard, RTC,  printer and first two serial lines..
  88  *
  89  * The local stuff makes for some complications, but it seems to be
  90  * gone in the PCI version. I hope I can get DEC suckered^H^H^H^H^H^H^H^H
  91  * convinced that I need one of the newer machines.
  92  */
  93 extern inline unsigned int __local_inb(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 __local_outb(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 int __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 void __outb(unsigned char b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 113 {
 114         *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x00) = b * 0x01010101;
 115         mb();
 116 }
 117 
 118 /*
 119  * This is a stupid one: I'll make it a bitmap soon, promise..
 120  *
 121  * On the other hand: this allows gcc to optimize. Hmm. I'll
 122  * have to use the __constant_p() stuff here.
 123  */
 124 extern inline int __is_local(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 125 {
 126         /* keyboard */
 127         if (addr == 0x60 || addr == 0x64)
 128                 return 1;
 129 
 130         /* RTC */
 131         if (addr == 0x170 || addr == 0x171)
 132                 return 1;
 133 
 134         /* motherboard COM2 */
 135         if (addr >= 0x2f8 && addr <= 0x2ff)
 136                 return 1;
 137 
 138         /* motherboard LPT1 */
 139         if (addr >= 0x3bc && addr <= 0x3be)
 140                 return 1;
 141 
 142         /* motherboard COM2 */
 143         if (addr >= 0x3f8 && addr <= 0x3ff)
 144                 return 1;
 145 
 146         return 0;
 147 }
 148 
 149 extern inline unsigned int inb(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 150 {
 151         if (__is_local(addr))
 152                 return __local_inb(addr);
 153         return __inb(addr);
 154 }
 155 
 156 extern inline void outb(unsigned char b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 157 {
 158         if (__is_local(addr))
 159                 __local_outb(b, addr);
 160         else
 161                 __outb(b, addr);
 162 }
 163 
 164 extern inline unsigned int inw(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 165 {
 166         long result = *(volatile int *) ((addr << 7) + EISA_IO + 0x20);
 167         result >>= (addr & 3) * 8;
 168         return 0xffffUL & result;
 169 }
 170 
 171 extern inline unsigned int inl(unsigned long addr)
 172 {
 173         return *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x60);
 174 }
 175 
 176 extern inline void outw(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 177 {
 178         *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x20) = b * 0x00010001;
 179         mb();
 180 }
 181 
 182 extern inline void outl(unsigned int b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 183 {
 184         *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x60) = b;
 185         mb();
 186 }
 187 
 188 /*
 189  * Memory functions
 190  */
 191 extern inline unsigned long readb(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 192 {
 193         long result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x00);
 194         result >>= (addr & 3) * 8;
 195         return 0xffUL & result;
 196 }
 197 
 198 extern inline unsigned long readw(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 199 {
 200         long result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x20);
 201         result >>= (addr & 3) * 8;
 202         return 0xffffUL & result;
 203 }
 204 
 205 extern inline unsigned long readl(unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 206 {
 207         return *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60);
 208 }
 209 
 210 extern inline void writeb(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 211 {
 212         *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x00) = b * 0x01010101;
 213 }
 214 
 215 extern inline void writew(unsigned short b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 216 {
 217         *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x20) = b * 0x00010001;
 218 }
 219 
 220 extern inline void writel(unsigned int b, unsigned long addr)
     /* [previous][next][first][last][top][bottom][index][help] */
 221 {
 222         *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60) = b;
 223 }
 224 
 225 #define inb_p inb
 226 #define outb_p outb
 227 
 228 /*
 229  * The Alpha Jensen hardware for some rather strange reason puts
 230  * the RTC clock at 0x170 instead of 0x70. Probably due to some
 231  * misguided idea about using 0x70 for NMI stuff.
 232  *
 233  * These defines will override the defaults when doing RTC queries
 234  */
 235 #define RTC_PORT(x)     (0x170+(x))
 236 #define RTC_ADDR(x)     (x)
 237 #define RTC_ALWAYS_BCD  0
 238 
 239 #endif

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