* Using atomic operations to synchronize the interrupt status between glue code

and ath_intr function. Those are faster than the HAIKU_INTR* macros.
* Some variable renaming to stick with common naming conventions of the other
  wlan drivers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34811 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther
2009-12-29 18:24:35 +00:00
parent 097be0a818
commit 168aaf2f9d
3 changed files with 32 additions and 40 deletions
@@ -1280,11 +1280,8 @@ ath_intr(void *arg)
struct ifnet *ifp = sc->sc_ifp;
struct ath_hal *ah = sc->sc_ah;
HAL_INT status;
#ifdef __HAIKU__
HAIKU_INTR_REGISTER_STATE;
#endif
#ifndef __HAIKU__
#if !defined(__HAIKU__)
if (sc->sc_invalid) {
/*
* The hardware is not ready/present, don't touch anything.
@@ -1312,10 +1309,8 @@ ath_intr(void *arg)
* bits we haven't explicitly enabled so we mask the
* value to insure we only process bits we requested.
*/
#ifdef __HAIKU__
HAIKU_INTR_REGISTER_ENTER();
status = sc->sc_lastisr;
HAIKU_INTR_REGISTER_LEAVE();
#if defined(__HAIKU__)
status = atomic_and((int32 *)&sc->sc_intr_status, 0);
#else
ath_hal_getisr(ah, &status); /* NB: clears ISR too */
#endif
@@ -343,8 +343,8 @@ struct ath_softc {
u_int32_t sc_avgtsfdeltap;/* TDMA slot adjust (+) */
u_int32_t sc_avgtsfdeltam;/* TDMA slot adjust (-) */
#ifdef __HAIKU__
HAL_INT sc_lastisr;
#if defined(__HAIKU__)
HAL_INT sc_intr_status;
#endif
};
@@ -23,21 +23,18 @@ HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
int
HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
{
struct ath_softc* ath = (struct ath_softc*)device_get_softc(dev);
struct ath_hal* ah = ath->sc_ah;
HAIKU_INTR_REGISTER_STATE;
struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev);
struct ath_hal* ah = sc->sc_ah;
HAL_INT intr_status;
if (ath->sc_invalid)
if (sc->sc_invalid)
// The hardware is not ready/present, don't touch anything.
// Note this can happen early on if the IRQ is shared.
return 0;
HAIKU_INTR_REGISTER_ENTER();
if (!ath_hal_intrpend(ah)) {
if (!ath_hal_intrpend(ah))
// shared irq, not for us
HAIKU_INTR_REGISTER_LEAVE();
return 0;
}
// We have to save the isr status right now.
// Some devices don't like having the interrupt disabled
@@ -48,12 +45,12 @@ HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
//
// Note: Haiku's pcnet driver uses the same technique of
// appending a sc_lastisr field.
ath_hal_getisr(ah, &ath->sc_lastisr);
ath_hal_getisr(ah, &intr_status);
atomic_or((int32*)&sc->sc_intr_status, intr_status);
ath_hal_intrset(ah, 0);
// disable further intr's
HAIKU_INTR_REGISTER_LEAVE();
return 1;
}
@@ -61,8 +58,8 @@ HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
void
HAIKU_REENABLE_INTERRUPTS(device_t dev)
{
struct ath_softc* ath = (struct ath_softc*)device_get_softc(dev);
struct ath_hal* ah = ath->sc_ah;
struct ath_softc* sc = (struct ath_softc*)device_get_softc(dev);
struct ath_hal* ah = sc->sc_ah;
ath_hal_intrset(ah, ath->sc_imask);
ath_hal_intrset(ah, sc->sc_imask);
}