aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/setup.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-10-07 14:08:56 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-07 14:08:56 -0400
commit5a89770daad83df74d77a8d34a1ffaedae565ce9 (patch)
tree0d8ef70293a6ef969ba8b7718e59608337643d40 /arch/mips/kernel/setup.c
parentc46c948260f41af18b277c1eb1895d788d3605dc (diff)
parentaf7c951d76708c61b862463d579d76be757130bf (diff)
Merge branches 'pxa-core' and 'pxa-machines' into pxa-all
Conflicts: arch/arm/mach-pxa/Kconfig arch/arm/mach-pxa/pxa25x.c arch/arm/mach-pxa/pxa27x.c
Diffstat (limited to 'arch/mips/kernel/setup.c')
-rw-r--r--arch/mips/kernel/setup.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8af84867e74d..16f8edfe5cdc 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -78,7 +78,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type)
78 78
79 /* Sanity check */ 79 /* Sanity check */
80 if (start + size < start) { 80 if (start + size < start) {
81 printk("Trying to add an invalid memory region, skipped\n"); 81 pr_warning("Trying to add an invalid memory region, skipped\n");
82 return; 82 return;
83 } 83 }
84 84
@@ -92,7 +92,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type)
92 } 92 }
93 93
94 if (x == BOOT_MEM_MAP_MAX) { 94 if (x == BOOT_MEM_MAP_MAX) {
95 printk("Ooops! Too many entries in the memory map!\n"); 95 pr_err("Ooops! Too many entries in the memory map!\n");
96 return; 96 return;
97 } 97 }
98 98
@@ -108,22 +108,22 @@ static void __init print_memory_map(void)
108 const int field = 2 * sizeof(unsigned long); 108 const int field = 2 * sizeof(unsigned long);
109 109
110 for (i = 0; i < boot_mem_map.nr_map; i++) { 110 for (i = 0; i < boot_mem_map.nr_map; i++) {
111 printk(" memory: %0*Lx @ %0*Lx ", 111 printk(KERN_INFO " memory: %0*Lx @ %0*Lx ",
112 field, (unsigned long long) boot_mem_map.map[i].size, 112 field, (unsigned long long) boot_mem_map.map[i].size,
113 field, (unsigned long long) boot_mem_map.map[i].addr); 113 field, (unsigned long long) boot_mem_map.map[i].addr);
114 114
115 switch (boot_mem_map.map[i].type) { 115 switch (boot_mem_map.map[i].type) {
116 case BOOT_MEM_RAM: 116 case BOOT_MEM_RAM:
117 printk("(usable)\n"); 117 printk(KERN_CONT "(usable)\n");
118 break; 118 break;
119 case BOOT_MEM_ROM_DATA: 119 case BOOT_MEM_ROM_DATA:
120 printk("(ROM data)\n"); 120 printk(KERN_CONT "(ROM data)\n");
121 break; 121 break;
122 case BOOT_MEM_RESERVED: 122 case BOOT_MEM_RESERVED:
123 printk("(reserved)\n"); 123 printk(KERN_CONT "(reserved)\n");
124 break; 124 break;
125 default: 125 default:
126 printk("type %lu\n", boot_mem_map.map[i].type); 126 printk(KERN_CONT "type %lu\n", boot_mem_map.map[i].type);
127 break; 127 break;
128 } 128 }
129 } 129 }
@@ -160,36 +160,39 @@ early_param("rd_size", rd_size_early);
160static unsigned long __init init_initrd(void) 160static unsigned long __init init_initrd(void)
161{ 161{
162 unsigned long end; 162 unsigned long end;
163 u32 *initrd_header;
164 163
165 /* 164 /*
166 * Board specific code or command line parser should have 165 * Board specific code or command line parser should have
167 * already set up initrd_start and initrd_end. In these cases 166 * already set up initrd_start and initrd_end. In these cases
168 * perfom sanity checks and use them if all looks good. 167 * perfom sanity checks and use them if all looks good.
169 */ 168 */
170 if (initrd_start && initrd_end > initrd_start) 169 if (!initrd_start || initrd_end <= initrd_start) {
171 goto sanitize; 170#ifdef CONFIG_PROBE_INITRD_HEADER
171 u32 *initrd_header;
172 172
173 /* 173 /*
174 * See if initrd has been added to the kernel image by 174 * See if initrd has been added to the kernel image by
175 * arch/mips/boot/addinitrd.c. In that case a header is 175 * arch/mips/boot/addinitrd.c. In that case a header is
176 * prepended to initrd and is made up by 8 bytes. The fisrt 176 * prepended to initrd and is made up by 8 bytes. The first
177 * word is a magic number and the second one is the size of 177 * word is a magic number and the second one is the size of
178 * initrd. Initrd start must be page aligned in any cases. 178 * initrd. Initrd start must be page aligned in any cases.
179 */ 179 */
180 initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8; 180 initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
181 if (initrd_header[0] != 0x494E5244) 181 if (initrd_header[0] != 0x494E5244)
182 goto disable;
183 initrd_start = (unsigned long)(initrd_header + 2);
184 initrd_end = initrd_start + initrd_header[1];
185#else
182 goto disable; 186 goto disable;
183 initrd_start = (unsigned long)(initrd_header + 2); 187#endif
184 initrd_end = initrd_start + initrd_header[1]; 188 }
185 189
186sanitize:
187 if (initrd_start & ~PAGE_MASK) { 190 if (initrd_start & ~PAGE_MASK) {
188 printk(KERN_ERR "initrd start must be page aligned\n"); 191 pr_err("initrd start must be page aligned\n");
189 goto disable; 192 goto disable;
190 } 193 }
191 if (initrd_start < PAGE_OFFSET) { 194 if (initrd_start < PAGE_OFFSET) {
192 printk(KERN_ERR "initrd start < PAGE_OFFSET\n"); 195 pr_err("initrd start < PAGE_OFFSET\n");
193 goto disable; 196 goto disable;
194 } 197 }
195 198
@@ -221,18 +224,18 @@ static void __init finalize_initrd(void)
221 goto disable; 224 goto disable;
222 } 225 }
223 if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) { 226 if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) {
224 printk("Initrd extends beyond end of memory"); 227 printk(KERN_ERR "Initrd extends beyond end of memory");
225 goto disable; 228 goto disable;
226 } 229 }
227 230
228 reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT); 231 reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT);
229 initrd_below_start_ok = 1; 232 initrd_below_start_ok = 1;
230 233
231 printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n", 234 pr_info("Initial ramdisk at: 0x%lx (%lu bytes)\n",
232 initrd_start, size); 235 initrd_start, size);
233 return; 236 return;
234disable: 237disable:
235 printk(" - disabling initrd\n"); 238 printk(KERN_CONT " - disabling initrd\n");
236 initrd_start = 0; 239 initrd_start = 0;
237 initrd_end = 0; 240 initrd_end = 0;
238} 241}
@@ -310,14 +313,12 @@ static void __init bootmem_init(void)
310 if (min_low_pfn >= max_low_pfn) 313 if (min_low_pfn >= max_low_pfn)
311 panic("Incorrect memory mapping !!!"); 314 panic("Incorrect memory mapping !!!");
312 if (min_low_pfn > ARCH_PFN_OFFSET) { 315 if (min_low_pfn > ARCH_PFN_OFFSET) {
313 printk(KERN_INFO 316 pr_info("Wasting %lu bytes for tracking %lu unused pages\n",
314 "Wasting %lu bytes for tracking %lu unused pages\n", 317 (min_low_pfn - ARCH_PFN_OFFSET) * sizeof(struct page),
315 (min_low_pfn - ARCH_PFN_OFFSET) * sizeof(struct page), 318 min_low_pfn - ARCH_PFN_OFFSET);
316 min_low_pfn - ARCH_PFN_OFFSET);
317 } else if (min_low_pfn < ARCH_PFN_OFFSET) { 319 } else if (min_low_pfn < ARCH_PFN_OFFSET) {
318 printk(KERN_INFO 320 pr_info("%lu free pages won't be used\n",
319 "%lu free pages won't be used\n", 321 ARCH_PFN_OFFSET - min_low_pfn);
320 ARCH_PFN_OFFSET - min_low_pfn);
321 } 322 }
322 min_low_pfn = ARCH_PFN_OFFSET; 323 min_low_pfn = ARCH_PFN_OFFSET;
323 324
@@ -471,7 +472,7 @@ static void __init arch_mem_init(char **cmdline_p)
471 /* call board setup routine */ 472 /* call board setup routine */
472 plat_mem_setup(); 473 plat_mem_setup();
473 474
474 printk("Determined physical RAM map:\n"); 475 pr_info("Determined physical RAM map:\n");
475 print_memory_map(); 476 print_memory_map();
476 477
477 strlcpy(command_line, arcs_cmdline, sizeof(command_line)); 478 strlcpy(command_line, arcs_cmdline, sizeof(command_line));
@@ -482,7 +483,7 @@ static void __init arch_mem_init(char **cmdline_p)
482 parse_early_param(); 483 parse_early_param();
483 484
484 if (usermem) { 485 if (usermem) {
485 printk("User-defined physical RAM map:\n"); 486 pr_info("User-defined physical RAM map:\n");
486 print_memory_map(); 487 print_memory_map();
487 } 488 }
488 489