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 11-16-2006, 11:49 AM   #1
cracauer
Member
 
Registered: Jul 2004
Location: Boston, MA, USA
Distribution: FreeBSD, Debian/AMD64, Ubuntu/i386
Posts: 59

Rep: Reputation: 15
Need help with PCI MMIO, do I need to map this first?


I am writing my first code to access device memory and I am a little confused about terminology.

The registers I want to read/write are in PCI device 0. The register set is at an offset (which I read successfully) and then an MMIO address.

It is not clear to me whether I access a "MMIO address" in a "MMIO range" the same way that I access normal memory and/or whether I have to map that first.

%%

Here's the verbose version:
  • The register set I want in in device 0 and lives at an offset given in a word stored at 0x44 in device 0.
  • So I do
    pci_read_config_dword(dev0, 0x44, &mchbase);
  • That works fine and returns 0xFED14000 for the base of the register set
  • Then the register I want is at "MMIO Range 0xFED14000", address offset 0x114

How do I access that register?

I tried both
- pci_read_config_dword(dev0, mchbase + 0x114, &myval);
and
- readl((void *)(long)(mchbase + 0x114));

That gives me a kernel fault that they can't handle the paging request.

%%

So questions:

- do I have to map that memory first?

- do I access that just as normal memory via readl or do I need to do anything special for the MMIO range value?

Thanks
Martin

Last edited by cracauer; 11-16-2006 at 11:54 AM.
 
Old 11-16-2006, 12:15 PM   #2
cracauer
Member
 
Registered: Jul 2004
Location: Boston, MA, USA
Distribution: FreeBSD, Debian/AMD64, Ubuntu/i386
Posts: 59

Original Poster
Rep: Reputation: 15
Already got it.

I need an ioremap and all is well.

Thanks.
 
  


Reply



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-X Raid card wont fit in motherboards PCI Express x16 slot???? abefroman Linux - Hardware 4 12-01-2006 08:24 AM
Geexbox hangs with limiting direct PCI/PCI transfers flagjunky Linux - Laptop and Netbook 0 10-11-2006 02:21 PM
PCI Memory Map rajtendulkar Linux - Hardware 0 03-20-2006 10:00 PM
SYSERR(root): hash map "generics": missing map file /etc/mail/genericstable.db? singying304 Linux - Networking 4 02-28-2005 06:49 AM
PCI-PCMCIA Bridge, anyone any experince? (Bufallo WLI-PCI-OP) al_mckin Linux - Hardware 1 08-26-2004 12:48 PM

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

All times are GMT -5. The time now is 10:23 PM.

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