1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 *  Copyright IBM Corp. 2006
4 *  Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
5 */
6#ifndef __S390_STP_H
7#define __S390_STP_H
8
9#include <linux/compiler.h>
10
11/* notifier for syncs */
12extern struct atomic_notifier_head s390_epoch_delta_notifier;
13
14/* STP interruption parameter */
15struct stp_irq_parm {
16	u32		: 14;
17	u32 tsc		:  1;	/* Timing status change */
18	u32 lac		:  1;	/* Link availability change */
19	u32 tcpc	:  1;	/* Time control parameter change */
20	u32		: 15;
21} __packed;
22
23#define STP_OP_SYNC	1
24#define STP_OP_CTRL	3
25
26struct stp_sstpi {
27	u32		: 32;
28	u32 tu		:  1;
29	u32 lu		:  1;
30	u32		:  6;
31	u32 stratum	:  8;
32	u32 vbits	: 16;
33	u32 leaps	: 16;
34	u32 tmd		:  4;
35	u32 ctn		:  4;
36	u32		:  3;
37	u32 c		:  1;
38	u32 tst		:  4;
39	u32 tzo		: 16;
40	u32 dsto	: 16;
41	u32 ctrl	: 16;
42	u32		: 16;
43	u32 tto;
44	u32		: 32;
45	u32 ctnid[3];
46	u32		: 32;
47	u64 todoff;
48	u32 rsvd[50];
49} __packed;
50
51struct stp_tzib {
52	u32 tzan	: 16;
53	u32		: 16;
54	u32 tzo		: 16;
55	u32 dsto	: 16;
56	u32 stn;
57	u32 dstn;
58	u64 dst_on_alg;
59	u64 dst_off_alg;
60} __packed;
61
62struct stp_tcpib {
63	u32 atcode	: 4;
64	u32 ntcode	: 4;
65	u32 d		: 1;
66	u32		: 23;
67	s32 tto;
68	struct stp_tzib atzib;
69	struct stp_tzib ntzib;
70	s32 adst_offset : 16;
71	s32 ndst_offset : 16;
72	u32 rsvd1;
73	u64 ntzib_update;
74	u64 ndsto_update;
75} __packed;
76
77struct stp_lsoib {
78	u32 p		: 1;
79	u32		: 31;
80	s32 also	: 16;
81	s32 nlso	: 16;
82	u64 nlsout;
83} __packed;
84
85struct stp_stzi {
86	u32 rsvd0[3];
87	u64 data_ts;
88	u32 rsvd1[22];
89	struct stp_tcpib tcpib;
90	struct stp_lsoib lsoib;
91} __packed;
92
93/* Functions needed by the machine check handler */
94int stp_sync_check(void);
95int stp_island_check(void);
96void stp_queue_work(void);
97
98#endif /* __S390_STP_H */
99