Changes in kernel/arch/sparc64/include/asm.h [7a0359b:2ee907e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/include/asm.h
r7a0359b r2ee907e 27 27 */ 28 28 29 /** @addtogroup sparc64 29 /** @addtogroup sparc64 30 30 * @{ 31 31 */ … … 43 43 #include <arch/stack.h> 44 44 #include <arch/barrier.h> 45 #include <trace.h> 46 47 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v) 45 46 static inline void pio_write_8(ioport8_t *port, uint8_t v) 48 47 { 49 48 *port = v; … … 51 50 } 52 51 53 NO_TRACEstatic inline void pio_write_16(ioport16_t *port, uint16_t v)52 static inline void pio_write_16(ioport16_t *port, uint16_t v) 54 53 { 55 54 *port = v; … … 57 56 } 58 57 59 NO_TRACEstatic inline void pio_write_32(ioport32_t *port, uint32_t v)58 static inline void pio_write_32(ioport32_t *port, uint32_t v) 60 59 { 61 60 *port = v; … … 63 62 } 64 63 65 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 66 { 67 uint8_t rv = *port; 68 memory_barrier(); 64 static inline uint8_t pio_read_8(ioport8_t *port) 65 { 66 uint8_t rv; 67 68 rv = *port; 69 memory_barrier(); 70 69 71 return rv; 70 72 } 71 73 72 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 73 { 74 uint16_t rv = *port; 75 memory_barrier(); 74 static inline uint16_t pio_read_16(ioport16_t *port) 75 { 76 uint16_t rv; 77 78 rv = *port; 79 memory_barrier(); 80 76 81 return rv; 77 82 } 78 83 79 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 80 { 81 uint32_t rv = *port; 82 memory_barrier(); 84 static inline uint32_t pio_read_32(ioport32_t *port) 85 { 86 uint32_t rv; 87 88 rv = *port; 89 memory_barrier(); 90 83 91 return rv; 84 92 } … … 87 95 * 88 96 * @return Value of PSTATE register. 89 * 90 */ 91 NO_TRACE static inline uint64_t pstate_read(void) 92 { 93 uint64_t v; 94 95 asm volatile ( 96 "rdpr %%pstate, %[v]\n" 97 : [v] "=r" (v) 98 ); 97 */ 98 static inline uint64_t pstate_read(void) 99 { 100 uint64_t v; 101 102 asm volatile ("rdpr %%pstate, %0\n" : "=r" (v)); 99 103 100 104 return v; … … 104 108 * 105 109 * @param v New value of PSTATE register. 106 * 107 */ 108 NO_TRACE static inline void pstate_write(uint64_t v) 109 { 110 asm volatile ( 111 "wrpr %[v], %[zero], %%pstate\n" 112 :: [v] "r" (v), 113 [zero] "i" (0) 114 ); 110 */ 111 static inline void pstate_write(uint64_t v) 112 { 113 asm volatile ("wrpr %0, %1, %%pstate\n" : : "r" (v), "i" (0)); 115 114 } 116 115 … … 118 117 * 119 118 * @return Value of TICK_comapre register. 120 * 121 */ 122 NO_TRACE static inline uint64_t tick_compare_read(void) 123 { 124 uint64_t v; 125 126 asm volatile ( 127 "rd %%tick_cmpr, %[v]\n" 128 : [v] "=r" (v) 129 ); 119 */ 120 static inline uint64_t tick_compare_read(void) 121 { 122 uint64_t v; 123 124 asm volatile ("rd %%tick_cmpr, %0\n" : "=r" (v)); 130 125 131 126 return v; … … 135 130 * 136 131 * @param v New value of TICK_comapre register. 137 * 138 */ 139 NO_TRACE static inline void tick_compare_write(uint64_t v) 140 { 141 asm volatile ( 142 "wr %[v], %[zero], %%tick_cmpr\n" 143 :: [v] "r" (v), 144 [zero] "i" (0) 145 ); 132 */ 133 static inline void tick_compare_write(uint64_t v) 134 { 135 asm volatile ("wr %0, %1, %%tick_cmpr\n" : : "r" (v), "i" (0)); 146 136 } 147 137 … … 149 139 * 150 140 * @return Value of STICK_compare register. 151 * 152 */ 153 NO_TRACE static inline uint64_t stick_compare_read(void) 154 { 155 uint64_t v; 156 157 asm volatile ( 158 "rd %%asr25, %[v]\n" 159 : [v] "=r" (v) 160 ); 141 */ 142 static inline uint64_t stick_compare_read(void) 143 { 144 uint64_t v; 145 146 asm volatile ("rd %%asr25, %0\n" : "=r" (v)); 161 147 162 148 return v; … … 166 152 * 167 153 * @param v New value of STICK_comapre register. 168 * 169 */ 170 NO_TRACE static inline void stick_compare_write(uint64_t v) 171 { 172 asm volatile ( 173 "wr %[v], %[zero], %%asr25\n" 174 :: [v] "r" (v), 175 [zero] "i" (0) 176 ); 154 */ 155 static inline void stick_compare_write(uint64_t v) 156 { 157 asm volatile ("wr %0, %1, %%asr25\n" : : "r" (v), "i" (0)); 177 158 } 178 159 … … 180 161 * 181 162 * @return Value of TICK register. 182 * 183 */ 184 NO_TRACE static inline uint64_t tick_read(void) 185 { 186 uint64_t v; 187 188 asm volatile ( 189 "rdpr %%tick, %[v]\n" 190 : [v] "=r" (v) 191 ); 163 */ 164 static inline uint64_t tick_read(void) 165 { 166 uint64_t v; 167 168 asm volatile ("rdpr %%tick, %0\n" : "=r" (v)); 192 169 193 170 return v; … … 197 174 * 198 175 * @param v New value of TICK register. 199 * 200 */ 201 NO_TRACE static inline void tick_write(uint64_t v) 202 { 203 asm volatile ( 204 "wrpr %[v], %[zero], %%tick\n" 205 :: [v] "r" (v), 206 [zero] "i" (0) 207 ); 176 */ 177 static inline void tick_write(uint64_t v) 178 { 179 asm volatile ("wrpr %0, %1, %%tick\n" : : "r" (v), "i" (0)); 208 180 } 209 181 … … 211 183 * 212 184 * @return Value of FPRS register. 213 * 214 */ 215 NO_TRACE static inline uint64_t fprs_read(void) 216 { 217 uint64_t v; 218 219 asm volatile ( 220 "rd %%fprs, %[v]\n" 221 : [v] "=r" (v) 222 ); 185 */ 186 static inline uint64_t fprs_read(void) 187 { 188 uint64_t v; 189 190 asm volatile ("rd %%fprs, %0\n" : "=r" (v)); 223 191 224 192 return v; … … 228 196 * 229 197 * @param v New value of FPRS register. 230 * 231 */ 232 NO_TRACE static inline void fprs_write(uint64_t v) 233 { 234 asm volatile ( 235 "wr %[v], %[zero], %%fprs\n" 236 :: [v] "r" (v), 237 [zero] "i" (0) 238 ); 198 */ 199 static inline void fprs_write(uint64_t v) 200 { 201 asm volatile ("wr %0, %1, %%fprs\n" : : "r" (v), "i" (0)); 239 202 } 240 203 … … 242 205 * 243 206 * @return Value of SOFTINT register. 244 * 245 */ 246 NO_TRACE static inline uint64_t softint_read(void) 247 { 248 uint64_t v; 249 250 asm volatile ( 251 "rd %%softint, %[v]\n" 252 : [v] "=r" (v) 253 ); 254 207 */ 208 static inline uint64_t softint_read(void) 209 { 210 uint64_t v; 211 212 asm volatile ("rd %%softint, %0\n" : "=r" (v)); 213 255 214 return v; 256 215 } … … 259 218 * 260 219 * @param v New value of SOFTINT register. 261 * 262 */ 263 NO_TRACE static inline void softint_write(uint64_t v) 264 { 265 asm volatile ( 266 "wr %[v], %[zero], %%softint\n" 267 :: [v] "r" (v), 268 [zero] "i" (0) 269 ); 220 */ 221 static inline void softint_write(uint64_t v) 222 { 223 asm volatile ("wr %0, %1, %%softint\n" : : "r" (v), "i" (0)); 270 224 } 271 225 … … 275 229 * 276 230 * @param v New value of CLEAR_SOFTINT register. 277 * 278 */ 279 NO_TRACE static inline void clear_softint_write(uint64_t v) 280 { 281 asm volatile ( 282 "wr %[v], %[zero], %%clear_softint\n" 283 :: [v] "r" (v), 284 [zero] "i" (0) 285 ); 231 */ 232 static inline void clear_softint_write(uint64_t v) 233 { 234 asm volatile ("wr %0, %1, %%clear_softint\n" : : "r" (v), "i" (0)); 286 235 } 287 236 … … 291 240 * 292 241 * @param v New value of SET_SOFTINT register. 293 * 294 */ 295 NO_TRACE static inline void set_softint_write(uint64_t v) 296 { 297 asm volatile ( 298 "wr %[v], %[zero], %%set_softint\n" 299 :: [v] "r" (v), 300 [zero] "i" (0) 301 ); 242 */ 243 static inline void set_softint_write(uint64_t v) 244 { 245 asm volatile ("wr %0, %1, %%set_softint\n" : : "r" (v), "i" (0)); 302 246 } 303 247 … … 308 252 * 309 253 * @return Old interrupt priority level. 310 * 311 */ 312 NO_TRACE static inline ipl_t interrupts_enable(void) { 254 */ 255 static inline ipl_t interrupts_enable(void) { 313 256 pstate_reg_t pstate; 314 uint64_t value = pstate_read(); 315 257 uint64_t value; 258 259 value = pstate_read(); 316 260 pstate.value = value; 317 261 pstate.ie = true; … … 327 271 * 328 272 * @return Old interrupt priority level. 329 * 330 */ 331 NO_TRACE static inline ipl_t interrupts_disable(void) { 273 */ 274 static inline ipl_t interrupts_disable(void) { 332 275 pstate_reg_t pstate; 333 uint64_t value = pstate_read(); 334 276 uint64_t value; 277 278 value = pstate_read(); 335 279 pstate.value = value; 336 280 pstate.ie = false; … … 345 289 * 346 290 * @param ipl Saved interrupt priority level. 347 * 348 */ 349 NO_TRACE static inline void interrupts_restore(ipl_t ipl) { 291 */ 292 static inline void interrupts_restore(ipl_t ipl) { 350 293 pstate_reg_t pstate; 351 294 … … 360 303 * 361 304 * @return Current interrupt priority level. 362 * 363 */ 364 NO_TRACE static inline ipl_t interrupts_read(void) { 305 */ 306 static inline ipl_t interrupts_read(void) { 365 307 return (ipl_t) pstate_read(); 366 }367 368 /** Check interrupts state.369 *370 * @return True if interrupts are disabled.371 *372 */373 NO_TRACE static inline bool interrupts_disabled(void)374 {375 pstate_reg_t pstate;376 377 pstate.value = pstate_read();378 return !pstate.ie;379 308 } 380 309 … … 384 313 * The stack is assumed to be STACK_SIZE bytes long. 385 314 * The stack must start on page boundary. 386 * 387 */ 388 NO_TRACE static inline uintptr_t get_stack_base(void) 315 */ 316 static inline uintptr_t get_stack_base(void) 389 317 { 390 318 uintptr_t unbiased_sp; 391 319 392 asm volatile ( 393 "add %%sp, %[stack_bias], %[unbiased_sp]\n" 394 : [unbiased_sp] "=r" (unbiased_sp) 395 : [stack_bias] "i" (STACK_BIAS) 396 ); 320 asm volatile ("add %%sp, %1, %0\n" : "=r" (unbiased_sp) : "i" (STACK_BIAS)); 397 321 398 322 return ALIGN_DOWN(unbiased_sp, STACK_SIZE); … … 402 326 * 403 327 * @return Value of VER register. 404 * 405 */ 406 NO_TRACE static inline uint64_t ver_read(void) 407 { 408 uint64_t v; 409 410 asm volatile ( 411 "rdpr %%ver, %[v]\n" 412 : [v] "=r" (v) 413 ); 328 */ 329 static inline uint64_t ver_read(void) 330 { 331 uint64_t v; 332 333 asm volatile ("rdpr %%ver, %0\n" : "=r" (v)); 414 334 415 335 return v; … … 419 339 * 420 340 * @return Current value in TPC. 421 * 422 */ 423 NO_TRACE static inline uint64_t tpc_read(void) 424 { 425 uint64_t v; 426 427 asm volatile ( 428 "rdpr %%tpc, %[v]\n" 429 : [v] "=r" (v) 430 ); 341 */ 342 static inline uint64_t tpc_read(void) 343 { 344 uint64_t v; 345 346 asm volatile ("rdpr %%tpc, %0\n" : "=r" (v)); 431 347 432 348 return v; … … 436 352 * 437 353 * @return Current value in TL. 438 * 439 */ 440 NO_TRACE static inline uint64_t tl_read(void) 441 { 442 uint64_t v; 443 444 asm volatile ( 445 "rdpr %%tl, %[v]\n" 446 : [v] "=r" (v) 447 ); 354 */ 355 static inline uint64_t tl_read(void) 356 { 357 uint64_t v; 358 359 asm volatile ("rdpr %%tl, %0\n" : "=r" (v)); 448 360 449 361 return v; … … 453 365 * 454 366 * @return Current value in TBA. 455 * 456 */ 457 NO_TRACE static inline uint64_t tba_read(void) 458 { 459 uint64_t v; 460 461 asm volatile ( 462 "rdpr %%tba, %[v]\n" 463 : [v] "=r" (v) 464 ); 367 */ 368 static inline uint64_t tba_read(void) 369 { 370 uint64_t v; 371 372 asm volatile ("rdpr %%tba, %0\n" : "=r" (v)); 465 373 466 374 return v; … … 470 378 * 471 379 * @param v New value of TBA. 472 * 473 */ 474 NO_TRACE static inline void tba_write(uint64_t v) 475 { 476 asm volatile ( 477 "wrpr %[v], %[zero], %%tba\n" 478 :: [v] "r" (v), 479 [zero] "i" (0) 480 ); 380 */ 381 static inline void tba_write(uint64_t v) 382 { 383 asm volatile ("wrpr %0, %1, %%tba\n" : : "r" (v), "i" (0)); 481 384 } 482 385 … … 484 387 * 485 388 * @param asi ASI determining the alternate space. 486 * @param va Virtual address within the ASI. 487 * 488 * @return Value read from the virtual address in 489 * the specified address space. 490 * 491 */ 492 NO_TRACE static inline uint64_t asi_u64_read(asi_t asi, uintptr_t va) 493 { 494 uint64_t v; 495 496 asm volatile ( 497 "ldxa [%[va]] %[asi], %[v]\n" 498 : [v] "=r" (v) 499 : [va] "r" (va), 500 [asi] "i" ((unsigned int) asi) 501 ); 389 * @param va Virtual address within the ASI. 390 * 391 * @return Value read from the virtual address in the specified address space. 392 */ 393 static inline uint64_t asi_u64_read(asi_t asi, uintptr_t va) 394 { 395 uint64_t v; 396 397 asm volatile ("ldxa [%1] %2, %0\n" : "=r" (v) : "r" (va), "i" ((unsigned) asi)); 502 398 503 399 return v; … … 507 403 * 508 404 * @param asi ASI determining the alternate space. 509 * @param va Virtual address within the ASI. 510 * @param v Value to be written. 511 * 512 */ 513 NO_TRACE static inline void asi_u64_write(asi_t asi, uintptr_t va, uint64_t v) 514 { 515 asm volatile ( 516 "stxa %[v], [%[va]] %[asi]\n" 517 :: [v] "r" (v), 518 [va] "r" (va), 519 [asi] "i" ((unsigned int) asi) 520 : "memory" 521 ); 405 * @param va Virtual address within the ASI. 406 * @param v Value to be written. 407 */ 408 static inline void asi_u64_write(asi_t asi, uintptr_t va, uint64_t v) 409 { 410 asm volatile ("stxa %0, [%1] %2\n" : : "r" (v), "r" (va), "i" ((unsigned) asi) : "memory"); 522 411 } 523 412 524 413 /** Flush all valid register windows to memory. */ 525 NO_TRACEstatic inline void flushw(void)414 static inline void flushw(void) 526 415 { 527 416 asm volatile ("flushw\n"); … … 529 418 530 419 /** Switch to nucleus by setting TL to 1. */ 531 NO_TRACEstatic inline void nucleus_enter(void)420 static inline void nucleus_enter(void) 532 421 { 533 422 asm volatile ("wrpr %g0, 1, %tl\n"); … … 535 424 536 425 /** Switch from nucleus by setting TL to 0. */ 537 NO_TRACEstatic inline void nucleus_leave(void)426 static inline void nucleus_leave(void) 538 427 { 539 428 asm volatile ("wrpr %g0, %g0, %tl\n");
Note:
See TracChangeset
for help on using the changeset viewer.