Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3022 | Rev 4055 | ||
|---|---|---|---|
| Line 55... | Line 55... | ||
| 55 | #define read_barrier() \ |
55 | #define read_barrier() \ |
| 56 | asm volatile ("membar #LoadLoad\n" ::: "memory") |
56 | asm volatile ("membar #LoadLoad\n" ::: "memory") |
| 57 | #define write_barrier() \ |
57 | #define write_barrier() \ |
| 58 | asm volatile ("membar #StoreStore\n" ::: "memory") |
58 | asm volatile ("membar #StoreStore\n" ::: "memory") |
| 59 | 59 | ||
| - | 60 | #define flush(a) \ |
|
| - | 61 | asm volatile ("flush %0\n" :: "r" ((a)) : "memory") |
|
| - | 62 | ||
| 60 | /** Flush Instruction Memory instruction. */ |
63 | /** Flush Instruction pipeline. */ |
| 61 | static inline void flush(void) |
64 | static inline void flush_pipeline(void) |
| 62 | { |
65 | { |
| 63 | /* |
66 | /* |
| 64 | * The FLUSH instruction takes address parameter. |
67 | * The FLUSH instruction takes address parameter. |
| 65 | * As such, it may trap if the address is not found in DTLB. |
68 | * As such, it may trap if the address is not found in DTLB. |
| 66 | * |
69 | * |
| Line 77... | Line 80... | ||
| 77 | static inline void membar(void) |
80 | static inline void membar(void) |
| 78 | { |
81 | { |
| 79 | asm volatile ("membar #Sync\n"); |
82 | asm volatile ("membar #Sync\n"); |
| 80 | } |
83 | } |
| 81 | 84 | ||
| - | 85 | #if defined (US) |
|
| - | 86 | ||
| - | 87 | #define smc_coherence(a) \ |
|
| - | 88 | { \ |
|
| - | 89 | write_barrier(); \ |
|
| - | 90 | flush((a)); \ |
|
| - | 91 | } |
|
| - | 92 | ||
| - | 93 | #define FLUSH_INVAL_MIN 4 |
|
| - | 94 | #define smc_coherence_block(a, l) \ |
|
| - | 95 | { \ |
|
| - | 96 | unsigned long i; \ |
|
| - | 97 | write_barrier(); \ |
|
| - | 98 | for (i = 0; i < (l); i += FLUSH_INVAL_MIN) \ |
|
| - | 99 | flush((void *)(a) + i); \ |
|
| - | 100 | } |
|
| - | 101 | ||
| - | 102 | #elif defined (US3) |
|
| - | 103 | ||
| - | 104 | #define smc_coherence(a) \ |
|
| - | 105 | { \ |
|
| - | 106 | write_barrier(); \ |
|
| - | 107 | flush_pipeline(); \ |
|
| - | 108 | } |
|
| - | 109 | ||
| - | 110 | #define smc_coherence_block(a, l) \ |
|
| - | 111 | { \ |
|
| - | 112 | write_barrier(); \ |
|
| - | 113 | flush_pipeline(); \ |
|
| - | 114 | } |
|
| - | 115 | ||
| - | 116 | #endif /* defined(US3) */ |
|
| - | 117 | ||
| 82 | #endif |
118 | #endif |
| 83 | 119 | ||
| 84 | /** @} |
120 | /** @} |
| 85 | */ |
121 | */ |