summaryrefslogtreecommitdiffstats
path: root/include/hw
diff options
context:
space:
mode:
authorCédric Le Goater2021-10-12 08:20:08 +0200
committerCédric Le Goater2021-10-12 08:20:08 +0200
commitf75b5331178b6771f2a96e92ce140dd2786c8282 (patch)
tree3a6067f4360e2021f6bb01e57c49ed198792fd3c /include/hw
parentaspeed/smc: Rename AspeedSMCFlash 'id' to 'cs' (diff)
downloadqemu-f75b5331178b6771f2a96e92ce140dd2786c8282.tar.gz
qemu-f75b5331178b6771f2a96e92ce140dd2786c8282.tar.xz
qemu-f75b5331178b6771f2a96e92ce140dd2786c8282.zip
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>
Diffstat (limited to 'include/hw')
-rw-r--r--include/hw/ssi/aspeed_smc.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h
index 40b6926b3e..ee943228b9 100644
--- a/include/hw/ssi/aspeed_smc.h
+++ b/include/hw/ssi/aspeed_smc.h
@@ -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;