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
68 * Mapping of external interrupt buffers should be used with the corresponding
70 * Names: iucv_ConnectionPending -> connection pending
71 * iucv_ConnectionComplete -> connection complete
72 * iucv_ConnectionSevered -> connection severed
73 * iucv_ConnectionQuiesced -> connection quiesced
74 * iucv_ConnectionResumed -> connection resumed
75 * iucv_MessagePending -> message pending
76 * iucv_MessageComplete -> message complete
89 } iucv_ConnectionPending;
102 } iucv_ConnectionComplete;
114 } iucv_ConnectionSevered;
126 } iucv_ConnectionQuiesced;
138 } iucv_ConnectionResumed;
155 } iucv_MessagePending;
170 } iucv_MessageComplete;
173 * iucv_interrupt_ops_t: Is a vector of functions that handle
176 * eib - is a pointer to a 40-byte area described
177 * with one of the structures above.
178 * pgm_data - this data is strictly for the
179 * interrupt handler that is passed by
180 * the application. This may be an address
184 void (*ConnectionPending) (iucv_ConnectionPending * eib,
186 void (*ConnectionComplete) (iucv_ConnectionComplete * eib,
188 void (*ConnectionSevered) (iucv_ConnectionSevered * eib,
190 void (*ConnectionQuiesced) (iucv_ConnectionQuiesced * eib,
192 void (*ConnectionResumed) (iucv_ConnectionResumed * eib,
194 void (*MessagePending) (iucv_MessagePending * eib, void *pgm_data);
195 void (*MessageComplete) (iucv_MessageComplete * eib, void *pgm_data);
196 } iucv_interrupt_ops_t;
199 *iucv_array_t : Defines buffer array.
200 * Inside the array may be 31- bit addresses and 31-bit lengths.
205 } iucv_array_t __attribute__ ((aligned (8)));
207 extern struct bus_type iucv_bus;
208 extern struct device *iucv_root;
212 * Name: iucv_register_program
213 * Purpose: Registers an application with IUCV
214 * Input: prmname - user identification
215 * userid - machine identification
216 * pgmmask - indicates which bits in the prmname and userid combined will be
217 * used to determine who is given control
218 * ops - address of vector of interrupt handlers
219 * pgm_data- application data passed to interrupt handlers
221 * Return: address of handler
222 * (0) - Error occurred, registration not completed.
223 * NOTE: Exact cause of failure will be recorded in syslog.
225 iucv_handle_t iucv_register_program (uchar pgmname[16],
228 iucv_interrupt_ops_t * ops,
232 * Name: iucv_unregister_program
233 * Purpose: Unregister application with IUCV
234 * Input: address of handler
236 * Return: (0) - Normal return
237 * (-EINVAL) - Internal error, wild pointer
239 int iucv_unregister_program (iucv_handle_t handle);
243 * Purpose: This function is issued after the user receives a Connection Pending external
244 * interrupt and now wishes to complete the IUCV communication path.
245 * Input: pathid - u16 , Path identification number
246 * msglim_reqstd - u16, The number of outstanding messages requested.
247 * user_data - uchar[16], Data specified by the iucv_connect function.
248 * flags1 - int, Contains options for this path.
249 * -IPPRTY - 0x20- Specifies if you want to send priority message.
250 * -IPRMDATA - 0x80, Specifies whether your program can handle a message
251 * in the parameter list.
252 * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being
254 * handle - iucv_handle_t, Address of handler.
255 * pgm_data - void *, Application data passed to interrupt handlers.
256 * flags1_out - int * Contains information about the path
257 * - IPPRTY - 0x20, Indicates you may send priority messages.
258 * msglim - *u16, Number of outstanding messages.
259 * Output: return code from CP IUCV call.
262 int iucv_accept (u16 pathid,
266 iucv_handle_t handle,
267 void *pgm_data, int *flags1_out, u16 * msglim);
271 * Purpose: This function establishes an IUCV path. Although the connect may complete
272 * successfully, you are not able to use the path until you receive an IUCV
273 * Connection Complete external interrupt.
274 * Input: pathid - u16 *, Path identification number
275 * msglim_reqstd - u16, Number of outstanding messages requested
276 * user_data - uchar[16], 16-byte user data
277 * userid - uchar[8], User identification
278 * system_name - uchar[8], 8-byte identifying the system name
279 * flags1 - int, Contains options for this path.
280 * -IPPRTY - 0x20, Specifies if you want to send priority message.
281 * -IPRMDATA - 0x80, Specifies whether your program can handle a message
282 * in the parameter list.
283 * -IPQUSCE - 0x40, Specifies whether you want to quiesce the path being
285 * -IPLOCAL - 0X01, Allows an application to force the partner to be on
286 * the local system. If local is specified then target class cannot be
288 * flags1_out - int * Contains information about the path
289 * - IPPRTY - 0x20, Indicates you may send priority messages.
290 * msglim - * u16, Number of outstanding messages
291 * handle - iucv_handle_t, Address of handler
292 * pgm_data - void *, Application data passed to interrupt handlers
293 * Output: return code from CP IUCV call
294 * rc - return code from iucv_declare_buffer
295 * -EINVAL - Invalid handle passed by application
296 * -EINVAL - Pathid address is NULL
297 * add_pathid_result - Return code from internal function add_pathid
300 iucv_connect (u16 * pathid,
304 uchar system_name[8],
307 u16 * msglim, iucv_handle_t handle, void *pgm_data);
311 * Purpose: This function cancels a message that you have sent.
312 * Input: pathid - Path identification number.
313 * msgid - Specifies the message ID of the message to be purged.
314 * srccls - Specifies the source message class.
315 * Output: audit - Contains information about asynchronous error
316 * that may have affected the normal completion
318 * Return: Return code from CP IUCV call.
320 int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit);
322 * Name: iucv_query_maxconn
323 * Purpose: This function determines the maximum number of communication paths you
325 * Return: maxconn - ulong, Maximum number of connection the virtual machine may
328 ulong iucv_query_maxconn (void);
331 * Name: iucv_query_bufsize
332 * Purpose: This function determines how large an external interrupt
333 * buffer IUCV requires to store information.
334 * Return: bufsize - ulong, Size of external interrupt buffer.
336 ulong iucv_query_bufsize (void);
340 * Purpose: This function temporarily suspends incoming messages on an
341 * IUCV path. You can later reactivate the path by invoking
342 * the iucv_resume function.
343 * Input: pathid - Path identification number
344 * user_data - 16-bytes of user data
346 * Return: Return code from CP IUCV call.
348 int iucv_quiesce (u16 pathid, uchar user_data[16]);
352 * Purpose: This function receives messages that are being sent to you
353 * over established paths. Data will be returned in buffer for length of
356 * pathid - Path identification number.
357 * buffer - Address of buffer to receive.
358 * buflen - Length of buffer to receive.
359 * msgid - Specifies the message ID.
360 * trgcls - Specifies target class.
362 * flags1_out: int *, Contains information about this path.
363 * IPNORPY - 0x10 Specifies this is a one-way message and no reply is
365 * IPPRTY - 0x20 Specifies if you want to send priority message.
366 * IPRMDATA - 0x80 specifies the data is contained in the parameter list
367 * residual_buffer - address of buffer updated by the number
368 * of bytes you have received.
370 * Contains one of the following values, if the receive buffer is:
371 * The same length as the message, this field is zero.
372 * Longer than the message, this field contains the number of
373 * bytes remaining in the buffer.
374 * Shorter than the message, this field contains the residual
375 * count (that is, the number of bytes remaining in the
376 * message that does not fit into the buffer. In this
377 * case b2f0_result = 5.
378 * Return: Return code from CP IUCV call.
379 * (-EINVAL) - buffer address is pointing to NULL
381 int iucv_receive (u16 pathid,
387 ulong * residual_buffer, ulong * residual_length);
390 * Name: iucv_receive_array
391 * Purpose: This function receives messages that are being sent to you
392 * over established paths. Data will be returned in first buffer for
393 * length of first buffer.
394 * Input: pathid - Path identification number.
395 * msgid - specifies the message ID.
396 * trgcls - Specifies target class.
397 * buffer - Address of array of buffers.
398 * buflen - Total length of buffers.
400 * flags1_out: int *, Contains information about this path.
401 * IPNORPY - 0x10 Specifies this is a one-way message and no reply is
403 * IPPRTY - 0x20 Specifies if you want to send priority message.
404 * IPRMDATA - 0x80 specifies the data is contained in the parameter list
405 * residual_buffer - address points to the current list entry IUCV
408 * Contains one of the following values, if the receive buffer is:
409 * The same length as the message, this field is zero.
410 * Longer than the message, this field contains the number of
411 * bytes remaining in the buffer.
412 * Shorter than the message, this field contains the residual
413 * count (that is, the number of bytes remaining in the
414 * message that does not fit into the buffer. In this
415 * case b2f0_result = 5.
416 * Return: Return code from CP IUCV call.
417 * (-EINVAL) - Buffer address is NULL.
419 int iucv_receive_array (u16 pathid,
422 iucv_array_t * buffer,
425 ulong * residual_buffer, ulong * residual_length);
429 * Purpose: The reject function refuses a specified message. Between the
430 * time you are notified of a message and the time that you
431 * complete the message, the message may be rejected.
432 * Input: pathid - Path identification number.
433 * msgid - Specifies the message ID.
434 * trgcls - Specifies target class.
436 * Return: Return code from CP IUCV call.
438 int iucv_reject (u16 pathid, u32 msgid, u32 trgcls);
442 * Purpose: This function responds to the two-way messages that you
443 * receive. You must identify completely the message to
444 * which you wish to reply. ie, pathid, msgid, and trgcls.
445 * Input: pathid - Path identification number.
446 * msgid - Specifies the message ID.
447 * trgcls - Specifies target class.
448 * flags1 - Option for path.
449 * IPPRTY- 0x20, Specifies if you want to send priority message.
450 * buffer - Address of reply buffer.
451 * buflen - Length of reply buffer.
452 * Output: residual_buffer - Address of buffer updated by the number
453 * of bytes you have moved.
454 * residual_length - Contains one of the following values:
455 * If the answer buffer is the same length as the reply, this field
457 * If the answer buffer is longer than the reply, this field contains
458 * the number of bytes remaining in the buffer.
459 * If the answer buffer is shorter than the reply, this field contains
460 * a residual count (that is, the number of bytes remianing in the
461 * reply that does not fit into the buffer. In this
462 * case b2f0_result = 5.
463 * Return: Return code from CP IUCV call.
464 * (-EINVAL) - Buffer address is NULL.
466 int iucv_reply (u16 pathid,
470 void *buffer, ulong buflen, ulong * residual_buffer,
471 ulong * residual_length);
474 * Name: iucv_reply_array
475 * Purpose: This function responds to the two-way messages that you
476 * receive. You must identify completely the message to
477 * which you wish to reply. ie, pathid, msgid, and trgcls.
478 * The array identifies a list of addresses and lengths of
479 * discontiguous buffers that contains the reply data.
480 * Input: pathid - Path identification number
481 * msgid - Specifies the message ID.
482 * trgcls - Specifies target class.
483 * flags1 - Option for path.
484 * IPPRTY- 0x20, Specifies if you want to send priority message.
485 * buffer - Address of array of reply buffers.
486 * buflen - Total length of reply buffers.
487 * Output: residual_buffer - Address of buffer which IUCV is currently working on.
488 * residual_length - Contains one of the following values:
489 * If the answer buffer is the same length as the reply, this field
491 * If the answer buffer is longer than the reply, this field contains
492 * the number of bytes remaining in the buffer.
493 * If the answer buffer is shorter than the reply, this field contains
494 * a residual count (that is, the number of bytes remianing in the
495 * reply that does not fit into the buffer. In this
496 * case b2f0_result = 5.
497 * Return: Return code from CP IUCV call.
498 * (-EINVAL) - Buffer address is NULL.
500 int iucv_reply_array (u16 pathid,
504 iucv_array_t * buffer,
505 ulong buflen, ulong * residual_address,
506 ulong * residual_length);
509 * Name: iucv_reply_prmmsg
510 * Purpose: This function responds to the two-way messages that you
511 * receive. You must identify completely the message to
512 * which you wish to reply. ie, pathid, msgid, and trgcls.
513 * Prmmsg signifies the data is moved into the
515 * Input: pathid - Path identification number.
516 * msgid - Specifies the message ID.
517 * trgcls - Specifies target class.
518 * flags1 - Option for path.
519 * IPPRTY- 0x20 Specifies if you want to send priority message.
520 * prmmsg - 8-bytes of data to be placed into the parameter.
523 * Return: Return code from CP IUCV call.
525 int iucv_reply_prmmsg (u16 pathid,
526 u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]);
530 * Purpose: This function restores communications over a quiesced path
531 * Input: pathid - Path identification number.
532 * user_data - 16-bytes of user data.
534 * Return: Return code from CP IUCV call.
536 int iucv_resume (u16 pathid, uchar user_data[16]);
540 * Purpose: This function transmits data to another application.
541 * Data to be transmitted is in a buffer and this is a
542 * one-way message and the receiver will not reply to the
544 * Input: pathid - Path identification number.
545 * trgcls - Specifies target class.
546 * srccls - Specifies the source message class.
547 * msgtag - Specifies a tag to be associated with the message.
548 * flags1 - Option for path.
549 * IPPRTY- 0x20 Specifies if you want to send priority message.
550 * buffer - Address of send buffer.
551 * buflen - Length of send buffer.
552 * Output: msgid - Specifies the message ID.
553 * Return: Return code from CP IUCV call.
554 * (-EINVAL) - Buffer address is NULL.
556 int iucv_send (u16 pathid,
559 u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen);
562 * Name: iucv_send_array
563 * Purpose: This function transmits data to another application.
564 * The contents of buffer is the address of the array of
565 * addresses and lengths of discontiguous buffers that hold
566 * the message text. This is a one-way message and the
567 * receiver will not reply to the message.
568 * Input: pathid - Path identification number.
569 * trgcls - Specifies target class.
570 * srccls - Specifies the source message class.
571 * msgtag - Specifies a tag to be associated witht the message.
572 * flags1 - Option for path.
573 * IPPRTY- specifies if you want to send priority message.
574 * buffer - Address of array of send buffers.
575 * buflen - Total length of send buffers.
576 * Output: msgid - Specifies the message ID.
577 * Return: Return code from CP IUCV call.
578 * (-EINVAL) - Buffer address is NULL.
580 int iucv_send_array (u16 pathid,
585 int flags1, iucv_array_t * buffer, ulong buflen);
588 * Name: iucv_send_prmmsg
589 * Purpose: This function transmits data to another application.
590 * Prmmsg specifies that the 8-bytes of data are to be moved
591 * into the parameter list. This is a one-way message and the
592 * receiver will not reply to the message.
593 * Input: pathid - Path identification number.
594 * trgcls - Specifies target class.
595 * srccls - Specifies the source message class.
596 * msgtag - Specifies a tag to be associated with the message.
597 * flags1 - Option for path.
598 * IPPRTY- 0x20 specifies if you want to send priority message.
599 * prmmsg - 8-bytes of data to be placed into parameter list.
600 * Output: msgid - Specifies the message ID.
601 * Return: Return code from CP IUCV call.
603 int iucv_send_prmmsg (u16 pathid,
606 u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]);
609 * Name: iucv_send2way
610 * Purpose: This function transmits data to another application.
611 * Data to be transmitted is in a buffer. The receiver
612 * of the send is expected to reply to the message and
613 * a buffer is provided into which IUCV moves the reply
615 * Input: pathid - Path identification number.
616 * trgcls - Specifies target class.
617 * srccls - Specifies the source message class.
618 * msgtag - Specifies a tag associated with the message.
619 * flags1 - Option for path.
620 * IPPRTY- 0x20 Specifies if you want to send priority message.
621 * buffer - Address of send buffer.
622 * buflen - Length of send buffer.
623 * ansbuf - Address of buffer into which IUCV moves the reply of
625 * anslen - Address of length of buffer.
626 * Output: msgid - Specifies the message ID.
627 * Return: Return code from CP IUCV call.
628 * (-EINVAL) - Buffer or ansbuf address is NULL.
630 int iucv_send2way (u16 pathid,
636 void *buffer, ulong buflen, void *ansbuf, ulong anslen);
639 * Name: iucv_send2way_array
640 * Purpose: This function transmits data to another application.
641 * The contents of buffer is the address of the array of
642 * addresses and lengths of discontiguous buffers that hold
643 * the message text. The receiver of the send is expected to
644 * reply to the message and a buffer is provided into which
645 * IUCV moves the reply to this message.
646 * Input: pathid - Path identification number.
647 * trgcls - Specifies target class.
648 * srccls - Specifies the source message class.
649 * msgtag - Specifies a tag to be associated with the message.
650 * flags1 - Option for path.
651 * IPPRTY- 0x20 Specifies if you want to send priority message.
652 * buffer - Sddress of array of send buffers.
653 * buflen - Total length of send buffers.
654 * ansbuf - Address of array of buffer into which IUCV moves the reply
656 * anslen - Address of length reply buffers.
657 * Output: msgid - Specifies the message ID.
658 * Return: Return code from CP IUCV call.
659 * (-EINVAL) - Buffer address is NULL.
661 int iucv_send2way_array (u16 pathid,
667 iucv_array_t * buffer,
668 ulong buflen, iucv_array_t * ansbuf, ulong anslen);
671 * Name: iucv_send2way_prmmsg
672 * Purpose: This function transmits data to another application.
673 * Prmmsg specifies that the 8-bytes of data are to be moved
674 * into the parameter list. This is a two-way message and the
675 * receiver of the message is expected to reply. A buffer
676 * is provided into which IUCV moves the reply to this
678 * Input: pathid - Rath identification number.
679 * trgcls - Specifies target class.
680 * srccls - Specifies the source message class.
681 * msgtag - Specifies a tag to be associated with the message.
682 * flags1 - Option for path.
683 * IPPRTY- 0x20 Specifies if you want to send priority message.
684 * prmmsg - 8-bytes of data to be placed in parameter list.
685 * ansbuf - Address of buffer into which IUCV moves the reply of
687 * anslen - Address of length of buffer.
688 * Output: msgid - Specifies the message ID.
689 * Return: Return code from CP IUCV call.
690 * (-EINVAL) - Buffer address is NULL.
692 int iucv_send2way_prmmsg (u16 pathid,
698 uchar prmmsg[8], void *ansbuf, ulong anslen);
701 * Name: iucv_send2way_prmmsg_array
702 * Purpose: This function transmits data to another application.
703 * Prmmsg specifies that the 8-bytes of data are to be moved
704 * into the parameter list. This is a two-way message and the
705 * receiver of the message is expected to reply. A buffer
706 * is provided into which IUCV moves the reply to this
707 * message. The contents of ansbuf is the address of the
708 * array of addresses and lengths of discontiguous buffers
709 * that contain the reply.
710 * Input: pathid - Path identification number.
711 * trgcls - Specifies target class.
712 * srccls - Specifies the source message class.
713 * msgtag - Specifies a tag to be associated with the message.
714 * flags1 - Option for path.
715 * IPPRTY- 0x20 specifies if you want to send priority message.
716 * prmmsg - 8-bytes of data to be placed into the parameter list.
717 * ansbuf - Address of array of buffer into which IUCV moves the reply
719 * anslen - Address of length of reply buffers.
720 * Output: msgid - Specifies the message ID.
721 * Return: Return code from CP IUCV call.
722 * (-EINVAL) - Ansbuf address is NULL.
724 int iucv_send2way_prmmsg_array (u16 pathid,
731 iucv_array_t * ansbuf, ulong anslen);
735 * Purpose: This function enables or disables the following IUCV
736 * external interruptions: Nonpriority and priority message
737 * interrupts, nonpriority and priority reply interrupts.
738 * Input: SetMaskFlag - options for interrupts
739 * 0x80 - Nonpriority_MessagePendingInterruptsFlag
740 * 0x40 - Priority_MessagePendingInterruptsFlag
741 * 0x20 - Nonpriority_MessageCompletionInterruptsFlag
742 * 0x10 - Priority_MessageCompletionInterruptsFlag
743 * 0x08 - IUCVControlInterruptsFlag
745 * Return: Return code from CP IUCV call.
747 int iucv_setmask (int SetMaskFlag);
751 * Purpose: This function terminates an IUCV path.
752 * Input: pathid - Path identification number.
753 * user_data - 16-bytes of user data.
755 * Return: Return code from CP IUCV call.
756 * (-EINVAL) - Interal error, wild pointer.
758 int iucv_sever (u16 pathid, uchar user_data[16]);