1 /* 2 * Copyright 2018, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 */ 5 6 7 #include <sys/bus.h> 8 #include <sys/kernel.h> 9 #include <sys/endian.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 #include <net80211/ieee80211_ratectl.h> 19 20 #include <dev/iwm/if_iwmreg.h> 21 #include <dev/iwm/if_iwmvar.h> 22 23 24 HAIKU_FBSD_WLAN_DRIVER_GLUE(idualwifi7260, iwm, pci) 25 NO_HAIKU_FBSD_MII_DRIVER(); 26 NO_HAIKU_REENABLE_INTERRUPTS(); 27 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN); 28 HAIKU_FIRMWARE_VERSION(1); 29 HAIKU_FIRMWARE_NAME_MAP(6) = { 30 {"iwm3160fw", "iwm-3160-17.ucode"}, 31 {"iwm7260fw", "iwm-7260-17.ucode"}, 32 {"iwm7265fw", "iwm-7265-17.ucode"}, 33 {"iwm7265Dfw", "iwm-7265D-22.ucode"}, 34 {"iwm8000Cfw", "iwm-8000C-22.ucode"}, 35 {"iwm8265fw", "iwm-8265-22.ucode"}, 36 }; 37 38 39 int 40 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 41 { 42 struct iwm_softc* sc = (struct iwm_softc*)device_get_softc(dev); 43 uint32 r1, r2; 44 45 r1 = IWM_READ(sc, IWM_CSR_INT); 46 /* "hardware gone" (where, fishing?) */ 47 if (r1 == 0xffffffff || (r1 & 0xfffffff0) == 0xa5a5a5a0) 48 return 0; 49 r2 = IWM_READ(sc, IWM_CSR_FH_INT_STATUS); 50 51 if (r1 == 0 && r2 == 0) 52 return 0; // not for us 53 54 atomic_set((int32*)&sc->sc_intr_status_1, r1); 55 atomic_set((int32*)&sc->sc_intr_status_2, r2); 56 57 IWM_WRITE(sc, IWM_CSR_INT_MASK, 0); 58 // disable interrupts 59 60 return 1; 61 } 62