Messages in this thread Patch in this message | | | From | Yinghai Lu <> | Subject | [PATCH 09/14] PCI: Add pci_bus_extend/shrink_top() | Date | Mon, 30 Jan 2012 23:42:47 -0800 |
| |
extend or shrink bus and parent buses top (subordinate)
extended range is verified safe range, and stop at recorded parent_res.
Signed-off-by: Yinghai Lu <yinghai@kernel.org> --- drivers/pci/probe.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 79de0dd..91fdaec 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -624,6 +624,52 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) } } +static void __devinit pci_bus_extend_top(struct pci_bus *parent, + resource_size_t size, struct resource *parent_res) +{ + struct resource *res; + + if (!size) + return; + + while (parent) { + res = &parent->busn_res; + if (res == parent_res) + break; + res->end += size; + parent->subordinate += size; + pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, + parent->subordinate); + dev_printk(KERN_DEBUG, &parent->dev, + "busn_res: extended %02llx to %pR\n", + (unsigned long long)size, res); + parent = parent->parent; + } +} + +static void __devinit pci_bus_shrink_top(struct pci_bus *parent, + resource_size_t size, struct resource *parent_res) +{ + struct resource *res; + + if (!size) + return; + + while (parent) { + res = &parent->busn_res; + if (res == parent_res) + break; + res->end -= size; + parent->subordinate -= size; + pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, + parent->subordinate); + dev_printk(KERN_DEBUG, &parent->dev, + "busn_res: shrunk %02llx to %pR\n", + (unsigned long long)size, res); + parent = parent->parent; + } +} + /* * If it's a bridge, configure it and scan the bus behind it. * For CardBus bridges, we don't scan behind as the devices will -- 1.7.7
| |