Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ee7883b7466e721a72edacbcba2fe9cf449d82b2
Commit:     ee7883b7466e721a72edacbcba2fe9cf449d82b2
Parent:     de8c43f2fca9bb06f3ee87b38a61d5d9966ce221
Author:     Yi Li <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 27 19:56:17 2008 +0800
Committer:  Bryan Wu <[EMAIL PROTECTED]>
CommitDate: Sun Jan 27 19:56:17 2008 +0800

    [Blackfin] arch: fix bug kernel boot message: memory information is not 
reasonable
    
    Some of the information in kernel boot message is not reasonable.
    
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3846
    
     - use _rambase as the start of kernel image.
       kernel is in the region [_rambase, _ramstart]
     - count in pages in per-cpu-page list as available memory
     - reserved memory now include: [0 - 4K] for bad pointer catching,
       memory reserved for abnormaly 05000263, memory reserved by kernel itself.
    
    Signed-off-by: Yi Li <[EMAIL PROTECTED]>
    Signed-off-by: Bryan Wu <[EMAIL PROTECTED]>
---
 arch/blackfin/kernel/setup.c |    1 +
 arch/blackfin/mm/init.c      |   29 +++++++++++++++++++++++------
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 1a942a7..462cae8 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -238,6 +238,7 @@ void __init setup_arch(char **cmdline_p)
        memory_end = _ramend - DMA_UNCACHED_REGION;
 
        _ramstart = (unsigned long)__bss_stop;
+       _rambase = (unsigned long)_stext;
 #ifdef CONFIG_MPU
        /* Round up to multiple of 4MB.  */
        memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 9f007ca..eb1a12a 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -128,8 +128,8 @@ void __init paging_init(void)
 void __init mem_init(void)
 {
        unsigned int codek = 0, datak = 0, initk = 0;
+       unsigned int reservedpages = 0, freepages = 0;
        unsigned long tmp;
-       unsigned int len = _ramend - _rambase;
        unsigned long start_mem = memory_start;
        unsigned long end_mem = memory_end;
 
@@ -138,19 +138,36 @@ void __init mem_init(void)
 
        start_mem = PAGE_ALIGN(start_mem);
        max_mapnr = num_physpages = MAP_NR(high_memory);
-       printk(KERN_INFO "Physical pages: %lx\n", num_physpages);
+       printk(KERN_INFO "Kernel managed physical pages: %lu\n",
+               num_physpages);
 
        /* This will put all memory onto the freelists. */
        totalram_pages = free_all_bootmem();
 
+       reservedpages = 0;
+       for (tmp = 0; tmp < max_mapnr; tmp++)
+               if (PageReserved(pfn_to_page(tmp)))
+                       reservedpages++;
+       freepages =  max_mapnr - reservedpages;
+
+       /* do not count in kernel image between _rambase and _ramstart */
+       reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
+#if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
+       reservedpages += (_ramend - memory_end - DMA_UNCACHED_REGION) >>
+                               PAGE_SHIFT;
+#endif
+
        codek = (_etext - _stext) >> 10;
-       datak = (__bss_stop - __bss_start) >> 10;
        initk = (__init_end - __init_begin) >> 10;
+       datak = ((_ramstart - _rambase) >> 10) - codek - initk;
 
-       tmp = nr_free_pages() << PAGE_SHIFT;
        printk(KERN_INFO
-            "Memory available: %luk/%uk RAM, (%uk init code, %uk kernel code, 
%uk data, %uk dma)\n",
-            tmp >> 10, len >> 10, initk, codek, datak, DMA_UNCACHED_REGION >> 
10);
+            "Memory available: %luk/%luk RAM, "
+               "(%uk init code, %uk kernel code, "
+               "%uk data, %uk dma, %uk reserved)\n",
+               (unsigned long) freepages << (PAGE_SHIFT-10), _ramend >> 10,
+               initk, codek, datak, DMA_UNCACHED_REGION >> 10,
+               (reservedpages << (PAGE_SHIFT-10)));
 
        /* Initialize the blackfin L1 Memory. */
        l1sram_init();
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to