Fix xilinx_ethlite breakage by 4f1c942b7f
authorJan Kiszka <jan.kiszka@web.de>
Thu, 11 Jun 2009 09:42:26 +0000 (11:42 +0200)
committerPaul Brook <paul@codesourcery.com>
Thu, 11 Jun 2009 11:33:19 +0000 (12:33 +0100)
Namely the new xilinx_ethlite used by mircoblaze.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hw/xilinx_ethlite.c

index 780e9c0..77cd6fb 100644 (file)
@@ -160,28 +160,28 @@ static CPUWriteMemoryFunc *eth_write[] = {
     NULL, NULL, &eth_writel,
 };
 
-static int eth_can_rx(void *opaque)
+static int eth_can_rx(VLANClientState *vc)
 {
-    struct xlx_ethlite *s = opaque;
+    struct xlx_ethlite *s = vc->opaque;
     int r;
     r = !(s->regs[R_RX_CTRL0] & CTRL_S);
     qemu_log("%s %d\n", __func__, r);
     return r;
 }
 
-static void eth_rx(void *opaque, const uint8_t *buf, int size)
+static ssize_t eth_rx(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    struct xlx_ethlite *s = opaque;
+    struct xlx_ethlite *s = vc->opaque;
     unsigned int rxbase = s->rxbuf * (0x800 / 4);
     int i;
 
     /* DA filter.  */
     if (!(buf[0] & 0x80) && memcmp(&s->macaddr[0], buf, 6))
-        return;
+        return size;
 
     if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) {
         D(qemu_log("ethlite lost packet %x\n", s->regs[R_RX_CTRL0]));
-        return;
+        return -1;
     }
 
     D(qemu_log("%s %d rxbase=%x\n", __func__, size, rxbase));
@@ -199,7 +199,7 @@ static void eth_rx(void *opaque, const uint8_t *buf, int size)
 
     /* If c_rx_pingpong was set flip buffers.  */
     s->rxbuf ^= s->c_rx_pingpong;
-    return;
+    return size;
 }
 
 static void eth_cleanup(VLANClientState *vc)
@@ -223,7 +223,7 @@ static void xilinx_ethlite_init(SysBusDevice *dev)
 
     qdev_get_macaddr(&dev->qdev, s->macaddr);
     s->vc = qdev_get_vlan_client(&dev->qdev,
-                                 eth_rx, eth_can_rx, eth_cleanup, s);
+                                 eth_can_rx, eth_rx, NULL, eth_cleanup, s);
 }
 
 static void xilinx_ethlite_register(void)