From 2edefe9d871785adf057f220b45b70705db97c3b Mon Sep 17 00:00:00 2001
From: Michael Lotz <mmlr@mlotz.ch>
Date: Fri, 2 Nov 2012 15:37:11 +0100
Subject: [PATCH 1/2] Disable duplicated interrupt disable code.
Since we now implement HAIKU_CHECK_DISABLE_INTERRUPTS there is no need
to do it again in the interrupt handler. Further, store and carry over
the interrupt status from the hook to the interrupt handler in case
reading the register somehow clears it.
---
.../drivers/network/marvell_yukon/dev/msk/glue.c | 9 ++++++++-
.../drivers/network/marvell_yukon/dev/msk/if_msk.c | 6 ++++++
.../network/marvell_yukon/dev/msk/if_mskreg.h | 3 +++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/glue.c b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/glue.c
index 997689e..6b76ab6 100644
a
|
b
|
HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
|
51 | 51 | return 0; |
52 | 52 | } |
53 | 53 | |
| 54 | sc->haiku_interrupt_status = status; |
54 | 55 | return 1; |
55 | 56 | } |
56 | 57 | |
57 | 58 | |
58 | | NO_HAIKU_REENABLE_INTERRUPTS(); |
| 59 | void |
| 60 | HAIKU_REENABLE_INTERRUPTS(device_t dev) |
| 61 | { |
| 62 | struct msk_softc *sc = device_get_softc(dev); |
| 63 | CSR_WRITE_4(sc, B0_Y2_SP_ICR, 2); |
| 64 | } |
| 65 | |
59 | 66 | |
60 | 67 | HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE | FBSD_SWI_TASKQUEUE); |
diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_msk.c b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_msk.c
index be4ac5d..377a158 100644
a
|
b
|
msk_intr(void *xsc)
|
3610 | 3610 | sc = xsc; |
3611 | 3611 | MSK_LOCK(sc); |
3612 | 3612 | |
| 3613 | #ifndef __HAIKU__ |
3613 | 3614 | /* Reading B0_Y2_SP_ISRC2 masks further interrupts. */ |
3614 | 3615 | status = CSR_READ_4(sc, B0_Y2_SP_ISRC2); |
3615 | 3616 | if (status == 0 || status == 0xffffffff || |
… |
… |
msk_intr(void *xsc)
|
3619 | 3620 | MSK_UNLOCK(sc); |
3620 | 3621 | return; |
3621 | 3622 | } |
| 3623 | #else |
| 3624 | status = sc->haiku_interrupt_status; |
| 3625 | #endif |
3622 | 3626 | |
3623 | 3627 | sc_if0 = sc->msk_if[MSK_PORT_A]; |
3624 | 3628 | sc_if1 = sc->msk_if[MSK_PORT_B]; |
… |
… |
msk_intr(void *xsc)
|
3655 | 3659 | if ((status & Y2_IS_STAT_BMU) != 0 && domore == 0) |
3656 | 3660 | CSR_WRITE_4(sc, STAT_CTRL, SC_STAT_CLR_IRQ); |
3657 | 3661 | |
| 3662 | #ifndef __HAIKU__ |
3658 | 3663 | /* Reenable interrupts. */ |
3659 | 3664 | CSR_WRITE_4(sc, B0_Y2_SP_ICR, 2); |
| 3665 | #endif |
3660 | 3666 | |
3661 | 3667 | if (ifp0 != NULL && (ifp0->if_drv_flags & IFF_DRV_RUNNING) != 0 && |
3662 | 3668 | !IFQ_DRV_IS_EMPTY(&ifp0->if_snd)) |
diff --git a/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_mskreg.h b/src/add-ons/kernel/drivers/network/marvell_yukon/dev/msk/if_mskreg.h
index 583f5e8..75ef99b 100644
a
|
b
|
struct msk_softc {
|
2520 | 2520 | int msk_process_limit; |
2521 | 2521 | int msk_stat_cons; |
2522 | 2522 | struct mtx msk_mtx; |
| 2523 | #ifdef __HAIKU__ |
| 2524 | uint32_t haiku_interrupt_status; |
| 2525 | #endif |
2523 | 2526 | }; |
2524 | 2527 | |
2525 | 2528 | #define MSK_LOCK(_sc) mtx_lock(&(_sc)->msk_mtx) |