]> git.proxmox.com Git - qemu.git/blame - hw/cpu/icc_bus.c
Revert "e1000/rtl8139: update HMP NIC when every bit is written"
[qemu.git] / hw / cpu / icc_bus.c
CommitLineData
f0513d2c
IM
1/* icc_bus.c
2 * emulate x86 ICC (Interrupt Controller Communications) bus
3 *
4 * Copyright (c) 2013 Red Hat, Inc
5 *
6 * Authors:
7 * Igor Mammedov <imammedo@redhat.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, see <http://www.gnu.org/licenses/>
21 */
22#include "hw/cpu/icc_bus.h"
23#include "hw/sysbus.h"
24
25/* icc-bridge implementation */
26
27static void icc_bus_init(Object *obj)
28{
29 BusState *b = BUS(obj);
30
31 b->allow_hotplug = true;
32}
33
34static const TypeInfo icc_bus_info = {
35 .name = TYPE_ICC_BUS,
36 .parent = TYPE_BUS,
37 .instance_size = sizeof(ICCBus),
38 .instance_init = icc_bus_init,
39};
40
41
42/* icc-device implementation */
43
44static void icc_device_realize(DeviceState *dev, Error **errp)
45{
46 ICCDevice *id = ICC_DEVICE(dev);
47 ICCDeviceClass *idc = ICC_DEVICE_GET_CLASS(id);
48
49 if (idc->init) {
50 if (idc->init(id) < 0) {
51 error_setg(errp, "%s initialization failed.",
52 object_get_typename(OBJECT(dev)));
53 }
54 }
55}
56
57static void icc_device_class_init(ObjectClass *oc, void *data)
58{
59 DeviceClass *dc = DEVICE_CLASS(oc);
60
61 dc->realize = icc_device_realize;
62 dc->bus_type = TYPE_ICC_BUS;
63}
64
65static const TypeInfo icc_device_info = {
66 .name = TYPE_ICC_DEVICE,
67 .parent = TYPE_DEVICE,
68 .abstract = true,
69 .instance_size = sizeof(ICCDevice),
70 .class_size = sizeof(ICCDeviceClass),
71 .class_init = icc_device_class_init,
72};
73
74
75/* icc-bridge implementation */
76
77typedef struct ICCBridgeState {
78 /*< private >*/
79 SysBusDevice parent_obj;
80 /*< public >*/
81
82 ICCBus icc_bus;
53a89e26 83 MemoryRegion apic_container;
f0513d2c
IM
84} ICCBridgeState;
85
86#define ICC_BRIGDE(obj) OBJECT_CHECK(ICCBridgeState, (obj), TYPE_ICC_BRIDGE)
87
88static void icc_bridge_init(Object *obj)
89{
90 ICCBridgeState *s = ICC_BRIGDE(obj);
53a89e26 91 SysBusDevice *sb = SYS_BUS_DEVICE(obj);
f0513d2c 92
fb17dfe0
AF
93 qbus_create_inplace(&s->icc_bus, sizeof(s->icc_bus), TYPE_ICC_BUS,
94 DEVICE(s), "icc");
53a89e26
IM
95
96 /* Do not change order of registering regions,
97 * APIC must be first registered region, board maps it by 0 index
98 */
300b1fc6 99 memory_region_init(&s->apic_container, obj, "icc-apic-container",
53a89e26
IM
100 APIC_SPACE_SIZE);
101 sysbus_init_mmio(sb, &s->apic_container);
102 s->icc_bus.apic_address_space = &s->apic_container;
f0513d2c
IM
103}
104
125ee0ed
MA
105static void icc_bridge_class_init(ObjectClass *oc, void *data)
106{
107 DeviceClass *dc = DEVICE_CLASS(oc);
108
109 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
110}
111
f0513d2c
IM
112static const TypeInfo icc_bridge_info = {
113 .name = TYPE_ICC_BRIDGE,
114 .parent = TYPE_SYS_BUS_DEVICE,
115 .instance_init = icc_bridge_init,
116 .instance_size = sizeof(ICCBridgeState),
125ee0ed 117 .class_init = icc_bridge_class_init,
f0513d2c
IM
118};
119
120
121static void icc_bus_register_types(void)
122{
123 type_register_static(&icc_bus_info);
124 type_register_static(&icc_device_info);
125 type_register_static(&icc_bridge_info);
126}
127
128type_init(icc_bus_register_types)