1 #ifndef _ASM_S390X_S390_H
2 #define _ASM_S390X_S390_H
3 
4 #include <linux/config.h>
5 #include <linux/socket.h>
6 #include <linux/nfs_fs.h>
7 #include <linux/sunrpc/svc.h>
8 #include <linux/nfsd/nfsd.h>
9 #include <linux/nfsd/export.h>
10 
11 #ifdef CONFIG_S390_SUPPORT
12 
13 /* Macro that masks the high order bit of an 32 bit pointer and converts it*/
14 /*       to a 64 bit pointer */
15 #define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL))
16 #define AA(__x)				\
17 	((unsigned long)(__x))
18 
19 /* Now 32bit compatibility types */
20 typedef unsigned int           __kernel_size_t32;
21 typedef int                    __kernel_ssize_t32;
22 typedef int                    __kernel_ptrdiff_t32;
23 typedef int                    __kernel_time_t32;
24 typedef int                    __kernel_clock_t32;
25 typedef int                    __kernel_pid_t32;
26 typedef unsigned short         __kernel_ipc_pid_t32;
27 typedef unsigned short         __kernel_uid_t32;
28 typedef unsigned short         __kernel_gid_t32;
29 typedef unsigned short         __kernel_dev_t32;
30 typedef unsigned int           __kernel_ino_t32;
31 typedef unsigned short         __kernel_mode_t32;
32 typedef unsigned short         __kernel_umode_t32;
33 typedef short                  __kernel_nlink_t32;
34 typedef int                    __kernel_daddr_t32;
35 typedef int                    __kernel_off_t32;
36 typedef unsigned int           __kernel_caddr_t32;
37 typedef long                   __kernel_loff_t32;
38 typedef __kernel_fsid_t        __kernel_fsid_t32;
39 
40 struct ipc_kludge_32 {
41         __u32   msgp;                           /* pointer              */
42         __s32   msgtyp;
43 };
44 
45 #define F_GETLK64       12
46 #define F_SETLK64       13
47 #define F_SETLKW64      14
48 
49 struct flock32 {
50         short l_type;
51         short l_whence;
52         __kernel_off_t32 l_start;
53         __kernel_off_t32 l_len;
54         __kernel_pid_t32 l_pid;
55         short __unused;
56 };
57 
58 struct stat32 {
59 	unsigned short	st_dev;
60 	unsigned short	__pad1;
61 	__u32		st_ino;
62 	unsigned short	st_mode;
63 	unsigned short	st_nlink;
64 	unsigned short	st_uid;
65 	unsigned short	st_gid;
66 	unsigned short	st_rdev;
67 	unsigned short	__pad2;
68 	__u32		st_size;
69 	__u32		st_blksize;
70 	__u32		st_blocks;
71 	__u32		st_atime;
72 	__u32		__unused1;
73 	__u32		st_mtime;
74 	__u32		__unused2;
75 	__u32		st_ctime;
76 	__u32		__unused3;
77 	__u32		__unused4;
78 	__u32		__unused5;
79 };
80 
81 struct statfs32 {
82 	__s32			f_type;
83 	__s32			f_bsize;
84 	__s32			f_blocks;
85 	__s32			f_bfree;
86 	__s32			f_bavail;
87 	__s32			f_files;
88 	__s32			f_ffree;
89 	__kernel_fsid_t		f_fsid;
90 	__s32			f_namelen;
91 	__s32			f_spare[6];
92 };
93 
94 typedef __u32 old_sigset_t32;       /* at least 32 bits */
95 
96 struct old_sigaction32 {
97        __u32			sa_handler;	/* Really a pointer, but need to deal with 32 bits */
98        old_sigset_t32		sa_mask;	/* A 32 bit mask */
99        __u32			sa_flags;
100        __u32			sa_restorer;	/* Another 32 bit pointer */
101 };
102 
103 #define _SIGCONTEXT_NSIG_WORDS32    2
104 typedef struct {
105         __u32   sig[_SIGCONTEXT_NSIG_WORDS32];
106 } sigset_t32;
107 
108 typedef union sigval32 {
109         int     sival_int;
110         __u32   sival_ptr;
111 } sigval_t32;
112 
113 typedef struct siginfo32 {
114 	int	si_signo;
115 	int	si_errno;
116 	int	si_code;
117 
118 	union {
119 		int _pad[((128/sizeof(int)) - 3)];
120 
121 		/* kill() */
122 		struct {
123 			pid_t	_pid;	/* sender's pid */
124 			uid_t	_uid;	/* sender's uid */
125 		} _kill;
126 
127 		/* POSIX.1b timers */
128 		struct {
129 			unsigned int	_timer1;
130 			unsigned int	_timer2;
131 
132 		} _timer;
133 
134 		/* POSIX.1b signals */
135 		struct {
136 			pid_t			_pid;	/* sender's pid */
137 			uid_t			_uid;	/* sender's uid */
138 			sigval_t32		_sigval;
139 		} _rt;
140 
141 		/* SIGCHLD */
142 		struct {
143 			pid_t			_pid;	/* which child */
144 			uid_t			_uid;	/* sender's uid */
145 			int			_status;/* exit code */
146 			__kernel_clock_t32	_utime;
147 			__kernel_clock_t32	_stime;
148 		} _sigchld;
149 
150 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
151 		struct {
152 			__u32	_addr;	/* faulting insn/memory ref. - pointer */
153 		} _sigfault;
154 
155 		/* SIGPOLL */
156 		struct {
157 			int	_band;	/* POLL_IN, POLL_OUT, POLL_MSG */
158 			int	_fd;
159 		} _sigpoll;
160 	} _sifields;
161 } siginfo_t32;
162 
163 /*
164  * How these fields are to be accessed.
165  */
166 #define si_pid		_sifields._kill._pid
167 #define si_uid		_sifields._kill._uid
168 #define si_status	_sifields._sigchld._status
169 #define si_utime	_sifields._sigchld._utime
170 #define si_stime	_sifields._sigchld._stime
171 #define si_value	_sifields._rt._sigval
172 #define si_int		_sifields._rt._sigval.sival_int
173 #define si_ptr		_sifields._rt._sigval.sival_ptr
174 #define si_addr		_sifields._sigfault._addr
175 #define si_band		_sifields._sigpoll._band
176 #define si_fd		_sifields._sigpoll._fd
177 
178 /* asm/sigcontext.h */
179 typedef union
180 {
181 	__u64   d;
182 	__u32   f;
183 } freg_t32;
184 
185 typedef struct
186 {
187 	unsigned int	fpc;
188 	freg_t32	fprs[__NUM_FPRS];
189 } _s390_fp_regs32;
190 
191 typedef struct
192 {
193         __u32   mask;
194         __u32	addr;
195 } _psw_t32 __attribute__ ((aligned(8)));
196 
197 typedef struct
198 {
199 	_psw_t32	psw;
200 	__u32		gprs[__NUM_GPRS];
201 	__u32		acrs[__NUM_ACRS];
202 } _s390_regs_common32;
203 
204 typedef struct
205 {
206 	_s390_regs_common32 regs;
207 	_s390_fp_regs32     fpregs;
208 } _sigregs32;
209 
210 #define _SIGCONTEXT_NSIG32	64
211 #define _SIGCONTEXT_NSIG_BPW32	32
212 #define __SIGNAL_FRAMESIZE32	96
213 #define _SIGMASK_COPY_SIZE32	(sizeof(u32)*2)
214 
215 struct sigcontext32
216 {
217 	__u32	oldmask[_SIGCONTEXT_NSIG_WORDS32];
218 	__u32	sregs;				/* pointer */
219 };
220 
221 /* asm/signal.h */
222 struct sigaction32 {
223 	__u32		sa_handler;		/* pointer */
224 	__u32		sa_flags;
225         __u32		sa_restorer;		/* pointer */
226 	sigset_t32	sa_mask;        /* mask last for extensibility */
227 };
228 
229 typedef struct {
230 	__u32			ss_sp;		/* pointer */
231 	int			ss_flags;
232 	__kernel_size_t32	ss_size;
233 } stack_t32;
234 
235 /* asm/ucontext.h */
236 struct ucontext32 {
237 	__u32			uc_flags;
238 	__u32			uc_link;	/* pointer */
239 	stack_t32		uc_stack;
240 	_sigregs32		uc_mcontext;
241 	sigset_t32		uc_sigmask;	/* mask last for extensibility */
242 };
243 
244 #endif /* !CONFIG_S390_SUPPORT */
245 
246 #endif /* _ASM_S390X_S390_H */
247