qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] hw/net: cadence_gem: fix: type2_compare_x_word_0 error


From: Andrew.Yuan
Subject: [PATCH] hw/net: cadence_gem: fix: type2_compare_x_word_0 error
Date: Thu, 6 Jun 2024 17:59:52 +0800

        In the Cadence IP for Gigabit Ethernet MAC Part Number: IP7014 IP Rev: 
R1p12 - Doc Rev: 1.3 User Guide, the specification for the 
type2_compare_x_word_0 register is as follows:
        The byte stored in bits [23:16] is compared against the byte in the 
received frame from the selected offset+0, and the byte stored in bits [31:24] 
is compared against the byte in
        the received frame from the selected offset+1.

        However, there is an implementation error in the cadence_gem model in 
qemu:
        the byte stored in bits [31:24] is compared against the byte in the 
received frame from the selected offset+0

        Now, the error code is as follows:
        rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset];

        and needs to be corrected to:
        rx_cmp = rxbuf_ptr[offset + 1] << 8 | rxbuf_ptr[offset];

Signed-off-by: Andrew.Yuan <andrew.yuan@jaguarmicro.com>
---
 hw/net/cadence_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index ec7bf562e5..9c73ded0d3 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -946,7 +946,7 @@ static int get_queue_from_screen(CadenceGEMState *s, 
uint8_t *rxbuf_ptr,
                 break;
             }
 
-            rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset];
+            rx_cmp = rxbuf_ptr[offset + 1] << 8 | rxbuf_ptr[offset];
             mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE);
             compare = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE);
 
-- 
2.37.0.windows.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]