diff --git a/src/arch/x86/vm.c b/src/arch/x86/vm.c index b1a1599..5711684 100644 --- a/src/arch/x86/vm.c +++ b/src/arch/x86/vm.c @@ -117,7 +117,9 @@ int vm_arch_cpu_init(vm_t *v) int vm_arch_init_platform_device(vm_t *v) { - pci_init(&v->pci, &v->io_bus); + pci_init(&v->pci); + bus_register_dev(&v->io_bus, &v->pci.pci_addr_dev); + bus_register_dev(&v->io_bus, &v->pci.pci_bus_dev); if (serial_init(&v->serial, &v->io_bus)) return throw_err("Failed to init UART device"); virtio_blk_init(&v->virtio_blk_dev); diff --git a/src/pci.c b/src/pci.c index 6bc66bb..75a4644 100644 --- a/src/pci.c +++ b/src/pci.c @@ -173,13 +173,11 @@ void pci_dev_register(struct pci_dev *dev) #define PCI_CONFIG_ADDR 0xCF8 #define PCI_CONFIG_DATA 0xCFC -void pci_init(struct pci *pci, struct bus *io_bus) +void pci_init(struct pci *pci) { dev_init(&pci->pci_addr_dev, PCI_CONFIG_ADDR, sizeof(uint32_t), pci, pci_address_io); dev_init(&pci->pci_bus_dev, PCI_CONFIG_DATA, sizeof(uint32_t), pci, pci_data_io); bus_init(&pci->pci_bus); - bus_register_dev(io_bus, &pci->pci_addr_dev); - bus_register_dev(io_bus, &pci->pci_bus_dev); } diff --git a/src/pci.h b/src/pci.h index 0d696f6..33fb77b 100644 --- a/src/pci.h +++ b/src/pci.h @@ -55,4 +55,4 @@ void pci_dev_init(struct pci_dev *dev, struct pci *pci, struct bus *io_bus, struct bus *mmio_bus); -void pci_init(); +void pci_init(struct pci *pci);