eccmemctl: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
ba4ea5bd29
commit
100bb15cb8
|
@ -120,8 +120,12 @@
|
||||||
#define ECC_DIAG_SIZE 4
|
#define ECC_DIAG_SIZE 4
|
||||||
#define ECC_DIAG_MASK (ECC_DIAG_SIZE - 1)
|
#define ECC_DIAG_MASK (ECC_DIAG_SIZE - 1)
|
||||||
|
|
||||||
|
#define TYPE_ECC_MEMCTL "eccmemctl"
|
||||||
|
#define ECC_MEMCTL(obj) OBJECT_CHECK(ECCState, (obj), TYPE_ECC_MEMCTL)
|
||||||
|
|
||||||
typedef struct ECCState {
|
typedef struct ECCState {
|
||||||
SysBusDevice busdev;
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
MemoryRegion iomem, iomem_diag;
|
MemoryRegion iomem, iomem_diag;
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
uint32_t regs[ECC_NREGS];
|
uint32_t regs[ECC_NREGS];
|
||||||
|
@ -273,13 +277,14 @@ static const VMStateDescription vmstate_ecc = {
|
||||||
|
|
||||||
static void ecc_reset(DeviceState *d)
|
static void ecc_reset(DeviceState *d)
|
||||||
{
|
{
|
||||||
ECCState *s = container_of(d, ECCState, busdev.qdev);
|
ECCState *s = ECC_MEMCTL(d);
|
||||||
|
|
||||||
if (s->version == ECC_MCC)
|
if (s->version == ECC_MCC) {
|
||||||
s->regs[ECC_MER] &= ECC_MER_REU;
|
s->regs[ECC_MER] &= ECC_MER_REU;
|
||||||
else
|
} else {
|
||||||
s->regs[ECC_MER] &= (ECC_MER_VER | ECC_MER_IMPL | ECC_MER_MRR |
|
s->regs[ECC_MER] &= (ECC_MER_VER | ECC_MER_IMPL | ECC_MER_MRR |
|
||||||
ECC_MER_DCI);
|
ECC_MER_DCI);
|
||||||
|
}
|
||||||
s->regs[ECC_MDR] = 0x20;
|
s->regs[ECC_MDR] = 0x20;
|
||||||
s->regs[ECC_MFSR] = 0;
|
s->regs[ECC_MFSR] = 0;
|
||||||
s->regs[ECC_VCR] = 0;
|
s->regs[ECC_VCR] = 0;
|
||||||
|
@ -292,7 +297,7 @@ static void ecc_reset(DeviceState *d)
|
||||||
|
|
||||||
static int ecc_init1(SysBusDevice *dev)
|
static int ecc_init1(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
ECCState *s = FROM_SYSBUS(ECCState, dev);
|
ECCState *s = ECC_MEMCTL(dev);
|
||||||
|
|
||||||
sysbus_init_irq(dev, &s->irq);
|
sysbus_init_irq(dev, &s->irq);
|
||||||
s->regs[0] = s->version;
|
s->regs[0] = s->version;
|
||||||
|
@ -325,7 +330,7 @@ static void ecc_class_init(ObjectClass *klass, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo ecc_info = {
|
static const TypeInfo ecc_info = {
|
||||||
.name = "eccmemctl",
|
.name = TYPE_ECC_MEMCTL,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(ECCState),
|
.instance_size = sizeof(ECCState),
|
||||||
.class_init = ecc_class_init,
|
.class_init = ecc_class_init,
|
||||||
|
|
Loading…
Reference in a new issue