On Tue, 10 Dec 2019, at 23:22, Cédric Le Goater wrote:
> On 10/12/2019 01:52, Andrew Jeffery wrote:
> > Initialise another SDHCI model instance for the AST2600's eMMC
> > controller and use the SDHCI's num_slots value introduced previously to
> > determine whether we should create an SD card instance for the new slot.
> >
> > Signed-off-by: Andrew Jeffery <and...@aj.id.au>
>
> LGTM. One comment.
>
> > ---
> > hw/arm/aspeed.c | 13 +++++++++++++
> > hw/arm/aspeed_ast2600.c | 21 +++++++++++++++++++++
> > include/hw/arm/aspeed_soc.h | 2 ++
> > 3 files changed, 36 insertions(+)
> >
> > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> > index 862549b1f3a9..0e08d62e9ff3 100644
> > --- a/hw/arm/aspeed.c
> > +++ b/hw/arm/aspeed.c
> > @@ -272,6 +272,19 @@ static void aspeed_board_init(MachineState *machine,
> > object_property_set_bool(OBJECT(card), true, "realized",
> > &error_fatal);
> > }
> >
> > + if (bmc->soc.emmc.num_slots) {
> > + SDHCIState *emmc = &bmc->soc.emmc.slots[0];
> > + DriveInfo *dinfo = drive_get_next(IF_SD);
> > + BlockBackend *blk;
> > + DeviceState *card;
> > +
> > + blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
> > + card = qdev_create(qdev_get_child_bus(DEVICE(emmc), "sd-bus"),
> > + TYPE_SD_CARD);
> > + qdev_prop_set_drive(card, "drive", blk, &error_fatal);
> > + object_property_set_bool(OBJECT(card), true, "realized",
> > &error_fatal);
> > + }
>
> I think we could use a function for the above ^
Yep, I'll refactor that.
Andrew