lkml.org 
[lkml]   [1999]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: FW: pci_find_device returned value?
On Fri, 25 Jun 1999, WANG,YIDING (HP-SanJose,ex1) wrote:

> One question now. When call pci_find_device(), the returned base address
> are:
> base[0]= 0 (Reserved, in our case)
> base[1]= 6501 (Low IO Address)
> base[2]= 6601 (Hi IO Address)
> base[3]= e10600000 (MEM Base)
> base[4]= e10000008 (RAM Base)
> base[5]= e10400000 (SROM Base)
>
> The base address 3, 4, 5 look like virtual address. Is that true?
>
> In my driver, after I get those address, it was converted to virtual address
> with bus_to_virt() function call. If the returned address is virtual, then
> no need to convert.

They're actually physical addresses that you need to call ioremap() on in
order to get a kernel mapping to access them. Ioremap takes the address
and size (see Documentation/IO-mapping.txt for more details). Note that
since they're coming directly from the PCI base, you'll have to mask off
the low four bits as those are flags (prefetchable and io space are the
two I remember off the top of my head). One other item to consider is
that PCI address ranges are allocated based on their size, so if you have
a memory range that's less than PAGE_SIZE, you can't pass it on to ioremap
without fiddling first. =)

-ben


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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