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 externstructhae{ 17 unsignedlongcache;
18 unsignedlong *reg;
19 }hae;
20
21 /* 22 * Virtual -> physical identity mapping starts at this offset 23 */ 24 #defineIDENT_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 externinlinevoidset_hae(unsignedlongnew_hae)
/* */ 36 { 37 unsignedlongipl = 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 externinlineunsignedlongvirt_to_phys(void * address)
/* */ 48 { 49 return 0xffffffffUL & (unsignedlong) address;
50 } 51
52 externinlinevoid * phys_to_virt(unsignedlongaddress)
/* */ 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 externunsignedint_inb (unsignedlongport);
65 externunsignedint_inw (unsignedlongport);
66 externunsignedint_inl (unsignedlongport);
67 externvoid_outb (unsignedcharb,unsignedlongport);
68 externvoid_outw (unsignedshortw,unsignedlongport);
69 externvoid_outl (unsignedintl,unsignedlongport);
70
71 #ifndefinb 72 # defineinb(p) _inb((p))
73 # defineinw(p) _inw((p))
74 # defineinl(p) _inl((p))
75 # defineoutb(b,p) _outb((b),(p))
76 # defineoutw(w,p) _outw((w),(p))
77 # defineoutl(l,p) _outl((l),(p))
78 #endif 79
80 #endif/* __KERNEL__ */ 81
82 /* 83 * There are different version of the alpha motherboards: the 84 * "interesting" (read: slightly braindead) Jensen type hardware 85 * and the PCI version 86 */ 87 #ifdefCONFIG_PCI 88 #include <asm/lca.h> /* get chip-specific definitions */ 89 #else 90 #include <asm/jensen.h>
91 #endif 92
93 #endif