--- zzzz-none-000/linux-2.6.13.1/arch/mips/kernel/setup.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/arch/mips/kernel/setup.c 2007-02-01 15:03:30.000000000 +0000 @@ -41,6 +41,7 @@ #include #include #include +#include struct cpuinfo_mips cpu_data[NR_CPUS]; @@ -95,6 +96,8 @@ int x = boot_mem_map.nr_map; struct boot_mem_map_entry *prev = boot_mem_map.map + x - 1; + /*--- prom_printf("[add_memory_region] start=0x%x size=0x%x type=%u\n", start, size, type); ---*/ + /*--- printk("[add_memory_region] start=0x%x size=0x%x type=%u\n", start, size, type); ---*/ /* * Try to merge with previous entry if any. This is far less than * perfect but is sufficient for most real world cases. @@ -113,6 +116,8 @@ boot_mem_map.map[x].size = size; boot_mem_map.map[x].type = type; boot_mem_map.nr_map++; + + /*--- prom_printf("[add_memory_region] done (nr_map=%u\n", boot_mem_map.nr_map); ---*/ } static void __init print_memory_map(void) @@ -122,21 +127,26 @@ for (i = 0; i < boot_mem_map.nr_map; i++) { printk(" memory: %0*Lx @ %0*Lx ", + /*--- prom_printf(" memory: %0*Lx @ %0*Lx ", ---*/ field, (unsigned long long) boot_mem_map.map[i].size, field, (unsigned long long) boot_mem_map.map[i].addr); switch (boot_mem_map.map[i].type) { case BOOT_MEM_RAM: printk("(usable)\n"); + /*--- prom_printf("(usable)\n"); ---*/ break; case BOOT_MEM_ROM_DATA: printk("(ROM data)\n"); + /*--- prom_printf("(ROM data)\n"); ---*/ break; case BOOT_MEM_RESERVED: printk("(reserved)\n"); + /*--- prom_printf("(reserved)\n"); ---*/ break; default: printk("type %lu\n", boot_mem_map.map[i].type); + /*--- prom_printf("type %lu\n", boot_mem_map.map[i].type); ---*/ break; } } @@ -149,6 +159,7 @@ int len = 0; int usermem = 0; + /*--- prom_printf("Determined physical RAM map:\n"); ---*/ printk("Determined physical RAM map:\n"); print_memory_map(); @@ -344,6 +355,8 @@ #endif } + /*--- printk("[bootmem_init]: max_low_pfn 0x%x first_usable_pfn 0x%x\n", max_low_pfn, first_usable_pfn); ---*/ + #ifdef CONFIG_HIGHMEM /* * Crude, we really should make a better attempt at detecting @@ -414,6 +427,7 @@ free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); } + /*--- printk("[bootmem_init] bootmap_size=0x%x\n", bootmap_size); ---*/ /* Reserve the bootmap memory. */ reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size); #endif /* CONFIG_SGI_IP27 */ @@ -440,6 +454,58 @@ reserve_bootmem(CPHYSADDR(initrd_start), initrd_size); } #endif /* CONFIG_BLK_DEV_INITRD */ + + + /* ram bug fix */ + if ( ! strstr( prom_getcmdline(), "CPU_NR=2" )) + { + struct _ram_bug { + unsigned int start; /* physikalische Adresse */ + unsigned int length; + }; + char *urlader = prom_getenv("mtd2"); + char *memsize_str = prom_getenv("memsize"); + unsigned int urlader_start, urlader_end, memsize; + struct _ram_bug *B; + + if (!memsize_str) { + memsize = 0x02000000; + } else { + memsize = simple_strtol(memsize_str, NULL, 0); + } + + if(urlader) { + urlader_start = simple_strtol(urlader, NULL, 0); + urlader = strchr(urlader,','); + if(urlader) { + urlader++; + urlader_end = simple_strtol(urlader, NULL, 0); + B = (struct _ram_bug *)urlader_end; + + while((--B)->start != 0xFFFFFFFF) { + printk("&B 0x%p B->start 0x%x B->length 0x%x\n", B, B->start, B->length); + if(B->start < 0x94000000) { + printk("[reserve] start addr 0x%x to low\n", B->start); + break; + } + if(B->start >= 0x94000000 + memsize) { + printk("[reserve] start addr 0x%x to high\n", B->start); + break; + } + if(B->length > (1 << 20)) { + printk("[reserve] length %u grater then 1 MByte\n", B->length); + break; + } + if(B->start < (unsigned int)&_end) { + printk("[reserve] memory from 0x%x to 0x%x (inside kernel)\n", B->start, B->start + B->length); + } else { + printk("[reserve] memory from 0x%x to 0x%x\n", B->start, B->start + B->length); + reserve_bootmem_node(NODE_DATA(0), B->start & ~0xE0000000, B->length); + } + } + } + } + } } static inline void resource_init(void) @@ -521,6 +587,7 @@ extern initcall_t __earlyinitcall_start, __earlyinitcall_end; +#include static void __init do_earlyinitcalls(void) { initcall_t *call, *start, *end; @@ -532,6 +599,9 @@ if (earlyinit_debug) printk("calling earlyinitcall 0x%p\n", *call); + + /*--- prom_printf("[do_earlyinitcalls]: call 0x%x", *call); ---*/ + /*--- print_symbol("%s\n", (unsigned int)*call); ---*/ (*call)(); } } @@ -554,11 +624,13 @@ do_earlyinitcalls(); strlcpy(command_line, arcs_cmdline, sizeof(command_line)); + strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_cmdline_early(); + bootmem_init(); sparse_init(); paging_init();