summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/ar5210.c20
-rw-r--r--sys/dev/ic/ar5211.c20
-rw-r--r--sys/dev/ic/ar5212.c20
-rw-r--r--sys/dev/ic/ar5xxx.h7
4 files changed, 33 insertions, 34 deletions
diff --git a/sys/dev/ic/ar5210.c b/sys/dev/ic/ar5210.c
index 1225efd50d7..1493cd76a86 100644
--- a/sys/dev/ic/ar5210.c
+++ b/sys/dev/ic/ar5210.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5210.c,v 1.36 2007/03/05 16:54:33 deraadt Exp $ */
+/* $OpenBSD: ar5210.c,v 1.37 2007/03/12 00:41:32 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
@@ -473,8 +473,8 @@ ar5k_ar5210_set_opmode(struct ath_hal *hal)
/*
* Set PCU and BCR registers
*/
- bcopy(&(hal->ah_sta_id[0]), &low_id, 4);
- bcopy(&(hal->ah_sta_id[4]), &high_id, 2);
+ low_id = AR5K_LOW_ID(hal->ah_sta_id);
+ high_id = AR5K_HIGH_ID(hal->ah_sta_id);
AR5K_REG_WRITE(AR5K_AR5210_STA_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5210_STA_ID1, pcu_reg | high_id);
AR5K_REG_WRITE(AR5K_AR5210_BCR, beacon_reg);
@@ -1445,9 +1445,8 @@ ar5k_ar5210_set_lladdr(struct ath_hal *hal, const u_int8_t *mac)
/* Set new station ID */
bcopy(mac, hal->ah_sta_id, IEEE80211_ADDR_LEN);
- bcopy(mac, &low_id, 4);
- bcopy(mac + 4, &high_id, 2);
- high_id = 0x0000ffff & high_id;
+ low_id = AR5K_LOW_ID(mac);
+ high_id = 0x0000ffff & AR5K_HIGH_ID(mac);
AR5K_REG_WRITE(AR5K_AR5210_STA_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5210_STA_ID1, high_id);
@@ -1514,8 +1513,8 @@ ar5k_ar5210_set_associd(struct ath_hal *hal, const u_int8_t *bssid,
/*
* Set BSSID which triggers the "SME Join" operation
*/
- bcopy(bssid, &low_id, 4);
- bcopy(bssid + 4, &high_id, 2);
+ low_id = AR5K_LOW_ID(bssid);
+ high_id = AR5K_HIGH_ID(bssid);
AR5K_REG_WRITE(AR5K_AR5210_BSS_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5210_BSS_ID1, high_id |
((assoc_id & 0x3fff) << AR5K_AR5210_BSS_ID1_AID_S));
@@ -1843,9 +1842,8 @@ ar5k_ar5210_set_key_lladdr(struct ath_hal *hal, u_int16_t entry,
/* MAC may be NULL if it's a broadcast key */
mac_v = mac == NULL ? etherbroadcastaddr : mac;
- bcopy(mac_v, &low_id, 4);
- bcopy(mac_v + 4, &high_id, 2);
- high_id |= AR5K_AR5210_KEYTABLE_VALID;
+ low_id = AR5K_LOW_ID(mac_v);
+ high_id = AR5K_HIGH_ID(mac_v) | AR5K_AR5210_KEYTABLE_VALID;
AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE_MAC0(entry), low_id);
AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE_MAC1(entry), high_id);
diff --git a/sys/dev/ic/ar5211.c b/sys/dev/ic/ar5211.c
index 4d7e39f57fa..56636ce5825 100644
--- a/sys/dev/ic/ar5211.c
+++ b/sys/dev/ic/ar5211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5211.c,v 1.31 2007/03/05 16:54:33 deraadt Exp $ */
+/* $OpenBSD: ar5211.c,v 1.32 2007/03/12 00:41:32 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
@@ -673,8 +673,8 @@ ar5k_ar5211_set_opmode(struct ath_hal *hal)
/*
* Set PCU registers
*/
- bcopy(&(hal->ah_sta_id[0]), &low_id, 4);
- bcopy(&(hal->ah_sta_id[4]), &high_id, 2);
+ low_id = AR5K_LOW_ID(hal->ah_sta_id);
+ high_id = AR5K_HIGH_ID(hal->ah_sta_id);
AR5K_REG_WRITE(AR5K_AR5211_STA_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5211_STA_ID1, pcu_reg | high_id);
@@ -1540,9 +1540,8 @@ ar5k_ar5211_set_lladdr(struct ath_hal *hal, const u_int8_t *mac)
/* Set new station ID */
bcopy(mac, hal->ah_sta_id, IEEE80211_ADDR_LEN);
- bcopy(mac, &low_id, 4);
- bcopy(mac + 4, &high_id, 2);
- high_id = 0x0000ffff & high_id;
+ low_id = AR5K_LOW_ID(mac);
+ high_id = 0x0000ffff & AR5K_HIGH_ID(mac);
AR5K_REG_WRITE(AR5K_AR5211_STA_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5211_STA_ID1, high_id);
@@ -1616,8 +1615,8 @@ ar5k_ar5211_set_associd(struct ath_hal *hal, const u_int8_t *bssid,
/*
* Set BSSID which triggers the "SME Join" operation
*/
- bcopy(bssid, &low_id, 4);
- bcopy(bssid + 4, &high_id, 2);
+ low_id = AR5K_LOW_ID(bssid);
+ high_id = AR5K_HIGH_ID(bssid);
AR5K_REG_WRITE(AR5K_AR5211_BSS_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5211_BSS_ID1, high_id |
((assoc_id & 0x3fff) << AR5K_AR5211_BSS_ID1_AID_S));
@@ -1948,9 +1947,8 @@ ar5k_ar5211_set_key_lladdr(struct ath_hal *hal, u_int16_t entry,
/* MAC may be NULL if it's a broadcast key */
mac_v = mac == NULL ? etherbroadcastaddr : mac;
- bcopy(mac_v, &low_id, 4);
- bcopy(mac_v + 4, &high_id, 2);
- high_id |= AR5K_AR5211_KEYTABLE_VALID;
+ low_id = AR5K_LOW_ID(mac_v);
+ high_id = AR5K_HIGH_ID(mac_v) | AR5K_AR5211_KEYTABLE_VALID;
AR5K_REG_WRITE(AR5K_AR5211_KEYTABLE_MAC0(entry), low_id);
AR5K_REG_WRITE(AR5K_AR5211_KEYTABLE_MAC1(entry), high_id);
diff --git a/sys/dev/ic/ar5212.c b/sys/dev/ic/ar5212.c
index cfa0c2ce375..f25e577eed7 100644
--- a/sys/dev/ic/ar5212.c
+++ b/sys/dev/ic/ar5212.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5212.c,v 1.37 2007/03/05 16:54:33 deraadt Exp $ */
+/* $OpenBSD: ar5212.c,v 1.38 2007/03/12 00:41:32 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
@@ -821,8 +821,8 @@ ar5k_ar5212_set_opmode(struct ath_hal *hal)
/*
* Set PCU registers
*/
- bcopy(&(hal->ah_sta_id[0]), &low_id, 4);
- bcopy(&(hal->ah_sta_id[4]), &high_id, 2);
+ low_id = AR5K_LOW_ID(hal->ah_sta_id);
+ high_id = AR5K_HIGH_ID(hal->ah_sta_id);
AR5K_REG_WRITE(AR5K_AR5212_STA_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5212_STA_ID1, pcu_reg | high_id);
@@ -1822,9 +1822,8 @@ ar5k_ar5212_set_lladdr(struct ath_hal *hal, const u_int8_t *mac)
/* Set new station ID */
bcopy(mac, hal->ah_sta_id, IEEE80211_ADDR_LEN);
- bcopy(mac, &low_id, 4);
- bcopy(mac + 4, &high_id, 2);
- high_id = 0x0000ffff & high_id;
+ low_id = AR5K_LOW_ID(mac);
+ high_id = 0x0000ffff & AR5K_HIGH_ID(mac);
AR5K_REG_WRITE(AR5K_AR5212_STA_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5212_STA_ID1, high_id);
@@ -1904,8 +1903,8 @@ ar5k_ar5212_set_associd(struct ath_hal *hal, const u_int8_t *bssid,
/*
* Set BSSID which triggers the "SME Join" operation
*/
- bcopy(bssid, &low_id, 4);
- bcopy(bssid + 4, &high_id, 2);
+ low_id = AR5K_LOW_ID(bssid);
+ high_id = AR5K_HIGH_ID(bssid);
AR5K_REG_WRITE(AR5K_AR5212_BSS_ID0, low_id);
AR5K_REG_WRITE(AR5K_AR5212_BSS_ID1, high_id |
((assoc_id & 0x3fff) << AR5K_AR5212_BSS_ID1_AID_S));
@@ -2280,9 +2279,8 @@ ar5k_ar5212_set_key_lladdr(struct ath_hal *hal, u_int16_t entry,
/* MAC may be NULL if it's a broadcast key */
mac_v = mac == NULL ? etherbroadcastaddr : mac;
- bcopy(mac_v, &low_id, 4);
- bcopy(mac_v + 4, &high_id, 2);
- high_id |= AR5K_AR5212_KEYTABLE_VALID;
+ low_id = AR5K_LOW_ID(mac_v);
+ high_id = AR5K_HIGH_ID(mac_v) | AR5K_AR5212_KEYTABLE_VALID;
AR5K_REG_WRITE(AR5K_AR5212_KEYTABLE_MAC0(entry), low_id);
AR5K_REG_WRITE(AR5K_AR5212_KEYTABLE_MAC1(entry), high_id);
diff --git a/sys/dev/ic/ar5xxx.h b/sys/dev/ic/ar5xxx.h
index d617a2ac9c7..a602263f76a 100644
--- a/sys/dev/ic/ar5xxx.h
+++ b/sys/dev/ic/ar5xxx.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5xxx.h,v 1.37 2007/03/05 16:54:33 deraadt Exp $ */
+/* $OpenBSD: ar5xxx.h,v 1.38 2007/03/12 00:41:32 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
@@ -1405,6 +1405,11 @@ typedef HAL_BOOL (ar5k_rfgain_t)
_reg &= ~(1 << _queue); \
} while (0)
+#define AR5K_LOW_ID(_a) ( \
+ (_a)[0] | (_a)[1] << 8 | (_a)[2] << 16 | (_a)[3] << 24 \
+)
+#define AR5K_HIGH_ID(_a) ((_a)[4] | (_a)[5] << 8)
+
/*
* Unaligned little endian access
*/