On 8/5/23 09:58, Cédric Le Goater wrote:
This to avoid address conflicts on the same SSI bus. Adapt machines
using multiple devices on the same bus to avoid breakage.

Cc: "Edgar E. Iglesias" <edgar.igles...@gmail.com>
Cc: Alistair Francis <alist...@alistair23.me>
Signed-off-by: Cédric Le Goater <c...@kaod.org>
---
  hw/arm/stellaris.c                  |  4 +++-
  hw/arm/xilinx_zynq.c                |  1 +
  hw/arm/xlnx-versal-virt.c           |  1 +
  hw/arm/xlnx-zcu102.c                |  2 ++
  hw/microblaze/petalogix_ml605_mmu.c |  1 +
  hw/ssi/ssi.c                        | 20 ++++++++++++++++++++
  6 files changed, 28 insertions(+), 1 deletion(-)


diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c
index a25e064417..685b7678e0 100644
--- a/hw/ssi/ssi.c
+++ b/hw/ssi/ssi.c
@@ -42,10 +42,30 @@ DeviceState *ssi_get_cs(SSIBus *bus, int addr)
      return NULL;
  }
+static bool ssi_bus_check_address(BusState *b, DeviceState *dev, Error **errp)
+{
+    SSIPeripheral *s = SSI_PERIPHERAL(dev);
+
+    if (ssi_get_cs(SSI_BUS(b), s->addr)) {
+        error_setg(errp, "addr '0x%x' already in use", s->addr);

We could return "... in use by a $MODEL device".

  DeviceState *d = ssi_get_cs(SSI_BUS(b), s->addr);
  if (d) {
      "... in use by a %s device", ..., object_get_typename(OBJECT(d)));
  }

Anyhow,
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>

+        return false;
+    }
+
+    return true;
+}



Reply via email to