qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v4 5/6] pci_expander_bridge: Add ioport for pxb ho


From: Marcel Apfelbaum
Subject: Re: [Qemu-devel] [RFC v4 5/6] pci_expander_bridge: Add ioport for pxb host bus
Date: Fri, 17 Aug 2018 20:51:59 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1



On 08/09/2018 09:35 AM, Zihan Yang wrote:
This enables seabios to read config file in pxb host bus other than sysbus

Signed-off-by: Zihan Yang <address@hidden>
---
  hw/pci-bridge/pci_expander_bridge.c         | 15 +++++++++++++++
  include/hw/pci-bridge/pci_expander_bridge.h |  3 +++
  2 files changed, 18 insertions(+)

diff --git a/hw/pci-bridge/pci_expander_bridge.c 
b/hw/pci-bridge/pci_expander_bridge.c
index c685c75..686b026 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -234,6 +234,20 @@ static void pxb_pcie_host_initfn(Object *obj)
                           qdev_prop_allow_set_link_before_realize, 0, NULL);
  }
+static void pxb_pcie_host_realize(DeviceState *dev, Error **errp)
+{
+    PCIHostState *pci = PCI_HOST_BRIDGE(dev);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+
+    // FIX ME! Use specific port number for pxb-pcie host bridge, not scalable!
+    /* port layout is | pxb1_cmd | pxb1_data | pxb2_cmd | pxb2_data | ... | */
+    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE, &pci->conf_mem);
+    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE + 
g_list_length(pxb_dev_list) * 8, 4);
+
+    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE, &pci->data_mem);
+    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE + 
g_list_length(pxb_dev_list) * 8, 4);

Why do we need this functionality? Can't we access the pxb-pcie config space only with
MMCFG?

Thanks,
Marcel

+}
+
  static Property pxb_pcie_host_props[] = {
      DEFINE_PROP_UINT64(PCIE_HOST_MCFG_BASE, PXBPCIEHost, parent_obj.base_addr,
                          PCIE_BASE_ADDR_UNMAPPED),
@@ -262,6 +276,7 @@ static void pxb_pcie_host_class_init(ObjectClass *class, 
void *data)
dc->fw_name = "pcie";
      dc->props = pxb_pcie_host_props;
+    dc->realize = pxb_pcie_host_realize;
      /* Reason: Internal part of the pxb/pxb-pcie device, not usable by itself 
*/
      dc->user_creatable = false;
      sbc->explicit_ofw_unit_address = pxb_host_ofw_unit_address;
diff --git a/include/hw/pci-bridge/pci_expander_bridge.h 
b/include/hw/pci-bridge/pci_expander_bridge.h
index 1119210..e6d3b67 100644
--- a/include/hw/pci-bridge/pci_expander_bridge.h
+++ b/include/hw/pci-bridge/pci_expander_bridge.h
@@ -7,6 +7,9 @@
  #define PROP_PXB_PCIE_DOMAIN_NR "domain_nr"
  #define PROP_PXB_BUS_NR "bus_nr"
+#define PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE 0x1000
+#define PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE 0x1004
+
  uint64_t pxb_pcie_mcfg_hole(void);
#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]