block/nvme: Make nvme_identify() return boolean indicating error
[qemu/ar7.git] / hw / display / ramfb-standalone.c
blob8c0094397f5b384df94cafa87cc854d4353e19f4
1 #include "qemu/osdep.h"
2 #include "qapi/error.h"
3 #include "qemu/module.h"
4 #include "hw/loader.h"
5 #include "hw/qdev-properties.h"
6 #include "hw/display/ramfb.h"
7 #include "ui/console.h"
8 #include "qom/object.h"
10 typedef struct RAMFBStandaloneState RAMFBStandaloneState;
11 DECLARE_INSTANCE_CHECKER(RAMFBStandaloneState, RAMFB,
12 TYPE_RAMFB_DEVICE)
14 struct RAMFBStandaloneState {
15 SysBusDevice parent_obj;
16 QemuConsole *con;
17 RAMFBState *state;
20 static void display_update_wrapper(void *dev)
22 RAMFBStandaloneState *ramfb = RAMFB(dev);
24 if (0 /* native driver active */) {
25 /* non-standalone device would run native display update here */;
26 } else {
27 ramfb_display_update(ramfb->con, ramfb->state);
31 static const GraphicHwOps wrapper_ops = {
32 .gfx_update = display_update_wrapper,
35 static void ramfb_realizefn(DeviceState *dev, Error **errp)
37 RAMFBStandaloneState *ramfb = RAMFB(dev);
39 ramfb->con = graphic_console_init(dev, 0, &wrapper_ops, dev);
40 ramfb->state = ramfb_setup(errp);
43 static void ramfb_class_initfn(ObjectClass *klass, void *data)
45 DeviceClass *dc = DEVICE_CLASS(klass);
47 set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
48 dc->realize = ramfb_realizefn;
49 dc->desc = "ram framebuffer standalone device";
50 dc->user_creatable = true;
53 static const TypeInfo ramfb_info = {
54 .name = TYPE_RAMFB_DEVICE,
55 .parent = TYPE_SYS_BUS_DEVICE,
56 .instance_size = sizeof(RAMFBStandaloneState),
57 .class_init = ramfb_class_initfn,
60 static void ramfb_register_types(void)
62 type_register_static(&ramfb_info);
65 type_init(ramfb_register_types)