lkml.org 
[lkml]   [1999]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: addresses & kernel modules for PCI drivers
On Mon, 26 Jul 1999, Michael Berg wrote:

> The problem is that any memory I allocate for this buffer in the module
> is a 32-bit address well above the range of addresses that will fit into
> the high 14 bits that I have available.
>
> Is there a way for the module to obtain a 256KByte chunk of memory that
> can be addresses with only 14 bits?

Yeap. __get_free_pages always returns objects aligned to their own size.
So just do

addr = __get_free_pages(GFP_KERNEL, 18 - PAGE_SHIFT); /*256KB*/

to get the memory you need. One other thing to consider is that since it
is a large contiguous chunk of memory, you should probably allocate it at
load time in order to avoid things like open() failing sporadically.

-ben



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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