linux-mips-fnet
[Top] [All Lists]

RE: boot memory

To: Rabeeh Khoury <rabeeh@galileo.co.il>
Subject: RE: boot memory
From: Harald Koerfgen <Harald.Koerfgen@home.ivm.de>
Date: Wed, 16 Feb 2000 18:24:02 +0100 (MET)
Cc: "linux-mips@fnet.fr" <linux-mips@fnet.fr>
In-reply-to: <38A9D0CB.FF958043@galileo.co.il>
Organization: none
Reply-to: "Harald Koerfgen" <Harald.Koerfgen@home.ivm.de>
Sender: harry@franz.no.dom
On 15-Feb-00 Rabeeh Khoury wrote:
> Hi All
> 
> I'm having trouble with my embedded system initializing the ram ; I do
> the following for initializations in kernel_entry -
> 
> {
>  mips_machgroup = MACH_GROUP_GALILEO;
> 
>  mips_memory_upper = 0x81000000; // not needed any more
>  galileo_mem_init();
> }
> 
> void __init galileo_mem_init(void)
> {
>   unsigned long bootmap_size;
> 
>  max_low_pfn = 0x1000; // 16 MB of ram - that's what I have on the
> embedded
>   bootmap_size = init_bootmem(0, max_low_pfn);
>   free_bootmem (0 , 0x01000000);
>   reserve_bootmem(0, 0x01000000);
> }
> 

What about something like:

#define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)

void __init galileo_mem_init(void)
{
  extern char _end;
  unsigned long bootmap_size;

  start_pfn = PFN_UP((unsigned long)&_end);
  mem_size = 0x01000000;

  /* Register all the contiguous memory with the bootmem allocator
    and free it.  Be careful about the bootmem freemap.  */
  bootmap_size = init_bootmem(start_pfn, mem_size >> PAGE_SHIFT);
  free_bootmem(start_pfn + bootmap_size, mem_size - start_pfn - bootmap_size);
}

?
---
Regards,
Harald

<Prev in Thread] Current Thread [Next in Thread>