Lines Matching full:pbus

34 int platform_bus_get_irqn(PlatformBusDevice *pbus, SysBusDevice *sbdev,  in platform_bus_get_irqn()  argument
40 for (i = 0; i < pbus->num_irqs; i++) { in platform_bus_get_irqn()
41 if (pbus->irqs[i] == sbirq) { in platform_bus_get_irqn()
54 hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, SysBusDevice *sbdev, in platform_bus_get_mmio_addr() argument
57 MemoryRegion *pbus_mr = &pbus->mmio; in platform_bus_get_mmio_addr()
79 PlatformBusDevice *pbus = opaque; in platform_bus_count_irqs() local
89 for (i = 0; i < pbus->num_irqs; i++) { in platform_bus_count_irqs()
90 if (pbus->irqs[i] == sbirq) { in platform_bus_count_irqs()
91 bitmap_set(pbus->used_irqs, i, 1); in platform_bus_count_irqs()
102 static void plaform_bus_refresh_irqs(PlatformBusDevice *pbus) in plaform_bus_refresh_irqs() argument
104 bitmap_zero(pbus->used_irqs, pbus->num_irqs); in plaform_bus_refresh_irqs()
105 foreach_dynamic_sysbus_device(platform_bus_count_irqs, pbus); in plaform_bus_refresh_irqs()
108 static void platform_bus_map_irq(PlatformBusDevice *pbus, SysBusDevice *sbdev, in platform_bus_map_irq() argument
111 int max_irqs = pbus->num_irqs; in platform_bus_map_irq()
119 irqn = find_first_zero_bit(pbus->used_irqs, max_irqs); in platform_bus_map_irq()
125 set_bit(irqn, pbus->used_irqs); in platform_bus_map_irq()
126 sysbus_connect_irq(sbdev, n, pbus->irqs[irqn]); in platform_bus_map_irq()
129 static void platform_bus_map_mmio(PlatformBusDevice *pbus, SysBusDevice *sbdev, in platform_bus_map_mmio() argument
147 for (off = 0; off < pbus->mmio_size; off += alignment) { in platform_bus_map_mmio()
148 MemoryRegion *mr = memory_region_find(&pbus->mmio, off, size).mr; in platform_bus_map_mmio()
164 memory_region_add_subregion(&pbus->mmio, off, sbdev_mr); in platform_bus_map_mmio()
171 void platform_bus_link_device(PlatformBusDevice *pbus, SysBusDevice *sbdev) in platform_bus_link_device() argument
176 platform_bus_map_irq(pbus, sbdev, i); in platform_bus_link_device()
180 platform_bus_map_mmio(pbus, sbdev, i); in platform_bus_link_device()
186 PlatformBusDevice *pbus; in platform_bus_realize() local
191 pbus = PLATFORM_BUS_DEVICE(dev); in platform_bus_realize()
193 memory_region_init(&pbus->mmio, OBJECT(dev), "platform bus", in platform_bus_realize()
194 pbus->mmio_size); in platform_bus_realize()
195 sysbus_init_mmio(d, &pbus->mmio); in platform_bus_realize()
197 pbus->used_irqs = bitmap_new(pbus->num_irqs); in platform_bus_realize()
198 pbus->irqs = g_new0(qemu_irq, pbus->num_irqs); in platform_bus_realize()
199 for (i = 0; i < pbus->num_irqs; i++) { in platform_bus_realize()
200 sysbus_init_irq(d, &pbus->irqs[i]); in platform_bus_realize()
204 plaform_bus_refresh_irqs(pbus); in platform_bus_realize()