Revision 0aab0d3a hw/pci.c
b/hw/pci.c | ||
---|---|---|
874 | 874 |
return s->bus; |
875 | 875 |
} |
876 | 876 |
|
877 |
typedef struct { |
|
878 |
DeviceInfo qdev; |
|
879 |
pci_qdev_initfn init; |
|
880 |
} PCIDeviceInfo; |
|
881 |
|
|
882 | 877 |
static void pci_qdev_init(DeviceState *qdev, DeviceInfo *base) |
883 | 878 |
{ |
884 | 879 |
PCIDevice *pci_dev = (PCIDevice *)qdev; |
... | ... | |
889 | 884 |
bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev)); |
890 | 885 |
devfn = qdev_get_prop_int(qdev, "devfn", -1); |
891 | 886 |
pci_dev = do_pci_register_device(pci_dev, bus, "FIXME", devfn, |
892 |
NULL, NULL);//FIXME:config_read, config_write);
|
|
887 |
info->config_read, info->config_write);
|
|
893 | 888 |
assert(pci_dev); |
894 | 889 |
info->init(pci_dev); |
895 | 890 |
} |
896 | 891 |
|
897 |
void pci_qdev_register(const char *name, int size, pci_qdev_initfn init)
|
|
892 |
void pci_qdev_register(PCIDeviceInfo *info)
|
|
898 | 893 |
{ |
899 |
PCIDeviceInfo *info; |
|
900 |
|
|
901 |
info = qemu_mallocz(sizeof(*info)); |
|
902 |
info->qdev.name = qemu_strdup(name); |
|
903 |
info->qdev.size = size; |
|
904 |
info->init = init; |
|
905 | 894 |
info->qdev.init = pci_qdev_init; |
906 | 895 |
info->qdev.bus_type = BUS_TYPE_PCI; |
907 |
|
|
908 | 896 |
qdev_register(&info->qdev); |
909 | 897 |
} |
910 | 898 |
|
899 |
void pci_qdev_register_many(PCIDeviceInfo *info) |
|
900 |
{ |
|
901 |
while (info->qdev.name) { |
|
902 |
pci_qdev_register(info); |
|
903 |
info++; |
|
904 |
} |
|
905 |
} |
|
906 |
|
|
911 | 907 |
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) |
912 | 908 |
{ |
913 | 909 |
DeviceState *dev; |
Also available in: Unified diff