[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 15/17] cadence_gem: fix interrupt events
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH 15/17] cadence_gem: fix interrupt events |
Date: |
Thu, 28 Feb 2013 18:54:01 +0000 |
From: Peter Crosthwaite <address@hidden>
Bits in the ISR were continually mirroring their corresponding TX/RX SR bits.
This is incorrect. The ISR bits are only ever set at the time their
corresponding event occurs.
Signed-off-by: Peter Crosthwaite <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
hw/cadence_gem.c | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/hw/cadence_gem.c b/hw/cadence_gem.c
index 966ab4f..a1ac069 100644
--- a/hw/cadence_gem.c
+++ b/hw/cadence_gem.c
@@ -427,32 +427,9 @@ static int gem_can_receive(NetClientState *nc)
*/
static void gem_update_int_status(GemState *s)
{
- uint32_t new_interrupts = 0;
- /* Packet transmitted ? */
- if (s->regs[GEM_TXSTATUS] & GEM_TXSTATUS_TXCMPL) {
- new_interrupts |= GEM_INT_TXCMPL;
- }
- /* End of TX ring ? */
- if (s->regs[GEM_TXSTATUS] & GEM_TXSTATUS_USED) {
- new_interrupts |= GEM_INT_TXUSED;
- }
-
- /* Frame received ? */
- if (s->regs[GEM_RXSTATUS] & GEM_RXSTATUS_FRMRCVD) {
- new_interrupts |= GEM_INT_RXCMPL;
- }
- /* RX ring full ? */
- if (s->regs[GEM_RXSTATUS] & GEM_RXSTATUS_NOBUF) {
- new_interrupts |= GEM_INT_RXUSED;
- }
-
- s->regs[GEM_ISR] |= new_interrupts & ~(s->regs[GEM_IMR]);
-
if (s->regs[GEM_ISR]) {
DB_PRINT("asserting int. (0x%08x)\n", s->regs[GEM_ISR]);
qemu_set_irq(s->irq, 1);
- } else {
- qemu_set_irq(s->irq, 0);
}
}
@@ -697,6 +674,7 @@ static ssize_t gem_receive(NetClientState *nc, const
uint8_t *buf, size_t size)
DB_PRINT("descriptor 0x%x owned by sw.\n",
(unsigned)packet_desc_addr);
s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_NOBUF;
+ s->regs[GEM_ISR] |= GEM_INT_RXUSED & ~(s->regs[GEM_IMR]);
/* Handle interrupt consequences */
gem_update_int_status(s);
return -1;
@@ -765,6 +743,7 @@ static ssize_t gem_receive(NetClientState *nc, const
uint8_t *buf, size_t size)
(uint8_t *)&desc[0], sizeof(desc));
s->regs[GEM_RXSTATUS] |= GEM_RXSTATUS_FRMRCVD;
+ s->regs[GEM_ISR] |= GEM_INT_RXCMPL & ~(s->regs[GEM_IMR]);
/* Handle interrupt consequences */
gem_update_int_status(s);
@@ -894,6 +873,7 @@ static void gem_transmit(GemState *s)
DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr);
s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_TXCMPL;
+ s->regs[GEM_ISR] |= GEM_INT_TXCMPL & ~(s->regs[GEM_IMR]);
/* Handle interrupt consequences */
gem_update_int_status(s);
@@ -931,6 +911,7 @@ static void gem_transmit(GemState *s)
if (tx_desc_get_used(desc)) {
s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_USED;
+ s->regs[GEM_ISR] |= GEM_INT_TXUSED & ~(s->regs[GEM_IMR]);
gem_update_int_status(s);
}
}
--
1.7.9.5
- [Qemu-devel] [PATCH 12/17] m25p80.c: Use QOM classes for part differentiation, (continued)
- [Qemu-devel] [PATCH 12/17] m25p80.c: Use QOM classes for part differentiation, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 17/17] cadence_gem: Add debug msgs for rx desc movement, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 02/17] hw/pflash_cfi01: Make read after byte-write or erase return status, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 14/17] cadence_gem: factor out can_rx() logic replication, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 03/17] hw/pflash_cfi01: Treat read in unknown command state as read, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 06/17] arm: mptimer: Remove WDT distinction, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 13/17] cadence_gem: Flush queued packets, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 10/17] vl.c: allow for repeated -sd arguments, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 05/17] arm: arm11mpcore, a9mpcore: CamelCased type names, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 16/17] cadence_gem: Don't reset rx desc pointer on rx_en, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 15/17] cadence_gem: fix interrupt events,
Peter Maydell <=
- [Qemu-devel] [PATCH 04/17] arm: mptimer: CamelCased type names, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 09/17] hw/sdhci: introduce standard SD host controller, Peter Maydell, 2013/02/28
- [Qemu-devel] [PATCH 01/17] hw/ds1338: Fix conversion between 12 hours and 24 hours modes., Peter Maydell, 2013/02/28
- Re: [Qemu-devel] [PULL 00/17] arm-devs queue, Blue Swirl, 2013/02/28