summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2005-09-19 10:27:09 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2005-09-19 10:27:09 +0000
commit08c5ab5fa59b674aacdcb6239b96079cf9f6aeee (patch)
tree59e3a0770726a0b00291a421a1d8ba641eac0e14 /sys/dev
parent06a664f84143271471484589db0961e075a13f18 (diff)
don't attach unsupported radio chipsets
based on a diff by jsg@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/ar5210.c3
-rw-r--r--sys/dev/ic/ar5211.c10
-rw-r--r--sys/dev/ic/ar5212.c13
-rw-r--r--sys/dev/ic/ar5xxx.c4
-rw-r--r--sys/dev/ic/ar5xxx.h35
-rw-r--r--sys/dev/ic/ath.c55
6 files changed, 56 insertions, 64 deletions
diff --git a/sys/dev/ic/ar5210.c b/sys/dev/ic/ar5210.c
index bdb057b56b8..8e735f09404 100644
--- a/sys/dev/ic/ar5210.c
+++ b/sys/dev/ic/ar5210.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5210.c,v 1.29 2005/09/10 14:36:46 jsg Exp $ */
+/* $OpenBSD: ar5210.c,v 1.30 2005/09/19 10:27:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -190,6 +190,7 @@ ar5k_ar5210_attach(u_int16_t device, void *sc, bus_space_tag_t st,
/* Get MAC, PHY and RADIO revisions */
srev = AR5K_REG_READ(AR5K_AR5210_SREV);
+ hal->ah_mac_srev = srev;
hal->ah_mac_version = AR5K_REG_MS(srev, AR5K_AR5210_SREV_VER);
hal->ah_mac_revision = AR5K_REG_MS(srev, AR5K_AR5210_SREV_REV);
hal->ah_phy_revision = AR5K_REG_READ(AR5K_AR5210_PHY_CHIP_ID) &
diff --git a/sys/dev/ic/ar5211.c b/sys/dev/ic/ar5211.c
index e14969c9b94..b0cf4db7a91 100644
--- a/sys/dev/ic/ar5211.c
+++ b/sys/dev/ic/ar5211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5211.c,v 1.21 2005/09/10 14:36:46 jsg Exp $ */
+/* $OpenBSD: ar5211.c,v 1.22 2005/09/19 10:27:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -193,18 +193,14 @@ ar5k_ar5211_attach(u_int16_t device, void *sc, bus_space_tag_t st,
/* Get MAC, PHY and RADIO revisions */
srev = AR5K_REG_READ(AR5K_AR5211_SREV);
+ hal->ah_mac_srev = srev;
hal->ah_mac_version = AR5K_REG_MS(srev, AR5K_AR5211_SREV_VER);
hal->ah_mac_revision = AR5K_REG_MS(srev, AR5K_AR5211_SREV_REV);
hal->ah_phy_revision = AR5K_REG_READ(AR5K_AR5211_PHY_CHIP_ID) &
0x00ffffffff;
-
hal->ah_radio_5ghz_revision =
ar5k_ar5211_radio_revision(hal, HAL_CHIP_5GHZ);
-
- /* Get the 2GHz radio revision if it's supported */
- if (hal->ah_mac_version >= AR5K_SREV_VER_AR5211)
- hal->ah_radio_2ghz_revision =
- ar5k_ar5211_radio_revision(hal, HAL_CHIP_2GHZ);
+ hal->ah_radio_2ghz_revision = 0;
/* Identify the chipset (this has to be done in an early step) */
hal->ah_version = AR5K_AR5211;
diff --git a/sys/dev/ic/ar5212.c b/sys/dev/ic/ar5212.c
index aac1722c595..2dba7499832 100644
--- a/sys/dev/ic/ar5212.c
+++ b/sys/dev/ic/ar5212.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5212.c,v 1.25 2005/09/10 14:36:46 jsg Exp $ */
+/* $OpenBSD: ar5212.c,v 1.26 2005/09/19 10:27:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -190,18 +190,19 @@ ar5k_ar5212_attach(u_int16_t device, void *sc, bus_space_tag_t st,
/* Get MAC, PHY and RADIO revisions */
srev = AR5K_REG_READ(AR5K_AR5212_SREV);
+ hal->ah_mac_srev = srev;
hal->ah_mac_version = AR5K_REG_MS(srev, AR5K_AR5212_SREV_VER);
hal->ah_mac_revision = AR5K_REG_MS(srev, AR5K_AR5212_SREV_REV);
hal->ah_phy_revision = AR5K_REG_READ(AR5K_AR5212_PHY_CHIP_ID) &
0x00ffffffff;
-
hal->ah_radio_5ghz_revision =
ar5k_ar5212_radio_revision(hal, HAL_CHIP_5GHZ);
+ hal->ah_radio_2ghz_revision =
+ ar5k_ar5212_radio_revision(hal, HAL_CHIP_2GHZ);
- /* Get the 2GHz radio revision if it's supported */
- if (hal->ah_mac_version >= AR5K_SREV_VER_AR5211)
- hal->ah_radio_2ghz_revision =
- ar5k_ar5212_radio_revision(hal, HAL_CHIP_2GHZ);
+ /* Single chip radio */
+ if (hal->ah_radio_2ghz_revision == hal->ah_radio_5ghz_revision)
+ hal->ah_radio_2ghz_revision = 0;
/* Identify the chipset (this has to be done in an early step) */
hal->ah_version = AR5K_AR5212;
diff --git a/sys/dev/ic/ar5xxx.c b/sys/dev/ic/ar5xxx.c
index c638e0dcf31..ad003805818 100644
--- a/sys/dev/ic/ar5xxx.c
+++ b/sys/dev/ic/ar5xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5xxx.c,v 1.29 2005/09/10 14:36:46 jsg Exp $ */
+/* $OpenBSD: ar5xxx.c,v 1.30 2005/09/19 10:27:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -522,7 +522,7 @@ ar5k_printver(enum ar5k_srev_type type, u_int32_t val)
if (names[i].sr_type != type ||
names[i].sr_val == AR5K_SREV_UNKNOWN)
continue;
- if (val < names[i + 1].sr_val) {
+ if ((val & 0xff) < names[i + 1].sr_val) {
name = names[i].sr_name;
break;
}
diff --git a/sys/dev/ic/ar5xxx.h b/sys/dev/ic/ar5xxx.h
index dbe4928c1f6..11d5904556e 100644
--- a/sys/dev/ic/ar5xxx.h
+++ b/sys/dev/ic/ar5xxx.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5xxx.h,v 1.26 2005/09/08 12:44:55 jsg Exp $ */
+/* $OpenBSD: ar5xxx.h,v 1.27 2005/09/19 10:27:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -1107,7 +1107,8 @@ struct ath_hal {
HAL_RATE_TABLE ah_rt_turbo;
HAL_RATE_TABLE ah_rt_xr;
- u_int32_t ah_mac_version;
+ u_int32_t ah_mac_srev;
+ u_int16_t ah_mac_version;
u_int16_t ah_mac_revision;
u_int16_t ah_phy_revision;
u_int16_t ah_radio_5ghz_revision;
@@ -1120,11 +1121,6 @@ struct ath_hal {
HAL_BOOL ah_5ghz;
HAL_BOOL ah_2ghz;
-#define ah_macVersion ah_mac_version
-#define ah_macRev ah_mac_revision
-#define ah_phyRev ah_phy_revision
-#define ah_analog5GhzRev ah_radio_5ghz_revision
-#define ah_analog2GhzRev ah_radio_2ghz_revision
#define ah_regdomain ah_capabilities.cap_regdomain.reg_current
#define ah_modes ah_capabilities.cap_mode
#define ah_ee_version ah_capabilities.cap_eeprom.ee_version
@@ -1197,31 +1193,27 @@ struct ar5k_srev_name {
{ "5311b", AR5K_VERSION_VER, AR5K_SREV_VER_AR5311B },\
{ "5211", AR5K_VERSION_VER, AR5K_SREV_VER_AR5211 }, \
{ "5212", AR5K_VERSION_VER, AR5K_SREV_VER_AR5212 }, \
+ { "5213", AR5K_VERSION_VER, AR5K_SREV_VER_AR5213 }, \
{ "xxxx", AR5K_VERSION_VER, AR5K_SREV_UNKNOWN }, \
{ "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 }, \
{ "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 }, \
{ "2111", AR5K_VERSION_RAD, AR5K_SREV_RAD_2111 }, \
{ "5112", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112 }, \
{ "2112", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112 }, \
+ { "2112a", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112A }, \
{ "xxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN } \
}
#define AR5K_SREV_UNKNOWN 0xffff
-#define AR5K_SREV_REV_FPGA 1
-#define AR5K_SREV_REV_PROTO 2
-#define AR5K_SREV_REV_PROTOA 3
-#define AR5K_SREV_REV_AR5210 4
-#define AR5K_SREV_REV_AR5210M 5
-#define AR5K_SREV_REV_AR5210M23 7
-#define AR5K_SREV_REV_AR521023 8
-
-#define AR5K_SREV_VER_AR5210 0
-#define AR5K_SREV_VER_AR5311 1
-#define AR5K_SREV_VER_AR5311A 2
-#define AR5K_SREV_VER_AR5311B 3
-#define AR5K_SREV_VER_AR5211 4
-#define AR5K_SREV_VER_AR5212 5
+#define AR5K_SREV_VER_AR5210 0x00
+#define AR5K_SREV_VER_AR5311 0x10
+#define AR5K_SREV_VER_AR5311A 0x20
+#define AR5K_SREV_VER_AR5311B 0x30
+#define AR5K_SREV_VER_AR5211 0x40
+#define AR5K_SREV_VER_AR5212 0x50
+#define AR5K_SREV_VER_AR5213 0x55
+#define AR5K_SREV_VER_UNSUPP 0x60
#define AR5K_SREV_RAD_5110 0x00
#define AR5K_SREV_RAD_5111 0x10
@@ -1231,6 +1223,7 @@ struct ar5k_srev_name {
#define AR5K_SREV_RAD_5112A 0x35
#define AR5K_SREV_RAD_2112 0x40
#define AR5K_SREV_RAD_2112A 0x45
+#define AR5K_SREV_RAD_UNSUPP 0x50
/*
* Misc defines
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c
index d04d210556b..879c5de285b 100644
--- a/sys/dev/ic/ath.c
+++ b/sys/dev/ic/ath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ath.c,v 1.39 2005/09/08 17:38:11 reyk Exp $ */
+/* $OpenBSD: ath.c,v 1.40 2005/09/19 10:27:08 reyk Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
@@ -238,18 +238,25 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
}
printf("%s: AR%s %u.%u phy %u.%u", ifp->if_xname,
- ar5k_printver(AR5K_VERSION_VER, ah->ah_macVersion),
- ah->ah_macVersion, ah->ah_macRev,
- ah->ah_phyRev >> 4, ah->ah_phyRev & 0xf);
+ ar5k_printver(AR5K_VERSION_VER, ah->ah_mac_srev),
+ ah->ah_mac_version, ah->ah_mac_revision,
+ ah->ah_phy_revision >> 4, ah->ah_phy_revision & 0xf);
printf(" rf%s %u.%u",
- ar5k_printver(AR5K_VERSION_RAD, ah->ah_analog5GhzRev),
- ah->ah_analog5GhzRev >> 4,
- ah->ah_analog5GhzRev & 0xf);
- if (ah->ah_analog2GhzRev != 0) {
+ ar5k_printver(AR5K_VERSION_RAD, ah->ah_radio_5ghz_revision),
+ ah->ah_radio_5ghz_revision >> 4,
+ ah->ah_radio_5ghz_revision & 0xf);
+ if (ah->ah_radio_2ghz_revision != 0) {
printf(" rf%s %u.%u",
- ar5k_printver(AR5K_VERSION_RAD, ah->ah_analog2GhzRev),
- ah->ah_analog2GhzRev >> 4,
- ah->ah_analog2GhzRev & 0xf);
+ ar5k_printver(AR5K_VERSION_RAD,
+ ah->ah_radio_2ghz_revision),
+ ah->ah_radio_2ghz_revision >> 4,
+ ah->ah_radio_2ghz_revision & 0xf);
+ }
+
+ if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_UNSUPP ||
+ ah->ah_radio_2ghz_revision >= AR5K_SREV_RAD_UNSUPP) {
+ printf(": RF radio not supported\n");
+ goto bad;
}
sc->sc_ah = ah;
@@ -282,8 +289,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
error = ath_desc_alloc(sc);
if (error != 0) {
- printf("%s: failed to allocate descriptors: %d\n",
- ifp->if_xname, error);
+ printf(": failed to allocate descriptors: %d\n", error);
goto bad;
}
timeout_set(&sc->sc_scan_to, ath_next_scan, sc);
@@ -310,8 +316,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
*/
sc->sc_bhalq = ath_hal_setup_tx_queue(ah,HAL_TX_QUEUE_BEACON,NULL);
if (sc->sc_bhalq == (u_int) -1) {
- printf("%s: unable to setup a beacon xmit queue!\n",
- ifp->if_xname);
+ printf(": unable to setup a beacon xmit queue!\n");
goto bad2;
}
@@ -321,8 +326,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
sc->sc_txhalq[i] = ath_hal_setup_tx_queue(ah,
HAL_TX_QUEUE_DATA, &qinfo);
if (sc->sc_txhalq[i] == (u_int) -1) {
- printf("%s: unable to setup a data xmit queue %u!\n",
- ifp->if_xname, i);
+ printf(": unable to setup a data xmit queue %u!\n", i);
goto bad2;
}
}
@@ -403,15 +407,12 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
* Make sure the interface is shutdown during reboot.
*/
sc->sc_sdhook = shutdownhook_establish(ath_shutdown, sc);
- if (sc->sc_sdhook == NULL) {
- printf("%s: WARNING: unable to establish shutdown hook\n",
- sc->sc_dev.dv_xname);
- }
+ if (sc->sc_sdhook == NULL)
+ printf(": WARNING: unable to establish shutdown hook\n");
sc->sc_powerhook = powerhook_establish(ath_power, sc);
- if (sc->sc_powerhook == NULL) {
- printf("%s: WARNING: unable to establish power hook\n",
- sc->sc_dev.dv_xname);
- }
+ if (sc->sc_powerhook == NULL)
+ printf(": WARNING: unable to establish power hook\n");
+
printf(", %s, address %s\n", ieee80211_regdomain2name(ath_regdomain),
ether_sprintf(ic->ic_myaddr));
@@ -434,11 +435,11 @@ ath_detach(struct ath_softc *sc, int flags)
struct ifnet *ifp = &sc->sc_ic.ic_if;
int s;
- config_detach_children(&sc->sc_dev, flags);
-
if ((sc->sc_flags & ATH_ATTACHED) == 0)
return (0);
+ config_detach_children(&sc->sc_dev, flags);
+
DPRINTF(ATH_DEBUG_ANY, ("%s: if_flags %x\n", __func__, ifp->if_flags));
s = splnet();