aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/uapi
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2012-10-09 08:18:10 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-10-09 08:18:10 -0400
commitab08ff34b44f752b664ebb312d2e110cf37a7f5e (patch)
tree80579bb79480ac303cad99c359549d4e86bcc773 /arch/s390/include/uapi
parent450e47da67499aeb6f1700e8f84747460c11ab56 (diff)
parent9807f75955ea7f1877981056755284481873115c (diff)
Merge tag 'disintegrate-s390-20121009' of
git://git.infradead.org/users/dhowells/linux-headers Pull UAPI patchset from David Howells: "Can you merge the following branch into the s390 tree please. This is to complete part of the UAPI disintegration for which the preparatory patches were pulled recently." Conflicts: arch/s390/include/asm/chpid.h
Diffstat (limited to 'arch/s390/include/uapi')
-rw-r--r--arch/s390/include/uapi/asm/Kbuild45
-rw-r--r--arch/s390/include/uapi/asm/auxvec.h6
-rw-r--r--arch/s390/include/uapi/asm/bitsperlong.h13
-rw-r--r--arch/s390/include/uapi/asm/byteorder.h6
-rw-r--r--arch/s390/include/uapi/asm/chpid.h22
-rw-r--r--arch/s390/include/uapi/asm/chsc.h130
-rw-r--r--arch/s390/include/uapi/asm/cmb.h53
-rw-r--r--arch/s390/include/uapi/asm/dasd.h291
-rw-r--r--arch/s390/include/uapi/asm/debug.h34
-rw-r--r--arch/s390/include/uapi/asm/errno.h11
-rw-r--r--arch/s390/include/uapi/asm/fcntl.h1
-rw-r--r--arch/s390/include/uapi/asm/ioctl.h1
-rw-r--r--arch/s390/include/uapi/asm/ioctls.h8
-rw-r--r--arch/s390/include/uapi/asm/ipcbuf.h31
-rw-r--r--arch/s390/include/uapi/asm/kvm.h60
-rw-r--r--arch/s390/include/uapi/asm/kvm_para.h0
-rw-r--r--arch/s390/include/uapi/asm/kvm_virtio.h64
-rw-r--r--arch/s390/include/uapi/asm/mman.h6
-rw-r--r--arch/s390/include/uapi/asm/monwriter.h31
-rw-r--r--arch/s390/include/uapi/asm/msgbuf.h37
-rw-r--r--arch/s390/include/uapi/asm/param.h6
-rw-r--r--arch/s390/include/uapi/asm/poll.h1
-rw-r--r--arch/s390/include/uapi/asm/posix_types.h51
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h472
-rw-r--r--arch/s390/include/uapi/asm/qeth.h115
-rw-r--r--arch/s390/include/uapi/asm/resource.h13
-rw-r--r--arch/s390/include/uapi/asm/schid.h16
-rw-r--r--arch/s390/include/uapi/asm/sembuf.h29
-rw-r--r--arch/s390/include/uapi/asm/setup.h13
-rw-r--r--arch/s390/include/uapi/asm/shmbuf.h48
-rw-r--r--arch/s390/include/uapi/asm/sigcontext.h69
-rw-r--r--arch/s390/include/uapi/asm/siginfo.h16
-rw-r--r--arch/s390/include/uapi/asm/signal.h135
-rw-r--r--arch/s390/include/uapi/asm/socket.h78
-rw-r--r--arch/s390/include/uapi/asm/sockios.h6
-rw-r--r--arch/s390/include/uapi/asm/stat.h103
-rw-r--r--arch/s390/include/uapi/asm/statfs.h69
-rw-r--r--arch/s390/include/uapi/asm/swab.h89
-rw-r--r--arch/s390/include/uapi/asm/tape390.h102
-rw-r--r--arch/s390/include/uapi/asm/termbits.h6
-rw-r--r--arch/s390/include/uapi/asm/termios.h49
-rw-r--r--arch/s390/include/uapi/asm/types.h22
-rw-r--r--arch/s390/include/uapi/asm/ucontext.h33
-rw-r--r--arch/s390/include/uapi/asm/unistd.h374
-rw-r--r--arch/s390/include/uapi/asm/vtoc.h213
-rw-r--r--arch/s390/include/uapi/asm/zcrypt.h276
46 files changed, 3254 insertions, 0 deletions
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index baebb3da1d44..7bf68fff7c5d 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -1,3 +1,48 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += auxvec.h
5header-y += bitsperlong.h
6header-y += byteorder.h
7header-y += chpid.h
8header-y += chsc.h
9header-y += cmb.h
10header-y += dasd.h
11header-y += debug.h
12header-y += errno.h
13header-y += fcntl.h
14header-y += ioctl.h
15header-y += ioctls.h
16header-y += ipcbuf.h
17header-y += kvm.h
18header-y += kvm_para.h
19header-y += kvm_virtio.h
20header-y += mman.h
21header-y += monwriter.h
22header-y += msgbuf.h
23header-y += param.h
24header-y += poll.h
25header-y += posix_types.h
26header-y += ptrace.h
27header-y += qeth.h
28header-y += resource.h
29header-y += schid.h
30header-y += sembuf.h
31header-y += setup.h
32header-y += shmbuf.h
33header-y += sigcontext.h
34header-y += siginfo.h
35header-y += signal.h
36header-y += socket.h
37header-y += sockios.h
38header-y += stat.h
39header-y += statfs.h
40header-y += swab.h
41header-y += tape390.h
42header-y += termbits.h
43header-y += termios.h
44header-y += types.h
45header-y += ucontext.h
46header-y += unistd.h
47header-y += vtoc.h
48header-y += zcrypt.h
diff --git a/arch/s390/include/uapi/asm/auxvec.h b/arch/s390/include/uapi/asm/auxvec.h
new file mode 100644
index 000000000000..a1f153e89133
--- /dev/null
+++ b/arch/s390/include/uapi/asm/auxvec.h
@@ -0,0 +1,6 @@
1#ifndef __ASMS390_AUXVEC_H
2#define __ASMS390_AUXVEC_H
3
4#define AT_SYSINFO_EHDR 33
5
6#endif
diff --git a/arch/s390/include/uapi/asm/bitsperlong.h b/arch/s390/include/uapi/asm/bitsperlong.h
new file mode 100644
index 000000000000..6b235aea9c66
--- /dev/null
+++ b/arch/s390/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_S390_BITSPERLONG_H
2#define __ASM_S390_BITSPERLONG_H
3
4#ifndef __s390x__
5#define __BITS_PER_LONG 32
6#else
7#define __BITS_PER_LONG 64
8#endif
9
10#include <asm-generic/bitsperlong.h>
11
12#endif /* __ASM_S390_BITSPERLONG_H */
13
diff --git a/arch/s390/include/uapi/asm/byteorder.h b/arch/s390/include/uapi/asm/byteorder.h
new file mode 100644
index 000000000000..a332e59e26fc
--- /dev/null
+++ b/arch/s390/include/uapi/asm/byteorder.h
@@ -0,0 +1,6 @@
1#ifndef _S390_BYTEORDER_H
2#define _S390_BYTEORDER_H
3
4#include <linux/byteorder/big_endian.h>
5
6#endif /* _S390_BYTEORDER_H */
diff --git a/arch/s390/include/uapi/asm/chpid.h b/arch/s390/include/uapi/asm/chpid.h
new file mode 100644
index 000000000000..581992dfae27
--- /dev/null
+++ b/arch/s390/include/uapi/asm/chpid.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright IBM Corp. 2007
3 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
4 */
5
6#ifndef _UAPI_ASM_S390_CHPID_H
7#define _UAPI_ASM_S390_CHPID_H
8
9#include <linux/string.h>
10#include <linux/types.h>
11
12#define __MAX_CHPID 255
13
14struct chp_id {
15 u8 reserved1;
16 u8 cssid;
17 u8 reserved2;
18 u8 id;
19} __attribute__((packed));
20
21
22#endif /* _UAPI_ASM_S390_CHPID_H */
diff --git a/arch/s390/include/uapi/asm/chsc.h b/arch/s390/include/uapi/asm/chsc.h
new file mode 100644
index 000000000000..1c6a7f85a581
--- /dev/null
+++ b/arch/s390/include/uapi/asm/chsc.h
@@ -0,0 +1,130 @@
1/*
2 * ioctl interface for /dev/chsc
3 *
4 * Copyright IBM Corp. 2008, 2012
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 */
7
8#ifndef _ASM_CHSC_H
9#define _ASM_CHSC_H
10
11#include <linux/types.h>
12#include <linux/ioctl.h>
13#include <asm/chpid.h>
14#include <asm/schid.h>
15
16#define CHSC_SIZE 0x1000
17
18struct chsc_async_header {
19 __u16 length;
20 __u16 code;
21 __u32 cmd_dependend;
22 __u32 key : 4;
23 __u32 : 28;
24 struct subchannel_id sid;
25} __attribute__ ((packed));
26
27struct chsc_async_area {
28 struct chsc_async_header header;
29 __u8 data[CHSC_SIZE - sizeof(struct chsc_async_header)];
30} __attribute__ ((packed));
31
32struct chsc_response_struct {
33 __u16 length;
34 __u16 code;
35 __u32 parms;
36 __u8 data[CHSC_SIZE - 2 * sizeof(__u16) - sizeof(__u32)];
37} __attribute__ ((packed));
38
39struct chsc_chp_cd {
40 struct chp_id chpid;
41 int m;
42 int fmt;
43 struct chsc_response_struct cpcb;
44};
45
46struct chsc_cu_cd {
47 __u16 cun;
48 __u8 cssid;
49 int m;
50 int fmt;
51 struct chsc_response_struct cucb;
52};
53
54struct chsc_sch_cud {
55 struct subchannel_id schid;
56 int fmt;
57 struct chsc_response_struct scub;
58};
59
60struct conf_id {
61 int m;
62 __u8 cssid;
63 __u8 ssid;
64};
65
66struct chsc_conf_info {
67 struct conf_id id;
68 int fmt;
69 struct chsc_response_struct scid;
70};
71
72struct ccl_parm_chpid {
73 int m;
74 struct chp_id chp;
75};
76
77struct ccl_parm_cssids {
78 __u8 f_cssid;
79 __u8 l_cssid;
80};
81
82struct chsc_comp_list {
83 struct {
84 enum {
85 CCL_CU_ON_CHP = 1,
86 CCL_CHP_TYPE_CAP = 2,
87 CCL_CSS_IMG = 4,
88 CCL_CSS_IMG_CONF_CHAR = 5,
89 CCL_IOP_CHP = 6,
90 } ctype;
91 int fmt;
92 struct ccl_parm_chpid chpid;
93 struct ccl_parm_cssids cssids;
94 } req;
95 struct chsc_response_struct sccl;
96};
97
98struct chsc_dcal {
99 struct {
100 enum {
101 DCAL_CSS_IID_PN = 4,
102 } atype;
103 __u32 list_parm[2];
104 int fmt;
105 } req;
106 struct chsc_response_struct sdcal;
107};
108
109struct chsc_cpd_info {
110 struct chp_id chpid;
111 int m;
112 int fmt;
113 int rfmt;
114 int c;
115 struct chsc_response_struct chpdb;
116};
117
118#define CHSC_IOCTL_MAGIC 'c'
119
120#define CHSC_START _IOWR(CHSC_IOCTL_MAGIC, 0x81, struct chsc_async_area)
121#define CHSC_INFO_CHANNEL_PATH _IOWR(CHSC_IOCTL_MAGIC, 0x82, \
122 struct chsc_chp_cd)
123#define CHSC_INFO_CU _IOWR(CHSC_IOCTL_MAGIC, 0x83, struct chsc_cu_cd)
124#define CHSC_INFO_SCH_CU _IOWR(CHSC_IOCTL_MAGIC, 0x84, struct chsc_sch_cud)
125#define CHSC_INFO_CI _IOWR(CHSC_IOCTL_MAGIC, 0x85, struct chsc_conf_info)
126#define CHSC_INFO_CCL _IOWR(CHSC_IOCTL_MAGIC, 0x86, struct chsc_comp_list)
127#define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info)
128#define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal)
129
130#endif
diff --git a/arch/s390/include/uapi/asm/cmb.h b/arch/s390/include/uapi/asm/cmb.h
new file mode 100644
index 000000000000..0c086d00d89e
--- /dev/null
+++ b/arch/s390/include/uapi/asm/cmb.h
@@ -0,0 +1,53 @@
1#ifndef _UAPIS390_CMB_H
2#define _UAPIS390_CMB_H
3
4#include <linux/types.h>
5
6/**
7 * struct cmbdata - channel measurement block data for user space
8 * @size: size of the stored data
9 * @elapsed_time: time since last sampling
10 * @ssch_rsch_count: number of ssch and rsch
11 * @sample_count: number of samples
12 * @device_connect_time: time of device connect
13 * @function_pending_time: time of function pending
14 * @device_disconnect_time: time of device disconnect
15 * @control_unit_queuing_time: time of control unit queuing
16 * @device_active_only_time: time of device active only
17 * @device_busy_time: time of device busy (ext. format)
18 * @initial_command_response_time: initial command response time (ext. format)
19 *
20 * All values are stored as 64 bit for simplicity, especially
21 * in 32 bit emulation mode. All time values are normalized to
22 * nanoseconds.
23 * Currently, two formats are known, which differ by the size of
24 * this structure, i.e. the last two members are only set when
25 * the extended channel measurement facility (first shipped in
26 * z990 machines) is activated.
27 * Potentially, more fields could be added, which would result in a
28 * new ioctl number.
29 */
30struct cmbdata {
31 __u64 size;
32 __u64 elapsed_time;
33 /* basic and exended format: */
34 __u64 ssch_rsch_count;
35 __u64 sample_count;
36 __u64 device_connect_time;
37 __u64 function_pending_time;
38 __u64 device_disconnect_time;
39 __u64 control_unit_queuing_time;
40 __u64 device_active_only_time;
41 /* extended format only: */
42 __u64 device_busy_time;
43 __u64 initial_command_response_time;
44};
45
46/* enable channel measurement */
47#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER, 32)
48/* enable channel measurement */
49#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER, 33)
50/* read channel measurement data */
51#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER, 33, struct cmbdata)
52
53#endif /* _UAPIS390_CMB_H */
diff --git a/arch/s390/include/uapi/asm/dasd.h b/arch/s390/include/uapi/asm/dasd.h
new file mode 100644
index 000000000000..38eca3ba40e2
--- /dev/null
+++ b/arch/s390/include/uapi/asm/dasd.h
@@ -0,0 +1,291 @@
1/*
2 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
3 * Bugreports.to..: <Linux390@de.ibm.com>
4 * Copyright IBM Corp. 1999, 2000
5 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
6 * Author.........: Nigel Hislop <hislop_nigel@emc.com>
7 *
8 * This file is the interface of the DASD device driver, which is exported to user space
9 * any future changes wrt the API will result in a change of the APIVERSION reported
10 * to userspace by the DASDAPIVER-ioctl
11 *
12 */
13
14#ifndef DASD_H
15#define DASD_H
16#include <linux/types.h>
17#include <linux/ioctl.h>
18
19#define DASD_IOCTL_LETTER 'D'
20
21#define DASD_API_VERSION 6
22
23/*
24 * struct dasd_information2_t
25 * represents any data about the device, which is visible to userspace.
26 * including foramt and featueres.
27 */
28typedef struct dasd_information2_t {
29 unsigned int devno; /* S/390 devno */
30 unsigned int real_devno; /* for aliases */
31 unsigned int schid; /* S/390 subchannel identifier */
32 unsigned int cu_type : 16; /* from SenseID */
33 unsigned int cu_model : 8; /* from SenseID */
34 unsigned int dev_type : 16; /* from SenseID */
35 unsigned int dev_model : 8; /* from SenseID */
36 unsigned int open_count;
37 unsigned int req_queue_len;
38 unsigned int chanq_len; /* length of chanq */
39 char type[4]; /* from discipline.name, 'none' for unknown */
40 unsigned int status; /* current device level */
41 unsigned int label_block; /* where to find the VOLSER */
42 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
43 unsigned int characteristics_size;
44 unsigned int confdata_size;
45 char characteristics[64]; /* from read_device_characteristics */
46 char configuration_data[256]; /* from read_configuration_data */
47 unsigned int format; /* format info like formatted/cdl/ldl/... */
48 unsigned int features; /* dasd features like 'ro',... */
49 unsigned int reserved0; /* reserved for further use ,... */
50 unsigned int reserved1; /* reserved for further use ,... */
51 unsigned int reserved2; /* reserved for further use ,... */
52 unsigned int reserved3; /* reserved for further use ,... */
53 unsigned int reserved4; /* reserved for further use ,... */
54 unsigned int reserved5; /* reserved for further use ,... */
55 unsigned int reserved6; /* reserved for further use ,... */
56 unsigned int reserved7; /* reserved for further use ,... */
57} dasd_information2_t;
58
59/*
60 * values to be used for dasd_information_t.format
61 * 0x00: NOT formatted
62 * 0x01: Linux disc layout
63 * 0x02: Common disc layout
64 */
65#define DASD_FORMAT_NONE 0
66#define DASD_FORMAT_LDL 1
67#define DASD_FORMAT_CDL 2
68/*
69 * values to be used for dasd_information_t.features
70 * 0x00: default features
71 * 0x01: readonly (ro)
72 * 0x02: use diag discipline (diag)
73 * 0x04: set the device initially online (internal use only)
74 * 0x08: enable ERP related logging
75 * 0x20: give access to raw eckd data
76 */
77#define DASD_FEATURE_DEFAULT 0x00
78#define DASD_FEATURE_READONLY 0x01
79#define DASD_FEATURE_USEDIAG 0x02
80#define DASD_FEATURE_INITIAL_ONLINE 0x04
81#define DASD_FEATURE_ERPLOG 0x08
82#define DASD_FEATURE_FAILFAST 0x10
83#define DASD_FEATURE_FAILONSLCK 0x20
84#define DASD_FEATURE_USERAW 0x40
85
86#define DASD_PARTN_BITS 2
87
88/*
89 * struct dasd_information_t
90 * represents any data about the data, which is visible to userspace
91 */
92typedef struct dasd_information_t {
93 unsigned int devno; /* S/390 devno */
94 unsigned int real_devno; /* for aliases */
95 unsigned int schid; /* S/390 subchannel identifier */
96 unsigned int cu_type : 16; /* from SenseID */
97 unsigned int cu_model : 8; /* from SenseID */
98 unsigned int dev_type : 16; /* from SenseID */
99 unsigned int dev_model : 8; /* from SenseID */
100 unsigned int open_count;
101 unsigned int req_queue_len;
102 unsigned int chanq_len; /* length of chanq */
103 char type[4]; /* from discipline.name, 'none' for unknown */
104 unsigned int status; /* current device level */
105 unsigned int label_block; /* where to find the VOLSER */
106 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
107 unsigned int characteristics_size;
108 unsigned int confdata_size;
109 char characteristics[64]; /* from read_device_characteristics */
110 char configuration_data[256]; /* from read_configuration_data */
111} dasd_information_t;
112
113/*
114 * Read Subsystem Data - Performance Statistics
115 */
116typedef struct dasd_rssd_perf_stats_t {
117 unsigned char invalid:1;
118 unsigned char format:3;
119 unsigned char data_format:4;
120 unsigned char unit_address;
121 unsigned short device_status;
122 unsigned int nr_read_normal;
123 unsigned int nr_read_normal_hits;
124 unsigned int nr_write_normal;
125 unsigned int nr_write_fast_normal_hits;
126 unsigned int nr_read_seq;
127 unsigned int nr_read_seq_hits;
128 unsigned int nr_write_seq;
129 unsigned int nr_write_fast_seq_hits;
130 unsigned int nr_read_cache;
131 unsigned int nr_read_cache_hits;
132 unsigned int nr_write_cache;
133 unsigned int nr_write_fast_cache_hits;
134 unsigned int nr_inhibit_cache;
135 unsigned int nr_bybass_cache;
136 unsigned int nr_seq_dasd_to_cache;
137 unsigned int nr_dasd_to_cache;
138 unsigned int nr_cache_to_dasd;
139 unsigned int nr_delayed_fast_write;
140 unsigned int nr_normal_fast_write;
141 unsigned int nr_seq_fast_write;
142 unsigned int nr_cache_miss;
143 unsigned char status2;
144 unsigned int nr_quick_write_promotes;
145 unsigned char reserved;
146 unsigned short ssid;
147 unsigned char reseved2[96];
148} __attribute__((packed)) dasd_rssd_perf_stats_t;
149
150/*
151 * struct profile_info_t
152 * holds the profinling information
153 */
154typedef struct dasd_profile_info_t {
155 unsigned int dasd_io_reqs; /* number of requests processed at all */
156 unsigned int dasd_io_sects; /* number of sectors processed at all */
157 unsigned int dasd_io_secs[32]; /* histogram of request's sizes */
158 unsigned int dasd_io_times[32]; /* histogram of requests's times */
159 unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */
160 unsigned int dasd_io_time1[32]; /* histogram of time from build to start */
161 unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */
162 unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
163 unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */
164 unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
165} dasd_profile_info_t;
166
167/*
168 * struct format_data_t
169 * represents all data necessary to format a dasd
170 */
171typedef struct format_data_t {
172 unsigned int start_unit; /* from track */
173 unsigned int stop_unit; /* to track */
174 unsigned int blksize; /* sectorsize */
175 unsigned int intensity;
176} format_data_t;
177
178/*
179 * values to be used for format_data_t.intensity
180 * 0/8: normal format
181 * 1/9: also write record zero
182 * 3/11: also write home address
183 * 4/12: invalidate track
184 */
185#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
186#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
187#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
188#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
189
190
191/*
192 * struct attrib_data_t
193 * represents the operation (cache) bits for the device.
194 * Used in DE to influence caching of the DASD.
195 */
196typedef struct attrib_data_t {
197 unsigned char operation:3; /* cache operation mode */
198 unsigned char reserved:5; /* cache operation mode */
199 __u16 nr_cyl; /* no of cyliners for read ahaed */
200 __u8 reserved2[29]; /* for future use */
201} __attribute__ ((packed)) attrib_data_t;
202
203/* definition of operation (cache) bits within attributes of DE */
204#define DASD_NORMAL_CACHE 0x0
205#define DASD_BYPASS_CACHE 0x1
206#define DASD_INHIBIT_LOAD 0x2
207#define DASD_SEQ_ACCESS 0x3
208#define DASD_SEQ_PRESTAGE 0x4
209#define DASD_REC_ACCESS 0x5
210
211/*
212 * Perform EMC Symmetrix I/O
213 */
214typedef struct dasd_symmio_parms {
215 unsigned char reserved[8]; /* compat with older releases */
216 unsigned long long psf_data; /* char * cast to u64 */
217 unsigned long long rssd_result; /* char * cast to u64 */
218 int psf_data_len;
219 int rssd_result_len;
220} __attribute__ ((packed)) dasd_symmio_parms_t;
221
222/*
223 * Data returned by Sense Path Group ID (SNID)
224 */
225struct dasd_snid_data {
226 struct {
227 __u8 group:2;
228 __u8 reserve:2;
229 __u8 mode:1;
230 __u8 res:3;
231 } __attribute__ ((packed)) path_state;
232 __u8 pgid[11];
233} __attribute__ ((packed));
234
235struct dasd_snid_ioctl_data {
236 struct dasd_snid_data data;
237 __u8 path_mask;
238} __attribute__ ((packed));
239
240
241/********************************************************************************
242 * SECTION: Definition of IOCTLs
243 *
244 * Here ist how the ioctl-nr should be used:
245 * 0 - 31 DASD driver itself
246 * 32 - 239 still open
247 * 240 - 255 reserved for EMC
248 *******************************************************************************/
249
250/* Disable the volume (for Linux) */
251#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
252/* Enable the volume (for Linux) */
253#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
254/* Issue a reserve/release command, rsp. */
255#define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */
256#define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */
257#define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */
258/* reset profiling information of a device */
259#define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)
260/* Quiesce IO on device */
261#define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
262/* Resume IO on device */
263#define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
264
265
266/* retrieve API version number */
267#define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
268/* Get information on a dasd device */
269#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
270/* retrieve profiling information of a device */
271#define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
272/* Get information on a dasd device (enhanced) */
273#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
274/* Performance Statistics Read */
275#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
276/* Get Attributes (cache operations) */
277#define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
278
279
280/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
281#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
282/* Set Attributes (cache operations) */
283#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
284
285/* Get Sense Path Group ID (SNID) data */
286#define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)
287
288#define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)
289
290#endif /* DASD_H */
291
diff --git a/arch/s390/include/uapi/asm/debug.h b/arch/s390/include/uapi/asm/debug.h
new file mode 100644
index 000000000000..c59fc79125f2
--- /dev/null
+++ b/arch/s390/include/uapi/asm/debug.h
@@ -0,0 +1,34 @@
1/*
2 * S/390 debug facility
3 *
4 * Copyright IBM Corp. 1999, 2000
5 */
6
7#ifndef _UAPIDEBUG_H
8#define _UAPIDEBUG_H
9
10#include <linux/fs.h>
11
12/* Note:
13 * struct __debug_entry must be defined outside of #ifdef __KERNEL__
14 * in order to allow a user program to analyze the 'raw'-view.
15 */
16
17struct __debug_entry{
18 union {
19 struct {
20 unsigned long long clock:52;
21 unsigned long long exception:1;
22 unsigned long long level:3;
23 unsigned long long cpuid:8;
24 } fields;
25
26 unsigned long long stck;
27 } id;
28 void* caller;
29} __attribute__((packed));
30
31
32#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
33
34#endif /* _UAPIDEBUG_H */
diff --git a/arch/s390/include/uapi/asm/errno.h b/arch/s390/include/uapi/asm/errno.h
new file mode 100644
index 000000000000..395e97d8005e
--- /dev/null
+++ b/arch/s390/include/uapi/asm/errno.h
@@ -0,0 +1,11 @@
1/*
2 * S390 version
3 *
4 */
5
6#ifndef _S390_ERRNO_H
7#define _S390_ERRNO_H
8
9#include <asm-generic/errno.h>
10
11#endif
diff --git a/arch/s390/include/uapi/asm/fcntl.h b/arch/s390/include/uapi/asm/fcntl.h
new file mode 100644
index 000000000000..46ab12db5739
--- /dev/null
+++ b/arch/s390/include/uapi/asm/fcntl.h
@@ -0,0 +1 @@
#include <asm-generic/fcntl.h>
diff --git a/arch/s390/include/uapi/asm/ioctl.h b/arch/s390/include/uapi/asm/ioctl.h
new file mode 100644
index 000000000000..b279fe06dfe5
--- /dev/null
+++ b/arch/s390/include/uapi/asm/ioctl.h
@@ -0,0 +1 @@
#include <asm-generic/ioctl.h>
diff --git a/arch/s390/include/uapi/asm/ioctls.h b/arch/s390/include/uapi/asm/ioctls.h
new file mode 100644
index 000000000000..960a4c1ebdf1
--- /dev/null
+++ b/arch/s390/include/uapi/asm/ioctls.h
@@ -0,0 +1,8 @@
1#ifndef __ARCH_S390_IOCTLS_H__
2#define __ARCH_S390_IOCTLS_H__
3
4#define FIOQSIZE 0x545E
5
6#include <asm-generic/ioctls.h>
7
8#endif
diff --git a/arch/s390/include/uapi/asm/ipcbuf.h b/arch/s390/include/uapi/asm/ipcbuf.h
new file mode 100644
index 000000000000..37f293d12c8f
--- /dev/null
+++ b/arch/s390/include/uapi/asm/ipcbuf.h
@@ -0,0 +1,31 @@
1#ifndef __S390_IPCBUF_H__
2#define __S390_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24#ifndef __s390x__
25 unsigned short __pad2;
26#endif /* ! __s390x__ */
27 unsigned long __unused1;
28 unsigned long __unused2;
29};
30
31#endif /* __S390_IPCBUF_H__ */
diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
new file mode 100644
index 000000000000..d25da598ec62
--- /dev/null
+++ b/arch/s390/include/uapi/asm/kvm.h
@@ -0,0 +1,60 @@
1#ifndef __LINUX_KVM_S390_H
2#define __LINUX_KVM_S390_H
3/*
4 * KVM s390 specific structures and definitions
5 *
6 * Copyright IBM Corp. 2008
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (version 2 only)
10 * as published by the Free Software Foundation.
11 *
12 * Author(s): Carsten Otte <cotte@de.ibm.com>
13 * Christian Borntraeger <borntraeger@de.ibm.com>
14 */
15#include <linux/types.h>
16
17#define __KVM_S390
18
19/* for KVM_GET_REGS and KVM_SET_REGS */
20struct kvm_regs {
21 /* general purpose regs for s390 */
22 __u64 gprs[16];
23};
24
25/* for KVM_GET_SREGS and KVM_SET_SREGS */
26struct kvm_sregs {
27 __u32 acrs[16];
28 __u64 crs[16];
29};
30
31/* for KVM_GET_FPU and KVM_SET_FPU */
32struct kvm_fpu {
33 __u32 fpc;
34 __u64 fprs[16];
35};
36
37struct kvm_debug_exit_arch {
38};
39
40/* for KVM_SET_GUEST_DEBUG */
41struct kvm_guest_debug_arch {
42};
43
44#define KVM_SYNC_PREFIX (1UL << 0)
45#define KVM_SYNC_GPRS (1UL << 1)
46#define KVM_SYNC_ACRS (1UL << 2)
47#define KVM_SYNC_CRS (1UL << 3)
48/* definition of registers in kvm_run */
49struct kvm_sync_regs {
50 __u64 prefix; /* prefix register */
51 __u64 gprs[16]; /* general purpose registers */
52 __u32 acrs[16]; /* access registers */
53 __u64 crs[16]; /* control registers */
54};
55
56#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
57#define KVM_REG_S390_EPOCHDIFF (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x2)
58#define KVM_REG_S390_CPU_TIMER (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x3)
59#define KVM_REG_S390_CLOCK_COMP (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x4)
60#endif
diff --git a/arch/s390/include/uapi/asm/kvm_para.h b/arch/s390/include/uapi/asm/kvm_para.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/arch/s390/include/uapi/asm/kvm_para.h
diff --git a/arch/s390/include/uapi/asm/kvm_virtio.h b/arch/s390/include/uapi/asm/kvm_virtio.h
new file mode 100644
index 000000000000..44a438ca9e72
--- /dev/null
+++ b/arch/s390/include/uapi/asm/kvm_virtio.h
@@ -0,0 +1,64 @@
1/*
2 * definition for virtio for kvm on s390
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
11 */
12
13#ifndef __KVM_S390_VIRTIO_H
14#define __KVM_S390_VIRTIO_H
15
16#include <linux/types.h>
17
18struct kvm_device_desc {
19 /* The device type: console, network, disk etc. Type 0 terminates. */
20 __u8 type;
21 /* The number of virtqueues (first in config array) */
22 __u8 num_vq;
23 /*
24 * The number of bytes of feature bits. Multiply by 2: one for host
25 * features and one for guest acknowledgements.
26 */
27 __u8 feature_len;
28 /* The number of bytes of the config array after virtqueues. */
29 __u8 config_len;
30 /* A status byte, written by the Guest. */
31 __u8 status;
32 __u8 config[0];
33};
34
35/*
36 * This is how we expect the device configuration field for a virtqueue
37 * to be laid out in config space.
38 */
39struct kvm_vqconfig {
40 /* The token returned with an interrupt. Set by the guest */
41 __u64 token;
42 /* The address of the virtio ring */
43 __u64 address;
44 /* The number of entries in the virtio_ring */
45 __u16 num;
46
47};
48
49#define KVM_S390_VIRTIO_NOTIFY 0
50#define KVM_S390_VIRTIO_RESET 1
51#define KVM_S390_VIRTIO_SET_STATUS 2
52
53/* The alignment to use between consumer and producer parts of vring.
54 * This is pagesize for historical reasons. */
55#define KVM_S390_VIRTIO_RING_ALIGN 4096
56
57
58/* These values are supposed to be in ext_params on an interrupt */
59#define VIRTIO_PARAM_MASK 0xff
60#define VIRTIO_PARAM_VRING_INTERRUPT 0x0
61#define VIRTIO_PARAM_CONFIG_CHANGED 0x1
62#define VIRTIO_PARAM_DEV_ADD 0x2
63
64#endif
diff --git a/arch/s390/include/uapi/asm/mman.h b/arch/s390/include/uapi/asm/mman.h
new file mode 100644
index 000000000000..de23da1f41b2
--- /dev/null
+++ b/arch/s390/include/uapi/asm/mman.h
@@ -0,0 +1,6 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/mman.h"
5 */
6#include <asm-generic/mman.h>
diff --git a/arch/s390/include/uapi/asm/monwriter.h b/arch/s390/include/uapi/asm/monwriter.h
new file mode 100644
index 000000000000..f845c8e2f861
--- /dev/null
+++ b/arch/s390/include/uapi/asm/monwriter.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright IBM Corp. 2006
3 * Character device driver for writing z/VM APPLDATA monitor records
4 * Version 1.0
5 * Author(s): Melissa Howland <melissah@us.ibm.com>
6 *
7 */
8
9#ifndef _ASM_390_MONWRITER_H
10#define _ASM_390_MONWRITER_H
11
12/* mon_function values */
13#define MONWRITE_START_INTERVAL 0x00 /* start interval recording */
14#define MONWRITE_STOP_INTERVAL 0x01 /* stop interval or config recording */
15#define MONWRITE_GEN_EVENT 0x02 /* generate event record */
16#define MONWRITE_START_CONFIG 0x03 /* start configuration recording */
17
18/* the header the app uses in its write() data */
19struct monwrite_hdr {
20 unsigned char mon_function;
21 unsigned short applid;
22 unsigned char record_num;
23 unsigned short version;
24 unsigned short release;
25 unsigned short mod_level;
26 unsigned short datalen;
27 unsigned char hdrlen;
28
29} __attribute__((packed));
30
31#endif /* _ASM_390_MONWRITER_H */
diff --git a/arch/s390/include/uapi/asm/msgbuf.h b/arch/s390/include/uapi/asm/msgbuf.h
new file mode 100644
index 000000000000..1bbdee927924
--- /dev/null
+++ b/arch/s390/include/uapi/asm/msgbuf.h
@@ -0,0 +1,37 @@
1#ifndef _S390_MSGBUF_H
2#define _S390_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17#ifndef __s390x__
18 unsigned long __unused1;
19#endif /* ! __s390x__ */
20 __kernel_time_t msg_rtime; /* last msgrcv time */
21#ifndef __s390x__
22 unsigned long __unused2;
23#endif /* ! __s390x__ */
24 __kernel_time_t msg_ctime; /* last change time */
25#ifndef __s390x__
26 unsigned long __unused3;
27#endif /* ! __s390x__ */
28 unsigned long msg_cbytes; /* current number of bytes on queue */
29 unsigned long msg_qnum; /* number of messages in queue */
30 unsigned long msg_qbytes; /* max number of bytes on queue */
31 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
32 __kernel_pid_t msg_lrpid; /* last receive pid */
33 unsigned long __unused4;
34 unsigned long __unused5;
35};
36
37#endif /* _S390_MSGBUF_H */
diff --git a/arch/s390/include/uapi/asm/param.h b/arch/s390/include/uapi/asm/param.h
new file mode 100644
index 000000000000..c616821bf2ac
--- /dev/null
+++ b/arch/s390/include/uapi/asm/param.h
@@ -0,0 +1,6 @@
1#ifndef _ASMS390_PARAM_H
2#define _ASMS390_PARAM_H
3
4#include <asm-generic/param.h>
5
6#endif /* _ASMS390_PARAM_H */
diff --git a/arch/s390/include/uapi/asm/poll.h b/arch/s390/include/uapi/asm/poll.h
new file mode 100644
index 000000000000..c98509d3149e
--- /dev/null
+++ b/arch/s390/include/uapi/asm/poll.h
@@ -0,0 +1 @@
#include <asm-generic/poll.h>
diff --git a/arch/s390/include/uapi/asm/posix_types.h b/arch/s390/include/uapi/asm/posix_types.h
new file mode 100644
index 000000000000..bf2a2ad2f800
--- /dev/null
+++ b/arch/s390/include/uapi/asm/posix_types.h
@@ -0,0 +1,51 @@
1/*
2 * S390 version
3 *
4 */
5
6#ifndef __ARCH_S390_POSIX_TYPES_H
7#define __ARCH_S390_POSIX_TYPES_H
8
9/*
10 * This file is generally used by user-level software, so you need to
11 * be a little careful about namespace pollution etc. Also, we cannot
12 * assume GCC is being used.
13 */
14
15typedef unsigned long __kernel_size_t;
16typedef long __kernel_ssize_t;
17#define __kernel_size_t __kernel_size_t
18
19typedef unsigned short __kernel_old_dev_t;
20#define __kernel_old_dev_t __kernel_old_dev_t
21
22#ifndef __s390x__
23
24typedef unsigned long __kernel_ino_t;
25typedef unsigned short __kernel_mode_t;
26typedef unsigned short __kernel_ipc_pid_t;
27typedef unsigned short __kernel_uid_t;
28typedef unsigned short __kernel_gid_t;
29typedef int __kernel_ptrdiff_t;
30
31#else /* __s390x__ */
32
33typedef unsigned int __kernel_ino_t;
34typedef unsigned int __kernel_mode_t;
35typedef int __kernel_ipc_pid_t;
36typedef unsigned int __kernel_uid_t;
37typedef unsigned int __kernel_gid_t;
38typedef long __kernel_ptrdiff_t;
39typedef unsigned long __kernel_sigset_t; /* at least 32 bits */
40
41#endif /* __s390x__ */
42
43#define __kernel_ino_t __kernel_ino_t
44#define __kernel_mode_t __kernel_mode_t
45#define __kernel_ipc_pid_t __kernel_ipc_pid_t
46#define __kernel_uid_t __kernel_uid_t
47#define __kernel_gid_t __kernel_gid_t
48
49#include <asm-generic/posix_types.h>
50
51#endif
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..705588a16d70
--- /dev/null
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -0,0 +1,472 @@
1/*
2 * S390 version
3 * Copyright IBM Corp. 1999, 2000
4 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
5 */
6
7#ifndef _UAPI_S390_PTRACE_H
8#define _UAPI_S390_PTRACE_H
9
10/*
11 * Offsets in the user_regs_struct. They are used for the ptrace
12 * system call and in entry.S
13 */
14#ifndef __s390x__
15
16#define PT_PSWMASK 0x00
17#define PT_PSWADDR 0x04
18#define PT_GPR0 0x08
19#define PT_GPR1 0x0C
20#define PT_GPR2 0x10
21#define PT_GPR3 0x14
22#define PT_GPR4 0x18
23#define PT_GPR5 0x1C
24#define PT_GPR6 0x20
25#define PT_GPR7 0x24
26#define PT_GPR8 0x28
27#define PT_GPR9 0x2C
28#define PT_GPR10 0x30
29#define PT_GPR11 0x34
30#define PT_GPR12 0x38
31#define PT_GPR13 0x3C
32#define PT_GPR14 0x40
33#define PT_GPR15 0x44
34#define PT_ACR0 0x48
35#define PT_ACR1 0x4C
36#define PT_ACR2 0x50
37#define PT_ACR3 0x54
38#define PT_ACR4 0x58
39#define PT_ACR5 0x5C
40#define PT_ACR6 0x60
41#define PT_ACR7 0x64
42#define PT_ACR8 0x68
43#define PT_ACR9 0x6C
44#define PT_ACR10 0x70
45#define PT_ACR11 0x74
46#define PT_ACR12 0x78
47#define PT_ACR13 0x7C
48#define PT_ACR14 0x80
49#define PT_ACR15 0x84
50#define PT_ORIGGPR2 0x88
51#define PT_FPC 0x90
52/*
53 * A nasty fact of life that the ptrace api
54 * only supports passing of longs.
55 */
56#define PT_FPR0_HI 0x98
57#define PT_FPR0_LO 0x9C
58#define PT_FPR1_HI 0xA0
59#define PT_FPR1_LO 0xA4
60#define PT_FPR2_HI 0xA8
61#define PT_FPR2_LO 0xAC
62#define PT_FPR3_HI 0xB0
63#define PT_FPR3_LO 0xB4
64#define PT_FPR4_HI 0xB8
65#define PT_FPR4_LO 0xBC
66#define PT_FPR5_HI 0xC0
67#define PT_FPR5_LO 0xC4
68#define PT_FPR6_HI 0xC8
69#define PT_FPR6_LO 0xCC
70#define PT_FPR7_HI 0xD0
71#define PT_FPR7_LO 0xD4
72#define PT_FPR8_HI 0xD8
73#define PT_FPR8_LO 0XDC
74#define PT_FPR9_HI 0xE0
75#define PT_FPR9_LO 0xE4
76#define PT_FPR10_HI 0xE8
77#define PT_FPR10_LO 0xEC
78#define PT_FPR11_HI 0xF0
79#define PT_FPR11_LO 0xF4
80#define PT_FPR12_HI 0xF8
81#define PT_FPR12_LO 0xFC
82#define PT_FPR13_HI 0x100
83#define PT_FPR13_LO 0x104
84#define PT_FPR14_HI 0x108
85#define PT_FPR14_LO 0x10C
86#define PT_FPR15_HI 0x110
87#define PT_FPR15_LO 0x114
88#define PT_CR_9 0x118
89#define PT_CR_10 0x11C
90#define PT_CR_11 0x120
91#define PT_IEEE_IP 0x13C
92#define PT_LASTOFF PT_IEEE_IP
93#define PT_ENDREGS 0x140-1
94
95#define GPR_SIZE 4
96#define CR_SIZE 4
97
98#define STACK_FRAME_OVERHEAD 96 /* size of minimum stack frame */
99
100#else /* __s390x__ */
101
102#define PT_PSWMASK 0x00
103#define PT_PSWADDR 0x08
104#define PT_GPR0 0x10
105#define PT_GPR1 0x18
106#define PT_GPR2 0x20
107#define PT_GPR3 0x28
108#define PT_GPR4 0x30
109#define PT_GPR5 0x38
110#define PT_GPR6 0x40
111#define PT_GPR7 0x48
112#define PT_GPR8 0x50
113#define PT_GPR9 0x58
114#define PT_GPR10 0x60
115#define PT_GPR11 0x68
116#define PT_GPR12 0x70
117#define PT_GPR13 0x78
118#define PT_GPR14 0x80
119#define PT_GPR15 0x88
120#define PT_ACR0 0x90
121#define PT_ACR1 0x94
122#define PT_ACR2 0x98
123#define PT_ACR3 0x9C
124#define PT_ACR4 0xA0
125#define PT_ACR5 0xA4
126#define PT_ACR6 0xA8
127#define PT_ACR7 0xAC
128#define PT_ACR8 0xB0
129#define PT_ACR9 0xB4
130#define PT_ACR10 0xB8
131#define PT_ACR11 0xBC
132#define PT_ACR12 0xC0
133#define PT_ACR13 0xC4
134#define PT_ACR14 0xC8
135#define PT_ACR15 0xCC
136#define PT_ORIGGPR2 0xD0
137#define PT_FPC 0xD8
138#define PT_FPR0 0xE0
139#define PT_FPR1 0xE8
140#define PT_FPR2 0xF0
141#define PT_FPR3 0xF8
142#define PT_FPR4 0x100
143#define PT_FPR5 0x108
144#define PT_FPR6 0x110
145#define PT_FPR7 0x118
146#define PT_FPR8 0x120
147#define PT_FPR9 0x128
148#define PT_FPR10 0x130
149#define PT_FPR11 0x138
150#define PT_FPR12 0x140
151#define PT_FPR13 0x148
152#define PT_FPR14 0x150
153#define PT_FPR15 0x158
154#define PT_CR_9 0x160
155#define PT_CR_10 0x168
156#define PT_CR_11 0x170
157#define PT_IEEE_IP 0x1A8
158#define PT_LASTOFF PT_IEEE_IP
159#define PT_ENDREGS 0x1B0-1
160
161#define GPR_SIZE 8
162#define CR_SIZE 8
163
164#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */
165
166#endif /* __s390x__ */
167
168#define NUM_GPRS 16
169#define NUM_FPRS 16
170#define NUM_CRS 16
171#define NUM_ACRS 16
172
173#define NUM_CR_WORDS 3
174
175#define FPR_SIZE 8
176#define FPC_SIZE 4
177#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */
178#define ACR_SIZE 4
179
180
181#define PTRACE_OLDSETOPTIONS 21
182
183#ifndef __ASSEMBLY__
184#include <linux/stddef.h>
185#include <linux/types.h>
186
187typedef union
188{
189 float f;
190 double d;
191 __u64 ui;
192 struct
193 {
194 __u32 hi;
195 __u32 lo;
196 } fp;
197} freg_t;
198
199typedef struct
200{
201 __u32 fpc;
202 freg_t fprs[NUM_FPRS];
203} s390_fp_regs;
204
205#define FPC_EXCEPTION_MASK 0xF8000000
206#define FPC_FLAGS_MASK 0x00F80000
207#define FPC_DXC_MASK 0x0000FF00
208#define FPC_RM_MASK 0x00000003
209#define FPC_VALID_MASK 0xF8F8FF03
210
211/* this typedef defines how a Program Status Word looks like */
212typedef struct
213{
214 unsigned long mask;
215 unsigned long addr;
216} __attribute__ ((aligned(8))) psw_t;
217
218typedef struct
219{
220 __u32 mask;
221 __u32 addr;
222} __attribute__ ((aligned(8))) psw_compat_t;
223
224#ifndef __s390x__
225
226#define PSW_MASK_PER 0x40000000UL
227#define PSW_MASK_DAT 0x04000000UL
228#define PSW_MASK_IO 0x02000000UL
229#define PSW_MASK_EXT 0x01000000UL
230#define PSW_MASK_KEY 0x00F00000UL
231#define PSW_MASK_BASE 0x00080000UL /* always one */
232#define PSW_MASK_MCHECK 0x00040000UL
233#define PSW_MASK_WAIT 0x00020000UL
234#define PSW_MASK_PSTATE 0x00010000UL
235#define PSW_MASK_ASC 0x0000C000UL
236#define PSW_MASK_CC 0x00003000UL
237#define PSW_MASK_PM 0x00000F00UL
238#define PSW_MASK_RI 0x00000000UL
239#define PSW_MASK_EA 0x00000000UL
240#define PSW_MASK_BA 0x00000000UL
241
242#define PSW_MASK_USER 0x00003F00UL
243
244#define PSW_ADDR_AMODE 0x80000000UL
245#define PSW_ADDR_INSN 0x7FFFFFFFUL
246
247#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20)
248
249#define PSW_ASC_PRIMARY 0x00000000UL
250#define PSW_ASC_ACCREG 0x00004000UL
251#define PSW_ASC_SECONDARY 0x00008000UL
252#define PSW_ASC_HOME 0x0000C000UL
253
254#else /* __s390x__ */
255
256#define PSW_MASK_PER 0x4000000000000000UL
257#define PSW_MASK_DAT 0x0400000000000000UL
258#define PSW_MASK_IO 0x0200000000000000UL
259#define PSW_MASK_EXT 0x0100000000000000UL
260#define PSW_MASK_BASE 0x0000000000000000UL
261#define PSW_MASK_KEY 0x00F0000000000000UL
262#define PSW_MASK_MCHECK 0x0004000000000000UL
263#define PSW_MASK_WAIT 0x0002000000000000UL
264#define PSW_MASK_PSTATE 0x0001000000000000UL
265#define PSW_MASK_ASC 0x0000C00000000000UL
266#define PSW_MASK_CC 0x0000300000000000UL
267#define PSW_MASK_PM 0x00000F0000000000UL
268#define PSW_MASK_RI 0x0000008000000000UL
269#define PSW_MASK_EA 0x0000000100000000UL
270#define PSW_MASK_BA 0x0000000080000000UL
271
272#define PSW_MASK_USER 0x00003F8180000000UL
273
274#define PSW_ADDR_AMODE 0x0000000000000000UL
275#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
276
277#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52)
278
279#define PSW_ASC_PRIMARY 0x0000000000000000UL
280#define PSW_ASC_ACCREG 0x0000400000000000UL
281#define PSW_ASC_SECONDARY 0x0000800000000000UL
282#define PSW_ASC_HOME 0x0000C00000000000UL
283
284#endif /* __s390x__ */
285
286
287/*
288 * The s390_regs structure is used to define the elf_gregset_t.
289 */
290typedef struct
291{
292 psw_t psw;
293 unsigned long gprs[NUM_GPRS];
294 unsigned int acrs[NUM_ACRS];
295 unsigned long orig_gpr2;
296} s390_regs;
297
298typedef struct
299{
300 psw_compat_t psw;
301 __u32 gprs[NUM_GPRS];
302 __u32 acrs[NUM_ACRS];
303 __u32 orig_gpr2;
304} s390_compat_regs;
305
306typedef struct
307{
308 __u32 gprs_high[NUM_GPRS];
309} s390_compat_regs_high;
310
311
312/*
313 * Now for the user space program event recording (trace) definitions.
314 * The following structures are used only for the ptrace interface, don't
315 * touch or even look at it if you don't want to modify the user-space
316 * ptrace interface. In particular stay away from it for in-kernel PER.
317 */
318typedef struct
319{
320 unsigned long cr[NUM_CR_WORDS];
321} per_cr_words;
322
323#define PER_EM_MASK 0xE8000000UL
324
325typedef struct
326{
327#ifdef __s390x__
328 unsigned : 32;
329#endif /* __s390x__ */
330 unsigned em_branching : 1;
331 unsigned em_instruction_fetch : 1;
332 /*
333 * Switching on storage alteration automatically fixes
334 * the storage alteration event bit in the users std.
335 */
336 unsigned em_storage_alteration : 1;
337 unsigned em_gpr_alt_unused : 1;
338 unsigned em_store_real_address : 1;
339 unsigned : 3;
340 unsigned branch_addr_ctl : 1;
341 unsigned : 1;
342 unsigned storage_alt_space_ctl : 1;
343 unsigned : 21;
344 unsigned long starting_addr;
345 unsigned long ending_addr;
346} per_cr_bits;
347
348typedef struct
349{
350 unsigned short perc_atmid;
351 unsigned long address;
352 unsigned char access_id;
353} per_lowcore_words;
354
355typedef struct
356{
357 unsigned perc_branching : 1;
358 unsigned perc_instruction_fetch : 1;
359 unsigned perc_storage_alteration : 1;
360 unsigned perc_gpr_alt_unused : 1;
361 unsigned perc_store_real_address : 1;
362 unsigned : 3;
363 unsigned atmid_psw_bit_31 : 1;
364 unsigned atmid_validity_bit : 1;
365 unsigned atmid_psw_bit_32 : 1;
366 unsigned atmid_psw_bit_5 : 1;
367 unsigned atmid_psw_bit_16 : 1;
368 unsigned atmid_psw_bit_17 : 1;
369 unsigned si : 2;
370 unsigned long address;
371 unsigned : 4;
372 unsigned access_id : 4;
373} per_lowcore_bits;
374
375typedef struct
376{
377 union {
378 per_cr_words words;
379 per_cr_bits bits;
380 } control_regs;
381 /*
382 * Use these flags instead of setting em_instruction_fetch
383 * directly they are used so that single stepping can be
384 * switched on & off while not affecting other tracing
385 */
386 unsigned single_step : 1;
387 unsigned instruction_fetch : 1;
388 unsigned : 30;
389 /*
390 * These addresses are copied into cr10 & cr11 if single
391 * stepping is switched off
392 */
393 unsigned long starting_addr;
394 unsigned long ending_addr;
395 union {
396 per_lowcore_words words;
397 per_lowcore_bits bits;
398 } lowcore;
399} per_struct;
400
401typedef struct
402{
403 unsigned int len;
404 unsigned long kernel_addr;
405 unsigned long process_addr;
406} ptrace_area;
407
408/*
409 * S/390 specific non posix ptrace requests. I chose unusual values so
410 * they are unlikely to clash with future ptrace definitions.
411 */
412#define PTRACE_PEEKUSR_AREA 0x5000
413#define PTRACE_POKEUSR_AREA 0x5001
414#define PTRACE_PEEKTEXT_AREA 0x5002
415#define PTRACE_PEEKDATA_AREA 0x5003
416#define PTRACE_POKETEXT_AREA 0x5004
417#define PTRACE_POKEDATA_AREA 0x5005
418#define PTRACE_GET_LAST_BREAK 0x5006
419#define PTRACE_PEEK_SYSTEM_CALL 0x5007
420#define PTRACE_POKE_SYSTEM_CALL 0x5008
421#define PTRACE_ENABLE_TE 0x5009
422#define PTRACE_DISABLE_TE 0x5010
423
424/*
425 * PT_PROT definition is loosely based on hppa bsd definition in
426 * gdb/hppab-nat.c
427 */
428#define PTRACE_PROT 21
429
430typedef enum
431{
432 ptprot_set_access_watchpoint,
433 ptprot_set_write_watchpoint,
434 ptprot_disable_watchpoint
435} ptprot_flags;
436
437typedef struct
438{
439 unsigned long lowaddr;
440 unsigned long hiaddr;
441 ptprot_flags prot;
442} ptprot_area;
443
444/* Sequence of bytes for breakpoint illegal instruction. */
445#define S390_BREAKPOINT {0x0,0x1}
446#define S390_BREAKPOINT_U16 ((__u16)0x0001)
447#define S390_SYSCALL_OPCODE ((__u16)0x0a00)
448#define S390_SYSCALL_SIZE 2
449
450/*
451 * The user_regs_struct defines the way the user registers are
452 * store on the stack for signal handling.
453 */
454struct user_regs_struct
455{
456 psw_t psw;
457 unsigned long gprs[NUM_GPRS];
458 unsigned int acrs[NUM_ACRS];
459 unsigned long orig_gpr2;
460 s390_fp_regs fp_regs;
461 /*
462 * These per registers are in here so that gdb can modify them
463 * itself as there is no "official" ptrace interface for hardware
464 * watchpoints. This is the way intel does it.
465 */
466 per_struct per_info;
467 unsigned long ieee_instruction_pointer; /* obsolete, always 0 */
468};
469
470#endif /* __ASSEMBLY__ */
471
472#endif /* _UAPI_S390_PTRACE_H */
diff --git a/arch/s390/include/uapi/asm/qeth.h b/arch/s390/include/uapi/asm/qeth.h
new file mode 100644
index 000000000000..3a896cf52589
--- /dev/null
+++ b/arch/s390/include/uapi/asm/qeth.h
@@ -0,0 +1,115 @@
1/*
2 * ioctl definitions for qeth driver
3 *
4 * Copyright IBM Corp. 2004
5 *
6 * Author(s): Thomas Spatzier <tspat@de.ibm.com>
7 *
8 */
9#ifndef __ASM_S390_QETH_IOCTL_H__
10#define __ASM_S390_QETH_IOCTL_H__
11#include <linux/types.h>
12#include <linux/ioctl.h>
13
14#define SIOC_QETH_ARP_SET_NO_ENTRIES (SIOCDEVPRIVATE)
15#define SIOC_QETH_ARP_QUERY_INFO (SIOCDEVPRIVATE + 1)
16#define SIOC_QETH_ARP_ADD_ENTRY (SIOCDEVPRIVATE + 2)
17#define SIOC_QETH_ARP_REMOVE_ENTRY (SIOCDEVPRIVATE + 3)
18#define SIOC_QETH_ARP_FLUSH_CACHE (SIOCDEVPRIVATE + 4)
19#define SIOC_QETH_ADP_SET_SNMP_CONTROL (SIOCDEVPRIVATE + 5)
20#define SIOC_QETH_GET_CARD_TYPE (SIOCDEVPRIVATE + 6)
21#define SIOC_QETH_QUERY_OAT (SIOCDEVPRIVATE + 7)
22
23struct qeth_arp_cache_entry {
24 __u8 macaddr[6];
25 __u8 reserved1[2];
26 __u8 ipaddr[16]; /* for both IPv4 and IPv6 */
27 __u8 reserved2[32];
28} __attribute__ ((packed));
29
30enum qeth_arp_ipaddrtype {
31 QETHARP_IP_ADDR_V4 = 1,
32 QETHARP_IP_ADDR_V6 = 2,
33};
34struct qeth_arp_entrytype {
35 __u8 mac;
36 __u8 ip;
37} __attribute__((packed));
38
39#define QETH_QARP_MEDIASPECIFIC_BYTES 32
40#define QETH_QARP_MACADDRTYPE_BYTES 1
41struct qeth_arp_qi_entry7 {
42 __u8 media_specific[QETH_QARP_MEDIASPECIFIC_BYTES];
43 struct qeth_arp_entrytype type;
44 __u8 macaddr[6];
45 __u8 ipaddr[4];
46} __attribute__((packed));
47
48struct qeth_arp_qi_entry7_ipv6 {
49 __u8 media_specific[QETH_QARP_MEDIASPECIFIC_BYTES];
50 struct qeth_arp_entrytype type;
51 __u8 macaddr[6];
52 __u8 ipaddr[16];
53} __attribute__((packed));
54
55struct qeth_arp_qi_entry7_short {
56 struct qeth_arp_entrytype type;
57 __u8 macaddr[6];
58 __u8 ipaddr[4];
59} __attribute__((packed));
60
61struct qeth_arp_qi_entry7_short_ipv6 {
62 struct qeth_arp_entrytype type;
63 __u8 macaddr[6];
64 __u8 ipaddr[16];
65} __attribute__((packed));
66
67struct qeth_arp_qi_entry5 {
68 __u8 media_specific[QETH_QARP_MEDIASPECIFIC_BYTES];
69 struct qeth_arp_entrytype type;
70 __u8 ipaddr[4];
71} __attribute__((packed));
72
73struct qeth_arp_qi_entry5_ipv6 {
74 __u8 media_specific[QETH_QARP_MEDIASPECIFIC_BYTES];
75 struct qeth_arp_entrytype type;
76 __u8 ipaddr[16];
77} __attribute__((packed));
78
79struct qeth_arp_qi_entry5_short {
80 struct qeth_arp_entrytype type;
81 __u8 ipaddr[4];
82} __attribute__((packed));
83
84struct qeth_arp_qi_entry5_short_ipv6 {
85 struct qeth_arp_entrytype type;
86 __u8 ipaddr[16];
87} __attribute__((packed));
88/*
89 * can be set by user if no "media specific information" is wanted
90 * -> saves a lot of space in user space buffer
91 */
92#define QETH_QARP_STRIP_ENTRIES 0x8000
93#define QETH_QARP_WITH_IPV6 0x4000
94#define QETH_QARP_REQUEST_MASK 0x00ff
95
96/* data sent to user space as result of query arp ioctl */
97#define QETH_QARP_USER_DATA_SIZE 20000
98#define QETH_QARP_MASK_OFFSET 4
99#define QETH_QARP_ENTRIES_OFFSET 6
100struct qeth_arp_query_user_data {
101 union {
102 __u32 data_len; /* set by user space program */
103 __u32 no_entries; /* set by kernel */
104 } u;
105 __u16 mask_bits;
106 char *entries;
107} __attribute__((packed));
108
109struct qeth_query_oat_data {
110 __u32 command;
111 __u32 buffer_len;
112 __u32 response_len;
113 __u64 ptr;
114};
115#endif /* __ASM_S390_QETH_IOCTL_H__ */
diff --git a/arch/s390/include/uapi/asm/resource.h b/arch/s390/include/uapi/asm/resource.h
new file mode 100644
index 000000000000..ec23d1c73c92
--- /dev/null
+++ b/arch/s390/include/uapi/asm/resource.h
@@ -0,0 +1,13 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/resources.h"
5 */
6
7#ifndef _S390_RESOURCE_H
8#define _S390_RESOURCE_H
9
10#include <asm-generic/resource.h>
11
12#endif
13
diff --git a/arch/s390/include/uapi/asm/schid.h b/arch/s390/include/uapi/asm/schid.h
new file mode 100644
index 000000000000..32f3ab2a8200
--- /dev/null
+++ b/arch/s390/include/uapi/asm/schid.h
@@ -0,0 +1,16 @@
1#ifndef _UAPIASM_SCHID_H
2#define _UAPIASM_SCHID_H
3
4#include <linux/types.h>
5
6struct subchannel_id {
7 __u32 cssid : 8;
8 __u32 : 4;
9 __u32 m : 1;
10 __u32 ssid : 2;
11 __u32 one : 1;
12 __u32 sch_no : 16;
13} __attribute__ ((packed, aligned(4)));
14
15
16#endif /* _UAPIASM_SCHID_H */
diff --git a/arch/s390/include/uapi/asm/sembuf.h b/arch/s390/include/uapi/asm/sembuf.h
new file mode 100644
index 000000000000..32626b0cac4b
--- /dev/null
+++ b/arch/s390/include/uapi/asm/sembuf.h
@@ -0,0 +1,29 @@
1#ifndef _S390_SEMBUF_H
2#define _S390_SEMBUF_H
3
4/*
5 * The semid64_ds structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem (for !__s390x__)
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17#ifndef __s390x__
18 unsigned long __unused1;
19#endif /* ! __s390x__ */
20 __kernel_time_t sem_ctime; /* last change time */
21#ifndef __s390x__
22 unsigned long __unused2;
23#endif /* ! __s390x__ */
24 unsigned long sem_nsems; /* no. of semaphores in array */
25 unsigned long __unused3;
26 unsigned long __unused4;
27};
28
29#endif /* _S390_SEMBUF_H */
diff --git a/arch/s390/include/uapi/asm/setup.h b/arch/s390/include/uapi/asm/setup.h
new file mode 100644
index 000000000000..5a637e3e385e
--- /dev/null
+++ b/arch/s390/include/uapi/asm/setup.h
@@ -0,0 +1,13 @@
1/*
2 * S390 version
3 * Copyright IBM Corp. 1999, 2010
4 */
5
6#ifndef _UAPI_ASM_S390_SETUP_H
7#define _UAPI_ASM_S390_SETUP_H
8
9#define COMMAND_LINE_SIZE 4096
10
11#define ARCH_COMMAND_LINE_SIZE 896
12
13#endif /* _UAPI_ASM_S390_SETUP_H */
diff --git a/arch/s390/include/uapi/asm/shmbuf.h b/arch/s390/include/uapi/asm/shmbuf.h
new file mode 100644
index 000000000000..eed2e280ce37
--- /dev/null
+++ b/arch/s390/include/uapi/asm/shmbuf.h
@@ -0,0 +1,48 @@
1#ifndef _S390_SHMBUF_H
2#define _S390_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for S/390 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem (for !__s390x__)
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18#ifndef __s390x__
19 unsigned long __unused1;
20#endif /* ! __s390x__ */
21 __kernel_time_t shm_dtime; /* last detach time */
22#ifndef __s390x__
23 unsigned long __unused2;
24#endif /* ! __s390x__ */
25 __kernel_time_t shm_ctime; /* last change time */
26#ifndef __s390x__
27 unsigned long __unused3;
28#endif /* ! __s390x__ */
29 __kernel_pid_t shm_cpid; /* pid of creator */
30 __kernel_pid_t shm_lpid; /* pid of last operator */
31 unsigned long shm_nattch; /* no. of current attaches */
32 unsigned long __unused4;
33 unsigned long __unused5;
34};
35
36struct shminfo64 {
37 unsigned long shmmax;
38 unsigned long shmmin;
39 unsigned long shmmni;
40 unsigned long shmseg;
41 unsigned long shmall;
42 unsigned long __unused1;
43 unsigned long __unused2;
44 unsigned long __unused3;
45 unsigned long __unused4;
46};
47
48#endif /* _S390_SHMBUF_H */
diff --git a/arch/s390/include/uapi/asm/sigcontext.h b/arch/s390/include/uapi/asm/sigcontext.h
new file mode 100644
index 000000000000..584787f6ce44
--- /dev/null
+++ b/arch/s390/include/uapi/asm/sigcontext.h
@@ -0,0 +1,69 @@
1/*
2 * S390 version
3 * Copyright IBM Corp. 1999, 2000
4 */
5
6#ifndef _ASM_S390_SIGCONTEXT_H
7#define _ASM_S390_SIGCONTEXT_H
8
9#include <linux/compiler.h>
10
11#define __NUM_GPRS 16
12#define __NUM_FPRS 16
13#define __NUM_ACRS 16
14
15#ifndef __s390x__
16
17/* Has to be at least _NSIG_WORDS from asm/signal.h */
18#define _SIGCONTEXT_NSIG 64
19#define _SIGCONTEXT_NSIG_BPW 32
20/* Size of stack frame allocated when calling signal handler. */
21#define __SIGNAL_FRAMESIZE 96
22
23#else /* __s390x__ */
24
25/* Has to be at least _NSIG_WORDS from asm/signal.h */
26#define _SIGCONTEXT_NSIG 64
27#define _SIGCONTEXT_NSIG_BPW 64
28/* Size of stack frame allocated when calling signal handler. */
29#define __SIGNAL_FRAMESIZE 160
30
31#endif /* __s390x__ */
32
33#define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
34#define _SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
35
36typedef struct
37{
38 unsigned long mask;
39 unsigned long addr;
40} __attribute__ ((aligned(8))) _psw_t;
41
42typedef struct
43{
44 _psw_t psw;
45 unsigned long gprs[__NUM_GPRS];
46 unsigned int acrs[__NUM_ACRS];
47} _s390_regs_common;
48
49typedef struct
50{
51 unsigned int fpc;
52 double fprs[__NUM_FPRS];
53} _s390_fp_regs;
54
55typedef struct
56{
57 _s390_regs_common regs;
58 _s390_fp_regs fpregs;
59} _sigregs;
60
61struct sigcontext
62{
63 unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS];
64 _sigregs __user *sregs;
65};
66
67
68#endif
69
diff --git a/arch/s390/include/uapi/asm/siginfo.h b/arch/s390/include/uapi/asm/siginfo.h
new file mode 100644
index 000000000000..91fd3e4b70ce
--- /dev/null
+++ b/arch/s390/include/uapi/asm/siginfo.h
@@ -0,0 +1,16 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/siginfo.h"
5 */
6
7#ifndef _S390_SIGINFO_H
8#define _S390_SIGINFO_H
9
10#ifdef __s390x__
11#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
12#endif
13
14#include <asm-generic/siginfo.h>
15
16#endif
diff --git a/arch/s390/include/uapi/asm/signal.h b/arch/s390/include/uapi/asm/signal.h
new file mode 100644
index 000000000000..8c6a49e392ee
--- /dev/null
+++ b/arch/s390/include/uapi/asm/signal.h
@@ -0,0 +1,135 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/signal.h"
5 */
6
7#ifndef _UAPI_ASMS390_SIGNAL_H
8#define _UAPI_ASMS390_SIGNAL_H
9
10#include <linux/types.h>
11#include <linux/time.h>
12
13/* Avoid too many header ordering problems. */
14struct siginfo;
15struct pt_regs;
16
17#ifndef __KERNEL__
18/* Here we must cater to libcs that poke about in kernel headers. */
19
20#define NSIG 32
21typedef unsigned long sigset_t;
22
23#endif /* __KERNEL__ */
24
25#define SIGHUP 1
26#define SIGINT 2
27#define SIGQUIT 3
28#define SIGILL 4
29#define SIGTRAP 5
30#define SIGABRT 6
31#define SIGIOT 6
32#define SIGBUS 7
33#define SIGFPE 8
34#define SIGKILL 9
35#define SIGUSR1 10
36#define SIGSEGV 11
37#define SIGUSR2 12
38#define SIGPIPE 13
39#define SIGALRM 14
40#define SIGTERM 15
41#define SIGSTKFLT 16
42#define SIGCHLD 17
43#define SIGCONT 18
44#define SIGSTOP 19
45#define SIGTSTP 20
46#define SIGTTIN 21
47#define SIGTTOU 22
48#define SIGURG 23
49#define SIGXCPU 24
50#define SIGXFSZ 25
51#define SIGVTALRM 26
52#define SIGPROF 27
53#define SIGWINCH 28
54#define SIGIO 29
55#define SIGPOLL SIGIO
56/*
57#define SIGLOST 29
58*/
59#define SIGPWR 30
60#define SIGSYS 31
61#define SIGUNUSED 31
62
63/* These should not be considered constants from userland. */
64#define SIGRTMIN 32
65#define SIGRTMAX _NSIG
66
67/*
68 * SA_FLAGS values:
69 *
70 * SA_ONSTACK indicates that a registered stack_t will be used.
71 * SA_RESTART flag to get restarting signals (which were the default long ago)
72 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
73 * SA_RESETHAND clears the handler when the signal is delivered.
74 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
75 * SA_NODEFER prevents the current signal from being masked in the handler.
76 *
77 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
78 * Unix names RESETHAND and NODEFER respectively.
79 */
80#define SA_NOCLDSTOP 0x00000001
81#define SA_NOCLDWAIT 0x00000002
82#define SA_SIGINFO 0x00000004
83#define SA_ONSTACK 0x08000000
84#define SA_RESTART 0x10000000
85#define SA_NODEFER 0x40000000
86#define SA_RESETHAND 0x80000000
87
88#define SA_NOMASK SA_NODEFER
89#define SA_ONESHOT SA_RESETHAND
90
91#define SA_RESTORER 0x04000000
92
93/*
94 * sigaltstack controls
95 */
96#define SS_ONSTACK 1
97#define SS_DISABLE 2
98
99#define MINSIGSTKSZ 2048
100#define SIGSTKSZ 8192
101
102#include <asm-generic/signal-defs.h>
103
104#ifndef __KERNEL__
105/* Here we must cater to libcs that poke about in kernel headers. */
106
107struct sigaction {
108 union {
109 __sighandler_t _sa_handler;
110 void (*_sa_sigaction)(int, struct siginfo *, void *);
111 } _u;
112#ifndef __s390x__ /* lovely */
113 sigset_t sa_mask;
114 unsigned long sa_flags;
115 void (*sa_restorer)(void);
116#else /* __s390x__ */
117 unsigned long sa_flags;
118 void (*sa_restorer)(void);
119 sigset_t sa_mask;
120#endif /* __s390x__ */
121};
122
123#define sa_handler _u._sa_handler
124#define sa_sigaction _u._sa_sigaction
125
126#endif /* __KERNEL__ */
127
128typedef struct sigaltstack {
129 void __user *ss_sp;
130 int ss_flags;
131 size_t ss_size;
132} stack_t;
133
134
135#endif /* _UAPI_ASMS390_SIGNAL_H */
diff --git a/arch/s390/include/uapi/asm/socket.h b/arch/s390/include/uapi/asm/socket.h
new file mode 100644
index 000000000000..69718cd6d635
--- /dev/null
+++ b/arch/s390/include/uapi/asm/socket.h
@@ -0,0 +1,78 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/socket.h"
5 */
6
7#ifndef _ASM_SOCKET_H
8#define _ASM_SOCKET_H
9
10#include <asm/sockios.h>
11
12/* For setsockopt(2) */
13#define SOL_SOCKET 1
14
15#define SO_DEBUG 1
16#define SO_REUSEADDR 2
17#define SO_TYPE 3
18#define SO_ERROR 4
19#define SO_DONTROUTE 5
20#define SO_BROADCAST 6
21#define SO_SNDBUF 7
22#define SO_RCVBUF 8
23#define SO_SNDBUFFORCE 32
24#define SO_RCVBUFFORCE 33
25#define SO_KEEPALIVE 9
26#define SO_OOBINLINE 10
27#define SO_NO_CHECK 11
28#define SO_PRIORITY 12
29#define SO_LINGER 13
30#define SO_BSDCOMPAT 14
31/* To add :#define SO_REUSEPORT 15 */
32#define SO_PASSCRED 16
33#define SO_PEERCRED 17
34#define SO_RCVLOWAT 18
35#define SO_SNDLOWAT 19
36#define SO_RCVTIMEO 20
37#define SO_SNDTIMEO 21
38
39/* Security levels - as per NRL IPv6 - don't actually do anything */
40#define SO_SECURITY_AUTHENTICATION 22
41#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
42#define SO_SECURITY_ENCRYPTION_NETWORK 24
43
44#define SO_BINDTODEVICE 25
45
46/* Socket filtering */
47#define SO_ATTACH_FILTER 26
48#define SO_DETACH_FILTER 27
49
50#define SO_PEERNAME 28
51#define SO_TIMESTAMP 29
52#define SCM_TIMESTAMP SO_TIMESTAMP
53
54#define SO_ACCEPTCONN 30
55
56#define SO_PEERSEC 31
57#define SO_PASSSEC 34
58#define SO_TIMESTAMPNS 35
59#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
60
61#define SO_MARK 36
62
63#define SO_TIMESTAMPING 37
64#define SCM_TIMESTAMPING SO_TIMESTAMPING
65
66#define SO_PROTOCOL 38
67#define SO_DOMAIN 39
68
69#define SO_RXQ_OVFL 40
70
71#define SO_WIFI_STATUS 41
72#define SCM_WIFI_STATUS SO_WIFI_STATUS
73#define SO_PEEK_OFF 42
74
75/* Instruct lower device to use last 4-bytes of skb data as FCS */
76#define SO_NOFCS 43
77
78#endif /* _ASM_SOCKET_H */
diff --git a/arch/s390/include/uapi/asm/sockios.h b/arch/s390/include/uapi/asm/sockios.h
new file mode 100644
index 000000000000..6f60eee73242
--- /dev/null
+++ b/arch/s390/include/uapi/asm/sockios.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_S390_SOCKIOS_H
2#define _ASM_S390_SOCKIOS_H
3
4#include <asm-generic/sockios.h>
5
6#endif
diff --git a/arch/s390/include/uapi/asm/stat.h b/arch/s390/include/uapi/asm/stat.h
new file mode 100644
index 000000000000..b4ca97d91466
--- /dev/null
+++ b/arch/s390/include/uapi/asm/stat.h
@@ -0,0 +1,103 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/stat.h"
5 */
6
7#ifndef _S390_STAT_H
8#define _S390_STAT_H
9
10#ifndef __s390x__
11struct __old_kernel_stat {
12 unsigned short st_dev;
13 unsigned short st_ino;
14 unsigned short st_mode;
15 unsigned short st_nlink;
16 unsigned short st_uid;
17 unsigned short st_gid;
18 unsigned short st_rdev;
19 unsigned long st_size;
20 unsigned long st_atime;
21 unsigned long st_mtime;
22 unsigned long st_ctime;
23};
24
25struct stat {
26 unsigned short st_dev;
27 unsigned short __pad1;
28 unsigned long st_ino;
29 unsigned short st_mode;
30 unsigned short st_nlink;
31 unsigned short st_uid;
32 unsigned short st_gid;
33 unsigned short st_rdev;
34 unsigned short __pad2;
35 unsigned long st_size;
36 unsigned long st_blksize;
37 unsigned long st_blocks;
38 unsigned long st_atime;
39 unsigned long st_atime_nsec;
40 unsigned long st_mtime;
41 unsigned long st_mtime_nsec;
42 unsigned long st_ctime;
43 unsigned long st_ctime_nsec;
44 unsigned long __unused4;
45 unsigned long __unused5;
46};
47
48/* This matches struct stat64 in glibc2.1, hence the absolutely
49 * insane amounts of padding around dev_t's.
50 */
51struct stat64 {
52 unsigned long long st_dev;
53 unsigned int __pad1;
54#define STAT64_HAS_BROKEN_ST_INO 1
55 unsigned long __st_ino;
56 unsigned int st_mode;
57 unsigned int st_nlink;
58 unsigned long st_uid;
59 unsigned long st_gid;
60 unsigned long long st_rdev;
61 unsigned int __pad3;
62 long long st_size;
63 unsigned long st_blksize;
64 unsigned char __pad4[4];
65 unsigned long __pad5; /* future possible st_blocks high bits */
66 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
67 unsigned long st_atime;
68 unsigned long st_atime_nsec;
69 unsigned long st_mtime;
70 unsigned long st_mtime_nsec;
71 unsigned long st_ctime;
72 unsigned long st_ctime_nsec; /* will be high 32 bits of ctime someday */
73 unsigned long long st_ino;
74};
75
76#else /* __s390x__ */
77
78struct stat {
79 unsigned long st_dev;
80 unsigned long st_ino;
81 unsigned long st_nlink;
82 unsigned int st_mode;
83 unsigned int st_uid;
84 unsigned int st_gid;
85 unsigned int __pad1;
86 unsigned long st_rdev;
87 unsigned long st_size;
88 unsigned long st_atime;
89 unsigned long st_atime_nsec;
90 unsigned long st_mtime;
91 unsigned long st_mtime_nsec;
92 unsigned long st_ctime;
93 unsigned long st_ctime_nsec;
94 unsigned long st_blksize;
95 long st_blocks;
96 unsigned long __unused[3];
97};
98
99#endif /* __s390x__ */
100
101#define STAT_HAVE_NSEC 1
102
103#endif
diff --git a/arch/s390/include/uapi/asm/statfs.h b/arch/s390/include/uapi/asm/statfs.h
new file mode 100644
index 000000000000..5acca0a34c20
--- /dev/null
+++ b/arch/s390/include/uapi/asm/statfs.h
@@ -0,0 +1,69 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/statfs.h"
5 */
6
7#ifndef _S390_STATFS_H
8#define _S390_STATFS_H
9
10#ifndef __s390x__
11#include <asm-generic/statfs.h>
12#else
13/*
14 * We can't use <asm-generic/statfs.h> because in 64-bit mode
15 * we mix ints of different sizes in our struct statfs.
16 */
17
18#ifndef __KERNEL_STRICT_NAMES
19#include <linux/types.h>
20typedef __kernel_fsid_t fsid_t;
21#endif
22
23struct statfs {
24 int f_type;
25 int f_bsize;
26 long f_blocks;
27 long f_bfree;
28 long f_bavail;
29 long f_files;
30 long f_ffree;
31 __kernel_fsid_t f_fsid;
32 int f_namelen;
33 int f_frsize;
34 int f_flags;
35 int f_spare[4];
36};
37
38struct statfs64 {
39 int f_type;
40 int f_bsize;
41 long f_blocks;
42 long f_bfree;
43 long f_bavail;
44 long f_files;
45 long f_ffree;
46 __kernel_fsid_t f_fsid;
47 int f_namelen;
48 int f_frsize;
49 int f_flags;
50 int f_spare[4];
51};
52
53struct compat_statfs64 {
54 __u32 f_type;
55 __u32 f_bsize;
56 __u64 f_blocks;
57 __u64 f_bfree;
58 __u64 f_bavail;
59 __u64 f_files;
60 __u64 f_ffree;
61 __kernel_fsid_t f_fsid;
62 __u32 f_namelen;
63 __u32 f_frsize;
64 __u32 f_flags;
65 __u32 f_spare[4];
66};
67
68#endif /* __s390x__ */
69#endif
diff --git a/arch/s390/include/uapi/asm/swab.h b/arch/s390/include/uapi/asm/swab.h
new file mode 100644
index 000000000000..da3bfe5cc161
--- /dev/null
+++ b/arch/s390/include/uapi/asm/swab.h
@@ -0,0 +1,89 @@
1#ifndef _S390_SWAB_H
2#define _S390_SWAB_H
3
4/*
5 * S390 version
6 * Copyright IBM Corp. 1999
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
8 */
9
10#include <linux/types.h>
11
12#ifndef __s390x__
13# define __SWAB_64_THRU_32__
14#endif
15
16#ifdef __s390x__
17static inline __u64 __arch_swab64p(const __u64 *x)
18{
19 __u64 result;
20
21 asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x));
22 return result;
23}
24#define __arch_swab64p __arch_swab64p
25
26static inline __u64 __arch_swab64(__u64 x)
27{
28 __u64 result;
29
30 asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
31 return result;
32}
33#define __arch_swab64 __arch_swab64
34
35static inline void __arch_swab64s(__u64 *x)
36{
37 *x = __arch_swab64p(x);
38}
39#define __arch_swab64s __arch_swab64s
40#endif /* __s390x__ */
41
42static inline __u32 __arch_swab32p(const __u32 *x)
43{
44 __u32 result;
45
46 asm volatile(
47#ifndef __s390x__
48 " icm %0,8,%O1+3(%R1)\n"
49 " icm %0,4,%O1+2(%R1)\n"
50 " icm %0,2,%O1+1(%R1)\n"
51 " ic %0,%1"
52 : "=&d" (result) : "Q" (*x) : "cc");
53#else /* __s390x__ */
54 " lrv %0,%1"
55 : "=d" (result) : "m" (*x));
56#endif /* __s390x__ */
57 return result;
58}
59#define __arch_swab32p __arch_swab32p
60
61#ifdef __s390x__
62static inline __u32 __arch_swab32(__u32 x)
63{
64 __u32 result;
65
66 asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x));
67 return result;
68}
69#define __arch_swab32 __arch_swab32
70#endif /* __s390x__ */
71
72static inline __u16 __arch_swab16p(const __u16 *x)
73{
74 __u16 result;
75
76 asm volatile(
77#ifndef __s390x__
78 " icm %0,2,%O1+1(%R1)\n"
79 " ic %0,%1\n"
80 : "=&d" (result) : "Q" (*x) : "cc");
81#else /* __s390x__ */
82 " lrvh %0,%1"
83 : "=d" (result) : "m" (*x));
84#endif /* __s390x__ */
85 return result;
86}
87#define __arch_swab16p __arch_swab16p
88
89#endif /* _S390_SWAB_H */
diff --git a/arch/s390/include/uapi/asm/tape390.h b/arch/s390/include/uapi/asm/tape390.h
new file mode 100644
index 000000000000..b2bc4bab7929
--- /dev/null
+++ b/arch/s390/include/uapi/asm/tape390.h
@@ -0,0 +1,102 @@
1/*************************************************************************
2 *
3 * enables user programs to display messages and control encryption
4 * on s390 tape devices
5 *
6 * Copyright IBM Corp. 2001, 2006
7 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
8 *
9 *************************************************************************/
10
11#ifndef _TAPE390_H
12#define _TAPE390_H
13
14#define TAPE390_DISPLAY _IOW('d', 1, struct display_struct)
15
16/*
17 * The TAPE390_DISPLAY ioctl calls the Load Display command
18 * which transfers 17 bytes of data from the channel to the subsystem:
19 * - 1 format control byte, and
20 * - two 8-byte messages
21 *
22 * Format control byte:
23 * 0-2: New Message Overlay
24 * 3: Alternate Messages
25 * 4: Blink Message
26 * 5: Display Low/High Message
27 * 6: Reserved
28 * 7: Automatic Load Request
29 *
30 */
31
32typedef struct display_struct {
33 char cntrl;
34 char message1[8];
35 char message2[8];
36} display_struct;
37
38/*
39 * Tape encryption support
40 */
41
42struct tape390_crypt_info {
43 char capability;
44 char status;
45 char medium_status;
46} __attribute__ ((packed));
47
48
49/* Macros for "capable" field */
50#define TAPE390_CRYPT_SUPPORTED_MASK 0x01
51#define TAPE390_CRYPT_SUPPORTED(x) \
52 ((x.capability & TAPE390_CRYPT_SUPPORTED_MASK))
53
54/* Macros for "status" field */
55#define TAPE390_CRYPT_ON_MASK 0x01
56#define TAPE390_CRYPT_ON(x) (((x.status) & TAPE390_CRYPT_ON_MASK))
57
58/* Macros for "medium status" field */
59#define TAPE390_MEDIUM_LOADED_MASK 0x01
60#define TAPE390_MEDIUM_ENCRYPTED_MASK 0x02
61#define TAPE390_MEDIUM_ENCRYPTED(x) \
62 (((x.medium_status) & TAPE390_MEDIUM_ENCRYPTED_MASK))
63#define TAPE390_MEDIUM_LOADED(x) \
64 (((x.medium_status) & TAPE390_MEDIUM_LOADED_MASK))
65
66/*
67 * The TAPE390_CRYPT_SET ioctl is used to switch on/off encryption.
68 * The "encryption_capable" and "tape_status" fields are ignored for this ioctl!
69 */
70#define TAPE390_CRYPT_SET _IOW('d', 2, struct tape390_crypt_info)
71
72/*
73 * The TAPE390_CRYPT_QUERY ioctl is used to query the encryption state.
74 */
75#define TAPE390_CRYPT_QUERY _IOR('d', 3, struct tape390_crypt_info)
76
77/* Values for "kekl1/2_type" and "kekl1/2_type_on_tape" fields */
78#define TAPE390_KEKL_TYPE_NONE 0
79#define TAPE390_KEKL_TYPE_LABEL 1
80#define TAPE390_KEKL_TYPE_HASH 2
81
82struct tape390_kekl {
83 unsigned char type;
84 unsigned char type_on_tape;
85 char label[65];
86} __attribute__ ((packed));
87
88struct tape390_kekl_pair {
89 struct tape390_kekl kekl[2];
90} __attribute__ ((packed));
91
92/*
93 * The TAPE390_KEKL_SET ioctl is used to set Key Encrypting Key labels.
94 */
95#define TAPE390_KEKL_SET _IOW('d', 4, struct tape390_kekl_pair)
96
97/*
98 * The TAPE390_KEKL_QUERY ioctl is used to query Key Encrypting Key labels.
99 */
100#define TAPE390_KEKL_QUERY _IOR('d', 5, struct tape390_kekl_pair)
101
102#endif
diff --git a/arch/s390/include/uapi/asm/termbits.h b/arch/s390/include/uapi/asm/termbits.h
new file mode 100644
index 000000000000..71bf6ac6a2b9
--- /dev/null
+++ b/arch/s390/include/uapi/asm/termbits.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_S390_TERMBITS_H
2#define _ASM_S390_TERMBITS_H
3
4#include <asm-generic/termbits.h>
5
6#endif
diff --git a/arch/s390/include/uapi/asm/termios.h b/arch/s390/include/uapi/asm/termios.h
new file mode 100644
index 000000000000..554f973db1e6
--- /dev/null
+++ b/arch/s390/include/uapi/asm/termios.h
@@ -0,0 +1,49 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/termios.h"
5 */
6
7#ifndef _UAPI_S390_TERMIOS_H
8#define _UAPI_S390_TERMIOS_H
9
10#include <asm/termbits.h>
11#include <asm/ioctls.h>
12
13struct winsize {
14 unsigned short ws_row;
15 unsigned short ws_col;
16 unsigned short ws_xpixel;
17 unsigned short ws_ypixel;
18};
19
20#define NCC 8
21struct termio {
22 unsigned short c_iflag; /* input mode flags */
23 unsigned short c_oflag; /* output mode flags */
24 unsigned short c_cflag; /* control mode flags */
25 unsigned short c_lflag; /* local mode flags */
26 unsigned char c_line; /* line discipline */
27 unsigned char c_cc[NCC]; /* control characters */
28};
29
30/* modem lines */
31#define TIOCM_LE 0x001
32#define TIOCM_DTR 0x002
33#define TIOCM_RTS 0x004
34#define TIOCM_ST 0x008
35#define TIOCM_SR 0x010
36#define TIOCM_CTS 0x020
37#define TIOCM_CAR 0x040
38#define TIOCM_RNG 0x080
39#define TIOCM_DSR 0x100
40#define TIOCM_CD TIOCM_CAR
41#define TIOCM_RI TIOCM_RNG
42#define TIOCM_OUT1 0x2000
43#define TIOCM_OUT2 0x4000
44#define TIOCM_LOOP 0x8000
45
46/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
47
48
49#endif /* _UAPI_S390_TERMIOS_H */
diff --git a/arch/s390/include/uapi/asm/types.h b/arch/s390/include/uapi/asm/types.h
new file mode 100644
index 000000000000..038f2b9178a4
--- /dev/null
+++ b/arch/s390/include/uapi/asm/types.h
@@ -0,0 +1,22 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/types.h"
5 */
6
7#ifndef _UAPI_S390_TYPES_H
8#define _UAPI_S390_TYPES_H
9
10#include <asm-generic/int-ll64.h>
11
12#ifndef __ASSEMBLY__
13
14/* A address type so that arithmetic can be done on it & it can be upgraded to
15 64 bit when necessary
16*/
17typedef unsigned long addr_t;
18typedef __signed__ long saddr_t;
19
20#endif /* __ASSEMBLY__ */
21
22#endif /* _UAPI_S390_TYPES_H */
diff --git a/arch/s390/include/uapi/asm/ucontext.h b/arch/s390/include/uapi/asm/ucontext.h
new file mode 100644
index 000000000000..200e06325c6a
--- /dev/null
+++ b/arch/s390/include/uapi/asm/ucontext.h
@@ -0,0 +1,33 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/ucontext.h"
5 */
6
7#ifndef _ASM_S390_UCONTEXT_H
8#define _ASM_S390_UCONTEXT_H
9
10#define UC_EXTENDED 0x00000001
11
12#ifndef __s390x__
13
14struct ucontext_extended {
15 unsigned long uc_flags;
16 struct ucontext *uc_link;
17 stack_t uc_stack;
18 _sigregs uc_mcontext;
19 unsigned long uc_sigmask[2];
20 unsigned long uc_gprs_high[16];
21};
22
23#endif
24
25struct ucontext {
26 unsigned long uc_flags;
27 struct ucontext *uc_link;
28 stack_t uc_stack;
29 _sigregs uc_mcontext;
30 sigset_t uc_sigmask; /* mask last for extensibility */
31};
32
33#endif /* !_ASM_S390_UCONTEXT_H */
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h
new file mode 100644
index 000000000000..63e6078699f1
--- /dev/null
+++ b/arch/s390/include/uapi/asm/unistd.h
@@ -0,0 +1,374 @@
1/*
2 * S390 version
3 *
4 * Derived from "include/asm-i386/unistd.h"
5 */
6
7#ifndef _UAPI_ASM_S390_UNISTD_H_
8#define _UAPI_ASM_S390_UNISTD_H_
9
10/*
11 * This file contains the system call numbers.
12 */
13
14#define __NR_exit 1
15#define __NR_fork 2
16#define __NR_read 3
17#define __NR_write 4
18#define __NR_open 5
19#define __NR_close 6
20#define __NR_restart_syscall 7
21#define __NR_creat 8
22#define __NR_link 9
23#define __NR_unlink 10
24#define __NR_execve 11
25#define __NR_chdir 12
26#define __NR_mknod 14
27#define __NR_chmod 15
28#define __NR_lseek 19
29#define __NR_getpid 20
30#define __NR_mount 21
31#define __NR_umount 22
32#define __NR_ptrace 26
33#define __NR_alarm 27
34#define __NR_pause 29
35#define __NR_utime 30
36#define __NR_access 33
37#define __NR_nice 34
38#define __NR_sync 36
39#define __NR_kill 37
40#define __NR_rename 38
41#define __NR_mkdir 39
42#define __NR_rmdir 40
43#define __NR_dup 41
44#define __NR_pipe 42
45#define __NR_times 43
46#define __NR_brk 45
47#define __NR_signal 48
48#define __NR_acct 51
49#define __NR_umount2 52
50#define __NR_ioctl 54
51#define __NR_fcntl 55
52#define __NR_setpgid 57
53#define __NR_umask 60
54#define __NR_chroot 61
55#define __NR_ustat 62
56#define __NR_dup2 63
57#define __NR_getppid 64
58#define __NR_getpgrp 65
59#define __NR_setsid 66
60#define __NR_sigaction 67
61#define __NR_sigsuspend 72
62#define __NR_sigpending 73
63#define __NR_sethostname 74
64#define __NR_setrlimit 75
65#define __NR_getrusage 77
66#define __NR_gettimeofday 78
67#define __NR_settimeofday 79
68#define __NR_symlink 83
69#define __NR_readlink 85
70#define __NR_uselib 86
71#define __NR_swapon 87
72#define __NR_reboot 88
73#define __NR_readdir 89
74#define __NR_mmap 90
75#define __NR_munmap 91
76#define __NR_truncate 92
77#define __NR_ftruncate 93
78#define __NR_fchmod 94
79#define __NR_getpriority 96
80#define __NR_setpriority 97
81#define __NR_statfs 99
82#define __NR_fstatfs 100
83#define __NR_socketcall 102
84#define __NR_syslog 103
85#define __NR_setitimer 104
86#define __NR_getitimer 105
87#define __NR_stat 106
88#define __NR_lstat 107
89#define __NR_fstat 108
90#define __NR_lookup_dcookie 110
91#define __NR_vhangup 111
92#define __NR_idle 112
93#define __NR_wait4 114
94#define __NR_swapoff 115
95#define __NR_sysinfo 116
96#define __NR_ipc 117
97#define __NR_fsync 118
98#define __NR_sigreturn 119
99#define __NR_clone 120
100#define __NR_setdomainname 121
101#define __NR_uname 122
102#define __NR_adjtimex 124
103#define __NR_mprotect 125
104#define __NR_sigprocmask 126
105#define __NR_create_module 127
106#define __NR_init_module 128
107#define __NR_delete_module 129
108#define __NR_get_kernel_syms 130
109#define __NR_quotactl 131
110#define __NR_getpgid 132
111#define __NR_fchdir 133
112#define __NR_bdflush 134
113#define __NR_sysfs 135
114#define __NR_personality 136
115#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
116#define __NR_getdents 141
117#define __NR_flock 143
118#define __NR_msync 144
119#define __NR_readv 145
120#define __NR_writev 146
121#define __NR_getsid 147
122#define __NR_fdatasync 148
123#define __NR__sysctl 149
124#define __NR_mlock 150
125#define __NR_munlock 151
126#define __NR_mlockall 152
127#define __NR_munlockall 153
128#define __NR_sched_setparam 154
129#define __NR_sched_getparam 155
130#define __NR_sched_setscheduler 156
131#define __NR_sched_getscheduler 157
132#define __NR_sched_yield 158
133#define __NR_sched_get_priority_max 159
134#define __NR_sched_get_priority_min 160
135#define __NR_sched_rr_get_interval 161
136#define __NR_nanosleep 162
137#define __NR_mremap 163
138#define __NR_query_module 167
139#define __NR_poll 168
140#define __NR_nfsservctl 169
141#define __NR_prctl 172
142#define __NR_rt_sigreturn 173
143#define __NR_rt_sigaction 174
144#define __NR_rt_sigprocmask 175
145#define __NR_rt_sigpending 176
146#define __NR_rt_sigtimedwait 177
147#define __NR_rt_sigqueueinfo 178
148#define __NR_rt_sigsuspend 179
149#define __NR_pread64 180
150#define __NR_pwrite64 181
151#define __NR_getcwd 183
152#define __NR_capget 184
153#define __NR_capset 185
154#define __NR_sigaltstack 186
155#define __NR_sendfile 187
156#define __NR_getpmsg 188
157#define __NR_putpmsg 189
158#define __NR_vfork 190
159#define __NR_pivot_root 217
160#define __NR_mincore 218
161#define __NR_madvise 219
162#define __NR_getdents64 220
163#define __NR_readahead 222
164#define __NR_setxattr 224
165#define __NR_lsetxattr 225
166#define __NR_fsetxattr 226
167#define __NR_getxattr 227
168#define __NR_lgetxattr 228
169#define __NR_fgetxattr 229
170#define __NR_listxattr 230
171#define __NR_llistxattr 231
172#define __NR_flistxattr 232
173#define __NR_removexattr 233
174#define __NR_lremovexattr 234
175#define __NR_fremovexattr 235
176#define __NR_gettid 236
177#define __NR_tkill 237
178#define __NR_futex 238
179#define __NR_sched_setaffinity 239
180#define __NR_sched_getaffinity 240
181#define __NR_tgkill 241
182/* Number 242 is reserved for tux */
183#define __NR_io_setup 243
184#define __NR_io_destroy 244
185#define __NR_io_getevents 245
186#define __NR_io_submit 246
187#define __NR_io_cancel 247
188#define __NR_exit_group 248
189#define __NR_epoll_create 249
190#define __NR_epoll_ctl 250
191#define __NR_epoll_wait 251
192#define __NR_set_tid_address 252
193#define __NR_fadvise64 253
194#define __NR_timer_create 254
195#define __NR_timer_settime (__NR_timer_create+1)
196#define __NR_timer_gettime (__NR_timer_create+2)
197#define __NR_timer_getoverrun (__NR_timer_create+3)
198#define __NR_timer_delete (__NR_timer_create+4)
199#define __NR_clock_settime (__NR_timer_create+5)
200#define __NR_clock_gettime (__NR_timer_create+6)
201#define __NR_clock_getres (__NR_timer_create+7)
202#define __NR_clock_nanosleep (__NR_timer_create+8)
203/* Number 263 is reserved for vserver */
204#define __NR_statfs64 265
205#define __NR_fstatfs64 266
206#define __NR_remap_file_pages 267
207/* Number 268 is reserved for new sys_mbind */
208/* Number 269 is reserved for new sys_get_mempolicy */
209/* Number 270 is reserved for new sys_set_mempolicy */
210#define __NR_mq_open 271
211#define __NR_mq_unlink 272
212#define __NR_mq_timedsend 273
213#define __NR_mq_timedreceive 274
214#define __NR_mq_notify 275
215#define __NR_mq_getsetattr 276
216#define __NR_kexec_load 277
217#define __NR_add_key 278
218#define __NR_request_key 279
219#define __NR_keyctl 280
220#define __NR_waitid 281
221#define __NR_ioprio_set 282
222#define __NR_ioprio_get 283
223#define __NR_inotify_init 284
224#define __NR_inotify_add_watch 285
225#define __NR_inotify_rm_watch 286
226/* Number 287 is reserved for new sys_migrate_pages */
227#define __NR_openat 288
228#define __NR_mkdirat 289
229#define __NR_mknodat 290
230#define __NR_fchownat 291
231#define __NR_futimesat 292
232#define __NR_unlinkat 294
233#define __NR_renameat 295
234#define __NR_linkat 296
235#define __NR_symlinkat 297
236#define __NR_readlinkat 298
237#define __NR_fchmodat 299
238#define __NR_faccessat 300
239#define __NR_pselect6 301
240#define __NR_ppoll 302
241#define __NR_unshare 303
242#define __NR_set_robust_list 304
243#define __NR_get_robust_list 305
244#define __NR_splice 306
245#define __NR_sync_file_range 307
246#define __NR_tee 308
247#define __NR_vmsplice 309
248/* Number 310 is reserved for new sys_move_pages */
249#define __NR_getcpu 311
250#define __NR_epoll_pwait 312
251#define __NR_utimes 313
252#define __NR_fallocate 314
253#define __NR_utimensat 315
254#define __NR_signalfd 316
255#define __NR_timerfd 317
256#define __NR_eventfd 318
257#define __NR_timerfd_create 319
258#define __NR_timerfd_settime 320
259#define __NR_timerfd_gettime 321
260#define __NR_signalfd4 322
261#define __NR_eventfd2 323
262#define __NR_inotify_init1 324
263#define __NR_pipe2 325
264#define __NR_dup3 326
265#define __NR_epoll_create1 327
266#define __NR_preadv 328
267#define __NR_pwritev 329
268#define __NR_rt_tgsigqueueinfo 330
269#define __NR_perf_event_open 331
270#define __NR_fanotify_init 332
271#define __NR_fanotify_mark 333
272#define __NR_prlimit64 334
273#define __NR_name_to_handle_at 335
274#define __NR_open_by_handle_at 336
275#define __NR_clock_adjtime 337
276#define __NR_syncfs 338
277#define __NR_setns 339
278#define __NR_process_vm_readv 340
279#define __NR_process_vm_writev 341
280#define __NR_s390_runtime_instr 342
281#define __NR_kcmp 343
282#define NR_syscalls 344
283
284/*
285 * There are some system calls that are not present on 64 bit, some
286 * have a different name although they do the same (e.g. __NR_chown32
287 * is __NR_chown on 64 bit).
288 */
289#ifndef __s390x__
290
291#define __NR_time 13
292#define __NR_lchown 16
293#define __NR_setuid 23
294#define __NR_getuid 24
295#define __NR_stime 25
296#define __NR_setgid 46
297#define __NR_getgid 47
298#define __NR_geteuid 49
299#define __NR_getegid 50
300#define __NR_setreuid 70
301#define __NR_setregid 71
302#define __NR_getrlimit 76
303#define __NR_getgroups 80
304#define __NR_setgroups 81
305#define __NR_fchown 95
306#define __NR_ioperm 101
307#define __NR_setfsuid 138
308#define __NR_setfsgid 139
309#define __NR__llseek 140
310#define __NR__newselect 142
311#define __NR_setresuid 164
312#define __NR_getresuid 165
313#define __NR_setresgid 170
314#define __NR_getresgid 171
315#define __NR_chown 182
316#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
317#define __NR_mmap2 192
318#define __NR_truncate64 193
319#define __NR_ftruncate64 194
320#define __NR_stat64 195
321#define __NR_lstat64 196
322#define __NR_fstat64 197
323#define __NR_lchown32 198
324#define __NR_getuid32 199
325#define __NR_getgid32 200
326#define __NR_geteuid32 201
327#define __NR_getegid32 202
328#define __NR_setreuid32 203
329#define __NR_setregid32 204
330#define __NR_getgroups32 205
331#define __NR_setgroups32 206
332#define __NR_fchown32 207
333#define __NR_setresuid32 208
334#define __NR_getresuid32 209
335#define __NR_setresgid32 210
336#define __NR_getresgid32 211
337#define __NR_chown32 212
338#define __NR_setuid32 213
339#define __NR_setgid32 214
340#define __NR_setfsuid32 215
341#define __NR_setfsgid32 216
342#define __NR_fcntl64 221
343#define __NR_sendfile64 223
344#define __NR_fadvise64_64 264
345#define __NR_fstatat64 293
346
347#else
348
349#define __NR_select 142
350#define __NR_getrlimit 191 /* SuS compliant getrlimit */
351#define __NR_lchown 198
352#define __NR_getuid 199
353#define __NR_getgid 200
354#define __NR_geteuid 201
355#define __NR_getegid 202
356#define __NR_setreuid 203
357#define __NR_setregid 204
358#define __NR_getgroups 205
359#define __NR_setgroups 206
360#define __NR_fchown 207
361#define __NR_setresuid 208
362#define __NR_getresuid 209
363#define __NR_setresgid 210
364#define __NR_getresgid 211
365#define __NR_chown 212
366#define __NR_setuid 213
367#define __NR_setgid 214
368#define __NR_setfsuid 215
369#define __NR_setfsgid 216
370#define __NR_newfstatat 293
371
372#endif
373
374#endif /* _UAPI_ASM_S390_UNISTD_H_ */
diff --git a/arch/s390/include/uapi/asm/vtoc.h b/arch/s390/include/uapi/asm/vtoc.h
new file mode 100644
index 000000000000..221419de275e
--- /dev/null
+++ b/arch/s390/include/uapi/asm/vtoc.h
@@ -0,0 +1,213 @@
1/*
2 * This file contains volume label definitions for DASD devices.
3 *
4 * Copyright IBM Corp. 2005
5 *
6 * Author(s): Volker Sameske <sameske@de.ibm.com>
7 *
8 */
9
10#ifndef _ASM_S390_VTOC_H
11#define _ASM_S390_VTOC_H
12
13#include <linux/types.h>
14
15struct vtoc_ttr
16{
17 __u16 tt;
18 __u8 r;
19} __attribute__ ((packed));
20
21struct vtoc_cchhb
22{
23 __u16 cc;
24 __u16 hh;
25 __u8 b;
26} __attribute__ ((packed));
27
28struct vtoc_cchh
29{
30 __u16 cc;
31 __u16 hh;
32} __attribute__ ((packed));
33
34struct vtoc_labeldate
35{
36 __u8 year;
37 __u16 day;
38} __attribute__ ((packed));
39
40struct vtoc_volume_label_cdl
41{
42 char volkey[4]; /* volume key = volume label */
43 char vollbl[4]; /* volume label */
44 char volid[6]; /* volume identifier */
45 __u8 security; /* security byte */
46 struct vtoc_cchhb vtoc; /* VTOC address */
47 char res1[5]; /* reserved */
48 char cisize[4]; /* CI-size for FBA,... */
49 /* ...blanks for CKD */
50 char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */
51 char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */
52 char res2[4]; /* reserved */
53 char lvtoc[14]; /* owner code for LVTOC */
54 char res3[29]; /* reserved */
55} __attribute__ ((packed));
56
57struct vtoc_volume_label_ldl {
58 char vollbl[4]; /* volume label */
59 char volid[6]; /* volume identifier */
60 char res3[69]; /* reserved */
61 char ldl_version; /* version number, valid for ldl format */
62 __u64 formatted_blocks; /* valid when ldl_version >= f2 */
63} __attribute__ ((packed));
64
65struct vtoc_extent
66{
67 __u8 typeind; /* extent type indicator */
68 __u8 seqno; /* extent sequence number */
69 struct vtoc_cchh llimit; /* starting point of this extent */
70 struct vtoc_cchh ulimit; /* ending point of this extent */
71} __attribute__ ((packed));
72
73struct vtoc_dev_const
74{
75 __u16 DS4DSCYL; /* number of logical cyls */
76 __u16 DS4DSTRK; /* number of tracks in a logical cylinder */
77 __u16 DS4DEVTK; /* device track length */
78 __u8 DS4DEVI; /* non-last keyed record overhead */
79 __u8 DS4DEVL; /* last keyed record overhead */
80 __u8 DS4DEVK; /* non-keyed record overhead differential */
81 __u8 DS4DEVFG; /* flag byte */
82 __u16 DS4DEVTL; /* device tolerance */
83 __u8 DS4DEVDT; /* number of DSCB's per track */
84 __u8 DS4DEVDB; /* number of directory blocks per track */
85} __attribute__ ((packed));
86
87struct vtoc_format1_label
88{
89 char DS1DSNAM[44]; /* data set name */
90 __u8 DS1FMTID; /* format identifier */
91 char DS1DSSN[6]; /* data set serial number */
92 __u16 DS1VOLSQ; /* volume sequence number */
93 struct vtoc_labeldate DS1CREDT; /* creation date: ydd */
94 struct vtoc_labeldate DS1EXPDT; /* expiration date */
95 __u8 DS1NOEPV; /* number of extents on volume */
96 __u8 DS1NOBDB; /* no. of bytes used in last direction blk */
97 __u8 DS1FLAG1; /* flag 1 */
98 char DS1SYSCD[13]; /* system code */
99 struct vtoc_labeldate DS1REFD; /* date last referenced */
100 __u8 DS1SMSFG; /* system managed storage indicators */
101 __u8 DS1SCXTF; /* sec. space extension flag byte */
102 __u16 DS1SCXTV; /* secondary space extension value */
103 __u8 DS1DSRG1; /* data set organisation byte 1 */
104 __u8 DS1DSRG2; /* data set organisation byte 2 */
105 __u8 DS1RECFM; /* record format */
106 __u8 DS1OPTCD; /* option code */
107 __u16 DS1BLKL; /* block length */
108 __u16 DS1LRECL; /* record length */
109 __u8 DS1KEYL; /* key length */
110 __u16 DS1RKP; /* relative key position */
111 __u8 DS1DSIND; /* data set indicators */
112 __u8 DS1SCAL1; /* secondary allocation flag byte */
113 char DS1SCAL3[3]; /* secondary allocation quantity */
114 struct vtoc_ttr DS1LSTAR; /* last used track and block on track */
115 __u16 DS1TRBAL; /* space remaining on last used track */
116 __u16 res1; /* reserved */
117 struct vtoc_extent DS1EXT1; /* first extent description */
118 struct vtoc_extent DS1EXT2; /* second extent description */
119 struct vtoc_extent DS1EXT3; /* third extent description */
120 struct vtoc_cchhb DS1PTRDS; /* possible pointer to f2 or f3 DSCB */
121} __attribute__ ((packed));
122
123struct vtoc_format4_label
124{
125 char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */
126 __u8 DS4IDFMT; /* format identifier */
127 struct vtoc_cchhb DS4HPCHR; /* highest address of a format 1 DSCB */
128 __u16 DS4DSREC; /* number of available DSCB's */
129 struct vtoc_cchh DS4HCCHH; /* CCHH of next available alternate track */
130 __u16 DS4NOATK; /* number of remaining alternate tracks */
131 __u8 DS4VTOCI; /* VTOC indicators */
132 __u8 DS4NOEXT; /* number of extents in VTOC */
133 __u8 DS4SMSFG; /* system managed storage indicators */
134 __u8 DS4DEVAC; /* number of alternate cylinders.
135 * Subtract from first two bytes of
136 * DS4DEVSZ to get number of usable
137 * cylinders. can be zero. valid
138 * only if DS4DEVAV on. */
139 struct vtoc_dev_const DS4DEVCT; /* device constants */
140 char DS4AMTIM[8]; /* VSAM time stamp */
141 char DS4AMCAT[3]; /* VSAM catalog indicator */
142 char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */
143 char res1[5]; /* reserved */
144 char DS4F6PTR[5]; /* pointer to first format 6 DSCB */
145 struct vtoc_extent DS4VTOCE; /* VTOC extent description */
146 char res2[10]; /* reserved */
147 __u8 DS4EFLVL; /* extended free-space management level */
148 struct vtoc_cchhb DS4EFPTR; /* pointer to extended free-space info */
149 char res3; /* reserved */
150 __u32 DS4DCYL; /* number of logical cyls */
151 char res4[2]; /* reserved */
152 __u8 DS4DEVF2; /* device flags */
153 char res5; /* reserved */
154} __attribute__ ((packed));
155
156struct vtoc_ds5ext
157{
158 __u16 t; /* RTA of the first track of free extent */
159 __u16 fc; /* number of whole cylinders in free ext. */
160 __u8 ft; /* number of remaining free tracks */
161} __attribute__ ((packed));
162
163struct vtoc_format5_label
164{
165 char DS5KEYID[4]; /* key identifier */
166 struct vtoc_ds5ext DS5AVEXT; /* first available (free-space) extent. */
167 struct vtoc_ds5ext DS5EXTAV[7]; /* seven available extents */
168 __u8 DS5FMTID; /* format identifier */
169 struct vtoc_ds5ext DS5MAVET[18]; /* eighteen available extents */
170 struct vtoc_cchhb DS5PTRDS; /* pointer to next format5 DSCB */
171} __attribute__ ((packed));
172
173struct vtoc_ds7ext
174{
175 __u32 a; /* starting RTA value */
176 __u32 b; /* ending RTA value + 1 */
177} __attribute__ ((packed));
178
179struct vtoc_format7_label
180{
181 char DS7KEYID[4]; /* key identifier */
182 struct vtoc_ds7ext DS7EXTNT[5]; /* space for 5 extent descriptions */
183 __u8 DS7FMTID; /* format identifier */
184 struct vtoc_ds7ext DS7ADEXT[11]; /* space for 11 extent descriptions */
185 char res1[2]; /* reserved */
186 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */
187} __attribute__ ((packed));
188
189struct vtoc_cms_label {
190 __u8 label_id[4]; /* Label identifier */
191 __u8 vol_id[6]; /* Volid */
192 __u16 version_id; /* Version identifier */
193 __u32 block_size; /* Disk block size */
194 __u32 origin_ptr; /* Disk origin pointer */
195 __u32 usable_count; /* Number of usable cylinders/blocks */
196 __u32 formatted_count; /* Maximum number of formatted cylinders/
197 * blocks */
198 __u32 block_count; /* Disk size in CMS blocks */
199 __u32 used_count; /* Number of CMS blocks in use */
200 __u32 fst_size; /* File Status Table (FST) size */
201 __u32 fst_count; /* Number of FSTs per CMS block */
202 __u8 format_date[6]; /* Disk FORMAT date */
203 __u8 reserved1[2];
204 __u32 disk_offset; /* Disk offset when reserved*/
205 __u32 map_block; /* Allocation Map Block with next hole */
206 __u32 hblk_disp; /* Displacement into HBLK data of next hole */
207 __u32 user_disp; /* Displacement into user part of Allocation
208 * map */
209 __u8 reserved2[4];
210 __u8 segment_name[8]; /* Name of shared segment */
211} __attribute__ ((packed));
212
213#endif /* _ASM_S390_VTOC_H */
diff --git a/arch/s390/include/uapi/asm/zcrypt.h b/arch/s390/include/uapi/asm/zcrypt.h
new file mode 100644
index 000000000000..e83fc116f5bf
--- /dev/null
+++ b/arch/s390/include/uapi/asm/zcrypt.h
@@ -0,0 +1,276 @@
1/*
2 * include/asm-s390/zcrypt.h
3 *
4 * zcrypt 2.1.0 (user-visible header)
5 *
6 * Copyright IBM Corp. 2001, 2006
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
9 *
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ASM_S390_ZCRYPT_H
28#define __ASM_S390_ZCRYPT_H
29
30#define ZCRYPT_VERSION 2
31#define ZCRYPT_RELEASE 1
32#define ZCRYPT_VARIANT 1
33
34#include <linux/ioctl.h>
35#include <linux/compiler.h>
36
37/**
38 * struct ica_rsa_modexpo
39 *
40 * Requirements:
41 * - outputdatalength is at least as large as inputdatalength.
42 * - All key parts are right justified in their fields, padded on
43 * the left with zeroes.
44 * - length(b_key) = inputdatalength
45 * - length(n_modulus) = inputdatalength
46 */
47struct ica_rsa_modexpo {
48 char __user * inputdata;
49 unsigned int inputdatalength;
50 char __user * outputdata;
51 unsigned int outputdatalength;
52 char __user * b_key;
53 char __user * n_modulus;
54};
55
56/**
57 * struct ica_rsa_modexpo_crt
58 *
59 * Requirements:
60 * - inputdatalength is even.
61 * - outputdatalength is at least as large as inputdatalength.
62 * - All key parts are right justified in their fields, padded on
63 * the left with zeroes.
64 * - length(bp_key) = inputdatalength/2 + 8
65 * - length(bq_key) = inputdatalength/2
66 * - length(np_key) = inputdatalength/2 + 8
67 * - length(nq_key) = inputdatalength/2
68 * - length(u_mult_inv) = inputdatalength/2 + 8
69 */
70struct ica_rsa_modexpo_crt {
71 char __user * inputdata;
72 unsigned int inputdatalength;
73 char __user * outputdata;
74 unsigned int outputdatalength;
75 char __user * bp_key;
76 char __user * bq_key;
77 char __user * np_prime;
78 char __user * nq_prime;
79 char __user * u_mult_inv;
80};
81
82/**
83 * CPRBX
84 * Note that all shorts and ints are big-endian.
85 * All pointer fields are 16 bytes long, and mean nothing.
86 *
87 * A request CPRB is followed by a request_parameter_block.
88 *
89 * The request (or reply) parameter block is organized thus:
90 * function code
91 * VUD block
92 * key block
93 */
94struct CPRBX {
95 unsigned short cprb_len; /* CPRB length 220 */
96 unsigned char cprb_ver_id; /* CPRB version id. 0x02 */
97 unsigned char pad_000[3]; /* Alignment pad bytes */
98 unsigned char func_id[2]; /* function id 0x5432 */
99 unsigned char cprb_flags[4]; /* Flags */
100 unsigned int req_parml; /* request parameter buffer len */
101 unsigned int req_datal; /* request data buffer */
102 unsigned int rpl_msgbl; /* reply message block length */
103 unsigned int rpld_parml; /* replied parameter block len */
104 unsigned int rpl_datal; /* reply data block len */
105 unsigned int rpld_datal; /* replied data block len */
106 unsigned int req_extbl; /* request extension block len */
107 unsigned char pad_001[4]; /* reserved */
108 unsigned int rpld_extbl; /* replied extension block len */
109 unsigned char padx000[16 - sizeof (char *)];
110 unsigned char * req_parmb; /* request parm block 'address' */
111 unsigned char padx001[16 - sizeof (char *)];
112 unsigned char * req_datab; /* request data block 'address' */
113 unsigned char padx002[16 - sizeof (char *)];
114 unsigned char * rpl_parmb; /* reply parm block 'address' */
115 unsigned char padx003[16 - sizeof (char *)];
116 unsigned char * rpl_datab; /* reply data block 'address' */
117 unsigned char padx004[16 - sizeof (char *)];
118 unsigned char * req_extb; /* request extension block 'addr'*/
119 unsigned char padx005[16 - sizeof (char *)];
120 unsigned char * rpl_extb; /* reply extension block 'address'*/
121 unsigned short ccp_rtcode; /* server return code */
122 unsigned short ccp_rscode; /* server reason code */
123 unsigned int mac_data_len; /* Mac Data Length */
124 unsigned char logon_id[8]; /* Logon Identifier */
125 unsigned char mac_value[8]; /* Mac Value */
126 unsigned char mac_content_flgs;/* Mac content flag byte */
127 unsigned char pad_002; /* Alignment */
128 unsigned short domain; /* Domain */
129 unsigned char usage_domain[4];/* Usage domain */
130 unsigned char cntrl_domain[4];/* Control domain */
131 unsigned char S390enf_mask[4];/* S/390 enforcement mask */
132 unsigned char pad_004[36]; /* reserved */
133} __attribute__((packed));
134
135/**
136 * xcRB
137 */
138struct ica_xcRB {
139 unsigned short agent_ID;
140 unsigned int user_defined;
141 unsigned short request_ID;
142 unsigned int request_control_blk_length;
143 unsigned char padding1[16 - sizeof (char *)];
144 char __user * request_control_blk_addr;
145 unsigned int request_data_length;
146 char padding2[16 - sizeof (char *)];
147 char __user * request_data_address;
148 unsigned int reply_control_blk_length;
149 char padding3[16 - sizeof (char *)];
150 char __user * reply_control_blk_addr;
151 unsigned int reply_data_length;
152 char padding4[16 - sizeof (char *)];
153 char __user * reply_data_addr;
154 unsigned short priority_window;
155 unsigned int status;
156} __attribute__((packed));
157#define AUTOSELECT ((unsigned int)0xFFFFFFFF)
158
159#define ZCRYPT_IOCTL_MAGIC 'z'
160
161/**
162 * Interface notes:
163 *
164 * The ioctl()s which are implemented (along with relevant details)
165 * are:
166 *
167 * ICARSAMODEXPO
168 * Perform an RSA operation using a Modulus-Exponent pair
169 * This takes an ica_rsa_modexpo struct as its arg.
170 *
171 * NOTE: please refer to the comments preceding this structure
172 * for the implementation details for the contents of the
173 * block
174 *
175 * ICARSACRT
176 * Perform an RSA operation using a Chinese-Remainder Theorem key
177 * This takes an ica_rsa_modexpo_crt struct as its arg.
178 *
179 * NOTE: please refer to the comments preceding this structure
180 * for the implementation details for the contents of the
181 * block
182 *
183 * ZSECSENDCPRB
184 * Send an arbitrary CPRB to a crypto card.
185 *
186 * Z90STAT_STATUS_MASK
187 * Return an 64 element array of unsigned chars for the status of
188 * all devices.
189 * 0x01: PCICA
190 * 0x02: PCICC
191 * 0x03: PCIXCC_MCL2
192 * 0x04: PCIXCC_MCL3
193 * 0x05: CEX2C
194 * 0x06: CEX2A
195 * 0x0d: device is disabled via the proc filesystem
196 *
197 * Z90STAT_QDEPTH_MASK
198 * Return an 64 element array of unsigned chars for the queue
199 * depth of all devices.
200 *
201 * Z90STAT_PERDEV_REQCNT
202 * Return an 64 element array of unsigned integers for the number
203 * of successfully completed requests per device since the device
204 * was detected and made available.
205 *
206 * Z90STAT_REQUESTQ_COUNT
207 * Return an integer count of the number of entries waiting to be
208 * sent to a device.
209 *
210 * Z90STAT_PENDINGQ_COUNT
211 * Return an integer count of the number of entries sent to all
212 * devices awaiting the reply.
213 *
214 * Z90STAT_TOTALOPEN_COUNT
215 * Return an integer count of the number of open file handles.
216 *
217 * Z90STAT_DOMAIN_INDEX
218 * Return the integer value of the Cryptographic Domain.
219 *
220 * The following ioctls are deprecated and should be no longer used:
221 *
222 * Z90STAT_TOTALCOUNT
223 * Return an integer count of all device types together.
224 *
225 * Z90STAT_PCICACOUNT
226 * Return an integer count of all PCICAs.
227 *
228 * Z90STAT_PCICCCOUNT
229 * Return an integer count of all PCICCs.
230 *
231 * Z90STAT_PCIXCCMCL2COUNT
232 * Return an integer count of all MCL2 PCIXCCs.
233 *
234 * Z90STAT_PCIXCCMCL3COUNT
235 * Return an integer count of all MCL3 PCIXCCs.
236 *
237 * Z90STAT_CEX2CCOUNT
238 * Return an integer count of all CEX2Cs.
239 *
240 * Z90STAT_CEX2ACOUNT
241 * Return an integer count of all CEX2As.
242 *
243 * ICAZ90STATUS
244 * Return some device driver status in a ica_z90_status struct
245 * This takes an ica_z90_status struct as its arg.
246 *
247 * Z90STAT_PCIXCCCOUNT
248 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
249 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
250 * MCL2 PCIXCCs.
251 */
252
253/**
254 * Supported ioctl calls
255 */
256#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0)
257#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
258#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0)
259
260/* New status calls */
261#define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int)
262#define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int)
263#define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int)
264#define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int)
265#define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int)
266#define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int)
267#define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int)
268#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int)
269#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int)
270#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int)
271#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int)
272#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64])
273#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64])
274#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64])
275
276#endif /* __ASM_S390_ZCRYPT_H */