linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dan Malek <dan@embeddededge.com>
To: Frank Haverkamp <f.haverkamp@web.de>
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Behaviour of consistent_{alloc|free}
Date: Wed, 23 Apr 2003 12:00:47 -0400	[thread overview]
Message-ID: <3EA6B8AF.8030005@embeddededge.com> (raw)
In-Reply-To: 200304231355.h3NDttq00868@mailgate5.cinetic.de


Frank Haverkamp wrote:

> I am working with a PowerPC 405 based asic having PCI_DRAM_OFFSET to be defined not to be zero.

Why?


> consistent_alloc returned a virtual address and the address on my pci bus.

I think you don't understand the value of PCI_DRAM_OFFSET.  This value is the
way system memory is mapped from the PCI bus, it does not represent a processor
mapping to the PCI bus.

> ... The address on the bus was
> returned correctly, but the mapping consistent_alloc was working was not like I expected it.

It did exactly what you asked.  It allocated free memory pages, then adjusted the
physical address by PCI_DRAM_OFFSET.  This address is what you should be giving
a device on the PCI bus for mastering buffers in your system memory.


> It maps the virtual address to an address on the bus and not to the real address of my DRAM.

Then, you don't have PCI_DRAM_OFFSET assigned a proper value.


> A mapping to the real address in DRAM is, what I wanted to have. I tried to do a virt_to_phys
> on the virtual address, but got, again, the address on the bus. And a bus_to_phys I could not find ;-)

You can't use any of the virt_to_* or bus_to_* functions on the addresses returned
by consistent_alloc.  This is why consistent_alloc() returns both a virtual address
for you to use for processor access, and a "bus" address handle to be given to the
device that will perform the DMA.  You have to stash these values in your driver
so you can reference them at later times when necessary.

In fact, if this is a PCI device, you should be using the pci_* functions as
described in Documentation/DMA-mapping.txt, and not using the consistent_alloc()
functions directly.

Thanks.


	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

      reply	other threads:[~2003-04-23 16:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-23 13:55 Behaviour of consistent_{alloc|free} Frank Haverkamp
2003-04-23 16:00 ` Dan Malek [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=3EA6B8AF.8030005@embeddededge.com \
    --to=dan@embeddededge.com \
    --cc=f.haverkamp@web.de \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /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;
as well as URLs for NNTP newsgroup(s).