Changes in kernel/arch/sparc64/include/asm.h [2ee907e:7a0359b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/include/asm.h
r2ee907e r7a0359b 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 46 static inline void pio_write_8(ioport8_t *port, uint8_t v) 45 #include <trace.h> 46 47 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v) 47 48 { 48 49 *port = v; … … 50 51 } 51 52 52 static inline void pio_write_16(ioport16_t *port, uint16_t v)53 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v) 53 54 { 54 55 *port = v; … … 56 57 } 57 58 58 static inline void pio_write_32(ioport32_t *port, uint32_t v)59 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v) 59 60 { 60 61 *port = v; … … 62 63 } 63 64 64 static inline uint8_t pio_read_8(ioport8_t *port) 65 { 66 uint8_t rv; 67 68 rv = *port; 65 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 66 { 67 uint8_t rv = *port; 69 68 memory_barrier(); 70 71 69 return rv; 72 70 } 73 71 74 static inline uint16_t pio_read_16(ioport16_t *port) 75 { 76 uint16_t rv; 77 78 rv = *port; 72 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 73 { 74 uint16_t rv = *port; 79 75 memory_barrier(); 80 81 76 return rv; 82 77 } 83 78 84 static inline uint32_t pio_read_32(ioport32_t *port) 85 { 86 uint32_t rv; 87 88 rv = *port; 79 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 80 { 81 uint32_t rv = *port; 89 82 memory_barrier(); 90 91 83 return rv; 92 84 } … … 95 87 * 96 88 * @return Value of PSTATE register. 97 */ 98 static inline uint64_t pstate_read(void) 99 { 100 uint64_t v; 101 102 asm volatile ("rdpr %%pstate, %0\n" : "=r" (v)); 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 ); 103 99 104 100 return v; … … 108 104 * 109 105 * @param v New value of PSTATE register. 110 */ 111 static inline void pstate_write(uint64_t v) 112 { 113 asm volatile ("wrpr %0, %1, %%pstate\n" : : "r" (v), "i" (0)); 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 ); 114 115 } 115 116 … … 117 118 * 118 119 * @return Value of TICK_comapre register. 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)); 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 ); 125 130 126 131 return v; … … 130 135 * 131 136 * @param v New value of TICK_comapre register. 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)); 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 ); 136 146 } 137 147 … … 139 149 * 140 150 * @return Value of STICK_compare register. 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)); 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 ); 147 161 148 162 return v; … … 152 166 * 153 167 * @param v New value of STICK_comapre register. 154 */ 155 static inline void stick_compare_write(uint64_t v) 156 { 157 asm volatile ("wr %0, %1, %%asr25\n" : : "r" (v), "i" (0)); 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 ); 158 177 } 159 178 … … 161 180 * 162 181 * @return Value of TICK register. 163 */ 164 static inline uint64_t tick_read(void) 165 { 166 uint64_t v; 167 168 asm volatile ("rdpr %%tick, %0\n" : "=r" (v)); 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 ); 169 192 170 193 return v; … … 174 197 * 175 198 * @param v New value of TICK register. 176 */ 177 static inline void tick_write(uint64_t v) 178 { 179 asm volatile ("wrpr %0, %1, %%tick\n" : : "r" (v), "i" (0)); 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 ); 180 208 } 181 209 … … 183 211 * 184 212 * @return Value of FPRS register. 185 */ 186 static inline uint64_t fprs_read(void) 187 { 188 uint64_t v; 189 190 asm volatile ("rd %%fprs, %0\n" : "=r" (v)); 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 ); 191 223 192 224 return v; … … 196 228 * 197 229 * @param v New value of FPRS register. 198 */ 199 static inline void fprs_write(uint64_t v) 200 { 201 asm volatile ("wr %0, %1, %%fprs\n" : : "r" (v), "i" (0)); 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 ); 202 239 } 203 240 … … 205 242 * 206 243 * @return Value of SOFTINT register. 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 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 214 255 return v; 215 256 } … … 218 259 * 219 260 * @param v New value of SOFTINT register. 220 */ 221 static inline void softint_write(uint64_t v) 222 { 223 asm volatile ("wr %0, %1, %%softint\n" : : "r" (v), "i" (0)); 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 ); 224 270 } 225 271 … … 229 275 * 230 276 * @param v New value of CLEAR_SOFTINT register. 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)); 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 ); 235 286 } 236 287 … … 240 291 * 241 292 * @param v New value of SET_SOFTINT register. 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)); 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 ); 246 302 } 247 303 … … 252 308 * 253 309 * @return Old interrupt priority level. 254 */ 255 static inline ipl_t interrupts_enable(void) { 310 * 311 */ 312 NO_TRACE static inline ipl_t interrupts_enable(void) { 256 313 pstate_reg_t pstate; 257 uint64_t value; 258 259 value = pstate_read(); 314 uint64_t value = pstate_read(); 315 260 316 pstate.value = value; 261 317 pstate.ie = true; … … 271 327 * 272 328 * @return Old interrupt priority level. 273 */ 274 static inline ipl_t interrupts_disable(void) { 329 * 330 */ 331 NO_TRACE static inline ipl_t interrupts_disable(void) { 275 332 pstate_reg_t pstate; 276 uint64_t value; 277 278 value = pstate_read(); 333 uint64_t value = pstate_read(); 334 279 335 pstate.value = value; 280 336 pstate.ie = false; … … 289 345 * 290 346 * @param ipl Saved interrupt priority level. 291 */ 292 static inline void interrupts_restore(ipl_t ipl) { 347 * 348 */ 349 NO_TRACE static inline void interrupts_restore(ipl_t ipl) { 293 350 pstate_reg_t pstate; 294 351 … … 303 360 * 304 361 * @return Current interrupt priority level. 305 */ 306 static inline ipl_t interrupts_read(void) { 362 * 363 */ 364 NO_TRACE static inline ipl_t interrupts_read(void) { 307 365 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; 308 379 } 309 380 … … 313 384 * The stack is assumed to be STACK_SIZE bytes long. 314 385 * The stack must start on page boundary. 315 */ 316 static inline uintptr_t get_stack_base(void) 386 * 387 */ 388 NO_TRACE static inline uintptr_t get_stack_base(void) 317 389 { 318 390 uintptr_t unbiased_sp; 319 391 320 asm volatile ("add %%sp, %1, %0\n" : "=r" (unbiased_sp) : "i" (STACK_BIAS)); 392 asm volatile ( 393 "add %%sp, %[stack_bias], %[unbiased_sp]\n" 394 : [unbiased_sp] "=r" (unbiased_sp) 395 : [stack_bias] "i" (STACK_BIAS) 396 ); 321 397 322 398 return ALIGN_DOWN(unbiased_sp, STACK_SIZE); … … 326 402 * 327 403 * @return Value of VER register. 328 */ 329 static inline uint64_t ver_read(void) 330 { 331 uint64_t v; 332 333 asm volatile ("rdpr %%ver, %0\n" : "=r" (v)); 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 ); 334 414 335 415 return v; … … 339 419 * 340 420 * @return Current value in TPC. 341 */ 342 static inline uint64_t tpc_read(void) 343 { 344 uint64_t v; 345 346 asm volatile ("rdpr %%tpc, %0\n" : "=r" (v)); 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 ); 347 431 348 432 return v; … … 352 436 * 353 437 * @return Current value in TL. 354 */ 355 static inline uint64_t tl_read(void) 356 { 357 uint64_t v; 358 359 asm volatile ("rdpr %%tl, %0\n" : "=r" (v)); 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 ); 360 448 361 449 return v; … … 365 453 * 366 454 * @return Current value in TBA. 367 */ 368 static inline uint64_t tba_read(void) 369 { 370 uint64_t v; 371 372 asm volatile ("rdpr %%tba, %0\n" : "=r" (v)); 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 ); 373 465 374 466 return v; … … 378 470 * 379 471 * @param v New value of TBA. 380 */ 381 static inline void tba_write(uint64_t v) 382 { 383 asm volatile ("wrpr %0, %1, %%tba\n" : : "r" (v), "i" (0)); 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 ); 384 481 } 385 482 … … 387 484 * 388 485 * @param asi ASI determining the alternate space. 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)); 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 ); 398 502 399 503 return v; … … 403 507 * 404 508 * @param asi ASI determining the alternate space. 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"); 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 ); 411 522 } 412 523 413 524 /** Flush all valid register windows to memory. */ 414 static inline void flushw(void)525 NO_TRACE static inline void flushw(void) 415 526 { 416 527 asm volatile ("flushw\n"); … … 418 529 419 530 /** Switch to nucleus by setting TL to 1. */ 420 static inline void nucleus_enter(void)531 NO_TRACE static inline void nucleus_enter(void) 421 532 { 422 533 asm volatile ("wrpr %g0, 1, %tl\n"); … … 424 535 425 536 /** Switch from nucleus by setting TL to 0. */ 426 static inline void nucleus_leave(void)537 NO_TRACE static inline void nucleus_leave(void) 427 538 { 428 539 asm volatile ("wrpr %g0, %g0, %tl\n");
Note:
See TracChangeset
for help on using the changeset viewer.