* Reworked interrupt handlink so that the interrupt status is read only once

per interrupt. Moreover the interrupt is disabled only once now too.
* Using atomic_{set|get} operations for synchronizing the interrupt status
  as proposed by Axel.
* Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34812 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther 2009-12-29 22:00:28 +00:00
parent 168aaf2f9d
commit b69688c36e
3 changed files with 38 additions and 34 deletions

View File

@ -1567,6 +1567,7 @@ bwi_intr(void *xsc)
BWI_LOCK(sc);
#if !defined(__HAIKU__)
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ||
(sc->sc_flags & BWI_F_STOP)) {
BWI_UNLOCK(sc);
@ -1580,6 +1581,9 @@ bwi_intr(void *xsc)
BWI_UNLOCK(sc);
return;
}
#else
intr_status = atomic_get((int32 *)&sc->sc_intr_status);
#endif
DPRINTF(sc, BWI_DBG_INTR, "intr status 0x%08x\n", intr_status);
@ -1626,8 +1630,10 @@ bwi_intr(void *xsc)
for (i = 0; i < BWI_TXRX_NRING; ++i)
CSR_WRITE_4(sc, BWI_TXRX_INTR_STATUS(i), txrx_intr_status[i]);
#if !defined(__HAIKU__)
/* Disable all interrupts */
bwi_disable_intrs(sc, BWI_ALL_INTRS);
#endif
/*
* http://bcm-specs.sipsolutions.net/Interrupts

View File

@ -648,6 +648,10 @@ struct bwi_softc {
int sc_led_blink;
int sc_txpwr_calib;
uint32_t sc_debug; /* BWI_DBG_ */
#if defined(__HAIKU__)
uint32_t sc_intr_status;
#endif
};
#define BWI_F_BUS_INITED 0x1

View File

@ -21,6 +21,7 @@
HAIKU_FBSD_WLAN_DRIVER_GLUE(broadcom43xx, bwi, pci)
NO_HAIKU_FBSD_MII_DRIVER();
NO_HAIKU_REENABLE_INTERRUPTS();
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_WLAN);
HAIKU_FIRMWARE_VERSION(0);
@ -28,29 +29,22 @@ int
HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
{
struct bwi_softc* sc = (struct bwi_softc*)device_get_softc(dev);
HAIKU_INTR_REGISTER_STATE;
struct ifnet* ifp = sc->sc_ifp;
uint32 intr_status;
HAIKU_INTR_REGISTER_ENTER();
if (CSR_READ_4(sc, BWI_MAC_INTR_STATUS) == 0xffffffff) {
/* Not for us */
HAIKU_INTR_REGISTER_LEAVE();
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0
|| (sc->sc_flags & BWI_F_STOP))
return 0;
}
/* Disable all interrupts */
intr_status = CSR_READ_4(sc, BWI_MAC_INTR_STATUS);
if (intr_status == 0xffffffff)
// Not for us
return 0;
atomic_set((int32*)&sc->sc_intr_status, intr_status);
CSR_CLRBITS_4(sc, BWI_MAC_INTR_MASK, BWI_ALL_INTRS);
HAIKU_INTR_REGISTER_LEAVE();
// Disable all interrupts
return 1;
}
void
HAIKU_REENABLE_INTERRUPTS(device_t dev)
{
struct bwi_softc* sc = (struct bwi_softc*)device_get_softc(dev);
/* enable interrupts */
CSR_SETBITS_4(sc, BWI_MAC_INTR_MASK, BWI_INIT_INTRS);
}