From: David Gibson <david@gibson.dropbear.id.au>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
Subject: [PATCH 4/4] powerpc: New reg.h for the zImage
Date: Wed, 21 Mar 2007 17:31:50 +1100 (EST) [thread overview]
Message-ID: <20070321063150.38E9CDDEAB@ozlabs.org> (raw)
In-Reply-To: <20070321063031.GB30422@localhost.localdomain>
This patch adds a reg.h to the zImage code, with common definitions
for accessing system reigsters. For now, this includes functions for
retreiving 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>
---
arch/powerpc/boot/crt0.S | 1 -
arch/powerpc/boot/main.c | 5 +++--
arch/powerpc/boot/ops.h | 2 +-
arch/powerpc/boot/reg.h | 22 ++++++++++++++++++++++
4 files changed, 26 insertions(+), 4 deletions(-)
Index: working-2.6/arch/powerpc/boot/reg.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ working-2.6/arch/powerpc/boot/reg.h 2007-03-21 17:28:38.000000000 +1100
@@ -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 */
Index: working-2.6/arch/powerpc/boot/crt0.S
===================================================================
--- working-2.6.orig/arch/powerpc/boot/crt0.S 2007-03-21 17:24:48.000000000 +1100
+++ working-2.6/arch/powerpc/boot/crt0.S 2007-03-21 17:24:48.000000000 +1100
@@ -97,5 +97,4 @@ _zimage_start_lib:
bl platform_init
/* Call start */
- mr r3,r1
b start
Index: working-2.6/arch/powerpc/boot/main.c
===================================================================
--- working-2.6.orig/arch/powerpc/boot/main.c 2007-03-21 17:24:48.000000000 +1100
+++ working-2.6/arch/powerpc/boot/main.c 2007-03-21 17:24:48.000000000 +1100
@@ -17,6 +17,7 @@
#include "ops.h"
#include "gunzip_util.h"
#include "flatdevtree.h"
+#include "reg.h"
extern char _start[];
extern char __bss_start[];
@@ -230,7 +231,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;
@@ -249,7 +250,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());
/* Ensure that the device tree has a /chosen node */
if (! finddevice("/chosen"))
Index: working-2.6/arch/powerpc/boot/ops.h
===================================================================
--- working-2.6.orig/arch/powerpc/boot/ops.h 2007-03-21 17:24:48.000000000 +1100
+++ working-2.6/arch/powerpc/boot/ops.h 2007-03-21 17:24:48.000000000 +1100
@@ -75,7 +75,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);
next prev parent reply other threads:[~2007-03-21 6:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-21 6:30 [0/4] Further zImage work David Gibson
2007-03-21 6:31 ` [PATCH 1/4] powerpc: Add gcc format warnings to zImage printf() David Gibson
2007-03-21 15:03 ` Milton Miller
2007-03-22 1:35 ` David Gibson
2007-03-21 6:31 ` [PATCH 2/4] powerpc: Add device tree utility functions to zImage David Gibson
2007-03-21 15:03 ` Milton Miller
2007-03-22 3:02 ` David Gibson
2007-03-21 17:10 ` Segher Boessenkool
2007-03-21 23:31 ` David Gibson
2007-03-21 21:57 ` Scott Wood
2007-03-22 1:36 ` David Gibson
2007-03-21 6:31 ` [PATCH 3/4] powerpc: Clean up zImage handling of the command line David Gibson
2007-03-21 6:31 ` David Gibson [this message]
2007-03-22 5:48 ` [0/4] Further zImage work (spin 2) David Gibson
2007-03-22 5:59 ` [PATCH 1/4] powerpc: Add gcc format warnings to zImage printf() David Gibson
2007-03-22 6:02 ` [PATCH 3/4] powerpc: Clean up zImage handling of the command line David Gibson
2007-03-22 6:02 ` [PATCH 4/4] powerpc: New reg.h for the zImage David Gibson
2007-03-22 6:02 ` [PATCH 2/4] powerpc: Add device tree utility functions to zImage David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070321063150.38E9CDDEAB@ozlabs.org \
--to=david@gibson.dropbear.id.au \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).