aspeed/smc: QOMify AspeedSMCFlash

AspeedSMCFlash is a small structure representing the AHB memory window
through which the contents of a flash device can be accessed with MMIOs.

Introduce an AspeedSMCFlash SysBusDevice model and attach the associated
memory region to the newly instantiated objects.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
Cédric Le Goater 2021-10-12 08:20:08 +02:00
parent 10f915e4ca
commit f75b533117
2 changed files with 77 additions and 12 deletions

View file

@ -30,18 +30,23 @@
#include "qom/object.h"
struct AspeedSMCState;
typedef struct AspeedSMCFlash {
struct AspeedSMCState *controller;
#define TYPE_ASPEED_SMC_FLASH "aspeed.smc.flash"
OBJECT_DECLARE_SIMPLE_TYPE(AspeedSMCFlash, ASPEED_SMC_FLASH)
struct AspeedSMCFlash {
SysBusDevice parent_obj;
struct AspeedSMCState *controller;
uint8_t cs;
MemoryRegion mmio;
} AspeedSMCFlash;
};
#define TYPE_ASPEED_SMC "aspeed.smc"
OBJECT_DECLARE_TYPE(AspeedSMCState, AspeedSMCClass, ASPEED_SMC)
#define ASPEED_SMC_R_MAX (0x100 / 4)
#define ASPEED_SMC_CS_MAX 5
struct AspeedSMCState {
SysBusDevice parent_obj;
@ -72,7 +77,7 @@ struct AspeedSMCState {
MemoryRegion *dram_mr;
AddressSpace dram_as;
AspeedSMCFlash *flashes;
AspeedSMCFlash flashes[ASPEED_SMC_CS_MAX];
uint8_t snoop_index;
uint8_t snoop_dummies;