From: Roland Dreier <roland@topspin.com>
To: kilian@bobodyne.com (Alan Kilian)
Cc: linux-kernel@vger.kernel.org
Subject: Re: Driver access ito PCI card memory space question.
Date: Wed, 06 Oct 2004 15:43:13 -0700 [thread overview]
Message-ID: <52llejpiwu.fsf@topspin.com> (raw)
In-Reply-To: <200410062020.i96KKPN13520@raceme.attbi.com> (Alan Kilian's message of "Wed, 6 Oct 2004 15:20:25 -0500 (CDT)")
Alan> Then I do request_mem_area(0xfeaff000,4095, "SSE");
Alan> Then I do a readl(0xfeaff100); and get this:
Alan> Unable to handle kernel paging request at virtual address feaff100
You can't blindly access an address from your device's BARs; on many
architectures PCI access needs setting up and/or addresses need
munging before use. The API you need is ioremap().
You need to do something like:
void __iomem *mybase = ioremap(pci_resource_start(my_pdev, 0), 4095);
u32 value = readl(mybase + 0x100);
(Delete the __iomem annotation for kernels before 2.6.9).
The "Linux Device Drivers" online book, available at
<http://www.xml.com/ldd/chapter/book/> will probably be pretty
helpful. In fact if you're serious about writing drivers, you should
buy a dead-tree copy.
- Roland
next prev parent reply other threads:[~2004-10-06 22:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-06 20:20 Driver access ito PCI card memory space question Alan Kilian
2004-10-06 22:43 ` Roland Dreier [this message]
2004-10-08 16:59 ` Erik Mouw
2004-10-06 22:51 ` Richard B. Johnson
-- strict thread matches above, loose matches on Subject: below --
2004-10-14 20:47 Alan Kilian
2004-10-14 21:22 ` Jesper Juhl
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=52llejpiwu.fsf@topspin.com \
--to=roland@topspin.com \
--cc=kilian@bobodyne.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.