aboutsummaryrefslogtreecommitdiffstats
path: root/bsp/qemu-ppc32/qemu-powerpc-Added-qemu_restart-function.patch
blob: 23713f1096db1782dc2378053f47eed3c6b7b0f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 4ea81210af681a20d425b52d42285e8c729b6f75 Mon Sep 17 00:00:00 2001
From: J. Aaron Gamble <john.gamble@windriver.com>
Date: Wed, 22 Sep 2010 11:20:03 -0400
Subject: [PATCH] qemu/powerpc: Added qemu_restart() function

qemu_restart code taken from:

   http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg03147.html

Updated qemu machine description to use this function

Signed-off-by: J. Aaron Gamble <john.gamble@windriver.com>
---
 arch/powerpc/platforms/qemu/setup.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/qemu/setup.c b/arch/powerpc/platforms/qemu/setup.c
index 2d1ecf2..1f37f71 100644
--- a/arch/powerpc/platforms/qemu/setup.c
+++ b/arch/powerpc/platforms/qemu/setup.c
@@ -159,6 +159,22 @@ static int __init qemu_probe(void)
 	return 1;
 }
 
+void qemu_restart(char *cmd)
+{
+	local_irq_disable(); /* no interrupts */
+	/* set exception prefix high - to the prom */
+	mtmsr(mfmsr() | MSR_IP);
+
+	/* make sure bit 0 (reset) is a 0 */
+	outb(inb(0x92) & ~1L, 0x92);
+	/* signal a reset to system control port A - soft reset */
+	outb(inb(0x92) | 1, 0x92);
+
+	while(1);
+
+	/* not reached */
+}
+
 define_machine(qemu) {
 	.name			= "QEMU",
 	.probe			= qemu_probe,
@@ -167,7 +183,7 @@ define_machine(qemu) {
 	.show_cpuinfo		= qemu_ibm_cpuinfo,
 	.init_IRQ		= qemu_init_IRQ,
 /* 	.pcibios_fixup		= qemu_pcibios_fixup, */
-/*	.restart		= qemu_restart, */
+	.restart		= qemu_restart,
 /*	.power_off		= qemu_halt, */
 /*	.halt			= qemu_halt, */
 /* 	.time_init		= todc_time_init, */
-- 
1.6.5.2