Revision 9fc380d3
b/hw/spapr_vio.c | ||
---|---|---|
621 | 621 |
rtas_st(rets, 0, 0); |
622 | 622 |
} |
623 | 623 |
|
624 |
static int spapr_vio_check_reg(VIOsPAPRDevice *sdev, VIOsPAPRDeviceInfo *info) |
|
625 |
{ |
|
626 |
VIOsPAPRDevice *other_sdev; |
|
627 |
DeviceState *qdev; |
|
628 |
VIOsPAPRBus *sbus; |
|
629 |
|
|
630 |
sbus = DO_UPCAST(VIOsPAPRBus, bus, sdev->qdev.parent_bus); |
|
631 |
|
|
632 |
/* |
|
633 |
* Check two device aren't given clashing addresses by the user (or some |
|
634 |
* other mechanism). We have to open code this because we have to check |
|
635 |
* for matches with devices other than us. |
|
636 |
*/ |
|
637 |
QTAILQ_FOREACH(qdev, &sbus->bus.children, sibling) { |
|
638 |
other_sdev = DO_UPCAST(VIOsPAPRDevice, qdev, qdev); |
|
639 |
|
|
640 |
if (other_sdev != sdev && other_sdev->reg == sdev->reg) { |
|
641 |
fprintf(stderr, "vio: %s and %s devices conflict at address %#x\n", |
|
642 |
info->qdev.name, other_sdev->qdev.info->name, sdev->reg); |
|
643 |
return -EEXIST; |
|
644 |
} |
|
645 |
} |
|
646 |
|
|
647 |
return 0; |
|
648 |
} |
|
649 |
|
|
624 | 650 |
static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo) |
625 | 651 |
{ |
626 | 652 |
VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)qinfo; |
627 | 653 |
VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; |
628 | 654 |
char *id; |
655 |
int ret; |
|
656 |
|
|
657 |
ret = spapr_vio_check_reg(dev, info); |
|
658 |
if (ret) { |
|
659 |
return ret; |
|
660 |
} |
|
629 | 661 |
|
630 | 662 |
/* Don't overwrite ids assigned on the command line */ |
631 | 663 |
if (!dev->qdev.id) { |
Also available in: Unified diff