From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz
Cc: rajesh.shah@intel.com
Subject: [PATCH] acpi bridge hotadd: Prevent duplicate bus numbers when scanning PCI bridge
Date: Mon, 27 Jun 2005 22:32:52 -0700 [thread overview]
Message-ID: <11199367724120@kroah.com> (raw)
In-Reply-To: <1119936772835@kroah.com>
[PATCH] acpi bridge hotadd: Prevent duplicate bus numbers when scanning PCI bridge
When hot-plugging a root bridge, as we try to assign bus numbers we may find
that the hotplugged hieratchy has more PCI to PCI bridges (i.e. bus
requirements) than available. Make sure we don't step over an existing bus
when that happens.
Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
commit cc57450f5c044270d2cf1dd437c1850422262109
tree 418c7546c443cfc80601da045731f6b5a9f23442
parent 71c3511c22e8e0648094672abec898b3bf84c18b
author Rajesh Shah <rajesh.shah@intel.com> Thu, 28 Apr 2005 00:25:47 -0700
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 27 Jun 2005 21:52:40 -0700
drivers/pci/probe.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -411,7 +411,7 @@ int __devinit pci_scan_bridge(struct pci
{
struct pci_bus *child;
int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS);
- u32 buses;
+ u32 buses, i;
u16 bctl;
pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses);
@@ -470,6 +470,10 @@ int __devinit pci_scan_bridge(struct pci
/* Clear errors */
pci_write_config_word(dev, PCI_STATUS, 0xffff);
+ /* Prevent assigning a bus number that already exists.
+ * This can happen when a bridge is hot-plugged */
+ if (pci_find_bus(pci_domain_nr(bus), max+1))
+ return max;
child = pci_alloc_child_bus(bus, dev, ++max);
buses = (buses & 0xff000000)
| ((unsigned int)(child->primary) << 0)
@@ -501,7 +505,11 @@ int __devinit pci_scan_bridge(struct pci
* as cards with a PCI-to-PCI bridge can be
* inserted later.
*/
- max += CARDBUS_RESERVE_BUSNR;
+ for (i=0; i<CARDBUS_RESERVE_BUSNR; i++)
+ if (pci_find_bus(pci_domain_nr(bus),
+ max+i+1))
+ break;
+ max += i;
}
/*
* Set the subordinate bus number to its real value.
next prev parent reply other threads:[~2005-06-28 6:15 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-28 5:30 [GIT PATCH] PCI patches for 2.6.12 Greg KH
2005-06-28 5:32 ` [PATCH] PCI Allow OutOfRange PIRQ table address Greg KH
2005-06-28 5:32 ` [PATCH] pci: remove deprecates Greg KH
2005-06-28 5:32 ` Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Make pcibios_fixup_bus() hot-plug safe Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: ACPI based root bridge hot-add Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Fix pci_enable_device() for p2p bridges Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Link newly created pci child bus to its parent on creation Greg KH
2005-06-28 5:32 ` Greg KH [this message]
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Take the PCI lock when modifying pci bus or device lists Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Make the PCI remove routines safe for failed hot-plug Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Remove hot-plugged devices that could not be allocated resources Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Read bridge resources when fixing up the bus Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: clean up notify handlers on acpiphp unload Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Allow ACPI .add and .start operations to be done independently Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: convert acpiphp to use generic resource code Greg KH
2005-06-28 5:32 ` [PATCH] acpi bridge hotadd: Export the interface to get PCI id for an ACPI handle Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: fix slot power-down problem with acpiphp Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: decouple slot power state changes from physical hotplug Greg KH
2005-06-28 5:32 ` [PATCH] acpi hotplug: aCPI based root bridge hot-add Greg KH
2005-06-28 5:32 ` [PATCH] ACPI based I/O APIC hot-plug: ia64 support Greg KH
2005-06-28 5:32 ` [PATCH] ACPI based I/O APIC hot-plug: add interfaces Greg KH
2005-06-28 5:32 ` [PATCH] PCI: fix-pci-mmap-on-ppc-and-ppc64.patch Greg KH
2005-06-28 5:32 ` [PATCH] ACPI based I/O APIC hot-plug: acpiphp support Greg KH
2005-06-28 5:32 ` [PATCH] PCI: DMA bursting advice Greg KH
2005-06-28 5:32 ` [PATCH] cpqphp: fix oops during unload without probe Greg KH
2005-06-28 5:32 ` [PATCH] PCI: clean up the MSI code a bit Greg KH
2005-06-28 5:32 ` [PATCH] PCI: fix up errors after dma bursting patch and CONFIG_PCI=n Greg KH
2005-06-28 5:32 ` [PATCH] PCI: add proper MCFG table parsing to ACPI core Greg KH
2005-06-28 5:32 ` [PATCH] PCI: make drivers use the pci shutdown callback instead of the driver core callback Greg KH
2005-06-28 5:32 ` [PATCH] PCI: use the MCFG table to properly access pci devices (i386) Greg KH
2005-06-28 5:32 ` [PATCH] PCI: use the MCFG table to properly access pci devices (x86-64) Greg KH
2005-06-29 16:33 ` [PATCH] acpi bridge hotadd: ACPI based root bridge hot-add Grant Grundler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11199367724120@kroah.com \
--to=gregkh@suse.de \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=rajesh.shah@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox