[lkml]   [2004]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectPCI resource allocation problem in 2.6.8
I'm writing a driver for a PCI-based USB controller. The work is almost
done but a few days ago something very ugly happened. I've tried to
pinpoint the problem but everything is so simple and clear to be
wrong... I really hope that someone can help me!

OK, here's the problem:
I'm using kernel 2.6.8 on an i386 arch. I want to allocate region 2 of
my PCI board. Here's the output of lspci:

0000:00:0e.0 Bridge: PLX Technology, Inc.: Unknown device 5406 (rev 0b)
Subsystem: PLX Technology, Inc.: Unknown device 9054
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR-
Latency: 32, Cache Line Size: 0x08 (32 bytes)
Interrupt: pin A routed to IRQ 9
Region 0: Memory at df100000 (32-bit, non-prefetchable)
Region 1: I/O ports at e400 [size=256]
Region 2: I/O ports at e800 [size=256]
Region 3: Memory at df000000 (32-bit, non-prefetchable)
Capabilities: [40] Power Management version 1
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [48] #06 [0000]
Capabilities: [4c] Vital Product Data

As you can see, region 2 begins at e800 and extends up to e8ff.

When I try to claim the region, I get wrong start-end-length numbers.
I've written something simple to demonstrate this fact:

for(pci_region=0; pci_region < PCI_ROM_RESOURCE; pci_region++){
resource_start = pci_resource_start (dev, pci_region);
resource_end = pci_resource_end (dev,pci_region);
printk (KERN_DEBUG "region:%d start:%lx, end:%lx - ", pci_region,
resource_start, resource_end);
len = pci_resource_len (dev, pci_region);
printk(KERN_DEBUG "length:%lx\n", len);

Where "dev" is a pointer to a pci device of course.
So here's what I get by running this code:

Nov 21 16:28:56 naousa kernel: PCI: Found IRQ 9 for device 0000:00:0e.0
Nov 21 16:28:56 naousa kernel: region:0 start:0, end:0 - <7>length:0
Nov 21 16:28:56 naousa kernel: region:1 start:df1000ff, end:200 -
Nov 21 16:28:56 naousa kernel: region:2 start:e4ff, end:101 -
Nov 21 16:28:56 naousa kernel: region:3 start:e8ff, end:101 -
Nov 21 16:28:56 naousa kernel: region:4 start:df0fffff, end:200 -
Nov 21 16:28:56 naousa kernel: region:5^Istart:0, end:0 - <7>length:0

As you can see, what "start" claims to be is in reality the end of each
region, and "end", "length" are nonsense...

Any ideas? Is this something typical???
I would appreciate any help, please CC me personally as I'm not yet
subscribed to the list, or find me at the linux-usb-devel list.

Thanx in advance,
Dimitris Lampridis <>
[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2005-03-22 14:08    [W:0.048 / U:0.024 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site