#include "sysemu/sysemu.h"
#include "hw/sysbus.h"
#include "exec/address-spaces.h"
+#include "qapi/error.h"
#include "qemu/bcd.h"
#include "qemu/module.h"
#include "trace.h"
#include "m48t59-internal.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
#define TYPE_M48TXX_SYS_BUS "sysbus-m48txx"
+typedef struct M48txxSysBusDeviceClass M48txxSysBusDeviceClass;
+typedef struct M48txxSysBusState M48txxSysBusState;
#define M48TXX_SYS_BUS_GET_CLASS(obj) \
OBJECT_GET_CLASS(M48txxSysBusDeviceClass, (obj), TYPE_M48TXX_SYS_BUS)
#define M48TXX_SYS_BUS_CLASS(klass) \
* http://www.st.com/stonline/products/literature/od/7001/m48t59y.pdf
*/
-typedef struct M48txxSysBusState {
+struct M48txxSysBusState {
SysBusDevice parent_obj;
M48t59State state;
MemoryRegion io;
-} M48txxSysBusState;
+};
-typedef struct M48txxSysBusDeviceClass {
+struct M48txxSysBusDeviceClass {
SysBusDeviceClass parent_class;
M48txxInfo info;
-} M48txxSysBusDeviceClass;
+};
static M48txxInfo m48txx_sysbus_info[] = {
{
continue;
}
- dev = qdev_create(NULL, m48txx_sysbus_info[i].bus_name);
+ dev = qdev_new(m48txx_sysbus_info[i].bus_name);
qdev_prop_set_int32(dev, "base-year", base_year);
- qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
+ sysbus_realize_and_unref(s, &error_fatal);
sysbus_connect_irq(s, 0, IRQ);
if (io_base != 0) {
memory_region_add_subregion(get_system_io(), io_base,