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 {"iwm9000fw", "iwm-9000-34.ucode"}, 38 {"iwm9260fw", "iwm-9260-34.ucode"}, 39 }); 40 41 42 int 43 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 44 { 45 struct iwm_softc* sc = (struct iwm_softc*)device_get_softc(dev); 46 uint32 r1, r2; 47 48 r1 = IWM_READ(sc, IWM_CSR_INT); 49 /* "hardware gone" (where, fishing?) */ 50 if (r1 == 0xffffffff || (r1 & 0xfffffff0) == 0xa5a5a5a0) 51 return 0; 52 r2 = IWM_READ(sc, IWM_CSR_FH_INT_STATUS); 53 54 if (r1 == 0 && r2 == 0) 55 return 0; // not for us 56 57 atomic_set((int32*)&sc->sc_intr_status_1, r1); 58 atomic_set((int32*)&sc->sc_intr_status_2, r2); 59 60 IWM_WRITE(sc, IWM_CSR_INT_MASK, 0); 61 // disable interrupts 62 63 return 1; 64 } 65