lkml.org 
[lkml]   [1996]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: vremap() of non-page-aligned memory
> 
> I'm working on a driver for an ATM adapter that insists on
> having 0x70 bytes of port memory at 0xfffdff80.
>
> Does anybody know whether there is a more elegant way (aka.
> another function than vremap()) of mapping this into kernel
> memory space? The obvious solution is remapping the physical
> page that contains the memory chunk, but that appears to
> be a somewhat non-portable solution since it relies on a
> preset page size etc.

You have to map in the thing in chunks (it's not only the way it works, it's
the only way it can ever work). However, it's not too hard to do this as
portably as anything else in the kernel:

void * addr = vremap(0xfffdff80 & PAGE_MASK, PAGE_SIZE);

If you want to make _really_ sure, you actually map two pages (in case the 0x70
bytes could possibly be in two different pages, but that's not possible in this
case unless the page-size ridiculously small). The you need to do some "offset
within area" stuff, but that's easy enough by using PAGE_MASK/PAGE_SIZE.

Linus


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.042 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site