Handle PCI_RES_BUS on the generic and ThunderX PCIe drivers. This has been

tested on the Pass 1.1 and 2.0 ThunderX machines in the Netperf cluster.

Reviewed by:	jhb
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6453
This commit is contained in:
andrew 2016-05-20 08:29:00 +00:00
parent e97aca5af0
commit 353b498d9d
2 changed files with 34 additions and 0 deletions

View File

@ -313,6 +313,10 @@ thunder_pem_adjust_resource(device_t dev, device_t child, int type,
struct rman *rm;
sc = device_get_softc(dev);
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
if (type == PCI_RES_BUS)
return (pci_domain_adjust_bus(sc->id, child, res, start, end));
#endif
rm = thunder_pem_rman(sc, type);
if (rm == NULL)
@ -619,6 +623,11 @@ thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid,
struct resource *res;
device_t parent_dev;
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
if (type == PCI_RES_BUS)
return (pci_domain_alloc_bus(sc->id, child, rid, start, end,
count, flags));
#endif
rm = thunder_pem_rman(sc, type);
if (rm == NULL) {
/* Find parent device. On ThunderX we know an exact path. */
@ -675,7 +684,12 @@ thunder_pem_release_resource(device_t dev, device_t child, int type, int rid,
struct resource *res)
{
device_t parent_dev;
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
struct thunder_pem_softc *sc = device_get_softc(dev);
if (type == PCI_RES_BUS)
return (pci_domain_release_bus(sc->id, child, rid, res));
#endif
/* Find parent device. On ThunderX we know an exact path. */
parent_dev = device_get_parent(device_get_parent(dev));

View File

@ -501,7 +501,14 @@ static int
generic_pcie_release_resource(device_t dev, device_t child, int type,
int rid, struct resource *res)
{
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
struct generic_pcie_softc *sc;
if (type == PCI_RES_BUS) {
sc = device_get_softc(dev);
return (pci_domain_release_bus(sc->ecam, child, rid, res));
}
#endif
/* For PCIe devices that do not have FDT nodes, use PCIB method */
if ((int)ofw_bus_get_node(child) <= 0) {
return (generic_pcie_release_resource_pcie(dev,
@ -517,7 +524,15 @@ struct resource *
pci_host_generic_alloc_resource(device_t dev, device_t child, int type, int *rid,
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
struct generic_pcie_softc *sc;
if (type == PCI_RES_BUS) {
sc = device_get_softc(dev);
return (pci_domain_alloc_bus(sc->ecam, child, rid, start, end,
count, flags));
}
#endif
/* For PCIe devices that do not have FDT nodes, use PCIB method */
if ((int)ofw_bus_get_node(child) <= 0)
return (generic_pcie_alloc_resource_pcie(dev, child, type, rid,
@ -579,6 +594,11 @@ generic_pcie_adjust_resource(device_t dev, device_t child, int type,
struct rman *rm;
sc = device_get_softc(dev);
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
if (type == PCI_RES_BUS)
return (pci_domain_adjust_bus(sc->ecam, child, res, start,
end));
#endif
rm = generic_pcie_rman(sc, type);
if (rm != NULL)