1 /* 2 * Copyright 2009, Colin Günther, coling@gmx.de. 3 * All Rights Reserved. Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <sys/bus.h> 8 #include <sys/kernel.h> 9 10 #include <net/if.h> 11 #include <net/if_media.h> 12 13 #include <net80211/ieee80211_var.h> 14 15 #include <dev/ath/if_athvar.h> 16 17 18 HAIKU_FBSD_WLAN_DRIVER_GLUE(atheroswifi, ath, pci) 19 NO_HAIKU_FBSD_MII_DRIVER(); 20 HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN); 21 22 23 int 24 HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) 25 { 26 struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev); 27 struct ath_hal* ah = sc->sc_ah; 28 HAL_INT intr_status; 29 30 if (sc->sc_invalid) 31 // The hardware is not ready/present, don't touch anything. 32 // Note this can happen early on if the IRQ is shared. 33 return 0; 34 35 if (!ath_hal_intrpend(ah)) 36 // shared irq, not for us 37 return 0; 38 39 // We have to save the isr status right now. 40 // Some devices don't like having the interrupt disabled 41 // before accessing the isr status. 42 // 43 // Those devices return status 0, when status access 44 // occurs after disabling the interrupts with ath_hal_intrset. 45 // 46 // Note: Haiku's pcnet driver uses the same technique of 47 // appending a sc_lastisr field. 48 ath_hal_getisr(ah, &intr_status); 49 atomic_or((int32*)&sc->sc_intr_status, intr_status); 50 51 ath_hal_intrset(ah, 0); 52 // disable further intr's 53 54 return 1; 55 } 56 57 58 void 59 HAIKU_REENABLE_INTERRUPTS(device_t dev) 60 { 61 struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev); 62 struct ath_hal* ah = sc->sc_ah; 63 64 ath_hal_intrset(ah, sc->sc_imask); 65 } 66