diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2006-11-21 01:37:37 +0100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 10:39:34 +0100 |
commit | 35af89eb491a0741005e474626053266e6e635b7 (patch) | |
tree | 6813c0457dedacd221a2014bda37d0c892c328cd /arch/powerpc/boot/main.c | |
parent | [POWERPC] Small clarification of initrd handling (diff) | |
download | linux-35af89eb491a0741005e474626053266e6e635b7.tar.xz linux-35af89eb491a0741005e474626053266e6e635b7.zip |
[POWERPC] Cleanup zImage handling of kernel entry with flat device tree
This makes 2 changes to clean up the flat device tree handling
logic in the zImage wrapper.
First, there were two callbacks from the dt_ops structure used for
producing a final flat tree to pass to the kerne: dt_ops.ft_pack()
which packed the flat tree (possibly a no-op) and dt_ops.ft_addr()
which retreived the address of the final blob. Since they were only
ever called together, this patch combines the two into a single new
callback, dt_ops.finalize(). This new callback does whatever
platform-dependent things are necessary to produce a final flat device
tree blob, and returns the blob's addres.
Second, the current logic calls the kernel with a flat device tree if
one is build into the zImage wrapper, otherwise it boots the kernel
with a PROM pointer, expecting the kernel to copy the OF device tree
itself. This approach precludes the possibility of the platform
wrapper code building a flat device tree from whatever
platform-specific information firmware provides. Thus, this patch
takes the more sensible approach of invoking the kernel with a flat
tree if the dt_ops.finalize callback provides one (by whatever means).
So, the dt_ops.finalize callback can be NULL, or can be a function
which returns NULL. In either case, the zImage wrapper logic assumes
that this is a platform with OF and invokes the kernel accordingly.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/main.c')
-rw-r--r-- | arch/powerpc/boot/main.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c index 630a453e16fa..6f6b50d238b6 100644 --- a/arch/powerpc/boot/main.c +++ b/arch/powerpc/boot/main.c @@ -298,6 +298,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) { kernel_entry_t kentry; char cmdline[COMMAND_LINE_SIZE]; + unsigned long ft_addr = 0; memset(__bss_start, 0, _end - __bss_start); memset(&platform_ops, 0, sizeof(platform_ops)); @@ -328,14 +329,20 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) set_cmdline(cmdline); } + printf("Finalizing device tree..."); + if (dt_ops.finalize) + ft_addr = dt_ops.finalize(); + if (ft_addr) + printf(" flat tree at 0x%lx\n\r", ft_addr); + else + printf(" using OF tree (promptr=%p)\n\r", promptr); + if (console_ops.close) console_ops.close(); kentry = (kernel_entry_t) vmlinux.addr; - if (_dtb_end > _dtb_start) { - dt_ops.ft_pack(); - kentry(dt_ops.ft_addr(), 0, NULL); - } + if (ft_addr) + kentry(ft_addr, 0, NULL); else /* XXX initrd addr/size should be passed in properties */ kentry(initrd.addr, initrd.size, promptr); |