linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajesh Shah <rajesh.shah@intel.com>
To: "Thomas Schäfer" <thomas.schaefer@kontron.com>
Cc: linux-hotplug-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: PCIe hotplug on far PCIe switch ports
Date: Wed, 12 Oct 2005 22:16:42 +0000	[thread overview]
Message-ID: <20051012151639.A29756@unix-os.sc.intel.com> (raw)
In-Reply-To: <D9F0B2AD4531B0449D51C1F09199D4840E0DAE@mail.kom-saarbruecken.com>; from thomas.schaefer@kontron.com on Wed, Oct 12, 2005 at 07:07:19PM +0200

On Wed, Oct 12, 2005 at 07:07:19PM +0200, Thomas Schäfer wrote:
> 
> 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 pressing the attention button again, reinsertion of the network adapter in the PCI tree works, but loading the driver fails:
> 
<snip>
>    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
> 
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.
> 
>    [root@amceval ~]# lspci -vx -s 6:0.0
>    06:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 11)
>            Subsystem: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet 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=0/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
> 
> 
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
=================================--- 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;
 
 		r = &dev->resource[idx];
+		if ((idx = 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 collisions\n", pci_name(dev));
 			return -EINVAL;
@@ -230,8 +233,6 @@ int pcibios_enable_resources(struct pci_
 		if (r->flags & IORESOURCE_MEM)
 			cmd |= PCI_COMMAND_MEMORY;
 	}
-	if (dev->resource[PCI_ROM_RESOURCE].start)
-		cmd |= PCI_COMMAND_MEMORY;
 	if (cmd != old_cmd) {
 		printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, 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

  parent reply	other threads:[~2005-10-12 22:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-12 17:07 PCIe hotplug on far PCIe switch ports Thomas Schäfer
2005-10-12 18:28 ` Greg KH
2005-10-12 22:16 ` Rajesh Shah [this message]
2005-10-13  1:12 ` Rajat Jain
2005-10-13  7:54 ` Thomas Schäfer
2005-10-13  9:25 ` Thomas Schäfer
2005-10-13 15:55 ` Gary Hade

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=20051012151639.A29756@unix-os.sc.intel.com \
    --to=rajesh.shah@intel.com \
    --cc=linux-hotplug-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.schaefer@kontron.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;
as well as URLs for NNTP newsgroup(s).