xref: /OK3568_Linux_fs/kernel/include/net/iucv/iucv.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *  drivers/s390/net/iucv.h
4*4882a593Smuzhiyun  *    IUCV base support.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  *  S390 version
7*4882a593Smuzhiyun  *    Copyright 2000, 2006 IBM Corporation
8*4882a593Smuzhiyun  *    Author(s):Alan Altmark (Alan_Altmark@us.ibm.com)
9*4882a593Smuzhiyun  *		Xenia Tkatschow (xenia@us.ibm.com)
10*4882a593Smuzhiyun  *    Rewritten for af_iucv:
11*4882a593Smuzhiyun  *	Martin Schwidefsky <schwidefsky@de.ibm.com>
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * Functionality:
15*4882a593Smuzhiyun  * To explore any of the IUCV functions, one must first register their
16*4882a593Smuzhiyun  * program using iucv_register(). Once your program has successfully
17*4882a593Smuzhiyun  * completed a register, it can exploit the other functions.
18*4882a593Smuzhiyun  * For furthur reference on all IUCV functionality, refer to the
19*4882a593Smuzhiyun  * CP Programming Services book, also available on the web thru
20*4882a593Smuzhiyun  * www.vm.ibm.com/pubs, manual # SC24-6084
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  * Definition of Return Codes
23*4882a593Smuzhiyun  * - All positive return codes including zero are reflected back
24*4882a593Smuzhiyun  *   from CP. The definition of each return code can be found in
25*4882a593Smuzhiyun  *   CP Programming Services book.
26*4882a593Smuzhiyun  * - Return Code of:
27*4882a593Smuzhiyun  *   -EINVAL: Invalid value
28*4882a593Smuzhiyun  *   -ENOMEM: storage allocation failed
29*4882a593Smuzhiyun  */
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #include <linux/types.h>
32*4882a593Smuzhiyun #include <linux/slab.h>
33*4882a593Smuzhiyun #include <asm/debug.h>
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun /*
36*4882a593Smuzhiyun  * IUCV option flags usable by device drivers:
37*4882a593Smuzhiyun  *
38*4882a593Smuzhiyun  * IUCV_IPRMDATA  Indicates that your program can handle a message in the
39*4882a593Smuzhiyun  *		  parameter list / a message is sent in the parameter list.
40*4882a593Smuzhiyun  *		  Used for iucv_path_accept, iucv_path_connect,
41*4882a593Smuzhiyun  *		  iucv_message_reply, iucv_message_send, iucv_message_send2way.
42*4882a593Smuzhiyun  * IUCV_IPQUSCE	  Indicates that you do not want to receive messages on this
43*4882a593Smuzhiyun  *		  path until an iucv_path_resume is issued.
44*4882a593Smuzhiyun  *		  Used for iucv_path_accept, iucv_path_connect.
45*4882a593Smuzhiyun  * IUCV_IPBUFLST  Indicates that an address list is used for the message data.
46*4882a593Smuzhiyun  *		  Used for iucv_message_receive, iucv_message_send,
47*4882a593Smuzhiyun  *		  iucv_message_send2way.
48*4882a593Smuzhiyun  * IUCV_IPPRTY	  Specifies that you want to send priority messages.
49*4882a593Smuzhiyun  *		  Used for iucv_path_accept, iucv_path_connect,
50*4882a593Smuzhiyun  *		  iucv_message_reply, iucv_message_send, iucv_message_send2way.
51*4882a593Smuzhiyun  * IUCV_IPSYNC	  Indicates a synchronous send request.
52*4882a593Smuzhiyun  *		  Used for iucv_message_send, iucv_message_send2way.
53*4882a593Smuzhiyun  * IUCV_IPANSLST  Indicates that an address list is used for the reply data.
54*4882a593Smuzhiyun  *		  Used for iucv_message_reply, iucv_message_send2way.
55*4882a593Smuzhiyun  * IUCV_IPLOCAL	  Specifies that the communication partner has to be on the
56*4882a593Smuzhiyun  *		  local system. If local is specified no target class can be
57*4882a593Smuzhiyun  *		  specified.
58*4882a593Smuzhiyun  *		  Used for iucv_path_connect.
59*4882a593Smuzhiyun  *
60*4882a593Smuzhiyun  * All flags are defined in the input field IPFLAGS1 of each function
61*4882a593Smuzhiyun  * and can be found in CP Programming Services.
62*4882a593Smuzhiyun  */
63*4882a593Smuzhiyun #define IUCV_IPRMDATA	0x80
64*4882a593Smuzhiyun #define IUCV_IPQUSCE	0x40
65*4882a593Smuzhiyun #define IUCV_IPBUFLST	0x40
66*4882a593Smuzhiyun #define IUCV_IPPRTY	0x20
67*4882a593Smuzhiyun #define IUCV_IPANSLST	0x08
68*4882a593Smuzhiyun #define IUCV_IPSYNC	0x04
69*4882a593Smuzhiyun #define IUCV_IPLOCAL	0x01
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun /*
72*4882a593Smuzhiyun  * iucv_array : Defines buffer array.
73*4882a593Smuzhiyun  * Inside the array may be 31- bit addresses and 31-bit lengths.
74*4882a593Smuzhiyun  * Use a pointer to an iucv_array as the buffer, reply or answer
75*4882a593Smuzhiyun  * parameter on iucv_message_send, iucv_message_send2way, iucv_message_receive
76*4882a593Smuzhiyun  * and iucv_message_reply if IUCV_IPBUFLST or IUCV_IPANSLST are used.
77*4882a593Smuzhiyun  */
78*4882a593Smuzhiyun struct iucv_array {
79*4882a593Smuzhiyun 	u32 address;
80*4882a593Smuzhiyun 	u32 length;
81*4882a593Smuzhiyun } __attribute__ ((aligned (8)));
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun extern struct bus_type iucv_bus;
84*4882a593Smuzhiyun extern struct device *iucv_root;
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun /*
87*4882a593Smuzhiyun  * struct iucv_path
88*4882a593Smuzhiyun  * pathid: 16 bit path identification
89*4882a593Smuzhiyun  * msglim: 16 bit message limit
90*4882a593Smuzhiyun  * flags: properties of the path: IPRMDATA, IPQUSCE, IPPRTY
91*4882a593Smuzhiyun  * handler:  address of iucv handler structure
92*4882a593Smuzhiyun  * private: private information of the handler associated with the path
93*4882a593Smuzhiyun  * list: list_head for the iucv_handler path list.
94*4882a593Smuzhiyun  */
95*4882a593Smuzhiyun struct iucv_path {
96*4882a593Smuzhiyun 	u16 pathid;
97*4882a593Smuzhiyun 	u16 msglim;
98*4882a593Smuzhiyun 	u8  flags;
99*4882a593Smuzhiyun 	void *private;
100*4882a593Smuzhiyun 	struct iucv_handler *handler;
101*4882a593Smuzhiyun 	struct list_head list;
102*4882a593Smuzhiyun };
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun /*
105*4882a593Smuzhiyun  * struct iucv_message
106*4882a593Smuzhiyun  * id: 32 bit message id
107*4882a593Smuzhiyun  * audit: 32 bit error information of purged or replied messages
108*4882a593Smuzhiyun  * class: 32 bit target class of a message (source class for replies)
109*4882a593Smuzhiyun  * tag: 32 bit tag to be associated with the message
110*4882a593Smuzhiyun  * length: 32 bit length of the message / reply
111*4882a593Smuzhiyun  * reply_size: 32 bit maximum allowed length of the reply
112*4882a593Smuzhiyun  * rmmsg: 8 byte inline message
113*4882a593Smuzhiyun  * flags: message properties (IUCV_IPPRTY)
114*4882a593Smuzhiyun  */
115*4882a593Smuzhiyun struct iucv_message {
116*4882a593Smuzhiyun 	u32 id;
117*4882a593Smuzhiyun 	u32 audit;
118*4882a593Smuzhiyun 	u32 class;
119*4882a593Smuzhiyun 	u32 tag;
120*4882a593Smuzhiyun 	u32 length;
121*4882a593Smuzhiyun 	u32 reply_size;
122*4882a593Smuzhiyun 	u8  rmmsg[8];
123*4882a593Smuzhiyun 	u8  flags;
124*4882a593Smuzhiyun } __packed;
125*4882a593Smuzhiyun 
126*4882a593Smuzhiyun /*
127*4882a593Smuzhiyun  * struct iucv_handler
128*4882a593Smuzhiyun  *
129*4882a593Smuzhiyun  * A vector of functions that handle IUCV interrupts. Each functions gets
130*4882a593Smuzhiyun  * a parameter area as defined by the CP Programming Services and private
131*4882a593Smuzhiyun  * pointer that is provided by the user of the interface.
132*4882a593Smuzhiyun  */
133*4882a593Smuzhiyun struct iucv_handler {
134*4882a593Smuzhiyun 	 /*
135*4882a593Smuzhiyun 	  * The path_pending function is called after an iucv interrupt
136*4882a593Smuzhiyun 	  * type 0x01 has been received. The base code allocates a path
137*4882a593Smuzhiyun 	  * structure and "asks" the handler if this path belongs to the
138*4882a593Smuzhiyun 	  * handler. To accept the path the path_pending function needs
139*4882a593Smuzhiyun 	  * to call iucv_path_accept and return 0. If the callback returns
140*4882a593Smuzhiyun 	  * a value != 0 the iucv base code will continue with the next
141*4882a593Smuzhiyun 	  * handler. The order in which the path_pending functions are
142*4882a593Smuzhiyun 	  * called is the order of the registration of the iucv handlers
143*4882a593Smuzhiyun 	  * to the base code.
144*4882a593Smuzhiyun 	  */
145*4882a593Smuzhiyun 	int  (*path_pending)(struct iucv_path *, u8 *ipvmid, u8 *ipuser);
146*4882a593Smuzhiyun 	/*
147*4882a593Smuzhiyun 	 * The path_complete function is called after an iucv interrupt
148*4882a593Smuzhiyun 	 * type 0x02 has been received for a path that has been established
149*4882a593Smuzhiyun 	 * for this handler with iucv_path_connect and got accepted by the
150*4882a593Smuzhiyun 	 * peer with iucv_path_accept.
151*4882a593Smuzhiyun 	 */
152*4882a593Smuzhiyun 	void (*path_complete)(struct iucv_path *, u8 *ipuser);
153*4882a593Smuzhiyun 	 /*
154*4882a593Smuzhiyun 	  * The path_severed function is called after an iucv interrupt
155*4882a593Smuzhiyun 	  * type 0x03 has been received. The communication peer shutdown
156*4882a593Smuzhiyun 	  * his end of the communication path. The path still exists and
157*4882a593Smuzhiyun 	  * remaining messages can be received until a iucv_path_sever
158*4882a593Smuzhiyun 	  * shuts down the other end of the path as well.
159*4882a593Smuzhiyun 	  */
160*4882a593Smuzhiyun 	void (*path_severed)(struct iucv_path *, u8 *ipuser);
161*4882a593Smuzhiyun 	/*
162*4882a593Smuzhiyun 	 * The path_quiesced function is called after an icuv interrupt
163*4882a593Smuzhiyun 	 * type 0x04 has been received. The communication peer has quiesced
164*4882a593Smuzhiyun 	 * the path. Delivery of messages is stopped until iucv_path_resume
165*4882a593Smuzhiyun 	 * has been called.
166*4882a593Smuzhiyun 	 */
167*4882a593Smuzhiyun 	void (*path_quiesced)(struct iucv_path *, u8 *ipuser);
168*4882a593Smuzhiyun 	/*
169*4882a593Smuzhiyun 	 * The path_resumed function is called after an icuv interrupt
170*4882a593Smuzhiyun 	 * type 0x05 has been received. The communication peer has resumed
171*4882a593Smuzhiyun 	 * the path.
172*4882a593Smuzhiyun 	 */
173*4882a593Smuzhiyun 	void (*path_resumed)(struct iucv_path *, u8 *ipuser);
174*4882a593Smuzhiyun 	/*
175*4882a593Smuzhiyun 	 * The message_pending function is called after an icuv interrupt
176*4882a593Smuzhiyun 	 * type 0x06 or type 0x07 has been received. A new message is
177*4882a593Smuzhiyun 	 * available and can be received with iucv_message_receive.
178*4882a593Smuzhiyun 	 */
179*4882a593Smuzhiyun 	void (*message_pending)(struct iucv_path *, struct iucv_message *);
180*4882a593Smuzhiyun 	/*
181*4882a593Smuzhiyun 	 * The message_complete function is called after an icuv interrupt
182*4882a593Smuzhiyun 	 * type 0x08 or type 0x09 has been received. A message send with
183*4882a593Smuzhiyun 	 * iucv_message_send2way has been replied to. The reply can be
184*4882a593Smuzhiyun 	 * received with iucv_message_receive.
185*4882a593Smuzhiyun 	 */
186*4882a593Smuzhiyun 	void (*message_complete)(struct iucv_path *, struct iucv_message *);
187*4882a593Smuzhiyun 
188*4882a593Smuzhiyun 	struct list_head list;
189*4882a593Smuzhiyun 	struct list_head paths;
190*4882a593Smuzhiyun };
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun /**
193*4882a593Smuzhiyun  * iucv_register:
194*4882a593Smuzhiyun  * @handler: address of iucv handler structure
195*4882a593Smuzhiyun  * @smp: != 0 indicates that the handler can deal with out of order messages
196*4882a593Smuzhiyun  *
197*4882a593Smuzhiyun  * Registers a driver with IUCV.
198*4882a593Smuzhiyun  *
199*4882a593Smuzhiyun  * Returns 0 on success, -ENOMEM if the memory allocation for the pathid
200*4882a593Smuzhiyun  * table failed, or -EIO if IUCV_DECLARE_BUFFER failed on all cpus.
201*4882a593Smuzhiyun  */
202*4882a593Smuzhiyun int iucv_register(struct iucv_handler *handler, int smp);
203*4882a593Smuzhiyun 
204*4882a593Smuzhiyun /**
205*4882a593Smuzhiyun  * iucv_unregister
206*4882a593Smuzhiyun  * @handler:  address of iucv handler structure
207*4882a593Smuzhiyun  * @smp: != 0 indicates that the handler can deal with out of order messages
208*4882a593Smuzhiyun  *
209*4882a593Smuzhiyun  * Unregister driver from IUCV.
210*4882a593Smuzhiyun  */
211*4882a593Smuzhiyun void iucv_unregister(struct iucv_handler *handle, int smp);
212*4882a593Smuzhiyun 
213*4882a593Smuzhiyun /**
214*4882a593Smuzhiyun  * iucv_path_alloc
215*4882a593Smuzhiyun  * @msglim: initial message limit
216*4882a593Smuzhiyun  * @flags: initial flags
217*4882a593Smuzhiyun  * @gfp: kmalloc allocation flag
218*4882a593Smuzhiyun  *
219*4882a593Smuzhiyun  * Allocate a new path structure for use with iucv_connect.
220*4882a593Smuzhiyun  *
221*4882a593Smuzhiyun  * Returns NULL if the memory allocation failed or a pointer to the
222*4882a593Smuzhiyun  * path structure.
223*4882a593Smuzhiyun  */
iucv_path_alloc(u16 msglim,u8 flags,gfp_t gfp)224*4882a593Smuzhiyun static inline struct iucv_path *iucv_path_alloc(u16 msglim, u8 flags, gfp_t gfp)
225*4882a593Smuzhiyun {
226*4882a593Smuzhiyun 	struct iucv_path *path;
227*4882a593Smuzhiyun 
228*4882a593Smuzhiyun 	path = kzalloc(sizeof(struct iucv_path), gfp);
229*4882a593Smuzhiyun 	if (path) {
230*4882a593Smuzhiyun 		path->msglim = msglim;
231*4882a593Smuzhiyun 		path->flags = flags;
232*4882a593Smuzhiyun 	}
233*4882a593Smuzhiyun 	return path;
234*4882a593Smuzhiyun }
235*4882a593Smuzhiyun 
236*4882a593Smuzhiyun /**
237*4882a593Smuzhiyun  * iucv_path_free
238*4882a593Smuzhiyun  * @path: address of iucv path structure
239*4882a593Smuzhiyun  *
240*4882a593Smuzhiyun  * Frees a path structure.
241*4882a593Smuzhiyun  */
iucv_path_free(struct iucv_path * path)242*4882a593Smuzhiyun static inline void iucv_path_free(struct iucv_path *path)
243*4882a593Smuzhiyun {
244*4882a593Smuzhiyun 	kfree(path);
245*4882a593Smuzhiyun }
246*4882a593Smuzhiyun 
247*4882a593Smuzhiyun /**
248*4882a593Smuzhiyun  * iucv_path_accept
249*4882a593Smuzhiyun  * @path: address of iucv path structure
250*4882a593Smuzhiyun  * @handler: address of iucv handler structure
251*4882a593Smuzhiyun  * @userdata: 16 bytes of data reflected to the communication partner
252*4882a593Smuzhiyun  * @private: private data passed to interrupt handlers for this path
253*4882a593Smuzhiyun  *
254*4882a593Smuzhiyun  * This function is issued after the user received a connection pending
255*4882a593Smuzhiyun  * external interrupt and now wishes to complete the IUCV communication path.
256*4882a593Smuzhiyun  *
257*4882a593Smuzhiyun  * Returns the result of the CP IUCV call.
258*4882a593Smuzhiyun  */
259*4882a593Smuzhiyun int iucv_path_accept(struct iucv_path *path, struct iucv_handler *handler,
260*4882a593Smuzhiyun 		     u8 *userdata, void *private);
261*4882a593Smuzhiyun 
262*4882a593Smuzhiyun /**
263*4882a593Smuzhiyun  * iucv_path_connect
264*4882a593Smuzhiyun  * @path: address of iucv path structure
265*4882a593Smuzhiyun  * @handler: address of iucv handler structure
266*4882a593Smuzhiyun  * @userid: 8-byte user identification
267*4882a593Smuzhiyun  * @system: 8-byte target system identification
268*4882a593Smuzhiyun  * @userdata: 16 bytes of data reflected to the communication partner
269*4882a593Smuzhiyun  * @private: private data passed to interrupt handlers for this path
270*4882a593Smuzhiyun  *
271*4882a593Smuzhiyun  * This function establishes an IUCV path. Although the connect may complete
272*4882a593Smuzhiyun  * successfully, you are not able to use the path until you receive an IUCV
273*4882a593Smuzhiyun  * Connection Complete external interrupt.
274*4882a593Smuzhiyun  *
275*4882a593Smuzhiyun  * Returns the result of the CP IUCV call.
276*4882a593Smuzhiyun  */
277*4882a593Smuzhiyun int iucv_path_connect(struct iucv_path *path, struct iucv_handler *handler,
278*4882a593Smuzhiyun 		      u8 *userid, u8 *system, u8 *userdata,
279*4882a593Smuzhiyun 		      void *private);
280*4882a593Smuzhiyun 
281*4882a593Smuzhiyun /**
282*4882a593Smuzhiyun  * iucv_path_quiesce:
283*4882a593Smuzhiyun  * @path: address of iucv path structure
284*4882a593Smuzhiyun  * @userdata: 16 bytes of data reflected to the communication partner
285*4882a593Smuzhiyun  *
286*4882a593Smuzhiyun  * This function temporarily suspends incoming messages on an IUCV path.
287*4882a593Smuzhiyun  * You can later reactivate the path by invoking the iucv_resume function.
288*4882a593Smuzhiyun  *
289*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
290*4882a593Smuzhiyun  */
291*4882a593Smuzhiyun int iucv_path_quiesce(struct iucv_path *path, u8 *userdata);
292*4882a593Smuzhiyun 
293*4882a593Smuzhiyun /**
294*4882a593Smuzhiyun  * iucv_path_resume:
295*4882a593Smuzhiyun  * @path: address of iucv path structure
296*4882a593Smuzhiyun  * @userdata: 16 bytes of data reflected to the communication partner
297*4882a593Smuzhiyun  *
298*4882a593Smuzhiyun  * This function resumes incoming messages on an IUCV path that has
299*4882a593Smuzhiyun  * been stopped with iucv_path_quiesce.
300*4882a593Smuzhiyun  *
301*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
302*4882a593Smuzhiyun  */
303*4882a593Smuzhiyun int iucv_path_resume(struct iucv_path *path, u8 *userdata);
304*4882a593Smuzhiyun 
305*4882a593Smuzhiyun /**
306*4882a593Smuzhiyun  * iucv_path_sever
307*4882a593Smuzhiyun  * @path: address of iucv path structure
308*4882a593Smuzhiyun  * @userdata: 16 bytes of data reflected to the communication partner
309*4882a593Smuzhiyun  *
310*4882a593Smuzhiyun  * This function terminates an IUCV path.
311*4882a593Smuzhiyun  *
312*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
313*4882a593Smuzhiyun  */
314*4882a593Smuzhiyun int iucv_path_sever(struct iucv_path *path, u8 *userdata);
315*4882a593Smuzhiyun 
316*4882a593Smuzhiyun /**
317*4882a593Smuzhiyun  * iucv_message_purge
318*4882a593Smuzhiyun  * @path: address of iucv path structure
319*4882a593Smuzhiyun  * @msg: address of iucv msg structure
320*4882a593Smuzhiyun  * @srccls: source class of message
321*4882a593Smuzhiyun  *
322*4882a593Smuzhiyun  * Cancels a message you have sent.
323*4882a593Smuzhiyun  *
324*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
325*4882a593Smuzhiyun  */
326*4882a593Smuzhiyun int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
327*4882a593Smuzhiyun 		       u32 srccls);
328*4882a593Smuzhiyun 
329*4882a593Smuzhiyun /**
330*4882a593Smuzhiyun  * iucv_message_receive
331*4882a593Smuzhiyun  * @path: address of iucv path structure
332*4882a593Smuzhiyun  * @msg: address of iucv msg structure
333*4882a593Smuzhiyun  * @flags: flags that affect how the message is received (IUCV_IPBUFLST)
334*4882a593Smuzhiyun  * @buffer: address of data buffer or address of struct iucv_array
335*4882a593Smuzhiyun  * @size: length of data buffer
336*4882a593Smuzhiyun  * @residual:
337*4882a593Smuzhiyun  *
338*4882a593Smuzhiyun  * This function receives messages that are being sent to you over
339*4882a593Smuzhiyun  * established paths. This function will deal with RMDATA messages
340*4882a593Smuzhiyun  * embedded in struct iucv_message as well.
341*4882a593Smuzhiyun  *
342*4882a593Smuzhiyun  * Locking:	local_bh_enable/local_bh_disable
343*4882a593Smuzhiyun  *
344*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
345*4882a593Smuzhiyun  */
346*4882a593Smuzhiyun int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
347*4882a593Smuzhiyun 			 u8 flags, void *buffer, size_t size, size_t *residual);
348*4882a593Smuzhiyun 
349*4882a593Smuzhiyun /**
350*4882a593Smuzhiyun  * __iucv_message_receive
351*4882a593Smuzhiyun  * @path: address of iucv path structure
352*4882a593Smuzhiyun  * @msg: address of iucv msg structure
353*4882a593Smuzhiyun  * @flags: flags that affect how the message is received (IUCV_IPBUFLST)
354*4882a593Smuzhiyun  * @buffer: address of data buffer or address of struct iucv_array
355*4882a593Smuzhiyun  * @size: length of data buffer
356*4882a593Smuzhiyun  * @residual:
357*4882a593Smuzhiyun  *
358*4882a593Smuzhiyun  * This function receives messages that are being sent to you over
359*4882a593Smuzhiyun  * established paths. This function will deal with RMDATA messages
360*4882a593Smuzhiyun  * embedded in struct iucv_message as well.
361*4882a593Smuzhiyun  *
362*4882a593Smuzhiyun  * Locking:	no locking.
363*4882a593Smuzhiyun  *
364*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
365*4882a593Smuzhiyun  */
366*4882a593Smuzhiyun int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
367*4882a593Smuzhiyun 			   u8 flags, void *buffer, size_t size,
368*4882a593Smuzhiyun 			   size_t *residual);
369*4882a593Smuzhiyun 
370*4882a593Smuzhiyun /**
371*4882a593Smuzhiyun  * iucv_message_reject
372*4882a593Smuzhiyun  * @path: address of iucv path structure
373*4882a593Smuzhiyun  * @msg: address of iucv msg structure
374*4882a593Smuzhiyun  *
375*4882a593Smuzhiyun  * The reject function refuses a specified message. Between the time you
376*4882a593Smuzhiyun  * are notified of a message and the time that you complete the message,
377*4882a593Smuzhiyun  * the message may be rejected.
378*4882a593Smuzhiyun  *
379*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
380*4882a593Smuzhiyun  */
381*4882a593Smuzhiyun int iucv_message_reject(struct iucv_path *path, struct iucv_message *msg);
382*4882a593Smuzhiyun 
383*4882a593Smuzhiyun /**
384*4882a593Smuzhiyun  * iucv_message_reply
385*4882a593Smuzhiyun  * @path: address of iucv path structure
386*4882a593Smuzhiyun  * @msg: address of iucv msg structure
387*4882a593Smuzhiyun  * @flags: how the reply is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
388*4882a593Smuzhiyun  * @reply: address of data buffer or address of struct iucv_array
389*4882a593Smuzhiyun  * @size: length of reply data buffer
390*4882a593Smuzhiyun  *
391*4882a593Smuzhiyun  * This function responds to the two-way messages that you receive. You
392*4882a593Smuzhiyun  * must identify completely the message to which you wish to reply. ie,
393*4882a593Smuzhiyun  * pathid, msgid, and trgcls. Prmmsg signifies the data is moved into
394*4882a593Smuzhiyun  * the parameter list.
395*4882a593Smuzhiyun  *
396*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
397*4882a593Smuzhiyun  */
398*4882a593Smuzhiyun int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
399*4882a593Smuzhiyun 		       u8 flags, void *reply, size_t size);
400*4882a593Smuzhiyun 
401*4882a593Smuzhiyun /**
402*4882a593Smuzhiyun  * iucv_message_send
403*4882a593Smuzhiyun  * @path: address of iucv path structure
404*4882a593Smuzhiyun  * @msg: address of iucv msg structure
405*4882a593Smuzhiyun  * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
406*4882a593Smuzhiyun  * @srccls: source class of message
407*4882a593Smuzhiyun  * @buffer: address of data buffer or address of struct iucv_array
408*4882a593Smuzhiyun  * @size: length of send buffer
409*4882a593Smuzhiyun  *
410*4882a593Smuzhiyun  * This function transmits data to another application. Data to be
411*4882a593Smuzhiyun  * transmitted is in a buffer and this is a one-way message and the
412*4882a593Smuzhiyun  * receiver will not reply to the message.
413*4882a593Smuzhiyun  *
414*4882a593Smuzhiyun  * Locking:	local_bh_enable/local_bh_disable
415*4882a593Smuzhiyun  *
416*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
417*4882a593Smuzhiyun  */
418*4882a593Smuzhiyun int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
419*4882a593Smuzhiyun 		      u8 flags, u32 srccls, void *buffer, size_t size);
420*4882a593Smuzhiyun 
421*4882a593Smuzhiyun /**
422*4882a593Smuzhiyun  * __iucv_message_send
423*4882a593Smuzhiyun  * @path: address of iucv path structure
424*4882a593Smuzhiyun  * @msg: address of iucv msg structure
425*4882a593Smuzhiyun  * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
426*4882a593Smuzhiyun  * @srccls: source class of message
427*4882a593Smuzhiyun  * @buffer: address of data buffer or address of struct iucv_array
428*4882a593Smuzhiyun  * @size: length of send buffer
429*4882a593Smuzhiyun  *
430*4882a593Smuzhiyun  * This function transmits data to another application. Data to be
431*4882a593Smuzhiyun  * transmitted is in a buffer and this is a one-way message and the
432*4882a593Smuzhiyun  * receiver will not reply to the message.
433*4882a593Smuzhiyun  *
434*4882a593Smuzhiyun  * Locking:	no locking.
435*4882a593Smuzhiyun  *
436*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
437*4882a593Smuzhiyun  */
438*4882a593Smuzhiyun int __iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
439*4882a593Smuzhiyun 			u8 flags, u32 srccls, void *buffer, size_t size);
440*4882a593Smuzhiyun 
441*4882a593Smuzhiyun /**
442*4882a593Smuzhiyun  * iucv_message_send2way
443*4882a593Smuzhiyun  * @path: address of iucv path structure
444*4882a593Smuzhiyun  * @msg: address of iucv msg structure
445*4882a593Smuzhiyun  * @flags: how the message is sent and the reply is received
446*4882a593Smuzhiyun  *	   (IUCV_IPRMDATA, IUCV_IPBUFLST, IUCV_IPPRTY, IUCV_ANSLST)
447*4882a593Smuzhiyun  * @srccls: source class of message
448*4882a593Smuzhiyun  * @buffer: address of data buffer or address of struct iucv_array
449*4882a593Smuzhiyun  * @size: length of send buffer
450*4882a593Smuzhiyun  * @ansbuf: address of answer buffer or address of struct iucv_array
451*4882a593Smuzhiyun  * @asize: size of reply buffer
452*4882a593Smuzhiyun  *
453*4882a593Smuzhiyun  * This function transmits data to another application. Data to be
454*4882a593Smuzhiyun  * transmitted is in a buffer. The receiver of the send is expected to
455*4882a593Smuzhiyun  * reply to the message and a buffer is provided into which IUCV moves
456*4882a593Smuzhiyun  * the reply to this message.
457*4882a593Smuzhiyun  *
458*4882a593Smuzhiyun  * Returns the result from the CP IUCV call.
459*4882a593Smuzhiyun  */
460*4882a593Smuzhiyun int iucv_message_send2way(struct iucv_path *path, struct iucv_message *msg,
461*4882a593Smuzhiyun 			  u8 flags, u32 srccls, void *buffer, size_t size,
462*4882a593Smuzhiyun 			  void *answer, size_t asize, size_t *residual);
463*4882a593Smuzhiyun 
464*4882a593Smuzhiyun struct iucv_interface {
465*4882a593Smuzhiyun 	int (*message_receive)(struct iucv_path *path, struct iucv_message *msg,
466*4882a593Smuzhiyun 		u8 flags, void *buffer, size_t size, size_t *residual);
467*4882a593Smuzhiyun 	int (*__message_receive)(struct iucv_path *path,
468*4882a593Smuzhiyun 		struct iucv_message *msg, u8 flags, void *buffer, size_t size,
469*4882a593Smuzhiyun 		size_t *residual);
470*4882a593Smuzhiyun 	int (*message_reply)(struct iucv_path *path, struct iucv_message *msg,
471*4882a593Smuzhiyun 		u8 flags, void *reply, size_t size);
472*4882a593Smuzhiyun 	int (*message_reject)(struct iucv_path *path, struct iucv_message *msg);
473*4882a593Smuzhiyun 	int (*message_send)(struct iucv_path *path, struct iucv_message *msg,
474*4882a593Smuzhiyun 		u8 flags, u32 srccls, void *buffer, size_t size);
475*4882a593Smuzhiyun 	int (*__message_send)(struct iucv_path *path, struct iucv_message *msg,
476*4882a593Smuzhiyun 		u8 flags, u32 srccls, void *buffer, size_t size);
477*4882a593Smuzhiyun 	int (*message_send2way)(struct iucv_path *path,
478*4882a593Smuzhiyun 		struct iucv_message *msg, u8 flags, u32 srccls, void *buffer,
479*4882a593Smuzhiyun 		size_t size, void *answer, size_t asize, size_t *residual);
480*4882a593Smuzhiyun 	int (*message_purge)(struct iucv_path *path, struct iucv_message *msg,
481*4882a593Smuzhiyun 		u32 srccls);
482*4882a593Smuzhiyun 	int (*path_accept)(struct iucv_path *path, struct iucv_handler *handler,
483*4882a593Smuzhiyun 		u8 userdata[16], void *private);
484*4882a593Smuzhiyun 	int (*path_connect)(struct iucv_path *path,
485*4882a593Smuzhiyun 		struct iucv_handler *handler,
486*4882a593Smuzhiyun 		u8 userid[8], u8 system[8], u8 userdata[16], void *private);
487*4882a593Smuzhiyun 	int (*path_quiesce)(struct iucv_path *path, u8 userdata[16]);
488*4882a593Smuzhiyun 	int (*path_resume)(struct iucv_path *path, u8 userdata[16]);
489*4882a593Smuzhiyun 	int (*path_sever)(struct iucv_path *path, u8 userdata[16]);
490*4882a593Smuzhiyun 	int (*iucv_register)(struct iucv_handler *handler, int smp);
491*4882a593Smuzhiyun 	void (*iucv_unregister)(struct iucv_handler *handler, int smp);
492*4882a593Smuzhiyun 	struct bus_type *bus;
493*4882a593Smuzhiyun 	struct device *root;
494*4882a593Smuzhiyun };
495*4882a593Smuzhiyun 
496*4882a593Smuzhiyun extern struct iucv_interface iucv_if;
497