i8259_common.c (29bb5317cb7b23422b2612025d56055bbf0bbd02) i8259_common.c (db895a1e6a97e919f9b86d60c969377357b05066)
1/*
2 * QEMU 8259 - common bits of emulated and KVM kernel model
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 * Copyright (c) 2011 Jan Kiszka, Siemens AG
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

61 PICCommonClass *info = PIC_COMMON_GET_CLASS(s);
62
63 if (info->post_load) {
64 info->post_load(s);
65 }
66 return 0;
67}
68
1/*
2 * QEMU 8259 - common bits of emulated and KVM kernel model
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 * Copyright (c) 2011 Jan Kiszka, Siemens AG
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

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

61 PICCommonClass *info = PIC_COMMON_GET_CLASS(s);
62
63 if (info->post_load) {
64 info->post_load(s);
65 }
66 return 0;
67}
68
69static int pic_init_common(ISADevice *dev)
69static void pic_common_realize(DeviceState *dev, Error **errp)
70{
71 PICCommonState *s = PIC_COMMON(dev);
72 PICCommonClass *info = PIC_COMMON_GET_CLASS(s);
73
74 info->init(s);
75
76 isa_register_ioport(NULL, &s->base_io, s->iobase);
77 if (s->elcr_addr != -1) {
78 isa_register_ioport(NULL, &s->elcr_io, s->elcr_addr);
79 }
80
70{
71 PICCommonState *s = PIC_COMMON(dev);
72 PICCommonClass *info = PIC_COMMON_GET_CLASS(s);
73
74 info->init(s);
75
76 isa_register_ioport(NULL, &s->base_io, s->iobase);
77 if (s->elcr_addr != -1) {
78 isa_register_ioport(NULL, &s->elcr_io, s->elcr_addr);
79 }
80
81 qdev_set_legacy_instance_id(DEVICE(dev), s->iobase, 1);
82
83 return 0;
81 qdev_set_legacy_instance_id(dev, s->iobase, 1);
84}
85
86ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master)
87{
88 ISADevice *dev;
89
90 dev = isa_create(bus, name);
91 qdev_prop_set_uint32(&dev->qdev, "iobase", master ? 0x20 : 0xa0);

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

130 DEFINE_PROP_HEX32("elcr_addr", PICCommonState, elcr_addr, -1),
131 DEFINE_PROP_HEX8("elcr_mask", PICCommonState, elcr_mask, -1),
132 DEFINE_PROP_BIT("master", PICCommonState, master, 0, false),
133 DEFINE_PROP_END_OF_LIST(),
134};
135
136static void pic_common_class_init(ObjectClass *klass, void *data)
137{
82}
83
84ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master)
85{
86 ISADevice *dev;
87
88 dev = isa_create(bus, name);
89 qdev_prop_set_uint32(&dev->qdev, "iobase", master ? 0x20 : 0xa0);

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

128 DEFINE_PROP_HEX32("elcr_addr", PICCommonState, elcr_addr, -1),
129 DEFINE_PROP_HEX8("elcr_mask", PICCommonState, elcr_mask, -1),
130 DEFINE_PROP_BIT("master", PICCommonState, master, 0, false),
131 DEFINE_PROP_END_OF_LIST(),
132};
133
134static void pic_common_class_init(ObjectClass *klass, void *data)
135{
138 ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
139 DeviceClass *dc = DEVICE_CLASS(klass);
140
141 dc->vmsd = &vmstate_pic_common;
142 dc->no_user = 1;
143 dc->props = pic_properties_common;
136 DeviceClass *dc = DEVICE_CLASS(klass);
137
138 dc->vmsd = &vmstate_pic_common;
139 dc->no_user = 1;
140 dc->props = pic_properties_common;
144 ic->init = pic_init_common;
141 dc->realize = pic_common_realize;
145}
146
147static const TypeInfo pic_common_type = {
148 .name = TYPE_PIC_COMMON,
149 .parent = TYPE_ISA_DEVICE,
150 .instance_size = sizeof(PICCommonState),
151 .class_size = sizeof(PICCommonClass),
152 .class_init = pic_common_class_init,
153 .abstract = true,
154};
155
156static void pic_common_register_types(void)
157{
158 type_register_static(&pic_common_type);
159}
160
161type_init(pic_common_register_types)
142}
143
144static const TypeInfo pic_common_type = {
145 .name = TYPE_PIC_COMMON,
146 .parent = TYPE_ISA_DEVICE,
147 .instance_size = sizeof(PICCommonState),
148 .class_size = sizeof(PICCommonClass),
149 .class_init = pic_common_class_init,
150 .abstract = true,
151};
152
153static void pic_common_register_types(void)
154{
155 type_register_static(&pic_common_type);
156}
157
158type_init(pic_common_register_types)