提交 96a8123e 编写于 作者: R Rafał Miłecki 提交者: Ralf Baechle

MIPS: BCM47XX: Slightly clean memory detection

Patch was tested on devices with 64 MiB and 256 MiB of RAM.
It documents every part nicely and drops this hacky part of code:
max = off | ((128 << 20) - 1);
Signed-off-by: NRafał Miłecki <zajec5@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Patchwork: https://patchwork.linux-mips.org/patch/6808/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 d8ce7593
...@@ -69,15 +69,18 @@ static __init void prom_init_mem(void) ...@@ -69,15 +69,18 @@ static __init void prom_init_mem(void)
* BCM47XX uses 128MB for addressing the ram, if the system contains * BCM47XX uses 128MB for addressing the ram, if the system contains
* less that that amount of ram it remaps the ram more often into the * less that that amount of ram it remaps the ram more often into the
* available space. * available space.
* Accessing memory after 128MB will cause an exception.
* max contains the biggest possible address supported by the platform.
* If the method wants to try something above we assume 128MB ram.
*/ */
off = (unsigned long)prom_init;
max = off | ((128 << 20) - 1); /* Physical address, without mapping to any kernel segment */
for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) { off = CPHYSADDR((unsigned long)prom_init);
if ((off + mem) > max) {
mem = (128 << 20); /* Accessing memory after 128 MiB will cause an exception */
max = 128 << 20;
for (mem = 1 << 20; mem < max; mem += 1 << 20) {
/* Loop condition may be not enough, off may be over 1 MiB */
if (off + mem >= max) {
mem = max;
printk(KERN_DEBUG "assume 128MB RAM\n"); printk(KERN_DEBUG "assume 128MB RAM\n");
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册