void ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) { bus_space_tag_t tag = BUSTAG(ah); bus_space_handle_t h = ah->ah_sh; /* Debug - complain if we haven't fully waken things up */ if (! ath_hal_reg_whilst_asleep(ah, reg) && ah->ah_powerMode != HAL_PM_AWAKE) { ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n", __func__, reg, val, ah->ah_powerMode); } if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->threadid = curthread->td_tid; r->op = OP_WRITE; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } } if (ah->ah_config.ah_serialise_reg_war) spin_lock(&ah_regser_spin); bus_space_write_4(tag, h, reg, val); if (ah->ah_config.ah_serialise_reg_war) spin_unlock(&ah_regser_spin); }
u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) { bus_space_tag_t tag = BUSTAG(ah); bus_space_handle_t h = ah->ah_sh; u_int32_t val; #ifdef AH_DEBUG /* Debug - complain if we haven't fully waken things up */ if (! ath_hal_reg_whilst_asleep(ah, reg) && ah->ah_powerMode != HAL_PM_AWAKE) { ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n", __func__, reg, ah->ah_powerMode); } #endif if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_READ); val = bus_space_read_4(tag, h, reg); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->threadid = curthread->td_tid; r->op = OP_READ; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } } return val; }
u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) { bus_space_tag_t tag = BUSTAG(ah); bus_space_handle_t h = ah->ah_sh; u_int32_t val; if (ah->ah_config.ah_serialise_reg_war) spin_lock(&ah_regser_spin); val = bus_space_read_4(tag, h, reg); if (ah->ah_config.ah_serialise_reg_war) spin_unlock(&ah_regser_spin); if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->threadid = curthread->td_tid; r->op = OP_READ; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } } return val; }
u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) { bus_space_tag_t tag = BUSTAG(ah); bus_space_handle_t h = ah->ah_sh; u_int32_t val; #if _BYTE_ORDER == _BIG_ENDIAN if (OS_REG_UNSWAPPED(reg)) val = bus_space_read_4(tag, h, reg); else #endif val = bus_space_read_stream_4(tag, h, reg); if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->op = OP_READ; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } } return val; }
/* * Copy a new entry into the queue. If the operation would block either * wait or return an error depending on the value of waitok. */ int alq_write(struct alq *alq, void *data, int waitok) { struct ale *ale; if ((ale = alq_get(alq, waitok)) == NULL) return (EWOULDBLOCK); bcopy(data, ale->ae_data, alq->aq_entlen); alq_post(alq, ale); return (0); }
void OS_MARK(struct ath_hal *ah, u_int id, u_int32_t v) { if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->op = OP_MARK; r->reg = id; r->val = v; alq_post(ath_hal_alq, ale); } } }
/* * Copy a new entry into the queue. If the operation would block either * wait or return an error depending on the value of waitok. */ int alq_write(struct alq *alq, void *data, int waitok) { unsigned long flags; struct ale *ale; local_irq_save(flags); if ((ale = alq_get(alq, waitok)) == NULL) { local_irq_restore(flags); return EWOULDBLOCK; } memcpy(ale->ae_data, data, alq->aq_entlen); alq_post(alq, ale); local_irq_restore(flags); return 0; }
static inline void ath_hal_logvprintf(struct ath_hal *ah, const char *fmt, va_list ap) { struct ale *ale; if (!ath_hal_alq) { ath_hal_alq_lost++; return; } ale = alq_get(ath_hal_alq, ALQ_NOWAIT); if (!ale) { ath_hal_alq_lost++; return; } memset(ale->ae_data, 0, MSG_MAXLEN); vsnprintf(ale->ae_data, MSG_MAXLEN, fmt, ap); alq_post(ath_hal_alq, ale); }
void __ahdecl OS_MARK(struct ath_hal *ah, u_int id, u_int32_t v) { if (ath_hal_alq) { unsigned long flags; struct ale *ale; local_irq_save(flags); ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->op = OP_MARK; r->reg = id; r->val = v; alq_post(ath_hal_alq, ale); } local_irq_restore(flags); } }
void __ahdecl ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) { if (ath_hal_alq) { unsigned long flags; struct ale *ale; local_irq_save(flags); ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->op = OP_WRITE; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } local_irq_restore(flags); } _OS_REG_WRITE(ah, reg, val); }
int ieee80211_alq_log(struct ieee80211com *ic, struct ieee80211vap *vap, uint32_t op, uint32_t flags, uint16_t srcid, const uint8_t *src, size_t len) { struct ale *ale; struct ieee80211_alq_rec *r; char *dst; /* Don't log if we're disabled */ if (ieee80211_alq == NULL) return (0); if (len > IEEE80211_ALQ_MAX_PAYLOAD) return (ENOMEM); ale = ieee80211_alq_get(len); if (! ale) return (ENOMEM); r = (struct ieee80211_alq_rec *) ale->ae_data; dst = ((char *) r) + sizeof(struct ieee80211_alq_rec); r->r_timestamp = htobe64(ticks); if (vap != NULL) { r->r_wlan = htobe16(vap->iv_ifp->if_dunit); } else { r->r_wlan = 0xffff; } r->r_src = htobe16(srcid); r->r_flags = htobe32(flags); r->r_op = htobe32(op); r->r_len = htobe32(len + sizeof(struct ieee80211_alq_rec)); r->r_threadid = htobe32((uint32_t) curthread->td_tid); if (src != NULL) memcpy(dst, src, len); alq_post(ieee80211_alq, ale); return (0); }
void ieee80211_alq_log(struct ieee80211vap *vap, uint8_t op, u_char *p, int l) { struct ale *ale; struct ieee80211_alq_rec *r; if (ieee80211_alq == NULL) return; ale = ieee80211_alq_get(); if (! ale) return; r = (struct ieee80211_alq_rec *) ale->ae_data; r->r_timestamp = htonl(ticks); r->r_version = 1; r->r_wlan = htons(vap->iv_ifp->if_dunit); r->r_op = op; memcpy(&r->r_payload, p, MIN(l, sizeof(r->r_payload))); alq_post(ieee80211_alq, ale); }
static struct ale * ath_hal_alq_get(struct ath_hal *ah) { struct ale *ale; if (ath_hal_alq_emitdev) { ale = alq_get(ath_hal_alq, ALQ_NOWAIT); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->op = OP_DEVICE; r->reg = 0; r->val = ah->ah_devid; alq_post(ath_hal_alq, ale); ath_hal_alq_emitdev = 0; } else ath_hal_alq_lost++; } ale = alq_get(ath_hal_alq, ALQ_NOWAIT); if (!ale) ath_hal_alq_lost++; return ale; }
void ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) { bus_space_tag_t tag = BUSTAG(ah); bus_space_handle_t h = ah->ah_sh; if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->threadid = curthread->td_tid; r->op = OP_WRITE; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } } if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); bus_space_write_4(tag, h, reg, val); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); }
u_int32_t __ahdecl ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) { u_int32_t val; val = _OS_REG_READ(ah, reg); if (ath_hal_alq) { unsigned long flags; struct ale *ale; local_irq_save(flags); ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->op = OP_READ; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } local_irq_restore(flags); } return val; }
void ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) { bus_space_tag_t tag = BUSTAG(ah); bus_space_handle_t h = ah->ah_sh; if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); if (ale) { struct athregrec *r = (struct athregrec *) ale->ae_data; r->op = OP_WRITE; r->reg = reg; r->val = val; alq_post(ath_hal_alq, ale); } } #if _BYTE_ORDER == _BIG_ENDIAN if (OS_REG_UNSWAPPED(reg)) bus_space_write_4(tag, h, reg, val); else #endif bus_space_write_stream_4(tag, h, reg, val); }
void ktr_tracepoint(u_int mask, const char *file, int line, const char *format, u_long arg1, u_long arg2, u_long arg3, u_long arg4, u_long arg5, u_long arg6) { struct ktr_entry *entry; #ifdef KTR_ALQ struct ale *ale = NULL; #endif int newindex, saveindex; #if defined(KTR_VERBOSE) || defined(KTR_ALQ) struct thread *td; #endif int cpu; if (panicstr) return; if ((ktr_mask & mask) == 0) return; cpu = KTR_CPU; if (((1 << cpu) & ktr_cpumask) == 0) return; #if defined(KTR_VERBOSE) || defined(KTR_ALQ) td = curthread; if (td->td_pflags & TDP_INKTR) return; td->td_pflags |= TDP_INKTR; #endif #ifdef KTR_ALQ if (ktr_alq_enabled) { if (td->td_critnest == 0 && (td->td_flags & TDF_IDLETD) == 0 && td != ald_thread) { if (ktr_alq_max && ktr_alq_cnt > ktr_alq_max) goto done; if ((ale = alq_get(ktr_alq, ALQ_NOWAIT)) == NULL) { ktr_alq_failed++; goto done; } ktr_alq_cnt++; entry = (struct ktr_entry *)ale->ae_data; } else { goto done; } } else #endif { do { saveindex = ktr_idx; newindex = (saveindex + 1) & (KTR_ENTRIES - 1); } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); entry = &ktr_buf[saveindex]; } entry->ktr_timestamp = KTR_TIME; entry->ktr_cpu = cpu; entry->ktr_thread = curthread; if (file != NULL) while (strncmp(file, "../", 3) == 0) file += 3; entry->ktr_file = file; entry->ktr_line = line; #ifdef KTR_VERBOSE if (ktr_verbose) { #ifdef SMP printf("cpu%d ", cpu); #endif if (ktr_verbose > 1) { printf("%s.%d\t", entry->ktr_file, entry->ktr_line); } printf(format, arg1, arg2, arg3, arg4, arg5, arg6); printf("\n"); } #endif entry->ktr_desc = format; entry->ktr_parms[0] = arg1; entry->ktr_parms[1] = arg2; entry->ktr_parms[2] = arg3; entry->ktr_parms[3] = arg4; entry->ktr_parms[4] = arg5; entry->ktr_parms[5] = arg6; #ifdef KTR_ALQ if (ktr_alq_enabled && ale) alq_post(ktr_alq, ale); done: #endif #if defined(KTR_VERBOSE) || defined(KTR_ALQ) td->td_pflags &= ~TDP_INKTR; #endif }