xref: /haiku/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/glue.c (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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(8) = {
28 	{"iwn1000fw", "iwlwifi-1000-5.ucode"},
29 	{"iwn4965fw", "iwlwifi-4965-2.ucode"},
30 	{"iwn5000fw", "iwlwifi-5000-5.ucode"},
31 	{"iwn5150fw", "iwlwifi-5150-2.ucode"},
32 	{"iwn6000fw", "iwlwifi-6000-4.ucode"},
33 	{"iwn6000g2afw", "iwlwifi-6000g2a-5.ucode"},
34 	{"iwn6000g2bfw", "iwlwifi-6000g2b-6.ucode"},
35 	{"iwn6050fw", "iwlwifi-6050-5.ucode"}
36 };
37 
38 
39 int
40 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
41 {
42 	struct iwn_softc* sc = (struct iwn_softc*)device_get_softc(dev);
43 	uint32 r1, r2;
44 
45 	r1 = IWN_READ(sc, IWN_INT);
46 	r2 = IWN_READ(sc, IWN_FH_INT);
47 
48 	if (r1 == 0 && r2 == 0) {
49 		// not for us
50 		IWN_WRITE(sc, IWN_INT_MASK, sc->int_mask);
51 		return 0;
52 	}
53 
54 	if (r1 == 0xffffffff) {
55 		// hardware gone
56 		return 0;
57 	}
58 
59 	atomic_set((int32*)&sc->sc_intr_status_1, r1);
60 	atomic_set((int32*)&sc->sc_intr_status_2, r2);
61 
62 	IWN_WRITE(sc, IWN_INT_MASK, 0);
63 		// disable interrupts
64 
65 	return 1;
66 }
67