Revision 8d43d7e5 hw/gt64xxx.c
b/hw/gt64xxx.c | ||
---|---|---|
229 | 229 |
target_phys_addr_t regname ##_length; \ |
230 | 230 |
MemoryRegion regname ##_mem |
231 | 231 |
|
232 |
#define TYPE_GT64120_PCI_HOST_BRIDGE "gt64120" |
|
233 |
|
|
234 |
#define GT64120_PCI_HOST_BRIDGE(obj) \ |
|
235 |
OBJECT_CHECK(GT64120State, (obj), TYPE_GT64120_PCI_HOST_BRIDGE) |
|
236 |
|
|
232 | 237 |
typedef struct GT64120State { |
233 |
SysBusDevice busdev; |
|
234 | 238 |
PCIHostState pci; |
239 |
|
|
235 | 240 |
uint32_t regs[GT_REGS]; |
236 | 241 |
PCI_MAPPING_ENTRY(PCI0IO); |
237 | 242 |
PCI_MAPPING_ENTRY(ISD); |
... | ... | |
1083 | 1088 |
|
1084 | 1089 |
PCIBus *gt64120_register(qemu_irq *pic) |
1085 | 1090 |
{ |
1086 |
SysBusDevice *s; |
|
1087 | 1091 |
GT64120State *d; |
1092 |
PCIHostState *phb; |
|
1088 | 1093 |
DeviceState *dev; |
1089 | 1094 |
|
1090 |
dev = qdev_create(NULL, "gt64120");
|
|
1095 |
dev = qdev_create(NULL, TYPE_GT64120_PCI_HOST_BRIDGE);
|
|
1091 | 1096 |
qdev_init_nofail(dev); |
1092 |
s = sysbus_from_qdev(dev);
|
|
1093 |
d = FROM_SYSBUS(GT64120State, s);
|
|
1094 |
d->pci.bus = pci_register_bus(&d->busdev.qdev, "pci",
|
|
1095 |
gt64120_pci_set_irq, gt64120_pci_map_irq,
|
|
1096 |
pic,
|
|
1097 |
get_system_memory(),
|
|
1098 |
get_system_io(),
|
|
1099 |
PCI_DEVFN(18, 0), 4);
|
|
1097 |
d = GT64120_PCI_HOST_BRIDGE(dev);
|
|
1098 |
phb = &d->pci;
|
|
1099 |
phb->bus = pci_register_bus(dev, "pci",
|
|
1100 |
gt64120_pci_set_irq, gt64120_pci_map_irq, |
|
1101 |
pic, |
|
1102 |
get_system_memory(), |
|
1103 |
get_system_io(), |
|
1104 |
PCI_DEVFN(18, 0), 4); |
|
1100 | 1105 |
memory_region_init_io(&d->ISD_mem, &isd_mem_ops, d, "isd-mem", 0x1000); |
1101 | 1106 |
|
1102 |
pci_create_simple(d->pci.bus, PCI_DEVFN(0, 0), "gt64120_pci");
|
|
1103 |
return d->pci.bus;
|
|
1107 |
pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "gt64120_pci");
|
|
1108 |
return phb->bus;
|
|
1104 | 1109 |
} |
1105 | 1110 |
|
1106 | 1111 |
static int gt64120_init(SysBusDevice *dev) |
1107 | 1112 |
{ |
1108 | 1113 |
GT64120State *s; |
1109 | 1114 |
|
1110 |
s = FROM_SYSBUS(GT64120State, dev);
|
|
1115 |
s = GT64120_PCI_HOST_BRIDGE(dev);
|
|
1111 | 1116 |
|
1112 | 1117 |
/* FIXME: This value is computed from registers during reset, but some |
1113 | 1118 |
devices (e.g. VGA card) need to know it when they are registered. |
... | ... | |
1162 | 1167 |
} |
1163 | 1168 |
|
1164 | 1169 |
static const TypeInfo gt64120_info = { |
1165 |
.name = "gt64120",
|
|
1170 |
.name = TYPE_GT64120_PCI_HOST_BRIDGE,
|
|
1166 | 1171 |
.parent = TYPE_SYS_BUS_DEVICE, |
1167 | 1172 |
.instance_size = sizeof(GT64120State), |
1168 | 1173 |
.class_init = gt64120_class_init, |
Also available in: Unified diff