1 /* 2 * Copyright 2009, Colin Günther, coling@gmx.de. All rights reserved. 3 * Copyright 2018, Haiku, Inc. All rights reserved. 4 * Distributed under the terms of the MIT license. 5 */ 6 7 8 #include <sys/bus.h> 9 #include <sys/kernel.h> 10 11 #include <machine/bus.h> 12 13 #include <net/if.h> 14 #include <net/if_media.h> 15 16 #include <net80211/ieee80211_var.h> 17 #include <net80211/ieee80211_amrr.h> 18 19 #include <dev/iwn/if_iwnreg.h> 20 #include <dev/iwn/if_iwnvar.h> 21 22 23 HAIKU_FBSD_WLAN_DRIVER_GLUE(iprowifi4965, iwn, pci) 24 NO_HAIKU_FBSD_MII_DRIVER(); 25 NO_HAIKU_REENABLE_INTERRUPTS(); 26 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN); 27 HAIKU_FIRMWARE_VERSION(44417); 28 HAIKU_FIRMWARE_NAME_MAP(13) = { 29 {"iwn100fw", "iwlwifi-100-5.ucode"}, 30 {"iwn105fw", "iwlwifi-105-6.ucode"}, 31 {"iwn135fw", "iwlwifi-135-6.ucode"}, 32 {"iwn1000fw", "iwlwifi-1000-5.ucode"}, 33 {"iwn2000fw", "iwlwifi-2000-6.ucode"}, 34 {"iwn2030fw", "iwlwifi-2030-6.ucode"}, 35 {"iwn4965fw", "iwlwifi-4965-2.ucode"}, 36 {"iwn5000fw", "iwlwifi-5000-5.ucode"}, 37 {"iwn5150fw", "iwlwifi-5150-2.ucode"}, 38 {"iwn6000fw", "iwlwifi-6000-4.ucode"}, 39 {"iwn6000g2afw", "iwlwifi-6000g2a-6.ucode"}, 40 {"iwn6000g2bfw", "iwlwifi-6000g2b-6.ucode"}, 41 {"iwn6050fw", "iwlwifi-6050-5.ucode"} 42 }; 43 44 45 int 46 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 47 { 48 struct iwn_softc* sc = (struct iwn_softc*)device_get_softc(dev); 49 uint32 r1, r2; 50 51 /* Disable interrupts. */ 52 IWN_WRITE(sc, IWN_INT_MASK, 0); 53 54 r1 = IWN_READ(sc, IWN_INT); 55 if (r1 == 0xffffffff || (r1 & 0xfffffff0) == 0xa5a5a5a0) { 56 return 0; /* Hardware gone! */ 57 } 58 r2 = IWN_READ(sc, IWN_FH_INT); 59 60 if (r1 == 0 && r2 == 0) { 61 // not for us 62 if (sc->sc_flags & IWN_FLAG_RUNNING) 63 IWN_WRITE(sc, IWN_INT_MASK, sc->int_mask); 64 return 0; 65 } 66 67 atomic_set((int32*)&sc->sc_intr_status_1, r1); 68 atomic_set((int32*)&sc->sc_intr_status_2, r2); 69 70 return 1; 71 } 72