QOMify PPC4xx devices and minor clean ups
cover QOMify PPC4xx devices and minor clean ups
Hello,
This is mased on gitlab.com/danielhb/qemu/tree/ppc-7.2
This series contains the rest of Cédric's patches modified according my review comments and some other small clean ups I've noticed along the way. I've kept the From line of Cédric for patches that were originally his even though they are modified a bit. Not sure what's the best way for this or what Cédric prefers.
The last sdram changes are not yet here because I'm still looking at those and will come back to them but this series is ready to merge unless there are comments that need further changes. Please let me know what do you think.
Regards,
BALATON Zoltan
BALATON Zoltan (22):
ppc/ppc4xx: Introduce a DCR device model ppc/ppc405: QOM'ify CPC
ppc/ppc405: QOM'ify GPT
ppc/ppc405: QOM'ify OCM
ppc/ppc405: QOM'ify GPIO
ppc/ppc405: QOM'ify DMA
ppc/ppc405: QOM'ify EBC
ppc/ppc405: QOM'ify OPBA
ppc/ppc405: QOM'ify POB
ppc/ppc405: QOM'ify PLB
ppc/ppc405: QOM'ify MAL
ppc4xx: Move PLB model to ppc4xx_devs.c
ppc4xx: Move EBC model to ppc4xx_devs.c ppc/ppc405: Use an embedded PPCUIC model in SoC state hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device ppc/ppc405: Use an explicit I2C object ppc/ppc405: QOM'ify FPGA
ppc405: Move machine specific code to ppc405_boards.c hw/ppc/Kconfig: Remove PPC405 dependency from sam460ex hw/ppc/Kconfig: Move imply before select
ppc4xx: Drop empty default cases
ppc/ppc4xx: Fix sdram trace events
hw/intc/ppc-uic.c | 26 +- hw/ppc/Kconfig | 3 +- hw/ppc/ppc405.h | 182 +++++-- hw/ppc/ppc405_boards.c | 360 +++++++++---- hw/ppc/ppc405_uc.c | 1071 ++++++++++++------------------------- hw/ppc/ppc440_bamboo.c | 7 +- hw/ppc/ppc440_uc.c | 27 - hw/ppc/ppc4xx_devs.c | 473 +++++++++++++--- hw/ppc/sam460ex.c | 37 +- hw/ppc/trace-events | 3 - hw/ppc/virtex_ml507.c | 7 +- include/hw/intc/ppc-uic.h | 6 +- include/hw/ppc/ppc4xx.h | 71 ++- 13 files changed, 1223 insertions(+), 1050 deletions(-)
Signature · 1 line
2.30.4
PATCH 1/22 ppc/ppc4xx: Introduce a DCR device model
From: Cédric Le Goater <[email protected]>
The Device Control Registers (DCR) of on-SoC devices are accessed by software through the use of the mtdcr and mfdcr instructions. These are converted in transactions on a side band bus, the DCR bus, which connects the on-SoC devices to the CPU.
Ideally, we should model these accesses with a DCR namespace and DCR memory regions but today the DCR handlers are installed in a DCR table under the CPU. Instead, introduce a little device model wrapper to hold a CPU link and handle registration of DCR handlers.
The DCR device inherits from SysBus because most of these devices also have MMIO regions and/or IRQs. Being a SysBusDevice makes things easier to install the device model in the overall SoC.
--- hw/ppc/ppc4xx_devs.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 17 +++++++++++++++++ 2 files changed, 58 insertions(+)
hw/ppc/ppc4xx_devs.c +41 -0
@@ -664,3 +664,44 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum, mal, &dcr_read_mal, &dcr_write_mal); } } + +/* PPC4xx_DCR_DEVICE */ + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, +dcr_read_cb dcr_read,dcr_write_cb dcr_write) +{ +assert (dev->cpu); +ppc_dcr_register (&dev->cpu->env, dcrn, opaque, dcr_read, dcr_write); +} + +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp) +{ +object_property_set_link (OBJECT (dev),"cpu" ,OBJECT (cpu), &error_abort); +return sysbus_realize (SYS_BUS_DEVICE (dev), errp); +} + +static Property ppc4xx_dcr_properties[] = { +DEFINE_PROP_LINK ("cpu" , Ppc4xxDcrDeviceState, cpu,TYPE_POWERPC_CPU , + PowerPCCPU *), +DEFINE_PROP_END_OF_LIST (), +}; + +static void ppc4xx_dcr_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + +device_class_set_props (dc, ppc4xx_dcr_properties); +} + +static const TypeInfo ppc4xx_types[] = { + { + .name = TYPE_PPC4xx_DCR_DEVICE, + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (Ppc4xxDcrDeviceState), + .class_init = ppc4xx_dcr_class_init, + .abstract = true, + } +}; + +DEFINE_TYPES (ppc4xx_types)
include/hw/ppc/ppc4xx.h +17 -0
@@ -27,6 +27,7 @@#include "hw/ppc/ppc.h" #include "exec/memory.h" +#include "hw/sysbus.h" void ppc4xx_sdram_banks(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[],
@@ -44,4 +45,20 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum,#define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost" +/* +* Generic DCR device +*/ +#define TYPE_PPC4xx_DCR_DEVICE "ppc4xx-dcr-device" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxDcrDeviceState, PPC4xx_DCR_DEVICE); +struct Ppc4xxDcrDeviceState { +SysBusDevice parent_obj; + +PowerPCCPU *cpu; +}; + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, +dcr_read_cb dcr_read,dcr_write_cb dcr_write); +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp); +#endif /* PPC4XX_H */
Signature · 1 line
2.30.4
Re: [PATCH 01/22] ppc/ppc4xx: Introduce a DCR device model
Quoted 12 lines · BALATON Zoltan
From: Cédric Le Goater <[email protected]>
The Device Control Registers (DCR) of on-SoC devices are accessed by software through the use of the mtdcr and mfdcr instructions. These are converted in transactions on a side band bus, the DCR bus, which connects the on-SoC devices to the CPU.
Ideally, we should model these accesses with a DCR namespace and DCR memory regions but today the DCR handlers are installed in a DCR table under the CPU. Instead, introduce a little device model wrapper to hold a CPU link and handle registration of DCR handlers.
Quoted 5 lines
The DCR device inherits from SysBus because most of these devices also have MMIO regions and/or IRQs. Being a SysBusDevice makes things easier to install the device model in the overall SoC.
Signed-off-by Cédric Le Goater <[email protected]>
When re-sending a patch, it is a good practice to list the changes before the Sob of the person doing the resend.
I think you only changed the ppc4xx_dcr_register prototype. Correct ?
Thanks,
C.
Quoted 88 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc4xx_devs.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 17 +++++++++++++++++ 2 files changed, 58 insertions(+)hw/ppc/ppc4xx_devs.c +41
-0@@ -664,3 +664,44 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum, mal, &dcr_read_mal, &dcr_write_mal); } } + +/* PPC4xx_DCR_DEVICE */ + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, +dcr_read_cb dcr_read,dcr_write_cb dcr_write) +{ +assert (dev->cpu); +ppc_dcr_register (&dev->cpu->env, dcrn, opaque, dcr_read, dcr_write); +} + +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp) +{ +object_property_set_link (OBJECT (dev),"cpu" ,OBJECT (cpu), &error_abort); +return sysbus_realize (SYS_BUS_DEVICE (dev), errp); +} + +static Property ppc4xx_dcr_properties[] = { +DEFINE_PROP_LINK ("cpu" , Ppc4xxDcrDeviceState, cpu,TYPE_POWERPC_CPU , + PowerPCCPU *), +DEFINE_PROP_END_OF_LIST (), +}; + +static void ppc4xx_dcr_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + +device_class_set_props (dc, ppc4xx_dcr_properties); +} + +static const TypeInfo ppc4xx_types[] = { + { + .name = TYPE_PPC4xx_DCR_DEVICE, + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (Ppc4xxDcrDeviceState), + .class_init = ppc4xx_dcr_class_init, + .abstract = true, + } +}; + +DEFINE_TYPES (ppc4xx_types)include/hw/ppc/ppc4xx.h +17
-0@@ -27,6 +27,7 @@#include "hw/ppc/ppc.h" #include "exec/memory.h" +#include "hw/sysbus.h" void ppc4xx_sdram_banks(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[],@@ -44,4 +45,20 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum,#define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost" +/* +* Generic DCR device +*/ +#define TYPE_PPC4xx_DCR_DEVICE "ppc4xx-dcr-device" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxDcrDeviceState, PPC4xx_DCR_DEVICE); +struct Ppc4xxDcrDeviceState { +SysBusDevice parent_obj; + +PowerPCCPU *cpu; +}; + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, +dcr_read_cb dcr_read,dcr_write_cb dcr_write); +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp); +#endif /* PPC4XX_H */
Re: [PATCH 01/22] ppc/ppc4xx: Introduce a DCR device model
Quoted 17 lines · Cédric Le Goater
Quoted 16 lines · BALATON Zoltan
From: Cédric Le Goater <[email protected]>
The Device Control Registers (DCR) of on-SoC devices are accessed by software through the use of the mtdcr and mfdcr instructions. These are converted in transactions on a side band bus, the DCR bus, which connects the on-SoC devices to the CPU.
Ideally, we should model these accesses with a DCR namespace and DCR memory regions but today the DCR handlers are installed in a DCR table under the CPU. Instead, introduce a little device model wrapper to hold a CPU link and handle registration of DCR handlers.
The DCR device inherits from SysBus because most of these devices also have MMIO regions and/or IRQs. Being a SysBusDevice makes things easier to install the device model in the overall SoC.
Quoted 6 lines
Quoted 1 line
Signed-off-by Cédric Le Goater <[email protected]>When re-sending a patch, it is a good practice to list the changes before the Sob of the person doing the resend.
I think you only changed the
ppc4xx_dcr_registerprototype. Correct ?
Mostly, and the resulting rebase but maybe some small changes here and there but I think those are also just code style fixes. I did not know what you prefer with the from line so if you're OK with keeping it I can go through it again and mark changes before signed-off if you think that's better.
I've also started cleaning up the sdram model, I need a bit more time for that, I'll probably send it as a separate series.
Quoted 96 lines
Thanks,
C.
Quoted 89 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc4xx_devs.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 17 +++++++++++++++++ 2 files changed, 58 insertions(+)hw/ppc/ppc4xx_devs.c +4
-0@@ -664,3 +664,44 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum,uint8_t rxcnum, mal, &dcr_read_mal, &dcr_write_mal); } } + +/* PPC4xx_DCR_DEVICE */ + +void ppc4xx_dcr_register(Ppc4xxDcrDeviceState *dev, int dcrn, void*opaque,
hw/ppc/ppc4xx_devs.c +10
-0+ dcr_read_cb dcr_read, dcr_write_cb dcr_write) +{ +assert (dev->cpu); +ppc_dcr_register (&dev->cpu->env, dcrn, opaque, dcr_read, dcr_write); +} + +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp) +{ + object_property_set_link(OBJECT(dev), "cpu", OBJECT(cpu),
&error_abort);hw/ppc/ppc4xx_devs.c +27
-0+return sysbus_realize (SYS_BUS_DEVICE (dev), errp); +} + +static Property ppc4xx_dcr_properties[] = { +DEFINE_PROP_LINK ("cpu" , Ppc4xxDcrDeviceState, cpu,TYPE_POWERPC_CPU , + PowerPCCPU *), +DEFINE_PROP_END_OF_LIST (), +}; + +static void ppc4xx_dcr_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + +device_class_set_props (dc, ppc4xx_dcr_properties); +} + +static const TypeInfo ppc4xx_types[] = { + { + .name = TYPE_PPC4xx_DCR_DEVICE, + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (Ppc4xxDcrDeviceState), + .class_init = ppc4xx_dcr_class_init, + .abstract = true, + } +}; + +DEFINE_TYPES (ppc4xx_types)include/hw/ppc/ppc4xx.h +16
-0@@ -27,6 +27,7 @@#include "hw/ppc/ppc.h" #include "exec/memory.h" +#include "hw/sysbus.h" void ppc4xx_sdram_banks(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[],@@ -44,4 +45,20 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum,#define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost" +/* +* Generic DCR device +*/ +#define TYPE_PPC4xx_DCR_DEVICE "ppc4xx-dcr-device" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxDcrDeviceState, PPC4xx_DCR_DEVICE); +struct Ppc4xxDcrDeviceState { +SysBusDevice parent_obj; + +PowerPCCPU *cpu; +}; + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, +dcr_read_cb dcr_read,dcr_write_cb dcr_write); +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, +Error **errp); +#endif /* PPC4XX_H */
Re: [PATCH 01/22] ppc/ppc4xx: Introduce a DCR device model
Quoted 18 lines · BALATON Zoltan
Quoted 17 lines · Cédric Le Goater
Quoted 16 lines · BALATON Zoltan
From: Cédric Le Goater <[email protected]>
The Device Control Registers (DCR) of on-SoC devices are accessed by software through the use of the mtdcr and mfdcr instructions. These are converted in transactions on a side band bus, the DCR bus, which connects the on-SoC devices to the CPU.
Ideally, we should model these accesses with a DCR namespace and DCR memory regions but today the DCR handlers are installed in a DCR table under the CPU. Instead, introduce a little device model wrapper to hold a CPU link and handle registration of DCR handlers.
The DCR device inherits from SysBus because most of these devices also have MMIO regions and/or IRQs. Being a SysBusDevice makes things easier to install the device model in the overall SoC.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Cédric Le Goater <[email protected]>When re-sending a patch, it is a good practice to list the changes before the Sob of the person doing the resend.
I think you only changed the
ppc4xx_dcr_registerprototype. Correct ?Mostly, and the resulting rebase but maybe some small changes here and there but I think those are also just code style fixes. I did not know what you prefer with the from line
See commit 6a54ac2a9737 for next time.
Quoted 1 line
so if you're OK with keeping it I can go through it again and mark changes before signed-off if you think that's better.
Don't bother. I did a quick scan and didn't notice anything important.
Quoted 1 line
I've also started cleaning up the sdram model, I need a bit more time for that, I'll probably send it as a separate series.
OK. My initial patches were good enough for 405 and bamboo. May be keep the same basic idea.
Thanks,
C.
Quoted 91 lines
Quoted 91 lines
Thanks,
C.
Quoted 84 lines
Signed-off-by BALATON Zoltan <[email protected]>---
hw/ppc/ppc4xx_devs.c | 41 +++++++++++++++++++++++++++++++++++++++++include/hw/ppc/ppc4xx.h| 17 +++++++++++++++++2 files changed, 58 insertions(+)hw/ppc/ppc4xx_devs.c +41
-0@@ -664,3 +664,44 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum, mal, &dcr_read_mal, &dcr_write_mal); } } + +/* PPC4xx_DCR_DEVICE */ + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, + dcr_read_cb dcr_read, dcr_write_cb dcr_write) +{ + assert(dev->cpu); + ppc_dcr_register(&dev->cpu->env, dcrn, opaque, dcr_read, dcr_write); +} + +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, + Error **errp) +{ + object_property_set_link(OBJECT(dev), "cpu", OBJECT(cpu), &error_abort); + return sysbus_realize(SYS_BUS_DEVICE(dev), errp); +} + +static Property ppc4xx_dcr_properties[] = { + DEFINE_PROP_LINK("cpu", Ppc4xxDcrDeviceState, cpu, TYPE_POWERPC_CPU, + PowerPCCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + +static void ppc4xx_dcr_class_init (ObjectClass *oc,void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + + device_class_set_props(dc, ppc4xx_dcr_properties); +} + +static const TypeInfo ppc4xx_types[] = { + { + .name = TYPE_PPC4xx_DCR_DEVICE, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(Ppc4xxDcrDeviceState), + .class_init = ppc4xx_dcr_class_init, + .abstract = true, + } +}; + +DEFINE_TYPES (ppc4xx_types)include/hw/ppc/ppc4xx.h +1
-0@@ -27,6 +27,7 @@ #include "hw/ppc/ppc.h" #include "exec/memory.h" +#include "hw/sysbus.h" void ppc4xx_sdram_banks(MemoryRegion *ram, int nr_banks, MemoryRegion ram_memories[],@@ -44,4 +45,20 @@ void ppc4xx_mal_init(CPUPPCState *env, uint8_t txcnum, uint8_t rxcnum, #define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost"+/*
+ * Generic DCR device
+ */include/hw/ppc/ppc4xx.h +13
-0+#define TYPE_PPC4xx_DCR_DEVICE "ppc4xx-dcr-device" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxDcrDeviceState, PPC4xx_DCR_DEVICE); +struct Ppc4xxDcrDeviceState { + SysBusDevice parent_obj; + + PowerPCCPU *cpu; +}; + +void ppc4xx_dcr_register (Ppc4xxDcrDeviceState *dev,int dcrn,void *opaque, + dcr_read_cb dcr_read, dcr_write_cb dcr_write); +bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu, + Error **errp); +#endif /*
PPC4XX_H*/
PATCH 2/22 ppc/ppc405: QOM'ify CPC
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
The CPC controller is currently modeled as a DCR device.
Now that all clock settings are handled at the CPC level, change the SoC "sys-clk" property to be an alias on the same property in the CPC model.
--- hw/ppc/ppc405.h | 35 ++++++++++- hw/ppc/ppc405_uc.c | 141 ++++++++++++++++++++------------------------- 2 files changed, 95 insertions(+), 81 deletions(-)
hw/ppc/ppc405.h +34 -1
@@ -63,6 +63,39 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +#define TYPE_PPC405_CPC "ppc405-cpc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405CpcState,PPC405_CPC ); + +enum { +PPC405EP_CPU_CLK =0 , +PPC405EP_PLB_CLK =1 , +PPC405EP_OPB_CLK =2 , +PPC405EP_EBC_CLK =3 , +PPC405EP_MAL_CLK =4 , +PPC405EP_PCI_CLK =5 , +PPC405EP_UART0_CLK =6 , +PPC405EP_UART1_CLK =7 , +PPC405EP_CLK_NB =8 , +}; + +struct Ppc405CpcState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t sysclk; +clk_setup_t clk_setup[PPC405EP_CLK_NB ]; +uint32_t boot; +uint32_t epctl; +uint32_t pllmr[2 ]; +uint32_t ucr; +uint32_t srr; +uint32_t jtagid; +uint32_t pci; +/* Clock and power management */ +uint32_t er; +uint32_t fr; +uint32_t sr; +}; +#define TYPE_PPC405_SOC "ppc405-soc"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405SoCState,PPC405_SOC );
@@ -78,9 +111,9 @@ struct Ppc405SoCState {MemoryRegion *dram_mr;hwaddr ram_size; -uint32_t sysclk;PowerPCCPU cpu;DeviceState *uic; +Ppc405CpcState cpc; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +61 -80
221 lines not on this page · raw message
Signature · 1 line
2.30.4
PATCH 3/22 ppc/ppc405: QOM'ify GPT
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
The GPT controller is currently modeled as a SysBus device with a unique memory region, a couple of IRQs and a timer.
--- hw/ppc/ppc405.h | 22 ++++++++++ hw/ppc/ppc405_uc.c | 99 ++++++++++++++++++++++++--------------------- hw/ppc/trace-events | 1 - 3 files changed, 75 insertions(+), 47 deletions(-)
hw/ppc/ppc405.h +22 -0
@@ -63,6 +63,27 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* General purpose timers */ +#define TYPE_PPC405_GPT "ppc405-gpt" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GptState,PPC405_GPT ); +struct Ppc405GptState { +SysBusDevice parent_obj; + +MemoryRegion iomem; + +int64_t tb_offset; +uint32_t tb_freq; +QEMUTimer *timer; +qemu_irq irqs[5 ]; +uint32_t oe; +uint32_t ol; +uint32_t im; +uint32_t is; +uint32_t ie; +uint32_t comp[5 ]; +uint32_t mask[5 ]; +}; +#define TYPE_PPC405_CPC "ppc405-cpc"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405CpcState,PPC405_CPC );
@@ -114,6 +135,7 @@ struct Ppc405SoCState {PowerPCCPU cpu;DeviceState *uic;Ppc405CpcState cpc; +Ppc405GptState gpt; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +53 -46
190 lines not on this page · raw message
hw/ppc/trace-events +0 -1
@@ -162,7 +162,6 @@ ocm_unmap(const char* prefix, uint32_t isarc) "OCM unmap %s 0x%08" PRIx32 ppc4xx_gpt_read(uint64_t addr, uint32_t size) "addr 0x%" PRIx64 " size %d" ppc4xx_gpt_write(uint64_t addr, uint32_t size, uint64_t val) "addr 0x%" PRIx64 " size %d = 0x%" PRIx64 -ppc4xx_gpt_init(uint64_t addr) "offet 0x%" PRIx64 ppc405ep_clocks_compute(const char *param, uint32_t param2, uint32_t val) "%s 0x%1" PRIx32 " %d" ppc405ep_clocks_setup(const char *trace) "%s"
Signature · 1 line
2.30.4
PATCH 4/22 ppc/ppc405: QOM'ify OCM
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
The OCM controller is currently modeled as a simple DCR device with a couple of memory regions.
--- hw/ppc/ppc405.h | 16 ++++++++++ hw/ppc/ppc405_uc.c | 77 +++++++++++++++++++++++----------------------- 2 files changed, 55 insertions(+), 38 deletions(-)
hw/ppc/ppc405.h +16 -0
@@ -63,6 +63,21 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* On Chip Memory */ +#define TYPE_PPC405_OCM "ppc405-ocm" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OcmState,PPC405_OCM ); +struct Ppc405OcmState { +Ppc4xxDcrDeviceState parent_obj; + +MemoryRegion ram; +MemoryRegion isarc_ram; +MemoryRegion dsarc_ram; +uint32_t isarc; +uint32_t isacntl; +uint32_t dsarc; +uint32_t dsacntl; +}; +/* General purpose timers */ #define TYPE_PPC405_GPT "ppc405-gpt"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GptState,PPC405_GPT );
@@ -136,6 +151,7 @@ struct Ppc405SoCState {DeviceState *uic;Ppc405CpcState cpc;Ppc405GptState gpt; +Ppc405OcmState ocm; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +39 -38
139 lines not on this page · raw message
Signature · 1 line
2.30.4
PATCH 5/22 ppc/ppc405: QOM'ify GPIO
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
The GPIO controller is currently modeled as a simple SysBus device with a unique memory region.
--- hw/ppc/ppc405.h | 21 +++++++++++++++++++ hw/ppc/ppc405_uc.c | 50 ++++++++++++++++++++++----------------------- hw/ppc/trace-events | 1 - 3 files changed, 45 insertions(+), 27 deletions(-)
hw/ppc/ppc405.h +21 -0
@@ -63,6 +63,26 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* GPIO */ +#define TYPE_PPC405_GPIO "ppc405-gpio" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GpioState,PPC405_GPIO ); +struct Ppc405GpioState { +SysBusDevice parent_obj; + +MemoryRegion io; +uint32_t or; +uint32_t tcr; +uint32_t osrh; +uint32_t osrl; +uint32_t tsrh; +uint32_t tsrl; +uint32_t odr; +uint32_t ir; +uint32_t rr1; +uint32_t isr1h; +uint32_t isr1l; +}; +/* On Chip Memory */ #define TYPE_PPC405_OCM "ppc405-ocm"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OcmState,PPC405_OCM );
@@ -152,6 +172,7 @@ struct Ppc405SoCState {Ppc405CpcState cpc;Ppc405GptState gpt;Ppc405OcmState ocm; +Ppc405GpioState gpio; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +24 -26
86 lines not on this page · raw message
hw/ppc/trace-events +0 -1
@@ -154,7 +154,6 @@ opba_init(uint64_t addr) "offet 0x%" PRIx64 ppc405_gpio_read(uint64_t addr, uint32_t size) "addr 0x%" PRIx64 " size %d" ppc405_gpio_write(uint64_t addr, uint32_t size, uint64_t val) "addr 0x%" PRIx64 " size %d = 0x%" PRIx64 -ppc405_gpio_init(uint64_t addr) "offet 0x%" PRIx64 ocm_update_mappings(uint32_t isarc, uint32_t isacntl, uint32_t dsarc, uint32_t dsacntl, uint32_t ocm_isarc, uint32_t ocm_isacntl, uint32_t ocm_dsarc, uint32_t ocm_dsacntl) "OCM update ISA 0x%08" PRIx32 " 0x%08" PRIx32 " (0x%08" PRIx32" 0x%08" PRIx32 ") DSA 0x%08" PRIx32 " 0x%08" PRIx32" (0x%08" PRIx32 " 0x%08" PRIx32 ")" ocm_map(const char* prefix, uint32_t isarc) "OCM map %s 0x%08" PRIx32
Signature · 1 line
2.30.4
PATCH 6/22 ppc/ppc405: QOM'ify DMA
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
The DMA controller is currently modeled as a DCR device with a couple of IRQs.
--- hw/ppc/ppc405.h | 19 ++++++ hw/ppc/ppc405_uc.c | 141 ++++++++++++++++++++------------------------- 2 files changed, 81 insertions(+), 79 deletions(-)
hw/ppc/ppc405.h +19 -0
@@ -63,6 +63,24 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* DMA controller */ +#define TYPE_PPC405_DMA "ppc405-dma" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405DmaState,PPC405_DMA ); +struct Ppc405DmaState { +Ppc4xxDcrDeviceState parent_obj; + +qemu_irq irqs[4 ]; +uint32_t cr[4 ]; +uint32_t ct[4 ]; +uint32_t da[4 ]; +uint32_t sa[4 ]; +uint32_t sg[4 ]; +uint32_t sr; +uint32_t sgc; +uint32_t slp; +uint32_t pol; +}; +/* GPIO */ #define TYPE_PPC405_GPIO "ppc405-gpio"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405GpioState,PPC405_GPIO );
@@ -173,6 +191,7 @@ struct Ppc405SoCState {Ppc405GptState gpt;Ppc405OcmState ocm;Ppc405GpioState gpio; +Ppc405DmaState dma; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +62 -79
188 lines not on this page · raw message
Signature · 1 line
2.30.4
PATCH 7/22 ppc/ppc405: QOM'ify EBC
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
EBC is currently modeled as a DCR device. Also drop the ppc405_ebc_init() helper and adapt the sam460ex machine.
--- hw/ppc/ppc405.h | 17 ++++++++++++- hw/ppc/ppc405_uc.c | 62 ++++++++++++++++++++++++---------------------- hw/ppc/sam460ex.c | 4 ++- 3 files changed, 51 insertions(+), 32 deletions(-)
hw/ppc/ppc405.h +16 -1
@@ -63,6 +63,21 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* Peripheral controller */ +#define TYPE_PPC405_EBC "ppc405-ebc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); +struct Ppc405EbcState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t addr; +uint32_t bcr[8 ]; +uint32_t bap[8 ]; +uint32_t bear; +uint32_t besr0; +uint32_t besr1; +uint32_t cfg; +}; +/* DMA controller */ #define TYPE_PPC405_DMA "ppc405-dma"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405DmaState,PPC405_DMA );
@@ -192,12 +207,12 @@ struct Ppc405SoCState {Ppc405OcmState ocm;Ppc405GpioState gpio;Ppc405DmaState dma; + Ppc405EbcState ebc; };/* PowerPC 405 core */ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size);void ppc4xx_plb_init (CPUPPCState *env); -void ppc405_ebc_init (CPUPPCState *env);#endif /* PPC405_H */
hw/ppc/ppc405_uc.c +32 -30
118 lines not on this page · raw message
hw/ppc/sam460ex.c +3 -1
@@ -371,7 +371,9 @@ static void sam460ex_init(MachineState *machine) qdev_get_gpio_in(uic[0], 3));/* External bus controller */ -ppc405_ebc_init (env); + dev =qdev_new (TYPE_PPC405_EBC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal); +object_unref (OBJECT (dev));/* CPR */ ppc4xx_cpr_init (env);
Signature · 1 line
2.30.4
PATCH 8/22 ppc/ppc405: QOM'ify OPBA
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
The OPB arbitrer is currently modeled as a simple SysBus device with a unique memory region.
--- hw/ppc/ppc405.h | 12 +++++++++++ hw/ppc/ppc405_uc.c | 49 +++++++++++++++++++++++++++------------------ hw/ppc/trace-events | 1 - 3 files changed, 41 insertions(+), 21 deletions(-)
hw/ppc/ppc405.h +12 -0
@@ -63,6 +63,17 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* OPB arbitrer */ +#define TYPE_PPC405_OPBA "ppc405-opba" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OpbaState,PPC405_OPBA ); +struct Ppc405OpbaState { +SysBusDevice parent_obj; + +MemoryRegion io; +uint8_t cr; +uint8_t pr; +}; +/* Peripheral controller */ #define TYPE_PPC405_EBC "ppc405-ebc"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC );
@@ -208,6 +219,7 @@ struct Ppc405SoCState {Ppc405GpioState gpio;Ppc405DmaState dma;Ppc405EbcState ebc; +Ppc405OpbaState opba; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +29 -20
96 lines not on this page · raw message
hw/ppc/trace-events +0 -1
@@ -150,7 +150,6 @@ ppc440_pcix_reg_write(uint64_t addr, uint32_t val, uint32_t size) "addr 0x%" PRI # ppc405_boards.c opba_readb(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32 opba_writeb(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " = 0x%" PRIx64 -opba_init(uint64_t addr) "offet 0x%" PRIx64 ppc405_gpio_read(uint64_t addr, uint32_t size) "addr 0x%" PRIx64 " size %d" ppc405_gpio_write(uint64_t addr, uint32_t size, uint64_t val) "addr 0x%" PRIx64 " size %d = 0x%" PRIx64
Signature · 1 line
2.30.4
PATCH 9/22 ppc/ppc405: QOM'ify POB
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
POB is currently modeled as a simple DCR device.
--- hw/ppc/ppc405.h | 12 ++++++++++ hw/ppc/ppc405_uc.c | 56 ++++++++++++++++++++++++++-------------------- 2 files changed, 44 insertions(+), 24 deletions(-)
hw/ppc/ppc405.h +12 -0
@@ -63,6 +63,17 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* PLB to OPB bridge */ +#define TYPE_PPC405_POB "ppc405-pob" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB ); +struct Ppc405PobState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t bear; +uint32_t besr0; +uint32_t besr1; +}; +/* OPB arbitrer */ #define TYPE_PPC405_OPBA "ppc405-opba"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405OpbaState,PPC405_OPBA );
@@ -220,6 +231,7 @@ struct Ppc405SoCState {Ppc405DmaState dma;Ppc405EbcState ebc;Ppc405OpbaState opba; +Ppc405PobState pob; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +32 -24
107 lines not on this page · raw message
Signature · 1 line
2.30.4
PATCH 10/22 ppc/ppc405: QOM'ify PLB
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
PLB is currently modeled as a simple DCR device. Also drop the ppc4xx_plb_init() helper and adapt the sam460ex machine.
--- hw/ppc/ppc405.h | 14 ++++++++-- hw/ppc/ppc405_uc.c | 64 ++++++++++++++++++++++++++-------------------- hw/ppc/sam460ex.c | 4 ++- 3 files changed, 51 insertions(+), 31 deletions(-)
hw/ppc/ppc405.h +12 -2
@@ -63,6 +63,17 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; +/* Peripheral local bus arbitrer */ +#define TYPE_PPC405_PLB "ppc405-plb" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); +struct Ppc405PlbState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t acr; +uint32_t bear; +uint32_t besr; +}; +/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );
@@ -232,11 +243,10 @@ struct Ppc405SoCState {Ppc405EbcState ebc;Ppc405OpbaState opba;Ppc405PobState pob; + Ppc405PlbState plb; };/* PowerPC 405 core */ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size); -void ppc4xx_plb_init (CPUPPCState *env); -#endif /* PPC405_H */
hw/ppc/ppc405_uc.c +36 -28
113 lines not on this page · raw message
hw/ppc/sam460ex.c +3 -1
@@ -309,7 +309,9 @@ static void sam460ex_init(MachineState *machine)ppc_dcr_init (env,NULL ,NULL );/* PLB arbitrer */ -ppc4xx_plb_init (env); + dev =qdev_new (TYPE_PPC405_PLB ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal); +object_unref (OBJECT (dev));/* interrupt controllers */ for (i =0 ; i <ARRAY_SIZE (uic); i++) {
Signature · 1 line
2.30.4
PATCH 11/22 ppc/ppc405: QOM'ify MAL
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
The Memory Access Layer (MAL) controller is currently modeled as a DCR device with 4 IRQs. Also drop the ppc4xx_mal_init() helper and adapt the sam460ex machine.
--- hw/ppc/ppc405.h | 1 + hw/ppc/ppc405_uc.c | 17 +++-- hw/ppc/ppc4xx_devs.c | 145 ++++++++++++++++++++-------------------- hw/ppc/sam460ex.c | 12 ++-- include/hw/ppc/ppc4xx.h | 28 +++++++- 5 files changed, 117 insertions(+), 86 deletions(-)
hw/ppc/ppc405.h +1 -0
@@ -244,6 +244,7 @@ struct Ppc405SoCState {Ppc405OpbaState opba;Ppc405PobState pob;Ppc405PlbState plb; +Ppc4xxMalState mal; };/* PowerPC 405 core */
hw/ppc/ppc405_uc.c +11 -6
@@ -1372,6 +1372,8 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"pob" , &s->pob,TYPE_PPC405_POB );object_initialize_child (obj,"plb" , &s->plb,TYPE_PPC405_PLB ); + +object_initialize_child (obj,"mal" , &s->mal, TYPE_PPC4xx_MAL); }static void ppc405_reset (void *opaque)
@@ -1382,7 +1384,6 @@ static void ppc405_reset(void *opaque)static void ppc405_soc_realize (DeviceState *dev,Error **errp) {Ppc405SoCState *s =PPC405_SOC (dev); -qemu_irq mal_irqs[4 ];CPUPPCState *env;SysBusDevice *sbd;int i;
@@ -1500,11 +1501,15 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) }/* MAL */ - mal_irqs[0 ] =qdev_get_gpio_in (s->uic,11 ); - mal_irqs[1 ] =qdev_get_gpio_in (s->uic,12 ); - mal_irqs[2 ] =qdev_get_gpio_in (s->uic,13 ); - mal_irqs[3 ] =qdev_get_gpio_in (s->uic,14 ); -ppc4xx_mal_init (env,4 ,2 , mal_irqs); +object_property_set_int (OBJECT (&s->mal),"txc-num" ,4 , &error_abort); +object_property_set_int (OBJECT (&s->mal),"rxc-num" ,2 , &error_abort); +if (!ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (&s->mal), &s->cpu, errp)) { +return ; + } + sbd =SYS_BUS_DEVICE (&s->mal); +for (i =0 ; i <ARRAY_SIZE (s->mal.irqs); i++) { +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,11 + i)); + }/* Ethernet */ /* Uses UIC IRQs 9, 15, 17 */
hw/ppc/ppc4xx_devs.c +72 -73
192 lines not on this page · raw message
hw/ppc/sam460ex.c +8 -4
@@ -280,7 +280,6 @@ static void sam460ex_init(MachineState *machine)hwaddr ram_sizes[SDRAM_NR_BANKS ] = {0 };MemoryRegion *l2cache_ram =g_new (MemoryRegion,1 );DeviceState *uic[4 ]; -qemu_irq mal_irqs[4 ];int i;PCIBus *pci_bus;PowerPCCPU *cpu;
@@ -387,10 +386,15 @@ static void sam460ex_init(MachineState *machine)ppc4xx_sdr_init (env);/* MAL */ -for (i =0 ; i <ARRAY_SIZE (mal_irqs); i++) { - mal_irqs[i] =qdev_get_gpio_in (uic[2 ],3 + i); + dev =qdev_new (TYPE_PPC4xx_MAL); +qdev_prop_set_uint32 (dev,"txc-num" ,4 ); +qdev_prop_set_uint32 (dev,"rxc-num" ,16 ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (dev), cpu, &error_fatal); +object_unref (OBJECT (dev)); + sbdev =SYS_BUS_DEVICE (dev); +for (i =0 ; i <ARRAY_SIZE (PPC4xx_MAL (dev)->irqs); i++) { +sysbus_connect_irq (sbdev, i,qdev_get_gpio_in (uic[2 ],3 + i)); } -ppc4xx_mal_init (env,4 ,16 , mal_irqs);/* DMA */ ppc4xx_dma_init (env,0x200 );
include/hw/ppc/ppc4xx.h +25 -3
@@ -40,9 +40,6 @@ void ppc4xx_sdram_init (CPUPPCState *env, qemu_irq irq, int nbanks,hwaddr *ram_sizes, int do_init); -void ppc4xx_mal_init (CPUPPCState *env,uint8_t txcnum,uint8_t rxcnum, -qemu_irq irqs[4 ]); -#define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost"/*
@@ -61,4 +58,29 @@ void ppc4xx_dcr_register(Ppc4xxDcrDeviceState *dev, int dcrn, void *opaque,bool ppc4xx_dcr_realize (Ppc4xxDcrDeviceState *dev,PowerPCCPU *cpu,Error **errp); +/* Memory Access Layer (MAL) */ +#define TYPE_PPC4xx_MAL "ppc4xx-mal" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc4xxMalState, PPC4xx_MAL); +struct Ppc4xxMalState { +Ppc4xxDcrDeviceState parent_obj; + +qemu_irq irqs[4 ]; +uint32_t cfg; +uint32_t esr; +uint32_t ier; +uint32_t txcasr; +uint32_t txcarr; +uint32_t txeobisr; +uint32_t txdeir; +uint32_t rxcasr; +uint32_t rxcarr; +uint32_t rxeobisr; +uint32_t rxdeir; +uint32_t *txctpr; +uint32_t *rxctpr; +uint32_t *rcbs; +uint8_t txcnum; +uint8_t rxcnum; +}; +#endif /* PPC4XX_H */
Signature · 1 line
2.30.4
PATCH 12/22 ppc4xx: Move PLB model to ppc4xx_devs.c
In reply to BALATON ZoltanThe PLB is shared between 405 and 440 so move it to the shared file.
--- hw/ppc/ppc405.h | 11 ----- hw/ppc/ppc405_uc.c | 93 ---------------------------------------- hw/ppc/ppc4xx_devs.c | 94 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 11 +++++ 4 files changed, 105 insertions(+), 104 deletions(-)
hw/ppc/ppc405.h +0 -11
@@ -63,17 +63,6 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; -/* Peripheral local bus arbitrer */ -#define TYPE_PPC405_PLB "ppc405-plb" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); -struct Ppc405PlbState { -Ppc4xxDcrDeviceState parent_obj; - -uint32_t acr; -uint32_t bear; -uint32_t besr; -}; -/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );
hw/ppc/ppc405_uc.c +0 -93
105 lines not on this page · raw message
hw/ppc/ppc4xx_devs.c +94 -0
106 lines not on this page · raw message
include/hw/ppc/ppc4xx.h +11 -0
@@ -83,4 +83,15 @@ struct Ppc4xxMalState { uint8_t rxcnum; }; +/* Peripheral local bus arbitrer */ +#define TYPE_PPC405_PLB "ppc405-plb" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); +struct Ppc405PlbState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t acr; +uint32_t bear; +uint32_t besr; +}; +#endif /* PPC4XX_H */
Signature · 1 line
2.30.4
Re: [PATCH 12/22] ppc4xx: Move PLB model to ppc4xx_devs.c
Quoted 1 line · BALATON Zoltan
The PLB is shared between 405 and 440 so move it to the shared file.
Should we rename the device to Ppc4xxPlbState ?
Thanks,
C.
Quoted 274 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc405.h | 11 ----- hw/ppc/ppc405_uc.c | 93 ---------------------------------------- hw/ppc/ppc4xx_devs.c | 94 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 11 +++++ 4 files changed, 105 insertions(+), 104 deletions(-)hw/ppc/ppc405.h +0
-11@@ -63,17 +63,6 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; -/* Peripheral local bus arbitrer */ -#define TYPE_PPC405_PLB "ppc405-plb" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); -struct Ppc405PlbState { -Ppc4xxDcrDeviceState parent_obj; - -uint32_t acr; -uint32_t bear; -uint32_t besr; -}; -/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );hw/ppc/ppc405_uc.c +0
-93@@ -137,94 +137,6 @@ ram_addr_t ppc405_set_bootinfo(CPUPPCState *env, ram_addr_t ram_size)/*****************************************************************************/ /* Shared peripherals */ -/*****************************************************************************/ -/* Peripheral local bus arbitrer */ -enum { -PLB3A0_ACR =0x077 , -PLB4A0_ACR =0x081 , -PLB0_BESR =0x084 , -PLB0_BEAR =0x086 , -PLB0_ACR =0x087 , -PLB4A1_ACR =0x089 , -}; - -static uint32_t dcr_read_plb (void *opaque,int dcrn) -{ -Ppc405PlbState *plb = opaque; -uint32_t ret; - -switch (dcrn) { -case PLB0_ACR : - ret = plb->acr; -break ; -case PLB0_BEAR : - ret = plb->bear; -break ; -case PLB0_BESR : - ret = plb->besr; -break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; - } - -return ret; -} - -static void dcr_write_plb (void *opaque,int dcrn,uint32_t val) -{ -Ppc405PlbState *plb = opaque; - -switch (dcrn) { -case PLB0_ACR : -/* We don't care about the actual parameters written as -* we don't manage any priorities on the bus -*/ - plb->acr = val &0xF8000000 ; -break ; -case PLB0_BEAR : -/* Read only */ -break ; -case PLB0_BESR : -/* Write-clear */ - plb->besr &= ~val; -break ; - } -} - -static void ppc405_plb_reset (DeviceState *dev) -{ -Ppc405PlbState *plb =PPC405_PLB (dev); - - plb->acr =0x00000000 ; - plb->bear =0x00000000 ; - plb->besr =0x00000000 ; -} - -static void ppc405_plb_realize (DeviceState *dev,Error **errp) -{ -Ppc405PlbState *plb =PPC405_PLB (dev); -Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev); - -ppc4xx_dcr_register (dcr,PLB3A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); -ppc4xx_dcr_register (dcr,PLB4A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); -ppc4xx_dcr_register (dcr,PLB0_ACR , plb, &dcr_read_plb, &dcr_write_plb); -ppc4xx_dcr_register (dcr,PLB0_BEAR , plb, &dcr_read_plb, &dcr_write_plb); -ppc4xx_dcr_register (dcr,PLB0_BESR , plb, &dcr_read_plb, &dcr_write_plb); -ppc4xx_dcr_register (dcr,PLB4A1_ACR , plb, &dcr_read_plb, &dcr_write_plb); -} - -static void ppc405_plb_class_init (ObjectClass *oc,void *data) -{ -DeviceClass *dc =DEVICE_CLASS (oc); - - dc->realize = ppc405_plb_realize; - dc->reset = ppc405_plb_reset; -/* Reason: only works as function of a ppc4xx SoC */ - dc->user_creatable = false; -} -/*****************************************************************************/ /* PLB to OPB bridge */ enum {@@ -1535,11 +1447,6 @@ static void ppc405_soc_class_init(ObjectClass *oc, void *data)static const TypeInfo ppc405_types[] = { { - .name =TYPE_PPC405_PLB , - .parent = TYPE_PPC4xx_DCR_DEVICE, - .instance_size =sizeof (Ppc405PlbState), - .class_init = ppc405_plb_class_init, - }, { .name =TYPE_PPC405_POB , .parent = TYPE_PPC4xx_DCR_DEVICE, .instance_size =sizeof (Ppc405PobState),hw/ppc/ppc4xx_devs.c +94
-0@@ -658,6 +658,95 @@ static void ppc4xx_mal_class_init(ObjectClass *oc, void *data)device_class_set_props (dc, ppc4xx_mal_properties); } +/*****************************************************************************/ +/* Peripheral local bus arbitrer */ +enum { +PLB3A0_ACR =0x077 , +PLB4A0_ACR =0x081 , +PLB0_BESR =0x084 , +PLB0_BEAR =0x086 , +PLB0_ACR =0x087 , +PLB4A1_ACR =0x089 , +}; + +static uint32_t dcr_read_plb (void *opaque,int dcrn) +{ +Ppc405PlbState *plb = opaque; +uint32_t ret; + +switch (dcrn) { +case PLB0_ACR : + ret = plb->acr; +break ; +case PLB0_BEAR : + ret = plb->bear; +break ; +case PLB0_BESR : + ret = plb->besr; +break ; +default : +/* Avoid gcc warning */ + ret =0 ; +break ; + } + +return ret; +} + +static void dcr_write_plb (void *opaque,int dcrn,uint32_t val) +{ +Ppc405PlbState *plb = opaque; + +switch (dcrn) { +case PLB0_ACR : +/* +* We don't care about the actual parameters written as +* we don't manage any priorities on the bus +*/ + plb->acr = val &0xF8000000 ; +break ; +case PLB0_BEAR : +/* Read only */ +break ; +case PLB0_BESR : +/* Write-clear */ + plb->besr &= ~val; +break ; + } +} + +static void ppc405_plb_reset (DeviceState *dev) +{ +Ppc405PlbState *plb =PPC405_PLB (dev); + + plb->acr =0x00000000 ; + plb->bear =0x00000000 ; + plb->besr =0x00000000 ; +} + +static void ppc405_plb_realize (DeviceState *dev,Error **errp) +{ +Ppc405PlbState *plb =PPC405_PLB (dev); +Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev); + +ppc4xx_dcr_register (dcr,PLB3A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); +ppc4xx_dcr_register (dcr,PLB4A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); +ppc4xx_dcr_register (dcr,PLB0_ACR , plb, &dcr_read_plb, &dcr_write_plb); +ppc4xx_dcr_register (dcr,PLB0_BEAR , plb, &dcr_read_plb, &dcr_write_plb); +ppc4xx_dcr_register (dcr,PLB0_BESR , plb, &dcr_read_plb, &dcr_write_plb); +ppc4xx_dcr_register (dcr,PLB4A1_ACR , plb, &dcr_read_plb, &dcr_write_plb); +} + +static void ppc405_plb_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->realize = ppc405_plb_realize; + dc->reset = ppc405_plb_reset; +/* Reason: only works as function of a ppc4xx SoC */ + dc->user_creatable = false; +} +/* PPC4xx_DCR_DEVICE */ void ppc4xx_dcr_register(Ppc4xxDcrDeviceState *dev, int dcrn, void *opaque,@@ -694,6 +783,11 @@ static const TypeInfo ppc4xx_types[] = { .instance_size = sizeof(Ppc4xxMalState), .instance_finalize = ppc4xx_mal_finalize, .class_init = ppc4xx_mal_class_init, + }, { + .name = TYPE_PPC405_PLB, + .parent = TYPE_PPC4xx_DCR_DEVICE, + .instance_size = sizeof(Ppc405PlbState), + .class_init = ppc405_plb_class_init, }, { .name = TYPE_PPC4xx_DCR_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,include/hw/ppc/ppc4xx.h +11
-0@@ -83,4 +83,15 @@ struct Ppc4xxMalState { uint8_t rxcnum; }; +/* Peripheral local bus arbitrer */ +#define TYPE_PPC405_PLB "ppc405-plb" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); +struct Ppc405PlbState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t acr; +uint32_t bear; +uint32_t besr; +}; +#endif /* PPC4XX_H */
Re: [PATCH 12/22] ppc4xx: Move PLB model to ppc4xx_devs.c
Quoted 4 lines · Cédric Le Goater
Quoted 1 line · BALATON Zoltan
The PLB is shared between 405 and 440 so move it to the shared file.
Should we rename the device to Ppc4xxPlbState ?
I could do that (also for the other one moved). Ptobably nothing in these boards care about the names so it shouldn't break anything.
Regards,
BALATON Zoltan
Quoted 292 lines
Thanks,
C.
Quoted 285 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc405.h | 11 ----- hw/ppc/ppc405_uc.c | 93 ---------------------------------------- hw/ppc/ppc4xx_devs.c | 94 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 11 +++++ 4 files changed, 105 insertions(+), 104 deletions(-)hw/ppc/ppc405.h +0
-10@@ -63,17 +63,6 @@ struct ppc4xx_bd_info_t {uint32_t bi_iic_fast[2 ]; }; -/* Peripheral local bus arbitrer */ -#define TYPE_PPC405_PLB "ppc405-plb" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); -struct Ppc405PlbState { -Ppc4xxDcrDeviceState parent_obj; - -uint32_t acr; -uint32_t bear; -uint32_t besr; -}; -/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );hw/ppc/ppc405_uc.c +0
-73@@ -137,94 +137,6 @@ ram_addr_t ppc405_set_bootinfo(CPUPPCState *env, ram_addr_t ram_size)/*****************************************************************************/ /* Shared peripherals */ -/*****************************************************************************/ -/* Peripheral local bus arbitrer */ -enum { -PLB3A0_ACR =0x077 , -PLB4A0_ACR =0x081 , -PLB0_BESR =0x084 , -PLB0_BEAR =0x086 , -PLB0_ACR =0x087 , -PLB4A1_ACR =0x089 , -}; - -static uint32_t dcr_read_plb (void *opaque,int dcrn) -{ -Ppc405PlbState *plb = opaque; -uint32_t ret; - -switch (dcrn) { -case PLB0_ACR : - ret = plb->acr; -break ; -case PLB0_BEAR : - ret = plb->bear; -break ; -case PLB0_BESR : - ret = plb->besr; -break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; - } - -return ret; -} - -static void dcr_write_plb (void *opaque,int dcrn,uint32_t val) -{ -Ppc405PlbState *plb = opaque; - -switch (dcrn) { -case PLB0_ACR : -/* We don't care about the actual parameters written as -* we don't manage any priorities on the bus -*/ - plb->acr = val &0xF8000000 ; -break ; -case PLB0_BEAR : -/* Read only */ -break ; -case PLB0_BESR : -/* Write-clear */ - plb->besr &= ~val; -break ; - } -} - -static void ppc405_plb_reset (DeviceState *dev) -{ -Ppc405PlbState *plb =PPC405_PLB (dev); - - plb->acr =0x00000000 ; - plb->bear =0x00000000 ; - plb->besr =0x00000000 ; -} - -static void ppc405_plb_realize (DeviceState *dev,Error **errp) -{ -Ppc405PlbState *plb =PPC405_PLB (dev); -Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev); - -ppc4xx_dcr_register (dcr,PLB3A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); -ppc4xx_dcr_register (dcr,PLB4A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); - ppc4xx_dcr_register(dcr, PLB0_ACR, plb, &dcr_read_plb,
&dcr_write_plb);
- ppc4xx_dcr_register(dcr,PLB0_BEAR, plb,&dcr_read_plb,&dcr_write_plb);
- ppc4xx_dcr_register(dcr,PLB0_BESR, plb,&dcr_read_plb,&dcr_write_plb);
- ppc4xx_dcr_register(dcr,PLB4A1_ACR, plb,&dcr_read_plb,&dcr_write_plb);hw/ppc/ppc405_uc.c +0
-17-} - -static void ppc405_plb_class_init (ObjectClass *oc,void *data) -{ -DeviceClass *dc =DEVICE_CLASS (oc); - - dc->realize = ppc405_plb_realize; - dc->reset = ppc405_plb_reset; -/* Reason: only works as function of a ppc4xx SoC */ - dc->user_creatable = false; -} -/*****************************************************************************/ /* PLB to OPB bridge */ enum {@@ -1535,11 +1447,6 @@ static void ppc405_soc_class_init(ObjectClass *oc, void *data)static const TypeInfo ppc405_types[] = { { - .name =TYPE_PPC405_PLB , - .parent = TYPE_PPC4xx_DCR_DEVICE, - .instance_size =sizeof (Ppc405PlbState), - .class_init = ppc405_plb_class_init, - }, { .name =TYPE_PPC405_POB , .parent = TYPE_PPC4xx_DCR_DEVICE, .instance_size =sizeof (Ppc405PobState),hw/ppc/ppc4xx_devs.c +73
-0@@ -658,6 +658,95 @@ static void ppc4xx_mal_class_init(ObjectClass *oc, void *data)device_class_set_props (dc ,ppc4xx_mal_properties ); } +/*****************************************************************************/ +/* Peripheral local bus arbitrer */ +enum { +PLB3A0_ACR =0x077 , +PLB4A0_ACR =0x081 , +PLB0_BESR =0x084 , +PLB0_BEAR =0x086 , +PLB0_ACR =0x087 , + PLB4A1_ACR = 0x089, +}; + +static uint32_t dcr_read_plb (void *opaque,int dcrn) +{ +Ppc405PlbState *plb = opaque; +uint32_t ret; + +switch (dcrn) { +case PLB0_ACR : + ret = plb->acr; +break ; +case PLB0_BEAR : + ret = plb->bear; +break ; +case PLB0_BESR : + ret = plb->besr; +break ; +default : +/* Avoid gcc warning */ + ret =0 ; +break ; + } + +return ret; +} + +static void dcr_write_plb (void *opaque,int dcrn,uint32_t val) +{ +Ppc405PlbState *plb = opaque; + +switch (dcrn) { +case PLB0_ACR : +/* +* We don't care about the actual parameters written as +* we don't manage any priorities on the bus +*/ + plb->acr = val &0xF8000000 ; +break ; +case PLB0_BEAR : +/* Read only */ +break ; +case PLB0_BESR : +/* Write-clear */ + plb->besr &= ~val; +break ; + } +} + +static void ppc405_plb_reset (DeviceState *dev) +{ +Ppc405PlbState *plb =PPC405_PLB (dev); + + plb->acr =0x00000000 ; + plb->bear =0x00000000 ; + plb->besr =0x00000000 ; +} + +static void ppc405_plb_realize (DeviceState *dev,Error **errp) +{ +Ppc405PlbState *plb =PPC405_PLB (dev); +Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev); + +ppc4xx_dcr_register (dcr,PLB3A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); +ppc4xx_dcr_register (dcr,PLB4A0_ACR , plb, &dcr_read_plb, &dcr_write_plb); + ppc4xx_dcr_register(dcr, PLB0_ACR, plb, &dcr_read_plb,
&dcr_write_plb);
+ ppc4xx_dcr_register(dcr,PLB0_BEAR, plb,&dcr_read_plb,&dcr_write_plb);
+ ppc4xx_dcr_register(dcr,PLB0_BESR, plb,&dcr_read_plb,&dcr_write_plb);
+ ppc4xx_dcr_register(dcr,PLB4A1_ACR, plb,&dcr_read_plb,&dcr_write_plb);hw/ppc/ppc4xx_devs.c +12
-0+} + +static void ppc405_plb_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->realize = ppc405_plb_realize; + dc->reset = ppc405_plb_reset; +/* Reason: only works as function of a ppc4xx SoC */ + dc->user_creatable = false; +} +/* PPC4xx_DCR_DEVICE */ void ppc4xx_dcr_register(Ppc4xxDcrDeviceState *dev, int dcrn, void*opaque,
hw/ppc/ppc4xx_devs.c +5
-0@@ -694,6 +783,11 @@ static const TypeInfo ppc4xx_types[] = { .instance_size = sizeof(Ppc4xxMalState), .instance_finalize = ppc4xx_mal_finalize, .class_init = ppc4xx_mal_class_init, + }, { + .name = TYPE_PPC405_PLB, + .parent = TYPE_PPC4xx_DCR_DEVICE, + .instance_size = sizeof(Ppc405PlbState), + .class_init = ppc405_plb_class_init, }, { .name = TYPE_PPC4xx_DCR_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,include/hw/ppc/ppc4xx.h +10
-0@@ -83,4 +83,15 @@ struct Ppc4xxMalState {uint8_t rxcnum; }; +/* Peripheral local bus arbitrer */ +#define TYPE_PPC405_PLB "ppc405-plb" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PlbState,PPC405_PLB ); +struct Ppc405PlbState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t acr; +uint32_t bear; +uint32_t besr; +}; +#endif /* PPC4XX_H */
PATCH 13/22 ppc4xx: Move EBC model to ppc4xx_devs.c
In reply to BALATON ZoltanThe EBC is shared between 405 and 440 so move it to shared file.
--- hw/ppc/ppc405.h | 15 ---- hw/ppc/ppc405_uc.c | 191 ---------------------------------------- hw/ppc/ppc4xx_devs.c | 191 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 15 ++++ 4 files changed, 206 insertions(+), 206 deletions(-)
hw/ppc/ppc405.h +0 -15
@@ -85,21 +85,6 @@ struct Ppc405OpbaState {uint8_t pr; }; -/* Peripheral controller */ -#define TYPE_PPC405_EBC "ppc405-ebc" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); -struct Ppc405EbcState { -Ppc4xxDcrDeviceState parent_obj; - -uint32_t addr; -uint32_t bcr[8 ]; -uint32_t bap[8 ]; -uint32_t bear; -uint32_t besr0; -uint32_t besr1; -uint32_t cfg; -}; -/* DMA controller */ #define TYPE_PPC405_DMA "ppc405-dma"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405DmaState,PPC405_DMA );
hw/ppc/ppc405_uc.c +0 -191
203 lines not on this page · raw message
hw/ppc/ppc4xx_devs.c +191 -0
203 lines not on this page · raw message
include/hw/ppc/ppc4xx.h +15 -0
@@ -94,4 +94,19 @@ struct Ppc405PlbState { uint32_t besr; }; +/* Peripheral controller */ +#define TYPE_PPC405_EBC "ppc405-ebc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); +struct Ppc405EbcState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t addr; +uint32_t bcr[8 ]; +uint32_t bap[8 ]; +uint32_t bear; +uint32_t besr0; +uint32_t besr1; +uint32_t cfg; +}; +#endif /* PPC4XX_H */
Signature · 1 line
2.30.4
Re: [PATCH 13/22] ppc4xx: Move EBC model to ppc4xx_devs.c
Quoted 1 line · BALATON Zoltan
The EBC is shared between 405 and 440 so move it to shared file.
Should we rename the device to Ppc4xxEbcState ?
Thanks,
C.
Quoted 476 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc405.h | 15 ---- hw/ppc/ppc405_uc.c | 191 ---------------------------------------- hw/ppc/ppc4xx_devs.c | 191 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/ppc4xx.h | 15 ++++ 4 files changed, 206 insertions(+), 206 deletions(-)hw/ppc/ppc405.h +0
-15@@ -85,21 +85,6 @@ struct Ppc405OpbaState {uint8_t pr; }; -/* Peripheral controller */ -#define TYPE_PPC405_EBC "ppc405-ebc" -OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); -struct Ppc405EbcState { -Ppc4xxDcrDeviceState parent_obj; - -uint32_t addr; -uint32_t bcr[8 ]; -uint32_t bap[8 ]; -uint32_t bear; -uint32_t besr0; -uint32_t besr1; -uint32_t cfg; -}; -/* DMA controller */ #define TYPE_PPC405_DMA "ppc405-dma"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405DmaState,PPC405_DMA );hw/ppc/ppc405_uc.c +0
-191@@ -299,192 +299,6 @@ static void ppc405_opba_class_init(ObjectClass *oc, void *data)/* Code decompression controller */ /* XXX: TODO */ -/*****************************************************************************/ -/* Peripheral controller */ -enum { -EBC0_CFGADDR =0x012 , -EBC0_CFGDATA =0x013 , -}; - -static uint32_t dcr_read_ebc (void *opaque,int dcrn) -{ -Ppc405EbcState *ebc = opaque; -uint32_t ret; - -switch (dcrn) { -case EBC0_CFGADDR : - ret = ebc->addr; -break ; -case EBC0_CFGDATA : -switch (ebc->addr) { -case 0x00 :/* B0CR */ - ret = ebc->bcr[0 ]; -break ; -case 0x01 :/* B1CR */ - ret = ebc->bcr[1 ]; -break ; -case 0x02 :/* B2CR */ - ret = ebc->bcr[2 ]; -break ; -case 0x03 :/* B3CR */ - ret = ebc->bcr[3 ]; -break ; -case 0x04 :/* B4CR */ - ret = ebc->bcr[4 ]; -break ; -case 0x05 :/* B5CR */ - ret = ebc->bcr[5 ]; -break ; -case 0x06 :/* B6CR */ - ret = ebc->bcr[6 ]; -break ; -case 0x07 :/* B7CR */ - ret = ebc->bcr[7 ]; -break ; -case 0x10 :/* B0AP */ - ret = ebc->bap[0 ]; -break ; -case 0x11 :/* B1AP */ - ret = ebc->bap[1 ]; -break ; -case 0x12 :/* B2AP */ - ret = ebc->bap[2 ]; -break ; -case 0x13 :/* B3AP */ - ret = ebc->bap[3 ]; -break ; -case 0x14 :/* B4AP */ - ret = ebc->bap[4 ]; -break ; -case 0x15 :/* B5AP */ - ret = ebc->bap[5 ]; -break ; -case 0x16 :/* B6AP */ - ret = ebc->bap[6 ]; -break ; -case 0x17 :/* B7AP */ - ret = ebc->bap[7 ]; -break ; -case 0x20 :/* BEAR */ - ret = ebc->bear; -break ; -case 0x21 :/* BESR0 */ - ret = ebc->besr0; -break ; -case 0x22 :/* BESR1 */ - ret = ebc->besr1; -break ; -case 0x23 :/* CFG */ - ret = ebc->cfg; -break ; -default : - ret =0x00000000 ; -break ; - } -break ; -default : - ret =0x00000000 ; -break ; - } - -return ret; -} - -static void dcr_write_ebc (void *opaque,int dcrn,uint32_t val) -{ -Ppc405EbcState *ebc = opaque; - -switch (dcrn) { -case EBC0_CFGADDR : - ebc->addr = val; -break ; -case EBC0_CFGDATA : -switch (ebc->addr) { -case 0x00 :/* B0CR */ -break ; -case 0x01 :/* B1CR */ -break ; -case 0x02 :/* B2CR */ -break ; -case 0x03 :/* B3CR */ -break ; -case 0x04 :/* B4CR */ -break ; -case 0x05 :/* B5CR */ -break ; -case 0x06 :/* B6CR */ -break ; -case 0x07 :/* B7CR */ -break ; -case 0x10 :/* B0AP */ -break ; -case 0x11 :/* B1AP */ -break ; -case 0x12 :/* B2AP */ -break ; -case 0x13 :/* B3AP */ -break ; -case 0x14 :/* B4AP */ -break ; -case 0x15 :/* B5AP */ -break ; -case 0x16 :/* B6AP */ -break ; -case 0x17 :/* B7AP */ -break ; -case 0x20 :/* BEAR */ -break ; -case 0x21 :/* BESR0 */ -break ; -case 0x22 :/* BESR1 */ -break ; -case 0x23 :/* CFG */ -break ; -default : -break ; - } -break ; -default : -break ; - } -} - -static void ppc405_ebc_reset (DeviceState *dev) -{ -Ppc405EbcState *ebc =PPC405_EBC (dev); -int i; - - ebc->addr =0x00000000 ; - ebc->bap[0 ] =0x7F8FFE80 ; - ebc->bcr[0 ] =0xFFE28000 ; -for (i =0 ; i <8 ; i++) { - ebc->bap[i] =0x00000000 ; - ebc->bcr[i] =0x00000000 ; - } - ebc->besr0 =0x00000000 ; - ebc->besr1 =0x00000000 ; - ebc->cfg =0x80400000 ; -} - -static void ppc405_ebc_realize (DeviceState *dev,Error **errp) -{ -Ppc405EbcState *ebc =PPC405_EBC (dev); -Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev); - -ppc4xx_dcr_register (dcr,EBC0_CFGADDR , ebc, &dcr_read_ebc, &dcr_write_ebc); -ppc4xx_dcr_register (dcr,EBC0_CFGDATA , ebc, &dcr_read_ebc, &dcr_write_ebc); -} - -static void ppc405_ebc_class_init (ObjectClass *oc,void *data) -{ -DeviceClass *dc =DEVICE_CLASS (oc); - - dc->realize = ppc405_ebc_realize; - dc->reset = ppc405_ebc_reset; -/* Reason: only works as function of a ppc4xx SoC */ - dc->user_creatable = false; -} -/*****************************************************************************/ /* DMA controller */ enum {@@ -1456,11 +1270,6 @@ static const TypeInfo ppc405_types[] = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(Ppc405OpbaState), .class_init = ppc405_opba_class_init, - }, { - .name = TYPE_PPC405_EBC, - .parent = TYPE_PPC4xx_DCR_DEVICE, - .instance_size = sizeof(Ppc405EbcState), - .class_init = ppc405_ebc_class_init, }, { .name = TYPE_PPC405_DMA, .parent = TYPE_PPC4xx_DCR_DEVICE,hw/ppc/ppc4xx_devs.c +191
-0@@ -747,6 +747,192 @@ static void ppc405_plb_class_init(ObjectClass *oc, void *data) dc->user_creatable = false; } +/*****************************************************************************/ +/* Peripheral controller */ +enum { +EBC0_CFGADDR =0x012 , +EBC0_CFGDATA =0x013 , +}; + +static uint32_t dcr_read_ebc (void *opaque,int dcrn) +{ +Ppc405EbcState *ebc = opaque; +uint32_t ret; + +switch (dcrn) { +case EBC0_CFGADDR : + ret = ebc->addr; +break ; +case EBC0_CFGDATA : +switch (ebc->addr) { +case 0x00 :/* B0CR */ + ret = ebc->bcr[0 ]; +break ; +case 0x01 :/* B1CR */ + ret = ebc->bcr[1 ]; +break ; +case 0x02 :/* B2CR */ + ret = ebc->bcr[2 ]; +break ; +case 0x03 :/* B3CR */ + ret = ebc->bcr[3 ]; +break ; +case 0x04 :/* B4CR */ + ret = ebc->bcr[4 ]; +break ; +case 0x05 :/* B5CR */ + ret = ebc->bcr[5 ]; +break ; +case 0x06 :/* B6CR */ + ret = ebc->bcr[6 ]; +break ; +case 0x07 :/* B7CR */ + ret = ebc->bcr[7 ]; +break ; +case 0x10 :/* B0AP */ + ret = ebc->bap[0 ]; +break ; +case 0x11 :/* B1AP */ + ret = ebc->bap[1 ]; +break ; +case 0x12 :/* B2AP */ + ret = ebc->bap[2 ]; +break ; +case 0x13 :/* B3AP */ + ret = ebc->bap[3 ]; +break ; +case 0x14 :/* B4AP */ + ret = ebc->bap[4 ]; +break ; +case 0x15 :/* B5AP */ + ret = ebc->bap[5 ]; +break ; +case 0x16 :/* B6AP */ + ret = ebc->bap[6 ]; +break ; +case 0x17 :/* B7AP */ + ret = ebc->bap[7 ]; +break ; +case 0x20 :/* BEAR */ + ret = ebc->bear; +break ; +case 0x21 :/* BESR0 */ + ret = ebc->besr0; +break ; +case 0x22 :/* BESR1 */ + ret = ebc->besr1; +break ; +case 0x23 :/* CFG */ + ret = ebc->cfg; +break ; +default : + ret =0x00000000 ; +break ; + } +break ; +default : + ret =0x00000000 ; +break ; + } + +return ret; +} + +static void dcr_write_ebc (void *opaque,int dcrn,uint32_t val) +{ +Ppc405EbcState *ebc = opaque; + +switch (dcrn) { +case EBC0_CFGADDR : + ebc->addr = val; +break ; +case EBC0_CFGDATA : +switch (ebc->addr) { +case 0x00 :/* B0CR */ +break ; +case 0x01 :/* B1CR */ +break ; +case 0x02 :/* B2CR */ +break ; +case 0x03 :/* B3CR */ +break ; +case 0x04 :/* B4CR */ +break ; +case 0x05 :/* B5CR */ +break ; +case 0x06 :/* B6CR */ +break ; +case 0x07 :/* B7CR */ +break ; +case 0x10 :/* B0AP */ +break ; +case 0x11 :/* B1AP */ +break ; +case 0x12 :/* B2AP */ +break ; +case 0x13 :/* B3AP */ +break ; +case 0x14 :/* B4AP */ +break ; +case 0x15 :/* B5AP */ +break ; +case 0x16 :/* B6AP */ +break ; +case 0x17 :/* B7AP */ +break ; +case 0x20 :/* BEAR */ +break ; +case 0x21 :/* BESR0 */ +break ; +case 0x22 :/* BESR1 */ +break ; +case 0x23 :/* CFG */ +break ; +default : +break ; + } +break ; +default : +break ; + } +} + +static void ppc405_ebc_reset (DeviceState *dev) +{ +Ppc405EbcState *ebc =PPC405_EBC (dev); +int i; + + ebc->addr =0x00000000 ; + ebc->bap[0 ] =0x7F8FFE80 ; + ebc->bcr[0 ] =0xFFE28000 ; +for (i =0 ; i <8 ; i++) { + ebc->bap[i] =0x00000000 ; + ebc->bcr[i] =0x00000000 ; + } + ebc->besr0 =0x00000000 ; + ebc->besr1 =0x00000000 ; + ebc->cfg =0x80400000 ; +} + +static void ppc405_ebc_realize (DeviceState *dev,Error **errp) +{ +Ppc405EbcState *ebc =PPC405_EBC (dev); +Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev); + +ppc4xx_dcr_register (dcr,EBC0_CFGADDR , ebc, &dcr_read_ebc, &dcr_write_ebc); +ppc4xx_dcr_register (dcr,EBC0_CFGDATA , ebc, &dcr_read_ebc, &dcr_write_ebc); +} + +static void ppc405_ebc_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->realize = ppc405_ebc_realize; + dc->reset = ppc405_ebc_reset; +/* Reason: only works as function of a ppc4xx SoC */ + dc->user_creatable = false; +} +/* PPC4xx_DCR_DEVICE */ void ppc4xx_dcr_register(Ppc4xxDcrDeviceState *dev, int dcrn, void *opaque,@@ -788,6 +974,11 @@ static const TypeInfo ppc4xx_types[] = { .parent = TYPE_PPC4xx_DCR_DEVICE, .instance_size = sizeof(Ppc405PlbState), .class_init = ppc405_plb_class_init, + }, { + .name = TYPE_PPC405_EBC, + .parent = TYPE_PPC4xx_DCR_DEVICE, + .instance_size = sizeof(Ppc405EbcState), + .class_init = ppc405_ebc_class_init, }, { .name = TYPE_PPC4xx_DCR_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,include/hw/ppc/ppc4xx.h +15
-0@@ -94,4 +94,19 @@ struct Ppc405PlbState { uint32_t besr; }; +/* Peripheral controller */ +#define TYPE_PPC405_EBC "ppc405-ebc" +OBJECT_DECLARE_SIMPLE_TYPE (Ppc405EbcState,PPC405_EBC ); +struct Ppc405EbcState { +Ppc4xxDcrDeviceState parent_obj; + +uint32_t addr; +uint32_t bcr[8 ]; +uint32_t bap[8 ]; +uint32_t bear; +uint32_t besr0; +uint32_t besr1; +uint32_t cfg; +}; +#endif /* PPC4XX_H */
PATCH 14/22 ppc/ppc405: Use an embedded PPCUIC model in SoC state
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
--- hw/ppc/ppc405.h | 3 ++- hw/ppc/ppc405_uc.c | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-)
hw/ppc/ppc405.h +2 -1
@@ -27,6 +27,7 @@#include "qom/object.h" #include "hw/ppc/ppc4xx.h" +#include "hw/intc/ppc-uic.h" #define PPC405EP_SDRAM_BASE 0x00000000#define PPC405EP_NVRAM_BASE 0xF0000000
@@ -208,7 +209,7 @@ struct Ppc405SoCState {hwaddr ram_size;PowerPCCPU cpu; -DeviceState *uic; +PPCUIC uic;Ppc405CpcState cpc;Ppc405GptState gpt;Ppc405OcmState ocm;
hw/ppc/ppc405_uc.c +14 -14
@@ -1080,6 +1080,8 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"cpu" , &s->cpu,POWERPC_CPU_TYPE_NAME ("405ep" )); +object_initialize_child (obj,"uic" , &s->uic,TYPE_PPC_UIC ); +object_initialize_child (obj,"cpc" , &s->cpc,TYPE_PPC405_CPC );object_property_add_alias (obj,"sys-clk" ,OBJECT (&s->cpc),"sys-clk" );
@@ -1147,17 +1149,15 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (sbd,0 ,0xef600600 );/* Universal interrupt controller */ - s->uic =qdev_new (TYPE_PPC_UIC ); - -object_property_set_link (OBJECT (s->uic),"cpu" ,OBJECT (&s->cpu), +object_property_set_link (OBJECT (&s->uic),"cpu" ,OBJECT (&s->cpu), &error_fatal); -if (!sysbus_realize (SYS_BUS_DEVICE (s->uic), errp)) { + sbd =SYS_BUS_DEVICE (&s->uic); +if (!sysbus_realize (sbd, errp)) {return ; } - -sysbus_connect_irq (SYS_BUS_DEVICE (s->uic),PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_INT)); -sysbus_connect_irq (SYS_BUS_DEVICE (s->uic),PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_CINT));/* SDRAM controller */
@@ -1168,7 +1168,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)"ppc405.sdram0" , s->dram_mr, s->ram_bases[0], s->ram_sizes[0]); -ppc4xx_sdram_init (env,qdev_get_gpio_in (s->uic,17 ),1 , +ppc4xx_sdram_init (env,qdev_get_gpio_in (DEVICE (&s->uic),17 ),1 , s->ram_banks, s->ram_bases, s->ram_sizes, s->do_dram_init);
@@ -1183,12 +1183,12 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) } sbd =SYS_BUS_DEVICE (&s->dma);for (i =0 ; i <ARRAY_SIZE (s->dma.irqs); i++) { -sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,5 + i)); +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (DEVICE (&s->uic),5 + i)); }/* I2C controller */ sysbus_create_simple (TYPE_PPC4xx_I2C,0xef600500 , -qdev_get_gpio_in (s->uic,2 )); +qdev_get_gpio_in (DEVICE (&s->uic),2 ));/* GPIO */ sbd =SYS_BUS_DEVICE (&s->gpio);
@@ -1200,13 +1200,13 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)/* Serial ports */ if (serial_hd (0 ) !=NULL ) {serial_mm_init (get_system_memory (),0xef600300 ,0 , -qdev_get_gpio_in (s->uic,0 ), +qdev_get_gpio_in (DEVICE (&s->uic),0 ),PPC_SERIAL_MM_BAUDBASE ,serial_hd (0 ),DEVICE_BIG_ENDIAN ); }if (serial_hd (1 ) !=NULL ) {serial_mm_init (get_system_memory (),0xef600400 ,0 , -qdev_get_gpio_in (s->uic,1 ), +qdev_get_gpio_in (DEVICE (&s->uic),1 ),PPC_SERIAL_MM_BAUDBASE ,serial_hd (1 ),DEVICE_BIG_ENDIAN ); }
@@ -1223,7 +1223,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) }sysbus_mmio_map (sbd,0 ,0xef600000 );for (i =0 ; i <ARRAY_SIZE (s->gpt.irqs); i++) { -sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,19 + i)); +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (DEVICE (&s->uic),19 + i)); }/* MAL */
@@ -1234,7 +1234,7 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) } sbd =SYS_BUS_DEVICE (&s->mal);for (i =0 ; i <ARRAY_SIZE (s->mal.irqs); i++) { -sysbus_connect_irq (sbd, i,qdev_get_gpio_in (s->uic,11 + i)); +sysbus_connect_irq (sbd, i,qdev_get_gpio_in (DEVICE (&s->uic),11 + i)); }/* Ethernet */
Signature · 1 line
2.30.4
PATCH 15/22 hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device
In reply to BALATON ZoltanMake ppc-uic a subclass of ppc4xx-dcr-device which will handle the cpu link and make it uniform with the other PPC4xx devices.
--- hw/intc/ppc-uic.c | 26 ++++++-------------------- hw/ppc/ppc405_uc.c | 6 ++---- hw/ppc/ppc440_bamboo.c | 7 ++----- hw/ppc/ppc4xx_devs.c | 1 - hw/ppc/sam460ex.c | 17 +++++++---------- hw/ppc/virtex_ml507.c | 7 ++----- include/hw/intc/ppc-uic.h | 6 ++---- 7 files changed, 21 insertions(+), 49 deletions(-)
hw/intc/ppc-uic.c +6 -20
@@ -25,11 +25,8 @@#include "qemu/osdep.h" #include "hw/intc/ppc-uic.h" #include "hw/irq.h" -#include "cpu.h" -#include "hw/ppc/ppc.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "qapi/error.h" enum {DCR_UICSR =0x000 ,
@@ -105,10 +102,9 @@ static void ppcuic_trigger_irq(PPCUIC *uic)static void ppcuic_set_irq (void *opaque,int irq_num,int level) { -PPCUIC *uic; +PPCUIC *uic = opaque;uint32_t mask, sr; - uic = opaque; mask =1U << (31 - irq_num); LOG_UIC("%s: irq %d level %d uicsr %08" PRIx32 " mask %08" PRIx32 " => %08" PRIx32 " %08" PRIx32 "\n",
@@ -144,10 +140,9 @@ static void ppcuic_set_irq(void *opaque, int irq_num, int level)static uint32_t dcr_read_uic (void *opaque,int dcrn) { -PPCUIC *uic; +PPCUIC *uic = opaque;uint32_t ret; - uic = opaque; dcrn -= uic->dcr_base;switch (dcrn) {case DCR_UICSR :
@@ -192,9 +187,8 @@ static uint32_t dcr_read_uic(void *opaque, int dcrn)static void dcr_write_uic (void *opaque,int dcrn,uint32_t val) { -PPCUIC *uic; +PPCUIC *uic = opaque; - uic = opaque; dcrn -= uic->dcr_base;LOG_UIC ("%s: dcr %d val 0x%x\n" , __func__, dcrn, val);switch (dcrn) {
@@ -251,19 +245,12 @@ static void ppc_uic_reset(DeviceState *dev)static void ppc_uic_realize (DeviceState *dev,Error **errp) {PPCUIC *uic =PPC_UIC (dev); +Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); -PowerPCCPU *cpu;int i; -if (!uic->cpu) { -/* This is a programming error in the code using this device */ -error_setg (errp,"ppc-uic 'cpu' link property was not set" ); -return ; - } - - cpu =POWERPC_CPU (uic->cpu);for (i =0 ; i <DCR_UICMAX ; i++) { -ppc_dcr_register (&cpu->env, uic->dcr_base + i, uic, +ppc4xx_dcr_register (dcr, uic->dcr_base + i, uic, &dcr_read_uic, &dcr_write_uic); }
@@ -273,7 +260,6 @@ static void ppc_uic_realize(DeviceState *dev, Error **errp) }static Property ppc_uic_properties[] = { - DEFINE_PROP_LINK("cpu", PPCUIC, cpu, TYPE_CPU, CPUState *),DEFINE_PROP_UINT32 ("dcr-base" ,PPCUIC , dcr_base,0xc0 ),DEFINE_PROP_BOOL ("use-vectors" ,PPCUIC , use_vectors, true),DEFINE_PROP_END_OF_LIST ()
@@ -308,7 +294,7 @@ static void ppc_uic_class_init(ObjectClass *klass, void *data)static const TypeInfo ppc_uic_info = { .name =TYPE_PPC_UIC , - .parent =TYPE_SYS_BUS_DEVICE , + .parent = TYPE_PPC4xx_DCR_DEVICE, .instance_size =sizeof (PPCUIC ), .class_init = ppc_uic_class_init, };
hw/ppc/ppc405_uc.c +2 -4
@@ -1149,12 +1149,10 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (sbd,0 ,0xef600600 );/* Universal interrupt controller */ -object_property_set_link (OBJECT (&s->uic),"cpu" ,OBJECT (&s->cpu), - &error_fatal); - sbd =SYS_BUS_DEVICE (&s->uic); -if (!sysbus_realize (sbd, errp)) { +if (!ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (&s->uic), &s->cpu, errp)) {return ; } + sbd =SYS_BUS_DEVICE (&s->uic);sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(sbd, PPCUIC_OUTPUT_CINT,
hw/ppc/ppc440_bamboo.c +2 -5
@@ -193,12 +193,9 @@ static void bamboo_init(MachineState *machine)/* interrupt controller */ uicdev =qdev_new (TYPE_PPC_UIC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uicdev), cpu, &error_fatal); +object_unref (OBJECT (uicdev)); uicsbd =SYS_BUS_DEVICE (uicdev); - -object_property_set_link (OBJECT (uicdev),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (uicsbd, &error_fatal); -sysbus_connect_irq (uicsbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT,
hw/ppc/ppc4xx_devs.c +0 -1
@@ -29,7 +29,6 @@#include "hw/irq.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc4xx.h" -#include "hw/intc/ppc-uic.h" #include "hw/qdev-properties.h" #include "qemu/log.h" #include "exec/address-spaces.h"
hw/ppc/sam460ex.c +7 -10
@@ -314,7 +314,6 @@ static void sam460ex_init(MachineState *machine)/* interrupt controllers */ for (i =0 ; i <ARRAY_SIZE (uic); i++) { -SysBusDevice *sbd;/* * UICs 1, 2 and 3 are cascaded through UIC 0. * input_ints[n] is the interrupt number on UIC 0 which
@@ -326,22 +325,20 @@ static void sam460ex_init(MachineState *machine)const int input_ints[] = {-1 ,30 ,10 ,16 }; uic[i] =qdev_new (TYPE_PPC_UIC ); - sbd =SYS_BUS_DEVICE (uic[i]); -qdev_prop_set_uint32 (uic[i],"dcr-base" ,0xc0 + i *0x10 ); -object_property_set_link (OBJECT (uic[i]),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (sbd, &error_fatal); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uic[i]), cpu, &error_fatal); +object_unref (OBJECT (uic[i])); + sbdev =SYS_BUS_DEVICE (uic[i]);if (i ==0 ) { -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_CINT)); }else { -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (uic[0 ], input_ints[i])); -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (uic[0 ], input_ints[i] +1 )); } }
hw/ppc/virtex_ml507.c +2 -5
@@ -104,12 +104,9 @@ static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t sysclk)/* interrupt controller */ uicdev =qdev_new (TYPE_PPC_UIC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uicdev), cpu, &error_fatal); +object_unref (OBJECT (uicdev)); uicsbd =SYS_BUS_DEVICE (uicdev); - -object_property_set_link (OBJECT (uicdev),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (uicsbd, &error_fatal); -sysbus_connect_irq (uicsbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT,
include/hw/intc/ppc-uic.h +2 -4
@@ -25,8 +25,7 @@#ifndef HW_INTC_PPC_UIC_H #define HW_INTC_PPC_UIC_H -#include "hw/sysbus.h" -#include "qom/object.h" +#include "hw/ppc/ppc4xx.h" #define TYPE_PPC_UIC "ppc-uic"OBJECT_DECLARE_SIMPLE_TYPE (PPCUIC ,PPC_UIC )
@@ -56,14 +55,13 @@ enum {struct PPCUIC {/*< private >*/ -SysBusDevice parent_obj; +Ppc4xxDcrDeviceState parent_obj;/*< public >*/ qemu_irq output_int;qemu_irq output_cint;/* properties */ -CPUState *cpu;uint32_t dcr_base;bool use_vectors;
Signature · 1 line
2.30.4
Re: [PATCH 15/22] hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device
Quoted 2 lines · BALATON Zoltan
Make ppc-uic a subclass of ppc4xx-dcr-device which will handle the cpu link and make it uniform with the other PPC4xx devices.
Thanks,
C.
Quoted 242 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/intc/ppc-uic.c | 26 ++++++-------------------- hw/ppc/ppc405_uc.c | 6 ++---- hw/ppc/ppc440_bamboo.c | 7 ++----- hw/ppc/ppc4xx_devs.c | 1 - hw/ppc/sam460ex.c | 17 +++++++---------- hw/ppc/virtex_ml507.c | 7 ++----- include/hw/intc/ppc-uic.h | 6 ++---- 7 files changed, 21 insertions(+), 49 deletions(-)hw/intc/ppc-uic.c +6
-20@@ -25,11 +25,8 @@#include "qemu/osdep.h" #include "hw/intc/ppc-uic.h" #include "hw/irq.h" -#include "cpu.h" -#include "hw/ppc/ppc.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "qapi/error.h" enum {DCR_UICSR =0x000 ,@@ -105,10 +102,9 @@ static void ppcuic_trigger_irq(PPCUIC *uic)static void ppcuic_set_irq (void *opaque,int irq_num,int level) { -PPCUIC *uic; +PPCUIC *uic = opaque;uint32_t mask, sr; - uic = opaque; mask =1U << (31 - irq_num); LOG_UIC("%s: irq %d level %d uicsr %08" PRIx32 " mask %08" PRIx32 " => %08" PRIx32 " %08" PRIx32 "\n",@@ -144,10 +140,9 @@ static void ppcuic_set_irq(void *opaque, int irq_num, int level)static uint32_t dcr_read_uic (void *opaque,int dcrn) { -PPCUIC *uic; +PPCUIC *uic = opaque;uint32_t ret; - uic = opaque; dcrn -= uic->dcr_base;switch (dcrn) {case DCR_UICSR :@@ -192,9 +187,8 @@ static uint32_t dcr_read_uic(void *opaque, int dcrn)static void dcr_write_uic (void *opaque,int dcrn,uint32_t val) { -PPCUIC *uic; +PPCUIC *uic = opaque; - uic = opaque; dcrn -= uic->dcr_base;LOG_UIC ("%s: dcr %d val 0x%x\n" , __func__, dcrn, val);switch (dcrn) {@@ -251,19 +245,12 @@ static void ppc_uic_reset(DeviceState *dev)static void ppc_uic_realize (DeviceState *dev,Error **errp) {PPCUIC *uic =PPC_UIC (dev); +Ppc4xxDcrDeviceState *dcr =PPC4xx_DCR_DEVICE (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); -PowerPCCPU *cpu;int i; -if (!uic->cpu) { -/* This is a programming error in the code using this device */ -error_setg (errp,"ppc-uic 'cpu' link property was not set" ); -return ; - } - - cpu =POWERPC_CPU (uic->cpu);for (i =0 ; i <DCR_UICMAX ; i++) { -ppc_dcr_register (&cpu->env, uic->dcr_base + i, uic, +ppc4xx_dcr_register (dcr, uic->dcr_base + i, uic, &dcr_read_uic, &dcr_write_uic); }@@ -273,7 +260,6 @@ static void ppc_uic_realize(DeviceState *dev, Error **errp) }static Property ppc_uic_properties[] = { - DEFINE_PROP_LINK("cpu", PPCUIC, cpu, TYPE_CPU, CPUState *),DEFINE_PROP_UINT32 ("dcr-base" ,PPCUIC , dcr_base,0xc0 ),DEFINE_PROP_BOOL ("use-vectors" ,PPCUIC , use_vectors, true),DEFINE_PROP_END_OF_LIST ()@@ -308,7 +294,7 @@ static void ppc_uic_class_init(ObjectClass *klass, void *data)static const TypeInfo ppc_uic_info = { .name =TYPE_PPC_UIC , - .parent =TYPE_SYS_BUS_DEVICE , + .parent = TYPE_PPC4xx_DCR_DEVICE, .instance_size =sizeof (PPCUIC ), .class_init = ppc_uic_class_init, };hw/ppc/ppc405_uc.c +2
-4@@ -1149,12 +1149,10 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (sbd,0 ,0xef600600 );/* Universal interrupt controller */ -object_property_set_link (OBJECT (&s->uic),"cpu" ,OBJECT (&s->cpu), - &error_fatal); - sbd =SYS_BUS_DEVICE (&s->uic); -if (!sysbus_realize (sbd, errp)) { +if (!ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (&s->uic), &s->cpu, errp)) {return ; } + sbd =SYS_BUS_DEVICE (&s->uic);sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (&s->cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(sbd, PPCUIC_OUTPUT_CINT,hw/ppc/ppc440_bamboo.c +2
-5@@ -193,12 +193,9 @@ static void bamboo_init(MachineState *machine)/* interrupt controller */ uicdev =qdev_new (TYPE_PPC_UIC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uicdev), cpu, &error_fatal); +object_unref (OBJECT (uicdev)); uicsbd =SYS_BUS_DEVICE (uicdev); - -object_property_set_link (OBJECT (uicdev),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (uicsbd, &error_fatal); -sysbus_connect_irq (uicsbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT,hw/ppc/ppc4xx_devs.c +0
-1@@ -29,7 +29,6 @@#include "hw/irq.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc4xx.h" -#include "hw/intc/ppc-uic.h" #include "hw/qdev-properties.h" #include "qemu/log.h" #include "exec/address-spaces.h" hw/ppc/sam460ex.c +7
-10@@ -314,7 +314,6 @@ static void sam460ex_init(MachineState *machine)/* interrupt controllers */ for (i =0 ; i <ARRAY_SIZE (uic); i++) { -SysBusDevice *sbd;/* * UICs 1, 2 and 3 are cascaded through UIC 0. * input_ints[n] is the interrupt number on UIC 0 which @@ -326,22 +325,20 @@ static void sam460ex_init(MachineState *machine)const int input_ints[] = {-1 ,30 ,10 ,16 }; uic[i] =qdev_new (TYPE_PPC_UIC ); - sbd =SYS_BUS_DEVICE (uic[i]); -qdev_prop_set_uint32 (uic[i],"dcr-base" ,0xc0 + i *0x10 ); -object_property_set_link (OBJECT (uic[i]),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (sbd, &error_fatal); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uic[i]), cpu, &error_fatal); +object_unref (OBJECT (uic[i])); + sbdev =SYS_BUS_DEVICE (uic[i]);if (i ==0 ) { -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_CINT)); }else { -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_INT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (uic[0 ], input_ints[i])); -sysbus_connect_irq (sbd,PPCUIC_OUTPUT_CINT , +sysbus_connect_irq (sbdev,PPCUIC_OUTPUT_CINT ,qdev_get_gpio_in (uic[0 ], input_ints[i] +1 )); } }hw/ppc/virtex_ml507.c +2
-5@@ -104,12 +104,9 @@ static PowerPCCPU *ppc440_init_xilinx(const char *cpu_type, uint32_t sysclk)/* interrupt controller */ uicdev =qdev_new (TYPE_PPC_UIC ); +ppc4xx_dcr_realize (PPC4xx_DCR_DEVICE (uicdev), cpu, &error_fatal); +object_unref (OBJECT (uicdev)); uicsbd =SYS_BUS_DEVICE (uicdev); - -object_property_set_link (OBJECT (uicdev),"cpu" ,OBJECT (cpu), - &error_fatal); -sysbus_realize_and_unref (uicsbd, &error_fatal); -sysbus_connect_irq (uicsbd,PPCUIC_OUTPUT_INT ,qdev_get_gpio_in (DEVICE (cpu), PPC40x_INPUT_INT)); sysbus_connect_irq(uicsbd, PPCUIC_OUTPUT_CINT,include/hw/intc/ppc-uic.h +2
-4@@ -25,8 +25,7 @@#ifndef HW_INTC_PPC_UIC_H #define HW_INTC_PPC_UIC_H -#include "hw/sysbus.h" -#include "qom/object.h" +#include "hw/ppc/ppc4xx.h" #define TYPE_PPC_UIC "ppc-uic"OBJECT_DECLARE_SIMPLE_TYPE (PPCUIC ,PPC_UIC )@@ -56,14 +55,13 @@ enum {struct PPCUIC {/*< private >*/ -SysBusDevice parent_obj; +Ppc4xxDcrDeviceState parent_obj;/*< public >*/ qemu_irq output_int;qemu_irq output_cint;/* properties */ -CPUState *cpu;uint32_t dcr_base;bool use_vectors;
PATCH 16/22 ppc/ppc405: Use an explicit I2C object
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
Having an explicit I2C model object will help if one day we want to add I2C devices on the bus from the machine init routine.
--- hw/ppc/ppc405.h | 2 ++ hw/ppc/ppc405_uc.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
hw/ppc/ppc405.h +2 -0
@@ -28,6 +28,7 @@#include "qom/object.h" #include "hw/ppc/ppc4xx.h" #include "hw/intc/ppc-uic.h" +#include "hw/i2c/ppc4xx_i2c.h" #define PPC405EP_SDRAM_BASE 0x00000000#define PPC405EP_NVRAM_BASE 0xF0000000
@@ -215,6 +216,7 @@ struct Ppc405SoCState {Ppc405OcmState ocm;Ppc405GpioState gpio;Ppc405DmaState dma; +PPC4xxI2CState i2c;Ppc405EbcState ebc;Ppc405OpbaState opba;Ppc405PobState pob;
hw/ppc/ppc405_uc.c +8 -2
@@ -1093,6 +1093,8 @@ static void ppc405_soc_instance_init(Object *obj)object_initialize_child (obj,"dma" , &s->dma,TYPE_PPC405_DMA ); +object_initialize_child (obj,"i2c" , &s->i2c, TYPE_PPC4xx_I2C); +object_initialize_child (obj,"ebc" , &s->ebc,TYPE_PPC405_EBC );object_initialize_child (obj,"opba" , &s->opba,TYPE_PPC405_OPBA );
@@ -1185,8 +1187,12 @@ static void ppc405_soc_realize(DeviceState *dev, Error **errp) }/* I2C controller */ -sysbus_create_simple (TYPE_PPC4xx_I2C,0xef600500 , -qdev_get_gpio_in (DEVICE (&s->uic),2 )); + sbd =SYS_BUS_DEVICE (&s->i2c); +if (!sysbus_realize (sbd, errp)) { +return ; + } +sysbus_mmio_map (sbd,0 ,0xef600500 ); +sysbus_connect_irq (sbd,0 ,qdev_get_gpio_in (DEVICE (&s->uic),2 ));/* GPIO */ sbd =SYS_BUS_DEVICE (&s->gpio);
Signature · 1 line
2.30.4
PATCH 17/22 ppc/ppc405: QOM'ify FPGA
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
--- hw/ppc/ppc405_boards.c | 56 +++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 17 deletions(-)
hw/ppc/ppc405_boards.c +39 -17
@@ -71,18 +71,23 @@ struct Ppc405MachineState {* - NVRAM (0xF0000000) * - FPGA (0xF0300000) */ -typedef struct ref405ep_fpga_t ref405ep_fpga_t ; -struct ref405ep_fpga_t { + +#define TYPE_REF405EP_FPGA "ref405ep-fpga" +OBJECT_DECLARE_SIMPLE_TYPE (Ref405epFpgaState,REF405EP_FPGA ); +struct Ref405epFpgaState { +SysBusDevice parent_obj; + +MemoryRegion iomem; +uint8_t reg0;uint8_t reg1; };static uint64_t ref405ep_fpga_readb (void *opaque,hwaddr addr,unsigned size) { -ref405ep_fpga_t *fpga; +Ref405epFpgaState *fpga = opaque;uint32_t ret; - fpga = opaque;switch (addr) {case 0x0 : ret = fpga->reg0;
@@ -101,9 +106,8 @@ static uint64_t ref405ep_fpga_readb(void *opaque, hwaddr addr, unsigned size)static void ref405ep_fpga_writeb (void *opaque,hwaddr addr,uint64_t value,unsigned size) { -ref405ep_fpga_t *fpga; +Ref405epFpgaState *fpga = opaque; - fpga = opaque;switch (addr) {case 0x0 :/* Read only */
@@ -126,27 +130,40 @@ static const MemoryRegionOps ref405ep_fpga_ops = { .endianness = DEVICE_BIG_ENDIAN, }; -static void ref405ep_fpga_reset (void *opaque) +static void ref405ep_fpga_reset (DeviceState *dev) { -ref405ep_fpga_t *fpga; +Ref405epFpgaState *fpga =REF405EP_FPGA (dev); - fpga = opaque; fpga->reg0 =0x00 ; fpga->reg1 =0x0F ; } -static void ref405ep_fpga_init (MemoryRegion *sysmem,uint32_t base) +static void ref405ep_fpga_realize (DeviceState *dev,Error **errp) { -ref405ep_fpga_t *fpga; -MemoryRegion *fpga_memory =g_new (MemoryRegion,1 ); +Ref405epFpgaState *s =REF405EP_FPGA (dev); - fpga =g_new0 (ref405ep_fpga_t,1 ); -memory_region_init_io (fpga_memory,NULL , &ref405ep_fpga_ops, fpga, +memory_region_init_io (&s->iomem,OBJECT (s), &ref405ep_fpga_ops, s,"fpga" ,0x00000100 ); -memory_region_add_subregion (sysmem, base, fpga_memory); -qemu_register_reset (&ref405ep_fpga_reset, fpga); +sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->iomem); +} + +static void ref405ep_fpga_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->realize = ref405ep_fpga_realize; + dc->reset = ref405ep_fpga_reset; +/* Reason: only works as part of a ppc405 board */ + dc->user_creatable = false; } +static const TypeInfo ref405ep_fpga_type = { + .name =TYPE_REF405EP_FPGA , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (Ref405epFpgaState), + .class_init = ref405ep_fpga_class_init, +}; +/* * CPU reset handler when booting directly from a loaded kernel */
@@ -331,7 +348,11 @@ static void ref405ep_init(MachineState *machine)memory_region_add_subregion (get_system_memory (),PPC405EP_SRAM_BASE , sram);/* Register FPGA */ -ref405ep_fpga_init (get_system_memory (),PPC405EP_FPGA_BASE ); + dev =qdev_new (TYPE_REF405EP_FPGA ); +object_property_add_child (OBJECT (machine),"fpga" ,OBJECT (dev)); +sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,PPC405EP_FPGA_BASE ); +/* Register NVRAM */ dev =qdev_new ("sysbus-m48t08" );qdev_prop_set_int32 (dev,"base-year" ,1968 );
@@ -376,6 +397,7 @@ static void ppc405_machine_init(void) {type_register_static (&ppc405_machine_type);type_register_static (&ref405ep_type); +type_register_static (&ref405ep_fpga_type); }type_init (ppc405_machine_init)
Signature · 1 line
2.30.4
PATCH 18/22 ppc405: Move machine specific code to ppc405_boards.c
In reply to BALATON ZoltanThese are only used by tha board code so move out from the shared SoC model and put it in the boards file.
--- hw/ppc/ppc405.h | 38 ----- hw/ppc/ppc405_boards.c | 375 +++++++++++++++++++++++++++-------------- hw/ppc/ppc405_uc.c | 92 ---------- 3 files changed, 251 insertions(+), 254 deletions(-)
hw/ppc/ppc405.h +0 -38
@@ -30,41 +30,6 @@#include "hw/intc/ppc-uic.h" #include "hw/i2c/ppc4xx_i2c.h" -#define PPC405EP_SDRAM_BASE 0x00000000 -#define PPC405EP_NVRAM_BASE 0xF0000000 -#define PPC405EP_FPGA_BASE 0xF0300000 -#define PPC405EP_SRAM_BASE 0xFFF00000 -#define PPC405EP_SRAM_SIZE (512 * KiB) -#define PPC405EP_FLASH_BASE 0xFFF80000 - -/* Bootinfo as set-up by u-boot */ -typedef struct ppc4xx_bd_info_t ppc4xx_bd_info_t ; -struct ppc4xx_bd_info_t { -uint32_t bi_memstart; -uint32_t bi_memsize; -uint32_t bi_flashstart; -uint32_t bi_flashsize; -uint32_t bi_flashoffset;/* 0x10 */ -uint32_t bi_sramstart; -uint32_t bi_sramsize; -uint32_t bi_bootflags; -uint32_t bi_ipaddr;/* 0x20 */ -uint8_t bi_enetaddr[6 ]; -uint16_t bi_ethspeed; -uint32_t bi_intfreq; -uint32_t bi_busfreq;/* 0x30 */ -uint32_t bi_baudrate; -uint8_t bi_s_version[4 ]; -uint8_t bi_r_version[32 ]; -uint32_t bi_procfreq; -uint32_t bi_plb_busfreq; -uint32_t bi_pci_busfreq; -uint8_t bi_pci_enetaddr[6 ]; -uint8_t bi_pci_enetaddr2[6 ];/* PPC405EP specific */ -uint32_t bi_opbfreq; -uint32_t bi_iic_fast[2 ]; -}; -/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );
@@ -224,7 +189,4 @@ struct Ppc405SoCState { Ppc4xxMalState mal; }; -/* PowerPC 405 core */ -ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size); -#endif /* PPC405_H */
hw/ppc/ppc405_boards.c +251 -124
405 lines not on this page · raw message
hw/ppc/ppc405_uc.c +0 -92
98 lines not on this page · raw message
Signature · 1 line
2.30.4
Re: [PATCH 18/22] ppc405: Move machine specific code to ppc405_boards.c
Quoted 1 line · BALATON Zoltan
These are only used by tha board code so move out from the shared SoC
s/tha/the/
Quoted 1 line
model and put it in the boards file.
Thanks,
C.
Quoted 578 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc405.h | 38 ----- hw/ppc/ppc405_boards.c | 375 +++++++++++++++++++++++++++-------------- hw/ppc/ppc405_uc.c | 92 ---------- 3 files changed, 251 insertions(+), 254 deletions(-)hw/ppc/ppc405.h +0
-38@@ -30,41 +30,6 @@#include "hw/intc/ppc-uic.h" #include "hw/i2c/ppc4xx_i2c.h" -#define PPC405EP_SDRAM_BASE 0x00000000 -#define PPC405EP_NVRAM_BASE 0xF0000000 -#define PPC405EP_FPGA_BASE 0xF0300000 -#define PPC405EP_SRAM_BASE 0xFFF00000 -#define PPC405EP_SRAM_SIZE (512 * KiB) -#define PPC405EP_FLASH_BASE 0xFFF80000 - -/* Bootinfo as set-up by u-boot */ -typedef struct ppc4xx_bd_info_t ppc4xx_bd_info_t ; -struct ppc4xx_bd_info_t { -uint32_t bi_memstart; -uint32_t bi_memsize; -uint32_t bi_flashstart; -uint32_t bi_flashsize; -uint32_t bi_flashoffset;/* 0x10 */ -uint32_t bi_sramstart; -uint32_t bi_sramsize; -uint32_t bi_bootflags; -uint32_t bi_ipaddr;/* 0x20 */ -uint8_t bi_enetaddr[6 ]; -uint16_t bi_ethspeed; -uint32_t bi_intfreq; -uint32_t bi_busfreq;/* 0x30 */ -uint32_t bi_baudrate; -uint8_t bi_s_version[4 ]; -uint8_t bi_r_version[32 ]; -uint32_t bi_procfreq; -uint32_t bi_plb_busfreq; -uint32_t bi_pci_busfreq; -uint8_t bi_pci_enetaddr[6 ]; -uint8_t bi_pci_enetaddr2[6 ];/* PPC405EP specific */ -uint32_t bi_opbfreq; -uint32_t bi_iic_fast[2 ]; -}; -/* PLB to OPB bridge */ #define TYPE_PPC405_POB "ppc405-pob"OBJECT_DECLARE_SIMPLE_TYPE (Ppc405PobState,PPC405_POB );@@ -224,7 +189,4 @@ struct Ppc405SoCState { Ppc4xxMalState mal; }; -/* PowerPC 405 core */ -ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size); -#endif /* PPC405_H */ hw/ppc/ppc405_boards.c +251
-124@@ -48,6 +48,10 @@#define KERNEL_LOAD_ADDR 0x01000000#define INITRD_LOAD_ADDR 0x01800000 +#define PPC405EP_SDRAM_BASE 0x00000000 +#define PPC405EP_SRAM_BASE 0xFFF00000 +#define PPC405EP_SRAM_SIZE (512 * KiB) +#define USE_FLASH_BIOS #define TYPE_PPC405_MACHINE MACHINE_TYPE_NAME("ppc405")@@ -61,112 +65,7 @@ struct Ppc405MachineState {Ppc405SoCState soc; }; -/*****************************************************************************/ -/* PPC405EP reference board (IBM) */ -/* Standalone board with: -* - PowerPC 405EP CPU -* - SDRAM (0x00000000) -* - Flash (0xFFF80000) -* - SRAM (0xFFF00000) -* - NVRAM (0xF0000000) -* - FPGA (0xF0300000) -*/ - -#define TYPE_REF405EP_FPGA "ref405ep-fpga" -OBJECT_DECLARE_SIMPLE_TYPE (Ref405epFpgaState,REF405EP_FPGA ); -struct Ref405epFpgaState { -SysBusDevice parent_obj; - -MemoryRegion iomem; - -uint8_t reg0; -uint8_t reg1; -}; - -static uint64_t ref405ep_fpga_readb (void *opaque,hwaddr addr,unsigned size) -{ -Ref405epFpgaState *fpga = opaque; -uint32_t ret; - -switch (addr) { -case 0x0 : - ret = fpga->reg0; -break ; -case 0x1 : - ret = fpga->reg1; -break ; -default : - ret =0 ; -break ; - } - -return ret; -} - -static void ref405ep_fpga_writeb (void *opaque,hwaddr addr,uint64_t value, -unsigned size) -{ -Ref405epFpgaState *fpga = opaque; - -switch (addr) { -case 0x0 : -/* Read only */ -break ; -case 0x1 : - fpga->reg1 = value; -break ; -default : -break ; - } -} - -static const MemoryRegionOps ref405ep_fpga_ops = { - .read = ref405ep_fpga_readb, - .write = ref405ep_fpga_writeb, - .impl.min_access_size =1 , - .impl.max_access_size =1 , - .valid.min_access_size =1 , - .valid.max_access_size =4 , - .endianness =DEVICE_BIG_ENDIAN , -}; - -static void ref405ep_fpga_reset (DeviceState *dev) -{ -Ref405epFpgaState *fpga =REF405EP_FPGA (dev); - - fpga->reg0 =0x00 ; - fpga->reg1 =0x0F ; -} - -static void ref405ep_fpga_realize (DeviceState *dev,Error **errp) -{ -Ref405epFpgaState *s =REF405EP_FPGA (dev); - -memory_region_init_io (&s->iomem,OBJECT (s), &ref405ep_fpga_ops, s, -"fpga" ,0x00000100 ); -sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->iomem); -} - -static void ref405ep_fpga_class_init (ObjectClass *oc,void *data) -{ -DeviceClass *dc =DEVICE_CLASS (oc); - - dc->realize = ref405ep_fpga_realize; - dc->reset = ref405ep_fpga_reset; -/* Reason: only works as part of a ppc405 board */ - dc->user_creatable = false; -} - -static const TypeInfo ref405ep_fpga_type = { - .name =TYPE_REF405EP_FPGA , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (Ref405epFpgaState), - .class_init = ref405ep_fpga_class_init, -}; - -/* -* CPU reset handler when booting directly from a loaded kernel -*/ +/* CPU reset handler when booting directly from a loaded kernel */ static struct boot_info { uint32_t entry; uint32_t bdloc;@@ -197,6 +96,126 @@ static void main_cpu_reset(void *opaque) env->nip = bi->entry; } +/* Bootinfo as set-up by u-boot */ +typedef struct { +uint32_t bi_memstart; +uint32_t bi_memsize; +uint32_t bi_flashstart; +uint32_t bi_flashsize; +uint32_t bi_flashoffset;/* 0x10 */ +uint32_t bi_sramstart; +uint32_t bi_sramsize; +uint32_t bi_bootflags; +uint32_t bi_ipaddr;/* 0x20 */ +uint8_t bi_enetaddr[6 ]; +uint16_t bi_ethspeed; +uint32_t bi_intfreq; +uint32_t bi_busfreq;/* 0x30 */ +uint32_t bi_baudrate; +uint8_t bi_s_version[4 ]; +uint8_t bi_r_version[32 ]; +uint32_t bi_procfreq; +uint32_t bi_plb_busfreq; +uint32_t bi_pci_busfreq; +uint8_t bi_pci_enetaddr[6 ]; +uint8_t bi_pci_enetaddr2[6 ];/* PPC405EP specific */ +uint32_t bi_opbfreq; +uint32_t bi_iic_fast[2 ]; +}ppc4xx_bd_info_t ; + +static void ppc405_set_default_bootinfo (ppc4xx_bd_info_t *bd, +ram_addr_t ram_size) +{ +memset (bd,0 ,sizeof (*bd)); + + bd->bi_memstart =PPC405EP_SDRAM_BASE ; + bd->bi_memsize = ram_size; + bd->bi_sramstart =PPC405EP_SRAM_BASE ; + bd->bi_sramsize =PPC405EP_SRAM_SIZE ; + bd->bi_bootflags =0 ; + bd->bi_intfreq =133333333 ; + bd->bi_busfreq =33333333 ; + bd->bi_baudrate =115200 ; + bd->bi_s_version[0 ] ='Q' ; + bd->bi_s_version[1 ] ='M' ; + bd->bi_s_version[2 ] ='U' ; + bd->bi_s_version[3 ] ='\0' ; + bd->bi_r_version[0 ] ='Q' ; + bd->bi_r_version[1 ] ='E' ; + bd->bi_r_version[2 ] ='M' ; + bd->bi_r_version[3 ] ='U' ; + bd->bi_r_version[4 ] ='\0' ; + bd->bi_procfreq =133333333 ; + bd->bi_plb_busfreq =33333333 ; + bd->bi_pci_busfreq =33333333 ; + bd->bi_opbfreq =33333333 ; +} + +static ram_addr_t __ppc405_set_bootinfo (CPUPPCState *env,ppc4xx_bd_info_t *bd) +{ +CPUState *cs =env_cpu (env); +ram_addr_t bdloc; +int i, n; + +/* We put the bd structure at the top of memory */ +if (bd->bi_memsize >=0x01000000UL ) { + bdloc =0x01000000UL -sizeof (ppc4xx_bd_info_t); + }else { + bdloc = bd->bi_memsize -sizeof (ppc4xx_bd_info_t); + } +stl_be_phys (cs->as, bdloc +0x00 , bd->bi_memstart); +stl_be_phys (cs->as, bdloc +0x04 , bd->bi_memsize); +stl_be_phys (cs->as, bdloc +0x08 , bd->bi_flashstart); +stl_be_phys (cs->as, bdloc +0x0C , bd->bi_flashsize); +stl_be_phys (cs->as, bdloc +0x10 , bd->bi_flashoffset); +stl_be_phys (cs->as, bdloc +0x14 , bd->bi_sramstart); +stl_be_phys (cs->as, bdloc +0x18 , bd->bi_sramsize); +stl_be_phys (cs->as, bdloc +0x1C , bd->bi_bootflags); +stl_be_phys (cs->as, bdloc +0x20 , bd->bi_ipaddr); +for (i =0 ; i <6 ; i++) { +stb_phys (cs->as, bdloc +0x24 + i, bd->bi_enetaddr[i]); + } +stw_be_phys (cs->as, bdloc +0x2A , bd->bi_ethspeed); +stl_be_phys (cs->as, bdloc +0x2C , bd->bi_intfreq); +stl_be_phys (cs->as, bdloc +0x30 , bd->bi_busfreq); +stl_be_phys (cs->as, bdloc +0x34 , bd->bi_baudrate); +for (i =0 ; i <4 ; i++) { +stb_phys (cs->as, bdloc +0x38 + i, bd->bi_s_version[i]); + } +for (i =0 ; i <32 ; i++) { +stb_phys (cs->as, bdloc +0x3C + i, bd->bi_r_version[i]); + } +stl_be_phys (cs->as, bdloc +0x5C , bd->bi_procfreq); +stl_be_phys (cs->as, bdloc +0x60 , bd->bi_plb_busfreq); +stl_be_phys (cs->as, bdloc +0x64 , bd->bi_pci_busfreq); +for (i =0 ; i <6 ; i++) { +stb_phys (cs->as, bdloc +0x68 + i, bd->bi_pci_enetaddr[i]); + } + n =0x70 ;/* includes 2 bytes hole */ +for (i =0 ; i <6 ; i++) { +stb_phys (cs->as, bdloc + n++, bd->bi_pci_enetaddr2[i]); + } +stl_be_phys (cs->as, bdloc + n, bd->bi_opbfreq); + n +=4 ; +for (i =0 ; i <2 ; i++) { +stl_be_phys (cs->as, bdloc + n, bd->bi_iic_fast[i]); + n +=4 ; + } + +return bdloc; +} + +static ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size) +{ +ppc4xx_bd_info_t bd; + +memset (&bd,0 ,sizeof (bd)); + +ppc405_set_default_bootinfo (&bd, ram_size); + +return __ppc405_set_bootinfo (env, &bd); +} +static void boot_from_kernel (MachineState *machine,PowerPCCPU *cpu) {CPUPPCState *env = &cpu->env;@@ -334,6 +353,132 @@ static void ppc405_init(MachineState *machine) } } +static void ppc405_machine_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); + + mc->desc ="PPC405 generic machine" ; + mc->init = ppc405_init; + mc->default_ram_size =128 * MiB; + mc->default_ram_id ="ppc405.ram" ; +} + +static const TypeInfo ppc405_machine_type = { + .name =TYPE_PPC405_MACHINE , + .parent =TYPE_MACHINE , + .instance_size =sizeof (Ppc405MachineState), + .class_init = ppc405_machine_class_init, + .abstract = true, +}; + +/*****************************************************************************/ +/* PPC405EP reference board (IBM) */ +/* +* Standalone board with: +* - PowerPC 405EP CPU +* - SDRAM (0x00000000) +* - Flash (0xFFF80000) +* - SRAM (0xFFF00000) +* - NVRAM (0xF0000000) +* - FPGA (0xF0300000) +*/ + +#define PPC405EP_NVRAM_BASE 0xF0000000 +#define PPC405EP_FPGA_BASE 0xF0300000 +#define PPC405EP_FLASH_BASE 0xFFF80000 + +#define TYPE_REF405EP_FPGA "ref405ep-fpga" +OBJECT_DECLARE_SIMPLE_TYPE (Ref405epFpgaState,REF405EP_FPGA ); +struct Ref405epFpgaState { +SysBusDevice parent_obj; + +MemoryRegion iomem; + +uint8_t reg0; +uint8_t reg1; +}; + +static uint64_t ref405ep_fpga_readb (void *opaque,hwaddr addr,unsigned size) +{ +Ref405epFpgaState *fpga = opaque; +uint32_t ret; + +switch (addr) { +case 0x0 : + ret = fpga->reg0; +break ; +case 0x1 : + ret = fpga->reg1; +break ; +default : + ret =0 ; +break ; + } + +return ret; +} + +static void ref405ep_fpga_writeb (void *opaque,hwaddr addr,uint64_t value, +unsigned size) +{ +Ref405epFpgaState *fpga = opaque; + +switch (addr) { +case 0x0 : +/* Read only */ +break ; +case 0x1 : + fpga->reg1 = value; +break ; +default : +break ; + } +} + +static const MemoryRegionOps ref405ep_fpga_ops = { + .read = ref405ep_fpga_readb, + .write = ref405ep_fpga_writeb, + .impl.min_access_size =1 , + .impl.max_access_size =1 , + .valid.min_access_size =1 , + .valid.max_access_size =4 , + .endianness =DEVICE_BIG_ENDIAN , +}; + +static void ref405ep_fpga_reset (DeviceState *dev) +{ +Ref405epFpgaState *fpga =REF405EP_FPGA (dev); + + fpga->reg0 =0x00 ; + fpga->reg1 =0x0F ; +} + +static void ref405ep_fpga_realize (DeviceState *dev,Error **errp) +{ +Ref405epFpgaState *s =REF405EP_FPGA (dev); + +memory_region_init_io (&s->iomem,OBJECT (s), &ref405ep_fpga_ops, s, +"fpga" ,0x00000100 ); +sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->iomem); +} + +static void ref405ep_fpga_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->realize = ref405ep_fpga_realize; + dc->reset = ref405ep_fpga_reset; +/* Reason: only works as part of a ppc405 board */ + dc->user_creatable = false; +} + +static const TypeInfo ref405ep_fpga_type = { + .name =TYPE_REF405EP_FPGA , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (Ref405epFpgaState), + .class_init = ref405ep_fpga_class_init, +}; +static void ref405ep_init (MachineState *machine) {DeviceState *dev;@@ -375,24 +520,6 @@ static const TypeInfo ref405ep_type = { .class_init = ref405ep_class_init, }; -static void ppc405_machine_class_init (ObjectClass *oc,void *data) -{ -MachineClass *mc =MACHINE_CLASS (oc); - - mc->desc ="PPC405 generic machine" ; - mc->init = ppc405_init; - mc->default_ram_size =128 * MiB; - mc->default_ram_id ="ppc405.ram" ; -} - -static const TypeInfo ppc405_machine_type = { - .name =TYPE_PPC405_MACHINE , - .parent =TYPE_MACHINE , - .instance_size =sizeof (Ppc405MachineState), - .class_init = ppc405_machine_class_init, - .abstract = true, -}; -static void ppc405_machine_init (void ) {type_register_static (&ppc405_machine_type);hw/ppc/ppc405_uc.c +0
-92@@ -42,98 +42,6 @@#include "qapi/error.h" #include "trace.h" -static void ppc405_set_default_bootinfo (ppc4xx_bd_info_t *bd, -ram_addr_t ram_size) -{ -memset (bd,0 ,sizeof (*bd)); - - bd->bi_memstart =PPC405EP_SDRAM_BASE ; - bd->bi_memsize = ram_size; - bd->bi_sramstart =PPC405EP_SRAM_BASE ; - bd->bi_sramsize =PPC405EP_SRAM_SIZE ; - bd->bi_bootflags =0 ; - bd->bi_intfreq =133333333 ; - bd->bi_busfreq =33333333 ; - bd->bi_baudrate =115200 ; - bd->bi_s_version[0 ] ='Q' ; - bd->bi_s_version[1 ] ='M' ; - bd->bi_s_version[2 ] ='U' ; - bd->bi_s_version[3 ] ='\0' ; - bd->bi_r_version[0 ] ='Q' ; - bd->bi_r_version[1 ] ='E' ; - bd->bi_r_version[2 ] ='M' ; - bd->bi_r_version[3 ] ='U' ; - bd->bi_r_version[4 ] ='\0' ; - bd->bi_procfreq =133333333 ; - bd->bi_plb_busfreq =33333333 ; - bd->bi_pci_busfreq =33333333 ; - bd->bi_opbfreq =33333333 ; -} - -static ram_addr_t __ppc405_set_bootinfo (CPUPPCState *env,ppc4xx_bd_info_t *bd) -{ -CPUState *cs =env_cpu (env); -ram_addr_t bdloc; -int i, n; - -/* We put the bd structure at the top of memory */ -if (bd->bi_memsize >=0x01000000UL ) - bdloc =0x01000000UL -sizeof (struct ppc4xx_bd_info_t ); -else - bdloc = bd->bi_memsize -sizeof (struct ppc4xx_bd_info_t ); -stl_be_phys (cs->as, bdloc +0x00 , bd->bi_memstart); -stl_be_phys (cs->as, bdloc +0x04 , bd->bi_memsize); -stl_be_phys (cs->as, bdloc +0x08 , bd->bi_flashstart); -stl_be_phys (cs->as, bdloc +0x0C , bd->bi_flashsize); -stl_be_phys (cs->as, bdloc +0x10 , bd->bi_flashoffset); -stl_be_phys (cs->as, bdloc +0x14 , bd->bi_sramstart); -stl_be_phys (cs->as, bdloc +0x18 , bd->bi_sramsize); -stl_be_phys (cs->as, bdloc +0x1C , bd->bi_bootflags); -stl_be_phys (cs->as, bdloc +0x20 , bd->bi_ipaddr); -for (i =0 ; i <6 ; i++) { -stb_phys (cs->as, bdloc +0x24 + i, bd->bi_enetaddr[i]); - } -stw_be_phys (cs->as, bdloc +0x2A , bd->bi_ethspeed); -stl_be_phys (cs->as, bdloc +0x2C , bd->bi_intfreq); -stl_be_phys (cs->as, bdloc +0x30 , bd->bi_busfreq); -stl_be_phys (cs->as, bdloc +0x34 , bd->bi_baudrate); -for (i =0 ; i <4 ; i++) { -stb_phys (cs->as, bdloc +0x38 + i, bd->bi_s_version[i]); - } -for (i =0 ; i <32 ; i++) { -stb_phys (cs->as, bdloc +0x3C + i, bd->bi_r_version[i]); - } -stl_be_phys (cs->as, bdloc +0x5C , bd->bi_procfreq); -stl_be_phys (cs->as, bdloc +0x60 , bd->bi_plb_busfreq); -stl_be_phys (cs->as, bdloc +0x64 , bd->bi_pci_busfreq); -for (i =0 ; i <6 ; i++) { -stb_phys (cs->as, bdloc +0x68 + i, bd->bi_pci_enetaddr[i]); - } - n =0x70 ;/* includes 2 bytes hole */ -for (i =0 ; i <6 ; i++) { -stb_phys (cs->as, bdloc + n++, bd->bi_pci_enetaddr2[i]); - } -stl_be_phys (cs->as, bdloc + n, bd->bi_opbfreq); - n +=4 ; -for (i =0 ; i <2 ; i++) { -stl_be_phys (cs->as, bdloc + n, bd->bi_iic_fast[i]); - n +=4 ; - } - -return bdloc; -} - -ram_addr_t ppc405_set_bootinfo (CPUPPCState *env,ram_addr_t ram_size) -{ -ppc4xx_bd_info_t bd; - -memset (&bd,0 ,sizeof (bd)); - -ppc405_set_default_bootinfo (&bd, ram_size); - -return __ppc405_set_bootinfo (env, &bd); -} -/*****************************************************************************/ /* Shared peripherals */
PATCH 19/22 hw/ppc/Kconfig: Remove PPC405 dependency from sam460ex
In reply to BALATON ZoltanNow that shared PPC4xx devices are separated from PPC405 ones we can drop this depencency.
--- hw/ppc/Kconfig | 1 - 1 file changed, 1 deletion(-)
hw/ppc/Kconfig +0 -1
@@ -58,7 +58,6 @@ config PPC4XX config SAM460EX bool - select PPC405 select PFLASH_CFI01 select IDE_SII3112 select M41T80
Signature · 1 line
2.30.4
Re: [PATCH 19/22] hw/ppc/Kconfig: Remove PPC405 dependency from sam460ex
Quoted 2 lines · BALATON Zoltan
Now that shared PPC4xx devices are separated from PPC405 ones we can drop this depencency.
Thanks,
C.
Quoted 18 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/Kconfig | 1 - 1 file changed, 1 deletion(-)hw/ppc/Kconfig +0
-1@@ -58,7 +58,6 @@ config PPC4XX config SAM460EX bool - select PPC405 select PFLASH_CFI01 select IDE_SII3112 select M41T80
PATCH 20/22 hw/ppc/Kconfig: Move imply before select
In reply to BALATON ZoltanIn pegasos2 section move imply before select to match other sections.
--- hw/ppc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/Kconfig +1 -1
@@ -71,6 +71,7 @@ config SAM460EX config PEGASOS2 bool + imply ATI_VGA select MV64361 select VT82C686 select IDE_VIA
@@ -78,7 +79,6 @@ config PEGASOS2 select VOF # This should come with VT82C686 select ACPI_X86 - imply ATI_VGA config PREP bool
Signature · 1 line
2.30.4
Re: [PATCH 20/22] hw/ppc/Kconfig: Move imply before select
Quoted 1 line · BALATON Zoltan
In pegasos2 section move imply before select to match other sections.
Thanks,
C.
Quoted 25 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/Kconfig +1
-1@@ -71,6 +71,7 @@ config SAM460EX config PEGASOS2 bool + imply ATI_VGA select MV64361 select VT82C686 select IDE_VIA@@ -78,7 +79,6 @@ config PEGASOS2 select VOF # This should come with VT82C686 select ACPI_X86 - imply ATI_VGA config PREP bool
PATCH 21/22 ppc4xx: Drop empty default cases
In reply to BALATON ZoltanRemove default case labels that do nothing or only there to set a default value that could easily be done at the variable definition instead.
--- hw/ppc/ppc405_boards.c | 7 +------ hw/ppc/ppc405_uc.c | 29 +++++------------------------ hw/ppc/ppc440_uc.c | 27 --------------------------- hw/ppc/ppc4xx_devs.c | 31 ++++--------------------------- 4 files changed, 10 insertions(+), 84 deletions(-)
hw/ppc/ppc405_boards.c +1 -6
@@ -401,7 +401,7 @@ struct Ref405epFpgaState {static uint64_t ref405ep_fpga_readb (void *opaque,hwaddr addr,unsigned size) {Ref405epFpgaState *fpga = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (addr) {case 0x0 :
@@ -410,9 +410,6 @@ static uint64_t ref405ep_fpga_readb(void *opaque, hwaddr addr, unsigned size)case 0x1 : ret = fpga->reg1;break ; -default : - ret =0 ; -break ; }return ret;
@@ -430,8 +427,6 @@ static void ref405ep_fpga_writeb(void *opaque, hwaddr addr, uint64_t value,case 0x1 : fpga->reg1 = value;break ; -default : -break ; } }
hw/ppc/ppc405_uc.c +5 -24
@@ -56,7 +56,7 @@ enum {static uint32_t dcr_read_pob (void *opaque,int dcrn) {Ppc405PobState *pob = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case POB0_BEAR :
@@ -68,10 +68,6 @@ static uint32_t dcr_read_pob(void *opaque, int dcrn)case POB0_BESR1 : ret = pob->besr1;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;
@@ -131,7 +127,7 @@ static void ppc405_pob_class_init(ObjectClass *oc, void *data)static uint64_t opba_readb (void *opaque,hwaddr addr,unsigned size) {Ppc405OpbaState *opba = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (addr) {case 0x00 :
@@ -140,9 +136,6 @@ static uint64_t opba_readb(void *opaque, hwaddr addr, unsigned size)case 0x01 : ret = opba->pr;break ; -default : - ret =0x00 ; -break ; }trace_opba_readb (addr, ret);
@@ -163,8 +156,6 @@ static void opba_writeb(void *opaque, hwaddr addr, uint64_t value,case 0x01 : opba->pr = value &0xFF ;break ; -default : -break ; } }static const MemoryRegionOps opba_ops = {
@@ -403,7 +394,7 @@ static void ocm_update_mappings(Ppc405OcmState *ocm,static uint32_t dcr_read_ocm (void *opaque,int dcrn) {Ppc405OcmState *ocm = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case OCM0_ISARC :
@@ -418,9 +409,6 @@ static uint32_t dcr_read_ocm(void *opaque, int dcrn)case OCM0_DSACNTL : ret = ocm->dsacntl;break ; -default : - ret =0 ; -break ; }return ret;
@@ -556,7 +544,7 @@ static void ppc4xx_gpt_compute_timer(Ppc405GptState *gpt)static uint64_t ppc4xx_gpt_read (void *opaque,hwaddr addr,unsigned size) {Ppc405GptState *gpt = opaque; -uint32_t ret; +uint32_t ret =-1 ;int idx;trace_ppc4xx_gpt_read (addr, size);
@@ -598,9 +586,6 @@ static uint64_t ppc4xx_gpt_read(void *opaque, hwaddr addr, unsigned size) idx = (addr -0xC0 ) >>2 ; ret = gpt->mask[idx];break ; -default : - ret =-1 ; -break ; }return ret;
@@ -844,7 +829,7 @@ static void ppc405ep_compute_clocks(Ppc405CpcState *cpc)static uint32_t dcr_read_epcpc (void *opaque,int dcrn) {Ppc405CpcState *cpc = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case PPC405EP_CPC0_BOOT :
@@ -871,10 +856,6 @@ static uint32_t dcr_read_epcpc(void *opaque, int dcrn)case PPC405EP_CPC0_PCI : ret = cpc->pci;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;
hw/ppc/ppc440_uc.c +0 -27
@@ -147,9 +147,6 @@ static uint32_t dcr_read_l2sram(void *opaque, int dcrn)case DCR_ISRAM0_DPC : ret = l2sram->isram0[dcrn -DCR_ISRAM0_BASE ];break ; - -default : -break ; }return ret;
@@ -304,12 +301,8 @@ static uint32_t dcr_read_cpr(void *opaque, int dcrn)case CPR0_AHBD : ret = (1 <<24 );break ; -default : -break ; }break ; -default : -break ; }return ret;
@@ -325,8 +318,6 @@ static void dcr_write_cpr(void *opaque, int dcrn, uint32_t val)break ;case CPR0_CFGDATA :break ; -default : -break ; } }
@@ -421,12 +412,8 @@ static uint32_t dcr_read_sdr(void *opaque, int dcrn)case PESDR1_LOOP : ret =1 <<12 ;break ; -default : -break ; }break ; -default : -break ; }return ret;
@@ -444,12 +431,8 @@ static void dcr_write_sdr(void *opaque, int dcrn, uint32_t val)switch (sdr->addr) {case 0x00 :/* B0CR */ break ; -default : -break ; }break ; -default : -break ; } }
@@ -646,12 +629,8 @@ static uint32_t dcr_read_sdram(void *opaque, int dcrn)case 0xE1 :/* SDR0_DDR0 */ ret =SDR0_DDR0_DDRM_ENCODE (1 ) |SDR0_DDR0_DDRM_DDR1 ;break ; -default : -break ; }break ; -default : -break ; }return ret;
@@ -679,12 +658,8 @@ static void dcr_write_sdram(void *opaque, int dcrn, uint32_t val)switch (sdram->addr) {case 0x00 :/* B0CR */ break ; -default : -break ; }break ; -default : -break ; } }
@@ -760,8 +735,6 @@ static uint32_t dcr_read_ahb(void *opaque, int dcrn)case AHB_BOT : ret = ahb->bot;break ; -default : -break ; }return ret;
hw/ppc/ppc4xx_devs.c +4 -27
@@ -182,7 +182,7 @@ static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram)static uint32_t dcr_read_sdram (void *opaque,int dcrn) {ppc4xx_sdram_t *sdram; -uint32_t ret; +uint32_t ret =0 ; sdram = opaque;switch (dcrn) {
@@ -238,10 +238,6 @@ static uint32_t dcr_read_sdram (void *opaque, int dcrn)break ; }break ; -default : -/* Avoid gcc warning */ - ret =0x00000000 ; -break ; }return ret;
@@ -321,8 +317,6 @@ static void dcr_write_sdram (void *opaque, int dcrn, uint32_t val)qemu_irq_lower (sdram->irq); sdram->eccesr = val;break ; -default :/* Error */ -break ; }break ; }
@@ -476,7 +470,7 @@ static void ppc4xx_mal_reset(DeviceState *dev)static uint32_t dcr_read_mal (void *opaque,int dcrn) {Ppc4xxMalState *mal = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case MAL0_CFG :
@@ -512,9 +506,6 @@ static uint32_t dcr_read_mal(void *opaque, int dcrn)case MAL0_RXDEIR : ret = mal->rxdeir;break ; -default : - ret =0 ; -break ; }if (dcrn >=MAL0_TXCTP0R && dcrn <MAL0_TXCTP0R + mal->txcnum) { ret = mal->txctpr[dcrn -MAL0_TXCTP0R ];
@@ -671,7 +662,7 @@ enum {static uint32_t dcr_read_plb (void *opaque,int dcrn) {Ppc405PlbState *plb = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case PLB0_ACR :
@@ -683,10 +674,6 @@ static uint32_t dcr_read_plb(void *opaque, int dcrn)case PLB0_BESR : ret = plb->besr;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;
@@ -756,7 +743,7 @@ enum {static uint32_t dcr_read_ebc (void *opaque,int dcrn) {Ppc405EbcState *ebc = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case EBC0_CFGADDR :
@@ -824,14 +811,8 @@ static uint32_t dcr_read_ebc(void *opaque, int dcrn)case 0x23 :/* CFG */ ret = ebc->cfg;break ; -default : - ret =0x00000000 ; -break ; }break ; -default : - ret =0x00000000 ; -break ; }return ret;
@@ -887,12 +868,8 @@ static void dcr_write_ebc(void *opaque, int dcrn, uint32_t val)break ;case 0x23 :/* CFG */ break ; -default : -break ; }break ; -default : -break ; } }
Signature · 1 line
2.30.4
Re: [PATCH 21/22] ppc4xx: Drop empty default cases
Quoted 3 lines · BALATON Zoltan
Remove default case labels that do nothing or only there to set a default value that could easily be done at the variable definition instead.
May be instead, the default case labels deserve a LOG_GUEST_ERROR or a UNIMP or even g_assert_not_reached() ?
C.
Quoted 356 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc405_boards.c | 7 +------ hw/ppc/ppc405_uc.c | 29 +++++------------------------ hw/ppc/ppc440_uc.c | 27 --------------------------- hw/ppc/ppc4xx_devs.c | 31 ++++--------------------------- 4 files changed, 10 insertions(+), 84 deletions(-)hw/ppc/ppc405_boards.c +1
-6@@ -401,7 +401,7 @@ struct Ref405epFpgaState {static uint64_t ref405ep_fpga_readb (void *opaque,hwaddr addr,unsigned size) {Ref405epFpgaState *fpga = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (addr) {case 0x0 :@@ -410,9 +410,6 @@ static uint64_t ref405ep_fpga_readb(void *opaque, hwaddr addr, unsigned size)case 0x1 : ret = fpga->reg1;break ; -default : - ret =0 ; -break ; }return ret;@@ -430,8 +427,6 @@ static void ref405ep_fpga_writeb(void *opaque, hwaddr addr, uint64_t value,case 0x1 : fpga->reg1 = value;break ; -default : -break ; } }hw/ppc/ppc405_uc.c +5
-24@@ -56,7 +56,7 @@ enum {static uint32_t dcr_read_pob (void *opaque,int dcrn) {Ppc405PobState *pob = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case POB0_BEAR :@@ -68,10 +68,6 @@ static uint32_t dcr_read_pob(void *opaque, int dcrn)case POB0_BESR1 : ret = pob->besr1;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;@@ -131,7 +127,7 @@ static void ppc405_pob_class_init(ObjectClass *oc, void *data)static uint64_t opba_readb (void *opaque,hwaddr addr,unsigned size) {Ppc405OpbaState *opba = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (addr) {case 0x00 :@@ -140,9 +136,6 @@ static uint64_t opba_readb(void *opaque, hwaddr addr, unsigned size)case 0x01 : ret = opba->pr;break ; -default : - ret =0x00 ; -break ; }trace_opba_readb (addr, ret);@@ -163,8 +156,6 @@ static void opba_writeb(void *opaque, hwaddr addr, uint64_t value,case 0x01 : opba->pr = value &0xFF ;break ; -default : -break ; } }static const MemoryRegionOps opba_ops = {@@ -403,7 +394,7 @@ static void ocm_update_mappings(Ppc405OcmState *ocm,static uint32_t dcr_read_ocm (void *opaque,int dcrn) {Ppc405OcmState *ocm = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case OCM0_ISARC :@@ -418,9 +409,6 @@ static uint32_t dcr_read_ocm(void *opaque, int dcrn)case OCM0_DSACNTL : ret = ocm->dsacntl;break ; -default : - ret =0 ; -break ; }return ret;@@ -556,7 +544,7 @@ static void ppc4xx_gpt_compute_timer(Ppc405GptState *gpt)static uint64_t ppc4xx_gpt_read (void *opaque,hwaddr addr,unsigned size) {Ppc405GptState *gpt = opaque; -uint32_t ret; +uint32_t ret =-1 ;int idx;trace_ppc4xx_gpt_read (addr, size);@@ -598,9 +586,6 @@ static uint64_t ppc4xx_gpt_read(void *opaque, hwaddr addr, unsigned size) idx = (addr -0xC0 ) >>2 ; ret = gpt->mask[idx];break ; -default : - ret =-1 ; -break ; }return ret;@@ -844,7 +829,7 @@ static void ppc405ep_compute_clocks(Ppc405CpcState *cpc)static uint32_t dcr_read_epcpc (void *opaque,int dcrn) {Ppc405CpcState *cpc = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case PPC405EP_CPC0_BOOT :@@ -871,10 +856,6 @@ static uint32_t dcr_read_epcpc(void *opaque, int dcrn)case PPC405EP_CPC0_PCI : ret = cpc->pci;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;hw/ppc/ppc440_uc.c +0
-27@@ -147,9 +147,6 @@ static uint32_t dcr_read_l2sram(void *opaque, int dcrn)case DCR_ISRAM0_DPC : ret = l2sram->isram0[dcrn -DCR_ISRAM0_BASE ];break ; - -default : -break ; }return ret;@@ -304,12 +301,8 @@ static uint32_t dcr_read_cpr(void *opaque, int dcrn)case CPR0_AHBD : ret = (1 <<24 );break ; -default : -break ; }break ; -default : -break ; }return ret;@@ -325,8 +318,6 @@ static void dcr_write_cpr(void *opaque, int dcrn, uint32_t val)break ;case CPR0_CFGDATA :break ; -default : -break ; } }@@ -421,12 +412,8 @@ static uint32_t dcr_read_sdr(void *opaque, int dcrn)case PESDR1_LOOP : ret =1 <<12 ;break ; -default : -break ; }break ; -default : -break ; }return ret;@@ -444,12 +431,8 @@ static void dcr_write_sdr(void *opaque, int dcrn, uint32_t val)switch (sdr->addr) {case 0x00 :/* B0CR */ break ; -default : -break ; }break ; -default : -break ; } }@@ -646,12 +629,8 @@ static uint32_t dcr_read_sdram(void *opaque, int dcrn)case 0xE1 :/* SDR0_DDR0 */ ret =SDR0_DDR0_DDRM_ENCODE (1 ) |SDR0_DDR0_DDRM_DDR1 ;break ; -default : -break ; }break ; -default : -break ; }return ret;@@ -679,12 +658,8 @@ static void dcr_write_sdram(void *opaque, int dcrn, uint32_t val)switch (sdram->addr) {case 0x00 :/* B0CR */ break ; -default : -break ; }break ; -default : -break ; } }@@ -760,8 +735,6 @@ static uint32_t dcr_read_ahb(void *opaque, int dcrn)case AHB_BOT : ret = ahb->bot;break ; -default : -break ; }return ret;hw/ppc/ppc4xx_devs.c +4
-27@@ -182,7 +182,7 @@ static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram)static uint32_t dcr_read_sdram (void *opaque,int dcrn) {ppc4xx_sdram_t *sdram; -uint32_t ret; +uint32_t ret =0 ; sdram = opaque;switch (dcrn) {@@ -238,10 +238,6 @@ static uint32_t dcr_read_sdram (void *opaque, int dcrn)break ; }break ; -default : -/* Avoid gcc warning */ - ret =0x00000000 ; -break ; }return ret;@@ -321,8 +317,6 @@ static void dcr_write_sdram (void *opaque, int dcrn, uint32_t val)qemu_irq_lower (sdram->irq); sdram->eccesr = val;break ; -default :/* Error */ -break ; }break ; }@@ -476,7 +470,7 @@ static void ppc4xx_mal_reset(DeviceState *dev)static uint32_t dcr_read_mal (void *opaque,int dcrn) {Ppc4xxMalState *mal = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case MAL0_CFG :@@ -512,9 +506,6 @@ static uint32_t dcr_read_mal(void *opaque, int dcrn)case MAL0_RXDEIR : ret = mal->rxdeir;break ; -default : - ret =0 ; -break ; }if (dcrn >=MAL0_TXCTP0R && dcrn <MAL0_TXCTP0R + mal->txcnum) { ret = mal->txctpr[dcrn -MAL0_TXCTP0R ];@@ -671,7 +662,7 @@ enum {static uint32_t dcr_read_plb (void *opaque,int dcrn) {Ppc405PlbState *plb = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case PLB0_ACR :@@ -683,10 +674,6 @@ static uint32_t dcr_read_plb(void *opaque, int dcrn)case PLB0_BESR : ret = plb->besr;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;@@ -756,7 +743,7 @@ enum {static uint32_t dcr_read_ebc (void *opaque,int dcrn) {Ppc405EbcState *ebc = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case EBC0_CFGADDR :@@ -824,14 +811,8 @@ static uint32_t dcr_read_ebc(void *opaque, int dcrn)case 0x23 :/* CFG */ ret = ebc->cfg;break ; -default : - ret =0x00000000 ; -break ; }break ; -default : - ret =0x00000000 ; -break ; }return ret;@@ -887,12 +868,8 @@ static void dcr_write_ebc(void *opaque, int dcrn, uint32_t val)break ;case 0x23 :/* CFG */ break ; -default : -break ; }break ; -default : -break ; } }
Re: [PATCH 21/22] ppc4xx: Drop empty default cases
Quoted 7 lines · Cédric Le Goater
Quoted 3 lines · BALATON Zoltan
Remove default case labels that do nothing or only there to set a default value that could easily be done at the variable definition instead.
May be instead, the default case labels deserve a
LOG_GUEST_ERRORor a UNIMP or eveng_assert_not_reached()?
g_assert_not_reached() is probably too much as a lot of these models may be incomplete so I think that could cause crashes where it works now but adding LOG_UNIMP could be useful to detect missing pieces.
Regards,
BALATON Zoltan
Quoted 349 lines
C.
Quoted 344 lines
Signed-off-by BALATON Zoltan <[email protected]>--- hw/ppc/ppc405_boards.c | 7 +------ hw/ppc/ppc405_uc.c | 29 +++++------------------------ hw/ppc/ppc440_uc.c | 27 --------------------------- hw/ppc/ppc4xx_devs.c | 31 ++++--------------------------- 4 files changed, 10 insertions(+), 84 deletions(-)hw/ppc/ppc405_boards.c +1
-6@@ -401,7 +401,7 @@ struct Ref405epFpgaState {static uint64_t ref405ep_fpga_readb (void *opaque,hwaddr addr,unsigned size) {Ref405epFpgaState *fpga = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (addr) {case 0x0 :@@ -410,9 +410,6 @@ static uint64_t ref405ep_fpga_readb(void *opaque, hwaddr addr, unsigned size)case 0x1 : ret = fpga->reg1;break ; -default : - ret =0 ; -break ; }return ret;@@ -430,8 +427,6 @@ static void ref405ep_fpga_writeb(void *opaque, hwaddr addr, uint64_t value, case 0x1: fpga->reg1 = value;break ; -default : -break ; } }diff --git
a/hw/ppc/ppc405_uc.cb/hw/ppc/ppc405_uc.c
indexb13026200f..6c84d87330100644hw/ppc/ppc405_uc.c +2
-11@@ -56,7 +56,7 @@ enum {static uint32_t dcr_read_pob (void *opaque,int dcrn) {Ppc405PobState *pob = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case POB0_BEAR :@@ -68,10 +68,6 @@ static uint32_t dcr_read_pob(void *opaque, int dcrn)case POB0_BESR1 : ret = pob->besr1;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;@@ -131,7 +127,7 @@ static void ppc405_pob_class_init(ObjectClass *oc, void *data)static uint64_t opba_readb (void *opaque,hwaddr addr,unsigned size) {Ppc405OpbaState *opba = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (addr) {case 0x00 :@@ -140,9 +136,6 @@ static uint64_t opba_readb(void *opaque, hwaddr addr, unsigned size)case 0x01 : ret = opba->pr;break ; -default : - ret =0x00 ; -break ; }trace_opba_readb (addr, ret);@@ -163,8 +156,6 @@ static void opba_writeb(void *opaque, hwaddr addr,uint64_t value, case 0x01: opba->pr = value & 0xFF;break ; -default : -break ; } }static const MemoryRegionOps opba_ops = {hw/ppc/ppc405_uc.c +3
-13@@ -403,7 +394,7 @@ static void ocm_update_mappings(Ppc405OcmState *ocm,static uint32_t dcr_read_ocm (void *opaque,int dcrn) {Ppc405OcmState *ocm = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case OCM0_ISARC :@@ -418,9 +409,6 @@ static uint32_t dcr_read_ocm(void *opaque, int dcrn)case OCM0_DSACNTL : ret = ocm->dsacntl;break ; -default : - ret =0 ; -break ; }return ret;@@ -556,7 +544,7 @@ static void ppc4xx_gpt_compute_timer(Ppc405GptState *gpt)static uint64_t ppc4xx_gpt_read (void *opaque,hwaddr addr,unsigned size) {Ppc405GptState *gpt = opaque; -uint32_t ret; +uint32_t ret =-1 ;int idx;trace_ppc4xx_gpt_read (addr, size);@@ -598,9 +586,6 @@ static uint64_t ppc4xx_gpt_read(void *opaque, hwaddr addr, unsigned size) idx = (addr -0xC0 ) >>2 ; ret = gpt->mask[idx];break ; -default : - ret =-1 ; -break ; }return ret;@@ -844,7 +829,7 @@ static void ppc405ep_compute_clocks(Ppc405CpcState *cpc)static uint32_t dcr_read_epcpc (void *opaque,int dcrn) {Ppc405CpcState *cpc = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case PPC405EP_CPC0_BOOT :@@ -871,10 +856,6 @@ static uint32_t dcr_read_epcpc(void *opaque, int dcrn)case PPC405EP_CPC0_PCI : ret = cpc->pci;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;hw/ppc/ppc440_uc.c +0
-9@@ -147,9 +147,6 @@ static uint32_t dcr_read_l2sram(void *opaque, int dcrn)case DCR_ISRAM0_DPC : ret = l2sram->isram0[dcrn -DCR_ISRAM0_BASE ];break ; - -default : -break ; }return ret;@@ -304,12 +301,8 @@ static uint32_t dcr_read_cpr(void *opaque, int dcrn)case CPR0_AHBD : ret = (1 <<24 );break ; -default : -break ; }break ; -default : -break ; }return ret;@@ -325,8 +318,6 @@ static void dcr_write_cpr(void *opaque, int dcrn, uint32_t val) break;case CPR0_CFGDATA :break ; -default : -break ; } }@@ -421,12 +412,8 @@ static uint32_t dcr_read_sdr(void *opaque, int dcrn) case PESDR1_LOOP: ret = 1 << 12; break;hw/ppc/ppc440_uc.c +0
-8-default : -break ; }break ; -default : -break ; }return ret;@@ -444,12 +431,8 @@ static void dcr_write_sdr(void *opaque, int dcrn, uint32_t val)switch (sdr->addr) {case 0x00 :/* B0CR */ break ; -default : -break ; }break ; -default : -break ; } }@@ -646,12 +629,8 @@ static
uint32_tdcr_read_sdram(void *opaque, int
dcrn)case 0xE1: /* SDR0_DDR0 */ ret = SDR0_DDR0_DDRM_ENCODE(1) | SDR0_DDR0_DDRM_DDR1; break;hw/ppc/ppc440_uc.c +0
-8-default : -break ; }break ; -default : -break ; }return ret;@@ -679,12 +658,8 @@ static void dcr_write_sdram(void *opaque, int dcrn, uint32_t val)switch (sdram->addr) {case 0x00 :/* B0CR */ break ; -default : -break ; }break ; -default : -break ; } }@@ -760,8 +735,6 @@ static uint32_t dcr_read_ahb(void *opaque, int dcrn) case AHB_BOT: ret = ahb->bot; break;hw/ppc/ppc440_uc.c +0
-2-default : -break ; }return ret;hw/ppc/ppc4xx_devs.c +1
-7@@ -182,7 +182,7 @@ static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram)static uint32_t dcr_read_sdram (void *opaque,int dcrn) {ppc4xx_sdram_t *sdram; -uint32_t ret; +uint32_t ret =0 ; sdram = opaque;switch (dcrn) {@@ -238,10 +238,6 @@ static uint32_t dcr_read_sdram (void *opaque, int dcrn)break ; }break ; -default : -/* Avoid gcc warning */ - ret =0x00000000 ; -break ; }return ret;@@ -321,8 +317,6 @@ static void dcr_write_sdram (void *opaque, int dcrn, uint32_t val) qemu_irq_lower(sdram->irq); sdram->eccesr = val;break ; -default :/* Error */ -break ; }break ;}hw/ppc/ppc4xx_devs.c +3
-20@@ -476,7 +470,7 @@ static void ppc4xx_mal_reset(DeviceState *dev)static uint32_t dcr_read_mal (void *opaque,int dcrn) {Ppc4xxMalState *mal = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case MAL0_CFG :@@ -512,9 +506,6 @@ static uint32_t dcr_read_mal(void *opaque, int dcrn)case MAL0_RXDEIR : ret = mal->rxdeir;break ; -default : - ret =0 ; -break ; }if (dcrn >=MAL0_TXCTP0R && dcrn <MAL0_TXCTP0R + mal->txcnum) { ret = mal->txctpr[dcrn -MAL0_TXCTP0R ];@@ -671,7 +662,7 @@ enum {static uint32_t dcr_read_plb (void *opaque,int dcrn) {Ppc405PlbState *plb = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case PLB0_ACR :@@ -683,10 +674,6 @@ static uint32_t dcr_read_plb(void *opaque, int dcrn)case PLB0_BESR : ret = plb->besr;break ; -default : -/* Avoid gcc warning */ - ret =0 ; -break ; }return ret;@@ -756,7 +743,7 @@ enum {static uint32_t dcr_read_ebc (void *opaque,int dcrn) {Ppc405EbcState *ebc = opaque; -uint32_t ret; +uint32_t ret =0 ;switch (dcrn) {case EBC0_CFGADDR :@@ -824,14 +811,8 @@ static uint32_t dcr_read_ebc(void *opaque, int dcrn)case 0x23 :/* CFG */ ret = ebc->cfg;break ; -default : - ret =0x00000000 ; -break ; }break ; -default : - ret =0x00000000 ; -break ; }return ret;@@ -887,12 +868,8 @@ static void dcr_write_ebc(void *opaque, int dcrn, uint32_t val) break;case 0x23 :/* CFG */ break ; -default : -break ; }break ; -default : -break ; } }
PATCH 22/22 ppc/ppc4xx: Fix sdram trace events
In reply to BALATON ZoltanFrom: Cédric Le Goater <[email protected]>
--- hw/ppc/ppc4xx_devs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/ppc4xx_devs.c +1 -1
@@ -142,7 +142,7 @@ static void sdram_set_bcr(ppc4xx_sdram_t *sdram, int i, } sdram->bcr[i] = bcr &0xFFDEE001 ;if (enabled && (bcr &0x00000001 )) { -trace_ppc4xx_sdram_unmap (sdram_base (bcr),sdram_size (bcr)); +trace_ppc4xx_sdram_map (sdram_base (bcr),sdram_size (bcr));memory_region_init (&sdram->containers[i],NULL ,"sdram-containers" ,sdram_size (bcr)); memory_region_add_subregion(&sdram->containers[i], 0,
Signature · 1 line
2.30.4
Quoted 10 lines · BALATON Zoltan
Hello,
This is mased on gitlab.com/danielhb/qemu/tree/ppc-7.2
This series contains the rest of Cédric's patches modified according my review comments and some other small clean ups I've noticed along the way. I've kept the From line of Cédric for patches that were originally his even though they are modified a bit. Not sure what's the best way for this or what Cédric prefers.
Quoted 4 lines
The last sdram changes are not yet here because I'm still looking at those and will come back to them but this series is ready to merge unless there are comments that need further changes. Please let me know what do you think.
LGTM. In case you resend, may be change the names of the models which are now common to PPC4xx. That's minor really.
I would dig the default case labels a little more before removing them.
Thanks,
C.
Quoted 43 lines
Regards,
BALATON ZoltanBALATON Zoltan (22):
ppc/ppc4xx: Introduce a DCR device model ppc/ppc405: QOM'ify CPC
ppc/ppc405: QOM'ify GPT
ppc/ppc405: QOM'ify OCM
ppc/ppc405: QOM'ify GPIO
ppc/ppc405: QOM'ify DMA
ppc/ppc405: QOM'ify EBC
ppc/ppc405: QOM'ify OPBA
ppc/ppc405: QOM'ify POB
ppc/ppc405: QOM'ify PLB
ppc/ppc405: QOM'ify MAL
ppc4xx: Move PLB model toppc4xx_devs.c
ppc4xx: Move EBC model toppc4xx_devs.cppc/ppc405: Use an embedded PPCUIC model in SoC state hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device ppc/ppc405: Use an explicit I2C object ppc/ppc405: QOM'ify FPGA
ppc405: Move machine specific code toppc405_boards.chw/ppc/Kconfig: Remove PPC405 dependency from sam460ex hw/ppc/Kconfig: Move imply before select
ppc4xx: Drop empty default cases
ppc/ppc4xx: Fix sdram trace eventshw/intc/ppc-uic.c | 26 +- hw/ppc/Kconfig | 3 +- hw/ppc/ppc405.h | 182 +++++-- hw/ppc/ppc405_boards.c | 360 +++++++++---- hw/ppc/ppc405_uc.c | 1071 ++++++++++++------------------------- hw/ppc/ppc440_bamboo.c | 7 +- hw/ppc/ppc440_uc.c | 27 - hw/ppc/ppc4xx_devs.c | 473 +++++++++++++--- hw/ppc/sam460ex.c | 37 +- hw/ppc/trace-events | 3 - hw/ppc/virtex_ml507.c | 7 +- include/hw/intc/ppc-uic.h | 6 +- include/hw/ppc/ppc4xx.h | 71 ++- 13 files changed, 1223 insertions(+), 1050 deletions(-)
Quoted 16 lines · Cédric Le Goater
Quoted 10 lines · BALATON Zoltan
Hello,
This is mased on gitlab.com/danielhb/qemu/tree/ppc-7.2
This series contains the rest of Cédric's patches modified according my review comments and some other small clean ups I've noticed along the way. I've kept the From line of Cédric for patches that were originally his even though they are modified a bit. Not sure what's the best way for this or what Cédric prefers.
Quoted 4 lines
The last sdram changes are not yet here because I'm still looking at those and will come back to them but this series is ready to merge unless there are comments that need further changes. Please let me know what do you think.
Quoted 5 lines
LGTM. In case you resend, may be change the names of the models which are now common to PPC4xx. That's minor really.
I would dig the default case labels a little more before removing them.
I've sent a v2 that includes the proposed name changes and dropped the patch removing empty default cases for now. This v2 now also includes my version of the sdram changes so that's all from me for now.
Regards,
BALATON Zoltan
Quoted 51 lines
Thanks,
C.
Quoted 43 lines
Regards,
BALATON ZoltanBALATON Zoltan (22):
ppc/ppc4xx: Introduce a DCR device model ppc/ppc405: QOM'ify CPC
ppc/ppc405: QOM'ify GPT
ppc/ppc405: QOM'ify OCM
ppc/ppc405: QOM'ify GPIO
ppc/ppc405: QOM'ify DMA
ppc/ppc405: QOM'ify EBC
ppc/ppc405: QOM'ify OPBA
ppc/ppc405: QOM'ify POB
ppc/ppc405: QOM'ify PLB
ppc/ppc405: QOM'ify MAL
ppc4xx: Move PLB model toppc4xx_devs.c
ppc4xx: Move EBC model toppc4xx_devs.cppc/ppc405: Use an embedded PPCUIC model in SoC state hw/intc/ppc-uic: Convert ppc-uic to a PPC4xx DCR device ppc/ppc405: Use an explicit I2C object ppc/ppc405: QOM'ify FPGA
ppc405: Move machine specific code toppc405_boards.chw/ppc/Kconfig: Remove PPC405 dependency from sam460ex hw/ppc/Kconfig: Move imply before select
ppc4xx: Drop empty default cases
ppc/ppc4xx: Fix sdram trace eventshw/intc/ppc-uic.c | 26 +- hw/ppc/Kconfig | 3 +- hw/ppc/ppc405.h | 182 +++++-- hw/ppc/ppc405_boards.c | 360 +++++++++---- hw/ppc/ppc405_uc.c | 1071 ++++++++++++------------------------- hw/ppc/ppc440_bamboo.c | 7 +- hw/ppc/ppc440_uc.c | 27 - hw/ppc/ppc4xx_devs.c | 473 +++++++++++++--- hw/ppc/sam460ex.c | 37 +- hw/ppc/trace-events | 3 - hw/ppc/virtex_ml507.c | 7 +- include/hw/intc/ppc-uic.h | 6 +- include/hw/ppc/ppc4xx.h | 71 ++- 13 files changed, 1223 insertions(+), 1050 deletions(-)