Changeset 26e7d6d in mainline for kernel/arch/amd64/include/asm.h
- Timestamp:
- 2011-09-19T16:31:00Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a347a11
- Parents:
- 3842a955 (diff), 086290d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/asm.h
r3842a955 r26e7d6d 41 41 #include <trace.h> 42 42 43 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 44 43 45 /** Return base address of current stack. 44 46 * … … 87 89 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 88 90 { 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; 91 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 92 uint8_t val; 93 94 asm volatile ( 95 "inb %w[port], %b[val]\n" 96 : [val] "=a" (val) 97 : [port] "d" (port) 98 ); 99 100 return val; 101 } else 102 return (uint8_t) *port; 98 103 } 99 104 … … 108 113 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 109 114 { 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; 115 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 116 uint16_t val; 117 118 asm volatile ( 119 "inw %w[port], %w[val]\n" 120 : [val] "=a" (val) 121 : [port] "d" (port) 122 ); 123 124 return val; 125 } else 126 return (uint16_t) *port; 119 127 } 120 128 … … 129 137 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 130 138 { 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; 139 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 140 uint32_t val; 141 142 asm volatile ( 143 "inl %w[port], %[val]\n" 144 : [val] "=a" (val) 145 : [port] "d" (port) 146 ); 147 148 return val; 149 } else 150 return (uint32_t) *port; 140 151 } 141 152 … … 150 161 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val) 151 162 { 152 asm volatile ( 153 "outb %b[val], %w[port]\n" 154 :: [val] "a" (val), 155 [port] "d" (port) 156 ); 163 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 164 asm volatile ( 165 "outb %b[val], %w[port]\n" 166 :: [val] "a" (val), [port] "d" (port) 167 ); 168 } else 169 *port = val; 157 170 } 158 171 … … 167 180 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val) 168 181 { 169 asm volatile ( 170 "outw %w[val], %w[port]\n" 171 :: [val] "a" (val), 172 [port] "d" (port) 173 ); 182 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 183 asm volatile ( 184 "outw %w[val], %w[port]\n" 185 :: [val] "a" (val), [port] "d" (port) 186 ); 187 } else 188 *port = val; 174 189 } 175 190 … … 184 199 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val) 185 200 { 186 asm volatile ( 187 "outl %[val], %w[port]\n" 188 :: [val] "a" (val), 189 [port] "d" (port) 190 ); 201 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 202 asm volatile ( 203 "outl %[val], %w[port]\n" 204 :: [val] "a" (val), [port] "d" (port) 205 ); 206 } else 207 *port = val; 191 208 } 192 209
Note:
See TracChangeset
for help on using the changeset viewer.