On 10/23/25 12:01, Jamin Lin wrote:
> Aspeed machines will be moved into split C files for better
> modularization and future maintenance.
>
> To allow all machine implementations to reuse the same
> AspeedMachineState structure, the struct definition is moved
> from aspeed.c to the shared header aspeed.h.
>
> This change centralizes the common state structure used across
> all Aspeed machine models, reduces redundancy, and simplifies
> future refactoring work for new machines.
>
> No functional changes.
>
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
> include/hw/arm/aspeed.h | 14 ++++++++++++++
> hw/arm/aspeed.c | 14 --------------
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index 6c36455656..383ebb9759 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -11,6 +11,7 @@
>
> #include "hw/boards.h"
> #include "qom/object.h"
> +#include "hw/arm/aspeed_soc.h"
>
> typedef struct AspeedMachineState AspeedMachineState;
>
> @@ -24,6 +25,19 @@ DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass,
> #define ASPEED_MAC2_ON (1 << 2)
> #define ASPEED_MAC3_ON (1 << 3)
>
> +struct AspeedMachineState {
> + /* Private */
> + MachineState parent_obj;
> + /* Public */
> +
> + AspeedSoCState *soc;
> + MemoryRegion boot_rom;
> + bool mmio_exec;
> + uint32_t uart_chosen;
> + char *fmc_model;
> + char *spi_model;
> + uint32_t hw_strap1;
> +};
>
> struct AspeedMachineClass {
> MachineClass parent_obj;
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 1bc9e534ba..761b526994 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -35,20 +35,6 @@ static struct arm_boot_info aspeed_board_binfo = {
> .board_id = -1, /* device-tree-only board */
> };
>
> -struct AspeedMachineState {
> - /* Private */
> - MachineState parent_obj;
> - /* Public */
You could drop the 'Private' and 'Public' comments.
Anyhow,
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
> -
> - AspeedSoCState *soc;
> - MemoryRegion boot_rom;
> - bool mmio_exec;
> - uint32_t uart_chosen;
> - char *fmc_model;
> - char *spi_model;
> - uint32_t hw_strap1;
> -};
> -
> /* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */
> #if HOST_LONG_BITS == 32
> #define ASPEED_RAM_SIZE(sz) MIN((sz), 1 * GiB)