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({ 30 {"iwm3160fw", "iwm-3160-17.ucode"}, 31 {"iwm3168fw", "iwm-3168-22.ucode"}, 32 {"iwm7260fw", "iwm-7260-17.ucode"}, 33 {"iwm7265fw", "iwm-7265-17.ucode"}, 34 {"iwm7265Dfw", "iwm-7265D-22.ucode"}, 35 {"iwm8000Cfw", "iwm-8000C-22.ucode"}, 36 {"iwm8265fw", "iwm-8265-22.ucode"}, 37 }); 38 39 40 int 41 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 42 { 43 struct iwm_softc* sc = (struct iwm_softc*)device_get_softc(dev); 44 uint32 r1, r2; 45 46 r1 = IWM_READ(sc, IWM_CSR_INT); 47 /* "hardware gone" (where, fishing?) */ 48 if (r1 == 0xffffffff || (r1 & 0xfffffff0) == 0xa5a5a5a0) 49 return 0; 50 r2 = IWM_READ(sc, IWM_CSR_FH_INT_STATUS); 51 52 if (r1 == 0 && r2 == 0) 53 return 0; // not for us 54 55 atomic_set((int32*)&sc->sc_intr_status_1, r1); 56 atomic_set((int32*)&sc->sc_intr_status_2, r2); 57 58 IWM_WRITE(sc, IWM_CSR_INT_MASK, 0); 59 // disable interrupts 60 61 return 1; 62 } 63