1
2
3
4
5
6
7
8
9#ifndef _ASM_S390_AIRQ_H
10#define _ASM_S390_AIRQ_H
11
12#include <linux/bit_spinlock.h>
13
14struct airq_struct {
15 struct hlist_node list;
16 void (*handler)(struct airq_struct *);
17 u8 *lsi_ptr;
18 u8 lsi_mask;
19 u8 isc;
20 u8 flags;
21};
22
23#define AIRQ_PTR_ALLOCATED 0x01
24
25int register_adapter_interrupt(struct airq_struct *airq);
26void unregister_adapter_interrupt(struct airq_struct *airq);
27
28
29struct airq_iv {
30 unsigned long *vector;
31 unsigned long *avail;
32 unsigned long *bitlock;
33 unsigned long *ptr;
34 unsigned int *data;
35 unsigned long bits;
36 unsigned long end;
37 spinlock_t lock;
38};
39
40#define AIRQ_IV_ALLOC 1
41#define AIRQ_IV_BITLOCK 2
42#define AIRQ_IV_PTR 4
43#define AIRQ_IV_DATA 8
44
45struct airq_iv *airq_iv_create(unsigned long bits, unsigned long flags);
46void airq_iv_release(struct airq_iv *iv);
47unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num);
48void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num);
49unsigned long airq_iv_scan(struct airq_iv *iv, unsigned long start,
50 unsigned long end);
51
52static inline unsigned long airq_iv_alloc_bit(struct airq_iv *iv)
53{
54 return airq_iv_alloc(iv, 1);
55}
56
57static inline void airq_iv_free_bit(struct airq_iv *iv, unsigned long bit)
58{
59 airq_iv_free(iv, bit, 1);
60}
61
62static inline unsigned long airq_iv_end(struct airq_iv *iv)
63{
64 return iv->end;
65}
66
67static inline void airq_iv_lock(struct airq_iv *iv, unsigned long bit)
68{
69 const unsigned long be_to_le = BITS_PER_LONG - 1;
70 bit_spin_lock(bit ^ be_to_le, iv->bitlock);
71}
72
73static inline void airq_iv_unlock(struct airq_iv *iv, unsigned long bit)
74{
75 const unsigned long be_to_le = BITS_PER_LONG - 1;
76 bit_spin_unlock(bit ^ be_to_le, iv->bitlock);
77}
78
79static inline void airq_iv_set_data(struct airq_iv *iv, unsigned long bit,
80 unsigned int data)
81{
82 iv->data[bit] = data;
83}
84
85static inline unsigned int airq_iv_get_data(struct airq_iv *iv,
86 unsigned long bit)
87{
88 return iv->data[bit];
89}
90
91static inline void airq_iv_set_ptr(struct airq_iv *iv, unsigned long bit,
92 unsigned long ptr)
93{
94 iv->ptr[bit] = ptr;
95}
96
97static inline unsigned long airq_iv_get_ptr(struct airq_iv *iv,
98 unsigned long bit)
99{
100 return iv->ptr[bit];
101}
102
103#endif
104