xref: /haiku/src/add-ons/kernel/drivers/network/wlan/iprowifi4965/glue.c (revision 323b65468e5836bb27a5e373b14027d902349437)
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(7) = {
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 	{"iwn6005fw", "iwlwifi-6000g2a-5.ucode"},
34 	{"iwn6050fw", "iwlwifi-6050-5.ucode"}
35 };
36 
37 
38 int
39 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
40 {
41 	struct iwn_softc* sc = (struct iwn_softc*)device_get_softc(dev);
42 	uint32 r1, r2;
43 
44 	r1 = IWN_READ(sc, IWN_INT);
45 	r2 = IWN_READ(sc, IWN_FH_INT);
46 
47 	if (r1 == 0 && r2 == 0) {
48 		// not for us
49 		IWN_WRITE(sc, IWN_INT_MASK, sc->int_mask);
50 		return 0;
51 	}
52 
53 	if (r1 == 0xffffffff) {
54 		// hardware gone
55 		return 0;
56 	}
57 
58 	atomic_set((int32*)&sc->sc_intr_status_1, r1);
59 	atomic_set((int32*)&sc->sc_intr_status_2, r2);
60 
61 	IWN_WRITE(sc, IWN_INT_MASK, 0);
62 		// disable interrupts
63 
64 	return 1;
65 }
66