1 /*
2  *  drivers/s390/char/hwc.h
3  *
4  *
5  *  S390 version
6  *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7  *    Author(s): Martin Peschke <mpeschke@de.ibm.com>
8  *
9  *
10  *
11  */
12 
13 #ifndef __HWC_H__
14 #define __HWC_H__
15 
16 #define HWC_EXT_INT_PARAM_ADDR	0xFFFFFFF8
17 #define HWC_EXT_INT_PARAM_PEND 0x00000001
18 
19 #define ET_OpCmd		0x01
20 #define ET_Msg		0x02
21 #define ET_StateChange	0x08
22 #define ET_PMsgCmd		0x09
23 #define ET_CntlProgOpCmd	0x20
24 #define ET_CntlProgIdent	0x0B
25 #define ET_SigQuiesce	0x1D
26 
27 #define ET_OpCmd_Mask	0x80000000
28 #define ET_Msg_Mask		0x40000000
29 #define ET_StateChange_Mask	0x01000000
30 #define ET_PMsgCmd_Mask	0x00800000
31 #define ET_CtlProgOpCmd_Mask	0x00000001
32 #define ET_CtlProgIdent_Mask	0x00200000
33 #define ET_SigQuiesce_Mask	0x00000008
34 
35 #define GMF_DOM		0x8000
36 #define GMF_SndAlrm	0x4000
37 #define GMF_HoldMsg	0x2000
38 
39 #define LTF_CntlText	0x8000
40 #define LTF_LabelText	0x4000
41 #define LTF_DataText	0x2000
42 #define LTF_EndText	0x1000
43 #define LTF_PromptText	0x0800
44 
45 #define HWC_COMMAND_INITIATED	0
46 #define HWC_BUSY		2
47 #define HWC_NOT_OPERATIONAL	3
48 
49 #define hwc_cmdw_t u32;
50 
51 #define HWC_CMDW_READDATA 0x00770005
52 
53 #define HWC_CMDW_WRITEDATA 0x00760005
54 
55 #define HWC_CMDW_WRITEMASK 0x00780005
56 
57 #define GDS_ID_MDSMU		0x1310
58 
59 #define GDS_ID_MDSRouteInfo	0x1311
60 
61 #define GDS_ID_AgUnWrkCorr	0x1549
62 
63 #define GDS_ID_SNACondReport	0x1532
64 
65 #define GDS_ID_CPMSU		0x1212
66 
67 #define GDS_ID_RoutTargInstr	0x154D
68 
69 #define GDS_ID_OpReq		0x8070
70 
71 #define GDS_ID_TextCmd		0x1320
72 
73 #define GDS_KEY_SelfDefTextMsg	0x31
74 
75 #define _HWCB_HEADER	u16	length; \
76 			u8	function_code; \
77 			u8	control_mask[3]; \
78 			u16	response_code;
79 
80 #define _EBUF_HEADER 	u16	length; \
81 			u8	type; \
82 			u8	flags; \
83 			u16	_reserved;
84 
85 typedef struct {
86 	_EBUF_HEADER
87 } __attribute__ ((packed))
88 
89 evbuf_t;
90 
91 #define _MDB_HEADER	u16	length; \
92 			u16	type; \
93 			u32	tag; \
94 			u32	revision_code;
95 
96 #define _GO_HEADER	u16	length; \
97 			u16	type; \
98 			u32	domid; \
99 			u8	hhmmss_time[8]; \
100 			u8	th_time[3]; \
101 			u8	_reserved_0; \
102 			u8	dddyyyy_date[7]; \
103 			u8	_reserved_1; \
104 			u16	general_msg_flags; \
105 			u8	_reserved_2[10]; \
106 			u8	originating_system_name[8]; \
107 			u8	job_guest_name[8];
108 
109 #define _MTO_HEADER	u16	length; \
110 			u16	type; \
111 			u16	line_type_flags; \
112 			u8	alarm_control; \
113 			u8	_reserved[3];
114 
115 typedef struct {
116 	_GO_HEADER
117 } __attribute__ ((packed))
118 
119 go_t;
120 
121 typedef struct {
122 	go_t go;
123 } __attribute__ ((packed))
124 
125 mdb_body_t;
126 
127 typedef struct {
128 	_MDB_HEADER
129 	mdb_body_t mdb_body;
130 } __attribute__ ((packed))
131 
132 mdb_t;
133 
134 typedef struct {
135 	_EBUF_HEADER
136 	mdb_t mdb;
137 } __attribute__ ((packed))
138 
139 msgbuf_t;
140 
141 typedef struct {
142 	_HWCB_HEADER
143 	msgbuf_t msgbuf;
144 } __attribute__ ((packed))
145 
146 write_hwcb_t;
147 
148 typedef struct {
149 	_MTO_HEADER
150 } __attribute__ ((packed))
151 
152 mto_t;
153 
154 static write_hwcb_t write_hwcb_template =
155 {
156 	sizeof (write_hwcb_t),
157 	0x00,
158 	{
159 		0x00,
160 		0x00,
161 		0x00
162 	},
163 	0x0000,
164 	{
165 		sizeof (msgbuf_t),
166 		ET_Msg,
167 		0x00,
168 		0x0000,
169 		{
170 			sizeof (mdb_t),
171 			0x0001,
172 			0xD4C4C240,
173 			0x00000001,
174 			{
175 				{
176 					sizeof (go_t),
177 					0x0001
178 
179 				}
180 			}
181 		}
182 	}
183 };
184 
185 static mto_t mto_template =
186 {
187 	sizeof (mto_t),
188 	0x0004,
189 	LTF_EndText,
190 	0x00
191 };
192 
193 typedef u32 _hwcb_mask_t;
194 
195 typedef struct {
196 	_HWCB_HEADER
197 	u16 _reserved;
198 	u16 mask_length;
199 	_hwcb_mask_t cp_receive_mask;
200 	_hwcb_mask_t cp_send_mask;
201 	_hwcb_mask_t hwc_receive_mask;
202 	_hwcb_mask_t hwc_send_mask;
203 } __attribute__ ((packed))
204 
205 init_hwcb_t;
206 
207 static init_hwcb_t init_hwcb_template =
208 {
209 	sizeof (init_hwcb_t),
210 	0x00,
211 	{
212 		0x00,
213 		0x00,
214 		0x00
215 	},
216 	0x0000,
217 	0x0000,
218 	sizeof (_hwcb_mask_t),
219 	ET_OpCmd_Mask | ET_PMsgCmd_Mask |
220 	ET_StateChange_Mask | ET_SigQuiesce_Mask,
221 	ET_Msg_Mask | ET_PMsgCmd_Mask | ET_CtlProgIdent_Mask
222 };
223 
224 typedef struct {
225 	_EBUF_HEADER
226 	u8 validity_hwc_active_facility_mask:1;
227 	u8 validity_hwc_receive_mask:1;
228 	u8 validity_hwc_send_mask:1;
229 	u8 validity_read_data_function_mask:1;
230 	u16 _zeros:12;
231 	u16 mask_length;
232 	u64 hwc_active_facility_mask;
233 	_hwcb_mask_t hwc_receive_mask;
234 	_hwcb_mask_t hwc_send_mask;
235 	u32 read_data_function_mask;
236 } __attribute__ ((packed))
237 
238 statechangebuf_t;
239 
240 #define _GDS_VECTOR_HEADER	u16	length; \
241 				u16	gds_id;
242 
243 #define _GDS_SUBVECTOR_HEADER	u8	length; \
244 				u8	key;
245 
246 typedef struct {
247 	_GDS_VECTOR_HEADER
248 } __attribute__ ((packed))
249 
250 gds_vector_t;
251 
252 typedef struct {
253 	_GDS_SUBVECTOR_HEADER
254 } __attribute__ ((packed))
255 
256 gds_subvector_t;
257 
258 typedef struct {
259 	_HWCB_HEADER
260 } __attribute__ ((packed))
261 
262 read_hwcb_t;
263 
264 static read_hwcb_t read_hwcb_template =
265 {
266 	PAGE_SIZE,
267 	0x00,
268 	{
269 		0x00,
270 		0x00,
271 		0x80
272 	}
273 };
274 
275 #endif				/* __HWC_H__ */
276