1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include "qemu/osdep.h"
25#include "qemu-common.h"
26
27#include "hw/pci/pci.h"
28#include "hw/pci/pci_host.h"
29#include "hw/pci/pcie_host.h"
30#include "hw/qdev-properties.h"
31#include "hw/pci-host/remote.h"
32#include "exec/memory.h"
33
34static const char *remote_pcihost_root_bus_path(PCIHostState *host_bridge,
35 PCIBus *rootbus)
36{
37 return "0000:00";
38}
39
40static void remote_pcihost_realize(DeviceState *dev, Error **errp)
41{
42 PCIHostState *pci = PCI_HOST_BRIDGE(dev);
43 RemotePCIHost *s = REMOTE_PCIHOST(dev);
44
45 pci->bus = pci_root_bus_new(DEVICE(s), "remote-pci",
46 s->mr_pci_mem, s->mr_sys_io,
47 0, TYPE_PCIE_BUS);
48}
49
50static void remote_pcihost_class_init(ObjectClass *klass, void *data)
51{
52 DeviceClass *dc = DEVICE_CLASS(klass);
53 PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);
54
55 hc->root_bus_path = remote_pcihost_root_bus_path;
56 dc->realize = remote_pcihost_realize;
57
58 dc->user_creatable = false;
59 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
60 dc->fw_name = "pci";
61}
62
63static const TypeInfo remote_pcihost_info = {
64 .name = TYPE_REMOTE_PCIHOST,
65 .parent = TYPE_PCIE_HOST_BRIDGE,
66 .instance_size = sizeof(RemotePCIHost),
67 .class_init = remote_pcihost_class_init,
68};
69
70static void remote_pcihost_register(void)
71{
72 type_register_static(&remote_pcihost_info);
73}
74
75type_init(remote_pcihost_register)
76