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