diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-18 18:31:39 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-01-07 18:24:33 -0500 |
commit | 36e097a8a29761e0e2c951c0390f1057df248a87 (patch) | |
tree | 871b8d7d1a029f3cf0e1deaa648c813738b9bbea /drivers/pci/bus.c | |
parent | 167b1f049008b367a9003a6a8df090af4282a6b0 (diff) |
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 688d191821de ("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>
Diffstat (limited to 'drivers/pci/bus.c')
-rw-r--r-- | drivers/pci/bus.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index fc1b74013743..6f2f47a7b6c6 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -147,11 +147,18 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
147 | !(res->flags & IORESOURCE_PREFETCH)) | 147 | !(res->flags & IORESOURCE_PREFETCH)) |
148 | continue; | 148 | continue; |
149 | 149 | ||
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 | |||
150 | /* Ok, try it out.. */ | 159 | /* Ok, try it out.. */ |
151 | ret = allocate_resource(r, res, size, | 160 | ret = allocate_resource(r, res, size, min, max, |
152 | r->start ? : min, | 161 | align, alignf, alignf_data); |
153 | max, align, | ||
154 | alignf, alignf_data); | ||
155 | if (ret == 0) | 162 | if (ret == 0) |
156 | break; | 163 | break; |
157 | } | 164 | } |