summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2004-11-08 16:48:26 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2004-11-08 16:48:26 +0000
commitbaec5f1eb175d1cad227138d68e1810ee1d35662 (patch)
tree77b955518f5d2439c3c3a2d1fd1d103e9a28a9ba /sys/dev
parent8e524ce584ae912c792c4ceaa25dcc09ea093461 (diff)
use __packed instead of __attribute__ ((__packed__)) (ok miod@), check
possible NULL mac in the keycache function.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/ar5210.c21
-rw-r--r--sys/dev/ic/ar5210var.h10
-rw-r--r--sys/dev/ic/ar5xxx.h4
3 files changed, 19 insertions, 16 deletions
diff --git a/sys/dev/ic/ar5210.c b/sys/dev/ic/ar5210.c
index 6c678942542..48e552a4c82 100644
--- a/sys/dev/ic/ar5210.c
+++ b/sys/dev/ic/ar5210.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5210.c,v 1.4 2004/11/03 16:40:46 reyk Exp $ */
+/* $OpenBSD: ar5210.c,v 1.5 2004/11/08 16:48:25 reyk Exp $ */
/*
* Copyright (c) 2004 Reyk Floeter <reyk@vantronix.net>.
@@ -1823,7 +1823,7 @@ ar5k_ar5210_resetKeyCacheEntry(hal, entry)
AR5K_ASSERT_ENTRY(entry, AR5K_AR5210_KEYTABLE_SIZE);
for (i = 0; i < AR5K_AR5210_KEYCACHE_SIZE; i++)
- AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (i * 4), 0);
+ AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (i << 2), 0);
return (AH_FALSE);
}
@@ -1840,7 +1840,7 @@ ar5k_ar5210_isKeyCacheEntryValid(hal, entry)
/*
* Check the validation flag at the end of the entry
*/
- offset = (AR5K_AR5210_KEYCACHE_SIZE - 1) * 4;
+ offset = (AR5K_AR5210_KEYCACHE_SIZE - 1) << 2;
if (AR5K_REG_READ(AR5K_AR5210_KEYTABLE(entry) + offset) &
AR5K_AR5210_KEYTABLE_VALID)
return AH_TRUE;
@@ -1903,7 +1903,7 @@ ar5k_ar5210_setKeyCacheEntry(hal, entry, keyval, mac, xor_notused)
}
/* Write value */
- AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (i * 4), key_v[i]);
+ AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (i << 2), key_v[i]);
}
return (ar5k_ar5210_setKeyCacheEntryMac(hal, entry, mac));
@@ -1924,16 +1924,19 @@ ar5k_ar5210_setKeyCacheEntryMac(hal, entry, mac)
AR5K_ASSERT_ENTRY(entry, AR5K_AR5210_KEYTABLE_SIZE);
offset = AR5K_AR5210_KEYCACHE_SIZE - 2;
+ low_id = high_id = 0;
- /* XXX big endian problems? */
- bcopy(mac, &low_id, 4);
- bcopy(mac + 4, &high_id, 2);
+ /* MAC may be NULL if it's a broadcast key */
+ if (mac != NULL) {
+ bcopy(mac, &low_id, 4);
+ bcopy(mac + 4, &high_id, 2);
+ }
high_id = 0x0000ffff & htole32(high_id);
- AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (offset++ * 4),
+ AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (offset++ << 2),
htole32(low_id));
- AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (offset * 4), high_id);
+ AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE(entry) + (offset << 2), high_id);
return (AH_TRUE);
}
diff --git a/sys/dev/ic/ar5210var.h b/sys/dev/ic/ar5210var.h
index 8a8a2ac4092..604cb888f60 100644
--- a/sys/dev/ic/ar5210var.h
+++ b/sys/dev/ic/ar5210var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5210var.h,v 1.3 2004/11/03 16:40:46 reyk Exp $ */
+/* $OpenBSD: ar5210var.h,v 1.4 2004/11/08 16:48:25 reyk Exp $ */
/*
* Copyright (c) 2004 Reyk Floeter <reyk@vantronix.net>.
@@ -70,7 +70,7 @@ struct ar5k_ar5210_rx_desc {
u_int32_t r2:1;
u_int32_t inter_req:1;
u_int32_t r3:18;
-} __attribute__ ((__packed__));
+} __packed;
struct ar5k_ar5210_rx_status {
/*
@@ -98,7 +98,7 @@ struct ar5k_ar5210_rx_status {
u_int32_t receive_timestamp:13;
u_int32_t key_cache_miss:1;
u_int32_t r3:3;
-} __attribute__ ((__packed__));
+} __packed;
#define AR5K_AR5210_DESC_RX_PHY_ERROR_NONE 0x00
#define AR5K_AR5210_DESC_RX_PHY_ERROR_TIMING 0x20
@@ -132,7 +132,7 @@ struct ar5k_ar5210_tx_desc {
u_int32_t more:1;
u_int32_t encrypt_key_index:6;
u_int32_t rts_duration:13;
-} __attribute__ ((__packed__));
+} __packed;
#define AR5K_AR5210_DESC_TX_XMIT_RATE_6 0xb
#define AR5K_AR5210_DESC_TX_XMIT_RATE_9 0xf
@@ -169,7 +169,7 @@ struct ar5k_ar5210_tx_status {
u_int32_t seq_num:12;
u_int32_t ack_sig_strength:8;
u_int32_t r2:11;
-} __attribute__ ((__packed__));
+} __packed;
/*
* Public function prototypes
diff --git a/sys/dev/ic/ar5xxx.h b/sys/dev/ic/ar5xxx.h
index 212eec26af8..39b51a6fbc8 100644
--- a/sys/dev/ic/ar5xxx.h
+++ b/sys/dev/ic/ar5xxx.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5xxx.h,v 1.3 2004/11/03 16:40:46 reyk Exp $ */
+/* $OpenBSD: ar5xxx.h,v 1.4 2004/11/08 16:48:25 reyk Exp $ */
/*
* Copyright (c) 2004 Reyk Floeter <reyk@vantronix.net>.
@@ -559,7 +559,7 @@ struct ath_desc {
#define ds_rxstat ds_us.rx
#define ds_txstat ds_us.tx
-} __attribute__((__packed__));
+} __packed;
#define HAL_RXDESC_INTREQ 0x0020