aboutsummaryrefslogtreecommitdiff
path: root/arch/blackfin/mm/init.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-28 08:15:24 +1100
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-28 08:15:24 +1100
commit91525300baf162e83e923b09ca286f9205e21522 (patch)
tree115f50c0f270eb1bb032dc520e018d9aa65b957c /arch/blackfin/mm/init.c
parent991dee591a99d035796a8c194eb1796cc020e142 (diff)
parent9c5e710bc1431f41ccdd0c294fa355aa0d45d2d7 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6: (54 commits) MAINTIANERS: just use Mike gmail e-mail for contact and pawn the serial driver off onto Sonic [Blackfin] arch: remove old I2C BF54x porting. [Blackfin] arch: Add the semtimedop syscall. Upstream uClibc doesn't compile without it. [Blackfin] arch: fix bug kernel boot message: memory information is not reasonable [Blackfin] arch: use common flash driver to setup partitions rather than the bf5xx-flash driver [Blackfin] arch: Fix bug - kernel build with Debug option enabled fails to boot up [Blackfin] arch: Fix bug Only RTC interrupt can wake up deeper sleep core. [Blackfin] arch: Add proper SW System Reset delay sequence [Blackfin] arch: Update copyright date [Blackfin] arch: GPIO API cleanup and anomaly update [Blackfin] arch: Fix BUG gpio_direction_output API is not compatitable with GENERIC_GPIO API interface [Blackfin] arch: Initial checkin of the memory protection support. [Blackfin] arch: set_bfin_dma_config shouldnt set SYNC or RESTART by default - add argument or option [Blackfin] arch: Add some comments - fix semicolons [Blackfin] arch: move all code related to CPLB handling into a new subdirectory under kernel/ [Blackfin] arch: print out list of modules if kernel is crashing and tell people if the kernel is tainted [Blackfin] arch: enable generic GPIO based I2C driver in STAMP-BF533, EZKIT-BF533 and EZKIT-BF561 boards [Blackfin] arch: Don't oops_in_progress if single step is comming from the kernel [Blackfin] arch: Fix BUG - kernel sometimes would stuck with KEYBOARD_GPIO on [Blackfin] arch: update to latest anomaly sheets ...
Diffstat (limited to 'arch/blackfin/mm/init.c')
-rw-r--r--arch/blackfin/mm/init.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index e97ea8fc8dc..eb1a12ac9e3 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();
@@ -184,13 +201,15 @@ static __init void free_init_pages(const char *what, unsigned long begin, unsign
#ifdef CONFIG_BLK_DEV_INITRD
void __init free_initrd_mem(unsigned long start, unsigned long end)
{
+#ifndef CONFIG_MPU
free_init_pages("initrd memory", start, end);
+#endif
}
#endif
void __init free_initmem(void)
{
-#ifdef CONFIG_RAMKERNEL
+#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU
free_init_pages("unused kernel memory",
(unsigned long)(&__init_begin),
(unsigned long)(&__init_end));