linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dan Malek <dan@netx4.com>
To: Steve Calfee <calfee@kerbango.com>
Cc: Bjvrn Lundberg <bjorn.lundberg@inu.se>,
	"linuxppc-embedded@lists.linuxppc.org"
	<linuxppc-embedded@lists.linuxppc.org>
Subject: Re: USB driver for MPC850/823
Date: Thu, 09 Mar 2000 00:28:42 -0500	[thread overview]
Message-ID: <38C7368A.7B28E61E@netx4.com> (raw)
In-Reply-To: 4.2.2.20000308153704.00a601f0@mail.kerbango.com


Steve Calfee wrote:

> .... The CPM wants to access
> physical memory addresses. You use a macro __pa for this, but I dont think
> that works for all cases of user and kernel memory.

It will certainly never work for user memory, you should only copyin/out
user addresses for a variety of reasons.

> Look at virt_to_phys(x); but that only does kmalloc'ed memory.

The virt_to_phys() and __pa() do the same thing.  Both work on kmalloc'ed
memory.  Neither will work with vmalloc'ed memory.

When using the CPM on the 8xx, you have to be careful about the cache
attributes on the pages as the 8xx doesn't have bus snooping to ensure
coherency.  I use a couple of different methods to get memory allocated
in the kernel for the CPM, sometimes they are cached and require software
management, other times not cached.  Depends upon how it is used.

You can use kmalloc() or __get_free_pages() to allocate memory for the
CPM.  Just make sure kmalloc() gives you something that is properly
aligned, as some CPM functions have rather large alignment boundaries.
When allocated in this way, you have to chase down the pte's and modify
the cache attributes yourself if desired.

> Does anyone have a pointer to a document that thoroughly describes memory
> mapping, both for the x86 and the ppc?

It would probably be correct only until the next source update.  While
trying to keep up with the 2.3.xx source tree, I have changed the CPM
memory interfaces at least three times.  I think we are back where we
started, at least this week.



	-- Dan

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

  reply	other threads:[~2000-03-09  5:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-08  9:35 USB driver for MPC850/823 Bjvrn Lundberg
2000-03-08 23:53 ` Steve Calfee
2000-03-09  5:28   ` Dan Malek [this message]
2000-03-09 12:30     ` Björn Lundberg
2000-03-09 15:34     ` Richard Hendricks
2000-03-09 16:30       ` Dan Malek
2000-03-09 17:14         ` Richard Hendricks

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=38C7368A.7B28E61E@netx4.com \
    --to=dan@netx4.com \
    --cc=bjorn.lundberg@inu.se \
    --cc=calfee@kerbango.com \
    --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).