iucv.h 30.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6
/*
 *  drivers/s390/net/iucv.h
 *    IUCV base support.
 *
 *  S390 version
 *    Copyright (C) 2000 IBM Corporation
7
 *    Author(s):Alan Altmark (Alan_Altmark@us.ibm.com)
L
Linus Torvalds 已提交
8 9 10 11 12 13 14 15 16 17 18
 *		Xenia Tkatschow (xenia@us.ibm.com)
 *
 *
 * Functionality:
 * To explore any of the IUCV functions, one must first register
 * their program using iucv_register_program(). Once your program has
 * successfully completed a register, it can exploit the other functions.
 * For furthur reference on all IUCV functionality, refer to the
 * CP Programming Services book, also available on the web
 * thru www.ibm.com/s390/vm/pubs, manual # SC24-5760
 *
19 20 21 22 23 24 25 26
 *      Definition of Return Codes
 *      -All positive return codes including zero are reflected back
 *       from CP except for iucv_register_program. The definition of each
 *       return code can be found in CP Programming Services book.
 *       Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760
 *      - Return Code of:
 *             (-EINVAL) Invalid value
 *             (-ENOMEM) storage allocation failed
L
Linus Torvalds 已提交
27
 *	pgmask defined in iucv_register_program will be set depending on input
28 29
 *	paramters.
 *
L
Linus Torvalds 已提交
30 31 32 33 34 35 36 37 38 39
 */

#include <linux/types.h>
#include <asm/debug.h>

/**
 * Debug Facility stuff
 */
#define IUCV_DBF_SETUP_NAME "iucv_setup"
#define IUCV_DBF_SETUP_LEN 32
40
#define IUCV_DBF_SETUP_PAGES 2
L
Linus Torvalds 已提交
41 42 43 44 45
#define IUCV_DBF_SETUP_NR_AREAS 1
#define IUCV_DBF_SETUP_LEVEL 3

#define IUCV_DBF_DATA_NAME "iucv_data"
#define IUCV_DBF_DATA_LEN 128
46
#define IUCV_DBF_DATA_PAGES 2
L
Linus Torvalds 已提交
47 48 49 50 51
#define IUCV_DBF_DATA_NR_AREAS 1
#define IUCV_DBF_DATA_LEVEL 2

#define IUCV_DBF_TRACE_NAME "iucv_trace"
#define IUCV_DBF_TRACE_LEN 16
52
#define IUCV_DBF_TRACE_PAGES 4
L
Linus Torvalds 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
#define IUCV_DBF_TRACE_NR_AREAS 1
#define IUCV_DBF_TRACE_LEVEL 3

#define IUCV_DBF_TEXT(name,level,text) \
	do { \
		debug_text_event(iucv_dbf_##name,level,text); \
	} while (0)

#define IUCV_DBF_HEX(name,level,addr,len) \
	do { \
		debug_event(iucv_dbf_##name,level,(void*)(addr),len); \
	} while (0)

DECLARE_PER_CPU(char[256], iucv_dbf_txt_buf);

#define IUCV_DBF_TEXT_(name,level,text...)				\
	do {								\
		char* iucv_dbf_txt_buf = get_cpu_var(iucv_dbf_txt_buf);	\
		sprintf(iucv_dbf_txt_buf, text);		  	\
		debug_text_event(iucv_dbf_##name,level,iucv_dbf_txt_buf); \
		put_cpu_var(iucv_dbf_txt_buf);				\
	} while (0)

#define IUCV_DBF_SPRINTF(name,level,text...) \
	do { \
		debug_sprintf_event(iucv_dbf_trace, level, ##text ); \
		debug_sprintf_event(iucv_dbf_trace, level, text ); \
	} while (0)

/**
 * some more debug stuff
 */
#define IUCV_HEXDUMP16(importance,header,ptr) \
PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
		   "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
		   *(((char*)ptr)),*(((char*)ptr)+1),*(((char*)ptr)+2), \
		   *(((char*)ptr)+3),*(((char*)ptr)+4),*(((char*)ptr)+5), \
		   *(((char*)ptr)+6),*(((char*)ptr)+7),*(((char*)ptr)+8), \
		   *(((char*)ptr)+9),*(((char*)ptr)+10),*(((char*)ptr)+11), \
		   *(((char*)ptr)+12),*(((char*)ptr)+13), \
		   *(((char*)ptr)+14),*(((char*)ptr)+15)); \
PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
		   "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
		   *(((char*)ptr)+16),*(((char*)ptr)+17), \
		   *(((char*)ptr)+18),*(((char*)ptr)+19), \
		   *(((char*)ptr)+20),*(((char*)ptr)+21), \
		   *(((char*)ptr)+22),*(((char*)ptr)+23), \
		   *(((char*)ptr)+24),*(((char*)ptr)+25), \
		   *(((char*)ptr)+26),*(((char*)ptr)+27), \
		   *(((char*)ptr)+28),*(((char*)ptr)+29), \
		   *(((char*)ptr)+30),*(((char*)ptr)+31));

static inline void
iucv_hex_dump(unsigned char *buf, size_t len)
{
	size_t i;

	for (i = 0; i < len; i++) {
		if (i && !(i % 16))
			printk("\n");
		printk("%02x ", *(buf + i));
	}
	printk("\n");
}
/**
 * end of debug stuff
 */

#define uchar  unsigned char
#define ushort unsigned short
#define ulong  unsigned long
#define iucv_handle_t void *

/* flags1:
127 128 129 130 131 132 133
 * All flags are defined in the field IPFLAGS1 of each function
 * and can be found in CP Programming Services.
 * IPLOCAL  - Indicates the connect can only be satisfied on the
 *            local system
 * IPPRTY   - Indicates a priority message
 * IPQUSCE  - Indicates you do not want to receive messages on a
 *            path until an iucv_resume is issued
L
Linus Torvalds 已提交
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
 * IPRMDATA - Indicates that the message is in the parameter list
 */
#define IPLOCAL   	0x01
#define IPPRTY         	0x20
#define IPQUSCE        	0x40
#define IPRMDATA       	0x80

/* flags1_out:
 * All flags are defined in the output field of IPFLAGS1 for each function
 * and can be found in CP Programming Services.
 * IPNORPY - Specifies this is a one-way message and no reply is expected.
 * IPPRTY   - Indicates a priority message is permitted. Defined in flags1.
 */
#define IPNORPY         0x10

#define Nonpriority_MessagePendingInterruptsFlag         0x80
#define Priority_MessagePendingInterruptsFlag            0x40
#define Nonpriority_MessageCompletionInterruptsFlag      0x20
#define Priority_MessageCompletionInterruptsFlag         0x10
#define IUCVControlInterruptsFlag                        0x08
#define AllInterrupts                                    0xf8
/*
 * Mapping of external interrupt buffers should be used with the corresponding
157 158
 * interrupt types.
 * Names: iucv_ConnectionPending    ->  connection pending
L
Linus Torvalds 已提交
159
 *        iucv_ConnectionComplete   ->  connection complete
160 161 162 163 164
 *        iucv_ConnectionSevered    ->  connection severed
 *        iucv_ConnectionQuiesced   ->  connection quiesced
 *        iucv_ConnectionResumed    ->  connection resumed
 *        iucv_MessagePending       ->  message pending
 *        iucv_MessageComplete      ->  message complete
L
Linus Torvalds 已提交
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
 */
typedef struct {
	u16 ippathid;
	uchar ipflags1;
	uchar iptype;
	u16 ipmsglim;
	u16 res1;
	uchar ipvmid[8];
	uchar ipuser[16];
	u32 res3;
	uchar ippollfg;
	uchar res4[3];
} iucv_ConnectionPending;

typedef struct {
	u16 ippathid;
	uchar ipflags1;
	uchar iptype;
	u16 ipmsglim;
	u16 res1;
	uchar res2[8];
	uchar ipuser[16];
	u32 res3;
	uchar ippollfg;
	uchar res4[3];
} iucv_ConnectionComplete;

typedef struct {
	u16 ippathid;
	uchar res1;
	uchar iptype;
	u32 res2;
	uchar res3[8];
	uchar ipuser[16];
	u32 res4;
	uchar ippollfg;
	uchar res5[3];
} iucv_ConnectionSevered;

typedef struct {
	u16 ippathid;
	uchar res1;
	uchar iptype;
	u32 res2;
	uchar res3[8];
	uchar ipuser[16];
	u32 res4;
	uchar ippollfg;
	uchar res5[3];
} iucv_ConnectionQuiesced;

typedef struct {
	u16 ippathid;
	uchar res1;
	uchar iptype;
	u32 res2;
	uchar res3[8];
	uchar ipuser[16];
	u32 res4;
	uchar ippollfg;
	uchar res5[3];
} iucv_ConnectionResumed;

typedef struct {
	u16 ippathid;
	uchar ipflags1;
	uchar iptype;
	u32 ipmsgid;
	u32 iptrgcls;
	union u2 {
		u32 iprmmsg1_u32;
		uchar iprmmsg1[4];
	} ln1msg1;
	union u1 {
		u32 ipbfln1f;
		uchar iprmmsg2[4];
	} ln1msg2;
	u32 res1[3];
	u32 ipbfln2f;
	uchar ippollfg;
	uchar res2[3];
} iucv_MessagePending;

typedef struct {
	u16 ippathid;
	uchar ipflags1;
	uchar iptype;
	u32 ipmsgid;
	u32 ipaudit;
	uchar iprmmsg[8];
	u32 ipsrccls;
	u32 ipmsgtag;
	u32 res;
	u32 ipbfln2f;
	uchar ippollfg;
	uchar res2[3];
} iucv_MessageComplete;

263 264 265 266 267 268 269 270 271 272
/*
 * iucv_interrupt_ops_t: Is a vector of functions that handle
 * IUCV interrupts.
 * Parameter list:
 *         eib - is a pointer to a 40-byte area described
 *               with one of the structures above.
 *         pgm_data - this data is strictly for the
 *                    interrupt handler that is passed by
 *                    the application. This may be an address
 *                    or token.
L
Linus Torvalds 已提交
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
*/
typedef struct {
	void (*ConnectionPending) (iucv_ConnectionPending * eib,
				   void *pgm_data);
	void (*ConnectionComplete) (iucv_ConnectionComplete * eib,
				    void *pgm_data);
	void (*ConnectionSevered) (iucv_ConnectionSevered * eib,
				   void *pgm_data);
	void (*ConnectionQuiesced) (iucv_ConnectionQuiesced * eib,
				    void *pgm_data);
	void (*ConnectionResumed) (iucv_ConnectionResumed * eib,
				   void *pgm_data);
	void (*MessagePending) (iucv_MessagePending * eib, void *pgm_data);
	void (*MessageComplete) (iucv_MessageComplete * eib, void *pgm_data);
} iucv_interrupt_ops_t;

/*
290 291
 *iucv_array_t : Defines buffer array.
 * Inside the array may be 31- bit addresses and 31-bit lengths.
L
Linus Torvalds 已提交
292 293 294 295 296 297 298 299 300 301
*/
typedef struct {
	u32 address;
	u32 length;
} iucv_array_t __attribute__ ((aligned (8)));

extern struct bus_type iucv_bus;
extern struct device *iucv_root;

/*   -prototypes-    */
302 303 304 305
/*
 * Name: iucv_register_program
 * Purpose: Registers an application with IUCV
 * Input: prmname - user identification
L
Linus Torvalds 已提交
306 307 308
 *        userid  - machine identification
 *        pgmmask - indicates which bits in the prmname and userid combined will be
 *  		    used to determine who is given control
309 310 311 312
 *        ops     - address of vector of interrupt handlers
 *        pgm_data- application data passed to interrupt handlers
 * Output: NA
 * Return: address of handler
L
Linus Torvalds 已提交
313
 *         (0) - Error occurred, registration not completed.
314
 * NOTE: Exact cause of failure will be recorded in syslog.
L
Linus Torvalds 已提交
315 316 317 318 319 320 321
*/
iucv_handle_t iucv_register_program (uchar pgmname[16],
				     uchar userid[8],
				     uchar pgmmask[24],
				     iucv_interrupt_ops_t * ops,
				     void *pgm_data);

322 323 324 325 326 327 328
/*
 * Name: iucv_unregister_program
 * Purpose: Unregister application with IUCV
 * Input: address of handler
 * Output: NA
 * Return: (0) - Normal return
 *         (-EINVAL) - Internal error, wild pointer
L
Linus Torvalds 已提交
329 330 331 332 333 334 335
*/
int iucv_unregister_program (iucv_handle_t handle);

/*
 * Name: iucv_accept
 * Purpose: This function is issued after the user receives a Connection Pending external
 *          interrupt and now wishes to complete the IUCV communication path.
336
 * Input:  pathid - u16 , Path identification number
L
Linus Torvalds 已提交
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
 *         msglim_reqstd - u16, The number of outstanding messages requested.
 *         user_data - uchar[16], Data specified by the iucv_connect function.
 *	   flags1 - int, Contains options for this path.
 *           -IPPRTY   - 0x20- Specifies if you want to send priority message.
 *           -IPRMDATA - 0x80, Specifies whether your program can handle a message
 *            	in  the parameter list.
 *           -IPQUSCE  - 0x40, Specifies whether you want to quiesce the path being
 *		established.
 *         handle - iucv_handle_t, Address of handler.
 *         pgm_data - void *, Application data passed to interrupt handlers.
 *         flags1_out - int * Contains information about the path
 *           - IPPRTY - 0x20, Indicates you may send priority messages.
 *         msglim - *u16, Number of outstanding messages.
 * Output: return code from CP IUCV call.
*/

int iucv_accept (u16 pathid,
		 u16 msglim_reqstd,
		 uchar user_data[16],
		 int flags1,
		 iucv_handle_t handle,
		 void *pgm_data, int *flags1_out, u16 * msglim);

/*
361
 * Name: iucv_connect
L
Linus Torvalds 已提交
362
 * Purpose: This function establishes an IUCV path. Although the connect may complete
363 364 365 366 367
 *	    successfully, you are not able to use the path until you receive an IUCV
 *          Connection Complete external interrupt.
 * Input: pathid - u16 *, Path identification number
 *        msglim_reqstd - u16, Number of outstanding messages requested
 *        user_data - uchar[16], 16-byte user data
L
Linus Torvalds 已提交
368
 *	  userid - uchar[8], User identification
369
 *        system_name - uchar[8], 8-byte identifying the system name
L
Linus Torvalds 已提交
370 371 372 373
 *	  flags1 - int, Contains options for this path.
 *          -IPPRTY -   0x20, Specifies if you want to send priority message.
 *          -IPRMDATA - 0x80, Specifies whether your program can handle a message
 *            	 in  the parameter list.
374
 *          -IPQUSCE -  0x40, Specifies whether you want to quiesce the path being
L
Linus Torvalds 已提交
375
 *		established.
376
 *          -IPLOCAL -  0X01, Allows an application to force the partner to be on
L
Linus Torvalds 已提交
377
 *		the local system. If local is specified then target class cannot be
378
 *		specified.
L
Linus Torvalds 已提交
379 380 381
 *        flags1_out - int * Contains information about the path
 *           - IPPRTY - 0x20, Indicates you may send priority messages.
 *        msglim - * u16, Number of outstanding messages
382 383
 *        handle - iucv_handle_t, Address of handler
 *        pgm_data - void *, Application data passed to interrupt handlers
L
Linus Torvalds 已提交
384 385
 * Output: return code from CP IUCV call
 *         rc - return code from iucv_declare_buffer
386 387 388
 *         -EINVAL - Invalid handle passed by application
 *         -EINVAL - Pathid address is NULL
 *         add_pathid_result - Return code from internal function add_pathid
L
Linus Torvalds 已提交
389 390 391 392 393 394 395 396 397 398 399
*/
int
    iucv_connect (u16 * pathid,
		  u16 msglim_reqstd,
		  uchar user_data[16],
		  uchar userid[8],
		  uchar system_name[8],
		  int flags1,
		  int *flags1_out,
		  u16 * msglim, iucv_handle_t handle, void *pgm_data);

400 401 402 403
/*
 * Name: iucv_purge
 * Purpose: This function cancels a message that you have sent.
 * Input: pathid - Path identification number.
L
Linus Torvalds 已提交
404
 *        msgid - Specifies the message ID of the message to be purged.
405 406 407 408 409
 *        srccls - Specifies the source message class.
 * Output: audit - Contains information about asynchronous error
 *                 that may have affected the normal completion
 *                 of this message.
 * Return: Return code from CP IUCV call.
L
Linus Torvalds 已提交
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
*/
int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit);
/*
 * Name: iucv_query_maxconn
 * Purpose: This function determines the maximum number of communication paths you
 *	    may establish.
 * Return:  maxconn - ulong, Maximum number of connection the virtual machine may
 *          establish.
*/
ulong iucv_query_maxconn (void);

/*
 * Name: iucv_query_bufsize
 * Purpose: This function determines how large an external interrupt
 *          buffer IUCV requires to store information.
 * Return:  bufsize - ulong, Size of external interrupt buffer.
 */
ulong iucv_query_bufsize (void);

429 430 431 432 433 434 435 436 437
/*
 * Name: iucv_quiesce
 * Purpose: This function temporarily suspends incoming messages on an
 *          IUCV path. You can later reactivate the path by invoking
 *          the iucv_resume function.
 * Input: pathid - Path identification number
 *        user_data  - 16-bytes of user data
 * Output: NA
 * Return: Return code from CP IUCV call.
L
Linus Torvalds 已提交
438 439 440
*/
int iucv_quiesce (u16 pathid, uchar user_data[16]);

441 442 443
/*
 * Name: iucv_receive
 * Purpose: This function receives messages that are being sent to you
L
Linus Torvalds 已提交
444 445
 *          over established paths. Data will be returned in buffer for length of
 *          buflen.
446 447 448 449 450 451 452
 * Input:
 *       pathid - Path identification number.
 *       buffer - Address of buffer to receive.
 *       buflen - Length of buffer to receive.
 *       msgid - Specifies the message ID.
 *       trgcls - Specifies target class.
 * Output:
L
Linus Torvalds 已提交
453 454
 *	 flags1_out: int *, Contains information about this path.
 *         IPNORPY - 0x10 Specifies this is a one-way message and no reply is
455 456
 *	   expected.
 *         IPPRTY  - 0x20 Specifies if you want to send priority message.
L
Linus Torvalds 已提交
457 458 459
 *         IPRMDATA - 0x80 specifies the data is contained in the parameter list
 *       residual_buffer - address of buffer updated by the number
 *                         of bytes you have received.
460
 *       residual_length -
L
Linus Torvalds 已提交
461 462 463 464 465 466 467 468
 *              Contains one of the following values, if the receive buffer is:
 *               The same length as the message, this field is zero.
 *               Longer than the message, this field contains the number of
 *                bytes remaining in the buffer.
 *               Shorter than the message, this field contains the residual
 *                count (that is, the number of bytes remaining in the
 *                message that does not fit into the buffer. In this
 *                case b2f0_result = 5.
469 470
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - buffer address is pointing to NULL
L
Linus Torvalds 已提交
471 472 473 474 475 476 477 478 479
*/
int iucv_receive (u16 pathid,
		  u32 msgid,
		  u32 trgcls,
		  void *buffer,
		  ulong buflen,
		  int *flags1_out,
		  ulong * residual_buffer, ulong * residual_length);

480 481 482
 /*
  * Name: iucv_receive_array
  * Purpose: This function receives messages that are being sent to you
L
Linus Torvalds 已提交
483 484
  *          over established paths. Data will be returned in first buffer for
  *          length of first buffer.
485
  * Input: pathid - Path identification number.
L
Linus Torvalds 已提交
486 487
  *        msgid - specifies the message ID.
  *        trgcls - Specifies target class.
488 489
  *        buffer - Address of array of buffers.
  *        buflen - Total length of buffers.
L
Linus Torvalds 已提交
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
  * Output:
  *        flags1_out: int *, Contains information about this path.
  *          IPNORPY - 0x10 Specifies this is a one-way message and no reply is
  *          expected.
  *          IPPRTY  - 0x20 Specifies if you want to send priority message.
  *          IPRMDATA - 0x80 specifies the data is contained in the parameter list
  *       residual_buffer - address points to the current list entry IUCV
  *                         is working on.
  *       residual_length -
  *              Contains one of the following values, if the receive buffer is:
  *               The same length as the message, this field is zero.
  *               Longer than the message, this field contains the number of
  *                bytes remaining in the buffer.
  *               Shorter than the message, this field contains the residual
  *                count (that is, the number of bytes remaining in the
  *                message that does not fit into the buffer. In this
  *                case b2f0_result = 5.
507 508
  * Return: Return code from CP IUCV call.
  *         (-EINVAL) - Buffer address is NULL.
L
Linus Torvalds 已提交
509 510 511 512 513 514 515 516 517
  */
int iucv_receive_array (u16 pathid,
			u32 msgid,
			u32 trgcls,
			iucv_array_t * buffer,
			ulong buflen,
			int *flags1_out,
			ulong * residual_buffer, ulong * residual_length);

518 519 520 521 522 523 524 525 526 527
/*
 * Name: iucv_reject
 * Purpose: The reject function refuses a specified message. Between the
 *          time you are notified of a message and the time that you
 *          complete the message, the message may be rejected.
 * Input: pathid - Path identification number.
 *        msgid - Specifies the message ID.
 *        trgcls - Specifies target class.
 * Output: NA
 * Return: Return code from CP IUCV call.
L
Linus Torvalds 已提交
528 529 530
*/
int iucv_reject (u16 pathid, u32 msgid, u32 trgcls);

531 532 533 534 535 536 537 538
/*
 * Name: iucv_reply
 * Purpose: This function responds to the two-way messages that you
 *          receive. You must identify completely the message to
 *          which you wish to reply. ie, pathid, msgid, and trgcls.
 * Input: pathid - Path identification number.
 *        msgid - Specifies the message ID.
 *        trgcls - Specifies target class.
L
Linus Torvalds 已提交
539
 *        flags1 - Option for path.
540 541 542 543 544
 *          IPPRTY- 0x20, Specifies if you want to send priority message.
 *        buffer - Address of reply buffer.
 *        buflen - Length of reply buffer.
 * Output: residual_buffer - Address of buffer updated by the number
 *                    of bytes you have moved.
L
Linus Torvalds 已提交
545 546 547 548
 *         residual_length - Contains one of the following values:
 *		If the answer buffer is the same length as the reply, this field
 *		 contains zero.
 *		If the answer buffer is longer than the reply, this field contains
549
 *		 the number of bytes remaining in the buffer.
L
Linus Torvalds 已提交
550 551 552 553
 *		If the answer buffer is shorter than the reply, this field contains
 *		 a residual count (that is, the number of bytes remianing in the
 *		 reply that does not fit into the buffer. In this
 *               case b2f0_result = 5.
554 555
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Buffer address is NULL.
L
Linus Torvalds 已提交
556 557 558 559 560 561 562 563
*/
int iucv_reply (u16 pathid,
		u32 msgid,
		u32 trgcls,
		int flags1,
		void *buffer, ulong buflen, ulong * residual_buffer,
		ulong * residual_length);

564 565 566 567 568 569 570 571 572 573
/*
 * Name: iucv_reply_array
 * Purpose: This function responds to the two-way messages that you
 *          receive. You must identify completely the message to
 *          which you wish to reply. ie, pathid, msgid, and trgcls.
 *          The array identifies a list of addresses and lengths of
 *          discontiguous buffers that contains the reply data.
 * Input: pathid - Path identification number
 *        msgid - Specifies the message ID.
 *        trgcls - Specifies target class.
L
Linus Torvalds 已提交
574 575
 *        flags1 - Option for path.
 *          IPPRTY- 0x20, Specifies if you want to send priority message.
576 577
 *        buffer - Address of array of reply buffers.
 *        buflen - Total length of reply buffers.
L
Linus Torvalds 已提交
578 579 580 581 582 583 584 585 586 587
 * Output: residual_buffer - Address of buffer which IUCV is currently working on.
 *         residual_length - Contains one of the following values:
 *              If the answer buffer is the same length as the reply, this field
 *               contains zero.
 *              If the answer buffer is longer than the reply, this field contains
 *               the number of bytes remaining in the buffer.
 *              If the answer buffer is shorter than the reply, this field contains
 *               a residual count (that is, the number of bytes remianing in the
 *               reply that does not fit into the buffer. In this
 *               case b2f0_result = 5.
588 589
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Buffer address is NULL.
L
Linus Torvalds 已提交
590 591 592 593 594 595 596 597 598
*/
int iucv_reply_array (u16 pathid,
		      u32 msgid,
		      u32 trgcls,
		      int flags1,
		      iucv_array_t * buffer,
		      ulong buflen, ulong * residual_address,
		      ulong * residual_length);

599 600 601 602 603 604 605 606 607 608
/*
 * Name: iucv_reply_prmmsg
 * Purpose: This function responds to the two-way messages that you
 *          receive. You must identify completely the message to
 *          which you wish to reply. ie, pathid, msgid, and trgcls.
 *          Prmmsg signifies the data is moved into the
 *          parameter list.
 * Input: pathid - Path identification number.
 *        msgid - Specifies the message ID.
 *        trgcls - Specifies target class.
L
Linus Torvalds 已提交
609 610
 *        flags1 - Option for path.
 *          IPPRTY- 0x20 Specifies if you want to send priority message.
611 612 613 614
 *        prmmsg - 8-bytes of data to be placed into the parameter.
 *                 list.
 * Output: NA
 * Return: Return code from CP IUCV call.
L
Linus Torvalds 已提交
615 616 617 618
*/
int iucv_reply_prmmsg (u16 pathid,
		       u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]);

619 620 621 622 623 624 625
/*
 * Name: iucv_resume
 * Purpose: This function restores communications over a quiesced path
 * Input: pathid - Path identification number.
 *        user_data  - 16-bytes of user data.
 * Output: NA
 * Return: Return code from CP IUCV call.
L
Linus Torvalds 已提交
626 627 628
*/
int iucv_resume (u16 pathid, uchar user_data[16]);

629 630 631 632 633 634 635 636 637 638
/*
 * Name: iucv_send
 * Purpose: This function transmits data to another application.
 *          Data to be transmitted is in a buffer and this is a
 *          one-way message and the receiver will not reply to the
 *          message.
 * Input: pathid - Path identification number.
 *        trgcls - Specifies target class.
 *        srccls - Specifies the source message class.
 *        msgtag - Specifies a tag to be associated with the message.
L
Linus Torvalds 已提交
639 640
 *        flags1 - Option for path.
 *          IPPRTY- 0x20 Specifies if you want to send priority message.
641 642 643 644 645
 *        buffer - Address of send buffer.
 *        buflen - Length of send buffer.
 * Output: msgid - Specifies the message ID.
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Buffer address is NULL.
L
Linus Torvalds 已提交
646 647 648 649 650 651
*/
int iucv_send (u16 pathid,
	       u32 * msgid,
	       u32 trgcls,
	       u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen);

652 653 654 655 656 657 658 659 660 661
/*
 * Name: iucv_send_array
 * Purpose: This function transmits data to another application.
 *          The contents of buffer is the address of the array of
 *          addresses and lengths of discontiguous buffers that hold
 *          the message text. This is a one-way message and the
 *          receiver will not reply to the message.
 * Input: pathid - Path identification number.
 *        trgcls - Specifies target class.
 *        srccls - Specifies the source message class.
L
Linus Torvalds 已提交
662 663
 *        msgtag - Specifies a tag to be associated witht the message.
 *        flags1 - Option for path.
664 665 666 667 668 669
 *          IPPRTY- specifies if you want to send priority message.
 *        buffer - Address of array of send buffers.
 *        buflen - Total length of send buffers.
 * Output: msgid - Specifies the message ID.
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Buffer address is NULL.
L
Linus Torvalds 已提交
670 671 672 673 674 675 676 677
*/
int iucv_send_array (u16 pathid,
		     u32 * msgid,
		     u32 trgcls,
		     u32 srccls,
		     u32 msgtag,
		     int flags1, iucv_array_t * buffer, ulong buflen);

678 679 680 681 682 683 684 685 686 687
/*
 * Name: iucv_send_prmmsg
 * Purpose: This function transmits data to another application.
 *          Prmmsg specifies that the 8-bytes of data are to be moved
 *          into the parameter list. This is a one-way message and the
 *          receiver will not reply to the message.
 * Input: pathid - Path identification number.
 *        trgcls - Specifies target class.
 *        srccls - Specifies the source message class.
 *        msgtag - Specifies a tag to be associated with the message.
L
Linus Torvalds 已提交
688 689
 *        flags1 - Option for path.
 *          IPPRTY- 0x20 specifies if you want to send priority message.
690 691 692
 *        prmmsg - 8-bytes of data to be placed into parameter list.
 * Output: msgid - Specifies the message ID.
 * Return: Return code from CP IUCV call.
L
Linus Torvalds 已提交
693 694 695 696 697 698
*/
int iucv_send_prmmsg (u16 pathid,
		      u32 * msgid,
		      u32 trgcls,
		      u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]);

699 700 701 702 703 704 705 706 707 708 709
/*
 * Name: iucv_send2way
 * Purpose: This function transmits data to another application.
 *          Data to be transmitted is in a buffer. The receiver
 *          of the send is expected to reply to the message and
 *          a buffer is provided into which IUCV moves the reply
 *          to this message.
 * Input: pathid - Path identification number.
 *        trgcls - Specifies target class.
 *        srccls - Specifies the source message class.
 *        msgtag - Specifies a tag associated with the message.
L
Linus Torvalds 已提交
710 711
 *        flags1 - Option for path.
 *          IPPRTY- 0x20 Specifies if you want to send priority message.
712 713 714 715 716 717 718 719
 *        buffer - Address of send buffer.
 *        buflen - Length of send buffer.
 *        ansbuf - Address of buffer into which IUCV moves the reply of
 *                 this message.
 *        anslen - Address of length of buffer.
 * Output: msgid - Specifies the message ID.
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Buffer or ansbuf address is NULL.
L
Linus Torvalds 已提交
720 721 722 723 724 725 726 727 728
*/
int iucv_send2way (u16 pathid,
		   u32 * msgid,
		   u32 trgcls,
		   u32 srccls,
		   u32 msgtag,
		   int flags1,
		   void *buffer, ulong buflen, void *ansbuf, ulong anslen);

729 730 731 732 733 734 735 736 737 738 739 740
/*
 * Name: iucv_send2way_array
 * Purpose: This function transmits data to another application.
 *          The contents of buffer is the address of the array of
 *          addresses and lengths of discontiguous buffers that hold
 *          the message text. The receiver of the send is expected to
 *          reply to the message and a buffer is provided into which
 *          IUCV moves the reply to this message.
 * Input: pathid - Path identification number.
 *        trgcls - Specifies target class.
 *        srccls - Specifies the source message class.
 *        msgtag - Specifies a tag to be associated with the message.
L
Linus Torvalds 已提交
741 742
 *        flags1 - Option for path.
 *          IPPRTY- 0x20 Specifies if you want to send priority message.
743 744 745 746 747 748 749 750
 *        buffer - Sddress of array of send buffers.
 *        buflen - Total length of send buffers.
 *        ansbuf - Address of array of buffer into which IUCV moves the reply
 *                 of this message.
 *        anslen - Address of length reply buffers.
 * Output: msgid - Specifies the message ID.
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Buffer address is NULL.
L
Linus Torvalds 已提交
751 752 753 754 755 756 757 758 759 760
*/
int iucv_send2way_array (u16 pathid,
			 u32 * msgid,
			 u32 trgcls,
			 u32 srccls,
			 u32 msgtag,
			 int flags1,
			 iucv_array_t * buffer,
			 ulong buflen, iucv_array_t * ansbuf, ulong anslen);

761 762 763 764 765 766 767 768 769 770 771 772
/*
 * Name: iucv_send2way_prmmsg
 * Purpose: This function transmits data to another application.
 *          Prmmsg specifies that the 8-bytes of data are to be moved
 *          into the parameter list. This is a two-way message and the
 *          receiver of the message is expected to reply. A buffer
 *          is provided into which IUCV moves the reply to this
 *          message.
 * Input: pathid - Rath identification number.
 *        trgcls - Specifies target class.
 *        srccls - Specifies the source message class.
 *        msgtag - Specifies a tag to be associated with the message.
L
Linus Torvalds 已提交
773 774
 *        flags1 - Option for path.
 *          IPPRTY- 0x20 Specifies if you want to send priority message.
775 776
 *        prmmsg - 8-bytes of data to be placed in parameter list.
 *        ansbuf - Address of buffer into which IUCV moves the reply of
L
Linus Torvalds 已提交
777
 *                 this message.
778 779 780 781
 *        anslen - Address of length of buffer.
 * Output: msgid - Specifies the message ID.
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Buffer address is NULL.
L
Linus Torvalds 已提交
782 783 784 785 786 787 788 789 790
*/
int iucv_send2way_prmmsg (u16 pathid,
			  u32 * msgid,
			  u32 trgcls,
			  u32 srccls,
			  u32 msgtag,
			  ulong flags1,
			  uchar prmmsg[8], void *ansbuf, ulong anslen);

791 792 793 794 795 796 797 798 799 800 801 802 803 804
/*
 * Name: iucv_send2way_prmmsg_array
 * Purpose: This function transmits data to another application.
 *          Prmmsg specifies that the 8-bytes of data are to be moved
 *          into the parameter list. This is a two-way message and the
 *          receiver of the message is expected to reply. A buffer
 *          is provided into which IUCV moves the reply to this
 *          message. The contents of ansbuf is the address of the
 *          array of addresses and lengths of discontiguous buffers
 *          that contain the reply.
 * Input: pathid - Path identification number.
 *        trgcls - Specifies target class.
 *        srccls - Specifies the source message class.
 *        msgtag - Specifies a tag to be associated with the message.
L
Linus Torvalds 已提交
805 806
 *        flags1 - Option for path.
 *          IPPRTY- 0x20 specifies if you want to send priority message.
807
 *        prmmsg - 8-bytes of data to be placed into the parameter list.
L
Linus Torvalds 已提交
808
 *        ansbuf - Address of array of buffer into which IUCV moves the reply
809 810 811 812 813
 *                 of this message.
 *        anslen - Address of length of reply buffers.
 * Output: msgid - Specifies the message ID.
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Ansbuf address is NULL.
L
Linus Torvalds 已提交
814 815 816 817 818 819 820 821 822 823
*/
int iucv_send2way_prmmsg_array (u16 pathid,
				u32 * msgid,
				u32 trgcls,
				u32 srccls,
				u32 msgtag,
				int flags1,
				uchar prmmsg[8],
				iucv_array_t * ansbuf, ulong anslen);

824 825 826 827 828
/*
 * Name: iucv_setmask
 * Purpose: This function enables or disables the following IUCV
 *          external interruptions: Nonpriority and priority message
 *          interrupts, nonpriority and priority reply interrupts.
L
Linus Torvalds 已提交
829
 * Input: SetMaskFlag - options for interrupts
830 831 832 833
 *           0x80 - Nonpriority_MessagePendingInterruptsFlag
 *           0x40 - Priority_MessagePendingInterruptsFlag
 *           0x20 - Nonpriority_MessageCompletionInterruptsFlag
 *           0x10 - Priority_MessageCompletionInterruptsFlag
L
Linus Torvalds 已提交
834
 *           0x08 - IUCVControlInterruptsFlag
835 836
 * Output: NA
 * Return: Return code from CP IUCV call.
L
Linus Torvalds 已提交
837 838 839
*/
int iucv_setmask (int SetMaskFlag);

840 841 842 843 844 845 846 847
/*
 * Name: iucv_sever
 * Purpose: This function terminates an IUCV path.
 * Input: pathid - Path identification number.
 *        user_data - 16-bytes of user data.
 * Output: NA
 * Return: Return code from CP IUCV call.
 *         (-EINVAL) - Interal error, wild pointer.
L
Linus Torvalds 已提交
848 849
*/
int iucv_sever (u16 pathid, uchar user_data[16]);