Print this page
5042 stop using deprecated atomic functions


 171         mutex_init(lockp, NULL, MUTEX_DRIVER, NULL)
 172 #define xge_os_spin_lock_init_irq(lockp, irqh) \
 173         mutex_init(lockp, NULL, MUTEX_DRIVER, DDI_INTR_PRI(irqh))
 174 #define xge_os_spin_lock_destroy(lockp, cthx) \
 175         (cthx = cthx, mutex_destroy(lockp))
 176 #define xge_os_spin_lock_destroy_irq(lockp, cthx) \
 177         (cthx = cthx, mutex_destroy(lockp))
 178 #define xge_os_spin_lock(lockp)                 mutex_enter(lockp)
 179 #define xge_os_spin_unlock(lockp)               mutex_exit(lockp)
 180 #define xge_os_spin_lock_irq(lockp, flags) (flags = flags, mutex_enter(lockp))
 181 #define xge_os_spin_unlock_irq(lockp, flags)    mutex_exit(lockp)
 182 
 183 /* x86 arch will never re-order writes, Sparc can */
 184 #define xge_os_wmb()                            membar_producer()
 185 
 186 #define xge_os_udelay(us)                       drv_usecwait(us)
 187 #define xge_os_mdelay(ms)                       drv_usecwait(ms * 1000)
 188 
 189 #define xge_os_cmpxchg(targetp, cmp, newval)            \
 190         sizeof (*(targetp)) == 4 ?                      \
 191         cas32((uint32_t *)targetp, cmp, newval) :       \
 192         cas64((uint64_t *)targetp, cmp, newval)
 193 
 194 /* ------------------------- misc primitives ------------------------------- */
 195 
 196 #define xge_os_unlikely(x)              (x)
 197 #define xge_os_prefetch(a)              (a = a)
 198 #define xge_os_prefetchw
 199 #ifdef __GNUC__
 200 #define xge_os_bug(fmt...)              cmn_err(CE_PANIC, fmt)
 201 #else
 202 static inline void xge_os_bug(char *fmt, ...) {
 203         va_list ap;
 204 
 205         va_start(ap, fmt);
 206         vcmn_err(CE_PANIC, fmt, ap);
 207         va_end(ap);
 208 }
 209 #endif
 210 
 211 /* -------------------------- compiler stuffs ------------------------------ */
 212 




 171         mutex_init(lockp, NULL, MUTEX_DRIVER, NULL)
 172 #define xge_os_spin_lock_init_irq(lockp, irqh) \
 173         mutex_init(lockp, NULL, MUTEX_DRIVER, DDI_INTR_PRI(irqh))
 174 #define xge_os_spin_lock_destroy(lockp, cthx) \
 175         (cthx = cthx, mutex_destroy(lockp))
 176 #define xge_os_spin_lock_destroy_irq(lockp, cthx) \
 177         (cthx = cthx, mutex_destroy(lockp))
 178 #define xge_os_spin_lock(lockp)                 mutex_enter(lockp)
 179 #define xge_os_spin_unlock(lockp)               mutex_exit(lockp)
 180 #define xge_os_spin_lock_irq(lockp, flags) (flags = flags, mutex_enter(lockp))
 181 #define xge_os_spin_unlock_irq(lockp, flags)    mutex_exit(lockp)
 182 
 183 /* x86 arch will never re-order writes, Sparc can */
 184 #define xge_os_wmb()                            membar_producer()
 185 
 186 #define xge_os_udelay(us)                       drv_usecwait(us)
 187 #define xge_os_mdelay(ms)                       drv_usecwait(ms * 1000)
 188 
 189 #define xge_os_cmpxchg(targetp, cmp, newval)            \
 190         sizeof (*(targetp)) == 4 ?                      \
 191         atomic_cas_32((uint32_t *)targetp, cmp, newval) :       \
 192         atomic_cas_64((uint64_t *)targetp, cmp, newval)
 193 
 194 /* ------------------------- misc primitives ------------------------------- */
 195 
 196 #define xge_os_unlikely(x)              (x)
 197 #define xge_os_prefetch(a)              (a = a)
 198 #define xge_os_prefetchw
 199 #ifdef __GNUC__
 200 #define xge_os_bug(fmt...)              cmn_err(CE_PANIC, fmt)
 201 #else
 202 static inline void xge_os_bug(char *fmt, ...) {
 203         va_list ap;
 204 
 205         va_start(ap, fmt);
 206         vcmn_err(CE_PANIC, fmt, ap);
 207         va_end(ap);
 208 }
 209 #endif
 210 
 211 /* -------------------------- compiler stuffs ------------------------------ */
 212