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

Re: boot memory

To: "linux-mips@fnet.fr" <linux-mips@fnet.fr>
Subject: Re: boot memory
From: "Gleb O. Raiko" <raiko@niisi.msk.ru>
Date: Wed, 16 Feb 2000 20:54:42 +0300
Organization: NIISI RAN
References: <XFMail.000216182402.Harald.Koerfgen@home.ivm.de>
Harald Koerfgen wrote:

> 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);
> }
> 

More easy :-), w/o PFN_UP. Just implemented for baget today:

/* endmem - highest address of phys memory, passed by Baget Linux loader
*/
static void __init prom_meminit(unsigned long endmem)
{
        extern int _end;
        unsigned long bootmap_size;
        unsigned long start_pfn, max_pfn;
        unsigned long free_start = PAGE_ALIGN((unsigned long)&_end);

        start_pfn = MAP_NR(free_start);
        max_pfn = MAP_NR(endmem);
        bootmap_size = init_bootmem(start_pfn, max_pfn);
        free_bootmem(__pa(free_start), endmem - free_start);
        /* reserve bootmem allocator's bitmap */
        reserve_bootmem(__pa(free_start), bootmap_size);
}

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