2 * drivers/s390/net/iucv.h
6 * Copyright (C) 2000 IBM Corporation
7 * Author(s):Alan Altmark (Alan_Altmark@us.ibm.com)
8 * Xenia Tkatschow (xenia@us.ibm.com)
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
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
25 * (-EINVAL) Invalid value
26 * (-ENOMEM) storage allocation failed
27 * pgmask defined in iucv_register_program will be set depending on input
32 #include <linux/types.h>
33 #define uchar unsigned char
34 #define ushort unsigned short
35 #define ulong unsigned long
36 #define iucv_handle_t void *
39 * All flags are defined in the field IPFLAGS1 of each function
40 * and can be found in CP Programming Services.
41 * IPLOCAL - Indicates the connect can only be satisfied on the
43 * IPPRTY - Indicates a priority message
44 * IPQUSCE - Indicates you do not want to receive messages on a
45 * path until an iucv_resume is issued
46 * IPRMDATA - Indicates that the message is in the parameter list
54 * All flags are defined in the output field of IPFLAGS1 for each function
55 * and can be found in CP Programming Services.
56 * IPNORPY - Specifies this is a one-way message and no reply is expected.
57 * IPPRTY - Indicates a priority message is permitted. Defined in flags1.
61 #define Nonpriority_MessagePendingInterruptsFlag 0x80
62 #define Priority_MessagePendingInterruptsFlag 0x40
63 #define Nonpriority_MessageCompletionInterruptsFlag 0x20
64 #define Priority_MessageCompletionInterruptsFlag 0x10
65 #define IUCVControlInterruptsFlag 0x08
66 #define AllInterrupts 0xf8
69 * Mapping of external interrupt buffers should be used with the corresponding
71 * Names: iucv_ConnectionPending -> connection pending
72 * iucv_ConnectionComplete -> connection complete
73 * iucv_ConnectionSevered -> connection severed
74 * iucv_ConnectionQuiesced -> connection quiesced
75 * iucv_ConnectionResumed -> connection resumed
76 * iucv_MessagePending -> message pending
77 * iucv_MessageComplete -> message complete
90 } iucv_ConnectionPending;
103 } iucv_ConnectionComplete;
115 } iucv_ConnectionSevered;
127 } iucv_ConnectionQuiesced;
139 } iucv_ConnectionResumed;
156 } iucv_MessagePending;
171 } iucv_MessageComplete;
174 * iucv_interrupt_ops_t: Is a vector of functions that handle
177 * eib - is a pointer to a 40-byte area described
178 * with one of the structures above.
179 * pgm_data - this data is strictly for the
180 * interrupt handler that is passed by
181 * the application. This may be an address
185 void (*ConnectionPending) (iucv_ConnectionPending * eib,
187 void (*ConnectionComplete) (iucv_ConnectionComplete * eib,
189 void (*ConnectionSevered) (iucv_ConnectionSevered * eib,
191 void (*ConnectionQuiesced) (iucv_ConnectionQuiesced * eib,
193 void (*ConnectionResumed) (iucv_ConnectionResumed * eib,
195 void (*MessagePending) (iucv_MessagePending * eib, void *pgm_data);
196 void (*MessageComplete) (iucv_MessageComplete * eib, void *pgm_data);
197 } iucv_interrupt_ops_t;
200 *iucv_array_t : Defines buffer array.
201 * Inside the array may be 31- bit addresses and 31-bit lengths.
206 } iucv_array_t __attribute__ ((aligned (8)));
210 * Name: iucv_register_program
211 * Purpose: Registers an application with IUCV
212 * Input: prmname - user identification
213 * userid - machine identification
214 * pgmmask - indicates which bits in the prmname and userid combined will be
215 * used to determine who is given control
216 * ops - address of vector of interrupt handlers
217 * pgm_data- application data passed to interrupt handlers
219 * Return: address of handler
220 * (0) - Error occured, registration not completed.
221 * NOTE: Exact cause of failure will be recorded in syslog.
223 iucv_handle_t iucv_register_program (uchar pgmname[16],
226 iucv_interrupt_ops_t * ops,
230 * Name: iucv_unregister_program
231 * Purpose: Unregister application with IUCV
232 * Input: address of handler
234 * Return: (0) - Normal return
235 * (-EINVAL) - Internal error, wild pointer
237 int iucv_unregister_program (iucv_handle_t handle);
241 * Purpose: This function is issued after the user receives a Connection Pending external
242 * interrupt and now wishes to complete the IUCV communication path.
243 * Input: pathid - u16 , Path identification number
244 * msglim_reqstd - u16, The number of outstanding messages requested.
245 * user_data - uchar[16], Data specified by the iucv_connect function.
246 * flags1 - int, Contains options for this path.
247 * -IPPRTY - 0x20- Specifies if you want to send priority message.
248 * -IPRMDATA - 0x80, Specifies whether your program can handle a message
249 * in the parameter list.
250 * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being
252 * handle - iucv_handle_t, Address of handler.
253 * pgm_data - void *, Application data passed to interrupt handlers.
254 * flags1_out - int * Contains information about the path
255 * - IPPRTY - 0x20, Indicates you may send priority messages.
256 * msglim - *u16, Number of outstanding messages.
257 * Output: return code from CP IUCV call.
260 int iucv_accept (u16 pathid,
264 iucv_handle_t handle,
265 void *pgm_data, int *flags1_out, u16 * msglim);
269 * Purpose: This function establishes an IUCV path. Although the connect may complete
270 * successfully, you are not able to use the path until you receive an IUCV
271 * Connection Complete external interrupt.
272 * Input: pathid - u16 *, Path identification number
273 * msglim_reqstd - u16, Number of outstanding messages requested
274 * user_data - uchar[16], 16-byte user data
275 * userid - uchar[8], User identification
276 * system_name - uchar[8], 8-byte identifying the system name
277 * flags1 - int, Contains options for this path.
278 * -IPPRTY - 0x20, Specifies if you want to send priority message.
279 * -IPRMDATA - 0x80, Specifies whether your program can handle a message
280 * in the parameter list.
281 * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being
283 * -IPLOCAL - 0X01, Allows an application to force the partner to be on
284 * the local system. If local is specified then target class cannot be
286 * flags1_out - int * Contains information about the path
287 * - IPPRTY - 0x20, Indicates you may send priority messages.
288 * msglim - * u16, Number of outstanding messages
289 * handle - iucv_handle_t, Address of handler
290 * pgm_data - void *, Application data passed to interrupt handlers
291 * Output: return code from CP IUCV call
292 * rc - return code from iucv_declare_buffer
293 * -EINVAL - Invalid handle passed by application
294 * -EINVAL - Pathid address is NULL
295 * add_pathid_result - Return code from internal function add_pathid
298 iucv_connect (u16 * pathid,
302 uchar system_name[8],
305 u16 * msglim, iucv_handle_t handle, void *pgm_data);
309 * Purpose: This function cancels a message that you have sent.
310 * Input: pathid - Path identification number.
311 * msgid - Specifies the message ID of the message to be purged.
312 * srccls - Specifies the source message class.
313 * Output: audit - Contains information about asynchronous error
314 * that may have affected the normal completion
316 * Return: Return code from CP IUCV call.
318 int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit);
320 * Name: iucv_query_maxconn
321 * Purpose: This function determines the maximum number of communication paths you
323 * Return: maxconn - ulong, Maximum number of connection the virtual machine may
326 ulong iucv_query_maxconn (void);
329 * Name: iucv_query_bufsize
330 * Purpose: This function determines how large an external interrupt
331 * buffer IUCV requires to store information.
332 * Return: bufsize - ulong, Size of external interrupt buffer.
334 ulong iucv_query_bufsize (void);
338 * Purpose: This function temporarily suspends incoming messages on an
339 * IUCV path. You can later reactivate the path by invoking
340 * the iucv_resume function.
341 * Input: pathid - Path identification number
342 * user_data - 16-bytes of user data
344 * Return: Return code from CP IUCV call.
346 int iucv_quiesce (u16 pathid, uchar user_data[16]);
350 * Purpose: This function receives messages that are being sent to you
351 * over established paths. Data will be returned in buffer for length of
354 * pathid - Path identification number.
355 * buffer - Address of buffer to receive.
356 * buflen - Length of buffer to receive.
357 * msgid - Specifies the message ID.
358 * trgcls - Specifies target class.
360 * flags1_out: int *, Contains information about this path.
361 * IPNORPY - 0x10 Specifies this is a one-way message and no reply is
363 * IPPRTY - 0x20 Specifies if you want to send priority message.
364 * IPRMDATA - 0x80 specifies the data is contained in the parameter list
365 * residual_buffer - address of buffer updated by the number
366 * of bytes you have received.
368 * Contains one of the following values, if the receive buffer is:
369 * The same length as the message, this field is zero.
370 * Longer than the message, this field contains the number of
371 * bytes remaining in the buffer.
372 * Shorter than the message, this field contains the residual
373 * count (that is, the number of bytes remaining in the
374 * message that does not fit into the buffer. In this
375 * case b2f0_result = 5.
376 * Return: Return code from CP IUCV call.
377 * (-EINVAL) - buffer address is pointing to NULL
379 int iucv_receive (u16 pathid,
385 ulong * residual_buffer, ulong * residual_length);
388 * Name: iucv_receive_array
389 * Purpose: This function receives messages that are being sent to you
390 * over established paths. Data will be returned in first buffer for
391 * length of first buffer.
392 * Input: pathid - Path identification number.
393 * msgid - specifies the message ID.
394 * trgcls - Specifies target class.
395 * buffer - Address of array of buffers.
396 * buflen - Total length of buffers.
398 * flags1_out: int *, Contains information about this path.
399 * IPNORPY - 0x10 Specifies this is a one-way message and no reply is
401 * IPPRTY - 0x20 Specifies if you want to send priority message.
402 * IPRMDATA - 0x80 specifies the data is contained in the parameter list
403 * residual_buffer - address points to the current list entry IUCV
406 * Contains one of the following values, if the receive buffer is:
407 * The same length as the message, this field is zero.
408 * Longer than the message, this field contains the number of
409 * bytes remaining in the buffer.
410 * Shorter than the message, this field contains the residual
411 * count (that is, the number of bytes remaining in the
412 * message that does not fit into the buffer. In this
413 * case b2f0_result = 5.
414 * Return: Return code from CP IUCV call.
415 * (-EINVAL) - Buffer address is NULL.
417 int iucv_receive_array (u16 pathid,
420 iucv_array_t * buffer,
423 ulong * residual_buffer, ulong * residual_length);
427 * Purpose: The reject function refuses a specified message. Between the
428 * time you are notified of a message and the time that you
429 * complete the message, the message may be rejected.
430 * Input: pathid - Path identification number.
431 * msgid - Specifies the message ID.
432 * trgcls - Specifies target class.
434 * Return: Return code from CP IUCV call.
436 int iucv_reject (u16 pathid, u32 msgid, u32 trgcls);
440 * Purpose: This function responds to the two-way messages that you
441 * receive. You must identify completely the message to
442 * which you wish to reply. ie, pathid, msgid, and trgcls.
443 * Input: pathid - Path identification number.
444 * msgid - Specifies the message ID.
445 * trgcls - Specifies target class.
446 * flags1 - Option for path.
447 * IPPRTY- 0x20, Specifies if you want to send priority message.
448 * buffer - Address of reply buffer.
449 * buflen - Length of reply buffer.
450 * Output: residual_buffer - Address of buffer updated by the number
451 * of bytes you have moved.
452 * residual_length - Contains one of the following values:
453 * If the answer buffer is the same length as the reply, this field
455 * If the answer buffer is longer than the reply, this field contains
456 * the number of bytes remaining in the buffer.
457 * If the answer buffer is shorter than the reply, this field contains
458 * a residual count (that is, the number of bytes remianing in the
459 * reply that does not fit into the buffer. In this
460 * case b2f0_result = 5.
461 * Return: Return code from CP IUCV call.
462 * (-EINVAL) - Buffer address is NULL.
464 int iucv_reply (u16 pathid,
468 void *buffer, ulong buflen, ulong * residual_buffer,
469 ulong * residual_length);
472 * Name: iucv_reply_array
473 * Purpose: This function responds to the two-way messages that you
474 * receive. You must identify completely the message to
475 * which you wish to reply. ie, pathid, msgid, and trgcls.
476 * The array identifies a list of addresses and lengths of
477 * discontiguous buffers that contains the reply data.
478 * Input: pathid - Path identification number
479 * msgid - Specifies the message ID.
480 * trgcls - Specifies target class.
481 * flags1 - Option for path.
482 * IPPRTY- 0x20, Specifies if you want to send priority message.
483 * buffer - Address of array of reply buffers.
484 * buflen - Total length of reply buffers.
485 * Output: residual_buffer - Address of buffer which IUCV is currently working on.
486 * residual_length - Contains one of the following values:
487 * If the answer buffer is the same length as the reply, this field
489 * If the answer buffer is longer than the reply, this field contains
490 * the number of bytes remaining in the buffer.
491 * If the answer buffer is shorter than the reply, this field contains
492 * a residual count (that is, the number of bytes remianing in the
493 * reply that does not fit into the buffer. In this
494 * case b2f0_result = 5.
495 * Return: Return code from CP IUCV call.
496 * (-EINVAL) - Buffer address is NULL.
498 int iucv_reply_array (u16 pathid,
502 iucv_array_t * buffer,
503 ulong buflen, ulong * residual_address,
504 ulong * residual_length);
507 * Name: iucv_reply_prmmsg
508 * Purpose: This function responds to the two-way messages that you
509 * receive. You must identify completely the message to
510 * which you wish to reply. ie, pathid, msgid, and trgcls.
511 * Prmmsg signifies the data is moved into the
513 * Input: pathid - Path identification number.
514 * msgid - Specifies the message ID.
515 * trgcls - Specifies target class.
516 * flags1 - Option for path.
517 * IPPRTY- 0x20 Specifies if you want to send priority message.
518 * prmmsg - 8-bytes of data to be placed into the parameter.
521 * Return: Return code from CP IUCV call.
523 int iucv_reply_prmmsg (u16 pathid,
524 u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]);
528 * Purpose: This function restores communications over a quiesced path
529 * Input: pathid - Path identification number.
530 * user_data - 16-bytes of user data.
532 * Return: Return code from CP IUCV call.
534 int iucv_resume (u16 pathid, uchar user_data[16]);
538 * Purpose: This function transmits data to another application.
539 * Data to be transmitted is in a buffer and this is a
540 * one-way message and the receiver will not reply to the
542 * Input: pathid - Path identification number.
543 * trgcls - Specifies target class.
544 * srccls - Specifies the source message class.
545 * msgtag - Specifies a tag to be associated with the message.
546 * flags1 - Option for path.
547 * IPPRTY- 0x20 Specifies if you want to send priority message.
548 * buffer - Address of send buffer.
549 * buflen - Length of send buffer.
550 * Output: msgid - Specifies the message ID.
551 * Return: Return code from CP IUCV call.
552 * (-EINVAL) - Buffer address is NULL.
554 int iucv_send (u16 pathid,
557 u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen);
560 * Name: iucv_send_array
561 * Purpose: This function transmits data to another application.
562 * The contents of buffer is the address of the array of
563 * addresses and lengths of discontiguous buffers that hold
564 * the message text. This is a one-way message and the
565 * receiver will not reply to the message.
566 * Input: pathid - Path identification number.
567 * trgcls - Specifies target class.
568 * srccls - Specifies the source message class.
569 * msgtag - Specifies a tag to be associated witht the message.
570 * flags1 - Option for path.
571 * IPPRTY- specifies if you want to send priority message.
572 * buffer - Address of array of send buffers.
573 * buflen - Total length of send buffers.
574 * Output: msgid - Specifies the message ID.
575 * Return: Return code from CP IUCV call.
576 * (-EINVAL) - Buffer address is NULL.
578 int iucv_send_array (u16 pathid,
583 int flags1, iucv_array_t * buffer, ulong buflen);
586 * Name: iucv_send_prmmsg
587 * Purpose: This function transmits data to another application.
588 * Prmmsg specifies that the 8-bytes of data are to be moved
589 * into the parameter list. This is a one-way message and the
590 * receiver will not reply to the message.
591 * Input: pathid - Path identification number.
592 * trgcls - Specifies target class.
593 * srccls - Specifies the source message class.
594 * msgtag - Specifies a tag to be associated with the message.
595 * flags1 - Option for path.
596 * IPPRTY- 0x20 specifies if you want to send priority message.
597 * prmmsg - 8-bytes of data to be placed into parameter list.
598 * Output: msgid - Specifies the message ID.
599 * Return: Return code from CP IUCV call.
601 int iucv_send_prmmsg (u16 pathid,
604 u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]);
607 * Name: iucv_send2way
608 * Purpose: This function transmits data to another application.
609 * Data to be transmitted is in a buffer. The receiver
610 * of the send is expected to reply to the message and
611 * a buffer is provided into which IUCV moves the reply
613 * Input: pathid - Path identification number.
614 * trgcls - Specifies target class.
615 * srccls - Specifies the source message class.
616 * msgtag - Specifies a tag associated with the message.
617 * flags1 - Option for path.
618 * IPPRTY- 0x20 Specifies if you want to send priority message.
619 * buffer - Address of send buffer.
620 * buflen - Length of send buffer.
621 * ansbuf - Address of buffer into which IUCV moves the reply of
623 * anslen - Address of length of buffer.
624 * Output: msgid - Specifies the message ID.
625 * Return: Return code from CP IUCV call.
626 * (-EINVAL) - Buffer or ansbuf address is NULL.
628 int iucv_send2way (u16 pathid,
634 void *buffer, ulong buflen, void *ansbuf, ulong anslen);
637 * Name: iucv_send2way_array
638 * Purpose: This function transmits data to another application.
639 * The contents of buffer is the address of the array of
640 * addresses and lengths of discontiguous buffers that hold
641 * the message text. The receiver of the send is expected to
642 * reply to the message and a buffer is provided into which
643 * IUCV moves the reply to this message.
644 * Input: pathid - Path identification number.
645 * trgcls - Specifies target class.
646 * srccls - Specifies the source message class.
647 * msgtag - Specifies a tag to be associated with the message.
648 * flags1 - Option for path.
649 * IPPRTY- 0x20 Specifies if you want to send priority message.
650 * buffer - Sddress of array of send buffers.
651 * buflen - Total length of send buffers.
652 * ansbuf - Address of array of buffer into which IUCV moves the reply
654 * anslen - Address of length reply buffers.
655 * Output: msgid - Specifies the message ID.
656 * Return: Return code from CP IUCV call.
657 * (-EINVAL) - Buffer address is NULL.
659 int iucv_send2way_array (u16 pathid,
665 iucv_array_t * buffer,
666 ulong buflen, iucv_array_t * ansbuf, ulong anslen);
669 * Name: iucv_send2way_prmmsg
670 * Purpose: This function transmits data to another application.
671 * Prmmsg specifies that the 8-bytes of data are to be moved
672 * into the parameter list. This is a two-way message and the
673 * receiver of the message is expected to reply. A buffer
674 * is provided into which IUCV moves the reply to this
676 * Input: pathid - Rath identification number.
677 * trgcls - Specifies target class.
678 * srccls - Specifies the source message class.
679 * msgtag - Specifies a tag to be associated with the message.
680 * flags1 - Option for path.
681 * IPPRTY- 0x20 Specifies if you want to send priority message.
682 * prmmsg - 8-bytes of data to be placed in parameter list.
683 * ansbuf - Address of buffer into which IUCV moves the reply of
685 * anslen - Address of length of buffer.
686 * Output: msgid - Specifies the message ID.
687 * Return: Return code from CP IUCV call.
688 * (-EINVAL) - Buffer address is NULL.
690 int iucv_send2way_prmmsg (u16 pathid,
696 uchar prmmsg[8], void *ansbuf, ulong anslen);
699 * Name: iucv_send2way_prmmsg_array
700 * Purpose: This function transmits data to another application.
701 * Prmmsg specifies that the 8-bytes of data are to be moved
702 * into the parameter list. This is a two-way message and the
703 * receiver of the message is expected to reply. A buffer
704 * is provided into which IUCV moves the reply to this
705 * message. The contents of ansbuf is the address of the
706 * array of addresses and lengths of discontiguous buffers
707 * that contain the reply.
708 * Input: pathid - Path identification number.
709 * trgcls - Specifies target class.
710 * srccls - Specifies the source message class.
711 * msgtag - Specifies a tag to be associated with the message.
712 * flags1 - Option for path.
713 * IPPRTY- 0x20 specifies if you want to send priority message.
714 * prmmsg - 8-bytes of data to be placed into the parameter list.
715 * ansbuf - Address of array of buffer into which IUCV moves the reply
717 * anslen - Address of length of reply buffers.
718 * Output: msgid - Specifies the message ID.
719 * Return: Return code from CP IUCV call.
720 * (-EINVAL) - Ansbuf address is NULL.
722 int iucv_send2way_prmmsg_array (u16 pathid,
729 iucv_array_t * ansbuf, ulong anslen);
733 * Purpose: This function enables or disables the following IUCV
734 * external interruptions: Nonpriority and priority message
735 * interrupts, nonpriority and priority reply interrupts.
736 * Input: SetMaskFlag - options for interrupts
737 * 0x80 - Nonpriority_MessagePendingInterruptsFlag
738 * 0x40 - Priority_MessagePendingInterruptsFlag
739 * 0x20 - Nonpriority_MessageCompletionInterruptsFlag
740 * 0x10 - Priority_MessageCompletionInterruptsFlag
741 * 0x08 - IUCVControlInterruptsFlag
743 * Return: Return code from CP IUCV call.
745 int iucv_setmask (int SetMaskFlag);
749 * Purpose: This function terminates an IUCV path.
750 * Input: pathid - Path identification number.
751 * user_data - 16-bytes of user data.
753 * Return: Return code from CP IUCV call.
754 * (-EINVAL) - Interal error, wild pointer.
756 int iucv_sever (u16 pathid, uchar user_data[16]);