Re: bus_to_virt equivalent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 08, 2005 at 02:47:00PM -0800, Anil kumar wrote:
> Hi Matthew,
> 
> Thanks for the reply.
> I can store the returned dma_addr from
> pci_map_sg/single or pci_map_page in a driver
> structure.
> 
> struct page *page =
> virt_to_page(Cmnd->request_buffer);
>                 unsigned long offset = ((unsigned
> long)Cmnd->request_buffer &
>                                         ~PAGE_MASK);
>                 dma_addr_t busaddr =
> pci_map_page(hostdata->pci_dev,
>                                                  
> page, offset,
>                                                  
> Cmnd->request_bufflen,
>                                                  
> scsi_to_pci_dma_dir(Cmnd->sc_data_direction));
> 
> But how do I convert this returned "busaddr" into a
> virtual addr?

You don't - that's architecture implementation detail which drivers
have _zero_ business knowing about.

As far as you're concerned, the virtual address is Cmnd->request_buffer.

Anyway, you're using the wrong interface - pci_map_single() takes
a virtual address.  No need to play around getting the offset and
struct page for pci_map_page() when pci_map_single() implements
what you require.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux