1 /* 2 * Copyright 2009, Colin Günther, coling@gmx.de. 3 * Copyright 2018, Haiku, Inc. 4 * All rights reserved. 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_ratectl.h> 18 19 #include <dev/wpi/if_wpireg.h> 20 #include <dev/wpi/if_wpivar.h> 21 22 23 HAIKU_FBSD_WLAN_DRIVER_GLUE(iprowifi3945, wpi, pci) 24 NO_HAIKU_FBSD_MII_DRIVER(); 25 NO_HAIKU_REENABLE_INTERRUPTS(); 26 HAIKU_DRIVER_REQUIREMENTS(FBSD_WLAN); 27 HAIKU_FIRMWARE_VERSION(2144); 28 HAIKU_FIRMWARE_NAME_MAP({ 29 {"wpifw", "iwlwifi-3945-15.ucode"} 30 }); 31 32 33 int 34 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 35 { 36 struct wpi_softc* sc = (struct wpi_softc*)device_get_softc(dev); 37 uint32 r1, r2; 38 39 r1 = WPI_READ(sc, WPI_INT); 40 41 if (__predict_false(r1 == 0xffffffff || 42 (r1 & 0xfffffff0) == 0xa5a5a5a0)) 43 return 0; /* Hardware gone! */ 44 45 r2 = WPI_READ(sc, WPI_FH_INT); 46 47 if (r1 == 0 && r2 == 0) 48 return 0; /* Interrupt not for us. */ 49 50 /* Disable interrupts. */ 51 WPI_WRITE(sc, WPI_INT_MASK, 0); 52 53 atomic_set((int32*)&sc->sc_intr_status_1, r1); 54 atomic_set((int32*)&sc->sc_intr_status_2, r2); 55 56 return 1; 57 } 58