RE: FW: pci_find_device returned value?

WANG,YIDING (yiding_wang@am.exch.hp.com)
Fri, 25 Jun 1999 13:23:48 -0600


Ben,

Got it and thanks!

-eddie

-----Original Message-----
From: Benjamin LaHaise [mailto:kernel@kvack.org]
Sent: Friday, June 25, 1999 11:30 AM
To: WANG,YIDING (HP-SanJose,ex1)
Cc: 'linux_kernel'
Subject: Re: 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/