From 956387e5e9c66a3b45ca4827f27ee3b7a612e0fc Mon Sep 17 00:00:00 2001 From: jchandra Date: Mon, 19 Nov 2018 02:43:34 +0000 Subject: [PATCH] pci_host_generic: allocate resources against devices Fix up pci_host_generic.c and pci_host_generic_fdt.c to allocate resources against devices that requested them. Currently the allocation happens against the pcib, which is incorrect. This is needed for the upcoming changes for fixing up pci_host_generic_acpi.c Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D17656 --- sys/dev/pci/pci_host_generic.c | 2 +- sys/dev/pci/pci_host_generic_fdt.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 49fffa02c187..c840abda9eb1 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -310,7 +310,7 @@ pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type, rm = generic_pcie_rman(sc, type); if (rm == NULL) - return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, start, end, count, flags)); if (bootverbose) { diff --git a/sys/dev/pci/pci_host_generic_fdt.c b/sys/dev/pci/pci_host_generic_fdt.c index 9babccd8f369..abd3ddd848d6 100644 --- a/sys/dev/pci/pci_host_generic_fdt.c +++ b/sys/dev/pci/pci_host_generic_fdt.c @@ -423,6 +423,7 @@ generic_pcie_fdt_activate_resource(device_t dev, device_t child, int type, } break; case SYS_RES_MEMORY: + case SYS_RES_IRQ: res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child, type, rid, r); break; @@ -445,6 +446,7 @@ generic_pcie_fdt_deactivate_resource(device_t dev, device_t child, int type, switch(type) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: + case SYS_RES_IRQ: res = BUS_DEACTIVATE_RESOURCE(device_get_parent(dev), child, type, rid, r); break;