2 * IUCV base infrastructure.
4 * Copyright 2001, 2006 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Alan Altmark (Alan_Altmark@us.ibm.com) Sept. 2000
8 * Xenia Tkatschow (xenia@us.ibm.com)
9 * 2Gb awareness and general cleanup:
10 * Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
11 * Rewritten for af_iucv:
12 * Martin Schwidefsky <schwidefsky@de.ibm.com>
16 * CP Programming Service, IBM document # SC24-5760
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2, or (at your option)
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 #include <linux/module.h>
34 #include <linux/moduleparam.h>
35 #include <linux/spinlock.h>
36 #include <linux/kernel.h>
37 #include <linux/slab.h>
38 #include <linux/init.h>
39 #include <linux/interrupt.h>
40 #include <linux/list.h>
41 #include <linux/errno.h>
42 #include <linux/err.h>
43 #include <linux/device.h>
44 #include <linux/cpu.h>
45 #include <net/iucv/iucv.h>
46 #include <asm/atomic.h>
47 #include <asm/ebcdic.h>
49 #include <asm/s390_ext.h>
50 #include <asm/s390_rdev.h>
55 * All flags are defined in the field IPFLAGS1 of each function
56 * and can be found in CP Programming Services.
57 * IPSRCCLS - Indicates you have specified a source class.
58 * IPTRGCLS - Indicates you have specified a target class.
59 * IPFGPID - Indicates you have specified a pathid.
60 * IPFGMID - Indicates you have specified a message ID.
61 * IPNORPY - Indicates a one-way message. No reply expected.
62 * IPALL - Indicates that all paths are affected.
64 #define IUCV_IPSRCCLS 0x01
65 #define IUCV_IPTRGCLS 0x01
66 #define IUCV_IPFGPID 0x02
67 #define IUCV_IPFGMID 0x04
68 #define IUCV_IPNORPY 0x10
69 #define IUCV_IPALL 0x80
71 static int iucv_bus_match(struct device
*dev
, struct device_driver
*drv
)
76 struct bus_type iucv_bus
= {
78 .match
= iucv_bus_match
,
80 EXPORT_SYMBOL(iucv_bus
);
82 struct device
*iucv_root
;
83 EXPORT_SYMBOL(iucv_root
);
85 static int iucv_available
;
87 /* General IUCV interrupt structure */
88 struct iucv_irq_data
{
95 struct iucv_irq_list
{
96 struct list_head list
;
97 struct iucv_irq_data data
;
100 static struct iucv_irq_data
*iucv_irq_data
;
101 static cpumask_t iucv_buffer_cpumask
= CPU_MASK_NONE
;
102 static cpumask_t iucv_irq_cpumask
= CPU_MASK_NONE
;
105 * Queue of interrupt buffers lock for delivery via the tasklet
106 * (fast but can't call smp_call_function).
108 static LIST_HEAD(iucv_task_queue
);
111 * The tasklet for fast delivery of iucv interrupts.
113 static void iucv_tasklet_fn(unsigned long);
114 static DECLARE_TASKLET(iucv_tasklet
, iucv_tasklet_fn
,0);
117 * Queue of interrupt buffers for delivery via a work queue
118 * (slower but can call smp_call_function).
120 static LIST_HEAD(iucv_work_queue
);
123 * The work element to deliver path pending interrupts.
125 static void iucv_work_fn(struct work_struct
*work
);
126 static DECLARE_WORK(iucv_work
, iucv_work_fn
);
129 * Spinlock protecting task and work queue.
131 static DEFINE_SPINLOCK(iucv_queue_lock
);
133 enum iucv_command_codes
{
135 IUCV_RETRIEVE_BUFFER
= 2,
143 IUCV_DECLARE_BUFFER
= 12,
151 * Error messages that are used with the iucv_sever function. They get
152 * converted to EBCDIC.
154 static char iucv_error_no_listener
[16] = "NO LISTENER";
155 static char iucv_error_no_memory
[16] = "NO MEMORY";
156 static char iucv_error_pathid
[16] = "INVALID PATHID";
159 * iucv_handler_list: List of registered handlers.
161 static LIST_HEAD(iucv_handler_list
);
164 * iucv_path_table: an array of iucv_path structures.
166 static struct iucv_path
**iucv_path_table
;
167 static unsigned long iucv_max_pathid
;
170 * iucv_lock: spinlock protecting iucv_handler_list and iucv_pathid_table
172 static DEFINE_SPINLOCK(iucv_table_lock
);
175 * iucv_active_cpu: contains the number of the cpu executing the tasklet
176 * or the work handler. Needed for iucv_path_sever called from tasklet.
178 static int iucv_active_cpu
= -1;
181 * Mutex and wait queue for iucv_register/iucv_unregister.
183 static DEFINE_MUTEX(iucv_register_mutex
);
186 * Counter for number of non-smp capable handlers.
188 static int iucv_nonsmp_handler
;
191 * IUCV control data structure. Used by iucv_path_accept, iucv_path_connect,
192 * iucv_path_quiesce and iucv_path_sever.
194 struct iucv_cmd_control
{
203 } __attribute__ ((packed
,aligned(8)));
206 * Data in parameter list iucv structure. Used by iucv_message_send,
207 * iucv_message_send2way and iucv_message_reply.
209 struct iucv_cmd_dpl
{
221 } __attribute__ ((packed
,aligned(8)));
224 * Data in buffer iucv structure. Used by iucv_message_receive,
225 * iucv_message_reject, iucv_message_send, iucv_message_send2way
226 * and iucv_declare_cpu.
241 } __attribute__ ((packed
,aligned(8)));
244 * Purge message iucv structure. Used by iucv_message_purge.
246 struct iucv_cmd_purge
{
257 } __attribute__ ((packed
,aligned(8)));
260 * Set mask iucv structure. Used by iucv_enable_cpu.
262 struct iucv_cmd_set_mask
{
267 } __attribute__ ((packed
,aligned(8)));
270 struct iucv_cmd_control ctrl
;
271 struct iucv_cmd_dpl dpl
;
272 struct iucv_cmd_db db
;
273 struct iucv_cmd_purge purge
;
274 struct iucv_cmd_set_mask set_mask
;
278 * Anchor for per-cpu IUCV command parameter block.
280 static union iucv_param
*iucv_param
;
284 * @code: identifier of IUCV call to CP.
285 * @parm: pointer to a struct iucv_parm block
287 * Calls CP to execute IUCV commands.
289 * Returns the result of the CP IUCV call.
291 static inline int iucv_call_b2f0(int command
, union iucv_param
*parm
)
293 register unsigned long reg0
asm ("0");
294 register unsigned long reg1
asm ("1");
298 reg1
= virt_to_phys(parm
);
300 " .long 0xb2f01000\n"
303 : "=d" (ccode
), "=m" (*parm
), "+d" (reg0
), "+a" (reg1
)
304 : "m" (*parm
) : "cc");
305 return (ccode
== 1) ? parm
->ctrl
.iprcode
: ccode
;
311 * Determines the maximum number of connections that may be established.
313 * Returns the maximum number of connections or -EPERM is IUCV is not
316 static int iucv_query_maxconn(void)
318 register unsigned long reg0
asm ("0");
319 register unsigned long reg1
asm ("1");
323 param
= kzalloc(sizeof(union iucv_param
), GFP_KERNEL
|GFP_DMA
);
327 reg1
= (unsigned long) param
;
329 " .long 0xb2f01000\n"
332 : "=d" (ccode
), "+d" (reg0
), "+d" (reg1
) : : "cc");
334 iucv_max_pathid
= reg0
;
336 return ccode
? -EPERM
: 0;
343 * Allow iucv interrupts on this cpu.
345 static void iucv_allow_cpu(void *data
)
347 int cpu
= smp_processor_id();
348 union iucv_param
*parm
;
351 * Enable all iucv interrupts.
352 * ipmask contains bits for the different interrupts
353 * 0x80 - Flag to allow nonpriority message pending interrupts
354 * 0x40 - Flag to allow priority message pending interrupts
355 * 0x20 - Flag to allow nonpriority message completion interrupts
356 * 0x10 - Flag to allow priority message completion interrupts
357 * 0x08 - Flag to allow IUCV control interrupts
359 parm
= percpu_ptr(iucv_param
, smp_processor_id());
360 memset(parm
, 0, sizeof(union iucv_param
));
361 parm
->set_mask
.ipmask
= 0xf8;
362 iucv_call_b2f0(IUCV_SETMASK
, parm
);
364 /* Set indication that iucv interrupts are allowed for this cpu. */
365 cpu_set(cpu
, iucv_irq_cpumask
);
372 * Block iucv interrupts on this cpu.
374 static void iucv_block_cpu(void *data
)
376 int cpu
= smp_processor_id();
377 union iucv_param
*parm
;
379 /* Disable all iucv interrupts. */
380 parm
= percpu_ptr(iucv_param
, smp_processor_id());
381 memset(parm
, 0, sizeof(union iucv_param
));
382 iucv_call_b2f0(IUCV_SETMASK
, parm
);
384 /* Clear indication that iucv interrupts are allowed for this cpu. */
385 cpu_clear(cpu
, iucv_irq_cpumask
);
392 * Declare a interrupt buffer on this cpu.
394 static void iucv_declare_cpu(void *data
)
396 int cpu
= smp_processor_id();
397 union iucv_param
*parm
;
400 if (cpu_isset(cpu
, iucv_buffer_cpumask
))
403 /* Declare interrupt buffer. */
404 parm
= percpu_ptr(iucv_param
, cpu
);
405 memset(parm
, 0, sizeof(union iucv_param
));
406 parm
->db
.ipbfadr1
= virt_to_phys(percpu_ptr(iucv_irq_data
, cpu
));
407 rc
= iucv_call_b2f0(IUCV_DECLARE_BUFFER
, parm
);
409 char *err
= "Unknown";
412 err
= "Directory error";
415 err
= "Invalid length";
418 err
= "Buffer already exists";
421 err
= "Buffer overlap";
424 err
= "Paging or storage error";
427 printk(KERN_WARNING
"iucv_register: iucv_declare_buffer "
428 "on cpu %i returned error 0x%02x (%s)\n", cpu
, rc
, err
);
432 /* Set indication that an iucv buffer exists for this cpu. */
433 cpu_set(cpu
, iucv_buffer_cpumask
);
435 if (iucv_nonsmp_handler
== 0 || cpus_empty(iucv_irq_cpumask
))
436 /* Enable iucv interrupts on this cpu. */
437 iucv_allow_cpu(NULL
);
439 /* Disable iucv interrupts on this cpu. */
440 iucv_block_cpu(NULL
);
447 * Retrieve interrupt buffer on this cpu.
449 static void iucv_retrieve_cpu(void *data
)
451 int cpu
= smp_processor_id();
452 union iucv_param
*parm
;
454 if (!cpu_isset(cpu
, iucv_buffer_cpumask
))
457 /* Block iucv interrupts. */
458 iucv_block_cpu(NULL
);
460 /* Retrieve interrupt buffer. */
461 parm
= percpu_ptr(iucv_param
, cpu
);
462 iucv_call_b2f0(IUCV_RETRIEVE_BUFFER
, parm
);
464 /* Clear indication that an iucv buffer exists for this cpu. */
465 cpu_clear(cpu
, iucv_buffer_cpumask
);
471 * Allow iucv interrupts on all cpus.
473 static void iucv_setmask_mp(void)
478 for_each_online_cpu(cpu
)
479 /* Enable all cpus with a declared buffer. */
480 if (cpu_isset(cpu
, iucv_buffer_cpumask
) &&
481 !cpu_isset(cpu
, iucv_irq_cpumask
))
482 smp_call_function_single(cpu
, iucv_allow_cpu
,
490 * Allow iucv interrupts on a single cpu.
492 static void iucv_setmask_up(void)
497 /* Disable all cpu but the first in cpu_irq_cpumask. */
498 cpumask
= iucv_irq_cpumask
;
499 cpu_clear(first_cpu(iucv_irq_cpumask
), cpumask
);
500 for_each_cpu_mask(cpu
, cpumask
)
501 smp_call_function_single(cpu
, iucv_block_cpu
, NULL
, 0, 1);
507 * This function makes iucv ready for use. It allocates the pathid
508 * table, declares an iucv interrupt buffer and enables the iucv
509 * interrupts. Called when the first user has registered an iucv
512 static int iucv_enable(void)
518 alloc_size
= iucv_max_pathid
* sizeof(struct iucv_path
);
519 iucv_path_table
= kzalloc(alloc_size
, GFP_KERNEL
);
520 if (!iucv_path_table
)
522 /* Declare per cpu buffers. */
525 for_each_online_cpu(cpu
)
526 smp_call_function_single(cpu
, iucv_declare_cpu
, NULL
, 0, 1);
528 if (cpus_empty(iucv_buffer_cpumask
))
529 /* No cpu could declare an iucv buffer. */
534 kfree(iucv_path_table
);
542 * This function shuts down iucv. It disables iucv interrupts, retrieves
543 * the iucv interrupt buffer and frees the pathid table. Called after the
544 * last user unregister its iucv handler.
546 static void iucv_disable(void)
548 on_each_cpu(iucv_retrieve_cpu
, NULL
, 0, 1);
549 kfree(iucv_path_table
);
552 static int __cpuinit
iucv_cpu_notify(struct notifier_block
*self
,
553 unsigned long action
, void *hcpu
)
556 long cpu
= (long) hcpu
;
560 case CPU_UP_PREPARE_FROZEN
:
561 if (!percpu_populate(iucv_irq_data
,
562 sizeof(struct iucv_irq_data
),
563 GFP_KERNEL
|GFP_DMA
, cpu
))
565 if (!percpu_populate(iucv_param
, sizeof(union iucv_param
),
566 GFP_KERNEL
|GFP_DMA
, cpu
)) {
567 percpu_depopulate(iucv_irq_data
, cpu
);
571 case CPU_UP_CANCELED
:
572 case CPU_UP_CANCELED_FROZEN
:
574 case CPU_DEAD_FROZEN
:
575 percpu_depopulate(iucv_param
, cpu
);
576 percpu_depopulate(iucv_irq_data
, cpu
);
579 case CPU_ONLINE_FROZEN
:
580 case CPU_DOWN_FAILED
:
581 case CPU_DOWN_FAILED_FROZEN
:
582 smp_call_function_single(cpu
, iucv_declare_cpu
, NULL
, 0, 1);
584 case CPU_DOWN_PREPARE
:
585 case CPU_DOWN_PREPARE_FROZEN
:
586 cpumask
= iucv_buffer_cpumask
;
587 cpu_clear(cpu
, cpumask
);
588 if (cpus_empty(cpumask
))
589 /* Can't offline last IUCV enabled cpu. */
591 smp_call_function_single(cpu
, iucv_retrieve_cpu
, NULL
, 0, 1);
592 if (cpus_empty(iucv_irq_cpumask
))
593 smp_call_function_single(first_cpu(iucv_buffer_cpumask
),
594 iucv_allow_cpu
, NULL
, 0, 1);
600 static struct notifier_block __cpuinitdata iucv_cpu_notifier
= {
601 .notifier_call
= iucv_cpu_notify
,
606 * @pathid: path identification number.
607 * @userdata: 16-bytes of user data.
609 * Sever an iucv path to free up the pathid. Used internally.
611 static int iucv_sever_pathid(u16 pathid
, u8 userdata
[16])
613 union iucv_param
*parm
;
615 parm
= percpu_ptr(iucv_param
, smp_processor_id());
616 memset(parm
, 0, sizeof(union iucv_param
));
618 memcpy(parm
->ctrl
.ipuser
, userdata
, sizeof(parm
->ctrl
.ipuser
));
619 parm
->ctrl
.ippathid
= pathid
;
620 return iucv_call_b2f0(IUCV_SEVER
, parm
);
625 * __iucv_cleanup_queue
626 * @dummy: unused dummy argument
628 * Nop function called via smp_call_function to force work items from
629 * pending external iucv interrupts to the work queue.
631 static void __iucv_cleanup_queue(void *dummy
)
639 * Function called after a path has been severed to find all remaining
640 * work items for the now stale pathid. The caller needs to hold the
643 static void iucv_cleanup_queue(void)
645 struct iucv_irq_list
*p
, *n
;
648 * When a path is severed, the pathid can be reused immediatly
649 * on a iucv connect or a connection pending interrupt. Remove
650 * all entries from the task queue that refer to a stale pathid
651 * (iucv_path_table[ix] == NULL). Only then do the iucv connect
652 * or deliver the connection pending interrupt. To get all the
653 * pending interrupts force them to the work queue by calling
654 * an empty function on all cpus.
656 smp_call_function(__iucv_cleanup_queue
, NULL
, 0, 1);
657 spin_lock_irq(&iucv_queue_lock
);
658 list_for_each_entry_safe(p
, n
, &iucv_task_queue
, list
) {
659 /* Remove stale work items from the task queue. */
660 if (iucv_path_table
[p
->data
.ippathid
] == NULL
) {
665 spin_unlock_irq(&iucv_queue_lock
);
670 * @handler: address of iucv handler structure
671 * @smp: != 0 indicates that the handler can deal with out of order messages
673 * Registers a driver with IUCV.
675 * Returns 0 on success, -ENOMEM if the memory allocation for the pathid
676 * table failed, or -EIO if IUCV_DECLARE_BUFFER failed on all cpus.
678 int iucv_register(struct iucv_handler
*handler
, int smp
)
684 mutex_lock(&iucv_register_mutex
);
686 iucv_nonsmp_handler
++;
687 if (list_empty(&iucv_handler_list
)) {
691 } else if (!smp
&& iucv_nonsmp_handler
== 1)
693 INIT_LIST_HEAD(&handler
->paths
);
695 spin_lock_irq(&iucv_table_lock
);
696 list_add_tail(&handler
->list
, &iucv_handler_list
);
697 spin_unlock_irq(&iucv_table_lock
);
700 mutex_unlock(&iucv_register_mutex
);
703 EXPORT_SYMBOL(iucv_register
);
707 * @handler: address of iucv handler structure
708 * @smp: != 0 indicates that the handler can deal with out of order messages
710 * Unregister driver from IUCV.
712 void iucv_unregister(struct iucv_handler
*handler
, int smp
)
714 struct iucv_path
*p
, *n
;
716 mutex_lock(&iucv_register_mutex
);
717 spin_lock_bh(&iucv_table_lock
);
718 /* Remove handler from the iucv_handler_list. */
719 list_del_init(&handler
->list
);
720 /* Sever all pathids still refering to the handler. */
721 list_for_each_entry_safe(p
, n
, &handler
->paths
, list
) {
722 iucv_sever_pathid(p
->pathid
, NULL
);
723 iucv_path_table
[p
->pathid
] = NULL
;
727 spin_unlock_bh(&iucv_table_lock
);
729 iucv_nonsmp_handler
--;
730 if (list_empty(&iucv_handler_list
))
732 else if (!smp
&& iucv_nonsmp_handler
== 0)
734 mutex_unlock(&iucv_register_mutex
);
736 EXPORT_SYMBOL(iucv_unregister
);
740 * @path: address of iucv path structure
741 * @handler: address of iucv handler structure
742 * @userdata: 16 bytes of data reflected to the communication partner
743 * @private: private data passed to interrupt handlers for this path
745 * This function is issued after the user received a connection pending
746 * external interrupt and now wishes to complete the IUCV communication path.
748 * Returns the result of the CP IUCV call.
750 int iucv_path_accept(struct iucv_path
*path
, struct iucv_handler
*handler
,
751 u8 userdata
[16], void *private)
753 union iucv_param
*parm
;
757 /* Prepare parameter block. */
758 parm
= percpu_ptr(iucv_param
, smp_processor_id());
759 memset(parm
, 0, sizeof(union iucv_param
));
760 parm
->ctrl
.ippathid
= path
->pathid
;
761 parm
->ctrl
.ipmsglim
= path
->msglim
;
763 memcpy(parm
->ctrl
.ipuser
, userdata
, sizeof(parm
->ctrl
.ipuser
));
764 parm
->ctrl
.ipflags1
= path
->flags
;
766 rc
= iucv_call_b2f0(IUCV_ACCEPT
, parm
);
768 path
->private = private;
769 path
->msglim
= parm
->ctrl
.ipmsglim
;
770 path
->flags
= parm
->ctrl
.ipflags1
;
775 EXPORT_SYMBOL(iucv_path_accept
);
779 * @path: address of iucv path structure
780 * @handler: address of iucv handler structure
781 * @userid: 8-byte user identification
782 * @system: 8-byte target system identification
783 * @userdata: 16 bytes of data reflected to the communication partner
784 * @private: private data passed to interrupt handlers for this path
786 * This function establishes an IUCV path. Although the connect may complete
787 * successfully, you are not able to use the path until you receive an IUCV
788 * Connection Complete external interrupt.
790 * Returns the result of the CP IUCV call.
792 int iucv_path_connect(struct iucv_path
*path
, struct iucv_handler
*handler
,
793 u8 userid
[8], u8 system
[8], u8 userdata
[16],
796 union iucv_param
*parm
;
800 spin_lock_bh(&iucv_table_lock
);
801 iucv_cleanup_queue();
802 parm
= percpu_ptr(iucv_param
, smp_processor_id());
803 memset(parm
, 0, sizeof(union iucv_param
));
804 parm
->ctrl
.ipmsglim
= path
->msglim
;
805 parm
->ctrl
.ipflags1
= path
->flags
;
807 memcpy(parm
->ctrl
.ipvmid
, userid
, sizeof(parm
->ctrl
.ipvmid
));
808 ASCEBC(parm
->ctrl
.ipvmid
, sizeof(parm
->ctrl
.ipvmid
));
809 EBC_TOUPPER(parm
->ctrl
.ipvmid
, sizeof(parm
->ctrl
.ipvmid
));
812 memcpy(parm
->ctrl
.iptarget
, system
,
813 sizeof(parm
->ctrl
.iptarget
));
814 ASCEBC(parm
->ctrl
.iptarget
, sizeof(parm
->ctrl
.iptarget
));
815 EBC_TOUPPER(parm
->ctrl
.iptarget
, sizeof(parm
->ctrl
.iptarget
));
818 memcpy(parm
->ctrl
.ipuser
, userdata
, sizeof(parm
->ctrl
.ipuser
));
820 rc
= iucv_call_b2f0(IUCV_CONNECT
, parm
);
822 if (parm
->ctrl
.ippathid
< iucv_max_pathid
) {
823 path
->pathid
= parm
->ctrl
.ippathid
;
824 path
->msglim
= parm
->ctrl
.ipmsglim
;
825 path
->flags
= parm
->ctrl
.ipflags1
;
826 path
->handler
= handler
;
827 path
->private = private;
828 list_add_tail(&path
->list
, &handler
->paths
);
829 iucv_path_table
[path
->pathid
] = path
;
831 iucv_sever_pathid(parm
->ctrl
.ippathid
,
836 spin_unlock_bh(&iucv_table_lock
);
839 EXPORT_SYMBOL(iucv_path_connect
);
843 * @path: address of iucv path structure
844 * @userdata: 16 bytes of data reflected to the communication partner
846 * This function temporarily suspends incoming messages on an IUCV path.
847 * You can later reactivate the path by invoking the iucv_resume function.
849 * Returns the result from the CP IUCV call.
851 int iucv_path_quiesce(struct iucv_path
*path
, u8 userdata
[16])
853 union iucv_param
*parm
;
857 parm
= percpu_ptr(iucv_param
, smp_processor_id());
858 memset(parm
, 0, sizeof(union iucv_param
));
860 memcpy(parm
->ctrl
.ipuser
, userdata
, sizeof(parm
->ctrl
.ipuser
));
861 parm
->ctrl
.ippathid
= path
->pathid
;
862 rc
= iucv_call_b2f0(IUCV_QUIESCE
, parm
);
866 EXPORT_SYMBOL(iucv_path_quiesce
);
870 * @path: address of iucv path structure
871 * @userdata: 16 bytes of data reflected to the communication partner
873 * This function resumes incoming messages on an IUCV path that has
874 * been stopped with iucv_path_quiesce.
876 * Returns the result from the CP IUCV call.
878 int iucv_path_resume(struct iucv_path
*path
, u8 userdata
[16])
880 union iucv_param
*parm
;
884 parm
= percpu_ptr(iucv_param
, smp_processor_id());
885 memset(parm
, 0, sizeof(union iucv_param
));
887 memcpy(parm
->ctrl
.ipuser
, userdata
, sizeof(parm
->ctrl
.ipuser
));
888 parm
->ctrl
.ippathid
= path
->pathid
;
889 rc
= iucv_call_b2f0(IUCV_RESUME
, parm
);
896 * @path: address of iucv path structure
897 * @userdata: 16 bytes of data reflected to the communication partner
899 * This function terminates an IUCV path.
901 * Returns the result from the CP IUCV call.
903 int iucv_path_sever(struct iucv_path
*path
, u8 userdata
[16])
908 if (iucv_active_cpu
!= smp_processor_id())
909 spin_lock_bh(&iucv_table_lock
);
910 rc
= iucv_sever_pathid(path
->pathid
, userdata
);
912 iucv_path_table
[path
->pathid
] = NULL
;
913 list_del_init(&path
->list
);
915 if (iucv_active_cpu
!= smp_processor_id())
916 spin_unlock_bh(&iucv_table_lock
);
920 EXPORT_SYMBOL(iucv_path_sever
);
924 * @path: address of iucv path structure
925 * @msg: address of iucv msg structure
926 * @srccls: source class of message
928 * Cancels a message you have sent.
930 * Returns the result from the CP IUCV call.
932 int iucv_message_purge(struct iucv_path
*path
, struct iucv_message
*msg
,
935 union iucv_param
*parm
;
939 parm
= percpu_ptr(iucv_param
, smp_processor_id());
940 memset(parm
, 0, sizeof(union iucv_param
));
941 parm
->purge
.ippathid
= path
->pathid
;
942 parm
->purge
.ipmsgid
= msg
->id
;
943 parm
->purge
.ipsrccls
= srccls
;
944 parm
->purge
.ipflags1
= IUCV_IPSRCCLS
| IUCV_IPFGMID
| IUCV_IPFGPID
;
945 rc
= iucv_call_b2f0(IUCV_PURGE
, parm
);
947 msg
->audit
= (*(u32
*) &parm
->purge
.ipaudit
) >> 8;
948 msg
->tag
= parm
->purge
.ipmsgtag
;
953 EXPORT_SYMBOL(iucv_message_purge
);
956 * iucv_message_receive
957 * @path: address of iucv path structure
958 * @msg: address of iucv msg structure
959 * @flags: how the message is received (IUCV_IPBUFLST)
960 * @buffer: address of data buffer or address of struct iucv_array
961 * @size: length of data buffer
964 * This function receives messages that are being sent to you over
965 * established paths. This function will deal with RMDATA messages
966 * embedded in struct iucv_message as well.
968 * Returns the result from the CP IUCV call.
970 int iucv_message_receive(struct iucv_path
*path
, struct iucv_message
*msg
,
971 u8 flags
, void *buffer
, size_t size
, size_t *residual
)
973 union iucv_param
*parm
;
974 struct iucv_array
*array
;
979 if (msg
->flags
& IUCV_IPRMDATA
) {
981 * Message is 8 bytes long and has been stored to the
982 * message descriptor itself.
984 rc
= (size
< 8) ? 5 : 0;
986 *residual
= abs(size
- 8);
988 if (flags
& IUCV_IPBUFLST
) {
989 /* Copy to struct iucv_array. */
990 size
= (size
< 8) ? size
: 8;
991 for (array
= buffer
; size
> 0; array
++) {
992 copy
= min_t(size_t, size
, array
->length
);
993 memcpy((u8
*)(addr_t
) array
->address
,
999 /* Copy to direct buffer. */
1000 memcpy(buffer
, rmmsg
, min_t(size_t, size
, 8));
1006 parm
= percpu_ptr(iucv_param
, smp_processor_id());
1007 memset(parm
, 0, sizeof(union iucv_param
));
1008 parm
->db
.ipbfadr1
= (u32
)(addr_t
) buffer
;
1009 parm
->db
.ipbfln1f
= (u32
) size
;
1010 parm
->db
.ipmsgid
= msg
->id
;
1011 parm
->db
.ippathid
= path
->pathid
;
1012 parm
->db
.iptrgcls
= msg
->class;
1013 parm
->db
.ipflags1
= (flags
| IUCV_IPFGPID
|
1014 IUCV_IPFGMID
| IUCV_IPTRGCLS
);
1015 rc
= iucv_call_b2f0(IUCV_RECEIVE
, parm
);
1016 if (!rc
|| rc
== 5) {
1017 msg
->flags
= parm
->db
.ipflags1
;
1019 *residual
= parm
->db
.ipbfln1f
;
1024 EXPORT_SYMBOL(iucv_message_receive
);
1027 * iucv_message_reject
1028 * @path: address of iucv path structure
1029 * @msg: address of iucv msg structure
1031 * The reject function refuses a specified message. Between the time you
1032 * are notified of a message and the time that you complete the message,
1033 * the message may be rejected.
1035 * Returns the result from the CP IUCV call.
1037 int iucv_message_reject(struct iucv_path
*path
, struct iucv_message
*msg
)
1039 union iucv_param
*parm
;
1043 parm
= percpu_ptr(iucv_param
, smp_processor_id());
1044 memset(parm
, 0, sizeof(union iucv_param
));
1045 parm
->db
.ippathid
= path
->pathid
;
1046 parm
->db
.ipmsgid
= msg
->id
;
1047 parm
->db
.iptrgcls
= msg
->class;
1048 parm
->db
.ipflags1
= (IUCV_IPTRGCLS
| IUCV_IPFGMID
| IUCV_IPFGPID
);
1049 rc
= iucv_call_b2f0(IUCV_REJECT
, parm
);
1053 EXPORT_SYMBOL(iucv_message_reject
);
1056 * iucv_message_reply
1057 * @path: address of iucv path structure
1058 * @msg: address of iucv msg structure
1059 * @flags: how the reply is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
1060 * @reply: address of reply data buffer or address of struct iucv_array
1061 * @size: length of reply data buffer
1063 * This function responds to the two-way messages that you receive. You
1064 * must identify completely the message to which you wish to reply. ie,
1065 * pathid, msgid, and trgcls. Prmmsg signifies the data is moved into
1066 * the parameter list.
1068 * Returns the result from the CP IUCV call.
1070 int iucv_message_reply(struct iucv_path
*path
, struct iucv_message
*msg
,
1071 u8 flags
, void *reply
, size_t size
)
1073 union iucv_param
*parm
;
1077 parm
= percpu_ptr(iucv_param
, smp_processor_id());
1078 memset(parm
, 0, sizeof(union iucv_param
));
1079 if (flags
& IUCV_IPRMDATA
) {
1080 parm
->dpl
.ippathid
= path
->pathid
;
1081 parm
->dpl
.ipflags1
= flags
;
1082 parm
->dpl
.ipmsgid
= msg
->id
;
1083 parm
->dpl
.iptrgcls
= msg
->class;
1084 memcpy(parm
->dpl
.iprmmsg
, reply
, min_t(size_t, size
, 8));
1086 parm
->db
.ipbfadr1
= (u32
)(addr_t
) reply
;
1087 parm
->db
.ipbfln1f
= (u32
) size
;
1088 parm
->db
.ippathid
= path
->pathid
;
1089 parm
->db
.ipflags1
= flags
;
1090 parm
->db
.ipmsgid
= msg
->id
;
1091 parm
->db
.iptrgcls
= msg
->class;
1093 rc
= iucv_call_b2f0(IUCV_REPLY
, parm
);
1097 EXPORT_SYMBOL(iucv_message_reply
);
1101 * @path: address of iucv path structure
1102 * @msg: address of iucv msg structure
1103 * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
1104 * @srccls: source class of message
1105 * @buffer: address of send buffer or address of struct iucv_array
1106 * @size: length of send buffer
1108 * This function transmits data to another application. Data to be
1109 * transmitted is in a buffer and this is a one-way message and the
1110 * receiver will not reply to the message.
1112 * Returns the result from the CP IUCV call.
1114 int iucv_message_send(struct iucv_path
*path
, struct iucv_message
*msg
,
1115 u8 flags
, u32 srccls
, void *buffer
, size_t size
)
1117 union iucv_param
*parm
;
1121 parm
= percpu_ptr(iucv_param
, smp_processor_id());
1122 memset(parm
, 0, sizeof(union iucv_param
));
1123 if (flags
& IUCV_IPRMDATA
) {
1124 /* Message of 8 bytes can be placed into the parameter list. */
1125 parm
->dpl
.ippathid
= path
->pathid
;
1126 parm
->dpl
.ipflags1
= flags
| IUCV_IPNORPY
;
1127 parm
->dpl
.iptrgcls
= msg
->class;
1128 parm
->dpl
.ipsrccls
= srccls
;
1129 parm
->dpl
.ipmsgtag
= msg
->tag
;
1130 memcpy(parm
->dpl
.iprmmsg
, buffer
, 8);
1132 parm
->db
.ipbfadr1
= (u32
)(addr_t
) buffer
;
1133 parm
->db
.ipbfln1f
= (u32
) size
;
1134 parm
->db
.ippathid
= path
->pathid
;
1135 parm
->db
.ipflags1
= flags
| IUCV_IPNORPY
;
1136 parm
->db
.iptrgcls
= msg
->class;
1137 parm
->db
.ipsrccls
= srccls
;
1138 parm
->db
.ipmsgtag
= msg
->tag
;
1140 rc
= iucv_call_b2f0(IUCV_SEND
, parm
);
1142 msg
->id
= parm
->db
.ipmsgid
;
1146 EXPORT_SYMBOL(iucv_message_send
);
1149 * iucv_message_send2way
1150 * @path: address of iucv path structure
1151 * @msg: address of iucv msg structure
1152 * @flags: how the message is sent and the reply is received
1153 * (IUCV_IPRMDATA, IUCV_IPBUFLST, IUCV_IPPRTY, IUCV_ANSLST)
1154 * @srccls: source class of message
1155 * @buffer: address of send buffer or address of struct iucv_array
1156 * @size: length of send buffer
1157 * @ansbuf: address of answer buffer or address of struct iucv_array
1158 * @asize: size of reply buffer
1160 * This function transmits data to another application. Data to be
1161 * transmitted is in a buffer. The receiver of the send is expected to
1162 * reply to the message and a buffer is provided into which IUCV moves
1163 * the reply to this message.
1165 * Returns the result from the CP IUCV call.
1167 int iucv_message_send2way(struct iucv_path
*path
, struct iucv_message
*msg
,
1168 u8 flags
, u32 srccls
, void *buffer
, size_t size
,
1169 void *answer
, size_t asize
, size_t *residual
)
1171 union iucv_param
*parm
;
1175 parm
= percpu_ptr(iucv_param
, smp_processor_id());
1176 memset(parm
, 0, sizeof(union iucv_param
));
1177 if (flags
& IUCV_IPRMDATA
) {
1178 parm
->dpl
.ippathid
= path
->pathid
;
1179 parm
->dpl
.ipflags1
= path
->flags
; /* priority message */
1180 parm
->dpl
.iptrgcls
= msg
->class;
1181 parm
->dpl
.ipsrccls
= srccls
;
1182 parm
->dpl
.ipmsgtag
= msg
->tag
;
1183 parm
->dpl
.ipbfadr2
= (u32
)(addr_t
) answer
;
1184 parm
->dpl
.ipbfln2f
= (u32
) asize
;
1185 memcpy(parm
->dpl
.iprmmsg
, buffer
, 8);
1187 parm
->db
.ippathid
= path
->pathid
;
1188 parm
->db
.ipflags1
= path
->flags
; /* priority message */
1189 parm
->db
.iptrgcls
= msg
->class;
1190 parm
->db
.ipsrccls
= srccls
;
1191 parm
->db
.ipmsgtag
= msg
->tag
;
1192 parm
->db
.ipbfadr1
= (u32
)(addr_t
) buffer
;
1193 parm
->db
.ipbfln1f
= (u32
) size
;
1194 parm
->db
.ipbfadr2
= (u32
)(addr_t
) answer
;
1195 parm
->db
.ipbfln2f
= (u32
) asize
;
1197 rc
= iucv_call_b2f0(IUCV_SEND
, parm
);
1199 msg
->id
= parm
->db
.ipmsgid
;
1203 EXPORT_SYMBOL(iucv_message_send2way
);
1207 * @data: Pointer to external interrupt buffer
1209 * Process connection pending work item. Called from tasklet while holding
1212 struct iucv_path_pending
{
1223 } __attribute__ ((packed
));
1225 static void iucv_path_pending(struct iucv_irq_data
*data
)
1227 struct iucv_path_pending
*ipp
= (void *) data
;
1228 struct iucv_handler
*handler
;
1229 struct iucv_path
*path
;
1232 BUG_ON(iucv_path_table
[ipp
->ippathid
]);
1233 /* New pathid, handler found. Create a new path struct. */
1234 error
= iucv_error_no_memory
;
1235 path
= iucv_path_alloc(ipp
->ipmsglim
, ipp
->ipflags1
, GFP_ATOMIC
);
1238 path
->pathid
= ipp
->ippathid
;
1239 iucv_path_table
[path
->pathid
] = path
;
1240 EBCASC(ipp
->ipvmid
, 8);
1242 /* Call registered handler until one is found that wants the path. */
1243 list_for_each_entry(handler
, &iucv_handler_list
, list
) {
1244 if (!handler
->path_pending
)
1247 * Add path to handler to allow a call to iucv_path_sever
1248 * inside the path_pending function. If the handler returns
1249 * an error remove the path from the handler again.
1251 list_add(&path
->list
, &handler
->paths
);
1252 path
->handler
= handler
;
1253 if (!handler
->path_pending(path
, ipp
->ipvmid
, ipp
->ipuser
))
1255 list_del(&path
->list
);
1256 path
->handler
= NULL
;
1258 /* No handler wanted the path. */
1259 iucv_path_table
[path
->pathid
] = NULL
;
1260 iucv_path_free(path
);
1261 error
= iucv_error_no_listener
;
1263 iucv_sever_pathid(ipp
->ippathid
, error
);
1267 * iucv_path_complete
1268 * @data: Pointer to external interrupt buffer
1270 * Process connection complete work item. Called from tasklet while holding
1273 struct iucv_path_complete
{
1284 } __attribute__ ((packed
));
1286 static void iucv_path_complete(struct iucv_irq_data
*data
)
1288 struct iucv_path_complete
*ipc
= (void *) data
;
1289 struct iucv_path
*path
= iucv_path_table
[ipc
->ippathid
];
1291 if (path
&& path
->handler
&& path
->handler
->path_complete
)
1292 path
->handler
->path_complete(path
, ipc
->ipuser
);
1297 * @data: Pointer to external interrupt buffer
1299 * Process connection severed work item. Called from tasklet while holding
1302 struct iucv_path_severed
{
1312 } __attribute__ ((packed
));
1314 static void iucv_path_severed(struct iucv_irq_data
*data
)
1316 struct iucv_path_severed
*ips
= (void *) data
;
1317 struct iucv_path
*path
= iucv_path_table
[ips
->ippathid
];
1319 if (!path
|| !path
->handler
) /* Already severed */
1321 if (path
->handler
->path_severed
)
1322 path
->handler
->path_severed(path
, ips
->ipuser
);
1324 iucv_sever_pathid(path
->pathid
, NULL
);
1325 iucv_path_table
[path
->pathid
] = NULL
;
1326 list_del_init(&path
->list
);
1327 iucv_path_free(path
);
1332 * iucv_path_quiesced
1333 * @data: Pointer to external interrupt buffer
1335 * Process connection quiesced work item. Called from tasklet while holding
1338 struct iucv_path_quiesced
{
1348 } __attribute__ ((packed
));
1350 static void iucv_path_quiesced(struct iucv_irq_data
*data
)
1352 struct iucv_path_quiesced
*ipq
= (void *) data
;
1353 struct iucv_path
*path
= iucv_path_table
[ipq
->ippathid
];
1355 if (path
&& path
->handler
&& path
->handler
->path_quiesced
)
1356 path
->handler
->path_quiesced(path
, ipq
->ipuser
);
1361 * @data: Pointer to external interrupt buffer
1363 * Process connection resumed work item. Called from tasklet while holding
1366 struct iucv_path_resumed
{
1376 } __attribute__ ((packed
));
1378 static void iucv_path_resumed(struct iucv_irq_data
*data
)
1380 struct iucv_path_resumed
*ipr
= (void *) data
;
1381 struct iucv_path
*path
= iucv_path_table
[ipr
->ippathid
];
1383 if (path
&& path
->handler
&& path
->handler
->path_resumed
)
1384 path
->handler
->path_resumed(path
, ipr
->ipuser
);
1388 * iucv_message_complete
1389 * @data: Pointer to external interrupt buffer
1391 * Process message complete work item. Called from tasklet while holding
1394 struct iucv_message_complete
{
1407 } __attribute__ ((packed
));
1409 static void iucv_message_complete(struct iucv_irq_data
*data
)
1411 struct iucv_message_complete
*imc
= (void *) data
;
1412 struct iucv_path
*path
= iucv_path_table
[imc
->ippathid
];
1413 struct iucv_message msg
;
1415 if (path
&& path
->handler
&& path
->handler
->message_complete
) {
1416 msg
.flags
= imc
->ipflags1
;
1417 msg
.id
= imc
->ipmsgid
;
1418 msg
.audit
= imc
->ipaudit
;
1419 memcpy(msg
.rmmsg
, imc
->iprmmsg
, 8);
1420 msg
.class = imc
->ipsrccls
;
1421 msg
.tag
= imc
->ipmsgtag
;
1422 msg
.length
= imc
->ipbfln2f
;
1423 path
->handler
->message_complete(path
, &msg
);
1428 * iucv_message_pending
1429 * @data: Pointer to external interrupt buffer
1431 * Process message pending work item. Called from tasklet while holding
1434 struct iucv_message_pending
{
1452 } __attribute__ ((packed
));
1454 static void iucv_message_pending(struct iucv_irq_data
*data
)
1456 struct iucv_message_pending
*imp
= (void *) data
;
1457 struct iucv_path
*path
= iucv_path_table
[imp
->ippathid
];
1458 struct iucv_message msg
;
1460 if (path
&& path
->handler
&& path
->handler
->message_pending
) {
1461 msg
.flags
= imp
->ipflags1
;
1462 msg
.id
= imp
->ipmsgid
;
1463 msg
.class = imp
->iptrgcls
;
1464 if (imp
->ipflags1
& IUCV_IPRMDATA
) {
1465 memcpy(msg
.rmmsg
, imp
->ln1msg1
.iprmmsg1
, 8);
1468 msg
.length
= imp
->ln1msg2
.ipbfln1f
;
1469 msg
.reply_size
= imp
->ipbfln2f
;
1470 path
->handler
->message_pending(path
, &msg
);
1477 * This tasklet loops over the queue of irq buffers created by
1478 * iucv_external_interrupt, calls the appropriate action handler
1479 * and then frees the buffer.
1481 static void iucv_tasklet_fn(unsigned long ignored
)
1483 typedef void iucv_irq_fn(struct iucv_irq_data
*);
1484 static iucv_irq_fn
*irq_fn
[] = {
1485 [0x02] = iucv_path_complete
,
1486 [0x03] = iucv_path_severed
,
1487 [0x04] = iucv_path_quiesced
,
1488 [0x05] = iucv_path_resumed
,
1489 [0x06] = iucv_message_complete
,
1490 [0x07] = iucv_message_complete
,
1491 [0x08] = iucv_message_pending
,
1492 [0x09] = iucv_message_pending
,
1494 struct list_head task_queue
= LIST_HEAD_INIT(task_queue
);
1495 struct iucv_irq_list
*p
, *n
;
1497 /* Serialize tasklet, iucv_path_sever and iucv_path_connect. */
1498 if (!spin_trylock(&iucv_table_lock
)) {
1499 tasklet_schedule(&iucv_tasklet
);
1502 iucv_active_cpu
= smp_processor_id();
1504 spin_lock_irq(&iucv_queue_lock
);
1505 list_splice_init(&iucv_task_queue
, &task_queue
);
1506 spin_unlock_irq(&iucv_queue_lock
);
1508 list_for_each_entry_safe(p
, n
, &task_queue
, list
) {
1509 list_del_init(&p
->list
);
1510 irq_fn
[p
->data
.iptype
](&p
->data
);
1514 iucv_active_cpu
= -1;
1515 spin_unlock(&iucv_table_lock
);
1521 * This work function loops over the queue of path pending irq blocks
1522 * created by iucv_external_interrupt, calls the appropriate action
1523 * handler and then frees the buffer.
1525 static void iucv_work_fn(struct work_struct
*work
)
1527 typedef void iucv_irq_fn(struct iucv_irq_data
*);
1528 struct list_head work_queue
= LIST_HEAD_INIT(work_queue
);
1529 struct iucv_irq_list
*p
, *n
;
1531 /* Serialize tasklet, iucv_path_sever and iucv_path_connect. */
1532 spin_lock_bh(&iucv_table_lock
);
1533 iucv_active_cpu
= smp_processor_id();
1535 spin_lock_irq(&iucv_queue_lock
);
1536 list_splice_init(&iucv_work_queue
, &work_queue
);
1537 spin_unlock_irq(&iucv_queue_lock
);
1539 iucv_cleanup_queue();
1540 list_for_each_entry_safe(p
, n
, &work_queue
, list
) {
1541 list_del_init(&p
->list
);
1542 iucv_path_pending(&p
->data
);
1546 iucv_active_cpu
= -1;
1547 spin_unlock_bh(&iucv_table_lock
);
1551 * iucv_external_interrupt
1554 * Handles external interrupts coming in from CP.
1555 * Places the interrupt buffer on a queue and schedules iucv_tasklet_fn().
1557 static void iucv_external_interrupt(u16 code
)
1559 struct iucv_irq_data
*p
;
1560 struct iucv_irq_list
*work
;
1562 p
= percpu_ptr(iucv_irq_data
, smp_processor_id());
1563 if (p
->ippathid
>= iucv_max_pathid
) {
1564 printk(KERN_WARNING
"iucv_do_int: Got interrupt with "
1565 "pathid %d > max_connections (%ld)\n",
1566 p
->ippathid
, iucv_max_pathid
- 1);
1567 iucv_sever_pathid(p
->ippathid
, iucv_error_no_listener
);
1570 if (p
->iptype
< 0x01 || p
->iptype
> 0x09) {
1571 printk(KERN_ERR
"iucv_do_int: unknown iucv interrupt\n");
1574 work
= kmalloc(sizeof(struct iucv_irq_list
), GFP_ATOMIC
);
1576 printk(KERN_WARNING
"iucv_external_interrupt: out of memory\n");
1579 memcpy(&work
->data
, p
, sizeof(work
->data
));
1580 spin_lock(&iucv_queue_lock
);
1581 if (p
->iptype
== 0x01) {
1582 /* Path pending interrupt. */
1583 list_add_tail(&work
->list
, &iucv_work_queue
);
1584 schedule_work(&iucv_work
);
1586 /* The other interrupts. */
1587 list_add_tail(&work
->list
, &iucv_task_queue
);
1588 tasklet_schedule(&iucv_tasklet
);
1590 spin_unlock(&iucv_queue_lock
);
1596 * Allocates and initializes various data structures.
1598 static int __init
iucv_init(void)
1602 if (!MACHINE_IS_VM
) {
1603 rc
= -EPROTONOSUPPORT
;
1606 rc
= iucv_query_maxconn();
1609 rc
= register_external_interrupt(0x4000, iucv_external_interrupt
);
1612 rc
= bus_register(&iucv_bus
);
1615 iucv_root
= s390_root_dev_register("iucv");
1616 if (IS_ERR(iucv_root
)) {
1617 rc
= PTR_ERR(iucv_root
);
1620 /* Note: GFP_DMA used to get memory below 2G */
1621 iucv_irq_data
= percpu_alloc(sizeof(struct iucv_irq_data
),
1622 GFP_KERNEL
|GFP_DMA
);
1623 if (!iucv_irq_data
) {
1627 /* Allocate parameter blocks. */
1628 iucv_param
= percpu_alloc(sizeof(union iucv_param
),
1629 GFP_KERNEL
|GFP_DMA
);
1634 register_hotcpu_notifier(&iucv_cpu_notifier
);
1635 ASCEBC(iucv_error_no_listener
, 16);
1636 ASCEBC(iucv_error_no_memory
, 16);
1637 ASCEBC(iucv_error_pathid
, 16);
1642 percpu_free(iucv_irq_data
);
1644 s390_root_dev_unregister(iucv_root
);
1646 bus_unregister(&iucv_bus
);
1648 unregister_external_interrupt(0x4000, iucv_external_interrupt
);
1656 * Frees everything allocated from iucv_init.
1658 static void __exit
iucv_exit(void)
1660 struct iucv_irq_list
*p
, *n
;
1662 spin_lock_irq(&iucv_queue_lock
);
1663 list_for_each_entry_safe(p
, n
, &iucv_task_queue
, list
)
1665 list_for_each_entry_safe(p
, n
, &iucv_work_queue
, list
)
1667 spin_unlock_irq(&iucv_queue_lock
);
1668 unregister_hotcpu_notifier(&iucv_cpu_notifier
);
1669 percpu_free(iucv_param
);
1670 percpu_free(iucv_irq_data
);
1671 s390_root_dev_unregister(iucv_root
);
1672 bus_unregister(&iucv_bus
);
1673 unregister_external_interrupt(0x4000, iucv_external_interrupt
);
1676 subsys_initcall(iucv_init
);
1677 module_exit(iucv_exit
);
1679 MODULE_AUTHOR("(C) 2001 IBM Corp. by Fritz Elfert (felfert@millenux.com)");
1680 MODULE_DESCRIPTION("Linux for S/390 IUCV lowlevel driver");
1681 MODULE_LICENSE("GPL");