--- zzzz-none-000/linux-2.6.19.2/arch/mips/mips-boards/generic/memory.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5504/linux-2.6.19.2/arch/mips/mips-boards/generic/memory.c 2007-05-08 12:32:35.000000000 +0000 @@ -42,6 +42,7 @@ #ifdef DEBUG static char *mtypes[3] = { "Dont use memory", + "Urlader data memory", "YAMON PROM memory", "Free memmory", }; @@ -55,6 +56,8 @@ char *memsize_str; unsigned int memsize; char cmdline[CL_SIZE], *ptr; + char *flashsize_str; + unsigned int flashsize; /* otherwise look in the environment */ memsize_str = prom_getenv("memsize"); @@ -86,8 +89,22 @@ else memsize = physical_memsize; + flashsize_str = prom_getenv("flashsize"); + if (!flashsize_str) { + prom_printf("flashsize not set in boot prom, set to default (8Mb)\n"); + flashsize = 0x00800000; + } else { +#ifdef DEBUG + prom_printf("prom_flashsize = %s\n", flashsize_str); +#endif + flashsize = simple_strtol(flashsize_str, NULL, 0); + } + prom_printf("flashsize=%u MByte\n", flashsize >> 20); + + memset(mdesc, 0, sizeof(mdesc)); +#if !defined(CONFIG_MIPS_OHIO) && !defined(CONFIG_MIPS_UR8) && !defined(CONFIG_MIPS_AR7) mdesc[0].type = yamon_dontuse; mdesc[0].base = 0x00000000; mdesc[0].size = 0x00001000; @@ -120,6 +137,55 @@ mdesc[4].type = yamon_free; mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end)); mdesc[4].size = memsize - mdesc[4].base; +#else /*--- #if !defined(CONFIG_MIPS_OHIO) && !defined(CONFIG_MIPS_UR8) && !defined(CONFIG_MIPS_AR7) ---*/ + /*------------------------------------------------------------------------------------------*\ + * Memory Avail + * + * ROM 0x1000 0000 - 0x1040 0000 4MB + * ROM 0x1000 0000 - 0x1080 0000 8MB + * + * RAM 0x1400 0000 - 0x1500 0000 16MB + * RAM 0x1400 0000 - 0x1600 0000 32MB + * + * Memory Layout + * + * kernel 0x1400 0000 - 0x1460 0700 [0] + [1] + * Urlader 0x1460 0700 - 0x1470 0700 + * RAM 0x1470 0700 - 0x1500 0000 16MB + * RAM 0x1470 0700 - 0x1600 0000 32MB + * + \*------------------------------------------------------------------------------------------*/ + prom_printf("&_end=0x%p PFN_ALIGN(&_end)=0x%lx CPHYSADDR(PFN_ALIGN(&_end))=0x%x memsize=0x%x\n", + &_end, PFN_ALIGN(&_end), CPHYSADDR(PFN_ALIGN(&_end)), memsize); + + /*--- kernel ---*/ + mdesc[0].type = yamon_dontuse; + mdesc[0].base = CPHYSADDR(PFN_ALIGN(&_text)); + mdesc[0].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[0].base; + + mdesc[1].type = yamon_free; + mdesc[1].base = mdesc[0].base + mdesc[0].size; +#if defined(CONFIG_MIPS_OHIO) + mdesc[1].size = memsize - (mdesc[1].base - CONFIG_MIPS_OHIO_PHY_MEMSTART); +#elif defined(CONFIG_MIPS_AR7) + mdesc[1].size = memsize - (mdesc[1].base - CONFIG_MIPS_AR7_PHY_MEMSTART); +#elif defined(CONFIG_MIPS_UR8) + mdesc[1].size = memsize - (mdesc[1].base - CONFIG_MIPS_UR8_PHY_MEMSTART); +#endif + + mdesc[2].type = yamon_dontuse; + mdesc[2].base = 0; + mdesc[2].size = 0; + + mdesc[3].type = yamon_dontuse; + mdesc[3].base = 0; + mdesc[3].size = 0; + + mdesc[4].type = yamon_dontuse; + mdesc[4].base = 0x10000000; + mdesc[4].size = flashsize; + +#endif /*--- #else ---*/ /*--- #if !defined(CONFIG_MIPS_OHIO) && !defined(CONFIG_MIPS_UR8) && !defined(CONFIG_MIPS_AR7)---*/ return &mdesc[0]; } @@ -176,7 +242,7 @@ if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) continue; - addr = PAGE_ALIGN(boot_mem_map.map[i].addr); + addr = boot_mem_map.map[i].addr; while (addr < boot_mem_map.map[i].addr + boot_mem_map.map[i].size) { ClearPageReserved(virt_to_page(__va(addr)));