[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 13/18] hw/pci-host/bonito: Create PCI regions in bonito_host_real
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 13/18] hw/pci-host/bonito: Create PCI regions in bonito_host_realize() |
Date: |
Thu, 31 Dec 2020 23:49:06 +0100 |
The PCI regions belong to the 'host' device, not the PCI function.
Move the PCI regions creation there.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci-host/bonito.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 1c88ccc6af8..4dcaa2fa8bb 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -654,6 +654,7 @@ static void bonito_host_realize(DeviceState *dev, Error
**errp)
{
PCIHostState *phb = PCI_HOST_BRIDGE(dev);
BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev);
+ MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);
memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem",
BONITO_PCIHI_SIZE);
phb->bus = pci_register_root_bus(dev, "pci",
@@ -662,6 +663,14 @@ static void bonito_host_realize(DeviceState *dev, Error
**errp)
PCI_DEVFN(5, 0), 32, TYPE_PCI_BUS);
create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB);
+
+ memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
+ &bs->pci_mem, 0, BONITO_PCIHI_SIZE);
+ memory_region_add_subregion(get_system_memory(),
+ BONITO_PCIHI_BASE, pcimem_alias);
+ create_unimplemented_device("PCI_2",
+ (hwaddr)BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE,
+ 2 * GiB);
}
static void bonito_pci_realize(PCIDevice *dev, Error **errp)
@@ -669,8 +678,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error **errp)
BonitoPciState *s = PCI_BONITO(dev);
SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost);
PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);
- BonitoState *bs = BONITO_PCI_HOST_BRIDGE(s->pcihost);
- MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);
assert(!target_words_bigendian()); /* FIXME not supported */
@@ -732,14 +739,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error
**errp)
create_unimplemented_device("IOCS[3]", BONITO_DEV_BASE + 3 * 256 * KiB,
256 * KiB);
- memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
- &bs->pci_mem, 0, BONITO_PCIHI_SIZE);
- memory_region_add_subregion(get_system_memory(),
- BONITO_PCIHI_BASE, pcimem_alias);
- create_unimplemented_device("PCI_2",
- (hwaddr)BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE,
- 2 * GiB);
-
/* set the default value of north bridge pci config */
pci_set_word(dev->config + PCI_COMMAND, 0x0000);
pci_set_word(dev->config + PCI_STATUS, 0x0000);
--
2.26.2
- [PATCH 03/18] hw/pci-host/bonito: Use PCI_DEVFN() macro, (continued)
- [PATCH 03/18] hw/pci-host/bonito: Use PCI_DEVFN() macro, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 04/18] hw/pci-host/bonito: Use pci_config_set_interrupt_pin(), Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 05/18] hw/pci-host/bonito: Simplify soft reset using FIELD_EX32(), Philippe Mathieu-Daudé, 2020/12/31
- [RFC PATCH 06/18] hw/pci-host/bonito: Do not allow big-endian targets, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 07/18] hw/pci-host/bonito: Make BONPONCFG register read-only, Philippe Mathieu-Daudé, 2020/12/31
- [RFC PATCH 08/18] hw/pci-host/bonito: Remap PCI "lo" regions when PCIMAP reg is modified, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 09/18] hw/pci-host/bonito: Rename north bridge helpers, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 10/18] hw/pci-host/bonito: Rename PCI host helpers, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 11/18] hw/pci-host/bonito: Rename PCI function helpers, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 12/18] hw/pci-host/bonito: Rename PCIBonitoState -> BonitoPciState, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 13/18] hw/pci-host/bonito: Create PCI regions in bonito_host_realize(),
Philippe Mathieu-Daudé <=
- [RFC PATCH 14/18] hw/pci-host/bonito: Simplify using pci_host_conf_le_ops MemoryRegionOps, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 15/18] hw/pci-host/bonito: Map north bridge region in bonito_host_realize(), Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 16/18] hw/pci-host/bonito: Create TYPE_PCI_BONITO in bonito_host_realize(), Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 17/18] hw/pci-host/bonito: Declare TYPE_BONITO_PCI_HOST_BRIDGE in include/, Philippe Mathieu-Daudé, 2020/12/31
- [RFC PATCH 18/18] hw/mips/fuloong2e: Inline bonito_init(), Philippe Mathieu-Daudé, 2020/12/31