ftgmac100: fix dblac write test

The test of the write of the dblac register was testing the old value
instead of the new value. This would accept the write of an invalid value
but subsequently refuse any following valid writes.

Signed-off-by: erik-smit <erik.lucas.smit@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
erik-smit 2020-06-28 16:26:59 +02:00 committed by Jason Wang
parent e7b347d0bf
commit a134321ef6

View File

@ -810,16 +810,18 @@ static void ftgmac100_write(void *opaque, hwaddr addr,
s->phydata = value & 0xffff; s->phydata = value & 0xffff;
break; break;
case FTGMAC100_DBLAC: /* DMA Burst Length and Arbitration Control */ case FTGMAC100_DBLAC: /* DMA Burst Length and Arbitration Control */
if (FTGMAC100_DBLAC_TXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) { if (FTGMAC100_DBLAC_TXDES_SIZE(value) < sizeof(FTGMAC100Desc)) {
qemu_log_mask(LOG_GUEST_ERROR, qemu_log_mask(LOG_GUEST_ERROR,
"%s: transmit descriptor too small : %d bytes\n", "%s: transmit descriptor too small: %" PRIx64
__func__, FTGMAC100_DBLAC_TXDES_SIZE(s->dblac)); " bytes\n", __func__,
FTGMAC100_DBLAC_TXDES_SIZE(value));
break; break;
} }
if (FTGMAC100_DBLAC_RXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) { if (FTGMAC100_DBLAC_RXDES_SIZE(value) < sizeof(FTGMAC100Desc)) {
qemu_log_mask(LOG_GUEST_ERROR, qemu_log_mask(LOG_GUEST_ERROR,
"%s: receive descriptor too small : %d bytes\n", "%s: receive descriptor too small : %" PRIx64
__func__, FTGMAC100_DBLAC_RXDES_SIZE(s->dblac)); " bytes\n", __func__,
FTGMAC100_DBLAC_RXDES_SIZE(value));
break; break;
} }
s->dblac = value; s->dblac = value;