diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -2364,7 +2364,20 @@ start, end)); #ifdef PCI_RES_BUS - if (type != PCI_RES_BUS) + if (type == PCI_RES_BUS) { + /* + * If our bus range isn't big enough to grow the sub-allocation + * then we need to grow our bus range. Any request that would + * require us to decrease the start of our own bus range is + * invalid, we can only extend the end; ignore such requests + * and let rman_adjust_resource fail below. + */ + if (start >= sc->bus.sec && end > sc->bus.sub) { + error = pcib_grow_subbus(&sc->bus, end); + if (error != 0) + return (error); + } + } else #endif { /*