Skip to content

Commit 36e097a

Browse files
committed
PCI: Split out bridge window override of minimum allocation address
pci_bus_alloc_resource() avoids allocating space below the "min" supplied by the caller (usually PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM). This is to protect badly documented motherboard resources. But if we're allocating space inside an already-configured PCI-PCI bridge window, we ignore "min". See 688d191 ("pci: make bus resource start address override minimum IO address"). This patch moves the check to make it more visible and simplify future patches. No functional change. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 167b1f0 commit 36e097a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/pci/bus.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,18 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
147147
!(res->flags & IORESOURCE_PREFETCH))
148148
continue;
149149

150+
/*
151+
* "min" is typically PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM to
152+
* protect badly documented motherboard resources, but if
153+
* this is an already-configured bridge window, its start
154+
* overrides "min".
155+
*/
156+
if (r->start)
157+
min = r->start;
158+
150159
/* Ok, try it out.. */
151-
ret = allocate_resource(r, res, size,
152-
r->start ? : min,
153-
max, align,
154-
alignf, alignf_data);
160+
ret = allocate_resource(r, res, size, min, max,
161+
align, alignf, alignf_data);
155162
if (ret == 0)
156163
break;
157164
}

0 commit comments

Comments
 (0)