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