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