Changes in kernel/arch/ia64/include/asm.h [314f3a3c:2f23341] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/include/asm.h
r314f3a3c r2f23341 38 38 #include <config.h> 39 39 #include <typedefs.h> 40 #include <typedefs.h> 40 41 #include <arch/register.h> 41 #include <arch/legacyio.h>42 42 #include <trace.h> 43 43 44 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 45 46 /** Map the I/O port address to a legacy I/O address. */ 47 NO_TRACE static inline uintptr_t p2a(volatile void *p) 48 { 49 uintptr_t prt = (uintptr_t) p; 50 51 return legacyio_virt_base + (((prt >> 2) << 12) | (prt & 0xfff)); 52 } 53 44 #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL 45 54 46 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v) 55 47 { 56 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) 57 *((ioport8_t *) p2a(port)) = v; 58 else 59 *port = v; 60 61 asm volatile ( 62 "mf\n" 63 "mf.a\n" 48 uintptr_t prt = (uintptr_t) port; 49 50 *((ioport8_t *) (IA64_IOSPACE_ADDRESS + 51 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 52 53 asm volatile ( 54 "mf\n" 64 55 ::: "memory" 65 56 ); … … 68 59 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v) 69 60 { 70 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) 71 *((ioport16_t *) p2a(port)) = v; 72 else 73 *port = v; 74 75 asm volatile ( 76 "mf\n" 77 "mf.a\n" 61 uintptr_t prt = (uintptr_t) port; 62 63 *((ioport16_t *) (IA64_IOSPACE_ADDRESS + 64 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 65 66 asm volatile ( 67 "mf\n" 78 68 ::: "memory" 79 69 ); … … 82 72 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v) 83 73 { 84 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) 85 *((ioport32_t *) p2a(port)) = v; 86 else 87 *port = v; 88 89 asm volatile ( 90 "mf\n" 91 "mf.a\n" 74 uintptr_t prt = (uintptr_t) port; 75 76 *((ioport32_t *) (IA64_IOSPACE_ADDRESS + 77 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 78 79 asm volatile ( 80 "mf\n" 92 81 ::: "memory" 93 82 ); … … 96 85 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 97 86 { 98 uint8_t v; 99 100 asm volatile ( 101 "mf\n" 102 ::: "memory" 103 ); 104 105 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) 106 v = *((ioport8_t *) p2a(port)); 107 else 108 v = *port; 109 110 asm volatile ( 111 "mf.a\n" 112 ::: "memory" 113 ); 114 115 return v; 87 uintptr_t prt = (uintptr_t) port; 88 89 asm volatile ( 90 "mf\n" 91 ::: "memory" 92 ); 93 94 return *((ioport8_t *) (IA64_IOSPACE_ADDRESS + 95 ((prt & 0xfff) | ((prt >> 2) << 12)))); 116 96 } 117 97 118 98 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 119 99 { 120 uint16_t v; 121 122 asm volatile ( 123 "mf\n" 124 ::: "memory" 125 ); 126 127 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) 128 v = *((ioport16_t *) p2a(port)); 129 else 130 v = *port; 131 132 asm volatile ( 133 "mf.a\n" 134 ::: "memory" 135 ); 136 137 return v; 100 uintptr_t prt = (uintptr_t) port; 101 102 asm volatile ( 103 "mf\n" 104 ::: "memory" 105 ); 106 107 return *((ioport16_t *) (IA64_IOSPACE_ADDRESS + 108 ((prt & 0xfff) | ((prt >> 2) << 12)))); 138 109 } 139 110 140 111 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 141 112 { 142 uint32_t v; 143 144 asm volatile ( 145 "mf\n" 146 ::: "memory" 147 ); 148 149 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) 150 v = *((ioport32_t *) p2a(port)); 151 else 152 v = *port; 153 154 asm volatile ( 155 "mf.a\n" 156 ::: "memory" 157 ); 158 159 return v; 113 uintptr_t prt = (uintptr_t) port; 114 115 asm volatile ( 116 "mf\n" 117 ::: "memory" 118 ); 119 120 return *((ioport32_t *) (IA64_IOSPACE_ADDRESS + 121 ((prt & 0xfff) | ((prt >> 2) << 12)))); 160 122 } 161 123
Note:
See TracChangeset
for help on using the changeset viewer.