Re: I can't get mapping ram work (Arm kernel 2.4 )

Started by ruben quiñones ruiz on Aug 25, 2005 · 2 messages from 2 authors · Last reply Aug 26, 2005

open the first message on its own page

Message details and related content
TONY wrote:
-----------
How did you allocate this buffer?  Is is system RAM?  If it's system RAM,
did you use kmalloc, vmalloc or __get_free_pages. (kmalloc, vmalloc usually
do not work, you have to use __get_free_pages).
 Tony
---------

Hi Tony, yeah , I use __get_free_pages : (this function is called in int init_module(void) )

int slcdc_init_buffer(void)
{
	u_int required_pages;
	u_int extra_pages;
	u_int order;
	struct page *page;
	u16  *allocated_region;

	printk("slcdc data buffer size = %x \n",(unsigned int)SLCDC_DATA_MEM_SIZE);

	if(g_slcdc_dbuffer_address != NULL)
		return -EINVAL;
	if(g_slcdc_cbuffer_address != NULL)
		return -EINVAL;
	/*find order required to allocate enough memory for it*/
	required_pages = SLCDC_DATA_MEM_SIZE >> PAGE_SHIFT;
	for (order = 0; required_pages >> order; order++){;}
	extra_pages = (1 << order) - required_pages;
	printk("PAGE_SHIFT=0x%x required_pages=0x%x\n",PAGE_SHIFT,required_pages);
	printk("extra_page=0x%x \n",extra_pages);

	if((allocated_region =	(u_char *)__get_free_pages(GFP_KERNEL | GFP_DMA, order)) == NULL)
	{
		printk("can not allocated memory\n");
      	return -ENOMEM;
	}

	g_slcdc_dbuffer_address = (u_char *)allocated_region + (extra_pages << PAGE_SHIFT);
	g_slcdc_dbuffer_phyaddress = (u_char *)__virt_to_phys((u_long)g_slcdc_dbuffer_address);
	printk("g_slcdc_dbuffer_address=0x%x \n",(unsigned int)g_slcdc_dbuffer_address);

41 more lines

Message details and related content
ruben quiñones ruiz wrote:
TONY wrote:
-----------
How did you allocate this buffer?  Is is system RAM?  If it's system RAM,
did you use kmalloc, vmalloc or __get_free_pages. (kmalloc, vmalloc usually
do not work, you have to use __get_free_pages).
 Tony
---------

Hi Tony, yeah , I use __get_free_pages : (this function is called in int init_module(void) )
Hmm, I don't see anything obviously wrong with the code.  Maybe you can
post this at the ARM mailing list (linux-arm-kernel@lists.arm.linux.org.uk).

Tony


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help