From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Anil kumar <anils_r@yahoo.com>
Cc: Matthew Wilcox <matthew@wil.cx>,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: bus_to_virt equivalent
Date: Tue, 8 Nov 2005 22:53:46 +0000 [thread overview]
Message-ID: <20051108225346.GF13357@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20051108224700.68513.qmail@web32406.mail.mud.yahoo.com>
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
prev parent reply other threads:[~2005-11-08 22:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-07 23:52 bus_to_virt equivalent Anil kumar
2005-11-08 1:37 ` Matthew Wilcox
2005-11-08 22:47 ` Anil kumar
2005-11-08 22:53 ` Russell King [this message]
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=20051108225346.GF13357@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=anils_r@yahoo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox