mirror of https://github.com/xemu-project/xemu.git
hw/intc/pxa2xx: Pass CPU reference using QOM link property
QOM objects shouldn't access each other internals fields except using the QOM API. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 20231020130331.50048-8-philmd@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
ead17ebf53
commit
ee5c9b5b19
|
@ -15,6 +15,7 @@
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/arm/pxa.h"
|
#include "hw/arm/pxa.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
#include "hw/qdev-properties.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
#include "target/arm/cpregs.h"
|
#include "target/arm/cpregs.h"
|
||||||
|
@ -288,7 +289,8 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu)
|
||||||
DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC);
|
DeviceState *dev = qdev_new(TYPE_PXA2XX_PIC);
|
||||||
PXA2xxPICState *s = PXA2XX_PIC(dev);
|
PXA2xxPICState *s = PXA2XX_PIC(dev);
|
||||||
|
|
||||||
s->cpu = cpu;
|
object_property_set_link(OBJECT(dev), "arm-cpu",
|
||||||
|
OBJECT(cpu), &error_abort);
|
||||||
|
|
||||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||||
|
|
||||||
|
@ -321,11 +323,18 @@ static const VMStateDescription vmstate_pxa2xx_pic_regs = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Property pxa2xx_pic_properties[] = {
|
||||||
|
DEFINE_PROP_LINK("arm-cpu", PXA2xxPICState, cpu,
|
||||||
|
TYPE_ARM_CPU, ARMCPU *),
|
||||||
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
};
|
||||||
|
|
||||||
static void pxa2xx_pic_class_init(ObjectClass *klass, void *data)
|
static void pxa2xx_pic_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
ResettableClass *rc = RESETTABLE_CLASS(klass);
|
ResettableClass *rc = RESETTABLE_CLASS(klass);
|
||||||
|
|
||||||
|
device_class_set_props(dc, pxa2xx_pic_properties);
|
||||||
dc->desc = "PXA2xx PIC";
|
dc->desc = "PXA2xx PIC";
|
||||||
dc->vmsd = &vmstate_pxa2xx_pic_regs;
|
dc->vmsd = &vmstate_pxa2xx_pic_regs;
|
||||||
rc->phases.hold = pxa2xx_pic_reset_hold;
|
rc->phases.hold = pxa2xx_pic_reset_hold;
|
||||||
|
|
Loading…
Reference in New Issue