qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zihan Yang <whois.zihan.yang@gmail.com>
To: qemu-devel@nongnu.org
Cc: Zihan Yang <whois.zihan.yang@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: [Qemu-devel] [RFC v3 5/6] pci_expander_bridge: Add ioport for pxb host bus
Date: Thu,  2 Aug 2018 10:45:23 +0800	[thread overview]
Message-ID: <1533177924-24765-6-git-send-email-whois.zihan.yang@gmail.com> (raw)
In-Reply-To: <1533177924-24765-1-git-send-email-whois.zihan.yang@gmail.com>

This enables seabios to read config file in pxb host bus other than sysbus

Signed-off-by: Zihan Yang <whois.zihan.yang@gmail.com>
---
 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 cdfdb90..38212db 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -226,6 +226,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);
+}
+
 static Property pxb_pcie_host_props[] = {
     DEFINE_PROP_UINT64(PCIE_HOST_MCFG_BASE, PXBPCIEHost, parent_obj.base_addr,
                         PCIE_BASE_ADDR_UNMAPPED),
@@ -254,6 +268,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
-- 
2.7.4

  parent reply	other threads:[~2018-08-02  2:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  2:45 [Qemu-devel] [RFC v3 0/6] pci_expander_brdige: Put pxb-pcie host bridge into separate pci domain Zihan Yang
2018-08-02  2:45 ` [Qemu-devel] [RFC v3 1/6] pci_expander_bridge: add type TYPE_PXB_PCIE_HOST Zihan Yang
2018-08-06 11:46   ` Marcel Apfelbaum
2018-08-07  5:18     ` Zihan Yang
2018-08-02  2:45 ` [Qemu-devel] [RFC v3 2/6] acpi-build: allocate mcfg for pxb-pcie host bridges Zihan Yang
2018-08-02  2:45 ` [Qemu-devel] [RFC v3 3/6] i386/acpi-build: describe new pci domain in AML Zihan Yang
2018-08-02  2:45 ` [Qemu-devel] [RFC v3 4/6] pci_expander_bridge: Add config_read callback Zihan Yang
2018-08-02  2:45 ` Zihan Yang [this message]
2018-08-02  2:45 ` [Qemu-devel] [RFC v3 6/6] pci_expander_bridge: add start_bus property Zihan Yang
2018-08-02  4:58 ` [Qemu-devel] [RFC v3 0/6] pci_expander_brdige: Put pxb-pcie host bridge into separate pci domain no-reply
2018-08-02  5:01 ` no-reply
2018-08-02  5:23 ` no-reply
  -- strict thread matches above, loose matches on Subject: below --
2018-08-02  2:42 Zihan Yang
2018-08-02  2:42 ` [Qemu-devel] [RFC v3 5/6] pci_expander_bridge: Add ioport for pxb host bus Zihan Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533177924-24765-6-git-send-email-whois.zihan.yang@gmail.com \
    --to=whois.zihan.yang@gmail.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).