1/*
2 * Copyright 2009, Colin G��nther, coling@gmx.de.
3 * All Rights Reserved. Distributed under the terms of the MIT License.
4 */
5
6
7#include <sys/bus.h>
8#include <sys/kernel.h>
9
10#include <net/if.h>
11#include <net/if_media.h>
12
13#include <net80211/ieee80211_var.h>
14
15#include <machine/bus.h>
16
17#include <dev/mwl/if_mwlvar.h>
18
19
20HAIKU_FBSD_WLAN_DRIVER_GLUE(marvell88w8363, mwl, pci)
21HAIKU_DRIVER_REQUIREMENTS(FBSD_WLAN);
22HAIKU_FIRMWARE_VERSION(0);
23
24NO_HAIKU_FBSD_MII_DRIVER();
25NO_HAIKU_FIRMWARE_NAME_MAP();
26
27
28int
29HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
30{
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;
34
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;
39	}
40
41	mwl_hal_getisr(mh, &intr_status);
42		// NB: clears ISR too
43
44	if (intr_status == 0) {
45		// must be a shared irq
46		return 0;
47	}
48
49	atomic_set((int32*)&sc->sc_intr_status, intr_status);
50
51	mwl_hal_intrset(mh, 0);
52		// disable further intr's
53	return 1;
54}
55
56
57void
58HAIKU_REENABLE_INTERRUPTS(device_t dev)
59{
60	struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
61	struct mwl_hal* mh = sc->sc_mh;
62
63	mwl_hal_intrset(mh, sc->sc_imask);
64}
65