Changes in kernel/arch/amd64/include/asm.h [667a4f8:96b02eb9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/asm.h
r667a4f8 r96b02eb9 77 77 } 78 78 79 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024))80 81 79 /** Byte from port 82 80 * … … 89 87 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 90 88 { 91 if (((void *)port) < IO_SPACE_BOUNDARY) { 92 uint8_t val; 93 asm volatile ( 94 "inb %w[port], %b[val]\n" 95 : [val] "=a" (val) 96 : [port] "d" (port) 97 ); 98 return val; 99 } else { 100 return (uint8_t) *port; 101 } 89 uint8_t val; 90 91 asm volatile ( 92 "inb %w[port], %b[val]\n" 93 : [val] "=a" (val) 94 : [port] "d" (port) 95 ); 96 97 return val; 102 98 } 103 99 … … 112 108 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 113 109 { 114 if (((void *)port) < IO_SPACE_BOUNDARY) { 115 uint16_t val; 116 asm volatile ( 117 "inw %w[port], %w[val]\n" 118 : [val] "=a" (val) 119 : [port] "d" (port) 120 ); 121 return val; 122 } else { 123 return (uint16_t) *port; 124 } 110 uint16_t val; 111 112 asm volatile ( 113 "inw %w[port], %w[val]\n" 114 : [val] "=a" (val) 115 : [port] "d" (port) 116 ); 117 118 return val; 125 119 } 126 120 … … 135 129 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 136 130 { 137 if (((void *)port) < IO_SPACE_BOUNDARY) { 138 uint32_t val; 139 asm volatile ( 140 "inl %w[port], %[val]\n" 141 : [val] "=a" (val) 142 : [port] "d" (port) 143 ); 144 return val; 145 } else { 146 return (uint32_t) *port; 147 } 131 uint32_t val; 132 133 asm volatile ( 134 "inl %w[port], %[val]\n" 135 : [val] "=a" (val) 136 : [port] "d" (port) 137 ); 138 139 return val; 148 140 } 149 141 … … 158 150 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val) 159 151 { 160 if (((void *)port) < IO_SPACE_BOUNDARY) { 161 asm volatile ( 162 "outb %b[val], %w[port]\n" 163 :: [val] "a" (val), [port] "d" (port) 164 ); 165 } else { 166 *((uint8_t *) port) = val; 167 } 152 asm volatile ( 153 "outb %b[val], %w[port]\n" 154 :: [val] "a" (val), 155 [port] "d" (port) 156 ); 168 157 } 169 158 … … 178 167 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val) 179 168 { 180 if (((void *)port) < IO_SPACE_BOUNDARY) { 181 asm volatile ( 182 "outw %w[val], %w[port]\n" 183 :: [val] "a" (val), [port] "d" (port) 184 ); 185 } else { 186 *((uint16_t *) port) = val; 187 } 169 asm volatile ( 170 "outw %w[val], %w[port]\n" 171 :: [val] "a" (val), 172 [port] "d" (port) 173 ); 188 174 } 189 175 … … 198 184 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val) 199 185 { 200 if (((void *)port) < IO_SPACE_BOUNDARY) { 201 asm volatile ( 202 "outl %[val], %w[port]\n" 203 :: [val] "a" (val), [port] "d" (port) 204 ); 205 } else { 206 *((uint32_t *) port) = val; 207 } 186 asm volatile ( 187 "outl %[val], %w[port]\n" 188 :: [val] "a" (val), 189 [port] "d" (port) 190 ); 208 191 } 209 192
Note:
See TracChangeset
for help on using the changeset viewer.