Patchwork [RFC,v1,4/4] xilinx_axienet: stub out second stream connection

login
register
mail settings
Submitter Peter Crosthwaite
Date Feb. 12, 2013, 1:17 a.m.
Message ID <cf035444759b48f67c84687a7d59d6c7d331339e.1360631576.git.peter.crosthwaite@xilinx.com>
Download mbox | patch
Permalink /patch/219715/
State New
Headers show

Comments

Peter Crosthwaite - Feb. 12, 2013, 1:17 a.m.
Example patch adding a second proxy object for the second stream connection of
axienet.

This is a non-functional RFC, please see the cover letter for discussion.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/xilinx_axienet.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/xilinx_axienet.c b/hw/xilinx_axienet.c
index 7adb24d..e8fa65c 100644
--- a/hw/xilinx_axienet.c
+++ b/hw/xilinx_axienet.c
@@ -365,11 +365,16 @@  struct XilinxAXIEnet {
 };
 
 #define TYPE_XILINX_AXI_ENET_DATA_STREAM "xilinx-axienet-data-stream"
+#define TYPE_XILINX_AXI_ENET_CONTROL_STREAM "xilinx-axienet-control-stream"
 
 #define XILINX_AXI_ENET_DATA_STREAM(obj) \
      OBJECT_CHECK(XilinxAXIEnetStreamSlave, (obj),\
      TYPE_XILINX_AXI_ENET_DATA_STREAM)
 
+#define XILINX_AXI_ENET_CONTROL_STREAM(obj) \
+     OBJECT_CHECK(XilinxAXIEnetStreamSlave, (obj),\
+     TYPE_XILINX_AXI_ENET_CONTROL_STREAM)
+
 typedef struct XilinxAXIEnetStreamSlave {
     Object parent;
 
@@ -801,6 +806,13 @@  static void eth_cleanup(NetClientState *nc)
     g_free(s->rxmem);
     g_free(s);
 }
+static void
+
+axienet_control_stream_push(StreamSlave *obj, uint8_t *buf, size_t size,
+                         uint32_t *hdr)
+{
+    /* ... */
+}
 
 static void
 axienet_data_stream_push(StreamSlave *obj, uint8_t *buf, size_t size,
@@ -860,6 +872,8 @@  static int xilinx_enet_init(SysBusDevice *dev)
     struct XilinxAXIEnet *s = FROM_SYSBUS(typeof(*s), dev);
     XilinxAXIEnetStreamSlave *ds = XILINX_AXI_ENET_DATA_STREAM(
                         object_new(TYPE_XILINX_AXI_ENET_DATA_STREAM));
+    XilinxAXIEnetStreamSlave *cs = XILINX_AXI_ENET_CONTROL_STREAM(
+                        object_new(TYPE_XILINX_AXI_ENET_CONTROL_STREAM));
     Error *errp = NULL;
 
     object_property_add_child(OBJECT(s), "data-stream", (Object *)ds, &errp);
@@ -870,6 +884,14 @@  static int xilinx_enet_init(SysBusDevice *dev)
     object_property_set_link(OBJECT(ds), OBJECT(s), "enet", &errp);
     assert_no_error(errp);
 
+    object_property_add_child(OBJECT(s), "control-stream", (Object *)cs, &errp);
+    assert_no_error(errp);
+    object_property_add_link(OBJECT(cs), "enet", "xlnx.axi-ethernet",
+                             (Object **) &cs->enet, &errp);
+    assert_no_error(errp);
+    object_property_set_link(OBJECT(cs), OBJECT(s), "enet", &errp);
+    assert_no_error(errp);
+
     sysbus_init_irq(dev, &s->irq);
 
     memory_region_init_io(&s->iomem, &enet_ops, s, "enet", 0x40000);
@@ -943,10 +965,23 @@  static const TypeInfo xilinx_enet_data_stream_info = {
     }
 };
 
+static const TypeInfo xilinx_enet_control_stream_info = {
+    .name          = TYPE_XILINX_AXI_ENET_CONTROL_STREAM,
+    .parent        = TYPE_OBJECT,
+    .instance_size = sizeof(struct XilinxAXIEnetStreamSlave),
+    .class_init    = xilinx_enet_stream_class_init,
+    .class_data    = axienet_control_stream_push,
+    .interfaces = (InterfaceInfo[]) {
+            { TYPE_STREAM_SLAVE },
+            { }
+    }
+};
+
 static void xilinx_enet_register_types(void)
 {
     type_register_static(&xilinx_enet_info);
     type_register_static(&xilinx_enet_data_stream_info);
+    type_register_static(&xilinx_enet_control_stream_info);
 }
 
 type_init(xilinx_enet_register_types)