Skip to content

Commit a134321

Browse files
erik-smitjasowang
authored andcommitted
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 <[email protected]> Reviewed-by: Cédric Le Goater <[email protected]> Signed-off-by: Jason Wang <[email protected]>
1 parent e7b347d commit a134321

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

hw/net/ftgmac100.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,16 +810,18 @@ static void ftgmac100_write(void *opaque, hwaddr addr,
810810
s->phydata = value & 0xffff;
811811
break;
812812
case FTGMAC100_DBLAC: /* DMA Burst Length and Arbitration Control */
813-
if (FTGMAC100_DBLAC_TXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) {
813+
if (FTGMAC100_DBLAC_TXDES_SIZE(value) < sizeof(FTGMAC100Desc)) {
814814
qemu_log_mask(LOG_GUEST_ERROR,
815-
"%s: transmit descriptor too small : %d bytes\n",
816-
__func__, FTGMAC100_DBLAC_TXDES_SIZE(s->dblac));
815+
"%s: transmit descriptor too small: %" PRIx64
816+
" bytes\n", __func__,
817+
FTGMAC100_DBLAC_TXDES_SIZE(value));
817818
break;
818819
}
819-
if (FTGMAC100_DBLAC_RXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) {
820+
if (FTGMAC100_DBLAC_RXDES_SIZE(value) < sizeof(FTGMAC100Desc)) {
820821
qemu_log_mask(LOG_GUEST_ERROR,
821-
"%s: receive descriptor too small : %d bytes\n",
822-
__func__, FTGMAC100_DBLAC_RXDES_SIZE(s->dblac));
822+
"%s: receive descriptor too small : %" PRIx64
823+
" bytes\n", __func__,
824+
FTGMAC100_DBLAC_RXDES_SIZE(value));
823825
break;
824826
}
825827
s->dblac = value;

0 commit comments

Comments
 (0)