aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-08-21 23:48:37 -0400
committerPaul Mackerras <paulus@samba.org>2007-08-22 02:48:35 -0400
commit7180e3e636deff82f8810291878a184f21142fa9 (patch)
tree00e6e833269df0dbcaa7b11059fa5c0a7e446812
parentdc8f571a26689102f6abe2565a84226edeaacc61 (diff)
[POWERPC] Split out iSeries specific exception macros
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/iseries/exception.S15
-rw-r--r--arch/powerpc/platforms/iseries/exception.h58
-rw-r--r--include/asm-powerpc/exception.h71
3 files changed, 78 insertions, 66 deletions
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index b5f600616ade..e9a3435b3c18 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -30,9 +30,10 @@
30#include <asm/asm-offsets.h> 30#include <asm/asm-offsets.h>
31#include <asm/thread_info.h> 31#include <asm/thread_info.h>
32#include <asm/ptrace.h> 32#include <asm/ptrace.h>
33#include <asm/exception.h>
34#include <asm/cputable.h> 33#include <asm/cputable.h>
35 34
35#include "exception.h"
36
36 .text 37 .text
37 38
38 .globl system_reset_iSeries 39 .globl system_reset_iSeries
@@ -104,15 +105,15 @@ BEGIN_FTR_SECTION
104 mtcrf 0x80,r12 105 mtcrf 0x80,r12
105 mfspr r12,SPRN_SPRG2 106 mfspr r12,SPRN_SPRG2
106END_FTR_SECTION_IFCLR(CPU_FTR_SLB) 107END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
107 EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN) 108 EXCEPTION_PROLOG_1(PACA_EXGEN)
108 EXCEPTION_PROLOG_ISERIES_2 109 EXCEPTION_PROLOG_ISERIES_1
109 b data_access_common 110 b data_access_common
110 111
111.do_stab_bolted_iSeries: 112.do_stab_bolted_iSeries:
112 mtcrf 0x80,r12 113 mtcrf 0x80,r12
113 mfspr r12,SPRN_SPRG2 114 mfspr r12,SPRN_SPRG2
114 EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB) 115 EXCEPTION_PROLOG_1(PACA_EXSLB)
115 EXCEPTION_PROLOG_ISERIES_2 116 EXCEPTION_PROLOG_ISERIES_1
116 b .do_stab_bolted 117 b .do_stab_bolted
117 118
118 .globl data_access_slb_iSeries 119 .globl data_access_slb_iSeries
@@ -171,7 +172,7 @@ slb_miss_user_iseries:
171 std r10,PACA_EXGEN+EX_R13(r13) 172 std r10,PACA_EXGEN+EX_R13(r13)
172 std r11,PACA_EXGEN+EX_R9(r13) 173 std r11,PACA_EXGEN+EX_R9(r13)
173 std r12,PACA_EXGEN+EX_R3(r13) 174 std r12,PACA_EXGEN+EX_R3(r13)
174 EXCEPTION_PROLOG_ISERIES_2 175 EXCEPTION_PROLOG_ISERIES_1
175 b slb_miss_user_common 176 b slb_miss_user_common
176#endif 177#endif
177 178
@@ -187,7 +188,7 @@ slb_miss_user_iseries:
187system_call_iSeries: 188system_call_iSeries:
188 mr r9,r13 189 mr r9,r13
189 mfspr r13,SPRN_SPRG3 190 mfspr r13,SPRN_SPRG3
190 EXCEPTION_PROLOG_ISERIES_2 191 EXCEPTION_PROLOG_ISERIES_1
191 b system_call_common 192 b system_call_common
192 193
193 STD_EXCEPTION_ISERIES( 0xd00, single_step, PACA_EXGEN) 194 STD_EXCEPTION_ISERIES( 0xd00, single_step, PACA_EXGEN)
diff --git a/arch/powerpc/platforms/iseries/exception.h b/arch/powerpc/platforms/iseries/exception.h
new file mode 100644
index 000000000000..5b3f285e8168
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/exception.h
@@ -0,0 +1,58 @@
1#ifndef _ASM_POWERPC_ISERIES_EXCEPTION_H
2#define _ASM_POWERPC_ISERIES_EXCEPTION_H
3/*
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *
9 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
10 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
11 * Adapted for Power Macintosh by Paul Mackerras.
12 * Low-level exception handlers and MMU support
13 * rewritten by Paul Mackerras.
14 * Copyright (C) 1996 Paul Mackerras.
15 *
16 * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and
17 * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com
18 *
19 * This file contains the low-level support and setup for the
20 * PowerPC-64 platform, including trap and interrupt dispatch.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 */
27#include <asm/exception.h>
28
29#define EXCEPTION_PROLOG_ISERIES_1 \
30 mfmsr r10; \
31 ld r12,PACALPPACAPTR(r13); \
32 ld r11,LPPACASRR0(r12); \
33 ld r12,LPPACASRR1(r12); \
34 ori r10,r10,MSR_RI; \
35 mtmsrd r10,1
36
37#define STD_EXCEPTION_ISERIES(n, label, area) \
38 .globl label##_iSeries; \
39label##_iSeries: \
40 HMT_MEDIUM; \
41 mtspr SPRN_SPRG1,r13; /* save r13 */ \
42 EXCEPTION_PROLOG_1(area); \
43 EXCEPTION_PROLOG_ISERIES_1; \
44 b label##_common
45
46#define MASKABLE_EXCEPTION_ISERIES(n, label) \
47 .globl label##_iSeries; \
48label##_iSeries: \
49 HMT_MEDIUM; \
50 mtspr SPRN_SPRG1,r13; /* save r13 */ \
51 EXCEPTION_PROLOG_1(PACA_EXGEN); \
52 lbz r10,PACASOFTIRQEN(r13); \
53 cmpwi 0,r10,0; \
54 beq- label##_iSeries_masked; \
55 EXCEPTION_PROLOG_ISERIES_1; \
56 b label##_common; \
57
58#endif /* _ASM_POWERPC_ISERIES_EXCEPTION_H */
diff --git a/include/asm-powerpc/exception.h b/include/asm-powerpc/exception.h
index 1980ed364a9c..d850c8ea5903 100644
--- a/include/asm-powerpc/exception.h
+++ b/include/asm-powerpc/exception.h
@@ -62,6 +62,16 @@
62 ori reg,reg,(label)@l; /* virt addr of handler ... */ 62 ori reg,reg,(label)@l; /* virt addr of handler ... */
63#endif 63#endif
64 64
65#define EXCEPTION_PROLOG_1(area) \
66 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
67 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
68 std r10,area+EX_R10(r13); \
69 std r11,area+EX_R11(r13); \
70 std r12,area+EX_R12(r13); \
71 mfspr r9,SPRN_SPRG1; \
72 std r9,area+EX_R13(r13); \
73 mfcr r9
74
65/* 75/*
66 * Equal to EXCEPTION_PROLOG_PSERIES, except that it forces 64bit mode. 76 * Equal to EXCEPTION_PROLOG_PSERIES, except that it forces 64bit mode.
67 * The firmware calls the registered system_reset_fwnmi and 77 * The firmware calls the registered system_reset_fwnmi and
@@ -70,14 +80,7 @@
70 * This firmware bug is present on POWER4 and JS20. 80 * This firmware bug is present on POWER4 and JS20.
71 */ 81 */
72#define EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(area, label) \ 82#define EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(area, label) \
73 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 83 EXCEPTION_PROLOG_1(area); \
74 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
75 std r10,area+EX_R10(r13); \
76 std r11,area+EX_R11(r13); \
77 std r12,area+EX_R12(r13); \
78 mfspr r9,SPRN_SPRG1; \
79 std r9,area+EX_R13(r13); \
80 mfcr r9; \
81 clrrdi r12,r13,32; /* get high part of &label */ \ 84 clrrdi r12,r13,32; /* get high part of &label */ \
82 mfmsr r10; \ 85 mfmsr r10; \
83 /* force 64bit mode */ \ 86 /* force 64bit mode */ \
@@ -94,14 +97,7 @@
94 b . /* prevent speculative execution */ 97 b . /* prevent speculative execution */
95 98
96#define EXCEPTION_PROLOG_PSERIES(area, label) \ 99#define EXCEPTION_PROLOG_PSERIES(area, label) \
97 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 100 EXCEPTION_PROLOG_1(area); \
98 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
99 std r10,area+EX_R10(r13); \
100 std r11,area+EX_R11(r13); \
101 std r12,area+EX_R12(r13); \
102 mfspr r9,SPRN_SPRG1; \
103 std r9,area+EX_R13(r13); \
104 mfcr r9; \
105 clrrdi r12,r13,32; /* get high part of &label */ \ 101 clrrdi r12,r13,32; /* get high part of &label */ \
106 mfmsr r10; \ 102 mfmsr r10; \
107 mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 103 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
@@ -114,28 +110,6 @@
114 b . /* prevent speculative execution */ 110 b . /* prevent speculative execution */
115 111
116/* 112/*
117 * This is the start of the interrupt handlers for iSeries
118 * This code runs with relocation on.
119 */
120#define EXCEPTION_PROLOG_ISERIES_1(area) \
121 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
122 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
123 std r10,area+EX_R10(r13); \
124 std r11,area+EX_R11(r13); \
125 std r12,area+EX_R12(r13); \
126 mfspr r9,SPRN_SPRG1; \
127 std r9,area+EX_R13(r13); \
128 mfcr r9
129
130#define EXCEPTION_PROLOG_ISERIES_2 \
131 mfmsr r10; \
132 ld r12,PACALPPACAPTR(r13); \
133 ld r11,LPPACASRR0(r12); \
134 ld r12,LPPACASRR1(r12); \
135 ori r10,r10,MSR_RI; \
136 mtmsrd r10,1
137
138/*
139 * The common exception prolog is used for all except a few exceptions 113 * The common exception prolog is used for all except a few exceptions
140 * such as a segment miss on a kernel address. We have to be prepared 114 * such as a segment miss on a kernel address. We have to be prepared
141 * to take another exception from the point where we first touch the 115 * to take another exception from the point where we first touch the
@@ -247,27 +221,6 @@ label##_pSeries: \
247 rfid; \ 221 rfid; \
248 b . /* prevent speculative execution */ 222 b . /* prevent speculative execution */
249 223
250#define STD_EXCEPTION_ISERIES(n, label, area) \
251 .globl label##_iSeries; \
252label##_iSeries: \
253 HMT_MEDIUM; \
254 mtspr SPRN_SPRG1,r13; /* save r13 */ \
255 EXCEPTION_PROLOG_ISERIES_1(area); \
256 EXCEPTION_PROLOG_ISERIES_2; \
257 b label##_common
258
259#define MASKABLE_EXCEPTION_ISERIES(n, label) \
260 .globl label##_iSeries; \
261label##_iSeries: \
262 HMT_MEDIUM; \
263 mtspr SPRN_SPRG1,r13; /* save r13 */ \
264 EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \
265 lbz r10,PACASOFTIRQEN(r13); \
266 cmpwi 0,r10,0; \
267 beq- label##_iSeries_masked; \
268 EXCEPTION_PROLOG_ISERIES_2; \
269 b label##_common; \
270
271#ifdef CONFIG_PPC_ISERIES 224#ifdef CONFIG_PPC_ISERIES
272#define DISABLE_INTS \ 225#define DISABLE_INTS \
273 li r11,0; \ 226 li r11,0; \