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