X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/83cf826ce2d25cf77fdd8fc905611d0ea5de45ef..cf070486ddf5ae6a56e4952f5a3e504f32cc0052:/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c diff --git a/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c b/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c index 17cb740b3..8ff571ce2 100644 --- a/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c +++ b/target/linux/ar7-2.6/files/arch/mips/ar7/memory.c @@ -38,33 +38,26 @@ #include -#warning FIXME: use sdram control regs and/or autodetection static int __init memsize(void) { - char *memsize_str; - unsigned int result; - char cmdline[CL_SIZE], *ptr; - - /* Check the command line first for a memsize directive */ - strcpy(cmdline, arcs_cmdline); - ptr = strstr(cmdline, "memsize="); - if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' ')) - ptr = strstr(ptr, " memsize="); - - if (ptr) { - result = memparse(ptr + 8, &ptr); - } else { - /* otherwise look in the environment */ - memsize_str = prom_getenv("memsize"); - if (!memsize_str) { - prom_printf("memsize not set in boot prom, set to default (8Mb)\n"); - result = 0x00800000; - } else { - result = simple_strtol(memsize_str, NULL, 0); - } + u32 size = (64 << 20); + volatile u32 *addr = (u32 *)KSEG1ADDR(0x14000000 + size - 4); + u32 *kernel_end = (u32 *)KSEG1ADDR(CPHYSADDR((u32)&_end)); + + while (addr > kernel_end) { + *addr = (u32)addr; + size >>= 1; + addr -= size >> 2; } - return result; + do { + addr += size >> 2; + if (*addr != (u32)addr) + break; + size <<= 1; + } while (size < (64 << 20)); + + return size; } #ifdef CONFIG_NEED_MULTIPLE_NODES @@ -167,9 +160,10 @@ void __init mem_init(void) void __init prom_meminit(void) { + unsigned long pages; #ifdef CONFIG_NEED_MULTIPLE_NODES unsigned long kernel_start, kernel_end; - unsigned long pages, free_pages; + unsigned long free_pages; unsigned long bootmap_size; #endif @@ -194,9 +188,7 @@ void __init prom_meminit(void) #endif } -unsigned long __init prom_free_prom_memory(void) +void __init prom_free_prom_memory(void) { -/* return freed; -*/ - return 0; + return; }