mirror of https://github.com/xemu-project/xemu.git
pci: fold BAR mapping function into its caller
There is only one function, so no need for a function pointer. Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
cfc0be257c
commit
50181f10da
25
hw/pci.c
25
hw/pci.c
|
@ -881,18 +881,6 @@ static int pci_unregister_device(DeviceState *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pci_simple_bar_mapfunc_region(PCIDevice *pci_dev, int region_num,
|
|
||||||
pcibus_t addr, pcibus_t size,
|
|
||||||
int type)
|
|
||||||
{
|
|
||||||
PCIIORegion *r = &pci_dev->io_regions[region_num];
|
|
||||||
|
|
||||||
memory_region_add_subregion_overlap(r->address_space,
|
|
||||||
addr,
|
|
||||||
r->memory,
|
|
||||||
1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pci_register_bar_region(PCIDevice *pci_dev, int region_num,
|
void pci_register_bar_region(PCIDevice *pci_dev, int region_num,
|
||||||
uint8_t type, MemoryRegion *memory)
|
uint8_t type, MemoryRegion *memory)
|
||||||
{
|
{
|
||||||
|
@ -914,7 +902,6 @@ void pci_register_bar_region(PCIDevice *pci_dev, int region_num,
|
||||||
r->size = size;
|
r->size = size;
|
||||||
r->filtered_size = size;
|
r->filtered_size = size;
|
||||||
r->type = type;
|
r->type = type;
|
||||||
r->map_func = pci_simple_bar_mapfunc_region;
|
|
||||||
r->memory = NULL;
|
r->memory = NULL;
|
||||||
|
|
||||||
wmask = ~(size - 1);
|
wmask = ~(size - 1);
|
||||||
|
@ -1102,10 +1089,16 @@ static void pci_update_mappings(PCIDevice *d)
|
||||||
* addr & (size - 1) != 0.
|
* addr & (size - 1) != 0.
|
||||||
*/
|
*/
|
||||||
if (r->type & PCI_BASE_ADDRESS_SPACE_IO) {
|
if (r->type & PCI_BASE_ADDRESS_SPACE_IO) {
|
||||||
r->map_func(d, i, r->addr, r->filtered_size, r->type);
|
memory_region_add_subregion_overlap(r->address_space,
|
||||||
|
r->addr,
|
||||||
|
r->memory,
|
||||||
|
1);
|
||||||
} else {
|
} else {
|
||||||
r->map_func(d, i, pci_to_cpu_addr(d->bus, r->addr),
|
memory_region_add_subregion_overlap(r->address_space,
|
||||||
r->filtered_size, r->type);
|
pci_to_cpu_addr(d->bus,
|
||||||
|
r->addr),
|
||||||
|
r->memory,
|
||||||
|
1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
hw/pci.h
1
hw/pci.h
|
@ -92,7 +92,6 @@ typedef struct PCIIORegion {
|
||||||
pcibus_t size;
|
pcibus_t size;
|
||||||
pcibus_t filtered_size;
|
pcibus_t filtered_size;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
PCIMapIORegionFunc *map_func;
|
|
||||||
MemoryRegion *memory;
|
MemoryRegion *memory;
|
||||||
MemoryRegion *address_space;
|
MemoryRegion *address_space;
|
||||||
} PCIIORegion;
|
} PCIIORegion;
|
||||||
|
|
Loading…
Reference in New Issue