mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dimitris Lampridis <labis@mhl.tuc.gr>
To: linux-kernel@vger.kernel.org
Subject: PCI resource allocation problem in 2.6.8
Date: Sun, 21 Nov 2004 14:57:27 +0000	[thread overview]
Message-ID: <1101049047.3201.18.camel@naousa.mhl.tuc.gr> (raw)

[-- Attachment #1: Type: text/plain, Size: 2977 bytes --]

Hi,
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)
[size=256]
        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)
[size=1M]
        Capabilities: [40] Power Management version 1
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot-,D3cold-)
                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 -
<7>length:20f00102
Nov 21 16:28:56 naousa kernel: region:2	start:e4ff, end:101 -
<7>length:ffff1c03
Nov 21 16:28:56 naousa kernel: region:3	start:e8ff, end:101 -
<7>length:ffff1803
Nov 21 16:28:56 naousa kernel: region:4	start:df0fffff, end:200 -
<7>length:20f00202
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 <labis@mhl.tuc.gr>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2004-11-21 15:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-21 14:57 Dimitris Lampridis [this message]
2004-11-23  8:22 ` Greg KH

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=1101049047.3201.18.camel@naousa.mhl.tuc.gr \
    --to=labis@mhl.tuc.gr \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®