vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / drivers / network / wlan / iprowifi2200 / glue.c
blob8eca0d0851ec0fe6e01a1a1c93ebde22a34edd8f
1 /*
2 * Copyright 2009, Colin Günther, coling@gmx.de.
3 * All Rights Reserved. Distributed under the terms of the MIT License.
4 */
7 #include <sys/bus.h>
8 #include <sys/kernel.h>
10 #include <machine/bus.h>
12 #include <net/if.h>
13 #include <net/if_media.h>
15 #include <net80211/ieee80211_var.h>
17 #include <dev/iwi/if_iwireg.h>
18 #include <dev/iwi/if_iwivar.h>
21 HAIKU_FBSD_WLAN_DRIVER_GLUE(iprowifi2200, iwi, pci)
22 NO_HAIKU_FBSD_MII_DRIVER();
23 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
24 HAIKU_FIRMWARE_VERSION(300);
25 HAIKU_FIRMWARE_NAME_MAP(3) = {{"iwi_bss", "ipw2200-bss.fw"},
26 {"iwi_ibss", "ipw2200-ibss.fw"}, {"iwi_monitor", "ipw2200-sniffer.fw"}};
29 int
30 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
32 struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
33 uint32 r;
35 r = CSR_READ_4(sc, IWI_CSR_INTR);
36 if (r == 0 || r == 0xffffffff)
37 return 0;
39 atomic_set((int32*)&sc->sc_intr_status, r);
41 CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, 0);
42 // disable interrupts
43 return 1;
47 void
48 HAIKU_REENABLE_INTERRUPTS(device_t dev)
50 struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
52 CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, IWI_INTR_MASK);
53 // reenable interrupts