aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-03-22 02:02:21 -0400
committerPaul Mackerras <paulus@samba.org>2007-03-26 01:11:20 -0400
commite5a2072bd48eb4a35c57a8ec45897ac2db3a3f82 (patch)
tree8ee71ecb846416925a3e5796a8f66626db0c6513 /arch/powerpc/boot
parentfae59c39e885148acf42320fe0d4ebf4cb3e9231 (diff)
[POWERPC] New reg.h for the zImage
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>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r--arch/powerpc/boot/crt0.S1
-rw-r--r--arch/powerpc/boot/main.c5
-rw-r--r--arch/powerpc/boot/ops.h2
-rw-r--r--arch/powerpc/boot/reg.h22
4 files changed, 26 insertions, 4 deletions
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 25ad7453531a..bd7770b60730 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -88,5 +88,4 @@ _zimage_start_lib:
88 bl platform_init 88 bl platform_init
89 89
90 /* Call start */ 90 /* Call start */
91 mr r3,r1
92 b start 91 b start
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 33c73295acf3..e1df8feaf16d 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -17,6 +17,7 @@
17#include "ops.h" 17#include "ops.h"
18#include "gunzip_util.h" 18#include "gunzip_util.h"
19#include "flatdevtree.h" 19#include "flatdevtree.h"
20#include "reg.h"
20 21
21extern char _start[]; 22extern char _start[];
22extern char __bss_start[]; 23extern char __bss_start[];
@@ -247,7 +248,7 @@ struct dt_ops dt_ops;
247struct console_ops console_ops; 248struct console_ops console_ops;
248struct loader_info loader_info; 249struct loader_info loader_info;
249 250
250void start(void *sp) 251void start(void)
251{ 252{
252 struct addr_range vmlinux, initrd; 253 struct addr_range vmlinux, initrd;
253 kernel_entry_t kentry; 254 kernel_entry_t kentry;
@@ -260,7 +261,7 @@ void start(void *sp)
260 platform_ops.fixups(); 261 platform_ops.fixups();
261 262
262 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", 263 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r",
263 _start, sp); 264 _start, get_sp());
264 265
265 vmlinux = prep_kernel(); 266 vmlinux = prep_kernel();
266 initrd = prep_initrd(vmlinux, loader_info.initrd_addr, 267 initrd = prep_initrd(vmlinux, loader_info.initrd_addr,
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index ea5368caca59..592dc6c20bdb 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -73,7 +73,7 @@ struct loader_info {
73}; 73};
74extern struct loader_info loader_info; 74extern struct loader_info loader_info;
75 75
76void start(void *sp); 76void start(void);
77int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device); 77int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
78int serial_console_init(void); 78int serial_console_init(void);
79int ns16550_console_init(void *devp, struct serial_console_data *scdp); 79int 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
index 000000000000..d3cd9ee98afb
--- /dev/null
+++ b/arch/powerpc/boot/reg.h
@@ -0,0 +1,22 @@
1#ifndef _PPC_BOOT_REG_H
2#define _PPC_BOOT_REG_H
3/*
4 * Copyright 2007 Davud Gibson, IBM Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12static inline u32 mfpvr(void)
13{
14 u32 pvr;
15 asm volatile ("mfpvr %0" : "=r"(pvr));
16 return pvr;
17}
18
19register void *__stack_pointer asm("r1");
20#define get_sp() (__stack_pointer)
21
22#endif /* _PPC_BOOT_REG_H */