Bug 13559 - PCI: Attempt to allocate incorrect iomem range for PCIe device
Summary: PCI: Attempt to allocate incorrect iomem range for PCIe device
Status: RESOLVED DOCUMENTED
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: i386 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: platform_i386
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-17 15:58 UTC by Fabio Correa
Modified: 2009-07-02 21:17 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.30
Subsystem:
Regression: No
Bisected commit-id:


Attachments
System info, dmesg (29.33 KB, application/x-bzip2)
2009-06-17 15:58 UTC, Fabio Correa
Details

Description Fabio Correa 2009-06-17 15:58:23 UTC
Created attachment 21965 [details]
System info, dmesg

Hello people, you are doing an outstanding work with the Linux kernel. Keep it up.

I don't know too much about PCI, but I might help testing solutions to this situation.

I have a Broadcom PCI Express WiFi card. The kernel first reports the following about it:

pci 0000:06:00.0: reg 10 32bit mmio: [0xd0000000-0xd0003fff]

Later, it reports
pci 0000:06:00.0: BAR 0: can't allocate resource

And later
b43-pci-bridge 0000:06:00.0: device not available because of BAR 0 [0x000000-0x003fff] collisions
b43-pci-bridge: probe of 0000:06:00.0 failed with error -22

I notice that the memory range has changed from the first to the last report, losing the initial "d".

The device is not available, so the b43, PHY, and SSB drivers cannot detect and handle it. I have to resort to ndiswrapper-1.54, which manages the wireless card without problem, in spite of the output shown above.

I'd like to use the b43 driver with my WiFi card, so any help would be greatly appreciated.
Comment 1 Fabio Correa 2009-06-17 16:04:41 UTC
Please take a look at the mailing list thread

http://lists.berlios.de/pipermail/bcm43xx-dev/2009-June/008981.html
Comment 2 Fabio Correa 2009-06-17 20:07:08 UTC
I studied file arch/x86/pci/i386.c, and realized lines 175, 176 are the cause for the output reported above. 

The problem now seems to be that the iomem resource has no parent, and I concluded it from modifying the file in order to show more info.

So I think this bug should be marked as invalid.
Comment 3 Jesse Barnes 2009-06-23 22:50:11 UTC
Well, or you could reclassify this bug as an issue with the allocation for the parent bridge, which appears to be 1c.2.  Maybe the BIOS just assigns a bogus resource range (incompatible with the bridge range) and assumes the OS will reassign it?  If so, adding a quirk would probably work (see drivers/pci/quirks.c), though it would be best if we handled this case automatically.
Comment 4 Fabio Correa 2009-06-24 02:05:53 UTC
Thanks for considering my particular issue. I will repost some info I gathered from dmesg, and published in the mailing list thread shown above.

OK, I found new data on my problem, this might shed light on some
fix/enhancement for the driver.

When the system starts, the iomem of the 4311 card is specified to be
pci 0000:06:00.0: reg 10 32bit mmio: [0xd0000000-0xd0003fff]

The iomem of 4311 cannot be allocated:
arch/x86/pci/i386.c:173: pci 0000:06:00.0: BAR 0: can't allocate resource

the next two instructions of file i386.c mean that the iomem range converts
from 0xd0000000-0xd0003fff to 0x000000-0x003fff. Then b43-pci-bridge tries
to allocate this iomem resource, which is invalid:
drivers/pci/setup-res.c:290: b43-pci-bridge 0000:06:00.0: device not
available because of BAR 0 [0x000000-0x003fff] collisions
drivers/base/dd.c:143: b43-pci-bridge: probe of 0000:06:00.0 failed with
error -22

The 4311 card (06:00.0) is in the PCI Express port 00:1c.2, with resources
that are reported later:
pci 0000:00:1c.2: PCI bridge, secondary bus 0000:06
pci 0000:00:1c.2:   MEM window: 0x88000000-0x880fffff

After booting, lspci -vvv shows:

00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port
3 (rev 01) (prog-if 00 [Normal decode])
        Memory behind bridge: 88000000-880fffff
06:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev
01)
        Region 0: Memory at 88000000 (32-bit, non-prefetchable)
[size=16K]

16K = 3fff.

Well then; the b43 controller stops probing my 4311 card because the wrong
resource is probed for.
Comment 5 Fabio Correa 2009-07-02 13:20:18 UTC
Hello All,

I recompiled the Linux kernel with ssb, phy and b43 as modules. I made
sure those modules were loaded after login, and now the b43 driver
properly detects the card, loading the firmware. It seems the phy driver is not needed.

Now I have the problem that the card does not scan, and it does not
associate to any AP. I hope the guys at the wireless, bcm43xx-dev lists will help me.

OK, I don't know whether the implementation of the PCI quirk is still a need.
Comment 6 Jesse Barnes 2009-07-02 16:47:07 UTC
Ah ok, so this bug can probably be closed.  You'll have to ping the b43 folks about the scanning part...
Comment 7 Fabio Correa 2009-07-02 21:17:59 UTC
Thank you very much. Marking as closed.

Let the comments serve as documentation for anyone who gets into the same trouble.

Note You need to log in before you can comment on or make changes to this bug.