vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / drivers / network / wlan / iprowifi3945 / glue.c
blobf989844692fd609d016c28bd29b3fe3639b0f0bd
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/wpi/if_wpireg.h>
18 #include <dev/wpi/if_wpivar.h>
21 HAIKU_FBSD_WLAN_DRIVER_GLUE(iprowifi3945, wpi, pci)
22 NO_HAIKU_FBSD_MII_DRIVER();
23 NO_HAIKU_REENABLE_INTERRUPTS();
24 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
25 HAIKU_FIRMWARE_VERSION(2144);
26 HAIKU_FIRMWARE_NAME_MAP(1) = {{"wpifw", "iwlwifi-3945-2.ucode"}};
29 int
30 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
32 struct wpi_softc* sc = (struct wpi_softc*)device_get_softc(dev);
33 uint32 r;
35 if ((r = WPI_READ(sc, WPI_INTR)) == 0 || r == 0xffffffff)
36 return 0;
38 atomic_set((int32*)&sc->sc_intr_status, r);
40 WPI_WRITE(sc, WPI_MASK, 0);
41 // disable interrupts
43 return 1;