CTRL_RESET = (1<<0),
};
+#define TYPE_MILKYMIST_VGAFB "milkymist-vgafb"
+#define MILKYMIST_VGAFB(obj) \
+ OBJECT_CHECK(MilkymistVgafbState, (obj), TYPE_MILKYMIST_VGAFB)
+
struct MilkymistVgafbState {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
MemoryRegion regs_region;
QemuConsole *con;
static void vgafb_update_display(void *opaque)
{
MilkymistVgafbState *s = opaque;
+ SysBusDevice *sbd;
DisplaySurface *surface = qemu_console_surface(s->con);
int first = 0;
int last = 0;
return;
}
+ sbd = SYS_BUS_DEVICE(s);
int dest_width = s->regs[R_HRES];
switch (surface_bits_per_pixel(surface)) {
break;
}
- framebuffer_update_display(surface, sysbus_address_space(&s->busdev),
+ framebuffer_update_display(surface, sysbus_address_space(sbd),
s->regs[R_BASEADDRESS] + s->fb_offset,
s->regs[R_HRES],
s->regs[R_VRES],
static void milkymist_vgafb_reset(DeviceState *d)
{
- MilkymistVgafbState *s = container_of(d, MilkymistVgafbState, busdev.qdev);
+ MilkymistVgafbState *s = MILKYMIST_VGAFB(d);
int i;
for (i = 0; i < R_MAX; i++) {
static int milkymist_vgafb_init(SysBusDevice *dev)
{
- MilkymistVgafbState *s = FROM_SYSBUS(typeof(*s), dev);
+ MilkymistVgafbState *s = MILKYMIST_VGAFB(dev);
memory_region_init_io(&s->regs_region, OBJECT(s), &vgafb_mmio_ops, s,
"milkymist-vgafb", R_MAX * 4);
}
static const TypeInfo milkymist_vgafb_info = {
- .name = "milkymist-vgafb",
+ .name = TYPE_MILKYMIST_VGAFB,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MilkymistVgafbState),
.class_init = milkymist_vgafb_class_init,