mst_fpga: correct irq level settings
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Wed, 16 Feb 2011 13:22:33 +0000 (16:22 +0300)
committerAndrzej Zaborowski <balrog@zabor.org>
Fri, 25 Feb 2011 08:06:16 +0000 (09:06 +0100)
Final corrections for IRQ levels that are set by mst_fpga:

* Don't retranslate IRQ if previously IRQ was masked.
* After setting or clearing IRQs through register, apply mask
  before setting parent IRQ level.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
hw/mst_fpga.c

index afed2acd44bb620c29f3981ed0004dbac59b8097..407bac97168bc81e850f6d6797897b9d7e9d9147 100644 (file)
@@ -50,7 +50,7 @@ static void
 mst_fpga_set_irq(void *opaque, int irq, int level)
 {
        mst_irq_state *s = (mst_irq_state *)opaque;
-       uint32_t oldint = s->intsetclr;
+       uint32_t oldint = s->intsetclr & s->intmskena;
 
        if (level)
                s->prev_level |= 1u << irq;
@@ -139,7 +139,7 @@ mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
                break;
        case MST_INTSETCLR:     /* clear or set interrupt */
                s->intsetclr = (value & 0xFEEFF);
-               qemu_set_irq(s->parent, s->intsetclr);
+               qemu_set_irq(s->parent, s->intsetclr & s->intmskena);
                break;
        case MST_PCMCIA0:
                s->pcmcia0 = value;