2 * arch/s390/kernel/s390_ext.c
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com),
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/slab.h>
13 #include <asm/lowcore.h>
14 #include <asm/s390_ext.h>
17 * Simple hash strategy: index = code & 0xff;
18 * ext_int_hash[index] is the start of the list for all external interrupts
19 * that hash to this index. With the current set of external interrupts
20 * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000
21 * iucv and 0x2603 pfault) this is always the first element.
23 ext_int_info_t *ext_int_hash[256] = { 0, };
25 int register_external_interrupt(__u16 code, ext_int_handler_t handler) {
29 p = (ext_int_info_t *) kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC);
35 p->next = ext_int_hash[index];
36 ext_int_hash[index] = p;
40 int register_early_external_interrupt(__u16 code, ext_int_handler_t handler,
49 p->next = ext_int_hash[index];
50 ext_int_hash[index] = p;
54 int unregister_external_interrupt(__u16 code, ext_int_handler_t handler) {
55 ext_int_info_t *p, *q;
60 p = ext_int_hash[index];
62 if (p->code == code && p->handler == handler)
72 ext_int_hash[index] = p->next;
77 int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler,
82 if (p == NULL || p->code != code || p->handler != handler)
85 q = ext_int_hash[index];
96 ext_int_hash[index] = p->next;
100 EXPORT_SYMBOL(register_external_interrupt);
101 EXPORT_SYMBOL(unregister_external_interrupt);