Changeset d5610b9 in mainline
- Timestamp:
- 2015-10-03T08:37:37Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- afe5e09
- Parents:
- 8ca6f08
- Location:
- kernel/arch/arm32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/include/arch/barrier.h
r8ca6f08 rd5610b9 38 38 39 39 #ifdef KERNEL 40 #include <arch/cache.h> 40 41 #include <arch/cp15.h> 41 42 #else … … 71 72 * CP15 implementation is mandatory only for armv6+. 72 73 */ 74 #if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a) 73 75 #define memory_barrier() CP15DMB_write(0) 74 #define read_barrier() CP15DSB_write(0) 76 #else 77 #define memory_barrier() CP15DSB_write(0) 78 #endif 79 #define read_barrier() CP15DSB_write(0) 75 80 #define write_barrier() read_barrier() 81 #if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a) 76 82 #define inst_barrier() CP15ISB_write(0) 83 #else 84 #define inst_barrier() 85 #endif 77 86 #else 78 87 /* Older manuals mention syscalls as a way to implement cache coherency and … … 103 112 104 113 #if defined PROCESSOR_ARCH_armv7_a | defined PROCESSOR_ARCH_armv6 | defined KERNEL 105 /* Available on all supported arms,106 * invalidates entire ICache so the written value does not matter. */107 114 //TODO might be PL1 only on armv5- 108 115 #define smc_coherence(a) \ 109 116 do { \ 110 DCCMVAU_write((uint32_t)(a)); /* Flush changed memory */\117 dcache_clean_mva_pou((uintptr_t) a);\ 111 118 write_barrier(); /* Wait for completion */\ 112 ICIALLU_write(0); /* Flush ICache */\119 icache_invalidate();\ 113 120 inst_barrier(); /* Wait for Inst refetch */\ 114 121 } while (0) -
kernel/arch/arm32/include/arch/cache.h
r8ca6f08 rd5610b9 37 37 #define KERN_arm32_CACHE_H_ 38 38 39 #include <typedefs.h> 40 39 41 unsigned dcache_levels(void); 40 42 … … 43 45 void cpu_dcache_flush(void); 44 46 void cpu_dcache_flush_invalidate(void); 45 void icache_invalidate(void); 47 extern void icache_invalidate(void); 48 extern void dcache_clean_mva_pou(uintptr_t); 46 49 47 50 #endif -
kernel/arch/arm32/include/arch/cp15.h
r8ca6f08 rd5610b9 391 391 CONTROL_REG_GEN_WRITE(HPFAR, c6, 4, c0, 4); 392 392 393 /* Cache maintenance, address translation and other */ 394 CONTROL_REG_GEN_WRITE(WFI, c7, 0, c0, 4); /* armv6 only */ 395 CONTROL_REG_GEN_WRITE(ICIALLLUIS, c7, 0, c1, 0); 396 CONTROL_REG_GEN_WRITE(BPIALLIS, c7, 0, c1, 6); 397 CONTROL_REG_GEN_READ(PAR, c7, 0, c4, 0); 398 CONTROL_REG_GEN_WRITE(PAR, c7, 0, c4, 0); 399 CONTROL_REG_GEN_READ(PARH, c7, 0, c7, 0); /* PAE */ 400 CONTROL_REG_GEN_WRITE(PARH, c7, 0, c7, 0); /* PAE */ 401 CONTROL_REG_GEN_WRITE(ICIALLU, c7, 0, c5, 0); 402 CONTROL_REG_GEN_WRITE(ICIMVAU, c7, 0, c5, 1); 393 /* 394 * Cache maintenance, address translation and other 395 */ 396 397 #if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a) 403 398 CONTROL_REG_GEN_WRITE(CP15ISB, c7, 0, c5, 4); 404 399 CONTROL_REG_GEN_WRITE(BPIALL, c7, 0, c5, 6); 405 400 CONTROL_REG_GEN_WRITE(BPIMVA, c7, 0, c5, 7); 406 401 #endif 402 403 #if !defined(PROCESSOR_arm920t) 404 CONTROL_REG_GEN_WRITE(DCISW, c7, 0, c6, 2); 405 #endif 406 407 #if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4) 408 CONTROL_REG_GEN_WRITE(DCCSW, c7, 0, c10, 2); 409 #endif 410 411 CONTROL_REG_GEN_WRITE(CP15DSB, c7, 0, c10, 4); 412 413 #if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a) 414 CONTROL_REG_GEN_WRITE(CP15DMB, c7, 0, c10, 5); 415 #endif 416 417 #if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4) 418 CONTROL_REG_GEN_WRITE(DCCISW, c7, 0, c14, 2); 419 #endif 420 421 #if defined(PROCESSOR_ARCH_armv7_a) 422 CONTROL_REG_GEN_WRITE(ICIALLLUIS, c7, 0, c1, 0); 423 CONTROL_REG_GEN_WRITE(BPIALLIS, c7, 0, c1, 6); 424 CONTROL_REG_GEN_READ(PAR, c7, 0, c4, 0); /* Security Extensions */ 425 CONTROL_REG_GEN_WRITE(PAR, c7, 0, c4, 0); /* Security Extensions */ 426 CONTROL_REG_GEN_WRITE(ICIALLU, c7, 0, c5, 0); 427 CONTROL_REG_GEN_WRITE(ICIMVAU, c7, 0, c5, 1); 407 428 CONTROL_REG_GEN_WRITE(DCIMVAC, c7, 0, c6, 1); 408 CONTROL_REG_GEN_ WRITE(DCISW, c7, 0, c6, 2);409 410 CONTROL_REG_GEN_WRITE(ATS1CPR, c7, 0, c8, 0); 411 CONTROL_REG_GEN_WRITE(ATS1CPW, c7, 0, c8, 1); 412 CONTROL_REG_GEN_WRITE(ATS1CUR, c7, 0, c8, 2); 413 CONTROL_REG_GEN_WRITE(ATS1CUW, c7, 0, c8, 3); 414 CONTROL_REG_GEN_WRITE(ATS12NSOPR, c7, 0, c8, 4); 415 CONTROL_REG_GEN_WRITE(ATS12NSOPW, c7, 0, c8, 5); 416 CONTROL_REG_GEN_WRITE(ATS12NSOUR, c7, 0, c8, 6); 417 CONTROL_REG_GEN_WRITE(ATS12NSOUW, c7, 0, c8, 7); 418 419 429 CONTROL_REG_GEN_READ(PARH, c7, 0, c7, 0); /* PAE */ 430 CONTROL_REG_GEN_WRITE(PARH, c7, 0, c7, 0); /* PAE */ 431 CONTROL_REG_GEN_WRITE(ATS1CPR, c7, 0, c8, 0); /* Security Extensions */ 432 CONTROL_REG_GEN_WRITE(ATS1CPW, c7, 0, c8, 1); /* Security Extensions */ 433 CONTROL_REG_GEN_WRITE(ATS1CUR, c7, 0, c8, 2); /* Security Extensions */ 434 CONTROL_REG_GEN_WRITE(ATS1CUW, c7, 0, c8, 3); /* Security Extensions */ 435 CONTROL_REG_GEN_WRITE(ATS12NSOPR, c7, 0, c8, 4); /* Security Extensions */ 436 CONTROL_REG_GEN_WRITE(ATS12NSOPW, c7, 0, c8, 5); /* Security Extensions */ 437 CONTROL_REG_GEN_WRITE(ATS12NSOUR, c7, 0, c8, 6); /* Security Extensions */ 438 CONTROL_REG_GEN_WRITE(ATS12NSOUW, c7, 0, c8, 7); /* Security Extensions */ 439 CONTROL_REG_GEN_WRITE(ATS1HR, c7, 4, c8, 0); /* Virtualization Extensions */ 440 CONTROL_REG_GEN_WRITE(ATS1HW, c7, 4, c8, 1); /* Virtualization Extensions */ 420 441 CONTROL_REG_GEN_WRITE(DCCMVAC, c7, 0, c10, 1); 421 CONTROL_REG_GEN_WRITE(DCCSW, c7, 0, c10, 2);422 CONTROL_REG_GEN_WRITE(CP15DSB, c7, 0, c10, 4);423 CONTROL_REG_GEN_WRITE(CP15DMB, c7, 0, c10, 5);424 442 CONTROL_REG_GEN_WRITE(DCCMVAU, c7, 0, c11, 1); 425 426 CONTROL_REG_GEN_WRITE(PFI, c7, 0, c13, 1); /* armv6 only */427 428 443 CONTROL_REG_GEN_WRITE(DCCIMVAC, c7, 0, c14, 1); 429 CONTROL_REG_GEN_WRITE(DCCISW, c7, 0, c14, 2); 430 431 CONTROL_REG_GEN_WRITE(ATS1HR, c7, 4, c8, 0); 432 CONTROL_REG_GEN_WRITE(ATS1HW, c7, 4, c8, 1); 444 #else 445 446 #if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4) 447 CONTROL_REG_GEN_WRITE(WFI, c7, 0, c0, 4); 448 #endif 449 450 CONTROL_REG_GEN_WRITE(ICIALL, c7, 0, c5, 0); 451 CONTROL_REG_GEN_WRITE(ICIMVA, c7, 0, c5, 1); 452 453 #if !defined(PROCESSOR_ARCH_armv4) 454 CONTROL_REG_GEN_WRITE(ICISW, c7, 0, c5, 2); 455 #endif 456 457 CONTROL_REG_GEN_WRITE(DCIALL, c7, 0, c6, 0); 458 CONTROL_REG_GEN_WRITE(DCIMVA, c7, 0, c6, 1); 459 CONTROL_REG_GEN_WRITE(CIALL, c7, 0, c7, 0); 460 CONTROL_REG_GEN_WRITE(CIMVA, c7, 0, c7, 1); 461 462 #if !defined(PROCESSOR_ARCH_armv4) 463 CONTROL_REG_GEN_WRITE(CISW, c7, 0, c7, 2); 464 #endif 465 466 #if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6) 467 CONTROL_REG_GEN_WRITE(DCCALL, c7, 0, c10, 0); 468 #endif 469 470 CONTROL_REG_GEN_WRITE(DCCMVA, c7, 0, c10, 1); 471 472 #if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6) 473 CONTROL_REG_GEN_WRITE(CCALL, c7, 0, c11, 0); 474 #endif 475 476 CONTROL_REG_GEN_WRITE(CCMVA, c7, 0, c11, 1); 477 478 #if !defined(PROCESSOR_ARCH_armv4) 479 CONTROL_REG_GEN_WRITE(CCSW, c7, 0, c11, 2); 480 #endif 481 482 #if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4) 483 CONTROL_REG_GEN_WRITE(PFIMVA, c7, 0, c13, 1); 484 #endif 485 486 #if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6) 487 CONTROL_REG_GEN_WRITE(DCCIALL, c7, 0, c14, 0); 488 #endif 489 490 CONTROL_REG_GEN_WRITE(DCCIMVA, c7, 0, c14, 1); 491 492 #if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6) 493 CONTROL_REG_GEN_WRITE(CCIALL, c7, 0, c15, 0); 494 #endif 495 496 CONTROL_REG_GEN_WRITE(CCIMVA, c7, 0, c15, 1); 497 498 #if defined(PROCESSOR_ARCH_armv5) || defined(PROCESSOR_ARCH_armv6) 499 CONTROL_REG_GEN_WRITE(CCISW, c7, 0, c15, 2); 500 #endif 501 502 #endif 433 503 434 504 /* TLB maintenance */ -
kernel/arch/arm32/include/arch/mm/page_armv4.h
r8ca6f08 rd5610b9 123 123 do { \ 124 124 for (unsigned i = 0; i < count; ++i) \ 125 DCCMVAU_write((uintptr_t)(pt + i)); \125 dcache_clean_mva_pou((uintptr_t)(pt + i)); \ 126 126 read_barrier(); \ 127 127 } while (0) -
kernel/arch/arm32/include/arch/mm/page_armv6.h
r8ca6f08 rd5610b9 156 156 do { \ 157 157 for (unsigned i = 0; i < count; ++i) \ 158 DCCMVAU_write((uintptr_t)(pt + i)); \158 dcache_clean_mva_pou((uintptr_t)(pt + i)); \ 159 159 read_barrier(); \ 160 160 } while (0) 161 162 161 163 162 /** Returns level 0 page table entry flags. -
kernel/arch/arm32/src/cpu/cpu.c
r8ca6f08 rd5610b9 322 322 void icache_invalidate(void) 323 323 { 324 #if defined(PROCESSOR_ARCH_armv7_a) 324 325 ICIALLU_write(0); 326 #else 327 ICIALL_write(0); 328 #endif 329 } 330 331 #if !defined(PROCESSOR_ARCH_armv7_a) 332 static bool cache_is_unified(void) 333 { 334 if (MIDR_read() != CTR_read()) { 335 /* We have the CTR register */ 336 return (CTR_read() & CTR_SEP_FLAG) != CTR_SEP_FLAG; 337 } else { 338 panic("Unknown cache type"); 339 } 340 } 341 #endif 342 343 void dcache_clean_mva_pou(uintptr_t mva) 344 { 345 #if defined(PROCESSOR_ARCH_armv7_a) 346 DCCMVAU_write(mva); 347 #else 348 if (cache_is_unified()) 349 CCMVA_write(mva); 350 else 351 DCCMVA_write(mva); 352 #endif 325 353 } 326 354
Note:
See TracChangeset
for help on using the changeset viewer.