To be able to select a particular SD bus from the command
line, add a QOM alias on the SoC (using an unique name).

Suggested-by: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
---
 hw/arm/xlnx-versal.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index 12ba6c4ebae..da3ee24a5b9 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -210,6 +210,7 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
     int i;
 
     for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
+        g_autofree char *bus_name = NULL;
         DeviceState *dev;
         MemoryRegion *mr;
 
@@ -224,6 +225,10 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
         object_property_set_uint(OBJECT(dev), "uhs", UHS_I, &error_fatal);
         sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal);
 
+        /* Alias controller SD bus to the SoC itself */
+        bus_name = g_strdup_printf("sd-bus%d", i);
+        object_property_add_alias(OBJECT(s), bus_name, OBJECT(dev), "sd-bus");
+
         mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
         memory_region_add_subregion(&s->mr_ps,
                                     MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr);
-- 
2.26.2


Reply via email to