summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ah.c222
-rw-r--r--ah_internal.h36
-rw-r--r--ar5210/ar5210.h5
-rw-r--r--ar5210/ar5210_attach.c19
-rw-r--r--ar5210/ar5210_beacon.c3
-rw-r--r--ar5210/ar5210_interrupts.c3
-rw-r--r--ar5210/ar5210_keycache.c3
-rw-r--r--ar5210/ar5210_misc.c3
-rw-r--r--ar5210/ar5210_phy.c3
-rw-r--r--ar5210/ar5210_power.c3
-rw-r--r--ar5210/ar5210_recv.c3
-rw-r--r--ar5210/ar5210_reset.c3
-rw-r--r--ar5210/ar5210_xmit.c3
-rw-r--r--ar5211/ar5211_attach.c17
-rw-r--r--ar5211/ar5211_beacon.c3
-rw-r--r--ar5211/ar5211_interrupts.c3
-rw-r--r--ar5211/ar5211_keycache.c3
-rw-r--r--ar5211/ar5211_misc.c3
-rw-r--r--ar5211/ar5211_phy.c3
-rw-r--r--ar5211/ar5211_power.c3
-rw-r--r--ar5211/ar5211_recv.c3
-rw-r--r--ar5211/ar5211_reset.c2
-rw-r--r--ar5211/ar5211_xmit.c3
-rw-r--r--ar5212/ar2316.c12
-rw-r--r--ar5212/ar2317.c12
-rw-r--r--ar5212/ar2413.c12
-rw-r--r--ar5212/ar2425.c16
-rw-r--r--ar5212/ar5111.c12
-rw-r--r--ar5212/ar5112.c12
-rw-r--r--ar5212/ar5212.h10
-rw-r--r--ar5212/ar5212_ani.c3
-rw-r--r--ar5212/ar5212_attach.c84
-rw-r--r--ar5212/ar5212_beacon.c3
-rw-r--r--ar5212/ar5212_eeprom.c6
-rw-r--r--ar5212/ar5212_gpio.c7
-rw-r--r--ar5212/ar5212_interrupts.c3
-rw-r--r--ar5212/ar5212_keycache.c3
-rw-r--r--ar5212/ar5212_misc.c6
-rw-r--r--ar5212/ar5212_phy.c3
-rw-r--r--ar5212/ar5212_power.c3
-rw-r--r--ar5212/ar5212_recv.c3
-rw-r--r--ar5212/ar5212_reset.c6
-rw-r--r--ar5212/ar5212_rfgain.c3
-rw-r--r--ar5212/ar5212_xmit.c3
-rw-r--r--ar5212/ar5413.c12
-rw-r--r--ar5312/ar5312_attach.c88
-rw-r--r--ar5416/ar2133.c3
-rw-r--r--ar5416/ar5416_ani.c2
-rw-r--r--ar5416/ar5416_attach.c17
-rw-r--r--ar5416/ar5416_beacon.c3
-rw-r--r--ar5416/ar5416_cal.c6
-rw-r--r--ar5416/ar5416_cal_adcdc.c3
-rw-r--r--ar5416/ar5416_cal_adcgain.c3
-rw-r--r--ar5416/ar5416_cal_iq.c3
-rw-r--r--ar5416/ar5416_eeprom.c3
-rw-r--r--ar5416/ar5416_gpio.c3
-rw-r--r--ar5416/ar5416_interrupts.c3
-rw-r--r--ar5416/ar5416_keycache.c3
-rw-r--r--ar5416/ar5416_misc.c3
-rw-r--r--ar5416/ar5416_phy.c3
-rw-r--r--ar5416/ar5416_power.c3
-rw-r--r--ar5416/ar5416_recv.c3
-rw-r--r--ar5416/ar5416_reset.c3
-rw-r--r--ar5416/ar5416_xmit.c3
-rw-r--r--ar5416/ar9160_attach.c19
65 files changed, 264 insertions, 499 deletions
diff --git a/ah.c b/ah.c
index 409259d..065c043 100644
--- a/ah.c
+++ b/ah.c
@@ -22,41 +22,10 @@
#include "ah_internal.h"
#include "ah_devid.h"
-#ifdef AH_SUPPORT_AR5210
-extern struct ath_hal *ar5210Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
-#ifdef AH_SUPPORT_AR5211
-extern struct ath_hal *ar5211Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
-#ifdef AH_SUPPORT_AR5212
-extern struct ath_hal *ar5212Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
-#ifdef AH_SUPPORT_AR5312
-extern struct ath_hal *ar5312Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
-#ifdef AH_SUPPORT_AR5416
-extern struct ath_hal *ar5416Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
-#ifdef AH_SUPPORT_AR9160
-extern struct ath_hal *ar9160Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
-#ifdef AH_SUPPORT_AR9280
-extern struct ath_hal *ar9280Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
-#ifdef AH_SUPPORT_AR9285
-extern struct ath_hal *ar9285Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
-#endif
#include "version.h"
char ath_hal_version[] = ATH_HAL_VERSION;
+/* XXX chip+rf support no longer correct */
const char* ath_hal_buildopts[] = {
#ifdef AH_SUPPORT_AR5210
"AR5210",
@@ -148,66 +117,24 @@ const char* ath_hal_buildopts[] = {
AH_NULL
};
-static const char*
-ath_hal_devname(uint16_t devid)
-{
- switch (devid) {
- case AR5210_PROD:
- case AR5210_DEFAULT:
- return "Atheros 5210";
-
- case AR5211_DEVID:
- case AR5311_DEVID:
- case AR5211_DEFAULT:
- return "Atheros 5211";
- case AR5211_FPGA11B:
- return "Atheros 5211 (FPGA)";
-
- case AR5212_FPGA:
- return "Atheros 5212 (FPGA)";
- case AR5212_AR5312_REV2:
- case AR5212_AR5312_REV7:
- return "Atheros 5312 WiSoC";
- case AR5212_AR2315_REV6:
- case AR5212_AR2315_REV7:
- return "Atheros 2315 WiSoC";
- case AR5212_AR2317_REV1:
- return "Atheros 2317 WiSoC";
- case AR5212_AR2313_REV8:
- return "Atheros 2313 WiSoC";
- case AR5212_DEVID:
- case AR5212_DEVID_IBM:
- case AR5212_DEFAULT:
- return "Atheros 5212";
- case AR5212_AR2413:
- return "Atheros 2413";
- case AR5212_AR2417:
- return "Atheros 2417";
- case AR5212_AR5413:
- return "Atheros 5413";
- case AR5212_AR5424:
- return "Atheros 5424/2424";
- case AR5416_DEVID_PCI:
- case AR5416_DEVID_PCIE:
- return "Atheros 5416";
- case AR9160_DEVID_PCI:
- return "Atheros 9160";
- case AR9280_DEVID_PCI:
- case AR9280_DEVID_PCIE:
- return "Atheros 9280";
- case AR9285_DEVID_PCIE:
- return "Atheros 9285";
- }
- return AH_NULL;
-}
+/* linker set of registered chips */
+OS_SET_DECLARE(ah_chips, struct ath_hal_chip);
+/*
+ * Check the set of registered chips to see if any recognize
+ * the device as one they can support.
+ */
const char*
ath_hal_probe(uint16_t vendorid, uint16_t devid)
{
- return (vendorid == ATHEROS_VENDOR_ID ||
- vendorid == ATHEROS_3COM_VENDOR_ID ||
- vendorid == ATHEROS_3COM2_VENDOR_ID ?
- ath_hal_devname(devid) : 0);
+ struct ath_hal_chip **pchip;
+
+ SET_FOREACH(pchip, ah_chips) {
+ const char *name = (*pchip)->probe(vendorid, devid);
+ if (name != AH_NULL)
+ return name;
+ }
+ return AH_NULL;
}
/*
@@ -221,87 +148,50 @@ struct ath_hal*
ath_hal_attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *error)
{
- struct ath_hal *ah=AH_NULL;
+ struct ath_hal_chip **pchip;
- switch (devid) {
-#ifdef AH_SUPPORT_AR5210
- case AR5210_AP:
- case AR5210_PROD:
- case AR5210_DEFAULT:
- ah = ar5210Attach(devid, sc, st, sh, error);
- break;
-#endif
-#ifdef AH_SUPPORT_AR5211
- case AR5211_DEVID:
- case AR5311_DEVID:
- case AR5211_FPGA11B:
- case AR5211_DEFAULT:
- ah = ar5211Attach(devid, sc, st, sh, error);
- break;
-#endif
-#ifdef AH_SUPPORT_AR5212
- case AR5212_DEVID_IBM:
- case AR5212_AR2413:
- case AR5212_AR2417:
- case AR5212_AR5413:
- case AR5212_AR5424:
- case AR5212_DEVID_FF19: /* XXX PCI Express extra */
- devid = AR5212_DEVID;
- /* fall thru... */
- case AR5212_DEVID:
- case AR5212_FPGA:
- case AR5212_DEFAULT:
- ah = ar5212Attach(devid, sc, st, sh, error);
- break;
-#endif
-#ifdef AH_SUPPORT_AR5312
- case AR5212_AR5312_REV2:
- case AR5212_AR5312_REV7:
- case AR5212_AR2313_REV8:
- case AR5212_AR2315_REV6:
- case AR5212_AR2315_REV7:
- case AR5212_AR2317_REV1:
- ah = ar5312Attach(devid, sc, st, sh, error);
- break;
-#endif
-#ifdef AH_SUPPORT_AR5416
- case AR5416_DEVID_PCI:
- case AR5416_DEVID_PCIE:
- ah = ar5416Attach(devid, sc, st, sh, error);
- break;
-#endif
-#ifdef AH_SUPPORT_AR9160
- case AR9160_DEVID_PCI:
- ah = ar9160Attach(devid, sc, st, sh, error);
- break;
-#endif
-#ifdef AH_SUPPORT_AR9280
- case AR9280_DEVID_PCI:
- case AR9280_DEVID_PCIE:
- ah = ar9280Attach(devid, sc, st, sh, error);
- break;
-#endif
-#ifdef AH_SUPPORT_AR9285
- case AR9285_DEVID_PCIE:
- ah = ar9285Attach(devid, sc, st, sh, error);
- break;
-#endif
- default:
- ah = AH_NULL;
- *error = HAL_ENXIO;
- break;
+ SET_FOREACH(pchip, ah_chips) {
+ struct ath_hal_chip *chip = *pchip;
+ struct ath_hal *ah;
+
+ /* XXX don't have vendorid, assume atheros one works */
+ if (chip->probe(ATHEROS_VENDOR_ID, devid) == AH_NULL)
+ continue;
+ ah = chip->attach(devid, sc, st, sh, error);
+ if (ah != AH_NULL) {
+ /* copy back private state to public area */
+ ah->ah_devid = AH_PRIVATE(ah)->ah_devid;
+ ah->ah_subvendorid = AH_PRIVATE(ah)->ah_subvendorid;
+ ah->ah_macVersion = AH_PRIVATE(ah)->ah_macVersion;
+ ah->ah_macRev = AH_PRIVATE(ah)->ah_macRev;
+ ah->ah_phyRev = AH_PRIVATE(ah)->ah_phyRev;
+ ah->ah_analog5GhzRev = AH_PRIVATE(ah)->ah_analog5GhzRev;
+ ah->ah_analog2GhzRev = AH_PRIVATE(ah)->ah_analog2GhzRev;
+ return ah;
+ }
}
- if (ah != AH_NULL) {
- /* copy back private state to public area */
- ah->ah_devid = AH_PRIVATE(ah)->ah_devid;
- ah->ah_subvendorid = AH_PRIVATE(ah)->ah_subvendorid;
- ah->ah_macVersion = AH_PRIVATE(ah)->ah_macVersion;
- ah->ah_macRev = AH_PRIVATE(ah)->ah_macRev;
- ah->ah_phyRev = AH_PRIVATE(ah)->ah_phyRev;
- ah->ah_analog5GhzRev = AH_PRIVATE(ah)->ah_analog5GhzRev;
- ah->ah_analog2GhzRev = AH_PRIVATE(ah)->ah_analog2GhzRev;
+ return AH_NULL;
+}
+
+/* linker set of registered RF backends */
+OS_SET_DECLARE(ah_rfs, struct ath_hal_rf);
+
+/*
+ * Check the set of registered RF backends to see if
+ * any recognize the device as one they can support.
+ */
+struct ath_hal_rf *
+ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode)
+{
+ struct ath_hal_rf **prf;
+
+ SET_FOREACH(prf, ah_rfs) {
+ struct ath_hal_rf *rf = *prf;
+ if (rf->probe(ah))
+ return rf;
}
- return ah;
+ *ecode = HAL_ENOTSUPP;
+ return AH_NULL;
}
/*
diff --git a/ah_internal.h b/ah_internal.h
index dc21e5e..8b6a59a 100644
--- a/ah_internal.h
+++ b/ah_internal.h
@@ -83,6 +83,42 @@ typedef enum {
HAL_CAP_AR = 1, /* AR capability */
} HAL_PHYDIAG_CAPS;
+/*
+ * Each chip or class of chips registers to offer support.
+ */
+struct ath_hal_chip {
+ const char *(*probe)(uint16_t vendorid, uint16_t devid);
+ struct ath_hal *(*attach)(uint16_t devid, HAL_SOFTC,
+ HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS *error);
+};
+#ifndef AH_CHIP
+#define AH_CHIP(name, _probe, _attach) \
+static struct ath_hal_chip name##_chip = { \
+ .probe = _probe, \
+ .attach = _attach \
+}; \
+OS_DATA_SET(ah_chips, name##_chip)
+#endif
+
+/*
+ * Each RF backend registers to offer support; this is mostly
+ * used by multi-chip 5212 solutions. Single-chip solutions
+ * have a fixed idea about which RF to use.
+ */
+struct ath_hal_rf {
+ HAL_BOOL (*probe)(struct ath_hal *ah);
+ HAL_BOOL (*attach)(struct ath_hal *ah, HAL_STATUS *ecode);
+};
+#ifndef AH_RF
+#define AH_RF(name, _probe, _attach) \
+static struct ath_hal_rf name##_rf = { \
+ .probe = _probe, \
+ .attach = _attach \
+}; \
+OS_DATA_SET(ah_rfs, name##_rf)
+#endif
+
+struct ath_hal_rf *ath_hal_rfprobe(struct ath_hal *ah, HAL_STATUS *ecode);
/*
* Internal form of a HAL_CHANNEL. Note that the structure
diff --git a/ar5210/ar5210.h b/ar5210/ar5210.h
index d857998..857cf3c 100644
--- a/ar5210/ar5210.h
+++ b/ar5210/ar5210.h
@@ -126,10 +126,7 @@ struct ath_hal_5210 {
struct ath_hal;
-extern struct ath_hal *ar5210Attach(uint16_t, HAL_SOFTC,
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS *);
-extern void ar5210Detach(struct ath_hal *);
-
+extern void ar5210Detach(struct ath_hal *ah);
extern HAL_BOOL ar5210Reset(struct ath_hal *, HAL_OPMODE,
HAL_CHANNEL *, HAL_BOOL bChannelChange, HAL_STATUS *);
extern void ar5210SetPCUConfig(struct ath_hal *);
diff --git a/ar5210/ar5210_attach.c b/ar5210/ar5210_attach.c
index 37fa425..610abea 100644
--- a/ar5210/ar5210_attach.c
+++ b/ar5210/ar5210_attach.c
@@ -18,10 +18,9 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
+#include "ah_devid.h"
#include "ar5210/ar5210.h"
#include "ar5210/ar5210reg.h"
@@ -170,8 +169,9 @@ static HAL_BOOL ar5210FillCapabilityInfo(struct ath_hal *ah);
/*
* Attach for an AR5210 part.
*/
-struct ath_hal *
-ar5210Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
+static struct ath_hal *
+ar5210Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh,
+ HAL_STATUS *status)
{
#define N(a) (sizeof(a)/sizeof(a[0]))
struct ath_hal_5210 *ahp;
@@ -371,4 +371,13 @@ ar5210FillCapabilityInfo(struct ath_hal *ah)
ahpriv->ah_rxornIsFatal = AH_TRUE;
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR5210 */
+
+static const char*
+ar5210Probe(uint16_t vendorid, uint16_t devid)
+{
+ if (vendorid == ATHEROS_VENDOR_ID &&
+ (devid == AR5210_PROD || devid == AR5210_DEFAULT))
+ return "Atheros 5210";
+ return AH_NULL;
+}
+AH_CHIP(ar5210, ar5210Probe, ar5210Attach);
diff --git a/ar5210/ar5210_beacon.c b/ar5210/ar5210_beacon.c
index f718187..680e2de 100644
--- a/ar5210/ar5210_beacon.c
+++ b/ar5210/ar5210_beacon.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_desc.h"
@@ -191,4 +189,3 @@ ar5210SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *bs)
OS_REG_WRITE(ah, AR_RSSI_THR, ahp->ah_rssiThr);
#undef BMISS_MAX
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_interrupts.c b/ar5210/ar5210_interrupts.c
index 81543e9..ccc2332 100644
--- a/ar5210/ar5210_interrupts.c
+++ b/ar5210/ar5210_interrupts.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
@@ -134,4 +132,3 @@ ar5210SetInterrupts(struct ath_hal *ah, HAL_INT ints)
return omask;
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_keycache.c b/ar5210/ar5210_keycache.c
index 7ee93e1..9594ce3 100644
--- a/ar5210/ar5210_keycache.c
+++ b/ar5210/ar5210_keycache.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
@@ -156,4 +154,3 @@ ar5210SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,
OS_REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), keyType);
return ar5210SetKeyCacheEntryMac(ah, entry, mac);
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_misc.c b/ar5210/ar5210_misc.c
index 710c03a..a673917 100644
--- a/ar5210/ar5210_misc.c
+++ b/ar5210/ar5210_misc.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
@@ -642,4 +640,3 @@ ar5210GetDiagState(struct ath_hal *ah, int request,
return ath_hal_getdiagstate(ah, request,
args, argsize, result, resultsize);
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_phy.c b/ar5210/ar5210_phy.c
index 0980100..14dc384 100644
--- a/ar5210/ar5210_phy.c
+++ b/ar5210/ar5210_phy.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
@@ -85,4 +83,3 @@ ar5210GetRateTable(struct ath_hal *ah, u_int mode)
ath_hal_setupratetable(ah, rt);
return rt;
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_power.c b/ar5210/ar5210_power.c
index dcece25..c2771f2 100644
--- a/ar5210/ar5210_power.c
+++ b/ar5210/ar5210_power.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
@@ -134,4 +132,3 @@ ar5210GetPowerMode(struct ath_hal *ah)
/* Just so happens the h/w maps directly to the abstracted value */
return MS(OS_REG_READ(ah, AR_SCR), AR_SCR_SLE);
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_recv.c b/ar5210/ar5210_recv.c
index 3cc6aee..489c55a 100644
--- a/ar5210/ar5210_recv.c
+++ b/ar5210/ar5210_recv.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_desc.h"
@@ -266,4 +264,3 @@ ar5210ProcRxDesc(struct ath_hal *ah, struct ath_desc *ds,
return HAL_OK;
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_reset.c b/ar5210/ar5210_reset.c
index 363c813..40c6768 100644
--- a/ar5210/ar5210_reset.c
+++ b/ar5210/ar5210_reset.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
@@ -1003,4 +1001,3 @@ ar5210GetRfgain(struct ath_hal *ah)
{
return HAL_RFGAIN_INACTIVE;
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5210/ar5210_xmit.c b/ar5210/ar5210_xmit.c
index 8d27912..7ce9c83 100644
--- a/ar5210/ar5210_xmit.c
+++ b/ar5210/ar5210_xmit.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5210
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_desc.h"
@@ -623,4 +621,3 @@ ar5210GetTxIntrQueue(struct ath_hal *ah, uint32_t *txqs)
{
return;
}
-#endif /* AH_SUPPORT_AR5210 */
diff --git a/ar5211/ar5211_attach.c b/ar5211/ar5211_attach.c
index 664b648..e097c74 100644
--- a/ar5211/ar5211_attach.c
+++ b/ar5211/ar5211_attach.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -502,4 +500,17 @@ ar5211FillCapabilityInfo(struct ath_hal *ah)
ahpriv->ah_rxornIsFatal = AH_TRUE;
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR5211 */
+
+static const char*
+ar5211Probe(uint16_t vendorid, uint16_t devid)
+{
+ if (vendorid == ATHEROS_VENDOR_ID) {
+ if (devid == AR5211_DEVID || devid == AR5311_DEVID ||
+ devid == AR5211_DEFAULT)
+ return "Atheros 5211";
+ if (devid == AR5211_FPGA11B)
+ return "Atheros 5211 (FPGA)";
+ }
+ return AH_NULL;
+}
+AH_CHIP(ar5211, ar5211Probe, ar5211Attach);
diff --git a/ar5211/ar5211_beacon.c b/ar5211/ar5211_beacon.c
index de14198..74207a3 100644
--- a/ar5211/ar5211_beacon.c
+++ b/ar5211/ar5211_beacon.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
@@ -173,4 +171,3 @@ ar5211SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *bs)
(bs->bs_sleepduration - SLEEP_SLOP) << 3);
#undef SLEEP_SLOP
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_interrupts.c b/ar5211/ar5211_interrupts.c
index c3203296..26035b8 100644
--- a/ar5211/ar5211_interrupts.c
+++ b/ar5211/ar5211_interrupts.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
@@ -160,4 +158,3 @@ ar5211SetInterrupts(struct ath_hal *ah, HAL_INT ints)
return omask;
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_keycache.c b/ar5211/ar5211_keycache.c
index 2a7ce28..61f579a 100644
--- a/ar5211/ar5211_keycache.c
+++ b/ar5211/ar5211_keycache.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
@@ -178,4 +176,3 @@ ar5211SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,
OS_REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), keyType);
return ar5211SetKeyCacheEntryMac(ah, entry, mac);
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_misc.c b/ar5211/ar5211_misc.c
index ee8ede9..5197212 100644
--- a/ar5211/ar5211_misc.c
+++ b/ar5211/ar5211_misc.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
@@ -685,4 +683,3 @@ ar5211GetDiagState(struct ath_hal *ah, int request,
}
return AH_FALSE;
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_phy.c b/ar5211/ar5211_phy.c
index b3be093..62a46b5 100644
--- a/ar5211/ar5211_phy.c
+++ b/ar5211/ar5211_phy.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
@@ -104,4 +102,3 @@ ar5211GetRateTable(struct ath_hal *ah, u_int mode)
ath_hal_setupratetable(ah, rt);
return rt;
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_power.c b/ar5211/ar5211_power.c
index 8a40e97..bcfcf7c 100644
--- a/ar5211/ar5211_power.c
+++ b/ar5211/ar5211_power.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
@@ -136,4 +134,3 @@ ar5211GetPowerMode(struct ath_hal *ah)
/* Just so happens the h/w maps directly to the abstracted value */
return MS(OS_REG_READ(ah, AR_SCR), AR_SCR_SLE);
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_recv.c b/ar5211/ar5211_recv.c
index 8cb801e..c5b0e18 100644
--- a/ar5211/ar5211_recv.c
+++ b/ar5211/ar5211_recv.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_desc.h"
@@ -245,4 +243,3 @@ ar5211ProcRxDesc(struct ath_hal *ah, struct ath_desc *ds,
return HAL_OK;
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_reset.c b/ar5211/ar5211_reset.c
index 80c7962..6646a4d 100644
--- a/ar5211/ar5211_reset.c
+++ b/ar5211/ar5211_reset.c
@@ -18,7 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
/*
* Chips specific device attachment and device info collection
* Connects Init Reg Vectors, EEPROM Data, and device Functions.
@@ -2137,4 +2136,3 @@ ar5211SetPCUConfig(struct ath_hal *ah)
{
ar5211SetOperatingMode(ah, AH_PRIVATE(ah)->ah_opmode);
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5211/ar5211_xmit.c b/ar5211/ar5211_xmit.c
index 23d4a8a..86ec2c7 100644
--- a/ar5211/ar5211_xmit.c
+++ b/ar5211/ar5211_xmit.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5211
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_desc.h"
@@ -679,4 +677,3 @@ ar5211GetTxIntrQueue(struct ath_hal *ah, uint32_t *txqs)
{
return;
}
-#endif /* AH_SUPPORT_AR5211 */
diff --git a/ar5212/ar2316.c b/ar5212/ar2316.c
index 207e7b7..9449645 100644
--- a/ar5212/ar2316.c
+++ b/ar5212/ar2316.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_2316
-
#include "ah.h"
#include "ah_internal.h"
@@ -727,7 +725,7 @@ ar2316RfDetach(struct ath_hal *ah)
* Allocate memory for private state.
* Scratch Buffer will be reinitialized every reset so no need to zero now
*/
-HAL_BOOL
+static HAL_BOOL
ar2316RfAttach(struct ath_hal *ah, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -760,4 +758,10 @@ ar2316RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_2316 */
+
+static HAL_BOOL
+ar2316Probe(struct ath_hal *ah)
+{
+ return IS_2316(ah);
+}
+AH_RF(ar2316, ar2316Probe, ar2316RfAttach);
diff --git a/ar5212/ar2317.c b/ar5212/ar2317.c
index 084fd5b..d955a41 100644
--- a/ar5212/ar2317.c
+++ b/ar5212/ar2317.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_2317
-
#include "ah.h"
#include "ah_internal.h"
@@ -706,7 +704,7 @@ ar2317RfDetach(struct ath_hal *ah)
* Allocate memory for analog bank scratch buffers
* Scratch Buffer will be reinitialized every reset so no need to zero now
*/
-HAL_BOOL
+static HAL_BOOL
ar2317RfAttach(struct ath_hal *ah, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -737,4 +735,10 @@ ar2317RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_2317 */
+
+static HAL_BOOL
+ar2317Probe(struct ath_hal *ah)
+{
+ return IS_2317(ah);
+}
+AH_RF(ar2317, ar2317Probe, ar2317RfAttach);
diff --git a/ar5212/ar2413.c b/ar5212/ar2413.c
index a16f705..4e296e4 100644
--- a/ar5212/ar2413.c
+++ b/ar5212/ar2413.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_2413
-
#include "ah.h"
#include "ah_internal.h"
@@ -721,7 +719,7 @@ ar2413RfDetach(struct ath_hal *ah)
* Allocate memory for analog bank scratch buffers
* Scratch Buffer will be reinitialized every reset so no need to zero now
*/
-HAL_BOOL
+static HAL_BOOL
ar2413RfAttach(struct ath_hal *ah, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -752,4 +750,10 @@ ar2413RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_2413 */
+
+static HAL_BOOL
+ar2413Probe(struct ath_hal *ah)
+{
+ return IS_2413(ah);
+}
+AH_RF(ar2413, ar2413Probe, ar2413RfAttach);
diff --git a/ar5212/ar2425.c b/ar5212/ar2425.c
index 0b8ef20..c9cf045d 100644
--- a/ar5212/ar2425.c
+++ b/ar5212/ar2425.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_2425
-
#include "ah.h"
#include "ah_internal.h"
@@ -30,9 +28,7 @@
#include "ah_eeprom_v3.h"
#define AH_5212_2425
-#ifdef AH_SUPPORT_2417
#define AH_5212_2417
-#endif
#include "ar5212/ar5212.ini"
#define N(a) (sizeof(a)/sizeof(a[0]))
@@ -211,13 +207,11 @@ ar2425SetRfRegs(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *chan, uint16_t modesIn
HAL_INI_WRITE_BANK(ah, ar5212Bank1_2425, priv->Bank1Data, regWrites);
HAL_INI_WRITE_BANK(ah, ar5212Bank2_2425, priv->Bank2Data, regWrites);
HAL_INI_WRITE_BANK(ah, ar5212Bank3_2425, priv->Bank3Data, regWrites);
-#ifdef AH_SUPPORT_2417
if (IS_2417(ah)) {
HALASSERT(N(ar5212Bank6_2425) == N(ar5212Bank6_2417));
HAL_INI_WRITE_BANK(ah, ar5212Bank6_2417, priv->Bank6Data,
regWrites);
} else
-#endif /* AH_SUPPORT_2417 */
HAL_INI_WRITE_BANK(ah, ar5212Bank6_2425, priv->Bank6Data,
regWrites);
HAL_INI_WRITE_BANK(ah, ar5212Bank7_2425, priv->Bank7Data, regWrites);
@@ -688,7 +682,7 @@ ar2425RfDetach(struct ath_hal *ah)
* Allocate memory for analog bank scratch buffers
* Scratch Buffer will be reinitialized every reset so no need to zero now
*/
-HAL_BOOL
+static HAL_BOOL
ar2425RfAttach(struct ath_hal *ah, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -719,4 +713,10 @@ ar2425RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_2425 */
+
+static HAL_BOOL
+ar2425Probe(struct ath_hal *ah)
+{
+ return IS_2425(ah) || IS_2417(ah);
+}
+AH_RF(ar2425, ar2425Probe, ar2425RfAttach);
diff --git a/ar5212/ar5111.c b/ar5212/ar5111.c
index 984ad58..5791711 100644
--- a/ar5212/ar5111.c
+++ b/ar5212/ar5111.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_5111
-
#include "ah.h"
#include "ah_internal.h"
@@ -673,7 +671,7 @@ ar5111RfDetach(struct ath_hal *ah)
* Allocate memory for analog bank scratch buffers
* Scratch Buffer will be reinitialized every reset so no need to zero now
*/
-HAL_BOOL
+static HAL_BOOL
ar5111RfAttach(struct ath_hal *ah, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -704,4 +702,10 @@ ar5111RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_5111 */
+
+static HAL_BOOL
+ar5111Probe(struct ath_hal *ah)
+{
+ return IS_RAD5111(ah);
+}
+AH_RF(ar5111, ar5111Probe, ar5111RfAttach);
diff --git a/ar5212/ar5112.c b/ar5212/ar5112.c
index ec9d034..ecb561f 100644
--- a/ar5212/ar5112.c
+++ b/ar5212/ar5112.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_5112
-
#include "ah.h"
#include "ah_internal.h"
@@ -843,7 +841,7 @@ ar5112RfDetach(struct ath_hal *ah)
* Allocate memory for analog bank scratch buffers
* Scratch Buffer will be reinitialized every reset so no need to zero now
*/
-HAL_BOOL
+static HAL_BOOL
ar5112RfAttach(struct ath_hal *ah, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -874,4 +872,10 @@ ar5112RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_5112 */
+
+static HAL_BOOL
+ar5112Probe(struct ath_hal *ah)
+{
+ return IS_RAD5112(ah);
+}
+AH_RF(ar5112, ar5112Probe, ar5112RfAttach);
diff --git a/ar5212/ar5212.h b/ar5212/ar5212.h
index 1236123..6645b76 100644
--- a/ar5212/ar5212.h
+++ b/ar5212/ar5212.h
@@ -408,21 +408,11 @@ struct ath_hal_5212 {
} \
} while (0)
-extern HAL_BOOL ar5111RfAttach(struct ath_hal *, HAL_STATUS *);
-extern HAL_BOOL ar5112RfAttach(struct ath_hal *, HAL_STATUS *);
-extern HAL_BOOL ar2413RfAttach(struct ath_hal *, HAL_STATUS *);
-extern HAL_BOOL ar5413RfAttach(struct ath_hal *, HAL_STATUS *);
-extern HAL_BOOL ar2316RfAttach(struct ath_hal *, HAL_STATUS *);
-extern HAL_BOOL ar2317RfAttach(struct ath_hal *, HAL_STATUS *);
-extern HAL_BOOL ar2425RfAttach(struct ath_hal *, HAL_STATUS *);
-
struct ath_hal;
extern uint32_t ar5212GetRadioRev(struct ath_hal *ah);
extern void ar5212InitState(struct ath_hal_5212 *, uint16_t devid, HAL_SOFTC,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status);
-extern struct ath_hal * ar5212Attach(uint16_t devid, HAL_SOFTC sc,
- HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status);
extern void ar5212Detach(struct ath_hal *ah);
extern HAL_BOOL ar5212ChipTest(struct ath_hal *ah);
extern HAL_BOOL ar5212GetChannelEdges(struct ath_hal *ah,
diff --git a/ar5212/ar5212_ani.c b/ar5212/ar5212_ani.c
index 1440f23..645c56c 100644
--- a/ar5212/ar5212_ani.c
+++ b/ar5212/ar5212_ani.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_desc.h"
@@ -1016,4 +1014,3 @@ ar5212AniPoll(struct ath_hal *ah, const HAL_NODE_STATS *stats,
}
}
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_attach.c b/ar5212/ar5212_attach.c
index a0baf5f..a6a9b78 100644
--- a/ar5212/ar5212_attach.c
+++ b/ar5212/ar5212_attach.c
@@ -18,16 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
-#if !defined(AH_SUPPORT_5112) && \
- !defined(AH_SUPPORT_5111) && \
- !defined(AH_SUPPORT_2413) && \
- !defined(AH_SUPPORT_5413) && \
- !defined(AH_SUPPORT_AR5312)
-#error "No 5212 RF support defined"
-#endif
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -35,9 +25,6 @@
#include "ar5212/ar5212.h"
#include "ar5212/ar5212reg.h"
#include "ar5212/ar5212phy.h"
-#ifdef AH_SUPPORT_AR5311
-#include "ar5212/ar5311reg.h"
-#endif
#define AH_5212_COMMON
#include "ar5212/ar5212.ini"
@@ -334,7 +321,7 @@ ar5212IsMacSupported(uint8_t macVersion, uint8_t macRev)
/*
* Attach for an AR5212 part.
*/
-struct ath_hal *
+static struct ath_hal *
ar5212Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
{
@@ -342,10 +329,10 @@ ar5212Attach(uint16_t devid, HAL_SOFTC sc,
(IS_PCIE(ah) ? AR_EEPROM_PROTECT_PCIE : AR_EEPROM_PROTECT)
struct ath_hal_5212 *ahp;
struct ath_hal *ah;
+ struct ath_hal_rf *rf;
uint32_t val;
uint16_t eeval;
HAL_STATUS ecode;
- HAL_BOOL rfStatus;
HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, (void*) st, (void*) sh);
@@ -417,6 +404,11 @@ ar5212Attach(uint16_t devid, HAL_SOFTC sc,
/* Read Radio Chip Rev Extract */
AH_PRIVATE(ah)->ah_analog5GhzRev = ar5212GetRadioRev(ah);
+
+ rf = ath_hal_rfprobe(ah, &ecode);
+ if (rf == AH_NULL)
+ goto bad;
+
/* NB: silently accept anything in release code per Atheros */
switch (AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR) {
case AR_RAD5111_SREV_MAJOR:
@@ -554,39 +546,7 @@ ar5212Attach(uint16_t devid, HAL_SOFTC sc,
goto bad;
}
- rfStatus = AH_FALSE;
- if (IS_5413(ah)) {
-#ifdef AH_SUPPORT_5413
- rfStatus = ar5413RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- }
- else if (IS_2413(ah))
-#ifdef AH_SUPPORT_2413
- rfStatus = ar2413RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- else if (IS_RAD5112(ah))
-#ifdef AH_SUPPORT_5112
- rfStatus = ar5112RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- else if (IS_2425(ah) || IS_2417(ah))
-#ifdef AH_SUPPORT_2425
- rfStatus = ar2425RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- else if (IS_RAD5111(ah))
-#ifdef AH_SUPPORT_5111
- rfStatus = ar5111RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- if (!rfStatus) {
+ if (!rf->attach(ah, &ecode)) {
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: RF setup failed, status %u\n",
__func__, ecode);
goto bad;
@@ -881,4 +841,30 @@ ar5212FillCapabilityInfo(struct ath_hal *ah)
#undef IS_GRIFFIN_LITE
#undef AR_KEYTABLE_SIZE
}
-#endif /* AH_SUPPORT_AR5212 */
+
+static const char*
+ar5212Probe(uint16_t vendorid, uint16_t devid)
+{
+ if (vendorid == ATHEROS_VENDOR_ID ||
+ vendorid == ATHEROS_3COM_VENDOR_ID ||
+ vendorid == ATHEROS_3COM2_VENDOR_ID) {
+ switch (devid) {
+ case AR5212_FPGA:
+ return "Atheros 5212 (FPGA)";
+ case AR5212_DEVID:
+ case AR5212_DEVID_IBM:
+ case AR5212_DEFAULT:
+ return "Atheros 5212";
+ case AR5212_AR2413:
+ return "Atheros 2413";
+ case AR5212_AR2417:
+ return "Atheros 2417";
+ case AR5212_AR5413:
+ return "Atheros 5413";
+ case AR5212_AR5424:
+ return "Atheros 5424/2424";
+ }
+ }
+ return AH_NULL;
+}
+AH_CHIP(ar5212, ar5212Probe, ar5212Attach);
diff --git a/ar5212/ar5212_beacon.c b/ar5212/ar5212_beacon.c
index db604c9..2dbc0cb 100644
--- a/ar5212/ar5212_beacon.c
+++ b/ar5212/ar5212_beacon.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
@@ -253,4 +251,3 @@ ar5212SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *bs)
#undef BEACON_TIMEOUT_VAL
#undef SLEEP_SLOP
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_eeprom.c b/ar5212/ar5212_eeprom.c
index 433deff..d2999fd 100644
--- a/ar5212/ar5212_eeprom.c
+++ b/ar5212/ar5212_eeprom.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -30,9 +28,6 @@
#include "ar5212/ar5212.h"
#include "ar5212/ar5212reg.h"
#include "ar5212/ar5212phy.h"
-#ifdef AH_SUPPORT_AR5311
-#include "ar5212/ar5311reg.h"
-#endif
/*
* Read 16 bits of data from offset into *data
@@ -53,4 +48,3 @@ ar5212EepromRead(struct ath_hal *ah, u_int off, uint16_t *data)
*data = OS_REG_READ(ah, AR_EEPROM_DATA) & 0xffff;
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_gpio.c b/ar5212/ar5212_gpio.c
index 85bbf3b..eb0022f 100644
--- a/ar5212/ar5212_gpio.c
+++ b/ar5212/ar5212_gpio.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -30,9 +28,6 @@
#include "ar5212/ar5212.h"
#include "ar5212/ar5212reg.h"
#include "ar5212/ar5212phy.h"
-#ifdef AH_SUPPORT_AR5311
-#include "ar5212/ar5311reg.h"
-#endif
#define AR_NUM_GPIO 6 /* 6 GPIO pins */
#define AR_GPIOD_MASK 0x0000002F /* GPIO data reg r/w mask */
@@ -127,5 +122,3 @@ ar5212GpioSetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel)
/* Change the interrupt mask. */
(void) ar5212SetInterrupts(ah, AH5212(ah)->ah_maskReg | HAL_INT_GPIO);
}
-
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_interrupts.c b/ar5212/ar5212_interrupts.c
index 6e636db..5d0b39c 100644
--- a/ar5212/ar5212_interrupts.c
+++ b/ar5212/ar5212_interrupts.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
@@ -206,4 +204,3 @@ ar5212SetInterrupts(struct ath_hal *ah, HAL_INT ints)
return omask;
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_keycache.c b/ar5212/ar5212_keycache.c
index 864daba..a1f2dbb 100644
--- a/ar5212/ar5212_keycache.c
+++ b/ar5212/ar5212_keycache.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
@@ -285,4 +283,3 @@ ar5212SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,
}
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_misc.c b/ar5212/ar5212_misc.c
index f55b7f2..da316ae 100644
--- a/ar5212/ar5212_misc.c
+++ b/ar5212/ar5212_misc.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -30,9 +28,6 @@
#include "ar5212/ar5212.h"
#include "ar5212/ar5212reg.h"
#include "ar5212/ar5212phy.h"
-#ifdef AH_SUPPORT_AR5311
-#include "ar5212/ar5311reg.h"
-#endif
#include "ah_eeprom_v3.h"
@@ -1077,4 +1072,3 @@ ar5212GetDiagState(struct ath_hal *ah, int request,
}
return AH_FALSE;
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_phy.c b/ar5212/ar5212_phy.c
index ae238f7..96e6725 100644
--- a/ar5212/ar5212_phy.c
+++ b/ar5212/ar5212_phy.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
@@ -199,4 +197,3 @@ ar5212GetRateTable(struct ath_hal *ah, u_int mode)
ath_hal_setupratetable(ah, rt);
return rt;
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_power.c b/ar5212/ar5212_power.c
index c7d90e4..aca52ad 100644
--- a/ar5212/ar5212_power.c
+++ b/ar5212/ar5212_power.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
@@ -175,4 +173,3 @@ ar5212GetPowerStatus(struct ath_hal *ah)
return (OS_REG_READ(ah, AR_PCICFG) & AR_PCICFG_SPWR_DN) != 0;
}
#endif
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_recv.c b/ar5212/ar5212_recv.c
index 765fd2e..22bc112 100644
--- a/ar5212/ar5212_recv.c
+++ b/ar5212/ar5212_recv.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
@@ -286,4 +284,3 @@ ar5212ProcRxDesc(struct ath_hal *ah, struct ath_desc *ds,
}
return HAL_OK;
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_reset.c b/ar5212/ar5212_reset.c
index ee87d5b..fcf5e72 100644
--- a/ar5212/ar5212_reset.c
+++ b/ar5212/ar5212_reset.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -27,9 +25,6 @@
#include "ar5212/ar5212.h"
#include "ar5212/ar5212reg.h"
#include "ar5212/ar5212phy.h"
-#ifdef AH_SUPPORT_AR5311
-#include "ar5212/ar5311reg.h"
-#endif
#include "ah_eeprom_v3.h"
@@ -2662,4 +2657,3 @@ ar5212SetIFSTiming(struct ath_hal *ah, HAL_CHANNEL *chan)
OS_REG_RMW_FIELD(ah, AR_D_GBL_IFS_MISC,
AR_D_GBL_IFS_MISC_USEC_DURATION, init_usec);
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_rfgain.c b/ar5212/ar5212_rfgain.c
index 088cd26..8448ed7 100644
--- a/ar5212/ar5212_rfgain.c
+++ b/ar5212/ar5212_rfgain.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -330,4 +328,3 @@ ar5212GetRfgain(struct ath_hal *ah)
}
return ahp->ah_rfgainState;
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5212_xmit.c b/ar5212/ar5212_xmit.c
index b2afe34..699de14 100644
--- a/ar5212/ar5212_xmit.c
+++ b/ar5212/ar5212_xmit.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5212
-
#include "ah.h"
#include "ah_internal.h"
@@ -941,4 +939,3 @@ ar5212GetTxIntrQueue(struct ath_hal *ah, uint32_t *txqs)
*txqs &= ahp->ah_intrTxqs;
ahp->ah_intrTxqs &= ~(*txqs);
}
-#endif /* AH_SUPPORT_AR5212 */
diff --git a/ar5212/ar5413.c b/ar5212/ar5413.c
index 6b15a6c..41ea1ba 100644
--- a/ar5212/ar5413.c
+++ b/ar5212/ar5413.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_5413
-
#include "ah.h"
#include "ah_internal.h"
@@ -759,7 +757,7 @@ ar5413RfDetach(struct ath_hal *ah)
* Allocate memory for analog bank scratch buffers
* Scratch Buffer will be reinitialized every reset so no need to zero now
*/
-HAL_BOOL
+static HAL_BOOL
ar5413RfAttach(struct ath_hal *ah, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH5212(ah);
@@ -790,4 +788,10 @@ ar5413RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_5413 */
+
+static HAL_BOOL
+ar5413Probe(struct ath_hal *ah)
+{
+ return IS_5413(ah);
+}
+AH_RF(ar5413, ar5413Probe, ar5413RfAttach);
diff --git a/ar5312/ar5312_attach.c b/ar5312/ar5312_attach.c
index e919924..0d041cb 100644
--- a/ar5312/ar5312_attach.c
+++ b/ar5312/ar5312_attach.c
@@ -18,15 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5312
-
-#if !defined(AH_SUPPORT_5112) && \
- !defined(AH_SUPPORT_5111) && \
- !defined(AH_SUPPORT_2316) && \
- !defined(AH_SUPPORT_2317)
-#error "No 5312 RF support defined"
-#endif
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -66,18 +57,18 @@ ar5312AniSetup(struct ath_hal *ah)
}
/*
- * Attach for an AR3212 part.
+ * Attach for an AR5312 part.
*/
-struct ath_hal *
+static struct ath_hal *
ar5312Attach(uint16_t devid, HAL_SOFTC sc,
HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status)
{
struct ath_hal_5212 *ahp = AH_NULL;
struct ath_hal *ah;
+ struct ath_hal_rf *rf;
uint32_t val;
uint16_t eeval;
HAL_STATUS ecode;
- HAL_BOOL rfStatus;
HALDEBUG(AH_NULL, HAL_DEBUG_ATTACH, "%s: sc %p st %p sh %p\n",
__func__, sc, st, (void*) sh);
@@ -193,23 +184,10 @@ ar5312Attach(uint16_t devid, HAL_SOFTC sc,
/* Read Radio Chip Rev Extract */
AH_PRIVATE(ah)->ah_analog5GhzRev = ar5212GetRadioRev(ah);
-#ifdef AH_DEBUG
- /* NB: silently accept anything in release code per Atheros */
- if ((AH_PRIVATE(ah)->ah_analog5GhzRev & 0xF0) !=
- AR_RAD5111_SREV_MAJOR &&
- (AH_PRIVATE(ah)->ah_analog5GhzRev & 0xF0) !=
- AR_RAD5112_SREV_MAJOR &&
- (AH_PRIVATE(ah)->ah_analog5GhzRev & 0xF0) !=
- AR_RAD2111_SREV_MAJOR &&
- (AH_PRIVATE(ah)->ah_analog5GhzRev & 0xF0) !=
- AR_RAD2112_SREV_MAJOR) {
- ath_hal_printf(ah, "%s: 5G Radio Chip Rev 0x%02X is not supported by "
- "this driver\n", __func__,
- AH_PRIVATE(ah)->ah_analog5GhzRev);
- ecode = HAL_ENOTSUPP;
+
+ rf = ath_hal_rfprobe(ah, &ecode);
+ if (rf == AH_NULL)
goto bad;
- }
-#endif
if (IS_RAD5112(ah) && !IS_RADX112_REV2(ah)) {
#ifdef AH_DEBUG
ath_hal_printf(ah, "%s: 5112 Rev 1 is not supported by this "
@@ -273,32 +251,7 @@ ar5312Attach(uint16_t devid, HAL_SOFTC sc,
goto bad;
}
- rfStatus = AH_FALSE;
- if (IS_2317(ah))
-#if defined AH_SUPPORT_2317
- rfStatus = ar2317RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- else if (IS_2316(ah))
-#if defined AH_SUPPORT_2316
- rfStatus = ar2316RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- else if (IS_RAD5112_ANY(ah))
-#ifdef AH_SUPPORT_5112
- rfStatus = ar5112RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- else if (IS_RAD5111(ah))
-#ifdef AH_SUPPORT_5111
- rfStatus = ar5111RfAttach(ah, &ecode);
-#else
- ecode = HAL_ENOTSUPP;
-#endif
- if (!rfStatus) {
+ if (!rf->attach(ah, &ecode)) {
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: RF setup failed, status %u\n",
__func__, ecode);
goto bad;
@@ -353,4 +306,29 @@ ar5312GetMacAddr(struct ath_hal *ah)
OS_MEMCPY(AH5212(ah)->ah_macaddr, macAddr, 6);
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR5312 */
+
+static const char*
+ar5312Probe(uint16_t vendorid, uint16_t devid)
+{
+ if (vendorid == ATHEROS_VENDOR_ID) {
+ switch (devid) {
+ case AR5212_AR5312_REV2:
+ case AR5212_AR5312_REV7:
+ return "Atheros 5312 WiSoC";
+ case AR5212_AR2313_REV8:
+ return "Atheros 2313 WiSoC";
+ case AR5212_AR2315_REV6:
+ case AR5212_AR2315_REV6:
+ case AR5212_AR2315_REV7:
+ return "Atheros 2315 WiSoC";
+ case AR5212_AR2317_REV1:
+ return "Atheros 2317 WiSoC";
+ case AR5212_AR2413:
+ return "Atheros 2413";
+ case AR5212_AR2417:
+ return "Atheros 2417";
+ }
+ }
+ return AH_NULL;
+}
+AH_CHIP(ar5312, ar5312Probe, ar5312Attach);
diff --git a/ar5416/ar2133.c b/ar5416/ar2133.c
index d966693..5d90b6e 100644
--- a/ar5416/ar2133.c
+++ b/ar5416/ar2133.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_2133
-
#include "ah.h"
#include "ah_internal.h"
@@ -466,4 +464,3 @@ ar2133RfAttach(struct ath_hal *ah, HAL_STATUS *status)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_2133 */
diff --git a/ar5416/ar5416_ani.c b/ar5416/ar5416_ani.c
index fbcab4d..59bfb20 100644
--- a/ar5416/ar5416_ani.c
+++ b/ar5416/ar5416_ani.c
@@ -18,7 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
/*
* XXX this is virtually the same code as for 5212; we reuse
* storage in the 5212 state block; need to refactor.
@@ -885,4 +884,3 @@ ar5416AniPoll(struct ath_hal *ah, const HAL_NODE_STATS *stats,
}
}
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_attach.c b/ar5416/ar5416_attach.c
index 49ebfa5..1d3c629 100644
--- a/ar5416/ar5416_attach.c
+++ b/ar5416/ar5416_attach.c
@@ -18,12 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
-#if !defined(AH_SUPPORT_2133)
-#error "No 5416 RF support defined"
-#endif
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -480,4 +474,13 @@ ar5416FillCapabilityInfo(struct ath_hal *ah)
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR5416 */
+
+static const char*
+ar5416Probe(uint16_t vendorid, uint16_t devid)
+{
+ if (vendorid == ATHEROS_VENDOR_ID &&
+ (devid == AR5416_DEVID_PCI || devid == AR5416_DEVID_PCIE))
+ return "Atheros 5416";
+ return AH_NULL;
+}
+AH_CHIP(ar5416, ar5416Probe, ar5416Attach);
diff --git a/ar5416/ar5416_beacon.c b/ar5416/ar5416_beacon.c
index ed3812d..1d68c68 100644
--- a/ar5416/ar5416_beacon.c
+++ b/ar5416/ar5416_beacon.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
@@ -246,4 +244,3 @@ ar5416SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *bs)
#undef BEACON_TIMEOUT_VAL
#undef SLEEP_SLOP
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_cal.c b/ar5416/ar5416_cal.c
index 1f2314b..49db049 100644
--- a/ar5416/ar5416_cal.c
+++ b/ar5416/ar5416_cal.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -29,9 +27,6 @@
#include "ar5416/ar5416.h"
#include "ar5416/ar5416reg.h"
#include "ar5416/ar5416phy.h"
-#ifdef AH_SUPPORT_AR9280
-#include "ar5416/ar9280.h"
-#endif
/* Owl specific stuff */
#define NUM_NOISEFLOOR_READINGS 6 /* 3 chains * (ctl + ext) */
@@ -666,4 +661,3 @@ ar5416GetNf(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *chan)
}
return nf;
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_cal_adcdc.c b/ar5416/ar5416_cal_adcdc.c
index 00948e2..2e580bd 100644
--- a/ar5416/ar5416_cal_adcdc.c
+++ b/ar5416/ar5416_cal_adcdc.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -111,4 +109,3 @@ ar5416AdcDcCalibration(struct ath_hal *ah, uint8_t numChains)
OS_REG_SET_BIT(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0),
AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE);
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_cal_adcgain.c b/ar5416/ar5416_cal_adcgain.c
index 9e8d861..ce38b03 100644
--- a/ar5416/ar5416_cal_adcgain.c
+++ b/ar5416/ar5416_cal_adcgain.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -116,4 +114,3 @@ ar5416AdcGainCalibration(struct ath_hal *ah, uint8_t numChains)
OS_REG_SET_BIT(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0),
AR_PHY_NEW_ADC_GAIN_CORR_ENABLE);
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_cal_iq.c b/ar5416/ar5416_cal_iq.c
index 7b9ca14..931249e 100644
--- a/ar5416/ar5416_cal_iq.c
+++ b/ar5416/ar5416_cal_iq.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -132,4 +130,3 @@ ar5416IQCalibration(struct ath_hal *ah, uint8_t numChains)
OS_REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4,
AR_PHY_TIMING_CTRL4_IQCORR_ENABLE);
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_eeprom.c b/ar5416/ar5416_eeprom.c
index 5c84e85..812159f 100644
--- a/ar5416/ar5416_eeprom.c
+++ b/ar5416/ar5416_eeprom.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -44,4 +42,3 @@ ar5416EepromRead(struct ath_hal *ah, u_int off, uint16_t *data)
AR_EEPROM_STATUS_DATA_VAL);
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_gpio.c b/ar5416/ar5416_gpio.c
index e47b48b..0aa2843 100644
--- a/ar5416/ar5416_gpio.c
+++ b/ar5416/ar5416_gpio.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -112,4 +110,3 @@ ar5416GpioSetIntr(struct ath_hal *ah, u_int gpio, uint32_t ilevel)
val |= AR_GPIO_BIT(gpio);
OS_REG_RMW_FIELD(ah, AR_INTR_ASYNC_MASK, AR_INTR_GPIO, val);
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_interrupts.c b/ar5416/ar5416_interrupts.c
index 406dc07..bef7522 100644
--- a/ar5416/ar5416_interrupts.c
+++ b/ar5416/ar5416_interrupts.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
@@ -259,4 +257,3 @@ ar5416SetInterrupts(struct ath_hal *ah, HAL_INT ints)
return omask;
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_keycache.c b/ar5416/ar5416_keycache.c
index 7fdb9cd..cb8ad71 100644
--- a/ar5416/ar5416_keycache.c
+++ b/ar5416/ar5416_keycache.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
@@ -66,4 +64,3 @@ ar5416SetKeyCacheEntry(struct ath_hal *ah, uint16_t entry,
} else
return AH_FALSE;
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_misc.c b/ar5416/ar5416_misc.c
index ce5f6bc..0ed704f 100644
--- a/ar5416/ar5416_misc.c
+++ b/ar5416/ar5416_misc.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -499,4 +497,3 @@ ar5416DetectBBHang(struct ath_hal *ah)
#undef N
}
#undef NUM_STATUS_READS
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_phy.c b/ar5416/ar5416_phy.c
index 0384d94..f8f5b2a 100644
--- a/ar5416/ar5416_phy.c
+++ b/ar5416/ar5416_phy.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
@@ -126,4 +124,3 @@ ar5416GetRateTable(struct ath_hal *ah, u_int mode)
ath_hal_setupratetable(ah, rt);
return rt;
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_power.c b/ar5416/ar5416_power.c
index b951cfd..b83b0f8 100644
--- a/ar5416/ar5416_power.c
+++ b/ar5416/ar5416_power.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
@@ -173,4 +171,3 @@ ar5416GetPowerMode(struct ath_hal *ah)
return HAL_PM_UNDEFINED;
}
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_recv.c b/ar5416/ar5416_recv.c
index 5701ec6..e888373 100644
--- a/ar5416/ar5416_recv.c
+++ b/ar5416/ar5416_recv.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_desc.h"
#include "ah_internal.h"
@@ -178,4 +176,3 @@ ar5416ProcRxDesc(struct ath_hal *ah, struct ath_desc *ds,
return HAL_OK;
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_reset.c b/ar5416/ar5416_reset.c
index b1717a6..74ba497 100644
--- a/ar5416/ar5416_reset.c
+++ b/ar5416/ar5416_reset.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -2895,4 +2893,3 @@ ar5416GetChannelCenters(struct ath_hal *ah,
centers->ext_center = chan->channel;
}
}
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar5416_xmit.c b/ar5416/ar5416_xmit.c
index 5789852..a0e2f14 100644
--- a/ar5416/ar5416_xmit.c
+++ b/ar5416/ar5416_xmit.c
@@ -18,8 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR5416
-
#include "ah.h"
#include "ah_desc.h"
#include "ah_internal.h"
@@ -698,4 +696,3 @@ ar5416Set11nBurstDuration(struct ath_hal *ah, struct ath_desc *ds,
ads->ds_ctl2 |= SM(burstDuration, AR_BurstDur);
}
#endif
-#endif /* AH_SUPPORT_AR5416 */
diff --git a/ar5416/ar9160_attach.c b/ar5416/ar9160_attach.c
index 373d773..0945d0b 100644
--- a/ar5416/ar9160_attach.c
+++ b/ar5416/ar9160_attach.c
@@ -18,15 +18,6 @@
*/
#include "opt_ah.h"
-#ifdef AH_SUPPORT_AR9160
-
-#if !defined(AH_SUPPORT_AR5416)
-#error "No 5416 support defined"
-#endif
-#if !defined(AH_SUPPORT_2133)
-#error "No 2133 RF support defined"
-#endif
-
#include "ah.h"
#include "ah_internal.h"
#include "ah_devid.h"
@@ -305,4 +296,12 @@ ar9160FillCapabilityInfo(struct ath_hal *ah)
pCap->halAutoSleepSupport = AH_FALSE; /* XXX? */
return AH_TRUE;
}
-#endif /* AH_SUPPORT_AR9160 */
+
+static const char*
+ar9160Probe(uint16_t vendorid, uint16_t devid)
+{
+ if (vendorid == ATHEROS_VENDOR_ID && devid == AR9160_DEVID_PCI)
+ return "Atheros 9160";
+ return AH_NULL;
+}
+AH_CHIP(ar9160, ar9160Probe, ar9160Attach);
OpenPOWER on IntegriCloud