Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2000 23:36:35 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        "Bill Clinton" <biffey@hotmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: dma to userland address 
Message-ID:  <200008160636.XAA18026@mass.osd.bsdi.com>
In-Reply-To: Your message of "Mon, 14 Aug 2000 18:16:09 GMT." <F89TuHZncJfKHmj9n1x00001510@hotmail.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> lets say, hypothetically, that i have an ioctl interface to my device
> driver that takes a buffer that looks something like:
> 
> struct {
>   int length;
>   char *buf;
> } mystruct;
> 
> and lets say, hypothetically, that i wanted to dma directly
> to/from 'buf'.  how would i do that?
> 
> i've tried doing vtophys on buf, but that doesn't seem to work.
> 
> i've tried doing vtophys on a kernel-allocated block and the mmapping it
> through /dev/mem in userland, but that doesn't seem to work either (this
> may have a bug, though - it worked under linux, but was about 10x slower
> than just leaving the kernel/user copy in there).
> 
> so what am i missing here?

As has been mentioned, you need to look at how the physio mechanism 
(physread/physwrite) does it.  Basically, you temporarily map the region 
into the kernel and then wire it down.

However, typically once you reach this point with an ioctl interface it's 
time to stop and wonder whether you're going about it the wrong way.  
Ioctls are usually *not* used for efficient I/O.

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008160636.XAA18026>