Rev 4342 | Rev 4344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4342 | Rev 4343 | ||
|---|---|---|---|
| Line 39... | Line 39... | ||
| 39 | #include <arch/types.h> |
39 | #include <arch/types.h> |
| 40 | #include <arch/register.h> |
40 | #include <arch/register.h> |
| 41 | 41 | ||
| 42 | #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL |
42 | #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL |
| 43 | 43 | ||
| 44 | static inline void outb(ioport_t port, uint8_t v) |
44 | static inline void pio_write_8(ioport_t port, uint8_t v) |
| 45 | { |
45 | { |
| 46 | *((uint8_t *)(IA64_IOSPACE_ADDRESS + |
46 | *((uint8_t *)(IA64_IOSPACE_ADDRESS + |
| 47 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
47 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
| 48 | 48 | ||
| 49 | asm volatile ("mf\n" ::: "memory"); |
49 | asm volatile ("mf\n" ::: "memory"); |
| 50 | } |
50 | } |
| 51 | 51 | ||
| 52 | static inline void outw(ioport_t port, uint16_t v) |
52 | static inline void pio_write_16(ioport_t port, uint16_t v) |
| 53 | { |
53 | { |
| 54 | *((uint16_t *)(IA64_IOSPACE_ADDRESS + |
54 | *((uint16_t *)(IA64_IOSPACE_ADDRESS + |
| 55 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
55 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
| 56 | 56 | ||
| 57 | asm volatile ("mf\n" ::: "memory"); |
57 | asm volatile ("mf\n" ::: "memory"); |
| 58 | } |
58 | } |
| 59 | 59 | ||
| 60 | static inline void outl(ioport_t port, uint32_t v) |
60 | static inline void pio_write_32(ioport_t port, uint32_t v) |
| 61 | { |
61 | { |
| 62 | *((uint32_t *)(IA64_IOSPACE_ADDRESS + |
62 | *((uint32_t *)(IA64_IOSPACE_ADDRESS + |
| 63 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
63 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
| 64 | 64 | ||
| 65 | asm volatile ("mf\n" ::: "memory"); |
65 | asm volatile ("mf\n" ::: "memory"); |
| 66 | } |
66 | } |
| 67 | 67 | ||
| 68 | static inline uint8_t inb(ioport_t port) |
68 | static inline uint8_t pio_read_8(ioport_t port) |
| 69 | { |
69 | { |
| 70 | asm volatile ("mf\n" ::: "memory"); |
70 | asm volatile ("mf\n" ::: "memory"); |
| 71 | 71 | ||
| 72 | return *((uint8_t *)(IA64_IOSPACE_ADDRESS + |
72 | return *((uint8_t *)(IA64_IOSPACE_ADDRESS + |
| 73 | ((port & 0xfff) | ((port >> 2) << 12)))); |
73 | ((port & 0xfff) | ((port >> 2) << 12)))); |
| 74 | } |
74 | } |
| 75 | 75 | ||
| 76 | static inline uint16_t inw(ioport_t port) |
76 | static inline uint16_t pio_read_16(ioport_t port) |
| 77 | { |
77 | { |
| 78 | asm volatile ("mf\n" ::: "memory"); |
78 | asm volatile ("mf\n" ::: "memory"); |
| 79 | 79 | ||
| 80 | return *((uint16_t *)(IA64_IOSPACE_ADDRESS + |
80 | return *((uint16_t *)(IA64_IOSPACE_ADDRESS + |
| 81 | ((port & 0xffE) | ((port >> 2) << 12)))); |
81 | ((port & 0xffE) | ((port >> 2) << 12)))); |
| 82 | } |
82 | } |
| 83 | 83 | ||
| 84 | static inline uint32_t inl(ioport_t port) |
84 | static inline uint32_t pio_read_32(ioport_t port) |
| 85 | { |
85 | { |
| 86 | asm volatile ("mf\n" ::: "memory"); |
86 | asm volatile ("mf\n" ::: "memory"); |
| 87 | 87 | ||
| 88 | return *((uint32_t *)(IA64_IOSPACE_ADDRESS + |
88 | return *((uint32_t *)(IA64_IOSPACE_ADDRESS + |
| 89 | ((port & 0xfff) | ((port >> 2) << 12)))); |
89 | ((port & 0xfff) | ((port >> 2) << 12)))); |