LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 09-01-2010, 10:13 AM   #1
ramukaka
LQ Newbie
 
Registered: Oct 2009
Posts: 20

Rep: Reputation: 0
PCI: device not available (can't reserve [mem 0x00000000-0x0003ffff])


Hi,

I am facing a strange problem with a PCI express device. I have written a simple PCI driver(pci_skel sample driver for LDD book) just to detect a PCI device and read its vender and device id from its configuration space. When I connect the device on a standard i386 based PC, it works fine, as expected. But when I run the same driver on the MPC837xERDB board(powerpc arch based processor from freescale), it gives me error. Below is the O/P on both the architectures. Could anyone suggest what can be the cause of this problem? I am new to linux device driver development.

i386 output.
Quote:
[ 921.097050] PCI driver: Init function
[ 921.097415] PCI driver: Probe function
[ 921.097442] pci_skel 0000:04:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
[ 921.097453] PCI driver Vendor ID = 1204
[ 921.097462] PCI driver Device ID = e250
[ 921.097471] PCI driver Revision = 0
Powerpc output
Quote:
PCI driver: Init function
PCI driver: Probe function
pci_skel 0001:02:00.0: device not available (can't reserve [mem 0x00000000-0x0003ffff])
Unable to Enable PCI device:-22
pci_skel: probe of 0001:02:00.0 failed with error -22
Thanks in advance
Ravi Gupta

Last edited by ramukaka; 09-03-2010 at 07:06 AM.
 
Old 09-02-2010, 11:05 AM   #2
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
You are new to linux device driver development but you are already making a PCI driver, one step ahead and you'll be making a usb host/device driver.
Did you build on same linux kernel source for both arch? What is the result of lspci for both arch?

Regards,
archieval
 
Old 09-03-2010, 01:44 AM   #3
ramukaka
LQ Newbie
 
Registered: Oct 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by archieval View Post
You are new to linux device driver development but you are already making a PCI driver, one step ahead and you'll be making a usb host/device driver.
i.e. what you call corporate world ... you do things which you have never done before even if you know nothing about them.

Quote:
Originally Posted by archieval View Post
Did you build on same linux kernel source for both arch? What is the result of lspci for both arch?
No, the i386 machine I am using, is running on linux kernel version 2.6.31 and the one on the powerpc board is linux kernel version 2.6.35. Below is the O/P of lspci command on both the arch. My device is the one named "Non-VGA unclassified device: Lattice Semiconductor Corporation Device e250".

On i386 (linux 2.6.31(open suse))
Quote:
scooby:~ # lspci
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 10)
00:01.0 PCI bridge: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port (rev 10)
00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 01)
00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
04:00.0 Non-VGA unclassified device: Lattice Semiconductor Corporation Device e250
05:06.0 Serial controller: Device 4348:3253 (rev 10)
On PowerPC(linux 2.6.35)
Quote:
# lspci
0000:00:00.0 Power PC: Freescale Semiconductor Inc Unknown device 00c6 (rev 21)
0001:01:00.0 PCI bridge: Freescale Semiconductor Inc Unknown device 00c6 (rev 21)
0001:02:00.0 Non-VGA unclassified device: Lattice Semiconductor Corporation Unknown device e250
One more thing, if I see the contents of /proc/iomem file, I can see the resource range allocated to my device. If resource range is already allocated then why it is saying "device not available (can't reserve [mem 0x00000000-0x0003ffff])" Can you explain the reason for this?

Quote:
cat /proc/iomem -------------------> i386
.
.
.
fe900000-fe9fffff : PCI Bus 0000:04
fe900000-fe93ffff : 0000:04:00.0
fe940000-fe97ffff : 0000:04:00.0
fea00000-feafffff : PCI Bus 0000:03
fea00000-fea1ffff : 0000:03:00.0
fea20000-fea20fff : 0000:03:00.0
fea20000-fea20fff : r8169
.
.
.
Quote:
# cat /proc/iomem ---------> PowerPC
80000000-8fffffff : /pci@e0008500
90000000-9fffffff : /pci@e0008500
a8000000-b7ffffff : /pcie@e0009000
a8000000-a80fffff : PCI Bus 0001:02
c8000000-d7ffffff : /pcie@e000a000
e0004500-e0004507 : serial
e0004600-e0004607 : serial
e0023000-e0023fff : usb
Regards,
Ravi

Last edited by ramukaka; 09-03-2010 at 06:32 AM.
 
Old 09-03-2010, 03:46 AM   #4
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
From an old post old post
Quote:
Originally Posted by cladisch View Post
This is printed when same resource that the BIOS says should be reserved has already been reserved by Linux (which already knows that this address should not be used) or by some other BIOS mechanism (there are multiple PnP interfaces).

You snipped the actual address, but this is usually harmless.
here is another relevant post: relevant post

Can you try compiling on same kernel version?
 
Old 09-03-2010, 06:25 AM   #5
ramukaka
LQ Newbie
 
Registered: Oct 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by archieval View Post
Can you try compiling on same kernel version?
yes I tried .... I upgraded the kernel on i386 machine to linux 2.6.35 and it still works giving the same O/P as in case of linux 2.6.31

Quote:
Originally Posted by archieval View Post
This is printed when same resource that the BIOS says should be reserved has already been reserved by Linux (which already knows that this address should not be used) or by some other BIOS mechanism (there are multiple PnP interfaces).

You snipped the actual address, but this is usually harmless.
Can you please elaborate a little bit keeping in mind that it works for i386 arch in my case?

Regards,
Ravi
 
Old 09-06-2010, 01:52 AM   #6
ramukaka
LQ Newbie
 
Registered: Oct 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Hi Archieval,

I think I got the problem but don't know how to solve it. If everything goes write, then the /proc/iomem contents shouls looks like:

Quote:
80000000-8fffffff : /pci@e0008500
90000000-9fffffff : /pci@e0008500
a8000000-b7ffffff : /pcie@e0009000
a8000000-a803ffff : PCI Bus 0001:02
a8040000-a807ffff : PCI Bus 0001:02
e0004500-e0004507 : serial
e0004600-e0004607 : serial
e0023000-e0023fff : usb
But since the address range "a8000000-a807ffff" is already taken by something else. Actual /proc/iomem contents are:

Quote:
80000000-8fffffff : /pci@e0008500
90000000-9fffffff : /pci@e0008500
a8000000-b7ffffff : /pcie@e0009000
8000000-a80fffff : PCI Bus 0001:02 ---> culprit
e0004500-e0004507 : serial
e0004600-e0004607 : serial
e0023000-e0023fff : usb
Now it looks to me a kernel bug. Do you know where this resource allocation is done, in the kernel code, in case of powerpc arch.

Regards,
Ravi

Last edited by ramukaka; 09-06-2010 at 01:53 AM.
 
Old 09-06-2010, 03:08 AM   #7
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
I think it has something to do with the mapping of physical address to kernel virtual address. You can check the probe function of your pci driver and verify the virtual address usually returned by ioremap. Probably the virtual address space is not enough to map additional pci device?

Last edited by archieval; 09-06-2010 at 03:09 AM.
 
  


Reply

Tags
kernel



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PCI : failed to allocate mem resource... Alexvader Slackware 9 12-03-2009 05:34 PM
PCI: Failed to allocate mem resource wjdoss Linux - Server 5 09-13-2009 12:10 PM
PCI: Failed to allocate mem resource #6 johnsfine Linux - Hardware 0 02-10-2008 08:51 AM
Unable to reserve mem region Ephracis Linux - Software 2 03-26-2005 01:21 PM
Some mem problems with pci region Ephracis Linux - Software 0 03-24-2005 07:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration