sdhci_attach_drive and write_boot_rom functions may be used by
the aspeed machine supporting co-processors.
Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
---
hw/arm/aspeed.c | 4 ++--
include/hw/arm/aspeed.h | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index a18d4ed1fb..62ac8b7206 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -256,7 +256,7 @@ static void aspeed_reset_secondary(ARMCPU *cpu,
cpu_set_pc(cs, info->smp_loader_start);
}
-static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
Error **errp)
{
g_autofree void *storage = NULL;
@@ -325,7 +325,7 @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
}
}
-static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
bool boot_emmc)
{
DeviceState *card;
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index cbeacb214c..bba224c357 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -10,7 +10,9 @@
#define ARM_ASPEED_H
#include "hw/boards.h"
+#include "hw/sd/sdhci.h"
#include "qom/object.h"
+#include "system/blockdev.h"
typedef struct AspeedMachineState AspeedMachineState;
@@ -41,5 +43,9 @@ struct AspeedMachineClass {
uint32_t uart_default;
};
+void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
+ bool boot_emmc);
+void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
+ Error **errp);
#endif
--
2.34.1
On 12/25/24 03:03, Steven Lee wrote:
> sdhci_attach_drive and write_boot_rom functions may be used by
> the aspeed machine supporting co-processors.
I would move these routines to aspeed_soc_common.c file and rename them
with an aspeed_ prefix.
Thanks,
C.
> Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
> ---
> hw/arm/aspeed.c | 4 ++--
> include/hw/arm/aspeed.h | 6 ++++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index a18d4ed1fb..62ac8b7206 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -256,7 +256,7 @@ static void aspeed_reset_secondary(ARMCPU *cpu,
> cpu_set_pc(cs, info->smp_loader_start);
> }
>
> -static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
> +void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
> Error **errp)
> {
> g_autofree void *storage = NULL;
> @@ -325,7 +325,7 @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
> }
> }
>
> -static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
> +void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
> bool boot_emmc)
> {
> DeviceState *card;
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index cbeacb214c..bba224c357 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -10,7 +10,9 @@
> #define ARM_ASPEED_H
>
> #include "hw/boards.h"
> +#include "hw/sd/sdhci.h"
> #include "qom/object.h"
> +#include "system/blockdev.h"
>
> typedef struct AspeedMachineState AspeedMachineState;
>
> @@ -41,5 +43,9 @@ struct AspeedMachineClass {
> uint32_t uart_default;
> };
>
> +void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
> + bool boot_emmc);
> +void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
> + Error **errp);
>
> #endif
Hi Cédric,
> -----Original Message-----
> From: Cédric Le Goater <clg@kaod.org>
> Sent: Friday, December 27, 2024 3:57 PM
> To: Steven Lee <steven_lee@aspeedtech.com>; Peter Maydell
> <peter.maydell@linaro.org>; Troy Lee <leetroy@gmail.com>; Jamin Lin
> <jamin_lin@aspeedtech.com>; Andrew Jeffery
> <andrew@codeconstruct.com.au>; Joel Stanley <joel@jms.id.au>; open
> list:ASPEED BMCs <qemu-arm@nongnu.org>; open list:All patches CC here
> <qemu-devel@nongnu.org>
> Cc: Troy Lee <troy_lee@aspeedtech.com>; Yunlin Tang
> <yunlin.tang@aspeedtech.com>
> Subject: Re: [PATCH 1/5] aspeed: Make sdhci_attach_drive and
> write_boot_rom public
>
> On 12/25/24 03:03, Steven Lee wrote:
> > sdhci_attach_drive and write_boot_rom functions may be used by the
> > aspeed machine supporting co-processors.
>
> I would move these routines to aspeed_soc_common.c file and rename them
> with an aspeed_ prefix.
>
>
> Thanks,
>
> C.
Thanks for the review.
I will move them to `aspeed_soc_common.c` and add the 'aspeed_' prefix to these functions.
Regards,
Steven
>
>
>
> > Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
> > ---
> > hw/arm/aspeed.c | 4 ++--
> > include/hw/arm/aspeed.h | 6 ++++++
> > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index
> > a18d4ed1fb..62ac8b7206 100644
> > --- a/hw/arm/aspeed.c
> > +++ b/hw/arm/aspeed.c
> > @@ -256,7 +256,7 @@ static void aspeed_reset_secondary(ARMCPU *cpu,
> > cpu_set_pc(cs, info->smp_loader_start);
> > }
> >
> > -static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t
> > rom_size,
> > +void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
> > Error **errp)
> > {
> > g_autofree void *storage = NULL; @@ -325,7 +325,7 @@ void
> > aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
> > }
> > }
> >
> > -static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo,
> > bool emmc,
> > +void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool
> > +emmc,
> > bool boot_emmc)
> > {
> > DeviceState *card;
> > diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index
> > cbeacb214c..bba224c357 100644
> > --- a/include/hw/arm/aspeed.h
> > +++ b/include/hw/arm/aspeed.h
> > @@ -10,7 +10,9 @@
> > #define ARM_ASPEED_H
> >
> > #include "hw/boards.h"
> > +#include "hw/sd/sdhci.h"
> > #include "qom/object.h"
> > +#include "system/blockdev.h"
> >
> > typedef struct AspeedMachineState AspeedMachineState;
> >
> > @@ -41,5 +43,9 @@ struct AspeedMachineClass {
> > uint32_t uart_default;
> > };
> >
> > +void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
> > + bool boot_emmc); void
> > +write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
> > + Error **errp);
> >
> > #endif
On 25/12/24 03:03, Steven Lee via wrote:
> sdhci_attach_drive and write_boot_rom functions may be used by
> the aspeed machine supporting co-processors.
>
> Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
> ---
> hw/arm/aspeed.c | 4 ++--
> include/hw/arm/aspeed.h | 6 ++++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index cbeacb214c..bba224c357 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -10,7 +10,9 @@
> #define ARM_ASPEED_H
>
> #include "hw/boards.h"
> +#include "hw/sd/sdhci.h"
> #include "qom/object.h"
> +#include "system/blockdev.h"
>
> typedef struct AspeedMachineState AspeedMachineState;
>
> @@ -41,5 +43,9 @@ struct AspeedMachineClass {
> uint32_t uart_default;
> };
>
> +void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
> + bool boot_emmc);
Indent is off.
> +void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
> + Error **errp);
Ditto.
Pre-existing, functions taking Error as last argument should return a
boolean indicating whether error occurred or not.
Fixing indentation:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Hi Philippe,
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Sent: Wednesday, December 25, 2024 7:28 PM
> To: Steven Lee <steven_lee@aspeedtech.com>; Cédric Le Goater
> <clg@kaod.org>; Peter Maydell <peter.maydell@linaro.org>; Troy Lee
> <leetroy@gmail.com>; Jamin Lin <jamin_lin@aspeedtech.com>; Andrew
> Jeffery <andrew@codeconstruct.com.au>; Joel Stanley <joel@jms.id.au>; open
> list:ASPEED BMCs <qemu-arm@nongnu.org>; open list:All patches CC here
> <qemu-devel@nongnu.org>
> Cc: Troy Lee <troy_lee@aspeedtech.com>; Yunlin Tang
> <yunlin.tang@aspeedtech.com>
> Subject: Re: [PATCH 1/5] aspeed: Make sdhci_attach_drive and
> write_boot_rom public
>
> On 25/12/24 03:03, Steven Lee via wrote:
> > sdhci_attach_drive and write_boot_rom functions may be used by the
> > aspeed machine supporting co-processors.
> >
> > Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
> > ---
> > hw/arm/aspeed.c | 4 ++--
> > include/hw/arm/aspeed.h | 6 ++++++
> > 2 files changed, 8 insertions(+), 2 deletions(-)
>
>
> > diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index
> > cbeacb214c..bba224c357 100644
> > --- a/include/hw/arm/aspeed.h
> > +++ b/include/hw/arm/aspeed.h
> > @@ -10,7 +10,9 @@
> > #define ARM_ASPEED_H
> >
> > #include "hw/boards.h"
> > +#include "hw/sd/sdhci.h"
> > #include "qom/object.h"
> > +#include "system/blockdev.h"
> >
> > typedef struct AspeedMachineState AspeedMachineState;
> >
> > @@ -41,5 +43,9 @@ struct AspeedMachineClass {
> > uint32_t uart_default;
> > };
> >
> > +void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
> > + bool boot_emmc);
>
> Indent is off.
>
> > +void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
> > + Error **errp);
>
> Ditto.
>
> Pre-existing, functions taking Error as last argument should return a boolean
> indicating whether error occurred or not.
>
> Fixing indentation:
Thanks for review.
Will fix it.
Steven
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
© 2016 - 2026 Red Hat, Inc.