mirror of https://gitee.com/openkylin/qemu.git
lm32/milkymist: some qomifying
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJXaBmJAAoJELRYq7DY03jj6osP/Az+8Rkb8eL3hVzqDso6JZhx QMmp48ipNe7xWlTGjKrf6yUWyuehp7Hr2dlXkz6KG/Y/PQg15uMfH3ZlS0HzWuyO cSeRQsvNY759Wk7bnAzzuRK9eVxXJaSytodaA+swGo/7maDbMMXdv0gFa/qP6k1e 4vc4mLoi3PX6GHuFsfWUaDkOkZpuhzsj3MxEEqDJd1TpiJzZIbJokk4bLUF89kCz tRGNUoUXJnWLigJYjOqXjg15Cue70ztiX3VE6LoI+TRe/RsJPLd+oCtij40Gah/S cOZUeuxIgLGDdkGoax+H/ymTjpTrHB4Mo8E7rtlwT/HYFti4ZzWeA9T3mJ9Zwc2F q4xU/St7dJYEOH37qNXKzyIWmQZxJKJOpOaOzasPbo76Bvt1X9d5+HuDOtf9ftWo LR/U+1MFxGId7TMM2/j+ziHKZcZWkGkpK7K0tScB6dM/yCxv1Qs5HuioqMNIvAgc Pe0bNAI5zSGX5ldqR/tPxL9b27PkqFs0a6itLOIv4tvashmnBfcDiaDMXmRc+hsb jJ7apWyEF3JOw9dKSpwgspPJHavYuRhohgfhuEpuwkcwc2QD3QdDrtlV6bxRhJoj yMZ5905B99LNCCGOszol1yMlzHLbGTmZVyhu8bL9930oxHgZzfOCQMFVtMMxaAp1 0yEVhlbZ0JE7zpetAHeF =ggrO -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mwalle/tags/lm32-queue/20160620' into staging lm32/milkymist: some qomifying # gpg: Signature made Mon 20 Jun 2016 17:27:53 BST # gpg: using RSA key 0xB458ABB0D8D378E3 # gpg: Good signature from "Michael Walle <michael@walle.cc>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 2190 3E48 4537 A7C2 90CE 3EB2 B458 ABB0 D8D3 78E3 * remotes/mwalle/tags/lm32-queue/20160620: milkymist: update specification URLs hw/intc: QOM'ify lm32_pic.c hw/display: QOM'ify milkymist-vgafb.c hw/display: QOM'ify milkymist-tmu2.c hw/timer: QOM'ify milkymist_sysctl hw/timer: QOM'ify lm32_timer Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
7e13ea57f4
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/ac97.pdf
|
||||
* http://milkymist.walle.cc/socdoc/ac97.pdf
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/uart.pdf
|
||||
* http://milkymist.walle.cc/socdoc/uart.pdf
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/tmu2.pdf
|
||||
* http://milkymist.walle.cc/socdoc/tmu2.pdf
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -443,21 +443,25 @@ static void milkymist_tmu2_reset(DeviceState *d)
|
|||
}
|
||||
}
|
||||
|
||||
static int milkymist_tmu2_init(SysBusDevice *dev)
|
||||
static void milkymist_tmu2_init(Object *obj)
|
||||
{
|
||||
MilkymistTMU2State *s = MILKYMIST_TMU2(obj);
|
||||
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
|
||||
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
|
||||
memory_region_init_io(&s->regs_region, obj, &tmu2_mmio_ops, s,
|
||||
"milkymist-tmu2", R_MAX * 4);
|
||||
sysbus_init_mmio(dev, &s->regs_region);
|
||||
}
|
||||
|
||||
static void milkymist_tmu2_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
MilkymistTMU2State *s = MILKYMIST_TMU2(dev);
|
||||
|
||||
if (tmu2_glx_init(s)) {
|
||||
return 1;
|
||||
error_setg(errp, "tmu2_glx_init failed");
|
||||
}
|
||||
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
|
||||
memory_region_init_io(&s->regs_region, OBJECT(s), &tmu2_mmio_ops, s,
|
||||
"milkymist-tmu2", R_MAX * 4);
|
||||
sysbus_init_mmio(dev, &s->regs_region);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_milkymist_tmu2 = {
|
||||
|
@ -473,9 +477,8 @@ static const VMStateDescription vmstate_milkymist_tmu2 = {
|
|||
static void milkymist_tmu2_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = milkymist_tmu2_init;
|
||||
dc->realize = milkymist_tmu2_realize;
|
||||
dc->reset = milkymist_tmu2_reset;
|
||||
dc->vmsd = &vmstate_milkymist_tmu2;
|
||||
}
|
||||
|
@ -484,6 +487,7 @@ static const TypeInfo milkymist_tmu2_info = {
|
|||
.name = TYPE_MILKYMIST_TMU2,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(MilkymistTMU2State),
|
||||
.instance_init = milkymist_tmu2_init,
|
||||
.class_init = milkymist_tmu2_class_init,
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/vgafb.pdf
|
||||
* http://milkymist.walle.cc/socdoc/vgafb.pdf
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
@ -292,17 +292,21 @@ static const GraphicHwOps vgafb_ops = {
|
|||
.gfx_update = vgafb_update_display,
|
||||
};
|
||||
|
||||
static int milkymist_vgafb_init(SysBusDevice *dev)
|
||||
static void milkymist_vgafb_init(Object *obj)
|
||||
{
|
||||
MilkymistVgafbState *s = MILKYMIST_VGAFB(dev);
|
||||
MilkymistVgafbState *s = MILKYMIST_VGAFB(obj);
|
||||
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
|
||||
|
||||
memory_region_init_io(&s->regs_region, OBJECT(s), &vgafb_mmio_ops, s,
|
||||
"milkymist-vgafb", R_MAX * 4);
|
||||
sysbus_init_mmio(dev, &s->regs_region);
|
||||
}
|
||||
|
||||
s->con = graphic_console_init(DEVICE(dev), 0, &vgafb_ops, s);
|
||||
static void milkymist_vgafb_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
MilkymistVgafbState *s = MILKYMIST_VGAFB(dev);
|
||||
|
||||
return 0;
|
||||
s->con = graphic_console_init(dev, 0, &vgafb_ops, s);
|
||||
}
|
||||
|
||||
static int vgafb_post_load(void *opaque, int version_id)
|
||||
|
@ -331,18 +335,18 @@ static Property milkymist_vgafb_properties[] = {
|
|||
static void milkymist_vgafb_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = milkymist_vgafb_init;
|
||||
dc->reset = milkymist_vgafb_reset;
|
||||
dc->vmsd = &vmstate_milkymist_vgafb;
|
||||
dc->props = milkymist_vgafb_properties;
|
||||
dc->realize = milkymist_vgafb_realize;
|
||||
}
|
||||
|
||||
static const TypeInfo milkymist_vgafb_info = {
|
||||
.name = TYPE_MILKYMIST_VGAFB,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(MilkymistVgafbState),
|
||||
.instance_init = milkymist_vgafb_init,
|
||||
.class_init = milkymist_vgafb_class_init,
|
||||
};
|
||||
|
||||
|
|
|
@ -152,17 +152,16 @@ static void pic_reset(DeviceState *d)
|
|||
}
|
||||
}
|
||||
|
||||
static int lm32_pic_init(SysBusDevice *sbd)
|
||||
static void lm32_pic_init(Object *obj)
|
||||
{
|
||||
DeviceState *dev = DEVICE(sbd);
|
||||
LM32PicState *s = LM32_PIC(dev);
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
LM32PicState *s = LM32_PIC(obj);
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
|
||||
|
||||
qdev_init_gpio_in(dev, irq_handler, 32);
|
||||
sysbus_init_irq(sbd, &s->parent_irq);
|
||||
|
||||
pic = s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_lm32_pic = {
|
||||
|
@ -181,9 +180,7 @@ static const VMStateDescription vmstate_lm32_pic = {
|
|||
static void lm32_pic_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = lm32_pic_init;
|
||||
dc->reset = pic_reset;
|
||||
dc->vmsd = &vmstate_lm32_pic;
|
||||
}
|
||||
|
@ -192,6 +189,7 @@ static const TypeInfo lm32_pic_info = {
|
|||
.name = TYPE_LM32_PIC,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(LM32PicState),
|
||||
.instance_init = lm32_pic_init,
|
||||
.class_init = lm32_pic_class_init,
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/hpdmc.pdf
|
||||
* http://milkymist.walle.cc/socdoc/hpdmc.pdf
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/pfpu.pdf
|
||||
* http://milkymist.walle.cc/socdoc/pfpu.pdf
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/memcard.pdf
|
||||
* http://milkymist.walle.cc/socdoc/memcard.pdf
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
|
|
@ -176,21 +176,26 @@ static void timer_reset(DeviceState *d)
|
|||
ptimer_stop(s->ptimer);
|
||||
}
|
||||
|
||||
static int lm32_timer_init(SysBusDevice *dev)
|
||||
static void lm32_timer_init(Object *obj)
|
||||
{
|
||||
LM32TimerState *s = LM32_TIMER(dev);
|
||||
LM32TimerState *s = LM32_TIMER(obj);
|
||||
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
|
||||
|
||||
sysbus_init_irq(dev, &s->irq);
|
||||
|
||||
s->bh = qemu_bh_new(timer_hit, s);
|
||||
s->ptimer = ptimer_init(s->bh);
|
||||
ptimer_set_freq(s->ptimer, s->freq_hz);
|
||||
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &timer_ops, s,
|
||||
memory_region_init_io(&s->iomem, obj, &timer_ops, s,
|
||||
"timer", R_MAX * 4);
|
||||
sysbus_init_mmio(dev, &s->iomem);
|
||||
}
|
||||
|
||||
return 0;
|
||||
static void lm32_timer_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
LM32TimerState *s = LM32_TIMER(dev);
|
||||
|
||||
ptimer_set_freq(s->ptimer, s->freq_hz);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_lm32_timer = {
|
||||
|
@ -213,9 +218,8 @@ static Property lm32_timer_properties[] = {
|
|||
static void lm32_timer_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = lm32_timer_init;
|
||||
dc->realize = lm32_timer_realize;
|
||||
dc->reset = timer_reset;
|
||||
dc->vmsd = &vmstate_lm32_timer;
|
||||
dc->props = lm32_timer_properties;
|
||||
|
@ -225,6 +229,7 @@ static const TypeInfo lm32_timer_info = {
|
|||
.name = TYPE_LM32_TIMER,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(LM32TimerState),
|
||||
.instance_init = lm32_timer_init,
|
||||
.class_init = lm32_timer_class_init,
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*
|
||||
*
|
||||
* Specification available at:
|
||||
* http://www.milkymist.org/socdoc/sysctl.pdf
|
||||
* http://milkymist.walle.cc/socdoc/sysctl.pdf
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
@ -270,9 +270,10 @@ static void milkymist_sysctl_reset(DeviceState *d)
|
|||
s->regs[R_GPIO_IN] = s->strappings;
|
||||
}
|
||||
|
||||
static int milkymist_sysctl_init(SysBusDevice *dev)
|
||||
static void milkymist_sysctl_init(Object *obj)
|
||||
{
|
||||
MilkymistSysctlState *s = MILKYMIST_SYSCTL(dev);
|
||||
MilkymistSysctlState *s = MILKYMIST_SYSCTL(obj);
|
||||
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
|
||||
|
||||
sysbus_init_irq(dev, &s->gpio_irq);
|
||||
sysbus_init_irq(dev, &s->timer0_irq);
|
||||
|
@ -282,14 +283,18 @@ static int milkymist_sysctl_init(SysBusDevice *dev)
|
|||
s->bh1 = qemu_bh_new(timer1_hit, s);
|
||||
s->ptimer0 = ptimer_init(s->bh0);
|
||||
s->ptimer1 = ptimer_init(s->bh1);
|
||||
ptimer_set_freq(s->ptimer0, s->freq_hz);
|
||||
ptimer_set_freq(s->ptimer1, s->freq_hz);
|
||||
|
||||
memory_region_init_io(&s->regs_region, OBJECT(s), &sysctl_mmio_ops, s,
|
||||
memory_region_init_io(&s->regs_region, obj, &sysctl_mmio_ops, s,
|
||||
"milkymist-sysctl", R_MAX * 4);
|
||||
sysbus_init_mmio(dev, &s->regs_region);
|
||||
}
|
||||
|
||||
return 0;
|
||||
static void milkymist_sysctl_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
MilkymistSysctlState *s = MILKYMIST_SYSCTL(dev);
|
||||
|
||||
ptimer_set_freq(s->ptimer0, s->freq_hz);
|
||||
ptimer_set_freq(s->ptimer1, s->freq_hz);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_milkymist_sysctl = {
|
||||
|
@ -319,9 +324,8 @@ static Property milkymist_sysctl_properties[] = {
|
|||
static void milkymist_sysctl_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = milkymist_sysctl_init;
|
||||
dc->realize = milkymist_sysctl_realize;
|
||||
dc->reset = milkymist_sysctl_reset;
|
||||
dc->vmsd = &vmstate_milkymist_sysctl;
|
||||
dc->props = milkymist_sysctl_properties;
|
||||
|
@ -331,6 +335,7 @@ static const TypeInfo milkymist_sysctl_info = {
|
|||
.name = TYPE_MILKYMIST_SYSCTL,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(MilkymistSysctlState),
|
||||
.instance_init = milkymist_sysctl_init,
|
||||
.class_init = milkymist_sysctl_class_init,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue