From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rajesh Shah Date: Wed, 12 Oct 2005 22:16:42 +0000 Subject: Re: PCIe hotplug on far PCIe switch ports Message-Id: <20051012151639.A29756@unix-os.sc.intel.com> List-Id: References: In-Reply-To: ; from thomas.schaefer@kontron.com on Wed, Oct 12, 2005 at 07:07:19PM +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: =?iso-8859-1?Q?Thomas_Sch=E4fer?= Cc: linux-hotplug-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org On Wed, Oct 12, 2005 at 07:07:19PM +0200, Thomas Sch=E4fer wrote: >=20 > When pressing the attention button, the driver of the network adapter is = unloaded and the adapter is properly removed from the PCI tree. But when pr= essing the attention button again, reinsertion of the network adapter in th= e PCI tree works, but loading the driver fails: >=20 > PCI: Device 0000:06:00.0 not available because of resource collisions > tg3: Cannot enable PCI device, aborting. > tg3: probe of 0000:06:00.0 failed with error -22 >=20 I think the kernel is flagging a bogus resource collision error for the disabled rom on the hot-added device. lspci output after boot shows that the device has a disabled ROM. >=20 > [root@amceval ~]# lspci -vx -s 6:0.0 > 06:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5721 Gi= gabit Ethernet PCI Express (rev 11) > Subsystem: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethe= rnet PCI Express > Flags: bus master, fast devsel, latency 0, IRQ 16 > Memory at fe9f0000 (64-bit, non-prefetchable) [sizedK] > Expansion ROM at fe9e0000 [disabled] [sizedK] > Capabilities: [48] Power Management version 2 > Capabilities: [50] Vital Product Data > Capabilities: [58] Message Signalled Interrupts: 64bit+ Queue= =3D0/3 Enable- > Capabilities: [d0] Express Endpoint IRQ 0 > 00: e4 14 59 16 06 00 10 00 11 00 00 02 10 00 00 00 > 10: 04 00 9f fe 00 00 00 00 00 00 00 00 00 00 00 00 > 20: 00 00 00 00 00 00 00 00 07 00 00 00 e4 14 59 16 > 30: 00 00 9e fe 48 00 00 00 00 00 00 00 0a 01 00 00 >=20 >=20 When attempting the hot-add, the pciehp driver clobbers the rom base address to 0. When pciehp later calls pci_scan_slot() -> pci_read_bases(), the device's resource structure records a 0 rom base address but a non-zero size. This in turn causes the kernel to believe this was done to flag a resource conflict. Does this patch fix the problem? Signed-off-by: rajesh.shah@intel.com arch/i386/pci/i386.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: linux-2.6.14-rc4/arch/i386/pci/i386.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D--- linux-2.6.14-rc4.orig/arch/i386/pci/i386.c +++ linux-2.6.14-rc4/arch/i386/pci/i386.c @@ -221,6 +221,9 @@ int pcibios_enable_resources(struct pci_ continue; =20 r =3D &dev->resource[idx]; + if ((idx =3D PCI_ROM_RESOURCE) && + (!(r->flags & IORESOURCE_ROM_ENABLE))) + continue; if (!r->start && r->end) { printk(KERN_ERR "PCI: Device %s not available because of resource colli= sions\n", pci_name(dev)); return -EINVAL; @@ -230,8 +233,6 @@ int pcibios_enable_resources(struct pci_ if (r->flags & IORESOURCE_MEM) cmd |=3D PCI_COMMAND_MEMORY; } - if (dev->resource[PCI_ROM_RESOURCE].start) - cmd |=3D PCI_COMMAND_MEMORY; if (cmd !=3D old_cmd) { printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cm= d, cmd); pci_write_config_word(dev, PCI_COMMAND, cmd); ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel