lowcore.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. #ifndef _ASM_S390_LOWCORE_H
  11. #define _ASM_S390_LOWCORE_H
  12. #define __LC_IPL_PARMBLOCK_PTR 0x0014
  13. #define __LC_EXT_PARAMS 0x0080
  14. #define __LC_CPU_ADDRESS 0x0084
  15. #define __LC_EXT_INT_CODE 0x0086
  16. #define __LC_SVC_ILC 0x0088
  17. #define __LC_SVC_INT_CODE 0x008a
  18. #define __LC_PGM_ILC 0x008c
  19. #define __LC_PGM_INT_CODE 0x008e
  20. #define __LC_PER_ATMID 0x0096
  21. #define __LC_PER_ADDRESS 0x0098
  22. #define __LC_PER_ACCESS_ID 0x00a1
  23. #define __LC_AR_MODE_ID 0x00a3
  24. #define __LC_SUBCHANNEL_ID 0x00b8
  25. #define __LC_SUBCHANNEL_NR 0x00ba
  26. #define __LC_IO_INT_PARM 0x00bc
  27. #define __LC_IO_INT_WORD 0x00c0
  28. #define __LC_MCCK_CODE 0x00e8
  29. #define __LC_DUMP_REIPL 0x0e00
  30. #ifndef __s390x__
  31. #define __LC_EXT_OLD_PSW 0x0018
  32. #define __LC_SVC_OLD_PSW 0x0020
  33. #define __LC_PGM_OLD_PSW 0x0028
  34. #define __LC_MCK_OLD_PSW 0x0030
  35. #define __LC_IO_OLD_PSW 0x0038
  36. #define __LC_EXT_NEW_PSW 0x0058
  37. #define __LC_SVC_NEW_PSW 0x0060
  38. #define __LC_PGM_NEW_PSW 0x0068
  39. #define __LC_MCK_NEW_PSW 0x0070
  40. #define __LC_IO_NEW_PSW 0x0078
  41. #define __LC_SAVE_AREA 0x0200
  42. #define __LC_RETURN_PSW 0x0240
  43. #define __LC_RETURN_MCCK_PSW 0x0248
  44. #define __LC_SYNC_ENTER_TIMER 0x0250
  45. #define __LC_ASYNC_ENTER_TIMER 0x0258
  46. #define __LC_EXIT_TIMER 0x0260
  47. #define __LC_USER_TIMER 0x0268
  48. #define __LC_SYSTEM_TIMER 0x0270
  49. #define __LC_STEAL_TIMER 0x0278
  50. #define __LC_LAST_UPDATE_TIMER 0x0280
  51. #define __LC_LAST_UPDATE_CLOCK 0x0288
  52. #define __LC_CURRENT 0x0290
  53. #define __LC_THREAD_INFO 0x0294
  54. #define __LC_KERNEL_STACK 0x0298
  55. #define __LC_ASYNC_STACK 0x029c
  56. #define __LC_PANIC_STACK 0x02a0
  57. #define __LC_KERNEL_ASCE 0x02a4
  58. #define __LC_USER_ASCE 0x02a8
  59. #define __LC_USER_EXEC_ASCE 0x02ac
  60. #define __LC_CPUID 0x02b0
  61. #define __LC_INT_CLOCK 0x02c8
  62. #define __LC_IRB 0x0300
  63. #define __LC_PFAULT_INTPARM 0x0080
  64. #define __LC_CPU_TIMER_SAVE_AREA 0x00d8
  65. #define __LC_CLOCK_COMP_SAVE_AREA 0x00e0
  66. #define __LC_PSW_SAVE_AREA 0x0100
  67. #define __LC_PREFIX_SAVE_AREA 0x0108
  68. #define __LC_AREGS_SAVE_AREA 0x0120
  69. #define __LC_FPREGS_SAVE_AREA 0x0160
  70. #define __LC_GPREGS_SAVE_AREA 0x0180
  71. #define __LC_CREGS_SAVE_AREA 0x01c0
  72. #else /* __s390x__ */
  73. #define __LC_LAST_BREAK 0x0110
  74. #define __LC_EXT_OLD_PSW 0x0130
  75. #define __LC_SVC_OLD_PSW 0x0140
  76. #define __LC_PGM_OLD_PSW 0x0150
  77. #define __LC_MCK_OLD_PSW 0x0160
  78. #define __LC_IO_OLD_PSW 0x0170
  79. #define __LC_EXT_NEW_PSW 0x01b0
  80. #define __LC_SVC_NEW_PSW 0x01c0
  81. #define __LC_PGM_NEW_PSW 0x01d0
  82. #define __LC_MCK_NEW_PSW 0x01e0
  83. #define __LC_IO_NEW_PSW 0x01f0
  84. #define __LC_SAVE_AREA 0x0200
  85. #define __LC_RETURN_PSW 0x0280
  86. #define __LC_RETURN_MCCK_PSW 0x0290
  87. #define __LC_SYNC_ENTER_TIMER 0x02a0
  88. #define __LC_ASYNC_ENTER_TIMER 0x02a8
  89. #define __LC_EXIT_TIMER 0x02b0
  90. #define __LC_USER_TIMER 0x02b8
  91. #define __LC_SYSTEM_TIMER 0x02c0
  92. #define __LC_STEAL_TIMER 0x02c8
  93. #define __LC_LAST_UPDATE_TIMER 0x02d0
  94. #define __LC_LAST_UPDATE_CLOCK 0x02d8
  95. #define __LC_CURRENT 0x02e0
  96. #define __LC_THREAD_INFO 0x02e8
  97. #define __LC_KERNEL_STACK 0x02f0
  98. #define __LC_ASYNC_STACK 0x02f8
  99. #define __LC_PANIC_STACK 0x0300
  100. #define __LC_KERNEL_ASCE 0x0308
  101. #define __LC_USER_ASCE 0x0310
  102. #define __LC_USER_EXEC_ASCE 0x0318
  103. #define __LC_CPUID 0x0320
  104. #define __LC_INT_CLOCK 0x0340
  105. #define __LC_VDSO_PER_CPU 0x0350
  106. #define __LC_IRB 0x0380
  107. #define __LC_PASTE 0x03c0
  108. #define __LC_PFAULT_INTPARM 0x11b8
  109. #define __LC_FPREGS_SAVE_AREA 0x1200
  110. #define __LC_GPREGS_SAVE_AREA 0x1280
  111. #define __LC_PSW_SAVE_AREA 0x1300
  112. #define __LC_PREFIX_SAVE_AREA 0x1318
  113. #define __LC_FP_CREG_SAVE_AREA 0x131c
  114. #define __LC_TODREG_SAVE_AREA 0x1324
  115. #define __LC_CPU_TIMER_SAVE_AREA 0x1328
  116. #define __LC_CLOCK_COMP_SAVE_AREA 0x1331
  117. #define __LC_AREGS_SAVE_AREA 0x1340
  118. #define __LC_CREGS_SAVE_AREA 0x1380
  119. #endif /* __s390x__ */
  120. #ifndef __ASSEMBLY__
  121. #include <asm/processor.h>
  122. #include <linux/types.h>
  123. #include <asm/sigp.h>
  124. void restart_int_handler(void);
  125. void ext_int_handler(void);
  126. void system_call(void);
  127. void pgm_check_handler(void);
  128. void mcck_int_handler(void);
  129. void io_int_handler(void);
  130. struct save_area_s390 {
  131. u32 ext_save;
  132. u64 timer;
  133. u64 clk_cmp;
  134. u8 pad1[24];
  135. u8 psw[8];
  136. u32 pref_reg;
  137. u8 pad2[20];
  138. u32 acc_regs[16];
  139. u64 fp_regs[4];
  140. u32 gp_regs[16];
  141. u32 ctrl_regs[16];
  142. } __attribute__((packed));
  143. struct save_area_s390x {
  144. u64 fp_regs[16];
  145. u64 gp_regs[16];
  146. u8 psw[16];
  147. u8 pad1[8];
  148. u32 pref_reg;
  149. u32 fp_ctrl_reg;
  150. u8 pad2[4];
  151. u32 tod_reg;
  152. u64 timer;
  153. u64 clk_cmp;
  154. u8 pad3[8];
  155. u32 acc_regs[16];
  156. u64 ctrl_regs[16];
  157. } __attribute__((packed));
  158. union save_area {
  159. struct save_area_s390 s390;
  160. struct save_area_s390x s390x;
  161. };
  162. #define SAVE_AREA_BASE_S390 0xd4
  163. #define SAVE_AREA_BASE_S390X 0x1200
  164. #ifndef __s390x__
  165. #define SAVE_AREA_SIZE sizeof(struct save_area_s390)
  166. #define SAVE_AREA_BASE SAVE_AREA_BASE_S390
  167. #else
  168. #define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
  169. #define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
  170. #endif
  171. struct _lowcore
  172. {
  173. #ifndef __s390x__
  174. /* 0x0000 - 0x01ff: defined by architecture */
  175. psw_t restart_psw; /* 0x0000 */
  176. __u32 ccw2[4]; /* 0x0008 */
  177. psw_t external_old_psw; /* 0x0018 */
  178. psw_t svc_old_psw; /* 0x0020 */
  179. psw_t program_old_psw; /* 0x0028 */
  180. psw_t mcck_old_psw; /* 0x0030 */
  181. psw_t io_old_psw; /* 0x0038 */
  182. __u8 pad_0x0040[0x0058-0x0040]; /* 0x0040 */
  183. psw_t external_new_psw; /* 0x0058 */
  184. psw_t svc_new_psw; /* 0x0060 */
  185. psw_t program_new_psw; /* 0x0068 */
  186. psw_t mcck_new_psw; /* 0x0070 */
  187. psw_t io_new_psw; /* 0x0078 */
  188. __u32 ext_params; /* 0x0080 */
  189. __u16 cpu_addr; /* 0x0084 */
  190. __u16 ext_int_code; /* 0x0086 */
  191. __u16 svc_ilc; /* 0x0088 */
  192. __u16 svc_code; /* 0x008a */
  193. __u16 pgm_ilc; /* 0x008c */
  194. __u16 pgm_code; /* 0x008e */
  195. __u32 trans_exc_code; /* 0x0090 */
  196. __u16 mon_class_num; /* 0x0094 */
  197. __u16 per_perc_atmid; /* 0x0096 */
  198. __u32 per_address; /* 0x0098 */
  199. __u32 monitor_code; /* 0x009c */
  200. __u8 exc_access_id; /* 0x00a0 */
  201. __u8 per_access_id; /* 0x00a1 */
  202. __u8 pad_0x00a2[0x00b8-0x00a2]; /* 0x00a2 */
  203. __u16 subchannel_id; /* 0x00b8 */
  204. __u16 subchannel_nr; /* 0x00ba */
  205. __u32 io_int_parm; /* 0x00bc */
  206. __u32 io_int_word; /* 0x00c0 */
  207. __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
  208. __u32 stfl_fac_list; /* 0x00c8 */
  209. __u8 pad_0x00cc[0x00d4-0x00cc]; /* 0x00cc */
  210. __u32 extended_save_area_addr; /* 0x00d4 */
  211. __u32 cpu_timer_save_area[2]; /* 0x00d8 */
  212. __u32 clock_comp_save_area[2]; /* 0x00e0 */
  213. __u32 mcck_interruption_code[2]; /* 0x00e8 */
  214. __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
  215. __u32 external_damage_code; /* 0x00f4 */
  216. __u32 failing_storage_address; /* 0x00f8 */
  217. __u8 pad_0x00fc[0x0100-0x00fc]; /* 0x00fc */
  218. __u32 st_status_fixed_logout[4]; /* 0x0100 */
  219. __u8 pad_0x0110[0x0120-0x0110]; /* 0x0110 */
  220. /* CPU register save area: defined by architecture */
  221. __u32 access_regs_save_area[16]; /* 0x0120 */
  222. __u32 floating_pt_save_area[8]; /* 0x0160 */
  223. __u32 gpregs_save_area[16]; /* 0x0180 */
  224. __u32 cregs_save_area[16]; /* 0x01c0 */
  225. /* Return psws. */
  226. __u32 save_area[16]; /* 0x0200 */
  227. psw_t return_psw; /* 0x0240 */
  228. psw_t return_mcck_psw; /* 0x0248 */
  229. /* CPU time accounting values */
  230. __u64 sync_enter_timer; /* 0x0250 */
  231. __u64 async_enter_timer; /* 0x0258 */
  232. __u64 exit_timer; /* 0x0260 */
  233. __u64 user_timer; /* 0x0268 */
  234. __u64 system_timer; /* 0x0270 */
  235. __u64 steal_timer; /* 0x0278 */
  236. __u64 last_update_timer; /* 0x0280 */
  237. __u64 last_update_clock; /* 0x0288 */
  238. /* Current process. */
  239. __u32 current_task; /* 0x0290 */
  240. __u32 thread_info; /* 0x0294 */
  241. __u32 kernel_stack; /* 0x0298 */
  242. /* Interrupt and panic stack. */
  243. __u32 async_stack; /* 0x029c */
  244. __u32 panic_stack; /* 0x02a0 */
  245. /* Address space pointer. */
  246. __u32 kernel_asce; /* 0x02a4 */
  247. __u32 user_asce; /* 0x02a8 */
  248. __u32 user_exec_asce; /* 0x02ac */
  249. /* SMP info area */
  250. cpuid_t cpu_id; /* 0x02b0 */
  251. __u32 cpu_nr; /* 0x02b8 */
  252. __u32 softirq_pending; /* 0x02bc */
  253. __u32 percpu_offset; /* 0x02c0 */
  254. __u32 ext_call_fast; /* 0x02c4 */
  255. __u64 int_clock; /* 0x02c8 */
  256. __u64 clock_comparator; /* 0x02d0 */
  257. __u8 pad_0x02d8[0x0300-0x02d8]; /* 0x02d8 */
  258. /* Interrupt response block */
  259. __u8 irb[64]; /* 0x0300 */
  260. __u8 pad_0x0400[0x0e00-0x0400]; /* 0x0400 */
  261. /*
  262. * 0xe00 contains the address of the IPL Parameter Information
  263. * block. Dump tools need IPIB for IPL after dump.
  264. * Note: do not change the position of any fields in 0x0e00-0x0f00
  265. */
  266. __u32 ipib; /* 0x0e00 */
  267. __u32 ipib_checksum; /* 0x0e04 */
  268. /* Align to the top 1k of prefix area */
  269. __u8 pad_0x0e08[0x1000-0x0e08]; /* 0x0e08 */
  270. #else /* !__s390x__ */
  271. /* 0x0000 - 0x01ff: defined by architecture */
  272. __u32 ccw1[2]; /* 0x0000 */
  273. __u32 ccw2[4]; /* 0x0008 */
  274. __u8 pad_0x0018[0x0080-0x0018]; /* 0x0018 */
  275. __u32 ext_params; /* 0x0080 */
  276. __u16 cpu_addr; /* 0x0084 */
  277. __u16 ext_int_code; /* 0x0086 */
  278. __u16 svc_ilc; /* 0x0088 */
  279. __u16 svc_code; /* 0x008a */
  280. __u16 pgm_ilc; /* 0x008c */
  281. __u16 pgm_code; /* 0x008e */
  282. __u32 data_exc_code; /* 0x0090 */
  283. __u16 mon_class_num; /* 0x0094 */
  284. __u16 per_perc_atmid; /* 0x0096 */
  285. addr_t per_address; /* 0x0098 */
  286. __u8 exc_access_id; /* 0x00a0 */
  287. __u8 per_access_id; /* 0x00a1 */
  288. __u8 op_access_id; /* 0x00a2 */
  289. __u8 ar_access_id; /* 0x00a3 */
  290. __u8 pad_0x00a4[0x00a8-0x00a4]; /* 0x00a4 */
  291. addr_t trans_exc_code; /* 0x00a8 */
  292. addr_t monitor_code; /* 0x00b0 */
  293. __u16 subchannel_id; /* 0x00b8 */
  294. __u16 subchannel_nr; /* 0x00ba */
  295. __u32 io_int_parm; /* 0x00bc */
  296. __u32 io_int_word; /* 0x00c0 */
  297. __u8 pad_0x00c4[0x00c8-0x00c4]; /* 0x00c4 */
  298. __u32 stfl_fac_list; /* 0x00c8 */
  299. __u8 pad_0x00cc[0x00e8-0x00cc]; /* 0x00cc */
  300. __u32 mcck_interruption_code[2]; /* 0x00e8 */
  301. __u8 pad_0x00f0[0x00f4-0x00f0]; /* 0x00f0 */
  302. __u32 external_damage_code; /* 0x00f4 */
  303. addr_t failing_storage_address; /* 0x00f8 */
  304. __u8 pad_0x0100[0x0120-0x0100]; /* 0x0100 */
  305. psw_t restart_old_psw; /* 0x0120 */
  306. psw_t external_old_psw; /* 0x0130 */
  307. psw_t svc_old_psw; /* 0x0140 */
  308. psw_t program_old_psw; /* 0x0150 */
  309. psw_t mcck_old_psw; /* 0x0160 */
  310. psw_t io_old_psw; /* 0x0170 */
  311. __u8 pad_0x0180[0x01a0-0x0180]; /* 0x0180 */
  312. psw_t restart_psw; /* 0x01a0 */
  313. psw_t external_new_psw; /* 0x01b0 */
  314. psw_t svc_new_psw; /* 0x01c0 */
  315. psw_t program_new_psw; /* 0x01d0 */
  316. psw_t mcck_new_psw; /* 0x01e0 */
  317. psw_t io_new_psw; /* 0x01f0 */
  318. /* Entry/exit save area & return psws. */
  319. __u64 save_area[16]; /* 0x0200 */
  320. psw_t return_psw; /* 0x0280 */
  321. psw_t return_mcck_psw; /* 0x0290 */
  322. /* CPU accounting and timing values. */
  323. __u64 sync_enter_timer; /* 0x02a0 */
  324. __u64 async_enter_timer; /* 0x02a8 */
  325. __u64 exit_timer; /* 0x02b0 */
  326. __u64 user_timer; /* 0x02b8 */
  327. __u64 system_timer; /* 0x02c0 */
  328. __u64 steal_timer; /* 0x02c8 */
  329. __u64 last_update_timer; /* 0x02d0 */
  330. __u64 last_update_clock; /* 0x02d8 */
  331. /* Current process. */
  332. __u64 current_task; /* 0x02e0 */
  333. __u64 thread_info; /* 0x02e8 */
  334. __u64 kernel_stack; /* 0x02f0 */
  335. /* Interrupt and panic stack. */
  336. __u64 async_stack; /* 0x02f8 */
  337. __u64 panic_stack; /* 0x0300 */
  338. /* Address space pointer. */
  339. __u64 kernel_asce; /* 0x0308 */
  340. __u64 user_asce; /* 0x0310 */
  341. __u64 user_exec_asce; /* 0x0318 */
  342. /* SMP info area */
  343. cpuid_t cpu_id; /* 0x0320 */
  344. __u32 cpu_nr; /* 0x0328 */
  345. __u32 softirq_pending; /* 0x032c */
  346. __u64 percpu_offset; /* 0x0330 */
  347. __u64 ext_call_fast; /* 0x0338 */
  348. __u64 int_clock; /* 0x0340 */
  349. __u64 clock_comparator; /* 0x0348 */
  350. __u64 vdso_per_cpu_data; /* 0x0350 */
  351. __u8 pad_0x0358[0x0380-0x0358]; /* 0x0358 */
  352. /* Interrupt response block. */
  353. __u8 irb[64]; /* 0x0380 */
  354. /* Per cpu primary space access list */
  355. __u32 paste[16]; /* 0x03c0 */
  356. __u8 pad_0x0400[0x0e00-0x0400]; /* 0x0400 */
  357. /*
  358. * 0xe00 contains the address of the IPL Parameter Information
  359. * block. Dump tools need IPIB for IPL after dump.
  360. * Note: do not change the position of any fields in 0x0e00-0x0f00
  361. */
  362. __u64 ipib; /* 0x0e00 */
  363. __u32 ipib_checksum; /* 0x0e08 */
  364. __u8 pad_0x0e0c[0x11b8-0x0e0c]; /* 0x0e0c */
  365. /* 64 bit extparam used for pfault/diag 250: defined by architecture */
  366. __u64 ext_params2; /* 0x11B8 */
  367. __u8 pad_0x11c0[0x1200-0x11C0]; /* 0x11C0 */
  368. /* CPU register save area: defined by architecture */
  369. __u64 floating_pt_save_area[16]; /* 0x1200 */
  370. __u64 gpregs_save_area[16]; /* 0x1280 */
  371. __u32 st_status_fixed_logout[4]; /* 0x1300 */
  372. __u8 pad_0x1310[0x1318-0x1310]; /* 0x1310 */
  373. __u32 prefixreg_save_area; /* 0x1318 */
  374. __u32 fpt_creg_save_area; /* 0x131c */
  375. __u8 pad_0x1320[0x1324-0x1320]; /* 0x1320 */
  376. __u32 tod_progreg_save_area; /* 0x1324 */
  377. __u32 cpu_timer_save_area[2]; /* 0x1328 */
  378. __u32 clock_comp_save_area[2]; /* 0x1330 */
  379. __u8 pad_0x1338[0x1340-0x1338]; /* 0x1338 */
  380. __u32 access_regs_save_area[16]; /* 0x1340 */
  381. __u64 cregs_save_area[16]; /* 0x1380 */
  382. /* align to the top of the prefix area */
  383. __u8 pad_0x1400[0x2000-0x1400]; /* 0x1400 */
  384. #endif /* !__s390x__ */
  385. } __attribute__((packed)); /* End structure*/
  386. #define S390_lowcore (*((struct _lowcore *) 0))
  387. extern struct _lowcore *lowcore_ptr[];
  388. static inline void set_prefix(__u32 address)
  389. {
  390. asm volatile("spx %0" : : "m" (address) : "memory");
  391. }
  392. static inline __u32 store_prefix(void)
  393. {
  394. __u32 address;
  395. asm volatile("stpx %0" : "=m" (address));
  396. return address;
  397. }
  398. #endif
  399. #endif