*/
#include <linux/bootmem.h>
#include <linux/init.h>
-#include <linux/initrd.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/pfn.h>
#include <asm/mips-boards/prom.h>
-#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));
-extern unsigned long __initramfs_start, __initramfs_end;
+ return size;
+}
#ifdef CONFIG_NEED_MULTIPLE_NODES
static bootmem_data_t node_bootmem_data;
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
-#ifdef CONFIG_BLK_DEV_INITRD
- initrd_start = (unsigned long)&__initramfs_start;
- initrd_end = (unsigned long)&__initramfs_end;
-#endif
-
pages = memsize() >> PAGE_SHIFT;
add_memory_region(ARCH_PFN_OFFSET << PAGE_SHIFT, pages <<
PAGE_SHIFT, BOOT_MEM_RAM);
#endif
}
-unsigned long __init prom_free_prom_memory(void)
+void __init prom_free_prom_memory(void)
{
-/* return freed;
-*/
- return 0;
+ return;
}