LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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
 
LinkBack Search this Thread
Old 10-29-2012, 07:20 AM   #1
nedsana
LQ Newbie
 
Registered: Oct 2012
Posts: 6

Rep: Reputation: Disabled
PCI sound device and IO memory


Hi all,

I am trying to implement a simple PCI driver for my sound card. But I think that I face a strange situation here. I will try to explain what I do and will ask my questions meanwhile:

As far as I understood each PCI device has IO PORTS and IO MEMORY assigned to it. IS THIS TRUE?


Because what I see in my case is this:

- I succeed reserving IO PORTS.
Code:
ioport = pci_resource_start(dev, 0);
ioport_len = pci_resource_len(dev, 0);
The info for these ports is ioport = 0xd100 and ioport_len = 0x0100
request_region(ioport, ioport_len, name); ===>>> OK

- I fail to reserve IO MEMORY.
Code:
iomem = pci_resource_start(dev, 1);
iomem_len = pci_resource_len(dev, 1);
The info for the io memory is iomem = 0xd200 and iomem_len = 0x0040
request_region(iomem, iomem_len, name); ===>>> FAIL!


So I don't see my driver in /proc/iomem.

I see my driver twice(???) in /proc/ioports:
d100-d1ff : pci_drv_temp
d200-d23f : pci_drv_temp


So it seems that pci_resource_start(dev, 1) returns only addresses in the io_port area. What could cause this?

Could this be caused by the device itself?
I checked the original device driver with lspci -v and it also does not list any iomemory(only ioports). Which makes me that indeed the device does not have iomemory. Could this be the case?



I am not sure if I have explained myself well enough. Please let me know if this is the case? I can give a better shot.
Thank you.
 
Old 10-30-2012, 02:38 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 1,143

Rep: Reputation: 258Reputation: 258Reputation: 258
References to devices can be made with regular memory cycles (memory space) or they can be done with I/O cycles (I/O space). It is up to how the hardware is designed as to which type of bus cycles it responds to: IO, memory or both. When the device is first initialized it uses a 3rd space, PCI configuration space, to set up the memory and I/O regions that will be used by the driver.

In your case, if only IO space is supported, you must access the device via I/O space.
 
Old 10-30-2012, 02:46 PM   #3
nedsana
LQ Newbie
 
Registered: Oct 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Smallpond thanks for the answer.

Indeed this was my conclusion as well. I came up with it after checking another sound device, which had both IO ports and IO memory.

So yes it depends on the device chip how it can be accessed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DMA xmit from kernel space to pci device memory amirh Linux - Software 1 04-06-2007 04:10 PM
DMA xmit from kernel space to pci device memory amirh Linux - Newbie 0 04-06-2007 04:06 PM
Sound Device Not Working, Possible conflict between onboard/pci? Christopher Linux - Hardware 5 01-07-2005 03:57 PM
device to simulate physical memory with PCI device kevinsung Linux - Software 1 12-14-2002 10:11 AM


All times are GMT -5. The time now is 05:29 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration