Marcel Apfelbaum <marcel.apfelb...@gmail.com> 于2018年8月18日周六 上午1:52写道: > > > > 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 <whois.zihan.y...@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 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?
This is for the same reason as mentioned in previous patch. > 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 >