summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@openbsd.org>2006-01-18 20:25:22 +0000
committerdamien <damien@openbsd.org>2006-01-18 20:25:22 +0000
commit149119bec8d15fdfa54d22f5b74607540ee7f053 (patch)
treebe39de1612c69dcc9451f1207496fc71c11ab410
parentDon't index before the start of the sc_link array if scsi_probe_bus() (diff)
downloadwireguard-openbsd-149119bec8d15fdfa54d22f5b74607540ee7f053.tar.xz
wireguard-openbsd-149119bec8d15fdfa54d22f5b74607540ee7f053.zip
add some bits to control assoc led.
-rw-r--r--sys/dev/pci/if_iwi.c35
-rw-r--r--sys/dev/pci/if_iwireg.h13
2 files changed, 35 insertions, 13 deletions
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c
index 66370b0cdad..8e64d5392cb 100644
--- a/sys/dev/pci/if_iwi.c
+++ b/sys/dev/pci/if_iwi.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: if_iwi.c,v 1.56 2006/01/04 06:04:41 canacar Exp $ */
+/* $OpenBSD: if_iwi.c,v 1.57 2006/01/18 20:25:22 damien Exp $ */
/*-
- * Copyright (c) 2004, 2005
+ * Copyright (c) 2004-2006
* Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -665,6 +665,10 @@ int
iwi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
{
struct iwi_softc *sc = ic->ic_softc;
+ enum ieee80211_state ostate;
+ u_int32_t tmp;
+
+ ostate = ic->ic_state;
switch (nstate) {
case IEEE80211_S_SCAN:
@@ -681,10 +685,22 @@ iwi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
ieee80211_new_state(ic, IEEE80211_S_AUTH, -1);
} else if (ic->ic_opmode == IEEE80211_M_MONITOR)
iwi_set_chan(sc, ic->ic_ibss_chan);
+
+ /* assoc led on */
+ tmp = MEM_READ_4(sc, IWI_MEM_EVENT_CTL) & IWI_LED_MASK;
+ MEM_WRITE_4(sc, IWI_MEM_EVENT_CTL, tmp | IWI_LED_ASSOC);
break;
- case IEEE80211_S_ASSOC:
case IEEE80211_S_INIT:
+ if (ostate != IEEE80211_S_RUN)
+ break;
+
+ /* assoc led off */
+ tmp = MEM_READ_4(sc, IWI_MEM_EVENT_CTL) & IWI_LED_MASK;
+ MEM_WRITE_4(sc, IWI_MEM_EVENT_CTL, tmp & ~IWI_LED_ASSOC);
+ break;
+
+ case IEEE80211_S_ASSOC:
break;
}
@@ -1493,9 +1509,9 @@ iwi_load_ucode(struct iwi_softc *sc, const char *name)
DELAY(5000);
MEM_WRITE_4(sc, 0x3000e0, 0);
DELAY(1000);
- MEM_WRITE_4(sc, 0x300004, 1);
+ MEM_WRITE_4(sc, IWI_MEM_EVENT_CTL, 1);
DELAY(1000);
- MEM_WRITE_4(sc, 0x300004, 0);
+ MEM_WRITE_4(sc, IWI_MEM_EVENT_CTL, 0);
DELAY(1000);
MEM_WRITE_1(sc, 0x200000, 0x00);
MEM_WRITE_1(sc, 0x200000, 0x40);
@@ -2082,12 +2098,15 @@ iwi_stop(struct ifnet *ifp, int disable)
struct iwi_tx_buf *buf;
int i;
- iwi_stop_master(sc);
- CSR_WRITE_4(sc, IWI_CSR_RST, IWI_RST_SW_RESET);
+ ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
+ sc->sc_tx_timer = 0;
ifp->if_timer = 0;
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ iwi_stop_master(sc);
+ CSR_WRITE_4(sc, IWI_CSR_RST, IWI_RST_SW_RESET);
+
/*
* Release Tx buffers
*/
@@ -2105,8 +2124,6 @@ iwi_stop(struct ifnet *ifp, int disable)
}
}
}
-
- ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
}
struct cfdriver iwi_cd = {
diff --git a/sys/dev/pci/if_iwireg.h b/sys/dev/pci/if_iwireg.h
index 98c6ef29d75..8771523a35b 100644
--- a/sys/dev/pci/if_iwireg.h
+++ b/sys/dev/pci/if_iwireg.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: if_iwireg.h,v 1.17 2005/10/06 20:33:39 damien Exp $ */
+/* $OpenBSD: if_iwireg.h,v 1.18 2006/01/18 20:25:22 damien Exp $ */
/*-
- * Copyright (c) 2004, 2005
+ * Copyright (c) 2004-2006
* Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -379,9 +379,14 @@ struct iwi_wep_key {
u_int8_t key[IEEE80211_KEYBUF_SIZE];
} __packed;
-/* EEPROM = Electrically Erasable Programmable Read-Only Memory */
-
#define IWI_MEM_EEPROM_CTL 0x00300040
+#define IWI_MEM_EVENT_CTL 0x00300004
+
+/* possible flags for register IWI_MEM_EVENT */
+#define IWI_LED_ASSOC (1 << 5)
+#define IWI_LED_MASK 0xd9fffffb
+
+/* EEPROM = Electrically Erasable Programmable Read-Only Memory */
#define IWI_EEPROM_MAC 0x21