Changes in kernel/arch/sparc64/include/barrier.h [7a0359b:c8e99bb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/include/barrier.h
r7a0359b rc8e99bb 27 27 */ 28 28 29 /** @addtogroup sparc64 29 /** @addtogroup sparc64 30 30 * @{ 31 31 */ … … 36 36 #define KERN_sparc64_BARRIER_H_ 37 37 38 #include <trace.h>39 40 38 #ifdef KERNEL 41 42 39 #include <typedefs.h> 43 44 40 #else 45 46 41 #include <stdint.h> 47 48 42 #endif 49 43 … … 51 45 * Our critical section barriers are prepared for the weakest RMO memory model. 52 46 */ 53 #define CS_ENTER_BARRIER() \ 54 asm volatile ( \ 55 "membar #LoadLoad | #LoadStore\n" \ 56 ::: "memory" \ 47 #define CS_ENTER_BARRIER() \ 48 asm volatile ( \ 49 "membar #LoadLoad | #LoadStore\n" \ 50 ::: "memory" \ 51 ) 52 #define CS_LEAVE_BARRIER() \ 53 asm volatile ( \ 54 "membar #StoreStore\n" \ 55 "membar #LoadStore\n" \ 56 ::: "memory" \ 57 57 ) 58 58 59 #define CS_LEAVE_BARRIER()\60 asm volatile ( \61 "membar #StoreStore\n"\62 "membar #LoadStore\n" \63 ::: "memory"\64 )59 #define memory_barrier() \ 60 asm volatile ("membar #LoadLoad | #StoreStore\n" ::: "memory") 61 #define read_barrier() \ 62 asm volatile ("membar #LoadLoad\n" ::: "memory") 63 #define write_barrier() \ 64 asm volatile ("membar #StoreStore\n" ::: "memory") 65 65 66 #define memory_barrier() \ 67 asm volatile ( \ 68 "membar #LoadLoad | #StoreStore\n" \ 69 ::: "memory" \ 70 ) 71 72 #define read_barrier() \ 73 asm volatile ( \ 74 "membar #LoadLoad\n" \ 75 ::: "memory" \ 76 ) 77 78 #define write_barrier() \ 79 asm volatile ( \ 80 "membar #StoreStore\n" \ 81 ::: "memory" \ 82 ) 83 84 #define flush(a) \ 85 asm volatile ( \ 86 "flush %[reg]\n" \ 87 :: [reg] "r" ((a)) \ 88 : "memory" \ 89 ) 66 #define flush(a) \ 67 asm volatile ("flush %0\n" :: "r" ((a)) : "memory") 90 68 91 69 /** Flush Instruction pipeline. */ 92 NO_TRACEstatic inline void flush_pipeline(void)70 static inline void flush_pipeline(void) 93 71 { 94 72 uint64_t pc; 95 73 96 74 /* 97 75 * The FLUSH instruction takes address parameter. … … 102 80 * the %pc register will always be in the range mapped by 103 81 * DTLB. 104 *105 82 */ 106 107 108 "rd %%pc, % [pc]\n"109 "flush % [pc]\n"110 : [pc]"=&r" (pc)83 84 asm volatile ( 85 "rd %%pc, %0\n" 86 "flush %0\n" 87 : "=&r" (pc) 111 88 ); 112 89 } 113 90 114 91 /** Memory Barrier instruction. */ 115 NO_TRACEstatic inline void membar(void)92 static inline void membar(void) 116 93 { 117 asm volatile ( 118 "membar #Sync\n" 119 ); 94 asm volatile ("membar #Sync\n"); 120 95 } 121 96 122 97 #if defined (US) 123 98 124 #define FLUSH_INVAL_MIN 4 99 #define smc_coherence(a) \ 100 { \ 101 write_barrier(); \ 102 flush((a)); \ 103 } 125 104 126 #define smc_coherence(a) \ 127 do { \ 128 write_barrier(); \ 129 flush((a)); \ 130 } while (0) 131 132 #define smc_coherence_block(a, l) \ 133 do { \ 134 unsigned long i; \ 135 write_barrier(); \ 136 \ 137 for (i = 0; i < (l); i += FLUSH_INVAL_MIN) \ 138 flush((void *)(a) + i); \ 139 } while (0) 105 #define FLUSH_INVAL_MIN 4 106 #define smc_coherence_block(a, l) \ 107 { \ 108 unsigned long i; \ 109 write_barrier(); \ 110 for (i = 0; i < (l); i += FLUSH_INVAL_MIN) \ 111 flush((void *)(a) + i); \ 112 } 140 113 141 114 #elif defined (US3) 142 115 143 #define smc_coherence(a) 144 do {\145 write_barrier();\146 flush_pipeline();\147 } while (0) 116 #define smc_coherence(a) \ 117 { \ 118 write_barrier(); \ 119 flush_pipeline(); \ 120 } 148 121 149 #define smc_coherence_block(a, l) 150 do {\151 write_barrier();\152 flush_pipeline();\153 } while (0) 122 #define smc_coherence_block(a, l) \ 123 { \ 124 write_barrier(); \ 125 flush_pipeline(); \ 126 } 154 127 155 #endif 128 #endif /* defined(US3) */ 156 129 157 130 #endif
Note:
See TracChangeset
for help on using the changeset viewer.