mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/pci-host/raven: Simplify PCI bus creation
Instead of doing it manually use pci_register_root_bus() to create and register the PCI bus. Also drop pci_bus from PREPPCIState and use the existing bus field in the parent PCIHostState. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-ID: <4ffa168d68947d95a16c51d73cedd141b0df0ea0.1761232472.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
committed by
Philippe Mathieu-Daudé
parent
3c334e48cc
commit
0d10cb62cb
+7
-11
@@ -46,7 +46,6 @@ struct PREPPCIState {
|
||||
|
||||
OrIRQState *or_irq;
|
||||
qemu_irq pci_irqs[PCI_NUM_PINS];
|
||||
PCIBus pci_bus;
|
||||
AddressSpace pci_io_as;
|
||||
MemoryRegion pci_io;
|
||||
MemoryRegion pci_io_non_contiguous;
|
||||
@@ -231,8 +230,9 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
|
||||
|
||||
qdev_init_gpio_in(d, raven_change_gpio, 1);
|
||||
|
||||
pci_bus_irqs(&s->pci_bus, raven_set_irq, s, PCI_NUM_PINS);
|
||||
pci_bus_map_irqs(&s->pci_bus, raven_map_irq);
|
||||
h->bus = pci_register_root_bus(d, NULL, raven_set_irq, raven_map_irq,
|
||||
s, &s->pci_memory, &s->pci_io, 0, 4,
|
||||
TYPE_PCI_BUS);
|
||||
|
||||
memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops, s,
|
||||
"pci-conf-idx", 4);
|
||||
@@ -250,12 +250,14 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
|
||||
"pci-intack", 1);
|
||||
memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_intack);
|
||||
|
||||
pci_create_simple(&s->pci_bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE);
|
||||
pci_create_simple(h->bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE);
|
||||
|
||||
address_space_init(&s->bm_as, &s->bm, "raven-bm");
|
||||
pci_setup_iommu(h->bus, &raven_iommu_ops, s);
|
||||
}
|
||||
|
||||
static void raven_pcihost_initfn(Object *obj)
|
||||
{
|
||||
PCIHostState *h = PCI_HOST_BRIDGE(obj);
|
||||
PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(obj);
|
||||
MemoryRegion *address_space_mem = get_system_memory();
|
||||
|
||||
@@ -278,8 +280,6 @@ static void raven_pcihost_initfn(Object *obj)
|
||||
memory_region_add_subregion_overlap(address_space_mem, PCI_IO_BASE_ADDR,
|
||||
&s->pci_io_non_contiguous, 1);
|
||||
memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_memory);
|
||||
pci_root_bus_init(&s->pci_bus, sizeof(s->pci_bus), DEVICE(obj), NULL,
|
||||
&s->pci_memory, &s->pci_io, 0, TYPE_PCI_BUS);
|
||||
|
||||
/* Bus master address space */
|
||||
memory_region_init(&s->bm, obj, "bm-raven", 4 * GiB);
|
||||
@@ -290,10 +290,6 @@ static void raven_pcihost_initfn(Object *obj)
|
||||
get_system_memory(), 0, 0x80000000);
|
||||
memory_region_add_subregion(&s->bm, 0 , &s->bm_pci_memory_alias);
|
||||
memory_region_add_subregion(&s->bm, 0x80000000, &s->bm_ram_alias);
|
||||
address_space_init(&s->bm_as, &s->bm, "raven-bm");
|
||||
pci_setup_iommu(&s->pci_bus, &raven_iommu_ops, s);
|
||||
|
||||
h->bus = &s->pci_bus;
|
||||
}
|
||||
|
||||
static void raven_pcihost_class_init(ObjectClass *klass, const void *data)
|
||||
|
||||
Reference in New Issue
Block a user