aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/main.c
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@mvista.com>2006-10-16 16:49:27 -0400
committerPaul Mackerras <paulus@samba.org>2006-10-18 01:50:18 -0400
commitc888554bf95a5a0a6ac3e2389c6bf1e03e9480ba (patch)
tree0bd690be6846ac378498310f9d90ae526a3028bd /arch/powerpc/boot/main.c
parentb0a779debd56514b2b5de7617a1643e5dac2d4dd (diff)
[POWERPC] More bootwrapper reorganization
More reorganization of the bootwrapper: - Add dtb section to zImage - ft_init now called by platform_init - Pack a flat dt before calling kernel - Remove size parameter from free - printf only calls console_ops.write it its not NULL - Some cleanup Signed-off-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/main.c')
-rw-r--r--arch/powerpc/boot/main.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index d719bb9333d1..418497482b6e 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -27,6 +27,8 @@ extern char _vmlinux_start[];
27extern char _vmlinux_end[]; 27extern char _vmlinux_end[];
28extern char _initrd_start[]; 28extern char _initrd_start[];
29extern char _initrd_end[]; 29extern char _initrd_end[];
30extern char _dtb_start[];
31extern char _dtb_end[];
30 32
31struct addr_range { 33struct addr_range {
32 unsigned long addr; 34 unsigned long addr;
@@ -250,10 +252,6 @@ static void prep_kernel(unsigned long *a1, unsigned long *a2)
250 flush_cache((void *)vmlinux.addr, vmlinux.size); 252 flush_cache((void *)vmlinux.addr, vmlinux.size);
251} 253}
252 254
253void __attribute__ ((weak)) ft_init(void *dt_blob)
254{
255}
256
257/* A buffer that may be edited by tools operating on a zImage binary so as to 255/* A buffer that may be edited by tools operating on a zImage binary so as to
258 * edit the command line passed to vmlinux (by setting /chosen/bootargs). 256 * edit the command line passed to vmlinux (by setting /chosen/bootargs).
259 * The buffer is put in it's own section so that tools may locate it easier. 257 * The buffer is put in it's own section so that tools may locate it easier.
@@ -285,19 +283,12 @@ static void set_cmdline(char *buf)
285 setprop(devp, "bootargs", buf, strlen(buf) + 1); 283 setprop(devp, "bootargs", buf, strlen(buf) + 1);
286} 284}
287 285
288/* Section where ft can be tacked on after zImage is built */
289union blobspace {
290 struct boot_param_header hdr;
291 char space[8*1024];
292} dt_blob __attribute__((__section__("__builtin_ft")));
293
294struct platform_ops platform_ops; 286struct platform_ops platform_ops;
295struct dt_ops dt_ops; 287struct dt_ops dt_ops;
296struct console_ops console_ops; 288struct console_ops console_ops;
297 289
298void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) 290void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
299{ 291{
300 int have_dt = 0;
301 kernel_entry_t kentry; 292 kernel_entry_t kentry;
302 char cmdline[COMMAND_LINE_SIZE]; 293 char cmdline[COMMAND_LINE_SIZE];
303 294
@@ -306,15 +297,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
306 memset(&dt_ops, 0, sizeof(dt_ops)); 297 memset(&dt_ops, 0, sizeof(dt_ops));
307 memset(&console_ops, 0, sizeof(console_ops)); 298 memset(&console_ops, 0, sizeof(console_ops));
308 299
309 /* Override the dt_ops and device tree if there was an flat dev 300 if (platform_init(promptr, _dtb_start, _dtb_end))
310 * tree attached to the zImage.
311 */
312 if (dt_blob.hdr.magic == OF_DT_HEADER) {
313 have_dt = 1;
314 ft_init(&dt_blob);
315 }
316
317 if (platform_init(promptr))
318 exit(); 301 exit();
319 if (console_ops.open && (console_ops.open() < 0)) 302 if (console_ops.open && (console_ops.open() < 0))
320 exit(); 303 exit();
@@ -342,8 +325,10 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
342 console_ops.close(); 325 console_ops.close();
343 326
344 kentry = (kernel_entry_t) vmlinux.addr; 327 kentry = (kernel_entry_t) vmlinux.addr;
345 if (have_dt) 328 if (_dtb_end > _dtb_start) {
329 dt_ops.ft_pack();
346 kentry(dt_ops.ft_addr(), 0, NULL); 330 kentry(dt_ops.ft_addr(), 0, NULL);
331 }
347 else 332 else
348 /* XXX initrd addr/size should be passed in properties */ 333 /* XXX initrd addr/size should be passed in properties */
349 kentry(a1, a2, promptr); 334 kentry(a1, a2, promptr);