xref: /haiku/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/glue.c (revision 62f5ba006a08b0df30631375878effaf67ae5dbc)
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/iwn/if_iwnreg.h>
19 #include <dev/iwn/if_iwnvar.h>
20 
21 
22 HAIKU_FBSD_WLAN_DRIVER_GLUE(iprowifi4965, iwn, pci)
23 NO_HAIKU_FBSD_MII_DRIVER();
24 NO_HAIKU_REENABLE_INTERRUPTS();
25 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
26 HAIKU_FIRMWARE_VERSION(44417);
27 HAIKU_FIRMWARE_NAME_MAP(1) = {{"iwnfw", "iwlwifi-4965-1.ucode"}};
28 
29 
30 int
31 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
32 {
33 	struct iwn_softc* sc = (struct iwn_softc*)device_get_softc(dev);
34 	uint32 r1, r2;
35 
36 	r1 = IWN_READ(sc, IWN_INTR);
37 	r2 = IWN_READ(sc, IWN_INTR_STATUS);
38 
39 	if (r1 == 0 && r2 == 0) {
40 		// not for us
41 		IWN_WRITE(sc, IWN_MASK, IWN_INTR_MASK);
42 		return 0;
43 	}
44 
45 	if (r1 == 0xffffffff) {
46 		// hardware gone
47 		return 0;
48 	}
49 
50 	atomic_set((int32*)&sc->sc_intr_status_1, r1);
51 	atomic_set((int32*)&sc->sc_intr_status_2, r2);
52 
53 	IWN_WRITE(sc, IWN_MASK, 0);
54 		// disable interrupts
55 
56 	return 1;
57 }
58