lkml.org 
[lkml]   [2004]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Driver access ito PCI card memory space question.
    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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.054 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site