ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-s390 / lowcore.h
1 /*
2  *  include/asm-s390/lowcore.h
3  *
4  *  S390 version
5  *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6  *    Author(s): Hartmut Penner (hp@de.ibm.com),
7  *               Martin Schwidefsky (schwidefsky@de.ibm.com),
8  *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
9  */
10
11 #ifndef _ASM_S390_LOWCORE_H
12 #define _ASM_S390_LOWCORE_H
13
14 #ifndef __s390x__
15 #define __LC_EXT_OLD_PSW                0x018
16 #define __LC_SVC_OLD_PSW                0x020
17 #define __LC_PGM_OLD_PSW                0x028
18 #define __LC_MCK_OLD_PSW                0x030
19 #define __LC_IO_OLD_PSW                 0x038
20 #define __LC_EXT_NEW_PSW                0x058
21 #define __LC_SVC_NEW_PSW                0x060
22 #define __LC_PGM_NEW_PSW                0x068
23 #define __LC_MCK_NEW_PSW                0x070
24 #define __LC_IO_NEW_PSW                 0x078
25 #else /* !__s390x__ */
26 #define __LC_EXT_OLD_PSW                0x0130
27 #define __LC_SVC_OLD_PSW                0x0140
28 #define __LC_PGM_OLD_PSW                0x0150
29 #define __LC_MCK_OLD_PSW                0x0160
30 #define __LC_IO_OLD_PSW                 0x0170
31 #define __LC_EXT_NEW_PSW                0x01b0
32 #define __LC_SVC_NEW_PSW                0x01c0
33 #define __LC_PGM_NEW_PSW                0x01d0
34 #define __LC_MCK_NEW_PSW                0x01e0
35 #define __LC_IO_NEW_PSW                 0x01f0
36 #endif /* !__s390x__ */
37
38 #define __LC_EXT_PARAMS                 0x080
39 #define __LC_CPU_ADDRESS                0x084
40 #define __LC_EXT_INT_CODE               0x086
41
42 #define __LC_SVC_ILC                    0x088
43 #define __LC_SVC_INT_CODE               0x08A
44 #define __LC_PGM_ILC                    0x08C
45 #define __LC_PGM_INT_CODE               0x08E
46
47 #define __LC_PER_ATMID                  0x096
48 #define __LC_PER_ADDRESS                0x098
49 #define __LC_PER_ACCESS_ID              0x0A1
50
51 #define __LC_SUBCHANNEL_ID              0x0B8
52 #define __LC_SUBCHANNEL_NR              0x0BA
53 #define __LC_IO_INT_PARM                0x0BC
54 #define __LC_IO_INT_WORD                0x0C0
55 #define __LC_MCCK_CODE                  0x0E8
56
57 #define __LC_RETURN_PSW                 0x200
58
59 #define __LC_IRB                        0x210
60
61 #define __LC_DIAG44_OPCODE              0x250
62
63 #define __LC_SAVE_AREA                  0xC00
64
65 #ifndef __s390x__
66 #define __LC_KERNEL_STACK               0xC40
67 #define __LC_THREAD_INFO                0xC44
68 #define __LC_ASYNC_STACK                0xC48
69 #define __LC_KERNEL_ASCE                0xC4C
70 #define __LC_USER_ASCE                  0xC50
71 #define __LC_CPUID                      0xC60
72 #define __LC_CPUADDR                    0xC68
73 #define __LC_IPLDEV                     0xC7C
74 #define __LC_JIFFY_TIMER                0xC80
75 #define __LC_CURRENT                    0xC90
76 #define __LC_INT_CLOCK                  0xC98
77 #else /* __s390x__ */
78 #define __LC_KERNEL_STACK               0xD40
79 #define __LC_THREAD_INFO                0xD48
80 #define __LC_ASYNC_STACK                0xD50
81 #define __LC_KERNEL_ASCE                0xD58
82 #define __LC_USER_ASCE                  0xD60
83 #define __LC_CPUID                      0xD90
84 #define __LC_CPUADDR                    0xD98
85 #define __LC_IPLDEV                     0xDB8
86 #define __LC_JIFFY_TIMER                0xDC0
87 #define __LC_CURRENT                    0xDD8
88 #define __LC_INT_CLOCK                  0xDe8
89 #endif /* __s390x__ */
90
91 #define __LC_PANIC_MAGIC                0xE00
92
93 #ifndef __s390x__
94 #define __LC_PFAULT_INTPARM             0x080
95 #define __LC_AREGS_SAVE_AREA            0x120
96 #define __LC_CREGS_SAVE_AREA            0x1C0
97 #else /* __s390x__ */
98 #define __LC_PFAULT_INTPARM             0x11B8
99 #define __LC_AREGS_SAVE_AREA            0x1340
100 #define __LC_CREGS_SAVE_AREA            0x1380
101 #endif /* __s390x__ */
102
103 #ifndef __ASSEMBLY__
104
105 #include <linux/config.h>
106 #include <asm/processor.h>
107 #include <linux/types.h>
108 #include <asm/sigp.h>
109
110 void restart_int_handler(void);
111 void ext_int_handler(void);
112 void system_call(void);
113 void pgm_check_handler(void);
114 void mcck_int_handler(void);
115 void io_int_handler(void);
116
117 struct _lowcore
118 {
119 #ifndef __s390x__
120         /* prefix area: defined by architecture */
121         psw_t        restart_psw;              /* 0x000 */
122         __u32        ccw2[4];                  /* 0x008 */
123         psw_t        external_old_psw;         /* 0x018 */
124         psw_t        svc_old_psw;              /* 0x020 */
125         psw_t        program_old_psw;          /* 0x028 */
126         psw_t        mcck_old_psw;             /* 0x030 */
127         psw_t        io_old_psw;               /* 0x038 */
128         __u8         pad1[0x58-0x40];          /* 0x040 */
129         psw_t        external_new_psw;         /* 0x058 */
130         psw_t        svc_new_psw;              /* 0x060 */
131         psw_t        program_new_psw;          /* 0x068 */
132         psw_t        mcck_new_psw;             /* 0x070 */
133         psw_t        io_new_psw;               /* 0x078 */
134         __u32        ext_params;               /* 0x080 */
135         __u16        cpu_addr;                 /* 0x084 */
136         __u16        ext_int_code;             /* 0x086 */
137         __u16        svc_ilc;                  /* 0x088 */
138         __u16        svc_code;                 /* 0x08a */
139         __u16        pgm_ilc;                  /* 0x08c */
140         __u16        pgm_code;                 /* 0x08e */
141         __u32        trans_exc_code;           /* 0x090 */
142         __u16        mon_class_num;            /* 0x094 */
143         __u16        per_perc_atmid;           /* 0x096 */
144         __u32        per_address;              /* 0x098 */
145         __u32        monitor_code;             /* 0x09c */
146         __u8         exc_access_id;            /* 0x0a0 */
147         __u8         per_access_id;            /* 0x0a1 */
148         __u8         pad2[0xB8-0xA2];          /* 0x0a2 */
149         __u16        subchannel_id;            /* 0x0b8 */
150         __u16        subchannel_nr;            /* 0x0ba */
151         __u32        io_int_parm;              /* 0x0bc */
152         __u32        io_int_word;              /* 0x0c0 */
153         __u8         pad3[0xD8-0xC4];          /* 0x0c4 */
154         __u32        cpu_timer_save_area[2];   /* 0x0d8 */
155         __u32        clock_comp_save_area[2];  /* 0x0e0 */
156         __u32        mcck_interruption_code[2]; /* 0x0e8 */
157         __u8         pad4[0xf4-0xf0];          /* 0x0f0 */
158         __u32        external_damage_code;     /* 0x0f4 */
159         __u32        failing_storage_address;  /* 0x0f8 */
160         __u8         pad5[0x100-0xfc];         /* 0x0fc */
161         __u32        st_status_fixed_logout[4];/* 0x100 */
162         __u8         pad6[0x120-0x110];        /* 0x110 */
163         __u32        access_regs_save_area[16];/* 0x120 */
164         __u32        floating_pt_save_area[8]; /* 0x160 */
165         __u32        gpregs_save_area[16];     /* 0x180 */
166         __u32        cregs_save_area[16];      /* 0x1c0 */      
167
168         psw_t        return_psw;               /* 0x200 */
169         __u8         irb[64];                  /* 0x208 */
170         __u8         pad8[0xc00-0x248];        /* 0x248 */
171
172         /* System info area */
173         __u32        save_area[16];            /* 0xc00 */
174         __u32        kernel_stack;             /* 0xc40 */
175         __u32        thread_info;              /* 0xc44 */
176         __u32        async_stack;              /* 0xc48 */
177         __u32        kernel_asce;              /* 0xc4c */
178         __u32        user_asce;                /* 0xc50 */
179         __u8         pad10[0xc60-0xc54];       /* 0xc54 */
180         /* entry.S sensitive area start */
181         struct       cpuinfo_S390 cpu_data;    /* 0xc60 */
182         __u32        ipl_device;               /* 0xc7c */
183         /* entry.S sensitive area end */
184
185         /* SMP info area: defined by DJB */
186         __u64        jiffy_timer;              /* 0xc80 */
187         __u32        ext_call_fast;            /* 0xc88 */
188         __u32        percpu_offset;            /* 0xc8c */
189         __u32        current_task;             /* 0xc90 */
190         __u32        softirq_pending;          /* 0xc94 */
191         __u64        int_clock;                /* 0xc98 */
192         __u8         pad11[0xe00-0xca0];       /* 0xca0 */
193
194         /* 0xe00 is used as indicator for dump tools */
195         /* whether the kernel died with panic() or not */
196         __u32        panic_magic;              /* 0xe00 */
197
198         /* Align to the top 1k of prefix area */
199         __u8         pad12[0x1000-0xe04];      /* 0xe04 */
200 #else /* !__s390x__ */
201         /* prefix area: defined by architecture */
202         __u32        ccw1[2];                  /* 0x000 */
203         __u32        ccw2[4];                  /* 0x008 */
204         __u8         pad1[0x80-0x18];          /* 0x018 */
205         __u32        ext_params;               /* 0x080 */
206         __u16        cpu_addr;                 /* 0x084 */
207         __u16        ext_int_code;             /* 0x086 */
208         __u16        svc_ilc;                  /* 0x088 */
209         __u16        svc_code;                 /* 0x08a */
210         __u16        pgm_ilc;                  /* 0x08c */
211         __u16        pgm_code;                 /* 0x08e */
212         __u32        data_exc_code;            /* 0x090 */
213         __u16        mon_class_num;            /* 0x094 */
214         __u16        per_perc_atmid;           /* 0x096 */
215         addr_t       per_address;              /* 0x098 */
216         __u8         exc_access_id;            /* 0x0a0 */
217         __u8         per_access_id;            /* 0x0a1 */
218         __u8         op_access_id;             /* 0x0a2 */
219         __u8         ar_access_id;             /* 0x0a3 */
220         __u8         pad2[0xA8-0xA4];          /* 0x0a4 */
221         addr_t       trans_exc_code;           /* 0x0A0 */
222         addr_t       monitor_code;             /* 0x09c */
223         __u16        subchannel_id;            /* 0x0b8 */
224         __u16        subchannel_nr;            /* 0x0ba */
225         __u32        io_int_parm;              /* 0x0bc */
226         __u32        io_int_word;              /* 0x0c0 */
227         __u8         pad3[0xc8-0xc4];          /* 0x0c4 */
228         __u32        stfl_fac_list;            /* 0x0c8 */
229         __u8         pad4[0xe8-0xcc];          /* 0x0cc */
230         __u32        mcck_interruption_code[2]; /* 0x0e8 */
231         __u8         pad5[0xf4-0xf0];          /* 0x0f0 */
232         __u32        external_damage_code;     /* 0x0f4 */
233         addr_t       failing_storage_address;  /* 0x0f8 */
234         __u8         pad6[0x120-0x100];        /* 0x100 */
235         psw_t        restart_old_psw;          /* 0x120 */
236         psw_t        external_old_psw;         /* 0x130 */
237         psw_t        svc_old_psw;              /* 0x140 */
238         psw_t        program_old_psw;          /* 0x150 */
239         psw_t        mcck_old_psw;             /* 0x160 */
240         psw_t        io_old_psw;               /* 0x170 */
241         __u8         pad7[0x1a0-0x180];        /* 0x180 */
242         psw_t        restart_psw;              /* 0x1a0 */
243         psw_t        external_new_psw;         /* 0x1b0 */
244         psw_t        svc_new_psw;              /* 0x1c0 */
245         psw_t        program_new_psw;          /* 0x1d0 */
246         psw_t        mcck_new_psw;             /* 0x1e0 */
247         psw_t        io_new_psw;               /* 0x1f0 */
248         psw_t        return_psw;               /* 0x200 */
249         __u8         irb[64];                  /* 0x210 */
250         __u32        diag44_opcode;            /* 0x250 */
251         __u8         pad8[0xc00-0x254];        /* 0x254 */
252         /* System info area */
253         __u64        save_area[16];            /* 0xc00 */
254         __u8         pad9[0xd40-0xc80];        /* 0xc80 */
255         __u64        kernel_stack;             /* 0xd40 */
256         __u64        thread_info;              /* 0xd48 */
257         __u64        async_stack;              /* 0xd50 */
258         __u64        kernel_asce;              /* 0xd58 */
259         __u64        user_asce;                /* 0xd60 */
260         __u8         pad10[0xd80-0xd68];       /* 0xd68 */
261         /* entry.S sensitive area start */
262         struct       cpuinfo_S390 cpu_data;    /* 0xd80 */
263         __u32        ipl_device;               /* 0xdb8 */
264         __u32        pad11;                    /* 0xdbc */
265         /* entry.S sensitive area end */
266
267         /* SMP info area: defined by DJB */
268         __u64        jiffy_timer;              /* 0xdc0 */
269         __u64        ext_call_fast;            /* 0xdc8 */
270         __u64        percpu_offset;            /* 0xdd0 */
271         __u64        current_task;             /* 0xdd8 */
272         __u64        softirq_pending;          /* 0xde0 */
273         __u64        int_clock;                /* 0xde8 */
274         __u8         pad12[0xe00-0xdf0];       /* 0xdf0 */
275
276         /* 0xe00 is used as indicator for dump tools */
277         /* whether the kernel died with panic() or not */
278         __u32        panic_magic;              /* 0xe00 */
279
280         __u8         pad13[0x1200-0xe04];      /* 0xe04 */
281
282         /* System info area */ 
283
284         __u64        floating_pt_save_area[16]; /* 0x1200 */
285         __u64        gpregs_save_area[16];      /* 0x1280 */
286         __u32        st_status_fixed_logout[4]; /* 0x1300 */
287         __u8         pad14[0x1318-0x1310];      /* 0x1310 */
288         __u32        prefixreg_save_area;       /* 0x1318 */
289         __u32        fpt_creg_save_area;        /* 0x131c */
290         __u8         pad15[0x1324-0x1320];      /* 0x1320 */
291         __u32        tod_progreg_save_area;     /* 0x1324 */
292         __u32        cpu_timer_save_area[2];    /* 0x1328 */
293         __u32        clock_comp_save_area[2];   /* 0x1330 */
294         __u8         pad16[0x1340-0x1338];      /* 0x1338 */ 
295         __u32        access_regs_save_area[16]; /* 0x1340 */ 
296         __u64        cregs_save_area[16];       /* 0x1380 */
297
298         /* align to the top of the prefix area */
299
300         __u8         pad17[0x2000-0x1400];      /* 0x1400 */
301 #endif /* !__s390x__ */
302 } __attribute__((packed)); /* End structure*/
303
304 #define S390_lowcore (*((struct _lowcore *) 0))
305 extern struct _lowcore *lowcore_ptr[];
306
307 extern __inline__ void set_prefix(__u32 address)
308 {
309         __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" );
310 }
311
312 #define __PANIC_MAGIC           0xDEADC0DE
313
314 #endif
315
316 #endif