xref: /haiku/src/add-ons/kernel/drivers/network/wlan/broadcom43xx/glue.c (revision 9563f44bfd75799f67201067483694e82b5779b9)
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 <machine/bus.h>
11 
12 #include <net/if.h>
13 #include <net/if_media.h>
14 
15 #include <net80211/ieee80211_var.h>
16 #include <net80211/ieee80211_amrr.h>
17 
18 #include <dev/bwi/bitops.h>
19 #include <dev/bwi/if_bwireg.h>
20 #include <dev/bwi/if_bwivar.h>
21 
22 
23 HAIKU_FBSD_WLAN_DRIVER_GLUE(broadcom43xx, bwi, pci)
24 NO_HAIKU_FBSD_MII_DRIVER();
25 NO_HAIKU_REENABLE_INTERRUPTS();
26 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
27 HAIKU_FIRMWARE_VERSION(0);
28 
29 
30 int
31 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
32 {
33 	struct bwi_softc* sc = (struct bwi_softc*)device_get_softc(dev);
34 	struct ifnet* ifp = sc->sc_ifp;
35 	uint32 intr_status;
36 
37 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0
38 		|| (sc->sc_flags & BWI_F_STOP))
39 		return 0;
40 
41 	intr_status = CSR_READ_4(sc, BWI_MAC_INTR_STATUS);
42 	if (intr_status == 0xffffffff) {
43 		// Not for us
44 		return 0;
45 	}
46 
47 	atomic_set((int32*)&sc->sc_intr_status, intr_status);
48 
49 	CSR_CLRBITS_4(sc, BWI_MAC_INTR_MASK, BWI_ALL_INTRS);
50 		// Disable all interrupts
51 
52 	return 1;
53 }
54