vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / drivers / network / wlan / marvell88w8363 / glue.c
blobbe6602a06799982e04b258f6a8cd66e546a45415
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 <net/if.h>
11 #include <net/if_media.h>
13 #include <net80211/ieee80211_var.h>
15 #include <machine/bus.h>
17 #include <dev/mwl/if_mwlvar.h>
20 HAIKU_FBSD_WLAN_DRIVER_GLUE(marvell88w8363, mwl, pci)
21 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
22 HAIKU_FIRMWARE_VERSION(0);
24 NO_HAIKU_FBSD_MII_DRIVER();
25 NO_HAIKU_FIRMWARE_NAME_MAP();
28 int
29 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
31 struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
32 struct mwl_hal* mh = sc->sc_mh;
33 uint32_t intr_status;
35 if (sc->sc_invalid) {
36 // The hardware is not ready/present, don't touch anything.
37 // Note this can happen early on if the IRQ is shared.
38 return 0;
41 mwl_hal_getisr(mh, &intr_status);
42 // NB: clears ISR too
44 if (intr_status == 0) {
45 // must be a shared irq
46 return 0;
49 atomic_set((int32*)&sc->sc_intr_status, intr_status);
51 mwl_hal_intrset(mh, 0);
52 // disable further intr's
53 return 1;
57 void
58 HAIKU_REENABLE_INTERRUPTS(device_t dev)
60 struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
61 struct mwl_hal* mh = sc->sc_mh;
63 mwl_hal_intrset(mh, sc->sc_imask);