static void pci_update_mappings(PCIDevice *d)

{

    PCIIORegion *r;

    int i;

    pcibus_t new_addr;



    for(i = 0; i < PCI_NUM_REGIONS; i++) {

        r = &d->io_regions[i];



        /* this region isn't registered */

        if (!r->size)

            continue;



        new_addr = pci_bar_address(d, i, r->type, r->size);



        /* This bar isn't changed */

        if (new_addr == r->addr)

            continue;



        /* now do the real mapping */

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_del(d, pci_bus_num(d->bus),

                                          PCI_SLOT(d->devfn),

                                          PCI_FUNC(d->devfn),

                                          i, r->addr, r->size);

            memory_region_del_subregion(r->address_space, r->memory);

        }

        r->addr = new_addr;

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_add(d, pci_bus_num(d->bus),

                                          PCI_SLOT(d->devfn),

                                          PCI_FUNC(d->devfn),

                                          i, r->addr, r->size);

            memory_region_add_subregion_overlap(r->address_space,

                                                r->addr, r->memory, 1);

        }

    }



    pci_update_vga(d);

}

static void pci_update_mappings(PCIDevice *d)

{

    PCIIORegion *r;

    int i;

    pcibus_t new_addr;



    for(i = 0; i < PCI_NUM_REGIONS; i++) {

        r = &d->io_regions[i];



        

        if (!r->size)

            continue;



        new_addr = pci_bar_address(d, i, r->type, r->size);



        

        if (new_addr == r->addr)

            continue;



        

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_del(d, pci_bus_num(d->bus),

                                          PCI_SLOT(d->devfn),

                                          PCI_FUNC(d->devfn),

                                          i, r->addr, r->size);

            memory_region_del_subregion(r->address_space, r->memory);

        }

        r->addr = new_addr;

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_add(d, pci_bus_num(d->bus),

                                          PCI_SLOT(d->devfn),

                                          PCI_FUNC(d->devfn),

                                          i, r->addr, r->size);

            memory_region_add_subregion_overlap(r->address_space,

                                                r->addr, r->memory, 1);

        }

    }



    pci_update_vga(d);

}

static void FUNC_0(PCIDevice *VAR_0)

{

    PCIIORegion *r;

    int VAR_1;

    pcibus_t new_addr;



    for(VAR_1 = 0; VAR_1 < PCI_NUM_REGIONS; VAR_1++) {

        r = &VAR_0->io_regions[VAR_1];



        

        if (!r->size)

            continue;



        new_addr = pci_bar_address(VAR_0, VAR_1, r->type, r->size);



        

        if (new_addr == r->addr)

            continue;



        

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_del(VAR_0, pci_bus_num(VAR_0->bus),

                                          PCI_SLOT(VAR_0->devfn),

                                          PCI_FUNC(VAR_0->devfn),

                                          VAR_1, r->addr, r->size);

            memory_region_del_subregion(r->address_space, r->memory);

        }

        r->addr = new_addr;

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_add(VAR_0, pci_bus_num(VAR_0->bus),

                                          PCI_SLOT(VAR_0->devfn),

                                          PCI_FUNC(VAR_0->devfn),

                                          VAR_1, r->addr, r->size);

            memory_region_add_subregion_overlap(r->address_space,

                                                r->addr, r->memory, 1);

        }

    }



    pci_update_vga(VAR_0);

}

static void FUNC_0(PCIDevice *VAR_0)
{ PCIIORegion *r; int VAR_1; pcibus_t new_addr; for(VAR_1 = 0; VAR_1 < PCI_NUM_REGIONS; VAR_1++) { r = &VAR_0->io_regions[VAR_1]; if (!r->size)
continue; new_addr = pci_bar_address(VAR_0, VAR_1, r->type, r->size); if (new_addr == r->addr)
continue; if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_del(VAR_0, pci_bus_num(VAR_0->bus),
PCI_SLOT(VAR_0->devfn),
PCI_FUNC(VAR_0->devfn),
VAR_1, r->addr, r->size); memory_region_del_subregion(r->address_space, r->memory); } r->addr = new_addr; if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_add(VAR_0, pci_bus_num(VAR_0->bus),
PCI_SLOT(VAR_0->devfn),
PCI_FUNC(VAR_0->devfn),
VAR_1, r->addr, r->size); memory_region_add_subregion_overlap(r->address_space,
r->addr, r->memory, 1); } } pci_update_vga(VAR_0); }