-/* $OpenBSD: ar5211.c,v 1.49 2017/10/15 13:06:12 stsp Exp $ */
+/* $OpenBSD: ar5211.c,v 1.50 2018/01/31 11:27:03 stsp Exp $ */
/*
* Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
*/
hal->ah_op_mode = op_mode;
- switch (channel->c_channel_flags & CHANNEL_MODES) {
- case CHANNEL_A:
+ if ((channel->c_channel_flags & CHANNEL_A) == CHANNEL_A) {
mode = AR5K_INI_VAL_11A;
freq = AR5K_INI_RFGAIN_5GHZ;
ee_mode = AR5K_EEPROM_MODE_11A;
- break;
- case CHANNEL_B:
- mode = AR5K_INI_VAL_11B;
+ } else if ((channel->c_channel_flags & CHANNEL_B) == CHANNEL_B) {
+ if (hal->ah_capabilities.cap_mode & HAL_MODE_11B) {
+ mode = AR5K_INI_VAL_11B;
+ ee_mode = AR5K_EEPROM_MODE_11B;
+ } else {
+ mode = AR5K_INI_VAL_11G;
+ ee_mode = AR5K_EEPROM_MODE_11G;
+ }
freq = AR5K_INI_RFGAIN_2GHZ;
- ee_mode = AR5K_EEPROM_MODE_11B;
- break;
- case CHANNEL_G:
- case CHANNEL_PUREG:
+ } else if ((channel->c_channel_flags & (CHANNEL_G | CHANNEL_PUREG)) ==
+ (CHANNEL_G | CHANNEL_PUREG)) {
mode = AR5K_INI_VAL_11G;
freq = AR5K_INI_RFGAIN_2GHZ;
ee_mode = AR5K_EEPROM_MODE_11G;
- break;
- default:
+ } else {
AR5K_PRINTF("invalid channel: %d\n", channel->c_channel);
return (AH_FALSE);
}
-/* $OpenBSD: ar5212.c,v 1.57 2017/10/15 13:06:12 stsp Exp $ */
+/* $OpenBSD: ar5212.c,v 1.58 2018/01/31 11:27:03 stsp Exp $ */
/*
* Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
*/
hal->ah_op_mode = op_mode;
- switch (channel->c_channel_flags & CHANNEL_MODES) {
- case CHANNEL_A:
+ if ((channel->c_channel_flags & CHANNEL_A) == CHANNEL_A) {
mode = AR5K_INI_VAL_11A;
freq = AR5K_INI_RFGAIN_5GHZ;
ee_mode = AR5K_EEPROM_MODE_11A;
- break;
- case CHANNEL_B:
- mode = AR5K_INI_VAL_11B;
+ } else if ((channel->c_channel_flags & CHANNEL_B) == CHANNEL_B) {
+ if (hal->ah_capabilities.cap_mode & HAL_MODE_11B) {
+ mode = AR5K_INI_VAL_11B;
+ ee_mode = AR5K_EEPROM_MODE_11B;
+ } else {
+ mode = AR5K_INI_VAL_11B;
+ mode = AR5K_INI_VAL_11G;
+ ee_mode = AR5K_EEPROM_MODE_11G;
+ }
freq = AR5K_INI_RFGAIN_2GHZ;
- ee_mode = AR5K_EEPROM_MODE_11B;
- break;
- case CHANNEL_G:
- case CHANNEL_PUREG:
+ } else if ((channel->c_channel_flags & (CHANNEL_G | CHANNEL_PUREG)) ==
+ (CHANNEL_G | CHANNEL_PUREG)) {
mode = AR5K_INI_VAL_11G;
freq = AR5K_INI_RFGAIN_2GHZ;
ee_mode = AR5K_EEPROM_MODE_11G;
- break;
- case CHANNEL_XR:
+ } else if ((channel->c_channel_flags & CHANNEL_XR) == CHANNEL_XR) {
mode = AR5K_INI_VAL_XR;
freq = AR5K_INI_RFGAIN_5GHZ;
ee_mode = AR5K_EEPROM_MODE_11A;
- break;
- default:
+ } else {
AR5K_PRINTF("invalid channel: %d\n", channel->c_channel);
return (AH_FALSE);
}
-/* $OpenBSD: ar5xxx.c,v 1.62 2017/08/25 10:04:36 tb Exp $ */
+/* $OpenBSD: ar5xxx.c,v 1.63 2018/01/31 11:27:03 stsp Exp $ */
/*
* Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
(ar5k_2ghz_channels[i].rc_mode & IEEE80211_CHAN_CCK))
all_channels[c].c_channel_flags = CHANNEL_B;
- if ((hal->ah_capabilities.cap_mode & HAL_MODE_11G) &&
- (ar5k_2ghz_channels[i].rc_mode & IEEE80211_CHAN_OFDM)) {
- all_channels[c].c_channel_flags |=
- hal->ah_version == AR5K_AR5211 ?
- CHANNEL_PUREG : CHANNEL_G;
+ if (hal->ah_capabilities.cap_mode & HAL_MODE_11G) {
+ if (ar5k_2ghz_channels[i].rc_mode & IEEE80211_CHAN_CCK)
+ all_channels[c].c_channel_flags = CHANNEL_B;
+ if (ar5k_2ghz_channels[i].rc_mode & IEEE80211_CHAN_OFDM)
+ all_channels[c].c_channel_flags |= (CHANNEL_G | CHANNEL_PUREG);
}
/* Write channel and increment counter */
-/* $OpenBSD: ath.c,v 1.115 2017/05/31 09:17:39 stsp Exp $ */
+/* $OpenBSD: ath.c,v 1.116 2018/01/31 11:27:03 stsp Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
void ath_fatal_proc(void *, int);
void ath_rxorn_proc(void *, int);
void ath_bmiss_proc(void *, int);
-u_int ath_chan2flags(struct ieee80211com *, struct ieee80211_channel *);
int ath_initkeytable(struct ath_softc *);
void ath_mcastfilter_accum(caddr_t, u_int32_t (*)[2]);
void ath_mcastfilter_compute(struct ath_softc *, u_int32_t (*)[2]);
}
}
-u_int
-ath_chan2flags(struct ieee80211com *ic, struct ieee80211_channel *chan)
-{
- enum ieee80211_phymode mode = ieee80211_chan2mode(ic, chan);
-
- switch (mode) {
- case IEEE80211_MODE_AUTO:
- return 0;
- case IEEE80211_MODE_11A:
- return CHANNEL_A;
- case IEEE80211_MODE_11B:
- return CHANNEL_B;
- case IEEE80211_MODE_11G:
- return CHANNEL_G;
- default:
- panic("%s: unsupported mode %d", __func__, mode);
- return 0;
- }
-}
-
int
ath_init(struct ifnet *ifp)
{
* and then setup of the interrupt mask.
*/
hchan.channel = ic->ic_ibss_chan->ic_freq;
- hchan.channelFlags = ath_chan2flags(ic, ic->ic_ibss_chan);
+ hchan.channelFlags = ic->ic_ibss_chan->ic_flags;
if (!ath_hal_reset(ah, ic->ic_opmode, &hchan, AH_TRUE, &status)) {
printf("%s: unable to reset hardware; hal status %u\n",
ifp->if_xname, status);
HAL_CHANNEL hchan;
/*
- * Convert to a HAL channel description with the flags
- * constrained to reflect the current operating mode.
+ * Convert to a HAL channel description.
*/
c = ic->ic_ibss_chan;
hchan.channel = c->ic_freq;
- hchan.channelFlags = ath_chan2flags(ic, c);
+ hchan.channelFlags = c->ic_flags;
ath_hal_set_intr(ah, 0); /* disable interrupts */
ath_draintxq(sc); /* stop xmit side */
ath_draintxq(sc); /* clear pending tx frames */
ath_stoprecv(sc); /* turn off frame recv */
/*
- * Convert to a HAL channel description with
- * the flags constrained to reflect the current
- * operating mode.
+ * Convert to a HAL channel description.
*/
hchan.channel = chan->ic_freq;
- hchan.channelFlags = ath_chan2flags(ic, chan);
+ hchan.channelFlags = chan->ic_flags;
if (!ath_hal_reset(ah, ic->ic_opmode, &hchan, AH_TRUE,
&status)) {
printf("%s: ath_chan_set: unable to reset "
sc->sc_stats.ast_per_cal++;
/*
- * Convert to a HAL channel description with the flags
- * constrained to reflect the current operating mode.
+ * Convert to a HAL channel description.
*/
c = ic->ic_ibss_chan;
hchan.channel = c->ic_freq;
- hchan.channelFlags = ath_chan2flags(ic, c);
+ hchan.channelFlags = c->ic_flags;
s = splnet();
DPRINTF(ATH_DEBUG_CALIBRATE,