1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44#include "qemu/osdep.h"
45#include "hw/pci/pci.h"
46#include "migration/vmstate.h"
47#include "qemu/module.h"
48#include "hw/i386/ich9.h"
49
50
51
52#define I82801ba_SSVID_OFFSET 0x50
53#define I82801ba_SSVID_SVID 0
54#define I82801ba_SSVID_SSID 0
55
56typedef struct I82801b11Bridge {
57
58 PCIBridge parent_obj;
59
60} I82801b11Bridge;
61
62static void i82801b11_bridge_realize(PCIDevice *d, Error **errp)
63{
64 int rc;
65
66 pci_bridge_initfn(d, TYPE_PCI_BUS);
67
68 rc = pci_bridge_ssvid_init(d, I82801ba_SSVID_OFFSET,
69 I82801ba_SSVID_SVID, I82801ba_SSVID_SSID,
70 errp);
71 if (rc < 0) {
72 goto err_bridge;
73 }
74 pci_config_set_prog_interface(d->config, PCI_CLASS_BRIDGE_PCI_INF_SUB);
75 return;
76
77err_bridge:
78 pci_bridge_exitfn(d);
79}
80
81static const VMStateDescription i82801b11_bridge_dev_vmstate = {
82 .name = "i82801b11_bridge",
83 .priority = MIG_PRI_PCI_BUS,
84 .fields = (VMStateField[]) {
85 VMSTATE_PCI_DEVICE(parent_obj, PCIBridge),
86 VMSTATE_END_OF_LIST()
87 }
88};
89
90static void i82801b11_bridge_class_init(ObjectClass *klass, void *data)
91{
92 PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
93 DeviceClass *dc = DEVICE_CLASS(klass);
94
95 k->is_bridge = true;
96 k->vendor_id = PCI_VENDOR_ID_INTEL;
97 k->device_id = PCI_DEVICE_ID_INTEL_82801BA_11;
98 k->revision = ICH9_D2P_A2_REVISION;
99 k->realize = i82801b11_bridge_realize;
100 k->config_write = pci_bridge_write_config;
101 dc->vmsd = &i82801b11_bridge_dev_vmstate;
102 dc->reset = pci_bridge_reset;
103 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
104}
105
106static const TypeInfo i82801b11_bridge_info = {
107 .name = "i82801b11-bridge",
108 .parent = TYPE_PCI_BRIDGE,
109 .instance_size = sizeof(I82801b11Bridge),
110 .class_init = i82801b11_bridge_class_init,
111 .interfaces = (InterfaceInfo[]) {
112 { INTERFACE_CONVENTIONAL_PCI_DEVICE },
113 { },
114 },
115};
116
117static void d2pbr_register(void)
118{
119 type_register_static(&i82801b11_bridge_info);
120}
121
122type_init(d2pbr_register);
123