]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] New reg.h for the zImage
authorDavid Gibson <david@gibson.dropbear.id.au>
Thu, 22 Mar 2007 06:02:21 +0000 (17:02 +1100)
committerPaul Mackerras <paulus@samba.org>
Mon, 26 Mar 2007 05:11:20 +0000 (15:11 +1000)
This patch adds a reg.h to the zImage code, with common definitions
for accessing system registers.  For now, this includes functions for
retrieving the PVR and the stack pointer.  This patch then uses the
new reg.h to let start() display the running stack address without
having to explicitly pass the stack as a parameter from the asm code.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/boot/crt0.S
arch/powerpc/boot/main.c
arch/powerpc/boot/ops.h
arch/powerpc/boot/reg.h [new file with mode: 0644]

index 25ad7453531aaea8526dd8f950bdbd64e10d75ec..bd7770b60730396e44c73e28e082c3c0b42a1007 100644 (file)
@@ -88,5 +88,4 @@ _zimage_start_lib:
        bl      platform_init
 
        /* Call start */
-       mr      r3,r1
        b       start
index 33c73295acf30bd0b1b3ba8a86e65e1c93db3da1..e1df8feaf16d36fca3ffdf8e46f4be594799ef02 100644 (file)
@@ -17,6 +17,7 @@
 #include "ops.h"
 #include "gunzip_util.h"
 #include "flatdevtree.h"
+#include "reg.h"
 
 extern char _start[];
 extern char __bss_start[];
@@ -247,7 +248,7 @@ struct dt_ops dt_ops;
 struct console_ops console_ops;
 struct loader_info loader_info;
 
-void start(void *sp)
+void start(void)
 {
        struct addr_range vmlinux, initrd;
        kernel_entry_t kentry;
@@ -260,7 +261,7 @@ void start(void *sp)
                platform_ops.fixups();
 
        printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r",
-              _start, sp);
+              _start, get_sp());
 
        vmlinux = prep_kernel();
        initrd = prep_initrd(vmlinux, loader_info.initrd_addr,
index ea5368caca5977c518fe5a6bc63f7037273a082e..592dc6c20bdbd445896f745dac5aded6adea2b00 100644 (file)
@@ -73,7 +73,7 @@ struct loader_info {
 };
 extern struct loader_info loader_info;
 
-void start(void *sp);
+void start(void);
 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
 int serial_console_init(void);
 int ns16550_console_init(void *devp, struct serial_console_data *scdp);
diff --git a/arch/powerpc/boot/reg.h b/arch/powerpc/boot/reg.h
new file mode 100644 (file)
index 0000000..d3cd9ee
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _PPC_BOOT_REG_H
+#define _PPC_BOOT_REG_H
+/*
+ * Copyright 2007 Davud Gibson, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+static inline u32 mfpvr(void)
+{
+       u32 pvr;
+       asm volatile ("mfpvr    %0" : "=r"(pvr));
+       return pvr;
+}
+
+register void *__stack_pointer asm("r1");
+#define get_sp()       (__stack_pointer)
+
+#endif /* _PPC_BOOT_REG_H */