pci_expander_bridge: Add ioport for pxb host bus
RFC v4 5/6 pci_expander_bridge: Add ioport for pxb host bus
This enables seabios to read config file in pxb host bus other than sysbus
Signed-off-by Zihan Yang <[email protected]>
--- hw/pci-bridge/pci_expander_bridge.c | 15 +++++++++++++++ include/hw/pci-bridge/pci_expander_bridge.h | 3 +++ 2 files changed, 18 insertions(+)
hw/pci-bridge/pci_expander_bridge.c +15 -0
@@ -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 ); +} +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;
include/hw/pci-bridge/pci_expander_bridge.h +3 -0
@@ -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
Signature · 1 line
2.7.4
Quoted 18 lines · Zihan Yang
This enables seabios to read config file in pxb host bus other than sysbus
Signed-off-by Zihan Yang <[email protected]>--- hw/pci-bridge/pci_expander_bridge.c | 15 +++++++++++++++ include/hw/pci-bridge/pci_expander_bridge.h | 3 +++ 2 files changed, 18 insertions(+)hw/pci-bridge/pci_expander_bridge.c +2
-0@@ -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) +{
hw/pci-bridge/pci_expander_bridge.c static void pxb_pcie_host_initfn(Object *obj) · line 248
Quoted 10 lines
hw/pci-bridge/pci_expander_bridge.c +10
-0+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
Quoted 27 lines
hw/pci-bridge/pci_expander_bridge.c +3
-0+} +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;include/hw/pci-bridge/pci_expander_bridge.h +3
-0@@ -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
Quoted 20 lines · Marcel Apfelbaum <[email protected]> 于2018年8月18日周六 上午1:52写道:
Quoted 16 lines · Zihan Yang
This enables seabios to read config file in pxb host bus other than sysbus
Signed-off-by Zihan Yang <[email protected]>--- hw/pci-bridge/pci_expander_bridge.c | 15 +++++++++++++++ include/hw/pci-bridge/pci_expander_bridge.h | 3 +++ 2 files changed, 18 insertions(+)hw/pci-bridge/pci_expander_bridge.c +0
-0@@ -234,6 +234,20 @@ static void pxb_pcie_host_initfn(Object *obj) qdev_prop_allow_set_link_before_realize, 0, NULL); }
Quoted 16 lines
hw/pci-bridge/pci_expander_bridge.c static void pxb_pcie_host_initfn(Object *obj) · line 248
Quoted 12 lines
hw/pci-bridge/pci_expander_bridge.c +12
-0+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.
Quoted 31 lines
Thanks,
MarcelQuoted 27 lines
hw/pci-bridge/pci_expander_bridge.c +3
-0+} +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;include/hw/pci-bridge/pci_expander_bridge.h +3
-0@@ -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