diff options
author | Alexander Graf <agraf@suse.de> | 2015-01-06 17:03:08 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-01-26 20:25:52 +0200 |
commit | 27fb9688f9162515901ebf29e3879788fd326ea7 (patch) | |
tree | fd594b554a76cc56605b7d426e19f1fbfb2bcc05 /hw | |
parent | 7828d75045380ac659f2ad85fb5fec9bbb0746ac (diff) |
pci: Split pcie_host_mmcfg_map()
The mmcfg space is a memory region that allows access to PCI config space
in the PCIe world. To maintain abstraction layers, I would like to expose
the mmcfg space as a sysbus mmio region rather than have it mapped straight
into the system's memory address space though.
So this patch splits the initialization of the mmcfg space from the actual
mapping, allowing us to only have an mmfg memory region without the map.
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pci/pcie_host.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c index 3db038fc7f..dfb4a2b505 100644 --- a/hw/pci/pcie_host.c +++ b/hw/pci/pcie_host.c @@ -98,8 +98,7 @@ void pcie_host_mmcfg_unmap(PCIExpressHost *e) } } -void pcie_host_mmcfg_map(PCIExpressHost *e, hwaddr addr, - uint32_t size) +void pcie_host_mmcfg_init(PCIExpressHost *e, uint32_t size) { assert(!(size & (size - 1))); /* power of 2 */ assert(size >= PCIE_MMCFG_SIZE_MIN); @@ -107,6 +106,12 @@ void pcie_host_mmcfg_map(PCIExpressHost *e, hwaddr addr, e->size = size; memory_region_init_io(&e->mmio, OBJECT(e), &pcie_mmcfg_ops, e, "pcie-mmcfg", e->size); +} + +void pcie_host_mmcfg_map(PCIExpressHost *e, hwaddr addr, + uint32_t size) +{ + pcie_host_mmcfg_init(e, size); e->base_addr = addr; memory_region_add_subregion(get_system_memory(), e->base_addr, &e->mmio); } |