pmu.c (3d81f594fdcd6c2737a52dcb19552a298f2af9e1) pmu.c (db873cc5d1a4aaa67eea87768d504b2f89d88738)
1/*
2 * QEMU PowerMac PMU device support
3 *
4 * Copyright (c) 2016 Benjamin Herrenschmidt, IBM Corp.
5 * Copyright (c) 2018 Mark Cave-Ayland
6 *
7 * Based on the CUDA device by:
8 *

--- 24 unchanged lines hidden (view full) ---

33#include "hw/ppc/mac.h"
34#include "hw/qdev-properties.h"
35#include "migration/vmstate.h"
36#include "hw/input/adb.h"
37#include "hw/irq.h"
38#include "hw/misc/mos6522.h"
39#include "hw/misc/macio/gpio.h"
40#include "hw/misc/macio/pmu.h"
1/*
2 * QEMU PowerMac PMU device support
3 *
4 * Copyright (c) 2016 Benjamin Herrenschmidt, IBM Corp.
5 * Copyright (c) 2018 Mark Cave-Ayland
6 *
7 * Based on the CUDA device by:
8 *

--- 24 unchanged lines hidden (view full) ---

33#include "hw/ppc/mac.h"
34#include "hw/qdev-properties.h"
35#include "migration/vmstate.h"
36#include "hw/input/adb.h"
37#include "hw/irq.h"
38#include "hw/misc/mos6522.h"
39#include "hw/misc/macio/gpio.h"
40#include "hw/misc/macio/pmu.h"
41#include "qapi/error.h"
41#include "qemu/timer.h"
42#include "sysemu/runstate.h"
43#include "qapi/error.h"
44#include "qemu/cutils.h"
45#include "qemu/log.h"
46#include "qemu/module.h"
47#include "trace.h"
48

--- 690 unchanged lines hidden (view full) ---

739
740static void pmu_realize(DeviceState *dev, Error **errp)
741{
742 PMUState *s = VIA_PMU(dev);
743 Error *err = NULL;
744 SysBusDevice *sbd;
745 struct tm tm;
746
42#include "qemu/timer.h"
43#include "sysemu/runstate.h"
44#include "qapi/error.h"
45#include "qemu/cutils.h"
46#include "qemu/log.h"
47#include "qemu/module.h"
48#include "trace.h"
49

--- 690 unchanged lines hidden (view full) ---

740
741static void pmu_realize(DeviceState *dev, Error **errp)
742{
743 PMUState *s = VIA_PMU(dev);
744 Error *err = NULL;
745 SysBusDevice *sbd;
746 struct tm tm;
747
747 object_property_set_bool(OBJECT(&s->mos6522_pmu), true, "realized",
748 &err);
748 sysbus_realize(SYS_BUS_DEVICE(&s->mos6522_pmu), &err);
749 if (err) {
750 error_propagate(errp, err);
751 return;
752 }
753
754 /* Pass IRQ from 6522 */
755 sbd = SYS_BUS_DEVICE(s);
756 sysbus_pass_irq(sbd, SYS_BUS_DEVICE(&s->mos6522_pmu));

--- 18 unchanged lines hidden (view full) ---

775 SysBusDevice *d = SYS_BUS_DEVICE(obj);
776 PMUState *s = VIA_PMU(obj);
777
778 object_property_add_link(obj, "gpio", TYPE_MACIO_GPIO,
779 (Object **) &s->gpio,
780 qdev_prop_allow_set_link_before_realize,
781 0);
782
749 if (err) {
750 error_propagate(errp, err);
751 return;
752 }
753
754 /* Pass IRQ from 6522 */
755 sbd = SYS_BUS_DEVICE(s);
756 sysbus_pass_irq(sbd, SYS_BUS_DEVICE(&s->mos6522_pmu));

--- 18 unchanged lines hidden (view full) ---

775 SysBusDevice *d = SYS_BUS_DEVICE(obj);
776 PMUState *s = VIA_PMU(obj);
777
778 object_property_add_link(obj, "gpio", TYPE_MACIO_GPIO,
779 (Object **) &s->gpio,
780 qdev_prop_allow_set_link_before_realize,
781 0);
782
783 sysbus_init_child_obj(obj, "mos6522-pmu", &s->mos6522_pmu,
784 sizeof(s->mos6522_pmu), TYPE_MOS6522_PMU);
783 object_initialize_child(obj, "mos6522-pmu", &s->mos6522_pmu,
784 TYPE_MOS6522_PMU);
785
786 memory_region_init_io(&s->mem, obj, &mos6522_pmu_ops, s, "via-pmu",
787 0x2000);
788 sysbus_init_mmio(d, &s->mem);
789}
790
791static Property pmu_properties[] = {
792 DEFINE_PROP_BOOL("has-adb", PMUState, has_adb, true),

--- 88 unchanged lines hidden ---
785
786 memory_region_init_io(&s->mem, obj, &mos6522_pmu_ops, s, "via-pmu",
787 0x2000);
788 sysbus_init_mmio(d, &s->mem);
789}
790
791static Property pmu_properties[] = {
792 DEFINE_PROP_BOOL("has-adb", PMUState, has_adb, true),

--- 88 unchanged lines hidden ---