Merge branch 'master' into for_paulus
[linux-drm-fsl-dcu.git] / drivers / s390 / net / iucv.h
1 /*
2  *  drivers/s390/net/iucv.h
3  *    IUCV base support.
4  *
5  *  S390 version
6  *    Copyright (C) 2000 IBM Corporation
7  *    Author(s):Alan Altmark (Alan_Altmark@us.ibm.com)
8  *              Xenia Tkatschow (xenia@us.ibm.com)
9  *
10  *
11  * Functionality:
12  * To explore any of the IUCV functions, one must first register
13  * their program using iucv_register_program(). Once your program has
14  * successfully completed a register, it can exploit the other functions.
15  * For furthur reference on all IUCV functionality, refer to the
16  * CP Programming Services book, also available on the web
17  * thru www.ibm.com/s390/vm/pubs, manual # SC24-5760
18  *
19  *      Definition of Return Codes
20  *      -All positive return codes including zero are reflected back
21  *       from CP except for iucv_register_program. The definition of each
22  *       return code can be found in CP Programming Services book.
23  *       Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760
24  *      - Return Code of:
25  *             (-EINVAL) Invalid value
26  *             (-ENOMEM) storage allocation failed
27  *      pgmask defined in iucv_register_program will be set depending on input
28  *      paramters.
29  *
30  */
31
32 #include <linux/types.h>
33 #include <asm/debug.h>
34
35 /**
36  * Debug Facility stuff
37  */
38 #define IUCV_DBF_SETUP_NAME "iucv_setup"
39 #define IUCV_DBF_SETUP_LEN 32
40 #define IUCV_DBF_SETUP_PAGES 2
41 #define IUCV_DBF_SETUP_NR_AREAS 1
42 #define IUCV_DBF_SETUP_LEVEL 3
43
44 #define IUCV_DBF_DATA_NAME "iucv_data"
45 #define IUCV_DBF_DATA_LEN 128
46 #define IUCV_DBF_DATA_PAGES 2
47 #define IUCV_DBF_DATA_NR_AREAS 1
48 #define IUCV_DBF_DATA_LEVEL 2
49
50 #define IUCV_DBF_TRACE_NAME "iucv_trace"
51 #define IUCV_DBF_TRACE_LEN 16
52 #define IUCV_DBF_TRACE_PAGES 4
53 #define IUCV_DBF_TRACE_NR_AREAS 1
54 #define IUCV_DBF_TRACE_LEVEL 3
55
56 #define IUCV_DBF_TEXT(name,level,text) \
57         do { \
58                 debug_text_event(iucv_dbf_##name,level,text); \
59         } while (0)
60
61 #define IUCV_DBF_HEX(name,level,addr,len) \
62         do { \
63                 debug_event(iucv_dbf_##name,level,(void*)(addr),len); \
64         } while (0)
65
66 DECLARE_PER_CPU(char[256], iucv_dbf_txt_buf);
67
68 #define IUCV_DBF_TEXT_(name,level,text...)                              \
69         do {                                                            \
70                 char* iucv_dbf_txt_buf = get_cpu_var(iucv_dbf_txt_buf); \
71                 sprintf(iucv_dbf_txt_buf, text);                        \
72                 debug_text_event(iucv_dbf_##name,level,iucv_dbf_txt_buf); \
73                 put_cpu_var(iucv_dbf_txt_buf);                          \
74         } while (0)
75
76 #define IUCV_DBF_SPRINTF(name,level,text...) \
77         do { \
78                 debug_sprintf_event(iucv_dbf_trace, level, ##text ); \
79                 debug_sprintf_event(iucv_dbf_trace, level, text ); \
80         } while (0)
81
82 /**
83  * some more debug stuff
84  */
85 #define IUCV_HEXDUMP16(importance,header,ptr) \
86 PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
87                    "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
88                    *(((char*)ptr)),*(((char*)ptr)+1),*(((char*)ptr)+2), \
89                    *(((char*)ptr)+3),*(((char*)ptr)+4),*(((char*)ptr)+5), \
90                    *(((char*)ptr)+6),*(((char*)ptr)+7),*(((char*)ptr)+8), \
91                    *(((char*)ptr)+9),*(((char*)ptr)+10),*(((char*)ptr)+11), \
92                    *(((char*)ptr)+12),*(((char*)ptr)+13), \
93                    *(((char*)ptr)+14),*(((char*)ptr)+15)); \
94 PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
95                    "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
96                    *(((char*)ptr)+16),*(((char*)ptr)+17), \
97                    *(((char*)ptr)+18),*(((char*)ptr)+19), \
98                    *(((char*)ptr)+20),*(((char*)ptr)+21), \
99                    *(((char*)ptr)+22),*(((char*)ptr)+23), \
100                    *(((char*)ptr)+24),*(((char*)ptr)+25), \
101                    *(((char*)ptr)+26),*(((char*)ptr)+27), \
102                    *(((char*)ptr)+28),*(((char*)ptr)+29), \
103                    *(((char*)ptr)+30),*(((char*)ptr)+31));
104
105 static inline void
106 iucv_hex_dump(unsigned char *buf, size_t len)
107 {
108         size_t i;
109
110         for (i = 0; i < len; i++) {
111                 if (i && !(i % 16))
112                         printk("\n");
113                 printk("%02x ", *(buf + i));
114         }
115         printk("\n");
116 }
117 /**
118  * end of debug stuff
119  */
120
121 #define uchar  unsigned char
122 #define ushort unsigned short
123 #define ulong  unsigned long
124 #define iucv_handle_t void *
125
126 /* flags1:
127  * All flags are defined in the field IPFLAGS1 of each function
128  * and can be found in CP Programming Services.
129  * IPLOCAL  - Indicates the connect can only be satisfied on the
130  *            local system
131  * IPPRTY   - Indicates a priority message
132  * IPQUSCE  - Indicates you do not want to receive messages on a
133  *            path until an iucv_resume is issued
134  * IPRMDATA - Indicates that the message is in the parameter list
135  */
136 #define IPLOCAL         0x01
137 #define IPPRTY          0x20
138 #define IPQUSCE         0x40
139 #define IPRMDATA        0x80
140
141 /* flags1_out:
142  * All flags are defined in the output field of IPFLAGS1 for each function
143  * and can be found in CP Programming Services.
144  * IPNORPY - Specifies this is a one-way message and no reply is expected.
145  * IPPRTY   - Indicates a priority message is permitted. Defined in flags1.
146  */
147 #define IPNORPY         0x10
148
149 #define Nonpriority_MessagePendingInterruptsFlag         0x80
150 #define Priority_MessagePendingInterruptsFlag            0x40
151 #define Nonpriority_MessageCompletionInterruptsFlag      0x20
152 #define Priority_MessageCompletionInterruptsFlag         0x10
153 #define IUCVControlInterruptsFlag                        0x08
154 #define AllInterrupts                                    0xf8
155 /*
156  * Mapping of external interrupt buffers should be used with the corresponding
157  * interrupt types.
158  * Names: iucv_ConnectionPending    ->  connection pending
159  *        iucv_ConnectionComplete   ->  connection complete
160  *        iucv_ConnectionSevered    ->  connection severed
161  *        iucv_ConnectionQuiesced   ->  connection quiesced
162  *        iucv_ConnectionResumed    ->  connection resumed
163  *        iucv_MessagePending       ->  message pending
164  *        iucv_MessageComplete      ->  message complete
165  */
166 typedef struct {
167         u16 ippathid;
168         uchar ipflags1;
169         uchar iptype;
170         u16 ipmsglim;
171         u16 res1;
172         uchar ipvmid[8];
173         uchar ipuser[16];
174         u32 res3;
175         uchar ippollfg;
176         uchar res4[3];
177 } iucv_ConnectionPending;
178
179 typedef struct {
180         u16 ippathid;
181         uchar ipflags1;
182         uchar iptype;
183         u16 ipmsglim;
184         u16 res1;
185         uchar res2[8];
186         uchar ipuser[16];
187         u32 res3;
188         uchar ippollfg;
189         uchar res4[3];
190 } iucv_ConnectionComplete;
191
192 typedef struct {
193         u16 ippathid;
194         uchar res1;
195         uchar iptype;
196         u32 res2;
197         uchar res3[8];
198         uchar ipuser[16];
199         u32 res4;
200         uchar ippollfg;
201         uchar res5[3];
202 } iucv_ConnectionSevered;
203
204 typedef struct {
205         u16 ippathid;
206         uchar res1;
207         uchar iptype;
208         u32 res2;
209         uchar res3[8];
210         uchar ipuser[16];
211         u32 res4;
212         uchar ippollfg;
213         uchar res5[3];
214 } iucv_ConnectionQuiesced;
215
216 typedef struct {
217         u16 ippathid;
218         uchar res1;
219         uchar iptype;
220         u32 res2;
221         uchar res3[8];
222         uchar ipuser[16];
223         u32 res4;
224         uchar ippollfg;
225         uchar res5[3];
226 } iucv_ConnectionResumed;
227
228 typedef struct {
229         u16 ippathid;
230         uchar ipflags1;
231         uchar iptype;
232         u32 ipmsgid;
233         u32 iptrgcls;
234         union u2 {
235                 u32 iprmmsg1_u32;
236                 uchar iprmmsg1[4];
237         } ln1msg1;
238         union u1 {
239                 u32 ipbfln1f;
240                 uchar iprmmsg2[4];
241         } ln1msg2;
242         u32 res1[3];
243         u32 ipbfln2f;
244         uchar ippollfg;
245         uchar res2[3];
246 } iucv_MessagePending;
247
248 typedef struct {
249         u16 ippathid;
250         uchar ipflags1;
251         uchar iptype;
252         u32 ipmsgid;
253         u32 ipaudit;
254         uchar iprmmsg[8];
255         u32 ipsrccls;
256         u32 ipmsgtag;
257         u32 res;
258         u32 ipbfln2f;
259         uchar ippollfg;
260         uchar res2[3];
261 } iucv_MessageComplete;
262
263 /*
264  * iucv_interrupt_ops_t: Is a vector of functions that handle
265  * IUCV interrupts.
266  * Parameter list:
267  *         eib - is a pointer to a 40-byte area described
268  *               with one of the structures above.
269  *         pgm_data - this data is strictly for the
270  *                    interrupt handler that is passed by
271  *                    the application. This may be an address
272  *                    or token.
273 */
274 typedef struct {
275         void (*ConnectionPending) (iucv_ConnectionPending * eib,
276                                    void *pgm_data);
277         void (*ConnectionComplete) (iucv_ConnectionComplete * eib,
278                                     void *pgm_data);
279         void (*ConnectionSevered) (iucv_ConnectionSevered * eib,
280                                    void *pgm_data);
281         void (*ConnectionQuiesced) (iucv_ConnectionQuiesced * eib,
282                                     void *pgm_data);
283         void (*ConnectionResumed) (iucv_ConnectionResumed * eib,
284                                    void *pgm_data);
285         void (*MessagePending) (iucv_MessagePending * eib, void *pgm_data);
286         void (*MessageComplete) (iucv_MessageComplete * eib, void *pgm_data);
287 } iucv_interrupt_ops_t;
288
289 /*
290  *iucv_array_t : Defines buffer array.
291  * Inside the array may be 31- bit addresses and 31-bit lengths.
292 */
293 typedef struct {
294         u32 address;
295         u32 length;
296 } iucv_array_t __attribute__ ((aligned (8)));
297
298 extern struct bus_type iucv_bus;
299 extern struct device *iucv_root;
300
301 /*   -prototypes-    */
302 /*
303  * Name: iucv_register_program
304  * Purpose: Registers an application with IUCV
305  * Input: prmname - user identification
306  *        userid  - machine identification
307  *        pgmmask - indicates which bits in the prmname and userid combined will be
308  *                  used to determine who is given control
309  *        ops     - address of vector of interrupt handlers
310  *        pgm_data- application data passed to interrupt handlers
311  * Output: NA
312  * Return: address of handler
313  *         (0) - Error occurred, registration not completed.
314  * NOTE: Exact cause of failure will be recorded in syslog.
315 */
316 iucv_handle_t iucv_register_program (uchar pgmname[16],
317                                      uchar userid[8],
318                                      uchar pgmmask[24],
319                                      iucv_interrupt_ops_t * ops,
320                                      void *pgm_data);
321
322 /*
323  * Name: iucv_unregister_program
324  * Purpose: Unregister application with IUCV
325  * Input: address of handler
326  * Output: NA
327  * Return: (0) - Normal return
328  *         (-EINVAL) - Internal error, wild pointer
329 */
330 int iucv_unregister_program (iucv_handle_t handle);
331
332 /*
333  * Name: iucv_accept
334  * Purpose: This function is issued after the user receives a Connection Pending external
335  *          interrupt and now wishes to complete the IUCV communication path.
336  * Input:  pathid - u16 , Path identification number
337  *         msglim_reqstd - u16, The number of outstanding messages requested.
338  *         user_data - uchar[16], Data specified by the iucv_connect function.
339  *         flags1 - int, Contains options for this path.
340  *           -IPPRTY   - 0x20- Specifies if you want to send priority message.
341  *           -IPRMDATA - 0x80, Specifies whether your program can handle a message
342  *              in  the parameter list.
343  *           -IPQUSCE  - 0x40, Specifies whether you want to quiesce the path being
344  *              established.
345  *         handle - iucv_handle_t, Address of handler.
346  *         pgm_data - void *, Application data passed to interrupt handlers.
347  *         flags1_out - int * Contains information about the path
348  *           - IPPRTY - 0x20, Indicates you may send priority messages.
349  *         msglim - *u16, Number of outstanding messages.
350  * Output: return code from CP IUCV call.
351 */
352
353 int iucv_accept (u16 pathid,
354                  u16 msglim_reqstd,
355                  uchar user_data[16],
356                  int flags1,
357                  iucv_handle_t handle,
358                  void *pgm_data, int *flags1_out, u16 * msglim);
359
360 /*
361  * Name: iucv_connect
362  * Purpose: This function establishes an IUCV path. Although the connect may complete
363  *          successfully, you are not able to use the path until you receive an IUCV
364  *          Connection Complete external interrupt.
365  * Input: pathid - u16 *, Path identification number
366  *        msglim_reqstd - u16, Number of outstanding messages requested
367  *        user_data - uchar[16], 16-byte user data
368  *        userid - uchar[8], User identification
369  *        system_name - uchar[8], 8-byte identifying the system name
370  *        flags1 - int, Contains options for this path.
371  *          -IPPRTY -   0x20, Specifies if you want to send priority message.
372  *          -IPRMDATA - 0x80, Specifies whether your program can handle a message
373  *               in  the parameter list.
374  *          -IPQUSCE -  0x40, Specifies whether you want to quiesce the path being
375  *              established.
376  *          -IPLOCAL -  0X01, Allows an application to force the partner to be on
377  *              the local system. If local is specified then target class cannot be
378  *              specified.
379  *        flags1_out - int * Contains information about the path
380  *           - IPPRTY - 0x20, Indicates you may send priority messages.
381  *        msglim - * u16, Number of outstanding messages
382  *        handle - iucv_handle_t, Address of handler
383  *        pgm_data - void *, Application data passed to interrupt handlers
384  * Output: return code from CP IUCV call
385  *         rc - return code from iucv_declare_buffer
386  *         -EINVAL - Invalid handle passed by application
387  *         -EINVAL - Pathid address is NULL
388  *         add_pathid_result - Return code from internal function add_pathid
389 */
390 int
391     iucv_connect (u16 * pathid,
392                   u16 msglim_reqstd,
393                   uchar user_data[16],
394                   uchar userid[8],
395                   uchar system_name[8],
396                   int flags1,
397                   int *flags1_out,
398                   u16 * msglim, iucv_handle_t handle, void *pgm_data);
399
400 /*
401  * Name: iucv_purge
402  * Purpose: This function cancels a message that you have sent.
403  * Input: pathid - Path identification number.
404  *        msgid - Specifies the message ID of the message to be purged.
405  *        srccls - Specifies the source message class.
406  * Output: audit - Contains information about asynchronous error
407  *                 that may have affected the normal completion
408  *                 of this message.
409  * Return: Return code from CP IUCV call.
410 */
411 int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit);
412 /*
413  * Name: iucv_query_maxconn
414  * Purpose: This function determines the maximum number of communication paths you
415  *          may establish.
416  * Return:  maxconn - ulong, Maximum number of connection the virtual machine may
417  *          establish.
418 */
419 ulong iucv_query_maxconn (void);
420
421 /*
422  * Name: iucv_query_bufsize
423  * Purpose: This function determines how large an external interrupt
424  *          buffer IUCV requires to store information.
425  * Return:  bufsize - ulong, Size of external interrupt buffer.
426  */
427 ulong iucv_query_bufsize (void);
428
429 /*
430  * Name: iucv_quiesce
431  * Purpose: This function temporarily suspends incoming messages on an
432  *          IUCV path. You can later reactivate the path by invoking
433  *          the iucv_resume function.
434  * Input: pathid - Path identification number
435  *        user_data  - 16-bytes of user data
436  * Output: NA
437  * Return: Return code from CP IUCV call.
438 */
439 int iucv_quiesce (u16 pathid, uchar user_data[16]);
440
441 /*
442  * Name: iucv_receive
443  * Purpose: This function receives messages that are being sent to you
444  *          over established paths. Data will be returned in buffer for length of
445  *          buflen.
446  * Input:
447  *       pathid - Path identification number.
448  *       buffer - Address of buffer to receive.
449  *       buflen - Length of buffer to receive.
450  *       msgid - Specifies the message ID.
451  *       trgcls - Specifies target class.
452  * Output:
453  *       flags1_out: int *, Contains information about this path.
454  *         IPNORPY - 0x10 Specifies this is a one-way message and no reply is
455  *         expected.
456  *         IPPRTY  - 0x20 Specifies if you want to send priority message.
457  *         IPRMDATA - 0x80 specifies the data is contained in the parameter list
458  *       residual_buffer - address of buffer updated by the number
459  *                         of bytes you have received.
460  *       residual_length -
461  *              Contains one of the following values, if the receive buffer is:
462  *               The same length as the message, this field is zero.
463  *               Longer than the message, this field contains the number of
464  *                bytes remaining in the buffer.
465  *               Shorter than the message, this field contains the residual
466  *                count (that is, the number of bytes remaining in the
467  *                message that does not fit into the buffer. In this
468  *                case b2f0_result = 5.
469  * Return: Return code from CP IUCV call.
470  *         (-EINVAL) - buffer address is pointing to NULL
471 */
472 int iucv_receive (u16 pathid,
473                   u32 msgid,
474                   u32 trgcls,
475                   void *buffer,
476                   ulong buflen,
477                   int *flags1_out,
478                   ulong * residual_buffer, ulong * residual_length);
479
480  /*
481   * Name: iucv_receive_array
482   * Purpose: This function receives messages that are being sent to you
483   *          over established paths. Data will be returned in first buffer for
484   *          length of first buffer.
485   * Input: pathid - Path identification number.
486   *        msgid - specifies the message ID.
487   *        trgcls - Specifies target class.
488   *        buffer - Address of array of buffers.
489   *        buflen - Total length of buffers.
490   * Output:
491   *        flags1_out: int *, Contains information about this path.
492   *          IPNORPY - 0x10 Specifies this is a one-way message and no reply is
493   *          expected.
494   *          IPPRTY  - 0x20 Specifies if you want to send priority message.
495   *          IPRMDATA - 0x80 specifies the data is contained in the parameter list
496   *       residual_buffer - address points to the current list entry IUCV
497   *                         is working on.
498   *       residual_length -
499   *              Contains one of the following values, if the receive buffer is:
500   *               The same length as the message, this field is zero.
501   *               Longer than the message, this field contains the number of
502   *                bytes remaining in the buffer.
503   *               Shorter than the message, this field contains the residual
504   *                count (that is, the number of bytes remaining in the
505   *                message that does not fit into the buffer. In this
506   *                case b2f0_result = 5.
507   * Return: Return code from CP IUCV call.
508   *         (-EINVAL) - Buffer address is NULL.
509   */
510 int iucv_receive_array (u16 pathid,
511                         u32 msgid,
512                         u32 trgcls,
513                         iucv_array_t * buffer,
514                         ulong buflen,
515                         int *flags1_out,
516                         ulong * residual_buffer, ulong * residual_length);
517
518 /*
519  * Name: iucv_reject
520  * Purpose: The reject function refuses a specified message. Between the
521  *          time you are notified of a message and the time that you
522  *          complete the message, the message may be rejected.
523  * Input: pathid - Path identification number.
524  *        msgid - Specifies the message ID.
525  *        trgcls - Specifies target class.
526  * Output: NA
527  * Return: Return code from CP IUCV call.
528 */
529 int iucv_reject (u16 pathid, u32 msgid, u32 trgcls);
530
531 /*
532  * Name: iucv_reply
533  * Purpose: This function responds to the two-way messages that you
534  *          receive. You must identify completely the message to
535  *          which you wish to reply. ie, pathid, msgid, and trgcls.
536  * Input: pathid - Path identification number.
537  *        msgid - Specifies the message ID.
538  *        trgcls - Specifies target class.
539  *        flags1 - Option for path.
540  *          IPPRTY- 0x20, Specifies if you want to send priority message.
541  *        buffer - Address of reply buffer.
542  *        buflen - Length of reply buffer.
543  * Output: residual_buffer - Address of buffer updated by the number
544  *                    of bytes you have moved.
545  *         residual_length - Contains one of the following values:
546  *              If the answer buffer is the same length as the reply, this field
547  *               contains zero.
548  *              If the answer buffer is longer than the reply, this field contains
549  *               the number of bytes remaining in the buffer.
550  *              If the answer buffer is shorter than the reply, this field contains
551  *               a residual count (that is, the number of bytes remianing in the
552  *               reply that does not fit into the buffer. In this
553  *               case b2f0_result = 5.
554  * Return: Return code from CP IUCV call.
555  *         (-EINVAL) - Buffer address is NULL.
556 */
557 int iucv_reply (u16 pathid,
558                 u32 msgid,
559                 u32 trgcls,
560                 int flags1,
561                 void *buffer, ulong buflen, ulong * residual_buffer,
562                 ulong * residual_length);
563
564 /*
565  * Name: iucv_reply_array
566  * Purpose: This function responds to the two-way messages that you
567  *          receive. You must identify completely the message to
568  *          which you wish to reply. ie, pathid, msgid, and trgcls.
569  *          The array identifies a list of addresses and lengths of
570  *          discontiguous buffers that contains the reply data.
571  * Input: pathid - Path identification number
572  *        msgid - Specifies the message ID.
573  *        trgcls - Specifies target class.
574  *        flags1 - Option for path.
575  *          IPPRTY- 0x20, Specifies if you want to send priority message.
576  *        buffer - Address of array of reply buffers.
577  *        buflen - Total length of reply buffers.
578  * Output: residual_buffer - Address of buffer which IUCV is currently working on.
579  *         residual_length - Contains one of the following values:
580  *              If the answer buffer is the same length as the reply, this field
581  *               contains zero.
582  *              If the answer buffer is longer than the reply, this field contains
583  *               the number of bytes remaining in the buffer.
584  *              If the answer buffer is shorter than the reply, this field contains
585  *               a residual count (that is, the number of bytes remianing in the
586  *               reply that does not fit into the buffer. In this
587  *               case b2f0_result = 5.
588  * Return: Return code from CP IUCV call.
589  *         (-EINVAL) - Buffer address is NULL.
590 */
591 int iucv_reply_array (u16 pathid,
592                       u32 msgid,
593                       u32 trgcls,
594                       int flags1,
595                       iucv_array_t * buffer,
596                       ulong buflen, ulong * residual_address,
597                       ulong * residual_length);
598
599 /*
600  * Name: iucv_reply_prmmsg
601  * Purpose: This function responds to the two-way messages that you
602  *          receive. You must identify completely the message to
603  *          which you wish to reply. ie, pathid, msgid, and trgcls.
604  *          Prmmsg signifies the data is moved into the
605  *          parameter list.
606  * Input: pathid - Path identification number.
607  *        msgid - Specifies the message ID.
608  *        trgcls - Specifies target class.
609  *        flags1 - Option for path.
610  *          IPPRTY- 0x20 Specifies if you want to send priority message.
611  *        prmmsg - 8-bytes of data to be placed into the parameter.
612  *                 list.
613  * Output: NA
614  * Return: Return code from CP IUCV call.
615 */
616 int iucv_reply_prmmsg (u16 pathid,
617                        u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]);
618
619 /*
620  * Name: iucv_resume
621  * Purpose: This function restores communications over a quiesced path
622  * Input: pathid - Path identification number.
623  *        user_data  - 16-bytes of user data.
624  * Output: NA
625  * Return: Return code from CP IUCV call.
626 */
627 int iucv_resume (u16 pathid, uchar user_data[16]);
628
629 /*
630  * Name: iucv_send
631  * Purpose: This function transmits data to another application.
632  *          Data to be transmitted is in a buffer and this is a
633  *          one-way message and the receiver will not reply to the
634  *          message.
635  * Input: pathid - Path identification number.
636  *        trgcls - Specifies target class.
637  *        srccls - Specifies the source message class.
638  *        msgtag - Specifies a tag to be associated with the message.
639  *        flags1 - Option for path.
640  *          IPPRTY- 0x20 Specifies if you want to send priority message.
641  *        buffer - Address of send buffer.
642  *        buflen - Length of send buffer.
643  * Output: msgid - Specifies the message ID.
644  * Return: Return code from CP IUCV call.
645  *         (-EINVAL) - Buffer address is NULL.
646 */
647 int iucv_send (u16 pathid,
648                u32 * msgid,
649                u32 trgcls,
650                u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen);
651
652 /*
653  * Name: iucv_send_array
654  * Purpose: This function transmits data to another application.
655  *          The contents of buffer is the address of the array of
656  *          addresses and lengths of discontiguous buffers that hold
657  *          the message text. This is a one-way message and the
658  *          receiver will not reply to the message.
659  * Input: pathid - Path identification number.
660  *        trgcls - Specifies target class.
661  *        srccls - Specifies the source message class.
662  *        msgtag - Specifies a tag to be associated witht the message.
663  *        flags1 - Option for path.
664  *          IPPRTY- specifies if you want to send priority message.
665  *        buffer - Address of array of send buffers.
666  *        buflen - Total length of send buffers.
667  * Output: msgid - Specifies the message ID.
668  * Return: Return code from CP IUCV call.
669  *         (-EINVAL) - Buffer address is NULL.
670 */
671 int iucv_send_array (u16 pathid,
672                      u32 * msgid,
673                      u32 trgcls,
674                      u32 srccls,
675                      u32 msgtag,
676                      int flags1, iucv_array_t * buffer, ulong buflen);
677
678 /*
679  * Name: iucv_send_prmmsg
680  * Purpose: This function transmits data to another application.
681  *          Prmmsg specifies that the 8-bytes of data are to be moved
682  *          into the parameter list. This is a one-way message and the
683  *          receiver will not reply to the message.
684  * Input: pathid - Path identification number.
685  *        trgcls - Specifies target class.
686  *        srccls - Specifies the source message class.
687  *        msgtag - Specifies a tag to be associated with the message.
688  *        flags1 - Option for path.
689  *          IPPRTY- 0x20 specifies if you want to send priority message.
690  *        prmmsg - 8-bytes of data to be placed into parameter list.
691  * Output: msgid - Specifies the message ID.
692  * Return: Return code from CP IUCV call.
693 */
694 int iucv_send_prmmsg (u16 pathid,
695                       u32 * msgid,
696                       u32 trgcls,
697                       u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]);
698
699 /*
700  * Name: iucv_send2way
701  * Purpose: This function transmits data to another application.
702  *          Data to be transmitted is in a buffer. The receiver
703  *          of the send is expected to reply to the message and
704  *          a buffer is provided into which IUCV moves the reply
705  *          to this message.
706  * Input: pathid - Path identification number.
707  *        trgcls - Specifies target class.
708  *        srccls - Specifies the source message class.
709  *        msgtag - Specifies a tag associated with the message.
710  *        flags1 - Option for path.
711  *          IPPRTY- 0x20 Specifies if you want to send priority message.
712  *        buffer - Address of send buffer.
713  *        buflen - Length of send buffer.
714  *        ansbuf - Address of buffer into which IUCV moves the reply of
715  *                 this message.
716  *        anslen - Address of length of buffer.
717  * Output: msgid - Specifies the message ID.
718  * Return: Return code from CP IUCV call.
719  *         (-EINVAL) - Buffer or ansbuf address is NULL.
720 */
721 int iucv_send2way (u16 pathid,
722                    u32 * msgid,
723                    u32 trgcls,
724                    u32 srccls,
725                    u32 msgtag,
726                    int flags1,
727                    void *buffer, ulong buflen, void *ansbuf, ulong anslen);
728
729 /*
730  * Name: iucv_send2way_array
731  * Purpose: This function transmits data to another application.
732  *          The contents of buffer is the address of the array of
733  *          addresses and lengths of discontiguous buffers that hold
734  *          the message text. The receiver of the send is expected to
735  *          reply to the message and a buffer is provided into which
736  *          IUCV moves the reply to this message.
737  * Input: pathid - Path identification number.
738  *        trgcls - Specifies target class.
739  *        srccls - Specifies the source message class.
740  *        msgtag - Specifies a tag to be associated with the message.
741  *        flags1 - Option for path.
742  *          IPPRTY- 0x20 Specifies if you want to send priority message.
743  *        buffer - Sddress of array of send buffers.
744  *        buflen - Total length of send buffers.
745  *        ansbuf - Address of array of buffer into which IUCV moves the reply
746  *                 of this message.
747  *        anslen - Address of length reply buffers.
748  * Output: msgid - Specifies the message ID.
749  * Return: Return code from CP IUCV call.
750  *         (-EINVAL) - Buffer address is NULL.
751 */
752 int iucv_send2way_array (u16 pathid,
753                          u32 * msgid,
754                          u32 trgcls,
755                          u32 srccls,
756                          u32 msgtag,
757                          int flags1,
758                          iucv_array_t * buffer,
759                          ulong buflen, iucv_array_t * ansbuf, ulong anslen);
760
761 /*
762  * Name: iucv_send2way_prmmsg
763  * Purpose: This function transmits data to another application.
764  *          Prmmsg specifies that the 8-bytes of data are to be moved
765  *          into the parameter list. This is a two-way message and the
766  *          receiver of the message is expected to reply. A buffer
767  *          is provided into which IUCV moves the reply to this
768  *          message.
769  * Input: pathid - Rath identification number.
770  *        trgcls - Specifies target class.
771  *        srccls - Specifies the source message class.
772  *        msgtag - Specifies a tag to be associated with the message.
773  *        flags1 - Option for path.
774  *          IPPRTY- 0x20 Specifies if you want to send priority message.
775  *        prmmsg - 8-bytes of data to be placed in parameter list.
776  *        ansbuf - Address of buffer into which IUCV moves the reply of
777  *                 this message.
778  *        anslen - Address of length of buffer.
779  * Output: msgid - Specifies the message ID.
780  * Return: Return code from CP IUCV call.
781  *         (-EINVAL) - Buffer address is NULL.
782 */
783 int iucv_send2way_prmmsg (u16 pathid,
784                           u32 * msgid,
785                           u32 trgcls,
786                           u32 srccls,
787                           u32 msgtag,
788                           ulong flags1,
789                           uchar prmmsg[8], void *ansbuf, ulong anslen);
790
791 /*
792  * Name: iucv_send2way_prmmsg_array
793  * Purpose: This function transmits data to another application.
794  *          Prmmsg specifies that the 8-bytes of data are to be moved
795  *          into the parameter list. This is a two-way message and the
796  *          receiver of the message is expected to reply. A buffer
797  *          is provided into which IUCV moves the reply to this
798  *          message. The contents of ansbuf is the address of the
799  *          array of addresses and lengths of discontiguous buffers
800  *          that contain the reply.
801  * Input: pathid - Path identification number.
802  *        trgcls - Specifies target class.
803  *        srccls - Specifies the source message class.
804  *        msgtag - Specifies a tag to be associated with the message.
805  *        flags1 - Option for path.
806  *          IPPRTY- 0x20 specifies if you want to send priority message.
807  *        prmmsg - 8-bytes of data to be placed into the parameter list.
808  *        ansbuf - Address of array of buffer into which IUCV moves the reply
809  *                 of this message.
810  *        anslen - Address of length of reply buffers.
811  * Output: msgid - Specifies the message ID.
812  * Return: Return code from CP IUCV call.
813  *         (-EINVAL) - Ansbuf address is NULL.
814 */
815 int iucv_send2way_prmmsg_array (u16 pathid,
816                                 u32 * msgid,
817                                 u32 trgcls,
818                                 u32 srccls,
819                                 u32 msgtag,
820                                 int flags1,
821                                 uchar prmmsg[8],
822                                 iucv_array_t * ansbuf, ulong anslen);
823
824 /*
825  * Name: iucv_setmask
826  * Purpose: This function enables or disables the following IUCV
827  *          external interruptions: Nonpriority and priority message
828  *          interrupts, nonpriority and priority reply interrupts.
829  * Input: SetMaskFlag - options for interrupts
830  *           0x80 - Nonpriority_MessagePendingInterruptsFlag
831  *           0x40 - Priority_MessagePendingInterruptsFlag
832  *           0x20 - Nonpriority_MessageCompletionInterruptsFlag
833  *           0x10 - Priority_MessageCompletionInterruptsFlag
834  *           0x08 - IUCVControlInterruptsFlag
835  * Output: NA
836  * Return: Return code from CP IUCV call.
837 */
838 int iucv_setmask (int SetMaskFlag);
839
840 /*
841  * Name: iucv_sever
842  * Purpose: This function terminates an IUCV path.
843  * Input: pathid - Path identification number.
844  *        user_data - 16-bytes of user data.
845  * Output: NA
846  * Return: Return code from CP IUCV call.
847  *         (-EINVAL) - Interal error, wild pointer.
848 */
849 int iucv_sever (u16 pathid, uchar user_data[16]);