1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <linux/config.h>
27
28#define RIO_NBOARDS 4
29#define RIO_PORTSPERBOARD 128
30#define RIO_NPORTS (RIO_NBOARDS * RIO_PORTSPERBOARD)
31
32#define MODEM_SUPPORT
33
34#ifdef __KERNEL__
35
36#define RIO_MAGIC 0x12345678
37
38
39struct vpd_prom {
40 unsigned short id;
41 char hwrev;
42 char hwass;
43 int uniqid;
44 char myear;
45 char mweek;
46 char hw_feature[5];
47 char oem_id;
48 char identifier[16];
49};
50
51
52#define RIO_DEBUG_ALL 0xffffffff
53
54#define O_OTHER(tty) \
55 ((O_OLCUC(tty)) ||\
56 (O_ONLCR(tty)) ||\
57 (O_OCRNL(tty)) ||\
58 (O_ONOCR(tty)) ||\
59 (O_ONLRET(tty)) ||\
60 (O_OFILL(tty)) ||\
61 (O_OFDEL(tty)) ||\
62 (O_NLDLY(tty)) ||\
63 (O_CRDLY(tty)) ||\
64 (O_TABDLY(tty)) ||\
65 (O_BSDLY(tty)) ||\
66 (O_VTDLY(tty)) ||\
67 (O_FFDLY(tty)))
68
69
70#define I_OTHER(tty) \
71 ((I_INLCR(tty)) ||\
72 (I_IGNCR(tty)) ||\
73 (I_ICRNL(tty)) ||\
74 (I_IUCLC(tty)) ||\
75 (L_ISIG(tty)))
76
77
78#endif
79
80
81#define RIO_BOARD_INTR_LOCK 1
82
83
84#ifndef RIOCTL_MISC_MINOR
85
86#define RIOCTL_MISC_MINOR 169
87#endif
88
89
90void rio_dec_mod_count (void);
91void rio_inc_mod_count (void);
92
93
94
95#if 1
96#define rio_spin_lock_irqsave(sem, flags) do { \
97 rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlockirqsave: %p %s:%d\n", \
98 sem, __FILE__, __LINE__);\
99 spin_lock_irqsave(sem, flags);\
100 } while (0)
101
102#define rio_spin_unlock_irqrestore(sem, flags) do { \
103 rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlockirqrestore: %p %s:%d\n",\
104 sem, __FILE__, __LINE__);\
105 spin_unlock_irqrestore(sem, flags);\
106 } while (0)
107
108#define rio_spin_lock(sem) do { \
109 rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlock: %p %s:%d\n",\
110 sem, __FILE__, __LINE__);\
111 spin_lock(sem);\
112 } while (0)
113
114#define rio_spin_unlock(sem) do { \
115 rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlock: %p %s:%d\n",\
116 sem, __FILE__, __LINE__);\
117 spin_unlock(sem);\
118 } while (0)
119#else
120#define rio_spin_lock_irqsave(sem, flags) \
121 spin_lock_irqsave(sem, flags)
122
123#define rio_spin_unlock_irqrestore(sem, flags) \
124 spin_unlock_irqrestore(sem, flags)
125
126#define rio_spin_lock(sem) \
127 spin_lock(sem)
128
129#define rio_spin_unlock(sem) \
130 spin_unlock(sem)
131
132#endif
133
134
135
136#ifdef CONFIG_RIO_OLDPCI
137static inline void *rio_memcpy_toio (void *dummy, void *dest, void *source, int n)
138{
139 char *dst = dest;
140 char *src = source;
141
142 while (n--) {
143 writeb (*src++, dst++);
144 (void) readb (dummy);
145 }
146
147 return dest;
148}
149
150
151static inline void *rio_memcpy_fromio (void *dest, void *source, int n)
152{
153 char *dst = dest;
154 char *src = source;
155
156 while (n--)
157 *dst++ = readb (src++);
158
159 return dest;
160}
161
162#else
163#define rio_memcpy_toio(dummy,dest,source,n) memcpy_toio(dest, source, n)
164#define rio_memcpy_fromio memcpy_fromio
165#endif
166
167#define DEBUG 1
168
169
170
171
172
173
174
175
176
177
178
179#ifdef DEBUG
180#define rio_dprintk(f, str...) do { if (rio_debug & f) printk (str);} while (0)
181#define func_enter() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s\n", __FUNCTION__)
182#define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit %s\n", __FUNCTION__)
183#define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n", \
184 __FUNCTION__, port->line)
185#else
186#define rio_dprintk(f, str...)
187#define func_enter()
188#define func_exit()
189#define func_enter2()
190#endif
191
192