提交 4b5e5210 编写于 作者: P Peter A. G. Crosthwaite 提交者: Edgar E. Iglesias

xilinx.h: Error check when setting links

Assert that the ethernet and dma controller are sucessfully linked to their
peers.
Signed-off-by: NPeter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
上级 919f89f4
......@@ -55,13 +55,16 @@ xilinx_axiethernet_create(NICInfo *nd, StreamSlave *peer,
int txmem, int rxmem)
{
DeviceState *dev;
Error *errp = NULL;
qemu_check_nic_model(nd, "xlnx.axi-ethernet");
dev = qdev_create(NULL, "xlnx.axi-ethernet");
qdev_set_nic_properties(dev, nd);
qdev_prop_set_uint32(dev, "rxmem", rxmem);
qdev_prop_set_uint32(dev, "txmem", txmem);
object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", NULL);
object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", &errp);
assert_no_error(errp);
qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
......@@ -74,8 +77,11 @@ xilinx_axiethernetdma_init(DeviceState *dev, StreamSlave *peer,
target_phys_addr_t base, qemu_irq irq,
qemu_irq irq2, int freqhz)
{
Error *errp = NULL;
qdev_prop_set_uint32(dev, "freqhz", freqhz);
object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", NULL);
object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", &errp);
assert_no_error(errp);
qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册