summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2007-04-01 19:15:49 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2007-04-01 19:15:49 +0000
commit3d563be4c67fbd26e18a8d16eee962b010e468a8 (patch)
tree8e2c9f201e6da8be33f27087912f3a43d544a74a /sys/dev/ic
parente88dc7c81a615d3c4fee150ab9252f155cab9785 (diff)
Write MAC and BSSID into devices template RAM at init time.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/bcw.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/sys/dev/ic/bcw.c b/sys/dev/ic/bcw.c
index 3a0ae570c8e..b5dfa699671 100644
--- a/sys/dev/ic/bcw.c
+++ b/sys/dev/ic/bcw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcw.c,v 1.85 2007/04/01 12:16:28 mglocker Exp $ */
+/* $OpenBSD: bcw.c,v 1.86 2007/04/01 19:15:48 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -101,6 +101,7 @@ void bcw_set_opmode(struct ifnet *);
void bcw_macfilter_set(struct bcw_softc *, uint16_t,
const uint8_t *);
void bcw_macfilter_clear(struct bcw_softc *, uint16_t);
+void bcw_templateram_set(struct bcw_softc *);
void bcw_mac_enable(struct bcw_softc *);
void bcw_mac_disable(struct bcw_softc *);
uint32_t bcw_intr_enable(struct bcw_softc *, uint32_t);
@@ -1368,6 +1369,33 @@ bcw_macfilter_clear(struct bcw_softc *sc, uint16_t offset)
}
/*
+ * Write MAC and BSSID into template RAM
+ *
+ * http://bcm-specs.sipsolutions.net/TemplateRam
+ */
+void
+bcw_templateram_set(struct bcw_softc *sc)
+{
+ struct ieee80211com *ic = &sc->sc_ic;
+ uint8_t mac_bssid[ETHER_ADDR_LEN * 2];
+ int i;
+
+ bcopy(ic->ic_myaddr, mac_bssid, ETHER_ADDR_LEN);
+ bcopy(ic->ic_bss->ni_bssid, mac_bssid + ETHER_ADDR_LEN, ETHER_ADDR_LEN);
+
+ /*
+ * We write our MAC and BSSID at three different addresses in the
+ * template RAM, in 4 byte blocks.
+ */
+ for (i = 0; i < sizeof(mac_bssid); i += sizeof(uint32_t))
+ bcw_ram_write(sc, 0x20 + i, *((int32_t *)(mac_bssid + i)));
+ for (i = 0; i < sizeof(mac_bssid); i += sizeof(uint32_t))
+ bcw_ram_write(sc, 0x78 + i, *((int32_t *)(mac_bssid + i)));
+ for (i = 0; i < sizeof(mac_bssid); i += sizeof(uint32_t))
+ bcw_ram_write(sc, 0x478 + i, *((int32_t *)(mac_bssid + i)));
+}
+
+/*
* Enable MAC on a PHY
*
* http://bcm-specs.sipsolutions.net/EnableMAC
@@ -2801,8 +2829,14 @@ bcw_chip_init(struct bcw_softc *sc)
bcw_shm_write16(sc, BCW_SHM_SHARED, 0x0044, 3);
bcw_shm_write16(sc, BCW_SHM_SHARED, 0x0046, 2);
+ bcw_macfilter_clear(sc, BCW_MACFILTER_SELF);
bcw_macfilter_set(sc, BCW_MACFILTER_SELF, ic->ic_myaddr);
+ bcw_macfilter_clear(sc, BCW_MACFILTER_ASSOC);
+ bcw_macfilter_set(sc, BCW_MACFILTER_ASSOC, ic->ic_bss->ni_bssid);
+
+ bcw_templateram_set(sc);
+
DPRINTF(("%s: Chip initialized\n", sc->sc_dev.dv_xname));
return (0);