| Linux kernel & device driver programming |
| [ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] |
1 /* 1 /*
2 ** ------------------------------------------- 2 ** -----------------------------------------------------------------------------
3 ** 3 **
4 ** Perle Specialix driver for Linux 4 ** Perle Specialix driver for Linux
5 ** Ported from existing RIO Driver for SCO so 5 ** Ported from existing RIO Driver for SCO sources.
6 * 6 *
7 * (C) 1990 - 2000 Specialix International Lt 7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
8 * 8 *
9 * This program is free software; you can 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either v 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 * 13 *
14 * This program is distributed in the hop 14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTI 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more de 17 * GNU General Public License for more details.
18 * 18 *
19 * You should have received a copy of the 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambri 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 ** 22 **
23 ** Module : rioctrl.c 23 ** Module : rioctrl.c
24 ** SID : 1.3 24 ** SID : 1.3
25 ** Last Modified : 11/6/98 10:33:42 25 ** Last Modified : 11/6/98 10:33:42
26 ** Retrieved : 11/6/98 10:33:49 26 ** Retrieved : 11/6/98 10:33:49
27 ** 27 **
28 ** ident @(#)rioctrl.c 1.3 28 ** ident @(#)rioctrl.c 1.3
29 ** 29 **
30 ** ------------------------------------------- 30 ** -----------------------------------------------------------------------------
31 */ 31 */
32 #ifdef SCCS_LABELS 32 #ifdef SCCS_LABELS
33 static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 33 static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3";
34 #endif 34 #endif
35 35
36 36
37 #include <linux/module.h> 37 #include <linux/module.h>
38 #include <linux/slab.h> 38 #include <linux/slab.h>
39 #include <linux/errno.h> 39 #include <linux/errno.h>
40 #include <asm/io.h> 40 #include <asm/io.h>
41 #include <asm/system.h> 41 #include <asm/system.h>
42 #include <asm/string.h> 42 #include <asm/string.h>
43 #include <asm/semaphore.h> 43 #include <asm/semaphore.h>
44 #include <asm/uaccess.h> 44 #include <asm/uaccess.h>
45 45
46 #include <linux/termios.h> 46 #include <linux/termios.h>
47 #include <linux/serial.h> 47 #include <linux/serial.h>
48 48
49 #include <linux/generic_serial.h> 49 #include <linux/generic_serial.h>
50 50
51 51
52 #include "linux_compat.h" 52 #include "linux_compat.h"
53 #include "rio_linux.h" 53 #include "rio_linux.h"
54 #include "typdef.h" <<
55 #include "pkt.h" 54 #include "pkt.h"
56 #include "daemon.h" 55 #include "daemon.h"
57 #include "rio.h" 56 #include "rio.h"
58 #include "riospace.h" 57 #include "riospace.h"
59 #include "top.h" <<
60 #include "cmdpkt.h" 58 #include "cmdpkt.h"
61 #include "map.h" 59 #include "map.h"
62 #include "riotypes.h" <<
63 #include "rup.h" 60 #include "rup.h"
64 #include "port.h" 61 #include "port.h"
65 #include "riodrvr.h" 62 #include "riodrvr.h"
66 #include "rioinfo.h" 63 #include "rioinfo.h"
67 #include "func.h" 64 #include "func.h"
68 #include "errors.h" 65 #include "errors.h"
69 #include "pci.h" 66 #include "pci.h"
70 67
71 #include "parmmap.h" 68 #include "parmmap.h"
72 #include "unixrup.h" 69 #include "unixrup.h"
73 #include "board.h" 70 #include "board.h"
74 #include "host.h" 71 #include "host.h"
75 #include "error.h" <<
76 #include "phb.h" 72 #include "phb.h"
77 #include "link.h" 73 #include "link.h"
78 #include "cmdblk.h" 74 #include "cmdblk.h"
79 #include "route.h" 75 #include "route.h"
80 #include "control.h" <<
81 #include "cirrus.h" 76 #include "cirrus.h"
82 #include "rioioctl.h" 77 #include "rioioctl.h"
83 78
84 79
85 static struct LpbReq LpbReq; !! 80 static struct LpbReq LpbReq;
86 static struct RupReq RupReq; !! 81 static struct RupReq RupReq;
87 static struct PortReq PortReq; !! 82 static struct PortReq PortReq;
88 static struct HostReq HostReq; !! 83 static struct HostReq HostReq; /* oh really? global? and no locking? */
89 static struct HostDpRam HostDpRam; 84 static struct HostDpRam HostDpRam;
90 static struct DebugCtrl DebugCtrl; 85 static struct DebugCtrl DebugCtrl;
91 static struct Map MapEnt; !! 86 static struct Map MapEnt;
92 static struct PortSetup PortSetup; 87 static struct PortSetup PortSetup;
93 static struct DownLoad DownLoad; !! 88 static struct DownLoad DownLoad;
94 static struct SendPack SendPack; !! 89 static struct SendPack SendPack;
95 /* static struct StreamInfo StreamInfo; */ 90 /* static struct StreamInfo StreamInfo; */
96 /* static char modemtable[RIO_PORTS]; */ 91 /* static char modemtable[RIO_PORTS]; */
97 static struct SpecialRupCmd SpecialRupCmd; 92 static struct SpecialRupCmd SpecialRupCmd;
98 static struct PortParams PortParams; 93 static struct PortParams PortParams;
99 static struct portStats portStats; 94 static struct portStats portStats;
100 95
101 static struct SubCmdStruct { 96 static struct SubCmdStruct {
102 ushort Host; !! 97 ushort Host;
103 ushort Rup; !! 98 ushort Rup;
104 ushort Port; !! 99 ushort Port;
105 ushort Addr; !! 100 ushort Addr;
106 } SubCmd; 101 } SubCmd;
107 102
108 struct PortTty { 103 struct PortTty {
109 uint port; !! 104 uint port;
110 struct ttystatics Tty; !! 105 struct ttystatics Tty;
111 }; 106 };
112 107
113 static struct PortTty PortTty; !! 108 static struct PortTty PortTty;
114 typedef struct ttystatics TERMIO; 109 typedef struct ttystatics TERMIO;
115 110
116 /* 111 /*
117 ** This table is used when the config.rio down 112 ** This table is used when the config.rio downloads bin code to the
118 ** driver. We index the table using the produc 113 ** driver. We index the table using the product code, 0-F, and call
119 ** the function pointed to by the entry, passi 114 ** the function pointed to by the entry, passing the information
120 ** about the boot. 115 ** about the boot.
121 ** The RIOBootCodeUNKNOWN entry is there to po 116 ** The RIOBootCodeUNKNOWN entry is there to politely tell the calling
122 ** process to bog off. 117 ** process to bog off.
123 */ 118 */
124 static int !! 119 static int
125 (*RIOBootTable[MAX_PRODUCT])(struct rio_info * !! 120 (*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = {
126 { !! 121 /* 0 */ RIOBootCodeHOST,
127 /* 0 */ RIOBootCodeHOST, /* Host Card * !! 122 /* Host Card */
128 /* 1 */ RIOBootCodeRTA, /* RTA */ !! 123 /* 1 */ RIOBootCodeRTA,
>> 124 /* RTA */
129 }; 125 };
130 126
131 #define drv_makedev(maj, min) ((((uint) maj & 127 #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
132 128
133 int copyin (int arg, caddr_t dp, int siz) !! 129 static int copy_from_io(void __user *to, void __iomem *from, size_t size)
134 { 130 {
135 int rv; !! 131 void *buf = kmalloc(size, GFP_KERNEL);
136 !! 132 int res = -ENOMEM;
137 rio_dprintk (RIO_DEBUG_CTRL, "Copying %d byt !! 133 if (buf) {
138 rv = copy_from_user (dp, (void *)arg, siz); !! 134 rio_memcpy_fromio(buf, from, size);
139 if (rv) return COPYFAIL; !! 135 res = copy_to_user(to, buf, size);
140 else return rv; !! 136 kfree(buf);
>> 137 }
>> 138 return res;
141 } 139 }
142 140
143 static int copyout (caddr_t dp, int arg, int s !! 141 int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su)
144 { 142 {
145 int rv; !! 143 uint Host; /* leave me unsigned! */
>> 144 uint port; /* and me! */
>> 145 struct Host *HostP;
>> 146 ushort loop;
>> 147 int Entry;
>> 148 struct Port *PortP;
>> 149 struct PKT __iomem *PacketP;
>> 150 int retval = 0;
>> 151 unsigned long flags;
>> 152 void __user *argp = (void __user *)arg;
146 153
147 rio_dprintk (RIO_DEBUG_CTRL, "Copying %d byt !! 154 func_enter();
148 rv = copy_to_user ((void *)arg, dp, siz); <<
149 if (rv) return COPYFAIL; <<
150 else return rv; <<
151 } <<
152 155
153 int <<
154 riocontrol(p, dev, cmd, arg, su) <<
155 struct rio_info * p; <<
156 dev_t dev; <<
157 int cmd; <<
158 caddr_t arg; <<
159 int su; <<
160 { <<
161 uint Host; /* leave me unsigned! <<
162 uint port; /* and me! */ <<
163 struct Host *HostP; <<
164 ushort loop; <<
165 int Entry; <<
166 struct Port *PortP; <<
167 PKT *PacketP; <<
168 int retval = 0; <<
169 unsigned long flags; <<
170 <<
171 func_enter (); <<
172 <<
173 /* Confuse the compiler to think that 156 /* Confuse the compiler to think that we've initialized these */
174 Host=0; !! 157 Host = 0;
175 PortP = NULL; 158 PortP = NULL;
176 159
177 rio_dprintk (RIO_DEBUG_CTRL, "control !! 160 rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, argp);
178 161
179 switch (cmd) { 162 switch (cmd) {
180 /* 163 /*
181 ** RIO_SET_TIMER !! 164 ** RIO_SET_TIMER
182 ** !! 165 **
183 ** Change the value of the hos !! 166 ** Change the value of the host card interrupt timer.
184 ** If the host card number is !! 167 ** If the host card number is -1 then all host cards are changed
185 ** otherwise just the specifie !! 168 ** otherwise just the specified host card will be changed.
186 */ !! 169 */
187 case RIO_SET_TIMER: !! 170 case RIO_SET_TIMER:
188 rio_dprintk (RIO_DEBUG !! 171 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", arg);
189 { !! 172 {
190 int host, valu !! 173 int host, value;
191 host = (uint)a !! 174 host = (arg >> 16) & 0x0000FFFF;
192 value = (uint) !! 175 value = arg & 0x0000ffff;
193 if (host == -1 !! 176 if (host == -1) {
194 for (h !! 177 for (host = 0; host < p->RIONumHosts; host++) {
195 !! 178 if (p->RIOHosts[host].Flags == RC_RUNNING) {
196 !! 179 writew(value, &p->RIOHosts[host].ParmMapP->timer);
197 <<
198 } <<
199 } else if (hos <<
200 return <<
201 } else { <<
202 if ( p <<
203 <<
204 } 180 }
205 } 181 }
206 } !! 182 } else if (host >= p->RIONumHosts) {
207 return 0; !! 183 return -EINVAL;
208 !! 184 } else {
209 case RIO_IDENTIFY_DRIVER: !! 185 if (p->RIOHosts[host].Flags == RC_RUNNING) {
210 /* !! 186 writew(value, &p->RIOHosts[host].ParmMapP->timer);
211 ** 15.10.1998 ARG - ES <<
212 ** Added driver ident <<
213 ** <<
214 #ifndef __THIS_RELEASE__ <<
215 #warning Driver Version string not defined ! <<
216 #endif <<
217 cprintf("%s %s %s %s\n <<
218 RIO_DRV_STR, <<
219 __THIS_RELEASE <<
220 __DATE__, __TI <<
221 <<
222 return 0; <<
223 <<
224 case RIO_DISPLAY_HOST_CFG: <<
225 ** <<
226 ** 15.10.1998 ARG - ES <<
227 ** Added driver host c <<
228 ** <<
229 ** Note that the only <<
230 ** are ISA and PCI. Al <<
231 ** (yet) distinguish b <<
232 ** and the Jet PCI car <<
233 ** driver only support <<
234 ** <<
235 <<
236 for (Host = 0; Host < <<
237 { <<
238 HostP = &(p->R <<
239 <<
240 switch ( HostP <<
241 { <<
242 case RIO_A <<
243 strcpy <<
244 break; <<
245 <<
246 case RIO_P <<
247 strcpy <<
248 break; <<
249 <<
250 default : <<
251 strcpy <<
252 break; <<
253 } 187 }
>> 188 }
>> 189 }
>> 190 return 0;
254 191
255 cprintf( !! 192 case RIO_FOAD_RTA:
256 "RIO Host %d !! 193 rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n");
257 Host, !! 194 return RIOCommandRta(p, arg, RIOFoadRta);
258 (uint) !! 195
259 (int)H !! 196 case RIO_ZOMBIE_RTA:
>> 197 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n");
>> 198 return RIOCommandRta(p, arg, RIOZombieRta);
>> 199
>> 200 case RIO_IDENTIFY_RTA:
>> 201 rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n");
>> 202 return RIOIdentifyRta(p, argp);
>> 203
>> 204 case RIO_KILL_NEIGHBOUR:
>> 205 rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n");
>> 206 return RIOKillNeighbour(p, argp);
>> 207
>> 208 case SPECIAL_RUP_CMD:
>> 209 {
>> 210 struct CmdBlk *CmdBlkP;
>> 211
>> 212 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
>> 213 if (copy_from_user(&SpecialRupCmd, argp, sizeof(SpecialRupCmd))) {
>> 214 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
>> 215 p->RIOError.Error = COPYIN_FAILED;
>> 216 return -EFAULT;
>> 217 }
>> 218 CmdBlkP = RIOGetCmdBlk();
>> 219 if (!CmdBlkP) {
>> 220 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n");
>> 221 return -ENXIO;
>> 222 }
>> 223 CmdBlkP->Packet = SpecialRupCmd.Packet;
>> 224 if (SpecialRupCmd.Host >= p->RIONumHosts)
>> 225 SpecialRupCmd.Host = 0;
>> 226 rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum);
>> 227 if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
>> 228 printk(KERN_WARNING "rio: FAILED TO QUEUE SPECIAL RUP COMMAND\n");
260 } 229 }
261 return 0; 230 return 0;
262 ** !! 231 }
263 */ <<
264 <<
265 case RIO_FOAD_RTA: <<
266 rio_dprintk (RIO_DEBUG <<
267 return RIOCommandRta(p <<
268 <<
269 case RIO_ZOMBIE_RTA: <<
270 rio_dprintk (RIO_DEBUG <<
271 return RIOCommandRta(p <<
272 <<
273 case RIO_IDENTIFY_RTA: <<
274 rio_dprintk (RIO_DEBUG <<
275 return RIOIdentifyRta( <<
276 <<
277 case RIO_KILL_NEIGHBOUR: <<
278 rio_dprintk (RIO_DEBUG <<
279 return RIOKillNeighbou <<
280 <<
281 case SPECIAL_RUP_CMD: <<
282 { <<
283 struct CmdBlk <<
284 <<
285 rio_dprintk (R <<
286 if (copyin((in <<
287 <<
288 rio_dp <<
289 p->RIO <<
290 return <<
291 } <<
292 CmdBlkP = RIOG <<
293 if ( !CmdBlkP <<
294 rio_dp <<
295 return <<
296 } <<
297 CmdBlkP->Packe <<
298 if ( SpecialRu <<
299 Specia <<
300 rio_dp <<
301 <<
302 if (RI <<
303 <<
304 <<
305 } <<
306 return <<
307 } <<
308 <<
309 case RIO_DEBUG_MEM: <<
310 #ifdef DEBUG_MEM_SUPPORT <<
311 RIO_DEBUG_CTRL, <<
312 return <<
313 else <<
314 #endif <<
315 return <<
316 232
317 case RIO_ALL_MODEM: !! 233 case RIO_DEBUG_MEM:
318 rio_dprintk (R !! 234 return -EPERM;
319 p->RIOError.Er <<
320 return -EINVAL <<
321 235
322 case RIO_GET_TABLE: !! 236 case RIO_ALL_MODEM:
323 /* !! 237 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
324 ** Read the ro !! 238 p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
325 */ !! 239 return -EINVAL;
326 rio_dprintk (R <<
327 <<
328 if ((retval = <<
329 return <<
330 <<
331 if (copyout((c <<
332 <<
333 rio_dp <<
334 p->RIO <<
335 return <<
336 } <<
337 240
338 { !! 241 case RIO_GET_TABLE:
339 int en !! 242 /*
340 rio_dp !! 243 ** Read the routing table from the device driver to user space
341 for ( !! 244 */
342 { !! 245 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE\n");
343 if ( !! 246
344 !! 247 if ((retval = RIOApel(p)) != 0)
345 !! 248 return retval;
346 !! 249
347 !! 250 if (copy_to_user(argp, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
348 !! 251 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
349 !! 252 p->RIOError.Error = COPYOUT_FAILED;
350 !! 253 return -EFAULT;
351 !! 254 }
352 !! 255
353 !! 256 {
354 !! 257 int entry;
355 !! 258 rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n");
356 !! 259 for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
357 !! 260 if ((p->RIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0))
358 !! 261 continue;
359 !! 262
360 !! 263 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum);
361 !! 264 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum);
362 } !! 265 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID);
363 rio_dp !! 266 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2);
364 } !! 267 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int) p->RIOConnectTable[entry].Flags);
365 p->RIOQuickChe !! 268 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int) p->RIOConnectTable[entry].SysPort);
366 return 0; !! 269 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit);
>> 270 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link);
>> 271 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit);
>> 272 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link);
>> 273 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit);
>> 274 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link);
>> 275 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit);
>> 276 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link);
>> 277 rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name);
>> 278 }
>> 279 rio_dprintk(RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n");
>> 280 }
>> 281 p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */
>> 282 return 0;
367 283
368 case RIO_PUT_TABLE: !! 284 case RIO_PUT_TABLE:
369 /* !! 285 /*
370 ** Write the r !! 286 ** Write the routing table to the device driver from user space
371 */ !! 287 */
372 rio_dprintk (R !! 288 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n");
373 !! 289
374 if ( !su ) { !! 290 if (!su) {
375 rio_dp !! 291 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n");
376 p->RIO !! 292 p->RIOError.Error = NOT_SUPER_USER;
377 return !! 293 return -EPERM;
378 } !! 294 }
379 if ( copyin((i !! 295 if (copy_from_user(&p->RIOConnectTable[0], argp, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
380 TOTAL_ !! 296 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
381 rio_dp !! 297 p->RIOError.Error = COPYIN_FAILED;
382 p->RIO !! 298 return -EFAULT;
383 return !! 299 }
384 } <<
385 /* 300 /*
386 *********************************** 301 ***********************************
387 { 302 {
388 int en 303 int entry;
389 rio_dp 304 rio_dprint(RIO_DEBUG_CTRL, ("*****\nMAP ENTRIES\n") );
390 for ( 305 for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ )
391 { 306 {
392 307 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ) );
393 308 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ) );
394 309 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ) );
395 310 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ) );
396 311 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Flags = 0x%x\n", entry, p->RIOConnectTable[entry].Flags ) );
397 312 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.SysPort = 0x%x\n", entry, p->RIOConnectTable[entry].SysPort ) );
398 313 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[0].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ) );
399 314 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[0].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[0].Link ) );
400 315 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[1].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ) );
401 316 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[1].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[1].Link ) );
402 317 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[2].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ) );
403 318 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[2].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[2].Link ) );
404 319 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[3].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ) );
405 320 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[4].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[3].Link ) );
406 321 rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ) );
407 } 322 }
408 rio_dp 323 rio_dprint(RIO_DEBUG_CTRL, ("*****\nEND MAP ENTRIES\n") );
409 } 324 }
410 *********************************** 325 ***********************************
411 */ 326 */
412 return RIONewT !! 327 return RIONewTable(p);
413 328
414 case RIO_GET_BINDINGS !! 329 case RIO_GET_BINDINGS:
415 /* !! 330 /*
416 ** Send bindin !! 331 ** Send bindings table, containing unique numbers of RTAs owned
417 ** by this sys !! 332 ** by this system to user space
418 */ !! 333 */
419 rio_dprintk (R !! 334 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n");
420 !! 335
421 if ( !su ) !! 336 if (!su) {
422 { !! 337 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
423 rio_dp !! 338 p->RIOError.Error = NOT_SUPER_USER;
424 p->RIO !! 339 return -EPERM;
425 return !! 340 }
426 } !! 341 if (copy_to_user(argp, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
427 if (copyout((c !! 342 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
428 !! 343 p->RIOError.Error = COPYOUT_FAILED;
429 rio_dp !! 344 return -EFAULT;
430 p->RIO !! 345 }
431 return !! 346 return 0;
432 } <<
433 return 0; <<
434 347
435 case RIO_PUT_BINDINGS !! 348 case RIO_PUT_BINDINGS:
>> 349 /*
>> 350 ** Receive a bindings table, containing unique numbers of RTAs owned
>> 351 ** by this system
>> 352 */
>> 353 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n");
>> 354
>> 355 if (!su) {
>> 356 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
>> 357 p->RIOError.Error = NOT_SUPER_USER;
>> 358 return -EPERM;
>> 359 }
>> 360 if (copy_from_user(&p->RIOBindTab[0], argp, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
>> 361 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
>> 362 p->RIOError.Error = COPYIN_FAILED;
>> 363 return -EFAULT;
>> 364 }
>> 365 return 0;
>> 366
>> 367 case RIO_BIND_RTA:
>> 368 {
>> 369 int EmptySlot = -1;
436 /* 370 /*
437 ** Receive a bindings !! 371 ** Bind this RTA to host, so that it will be booted by
438 ** by this system !! 372 ** host in 'boot owned RTAs' mode.
439 */ !! 373 */
440 rio_dprintk (R !! 374 rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA\n");
441 !! 375
442 if ( !su ) !! 376 if (!su) {
443 { !! 377 rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n");
444 rio_dp !! 378 p->RIOError.Error = NOT_SUPER_USER;
445 p->RIO !! 379 return -EPERM;
446 return !! 380 }
447 } !! 381 for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) {
448 if (copyin((in !! 382 if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L))
449 !! 383 EmptySlot = Entry;
450 rio_dp !! 384 else if (p->RIOBindTab[Entry] == arg) {
451 p->RIO <<
452 return <<
453 } <<
454 return 0; <<
455 <<
456 case RIO_BIND_RTA : <<
457 { <<
458 int <<
459 /* <<
460 ** Bin <<
461 ** hos <<
462 */ <<
463 rio_dp <<
464 <<
465 if ( ! <<
466 <<
467 <<
468 <<
469 } <<
470 for (E <<
471 <<
472 <<
473 <<
474 <<
475 <<
476 <<
477 <<
478 <<
479 <<
480 <<
481 <<
482 } <<
483 /* 385 /*
484 ** Dos !! 386 ** Already exists - delete
485 */ !! 387 */
486 if (Em !! 388 p->RIOBindTab[Entry] = 0L;
487 !! 389 rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", arg);
488 <<
489 <<
490 } <<
491 else { <<
492 <<
493 <<
494 <<
495 } <<
496 return 390 return 0;
497 } 391 }
>> 392 }
>> 393 /*
>> 394 ** Dosen't exist - add
>> 395 */
>> 396 if (EmptySlot != -1) {
>> 397 p->RIOBindTab[EmptySlot] = arg;
>> 398 rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", arg);
>> 399 } else {
>> 400 rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", arg);
>> 401 return -ENOMEM;
>> 402 }
>> 403 return 0;
>> 404 }
498 405
499 case RIO_RESUME : !! 406 case RIO_RESUME:
500 rio_dprintk (R !! 407 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n");
501 port = (uint) !! 408 port = arg;
502 if ((port < 0) !! 409 if ((port < 0) || (port > 511)) {
503 rio_dp !! 410 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
504 p->RIO !! 411 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
505 return !! 412 return -EINVAL;
506 } !! 413 }
507 PortP = p->RIO !! 414 PortP = p->RIOPortp[port];
508 if (!PortP->Ma !! 415 if (!PortP->Mapped) {
509 rio_dp !! 416 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port);
510 p->RIO !! 417 p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
511 return !! 418 return -EINVAL;
512 } !! 419 }
513 if (!(PortP->S !! 420 if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
514 rio_dp !! 421 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port);
515 return !! 422 return -EINVAL;
516 } !! 423 }
517 !! 424
518 rio_spin_lock_ !! 425 rio_spin_lock_irqsave(&PortP->portSem, flags);
519 if (RIOPreempt !! 426 if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) {
520 !! 427 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
521 rio_dp !! 428 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
522 rio_sp !! 429 return -EBUSY;
523 return !! 430 } else {
524 } !! 431 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
525 else { !! 432 PortP->State |= RIO_BUSY;
526 rio_dp !! 433 }
527 PortP- !! 434 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
528 } !! 435 return retval;
529 rio_spin_unloc !! 436
530 return retval; !! 437 case RIO_ASSIGN_RTA:
531 !! 438 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n");
532 case RIO_ASSIGN_RTA: !! 439 if (!su) {
533 rio_dprintk (R !! 440 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n");
534 if ( !su ) { !! 441 p->RIOError.Error = NOT_SUPER_USER;
535 rio_dp !! 442 return -EPERM;
536 p->RIO !! 443 }
537 return !! 444 if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) {
538 } !! 445 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
539 if (copyin((in !! 446 p->RIOError.Error = COPYIN_FAILED;
540 !! 447 return -EFAULT;
541 rio_dp !! 448 }
542 p->RIO !! 449 return RIOAssignRta(p, &MapEnt);
543 return !! 450
544 } !! 451 case RIO_CHANGE_NAME:
545 return RIOAssi !! 452 rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n");
546 !! 453 if (!su) {
547 case RIO_CHANGE_NAME: !! 454 rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n");
548 rio_dprintk (R !! 455 p->RIOError.Error = NOT_SUPER_USER;
549 if ( !su ) { !! 456 return -EPERM;
550 rio_dp !! 457 }
>> 458 if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) {
>> 459 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
>> 460 p->RIOError.Error = COPYIN_FAILED;
>> 461 return -EFAULT;
>> 462 }
>> 463 return RIOChangeName(p, &MapEnt);
>> 464
>> 465 case RIO_DELETE_RTA:
>> 466 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n");
>> 467 if (!su) {
>> 468 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n");
>> 469 p->RIOError.Error = NOT_SUPER_USER;
>> 470 return -EPERM;
>> 471 }
>> 472 if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) {
>> 473 rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n");
>> 474 p->RIOError.Error = COPYIN_FAILED;
>> 475 return -EFAULT;
>> 476 }
>> 477 return RIODeleteRta(p, &MapEnt);
>> 478
>> 479 case RIO_QUICK_CHECK:
>> 480 if (copy_to_user(argp, &p->RIORtaDisCons, sizeof(unsigned int))) {
>> 481 p->RIOError.Error = COPYOUT_FAILED;
>> 482 return -EFAULT;
>> 483 }
>> 484 return 0;
>> 485
>> 486 case RIO_LAST_ERROR:
>> 487 if (copy_to_user(argp, &p->RIOError, sizeof(struct Error)))
>> 488 return -EFAULT;
>> 489 return 0;
>> 490
>> 491 case RIO_GET_LOG:
>> 492 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n");
>> 493 return -EINVAL;
>> 494
>> 495 case RIO_GET_MODTYPE:
>> 496 if (copy_from_user(&port, argp, sizeof(unsigned int))) {
>> 497 p->RIOError.Error = COPYIN_FAILED;
>> 498 return -EFAULT;
>> 499 }
>> 500 rio_dprintk(RIO_DEBUG_CTRL, "Get module type for port %d\n", port);
>> 501 if (port < 0 || port > 511) {
>> 502 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port);
>> 503 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 504 return -EINVAL;
>> 505 }
>> 506 PortP = (p->RIOPortp[port]);
>> 507 if (!PortP->Mapped) {
>> 508 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
>> 509 p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
>> 510 return -EINVAL;
>> 511 }
>> 512 /*
>> 513 ** Return module type of port
>> 514 */
>> 515 port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
>> 516 if (copy_to_user(argp, &port, sizeof(unsigned int))) {
>> 517 p->RIOError.Error = COPYOUT_FAILED;
>> 518 return -EFAULT;
>> 519 }
>> 520 return (0);
>> 521 case RIO_BLOCK_OPENS:
>> 522 rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n");
>> 523 for (Entry = 0; Entry < RIO_PORTS; Entry++) {
>> 524 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 525 p->RIOPortp[Entry]->WaitUntilBooted = 1;
>> 526 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 527 }
>> 528 return 0;
>> 529
>> 530 case RIO_SETUP_PORTS:
>> 531 rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n");
>> 532 if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) {
>> 533 p->RIOError.Error = COPYIN_FAILED;
>> 534 rio_dprintk(RIO_DEBUG_CTRL, "EFAULT");
>> 535 return -EFAULT;
>> 536 }
>> 537 if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) {
>> 538 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 539 rio_dprintk(RIO_DEBUG_CTRL, "ENXIO");
>> 540 return -ENXIO;
>> 541 }
>> 542 if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) {
>> 543 p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE;
>> 544 rio_dprintk(RIO_DEBUG_CTRL, "EINVAL");
>> 545 return -EINVAL;
>> 546 }
>> 547 if (!p->RIOPortp) {
>> 548 printk(KERN_ERR "rio: No p->RIOPortp array!\n");
>> 549 rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
>> 550 return -EIO;
>> 551 }
>> 552 rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
>> 553 for (loop = PortSetup.From; loop <= PortSetup.To; loop++) {
>> 554 rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop);
>> 555 }
>> 556 rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop);
>> 557 rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval);
>> 558 return retval;
>> 559
>> 560 case RIO_GET_PORT_SETUP:
>> 561 rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n");
>> 562 if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) {
>> 563 p->RIOError.Error = COPYIN_FAILED;
>> 564 return -EFAULT;
>> 565 }
>> 566 if (PortSetup.From >= RIO_PORTS) {
>> 567 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 568 return -ENXIO;
>> 569 }
>> 570
>> 571 port = PortSetup.To = PortSetup.From;
>> 572 PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0;
>> 573 PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0;
>> 574 PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0;
>> 575 PortSetup.Store = p->RIOPortp[port]->Store;
>> 576 PortSetup.Lock = p->RIOPortp[port]->Lock;
>> 577 PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps;
>> 578 memcpy(PortSetup.XpOn, p->RIOPortp[port]->Xprint.XpOn, MAX_XP_CTRL_LEN);
>> 579 memcpy(PortSetup.XpOff, p->RIOPortp[port]->Xprint.XpOff, MAX_XP_CTRL_LEN);
>> 580 PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
>> 581 PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
>> 582
>> 583 if (copy_to_user(argp, &PortSetup, sizeof(PortSetup))) {
>> 584 p->RIOError.Error = COPYOUT_FAILED;
>> 585 return -EFAULT;
>> 586 }
>> 587 return retval;
>> 588
>> 589 case RIO_GET_PORT_PARAMS:
>> 590 rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n");
>> 591 if (copy_from_user(&PortParams, argp, sizeof(struct PortParams))) {
>> 592 p->RIOError.Error = COPYIN_FAILED;
>> 593 return -EFAULT;
>> 594 }
>> 595 if (PortParams.Port >= RIO_PORTS) {
>> 596 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 597 return -ENXIO;
>> 598 }
>> 599 PortP = (p->RIOPortp[PortParams.Port]);
>> 600 PortParams.Config = PortP->Config;
>> 601 PortParams.State = PortP->State;
>> 602 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);
>> 603
>> 604 if (copy_to_user(argp, &PortParams, sizeof(struct PortParams))) {
>> 605 p->RIOError.Error = COPYOUT_FAILED;
>> 606 return -EFAULT;
>> 607 }
>> 608 return retval;
>> 609
>> 610 case RIO_GET_PORT_TTY:
>> 611 rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n");
>> 612 if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) {
>> 613 p->RIOError.Error = COPYIN_FAILED;
>> 614 return -EFAULT;
>> 615 }
>> 616 if (PortTty.port >= RIO_PORTS) {
>> 617 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 618 return -ENXIO;
>> 619 }
>> 620
>> 621 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
>> 622 PortP = (p->RIOPortp[PortTty.port]);
>> 623 if (copy_to_user(argp, &PortTty, sizeof(struct PortTty))) {
>> 624 p->RIOError.Error = COPYOUT_FAILED;
>> 625 return -EFAULT;
>> 626 }
>> 627 return retval;
>> 628
>> 629 case RIO_SET_PORT_TTY:
>> 630 if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) {
>> 631 p->RIOError.Error = COPYIN_FAILED;
>> 632 return -EFAULT;
>> 633 }
>> 634 rio_dprintk(RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port);
>> 635 if (PortTty.port >= (ushort) RIO_PORTS) {
>> 636 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 637 return -ENXIO;
>> 638 }
>> 639 PortP = (p->RIOPortp[PortTty.port]);
>> 640 RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP);
>> 641 return retval;
>> 642
>> 643 case RIO_SET_PORT_PARAMS:
>> 644 rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n");
>> 645 if (copy_from_user(&PortParams, argp, sizeof(PortParams))) {
>> 646 p->RIOError.Error = COPYIN_FAILED;
>> 647 return -EFAULT;
>> 648 }
>> 649 if (PortParams.Port >= (ushort) RIO_PORTS) {
>> 650 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 651 return -ENXIO;
>> 652 }
>> 653 PortP = (p->RIOPortp[PortParams.Port]);
>> 654 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 655 PortP->Config = PortParams.Config;
>> 656 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 657 return retval;
>> 658
>> 659 case RIO_GET_PORT_STATS:
>> 660 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
>> 661 if (copy_from_user(&portStats, argp, sizeof(struct portStats))) {
>> 662 p->RIOError.Error = COPYIN_FAILED;
>> 663 return -EFAULT;
>> 664 }
>> 665 if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
>> 666 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 667 return -ENXIO;
>> 668 }
>> 669 PortP = (p->RIOPortp[portStats.port]);
>> 670 portStats.gather = PortP->statsGather;
>> 671 portStats.txchars = PortP->txchars;
>> 672 portStats.rxchars = PortP->rxchars;
>> 673 portStats.opens = PortP->opens;
>> 674 portStats.closes = PortP->closes;
>> 675 portStats.ioctls = PortP->ioctls;
>> 676 if (copy_to_user(argp, &portStats, sizeof(struct portStats))) {
>> 677 p->RIOError.Error = COPYOUT_FAILED;
>> 678 return -EFAULT;
>> 679 }
>> 680 return retval;
>> 681
>> 682 case RIO_RESET_PORT_STATS:
>> 683 port = arg;
>> 684 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
>> 685 if (port >= RIO_PORTS) {
>> 686 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 687 return -ENXIO;
>> 688 }
>> 689 PortP = (p->RIOPortp[port]);
>> 690 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 691 PortP->txchars = 0;
>> 692 PortP->rxchars = 0;
>> 693 PortP->opens = 0;
>> 694 PortP->closes = 0;
>> 695 PortP->ioctls = 0;
>> 696 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 697 return retval;
>> 698
>> 699 case RIO_GATHER_PORT_STATS:
>> 700 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
>> 701 if (copy_from_user(&portStats, argp, sizeof(struct portStats))) {
>> 702 p->RIOError.Error = COPYIN_FAILED;
>> 703 return -EFAULT;
>> 704 }
>> 705 if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
>> 706 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 707 return -ENXIO;
>> 708 }
>> 709 PortP = (p->RIOPortp[portStats.port]);
>> 710 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 711 PortP->statsGather = portStats.gather;
>> 712 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 713 return retval;
>> 714
>> 715 case RIO_READ_CONFIG:
>> 716 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
>> 717 if (copy_to_user(argp, &p->RIOConf, sizeof(struct Conf))) {
>> 718 p->RIOError.Error = COPYOUT_FAILED;
>> 719 return -EFAULT;
>> 720 }
>> 721 return retval;
>> 722
>> 723 case RIO_SET_CONFIG:
>> 724 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n");
>> 725 if (!su) {
>> 726 p->RIOError.Error = NOT_SUPER_USER;
>> 727 return -EPERM;
>> 728 }
>> 729 if (copy_from_user(&p->RIOConf, argp, sizeof(struct Conf))) {
>> 730 p->RIOError.Error = COPYIN_FAILED;
>> 731 return -EFAULT;
>> 732 }
>> 733 /*
>> 734 ** move a few value around
>> 735 */
>> 736 for (Host = 0; Host < p->RIONumHosts; Host++)
>> 737 if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING)
>> 738 writew(p->RIOConf.Timer, &p->RIOHosts[Host].ParmMapP->timer);
>> 739 return retval;
>> 740
>> 741 case RIO_START_POLLER:
>> 742 rio_dprintk(RIO_DEBUG_CTRL, "RIO_START_POLLER\n");
>> 743 return -EINVAL;
>> 744
>> 745 case RIO_STOP_POLLER:
>> 746 rio_dprintk(RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n");
>> 747 if (!su) {
>> 748 p->RIOError.Error = NOT_SUPER_USER;
>> 749 return -EPERM;
>> 750 }
>> 751 p->RIOPolling = NOT_POLLING;
>> 752 return retval;
>> 753
>> 754 case RIO_SETDEBUG:
>> 755 case RIO_GETDEBUG:
>> 756 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n");
>> 757 if (copy_from_user(&DebugCtrl, argp, sizeof(DebugCtrl))) {
>> 758 p->RIOError.Error = COPYIN_FAILED;
>> 759 return -EFAULT;
>> 760 }
>> 761 if (DebugCtrl.SysPort == NO_PORT) {
>> 762 if (cmd == RIO_SETDEBUG) {
>> 763 if (!su) {
551 p->RIO 764 p->RIOError.Error = NOT_SUPER_USER;
552 return 765 return -EPERM;
553 } 766 }
554 if (copyin((in !! 767 p->rio_debug = DebugCtrl.Debug;
555 !! 768 p->RIODebugWait = DebugCtrl.Wait;
556 rio_dp !! 769 rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", p->rio_debug, p->RIODebugWait);
557 p->RIO !! 770 } else {
558 return !! 771 rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait);
559 } !! 772 DebugCtrl.Debug = p->rio_debug;
560 return RIOChan !! 773 DebugCtrl.Wait = p->RIODebugWait;
561 !! 774 if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) {
562 case RIO_DELETE_RTA: !! 775 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
563 rio_dprintk (R <<
564 if ( !su ) { <<
565 rio_dp <<
566 p->RIO <<
567 return <<
568 } <<
569 if (copyin((in <<
570 <<
571 rio_dp <<
572 p->RIO <<
573 return <<
574 } <<
575 return RIODele <<
576 <<
577 case RIO_QUICK_CHECK: <<
578 /* <<
579 ** 09.12.1998 <<
580 ** A customer <<
581 ** connect/dis <<
582 ** RIOConCon() <<
583 ** to keep tra <<
584 ** disconnecti <<
585 ** RIORtaDisCo <<
586 ** does the jo <<
587 ** of RIORtaCo <<
588 ** <<
589 if (copyout((c <<
590 <<
591 ** <<
592 */ <<
593 <<
594 if (copyout((c <<
595 <<
596 p->RIO <<
597 return <<
598 } <<
599 return 0; <<
600 <<
601 case RIO_LAST_ERROR: <<
602 if (copyout((c <<
603 <<
604 return <<
605 return 0; <<
606 <<
607 case RIO_GET_LOG: <<
608 rio_dprintk (R <<
609 #ifdef LOGGING <<
610 RIOGetLog(arg) <<
611 return 0; <<
612 #else <<
613 return -EINVAL <<
614 #endif <<
615 <<
616 case RIO_GET_MODTYPE: <<
617 if ( copyin( ( <<
618 <<
619 { <<
620 p->RIO <<
621 return <<
622 } <<
623 rio_dprintk (R <<
624 if ( port < 0 <<
625 { <<
626 rio_dp <<
627 p->RIO <<
628 return <<
629 } <<
630 PortP = (p->RI <<
631 if (!PortP->Ma <<
632 { <<
633 rio_dp <<
634 p->RIO <<
635 return <<
636 } <<
637 /* <<
638 ** Return modu <<
639 */ <<
640 port = PortP-> <<
641 if (copyout((c <<
642 <<
643 p->RIO <<
644 return <<
645 } <<
646 return(0); <<
647 /* <<
648 ** 02.03.1999 ARG - ES <<
649 ** We are no longer us <<
650 ** are not required : <<
651 ** <<
652 case RIO_GET_BOOT_MODE <<
653 rio_dprint(RIO <<
654 ** <<
655 ** Return boot <<
656 ** <<
657 if (copyout((c <<
658 <<
659 p->RIO <<
660 return <<
661 } <<
662 return(0); <<
663 <<
664 case RIO_SET_BOOT_MODE <<
665 p->RIOBootMode <<
666 rio_dprint(RIO <<
667 return(0); <<
668 ** <<
669 ** End ESIL 0820 fix <<
670 */ <<
671 <<
672 case RIO_BLOCK_OPENS: <<
673 rio_dprintk (R <<
674 for ( Entry=0; <<
675 rio_sp <<
676 p->RIO <<
677 rio_sp <<
678 } <<
679 return 0; <<
680 <<
681 case RIO_SETUP_PORTS: <<
682 rio_dprintk (R <<
683 if (copyin((in <<
684 <<
685 p->RI <<
686 rio_d <<
687 retur <<
688 } <<
689 if ( PortSetup <<
690 <<
691 p->RI <<
692 rio_d <<
693 retur <<
694 } <<
695 if ( PortSetup <<
696 PortS <<
697 p->RI <<
698 rio_d <<
699 retur <<
700 } <<
701 if ( !p->RIOPo <<
702 cprin <<
703 rio_d <<
704 retur <<
705 } <<
706 rio_dprintk (R <<
707 for (loop=Port <<
708 rio_dprintk (R <<
709 #if 0 <<
710 PortP <<
711 if ( ! <<
712 <<
713 <<
714 <<
715 <<
716 <<
717 <<
718 <<
719 <<
720 <<
721 <<
722 <<
723 <<
724 /* <<
725 ** If <<
726 ** to <<
727 */ <<
728 <<
729 <<
730 <<
731 <<
732 <<
733 /* <<
734 ** St <<
735 ** po <<
736 */ <<
737 if (P <<
738 <<
739 <<
740 <<
741 <<
742 <<
743 <<
744 <<
745 <<
746 <<
747 <<
748 } <<
749 PortP <<
750 PortP <<
751 PortP <<
752 bcopy <<
753 bcopy <<
754 PortP <<
755 PortP <<
756 PortP <<
757 <<
758 rio_s <<
759 #endif <<
760 } <<
761 rio_dprintk (R <<
762 rio_dprintk (R <<
763 return retval; <<
764 <<
765 case RIO_GET_PORT_SETU <<
766 rio_dprintk (R <<
767 if (copyin((in <<
768 <<
769 p->RI <<
770 retur <<
771 } <<
772 if ( PortSetup <<
773 p->RI <<
774 retur <<
775 } <<
776 <<
777 port = PortSet <<
778 PortSetup.IxAn <<
779 <<
780 PortSetup.IxOn <<
781 <<
782 PortSetup.Drai <<
783 <<
784 PortSetup.Stor <<
785 PortSetup.Lock <<
786 PortSetup.XpCp <<
787 bcopy(p->RIOPo <<
788 <<
789 bcopy(p->RIOPo <<
790 <<
791 PortSetup.XpOn <<
792 PortSetup.XpOf <<
793 <<
794 if ( copyout(( <<
795 <<
796 p->RI <<
797 retur <<
798 } <<
799 return retval; <<
800 <<
801 case RIO_GET_PORT_PARA <<
802 rio_dprintk (R <<
803 if (copyin( (i <<
804 sizeof <<
805 p->RIO <<
806 return <<
807 } <<
808 if (PortParams <<
809 p->RIO <<
810 return <<
811 } <<
812 PortP = (p->RI <<
813 PortParams.Con <<
814 PortParams.Sta <<
815 rio_dprintk (R <<
816 <<
817 if (copyout((c <<
818 <<
819 p->RI <<
820 retur <<
821 } <<
822 return retval; <<
823 <<
824 case RIO_GET_PORT_TTY <<
825 rio_dprintk (R <<
826 if (copyin((in <<
827 <<
828 p->RI <<
829 retur <<
830 } <<
831 if ( PortTty.p <<
832 p->RI <<
833 retur <<
834 } <<
835 <<
836 rio_dprintk (R <<
837 PortP = (p->RI <<
838 #if 0 <<
839 PortTty.Tty.tm <<
840 PortTty.Tty.tm <<
841 PortTty.Tty.tm <<
842 PortTty.Tty.tm <<
843 #endif <<
844 if (copyout((c <<
845 <<
846 p->RIO 776 p->RIOError.Error = COPYOUT_FAILED;
847 return 777 return -EFAULT;
848 } 778 }
849 return retval; !! 779 }
850 !! 780 } else if (DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT) {
851 case RIO_SET_PORT_TTY !! 781 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
852 if (copyin((in !! 782 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
853 !! 783 return -ENXIO;
854 p->RI !! 784 } else if (cmd == RIO_SETDEBUG) {
855 retur !! 785 if (!su) {
856 } !! 786 p->RIOError.Error = NOT_SUPER_USER;
857 rio_dprintk (R !! 787 return -EPERM;
858 if (PortTty.po !! 788 }
859 p->RI !! 789 rio_spin_lock_irqsave(&PortP->portSem, flags);
860 retur !! 790 p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug;
861 } !! 791 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
862 PortP = (p->RI !! 792 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
863 #if 0 !! 793 } else {
864 rio_spin_lock_ !! 794 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
865 PortP->TtyP->t !! 795 DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug;
866 PortP->TtyP->t !! 796 if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) {
867 PortP->TtyP->t !! 797 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
868 PortP->TtyP->t !! 798 p->RIOError.Error = COPYOUT_FAILED;
869 rio_spin_unloc !! 799 return -EFAULT;
870 #endif !! 800 }
871 !! 801 }
872 RIOParam(PortP !! 802 return retval;
873 return retval; <<
874 <<
875 case RIO_SET_PORT_PARA <<
876 rio_dprintk (R <<
877 if ( copyin((i <<
878 == COP <<
879 p->RI <<
880 retur <<
881 } <<
882 if (PortParams <<
883 p->RI <<
884 retur <<
885 } <<
886 PortP = (p->RI <<
887 rio_spin_lock_ <<
888 PortP->Config <<
889 rio_spin_unloc <<
890 return retval; <<
891 <<
892 case RIO_GET_PORT_STAT <<
893 rio_dprintk (R <<
894 if ( copyin((i <<
895 <<
896 p->RI <<
897 retur <<
898 } <<
899 if ( portStats <<
900 p->RI <<
901 retur <<
902 } <<
903 PortP = (p->RI <<
904 portStats.gath <<
905 portStats.txch <<
906 portStats.rxch <<
907 portStats.open <<
908 portStats.clos <<
909 portStats.ioct <<
910 if ( copyout(( <<
911 <<
912 p->RI <<
913 retur <<
914 } <<
915 return retval; <<
916 <<
917 case RIO_RESET_PORT_ST <<
918 port = (uint) <<
919 rio_dprintk (R <<
920 if ( port >= R <<
921 p->RI <<
922 retur <<
923 } <<
924 PortP = (p->RI <<
925 rio_spin_lock_ <<
926 PortP->txchars <<
927 PortP->rxchars <<
928 PortP->opens <<
929 PortP->closes <<
930 PortP->ioctls <<
931 rio_spin_unloc <<
932 return retval; <<
933 <<
934 case RIO_GATHER_PORT_S <<
935 rio_dprintk (R <<
936 if ( copyin( ( <<
937 <<
938 p->RI <<
939 retur <<
940 } <<
941 if ( portStats <<
942 p->RI <<
943 retur <<
944 } <<
945 PortP = (p->RI <<
946 rio_spin_lock_ <<
947 PortP->statsGa <<
948 rio_spin_unloc <<
949 return retval; <<
950 <<
951 #ifdef DEBUG_SUPPORTED <<
952 case RIO_READ_LEVELS: <<
953 { <<
954 int n <<
955 rio_d <<
956 for ( <<
957 rio_d <<
958 if (c <<
959 <<
960 <<
961 <<
962 <<
963 } <<
964 rio_d <<
965 retur <<
966 } <<
967 #endif <<
968 <<
969 case RIO_READ_CONFIG: <<
970 rio_dprintk (R <<
971 if (copyout((c <<
972 <<
973 p->RI <<
974 retur <<
975 } <<
976 return retval; <<
977 <<
978 case RIO_SET_CONFIG: <<
979 rio_dprintk (R <<
980 if ( !su ) { <<
981 p->RI <<
982 retur <<
983 } <<
984 if ( copyin((i <<
985 <<
986 p->RI <<
987 retur <<
988 } <<
989 /* <<
990 ** move a few <<
991 */ <<
992 for (Host=0; H <<
993 if ( <<
994 <<
995 <<
996 return retval; <<
997 <<
998 case RIO_START_POLLER: <<
999 rio_dprintk (R <<
1000 return -EINVA <<
1001 803
1002 case RIO_STOP_POLLER: !! 804 case RIO_VERSID:
1003 rio_dprintk ( !! 805 /*
1004 if ( !su ) { !! 806 ** Enquire about the release and version.
1005 p->R !! 807 ** We return MAX_VERSION_LEN bytes, being a
1006 retu !! 808 ** textual null terminated string.
1007 } !! 809 */
1008 p->RIOPolling !! 810 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n");
1009 return retval !! 811 if (copy_to_user(argp, RIOVersid(), sizeof(struct rioVersion))) {
>> 812 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
>> 813 p->RIOError.Error = COPYOUT_FAILED;
>> 814 return -EFAULT;
>> 815 }
>> 816 return retval;
1010 817
1011 case RIO_SETDEBUG: !! 818 case RIO_NUM_HOSTS:
1012 case RIO_GETDEBUG: !! 819 /*
1013 rio_dprintk ( !! 820 ** Enquire as to the number of hosts located
1014 if ( copyin( !! 821 ** at init time.
1015 !! 822 */
1016 p->R !! 823 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
1017 retu !! 824 if (copy_to_user(argp, &p->RIONumHosts, sizeof(p->RIONumHosts))) {
1018 } !! 825 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
1019 if ( DebugCtr !! 826 p->RIOError.Error = COPYOUT_FAILED;
1020 if ( !! 827 return -EFAULT;
1021 !! 828 }
1022 !! 829 return retval;
1023 <<
1024 <<
1025 <<
1026 <<
1027 <<
1028 <<
1029 } <<
1030 else <<
1031 <<
1032 <<
1033 <<
1034 <<
1035 <<
1036 <<
1037 <<
1038 <<
1039 <<
1040 <<
1041 <<
1042 } <<
1043 } <<
1044 else if ( Deb <<
1045 <<
1046 rio_ <<
1047 <<
1048 p->R <<
1049 retu <<
1050 } <<
1051 else if ( cmd <<
1052 if ( <<
1053 <<
1054 <<
1055 } <<
1056 rio_s <<
1057 p->RI <<
1058 rio_s <<
1059 rio_d <<
1060 <<
1061 } <<
1062 else { <<
1063 rio_d <<
1064 <<
1065 Debug <<
1066 if ( <<
1067 <<
1068 <<
1069 <<
1070 <<
1071 } <<
1072 } <<
1073 return retval <<
1074 830
1075 case RIO_VERSID: !! 831 case RIO_HOST_FOAD:
1076 /* !! 832 /*
1077 ** Enquire ab !! 833 ** Kill host. This may not be in the final version...
1078 ** We return !! 834 */
1079 ** textual nu !! 835 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", arg);
1080 */ !! 836 if (!su) {
1081 rio_dprintk ( !! 837 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
1082 if ( copyout( !! 838 p->RIOError.Error = NOT_SUPER_USER;
1083 !! 839 return -EPERM;
1084 !! 840 }
1085 { !! 841 p->RIOHalted = 1;
1086 rio_ !! 842 p->RIOSystemUp = 0;
1087 p->R !! 843
1088 retu !! 844 for (Host = 0; Host < p->RIONumHosts; Host++) {
1089 } !! 845 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
1090 return retval !! 846 memset(&p->RIOHosts[Host].Flags, 0, ((char *) &p->RIOHosts[Host].____end_marker____) - ((char *) &p->RIOHosts[Host].Flags));
>> 847 p->RIOHosts[Host].Flags = RC_WAITING;
>> 848 }
>> 849 RIOFoadWakeup(p);
>> 850 p->RIONumBootPkts = 0;
>> 851 p->RIOBooting = 0;
>> 852 printk("HEEEEELP!\n");
>> 853
>> 854 for (loop = 0; loop < RIO_PORTS; loop++) {
>> 855 spin_lock_init(&p->RIOPortp[loop]->portSem);
>> 856 p->RIOPortp[loop]->InUse = NOT_INUSE;
>> 857 }
>> 858
>> 859 p->RIOSystemUp = 0;
>> 860 return retval;
>> 861
>> 862 case RIO_DOWNLOAD:
>> 863 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n");
>> 864 if (!su) {
>> 865 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n");
>> 866 p->RIOError.Error = NOT_SUPER_USER;
>> 867 return -EPERM;
>> 868 }
>> 869 if (copy_from_user(&DownLoad, argp, sizeof(DownLoad))) {
>> 870 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
>> 871 p->RIOError.Error = COPYIN_FAILED;
>> 872 return -EFAULT;
>> 873 }
>> 874 rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode);
1091 875
>> 876 /*
>> 877 ** It is important that the product code is an unsigned object!
>> 878 */
>> 879 if (DownLoad.ProductCode > MAX_PRODUCT) {
>> 880 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode);
>> 881 p->RIOError.Error = NO_SUCH_PRODUCT;
>> 882 return -ENXIO;
>> 883 }
>> 884 /*
>> 885 ** do something!
>> 886 */
>> 887 retval = (*(RIOBootTable[DownLoad.ProductCode])) (p, &DownLoad);
>> 888 /* <-- Panic */
>> 889 p->RIOHalted = 0;
>> 890 /*
>> 891 ** and go back, content with a job well completed.
>> 892 */
>> 893 return retval;
>> 894
>> 895 case RIO_PARMS:
>> 896 {
>> 897 unsigned int host;
>> 898
>> 899 if (copy_from_user(&host, argp, sizeof(host))) {
>> 900 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
>> 901 p->RIOError.Error = COPYIN_FAILED;
>> 902 return -EFAULT;
>> 903 }
1092 /* 904 /*
1093 ** !!!!!!!!!!!!!!!!!! !! 905 ** Fetch the parmmap
1094 ** !! commented out p !! 906 */
1095 ** !!!!!!!!!!!!!!!!!! !! 907 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n");
1096 ** !! 908 if (copy_from_io(argp, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) {
1097 case RIO_VERSID: !! 909 p->RIOError.Error = COPYOUT_FAILED;
1098 ** !! 910 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
1099 ** Enquire ab !! 911 return -EFAULT;
1100 ** We return !! 912 }
1101 ** terminated !! 913 }
1102 ** !! 914 return retval;
1103 rio_dprint(RI <<
1104 if (copyout(( <<
1105 <<
1106 rio_ <<
1107 p->R <<
1108 retu <<
1109 } <<
1110 return retval <<
1111 ** <<
1112 ** !!!!!!!!!!!!!!!!!! <<
1113 */ <<
1114 <<
1115 case RIO_NUM_HOSTS: <<
1116 /* <<
1117 ** Enquire as <<
1118 ** at init ti <<
1119 */ <<
1120 rio_dprintk ( <<
1121 if (copyout(( <<
1122 <<
1123 rio_ <<
1124 p->R <<
1125 retu <<
1126 } <<
1127 return retval <<
1128 <<
1129 case RIO_HOST_FOAD: <<
1130 /* <<
1131 ** Kill host. <<
1132 */ <<
1133 rio_dprintk ( <<
1134 if ( !su ) { <<
1135 rio_ <<
1136 p->R <<
1137 retu <<
1138 } <<
1139 p->RIOHalted <<
1140 p->RIOSystemU <<
1141 <<
1142 for ( Host=0; <<
1143 (voi <<
1144 <<
1145 <<
1146 bzer <<
1147 <<
1148 <<
1149 p->R <<
1150 #if 0 <<
1151 RIOS <<
1152 #endif <<
1153 } <<
1154 RIOFoadWakeup <<
1155 p->RIONumBoot <<
1156 p->RIOBooting <<
1157 <<
1158 #ifdef RINGBUFFER_SUPPORT <<
1159 for( loop=0; <<
1160 if ( <<
1161 <<
1162 <<
1163 #endif <<
1164 #if 0 <<
1165 bzero((caddr_ <<
1166 #else <<
1167 printk ("HEEE <<
1168 #endif <<
1169 <<
1170 for( loop=0; <<
1171 #if 0 <<
1172 p->RI <<
1173 #endif <<
1174 <<
1175 spin_ <<
1176 p->RI <<
1177 } <<
1178 <<
1179 p->RIOSystemU <<
1180 return retval <<
1181 <<
1182 case RIO_DOWNLOAD: <<
1183 rio_dprintk ( <<
1184 if ( !su ) { <<
1185 rio_ <<
1186 p->R <<
1187 retu <<
1188 } <<
1189 if ( copyin(( <<
1190 <<
1191 rio_ <<
1192 p->R <<
1193 retu <<
1194 } <<
1195 rio_dprintk ( <<
1196 DownLoad. <<
1197 <<
1198 /* <<
1199 ** It is impo <<
1200 */ <<
1201 if ( DownLoad <<
1202 rio_ <<
1203 <<
1204 p->R <<
1205 retu <<
1206 } <<
1207 /* <<
1208 ** do somethi <<
1209 */ <<
1210 retval = (*(R <<
1211 <<
1212 p->RIOHalted <<
1213 /* <<
1214 ** and go bac <<
1215 */ <<
1216 return retval <<
1217 <<
1218 case RIO_PARMS: <<
1219 { <<
1220 uint <<
1221 <<
1222 if (c <<
1223 <<
1224 <<
1225 <<
1226 <<
1227 <<
1228 } <<
1229 /* <<
1230 ** Fe <<
1231 */ <<
1232 rio_d <<
1233 if ( <<
1234 <<
1235 <<
1236 <<
1237 <<
1238 } <<
1239 } <<
1240 return retval <<
1241 <<
1242 case RIO_HOST_REQ: <<
1243 rio_dprintk ( <<
1244 if (copyin((i <<
1245 <<
1246 rio_ <<
1247 p->R <<
1248 retu <<
1249 } <<
1250 if ( HostReq. <<
1251 p->R <<
1252 rio_ <<
1253 <<
1254 retu <<
1255 } <<
1256 rio_dprintk ( <<
1257 <<
1258 if (copyout(( <<
1259 (int) <<
1260 p->RI <<
1261 rio_d <<
1262 retur <<
1263 } <<
1264 return retval <<
1265 <<
1266 case RIO_HOST_DPRAM: <<
1267 rio_dprintk ( <<
1268 if ( copyin( <<
1269 <<
1270 rio_d <<
1271 p->RI <<
1272 retur <<
1273 } <<
1274 if ( HostDpRa <<
1275 p->RI <<
1276 rio_d <<
1277 <<
1278 retur <<
1279 } <<
1280 rio_dprintk ( <<
1281 <<
1282 if (p->RIOHos <<
1283 int <<
1284 /* I <<
1285 stat <<
1286 for ( <<
1287 <<
1288 if ( <<
1289 <<
1290 <<
1291 <<
1292 <<
1293 } <<
1294 } <<
1295 else if (copy <<
1296 (int) <<
1297 <<
1298 p->R <<
1299 rio_ <<
1300 retu <<
1301 } <<
1302 return retval <<
1303 <<
1304 case RIO_SET_BUSY: <<
1305 rio_dprintk ( <<
1306 if ( (int)arg <<
1307 rio_ <<
1308 p->R <<
1309 retu <<
1310 } <<
1311 rio_spin_lock <<
1312 p->RIOPortp[( <<
1313 rio_spin_unlo <<
1314 return retval <<
1315 <<
1316 case RIO_HOST_PORT: <<
1317 /* <<
1318 ** The daemon <<
1319 ** (probably <<
1320 */ <<
1321 rio_dprintk ( <<
1322 if ( copyin(( <<
1323 sizeo <<
1324 rio_d <<
1325 p->RI <<
1326 retur <<
1327 } <<
1328 <<
1329 if (PortReq.S <<
1330 rio_ <<
1331 <<
1332 p->R <<
1333 retu <<
1334 } <<
1335 rio_dprintk ( <<
1336 if (copyout(( <<
1337 <<
1338 <<
1339 p->R <<
1340 rio_ <<
1341 retu <<
1342 } <<
1343 return retval <<
1344 <<
1345 case RIO_HOST_RUP: <<
1346 /* <<
1347 ** The daemon <<
1348 ** (probably <<
1349 */ <<
1350 rio_dprintk ( <<
1351 if (copyin((i <<
1352 <<
1353 rio_ <<
1354 p->R <<
1355 retu <<
1356 } <<
1357 if (RupReq.Ho <<
1358 rio_ <<
1359 <<
1360 p->R <<
1361 retu <<
1362 } <<
1363 if ( RupReq.R <<
1364 rio_ <<
1365 <<
1366 p->R <<
1367 retu <<
1368 } <<
1369 HostP = &p->R <<
1370 <<
1371 if ((HostP->F <<
1372 rio_ <<
1373 <<
1374 p->R <<
1375 retu <<
1376 } <<
1377 rio_dprintk ( <<
1378 <<
1379 <<
1380 if (copyout(( <<
1381 (int) <<
1382 p->RI <<
1383 rio_d <<
1384 retur <<
1385 } <<
1386 return retval <<
1387 <<
1388 case RIO_HOST_LPB: <<
1389 /* <<
1390 ** The daemon <<
1391 ** (probably <<
1392 */ <<
1393 rio_dprintk ( <<
1394 if (copyin((i <<
1395 sizeo <<
1396 rio_ <<
1397 p->R <<
1398 retu <<
1399 } <<
1400 if (LpbReq.Ho <<
1401 rio_d <<
1402 <<
1403 p->RI <<
1404 retur <<
1405 } <<
1406 if ( LpbReq.L <<
1407 rio_ <<
1408 <<
1409 p->R <<
1410 retu <<
1411 } <<
1412 HostP = &p->R <<
1413 <<
1414 if ( (HostP-> <<
1415 rio_ <<
1416 <<
1417 p->R <<
1418 retu <<
1419 } <<
1420 rio_dprintk ( <<
1421 LpbRe <<
1422 <<
1423 if (copyout(( <<
1424 (int) <<
1425 rio_d <<
1426 p->RI <<
1427 retur <<
1428 } <<
1429 return retval <<
1430 <<
1431 /* <<
1432 ** Here 3 IOC <<
1433 ** rio logs e <<
1434 ** to both sy <<
1435 ** <<
1436 ** See RioStr <<
1437 */ <<
1438 case RIO_SYSLOG_ONLY: <<
1439 p->RIOPrintLo <<
1440 return 0; <<
1441 <<
1442 case RIO_SYSLOG_CONS: <<
1443 p->RIOPrintLo <<
1444 return 0; <<
1445 <<
1446 case RIO_CONS_ONLY: <<
1447 p->RIOPrintLo <<
1448 return 0; <<
1449 <<
1450 case RIO_SIGNALS_ON: <<
1451 if ( p->RIOSi <<
1452 p->R <<
1453 retu <<
1454 } <<
1455 p->RIOSignalP <<
1456 p->RIOPrintDi <<
1457 return retval <<
1458 <<
1459 case RIO_SIGNALS_OFF: <<
1460 if ( p->RIOSi <<
1461 p->R <<
1462 retu <<
1463 } <<
1464 rio_dprintk ( <<
1465 p->RIOSignalP <<
1466 return retval <<
1467 <<
1468 case RIO_SET_BYTE_MOD <<
1469 for ( Host=0; <<
1470 if ( <<
1471 <<
1472 return retval <<
1473 <<
1474 case RIO_SET_WORD_MOD <<
1475 for ( Host=0; <<
1476 if ( <<
1477 <<
1478 return retval <<
1479 <<
1480 case RIO_SET_FAST_BUS <<
1481 for ( Host=0; <<
1482 if ( <<
1483 <<
1484 return retval <<
1485 <<
1486 case RIO_SET_SLOW_BUS <<
1487 for ( Host=0; <<
1488 if ( <<
1489 <<
1490 return retval <<
1491 <<
1492 case RIO_MAP_B50_TO_5 <<
1493 case RIO_MAP_B50_TO_5 <<
1494 case RIO_MAP_B110_TO_ <<
1495 case RIO_MAP_B110_TO_ <<
1496 rio_dprintk ( <<
1497 port = (uint) <<
1498 if ( port < 0 <<
1499 rio_ <<
1500 p->R <<
1501 retu <<
1502 } <<
1503 rio_spin_lock <<
1504 switch( cmd ) <<
1505 { <<
1506 case <<
1507 <<
1508 <<
1509 case <<
1510 <<
1511 <<
1512 case <<
1513 <<
1514 <<
1515 case <<
1516 <<
1517 <<
1518 } <<
1519 rio_spin_unlo <<
1520 return retval <<
1521 <<
1522 case RIO_STREAM_INFO: <<
1523 rio_dprintk ( <<
1524 return -EINVA <<
1525 <<
1526 case RIO_SEND_PACKET: <<
1527 rio_dprintk ( <<
1528 if ( copyin( <<
1529 <<
1530 rio_ <<
1531 p->R <<
1532 retu <<
1533 } <<
1534 if ( SendPack <<
1535 p->R <<
1536 retu <<
1537 } <<
1538 <<
1539 PortP = p->RI <<
1540 rio_spin_lock <<
1541 <<
1542 if ( !can_add <<
1543 p->R <<
1544 rio_ <<
1545 retu <<
1546 } <<
1547 <<
1548 for ( loop=0; <<
1549 WBYT <<
1550 <<
1551 WBYTE(PacketP <<
1552 <<
1553 add_transmit( <<
1554 /* <<
1555 ** Count char <<
1556 */ <<
1557 if (PortP->st <<
1558 Port <<
1559 rio_spin_unlo <<
1560 return retval <<
1561 <<
1562 case RIO_NO_MESG: <<
1563 if ( su ) <<
1564 p->R <<
1565 return su ? 0 <<
1566 <<
1567 case RIO_MESG: <<
1568 if ( su ) <<
1569 p->RI <<
1570 return su ? 0 <<
1571 <<
1572 case RIO_WHAT_MESG: <<
1573 if ( copyout( <<
1574 sizeo <<
1575 rio_d <<
1576 p->RI <<
1577 retur <<
1578 } <<
1579 return 0; <<
1580 <<
1581 case RIO_MEM_DUMP : <<
1582 if (copyin((i <<
1583 <<
1584 p->R <<
1585 retu <<
1586 } <<
1587 rio_dprintk ( <<
1588 <<
1589 <<
1590 if (SubCmd.Ru <<
1591 p->R <<
1592 retu <<
1593 } <<
1594 <<
1595 if (SubCmd.Ho <<
1596 p->R <<
1597 retu <<
1598 } <<
1599 <<
1600 port = p->RIO <<
1601 <<
1602 <<
1603 PortP = p->RI <<
1604 <<
1605 rio_spin_lock <<
1606 <<
1607 if ( RIOPreem <<
1608 rio_ <<
1609 rio_ <<
1610 retu <<
1611 } <<
1612 else <<
1613 Port <<
1614 <<
1615 rio_spin_unlo <<
1616 if ( copyout( <<
1617 <<
1618 rio_ <<
1619 p->R <<
1620 retu <<
1621 } <<
1622 return 0; <<
1623 <<
1624 case RIO_TICK: <<
1625 if ((int)arg <<
1626 retu <<
1627 rio_dprintk ( <<
1628 WBYTE(p->RIOH <<
1629 return 0; <<
1630 <<
1631 case RIO_TOCK: <<
1632 if ((int)arg <<
1633 retu <<
1634 rio_dprintk ( <<
1635 WBYTE((p->RIO <<
1636 return 0; <<
1637 <<
1638 case RIO_READ_CHECK: <<
1639 /* Check read <<
1640 p->RIOReadChe <<
1641 if (copyout(( <<
1642 <<
1643 p->R <<
1644 retu <<
1645 } <<
1646 return 0; <<
1647 <<
1648 case RIO_READ_REGISTE <<
1649 if (copyin((i <<
1650 <<
1651 p->R <<
1652 retu <<
1653 } <<
1654 rio_dprintk ( <<
1655 <<
1656 915
1657 if (SubCmd.Po !! 916 case RIO_HOST_REQ:
1658 rio_ !! 917 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
1659 !! 918 if (copy_from_user(&HostReq, argp, sizeof(HostReq))) {
1660 p->R !! 919 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
1661 retu !! 920 p->RIOError.Error = COPYIN_FAILED;
1662 } !! 921 return -EFAULT;
>> 922 }
>> 923 if (HostReq.HostNum >= p->RIONumHosts) {
>> 924 p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
>> 925 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum);
>> 926 return -ENXIO;
>> 927 }
>> 928 rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
>> 929
>> 930 if (copy_to_user(HostReq.HostP, &p->RIOHosts[HostReq.HostNum], sizeof(struct Host))) {
>> 931 p->RIOError.Error = COPYOUT_FAILED;
>> 932 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
>> 933 return -EFAULT;
>> 934 }
>> 935 return retval;
>> 936
>> 937 case RIO_HOST_DPRAM:
>> 938 rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n");
>> 939 if (copy_from_user(&HostDpRam, argp, sizeof(HostDpRam))) {
>> 940 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
>> 941 p->RIOError.Error = COPYIN_FAILED;
>> 942 return -EFAULT;
>> 943 }
>> 944 if (HostDpRam.HostNum >= p->RIONumHosts) {
>> 945 p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
>> 946 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum);
>> 947 return -ENXIO;
>> 948 }
>> 949 rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum);
>> 950
>> 951 if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) {
>> 952 int off;
>> 953 /* It's hardware like this that really gets on my tits. */
>> 954 static unsigned char copy[sizeof(struct DpRam)];
>> 955 for (off = 0; off < sizeof(struct DpRam); off++)
>> 956 copy[off] = readb(p->RIOHosts[HostDpRam.HostNum].Caddr + off);
>> 957 if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) {
>> 958 p->RIOError.Error = COPYOUT_FAILED;
>> 959 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
>> 960 return -EFAULT;
>> 961 }
>> 962 } else if (copy_from_io(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) {
>> 963 p->RIOError.Error = COPYOUT_FAILED;
>> 964 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
>> 965 return -EFAULT;
>> 966 }
>> 967 return retval;
>> 968
>> 969 case RIO_SET_BUSY:
>> 970 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n");
>> 971 if (arg > 511) {
>> 972 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", arg);
>> 973 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 974 return -EINVAL;
>> 975 }
>> 976 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 977 p->RIOPortp[arg]->State |= RIO_BUSY;
>> 978 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 979 return retval;
1663 980
1664 if (SubCmd.Ru !! 981 case RIO_HOST_PORT:
1665 p->R !! 982 /*
1666 retu !! 983 ** The daemon want port information
1667 } !! 984 ** (probably for debug reasons)
>> 985 */
>> 986 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
>> 987 if (copy_from_user(&PortReq, argp, sizeof(PortReq))) {
>> 988 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
>> 989 p->RIOError.Error = COPYIN_FAILED;
>> 990 return -EFAULT;
>> 991 }
>> 992
>> 993 if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */
>> 994 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort);
>> 995 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 996 return -ENXIO;
>> 997 }
>> 998 rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
>> 999 if (copy_to_user(PortReq.PortP, p->RIOPortp[PortReq.SysPort], sizeof(struct Port))) {
>> 1000 p->RIOError.Error = COPYOUT_FAILED;
>> 1001 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
>> 1002 return -EFAULT;
>> 1003 }
>> 1004 return retval;
1668 1005
1669 if (SubCmd.Ho !! 1006 case RIO_HOST_RUP:
1670 p->R !! 1007 /*
1671 retu !! 1008 ** The daemon want rup information
1672 } !! 1009 ** (probably for debug reasons)
>> 1010 */
>> 1011 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
>> 1012 if (copy_from_user(&RupReq, argp, sizeof(RupReq))) {
>> 1013 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
>> 1014 p->RIOError.Error = COPYIN_FAILED;
>> 1015 return -EFAULT;
>> 1016 }
>> 1017 if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */
>> 1018 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum);
>> 1019 p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
>> 1020 return -ENXIO;
>> 1021 }
>> 1022 if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) { /* eek! */
>> 1023 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum);
>> 1024 p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
>> 1025 return -EINVAL;
>> 1026 }
>> 1027 HostP = &p->RIOHosts[RupReq.HostNum];
>> 1028
>> 1029 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
>> 1030 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum);
>> 1031 p->RIOError.Error = HOST_NOT_RUNNING;
>> 1032 return -EIO;
>> 1033 }
>> 1034 rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum);
>> 1035
>> 1036 if (copy_from_io(RupReq.RupP, HostP->UnixRups[RupReq.RupNum].RupP, sizeof(struct RUP))) {
>> 1037 p->RIOError.Error = COPYOUT_FAILED;
>> 1038 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
>> 1039 return -EFAULT;
>> 1040 }
>> 1041 return retval;
1673 1042
1674 port = p->RIO !! 1043 case RIO_HOST_LPB:
1675 !! 1044 /*
1676 PortP = p->RI !! 1045 ** The daemon want lpb information
1677 !! 1046 ** (probably for debug reasons)
1678 rio_spin_lock !! 1047 */
1679 !! 1048 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
1680 if (RIOPreemp !! 1049 if (copy_from_user(&LpbReq, argp, sizeof(LpbReq))) {
1681 rio_ !! 1050 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
1682 rio_ !! 1051 p->RIOError.Error = COPYIN_FAILED;
1683 retu !! 1052 return -EFAULT;
1684 } !! 1053 }
1685 else !! 1054 if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */
1686 Port !! 1055 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host);
>> 1056 p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
>> 1057 return -ENXIO;
>> 1058 }
>> 1059 if (LpbReq.Link >= LINKS_PER_UNIT) { /* eek! */
>> 1060 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link);
>> 1061 p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE;
>> 1062 return -EINVAL;
>> 1063 }
>> 1064 HostP = &p->RIOHosts[LpbReq.Host];
>> 1065
>> 1066 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
>> 1067 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host);
>> 1068 p->RIOError.Error = HOST_NOT_RUNNING;
>> 1069 return -EIO;
>> 1070 }
>> 1071 rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host);
>> 1072
>> 1073 if (copy_from_io(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) {
>> 1074 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
>> 1075 p->RIOError.Error = COPYOUT_FAILED;
>> 1076 return -EFAULT;
>> 1077 }
>> 1078 return retval;
1687 1079
1688 rio_spin_unlo !! 1080 /*
1689 if (copyout(( !! 1081 ** Here 3 IOCTL's that allow us to change the way in which
1690 !! 1082 ** rio logs errors. send them just to syslog or send them
1691 rio_ !! 1083 ** to both syslog and console or send them to just the console.
1692 p->R !! 1084 **
1693 retu !! 1085 ** See RioStrBuf() in util.c for the other half.
1694 } !! 1086 */
1695 return 0; !! 1087 case RIO_SYSLOG_ONLY:
1696 /* !! 1088 p->RIOPrintLogState = PRINT_TO_LOG; /* Just syslog */
1697 ** rio_make_d !! 1089 return 0;
1698 ** (RIO_DEV_D !! 1090
1699 ** value to p !! 1091 case RIO_SYSLOG_CONS:
1700 */ !! 1092 p->RIOPrintLogState = PRINT_TO_LOG_CONS; /* syslog and console */
1701 case RIO_MAKE_DEV: !! 1093 return 0;
1702 { !! 1094
1703 uint !! 1095 case RIO_CONS_ONLY:
>> 1096 p->RIOPrintLogState = PRINT_TO_CONS; /* Just console */
>> 1097 return 0;
>> 1098
>> 1099 case RIO_SIGNALS_ON:
>> 1100 if (p->RIOSignalProcess) {
>> 1101 p->RIOError.Error = SIGNALS_ALREADY_SET;
>> 1102 return -EBUSY;
>> 1103 }
>> 1104 /* FIXME: PID tracking */
>> 1105 p->RIOSignalProcess = current->pid;
>> 1106 p->RIOPrintDisabled = DONT_PRINT;
>> 1107 return retval;
>> 1108
>> 1109 case RIO_SIGNALS_OFF:
>> 1110 if (p->RIOSignalProcess != current->pid) {
>> 1111 p->RIOError.Error = NOT_RECEIVING_PROCESS;
>> 1112 return -EPERM;
>> 1113 }
>> 1114 rio_dprintk(RIO_DEBUG_CTRL, "Clear signal process to zero\n");
>> 1115 p->RIOSignalProcess = 0;
>> 1116 return retval;
>> 1117
>> 1118 case RIO_SET_BYTE_MODE:
>> 1119 for (Host = 0; Host < p->RIONumHosts; Host++)
>> 1120 if (p->RIOHosts[Host].Type == RIO_AT)
>> 1121 p->RIOHosts[Host].Mode &= ~WORD_OPERATION;
>> 1122 return retval;
>> 1123
>> 1124 case RIO_SET_WORD_MODE:
>> 1125 for (Host = 0; Host < p->RIONumHosts; Host++)
>> 1126 if (p->RIOHosts[Host].Type == RIO_AT)
>> 1127 p->RIOHosts[Host].Mode |= WORD_OPERATION;
>> 1128 return retval;
>> 1129
>> 1130 case RIO_SET_FAST_BUS:
>> 1131 for (Host = 0; Host < p->RIONumHosts; Host++)
>> 1132 if (p->RIOHosts[Host].Type == RIO_AT)
>> 1133 p->RIOHosts[Host].Mode |= FAST_AT_BUS;
>> 1134 return retval;
>> 1135
>> 1136 case RIO_SET_SLOW_BUS:
>> 1137 for (Host = 0; Host < p->RIONumHosts; Host++)
>> 1138 if (p->RIOHosts[Host].Type == RIO_AT)
>> 1139 p->RIOHosts[Host].Mode &= ~FAST_AT_BUS;
>> 1140 return retval;
>> 1141
>> 1142 case RIO_MAP_B50_TO_50:
>> 1143 case RIO_MAP_B50_TO_57600:
>> 1144 case RIO_MAP_B110_TO_110:
>> 1145 case RIO_MAP_B110_TO_115200:
>> 1146 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n");
>> 1147 port = arg;
>> 1148 if (port < 0 || port > 511) {
>> 1149 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
>> 1150 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 1151 return -EINVAL;
>> 1152 }
>> 1153 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 1154 switch (cmd) {
>> 1155 case RIO_MAP_B50_TO_50:
>> 1156 p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50;
>> 1157 break;
>> 1158 case RIO_MAP_B50_TO_57600:
>> 1159 p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50;
>> 1160 break;
>> 1161 case RIO_MAP_B110_TO_110:
>> 1162 p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110;
>> 1163 break;
>> 1164 case RIO_MAP_B110_TO_115200:
>> 1165 p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110;
>> 1166 break;
>> 1167 }
>> 1168 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 1169 return retval;
>> 1170
>> 1171 case RIO_STREAM_INFO:
>> 1172 rio_dprintk(RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n");
>> 1173 return -EINVAL;
>> 1174
>> 1175 case RIO_SEND_PACKET:
>> 1176 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
>> 1177 if (copy_from_user(&SendPack, argp, sizeof(SendPack))) {
>> 1178 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
>> 1179 p->RIOError.Error = COPYIN_FAILED;
>> 1180 return -EFAULT;
>> 1181 }
>> 1182 if (SendPack.PortNum >= 128) {
>> 1183 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 1184 return -ENXIO;
>> 1185 }
>> 1186
>> 1187 PortP = p->RIOPortp[SendPack.PortNum];
>> 1188 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 1189
>> 1190 if (!can_add_transmit(&PacketP, PortP)) {
>> 1191 p->RIOError.Error = UNIT_IS_IN_USE;
>> 1192 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 1193 return -ENOSPC;
>> 1194 }
1704 1195
1705 switc !! 1196 for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++)
1706 !! 1197 writeb(SendPack.Data[loop], &PacketP->data[loop]);
1707 <<
1708 <<
1709 <<
1710 <<
1711 <<
1712 <<
1713 <<
1714 <<
1715 <<
1716 <<
1717 <<
1718 } <<
1719 rio_d <<
1720 retur <<
1721 } <<
1722 /* <<
1723 ** rio_minor: <<
1724 ** the port n <<
1725 ** ( RIO_DEV_ <<
1726 */ <<
1727 case RIO_MINOR: <<
1728 { <<
1729 dev_t <<
1730 int m <<
1731 1198
1732 dv = !! 1199 writeb(SendPack.Len, &PacketP->len);
1733 mino <<
1734 1200
1735 if ( !! 1201 add_transmit(PortP);
1736 !! 1202 /*
1737 !! 1203 ** Count characters transmitted for port statistics reporting
1738 } !! 1204 */
1739 else !! 1205 if (PortP->statsGather)
1740 !! 1206 PortP->txchars += (SendPack.Len & 127);
1741 !! 1207 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1742 } !! 1208 return retval;
1743 retur !! 1209
1744 } !! 1210 case RIO_NO_MESG:
>> 1211 if (su)
>> 1212 p->RIONoMessage = 1;
>> 1213 return su ? 0 : -EPERM;
>> 1214
>> 1215 case RIO_MESG:
>> 1216 if (su)
>> 1217 p->RIONoMessage = 0;
>> 1218 return su ? 0 : -EPERM;
>> 1219
>> 1220 case RIO_WHAT_MESG:
>> 1221 if (copy_to_user(argp, &p->RIONoMessage, sizeof(p->RIONoMessage))) {
>> 1222 rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
>> 1223 p->RIOError.Error = COPYOUT_FAILED;
>> 1224 return -EFAULT;
>> 1225 }
>> 1226 return 0;
>> 1227
>> 1228 case RIO_MEM_DUMP:
>> 1229 if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) {
>> 1230 p->RIOError.Error = COPYIN_FAILED;
>> 1231 return -EFAULT;
>> 1232 }
>> 1233 rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
>> 1234
>> 1235 if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
>> 1236 p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
>> 1237 return -EINVAL;
>> 1238 }
>> 1239
>> 1240 if (SubCmd.Host >= p->RIONumHosts) {
>> 1241 p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
>> 1242 return -EINVAL;
>> 1243 }
>> 1244
>> 1245 port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort;
>> 1246
>> 1247 PortP = p->RIOPortp[port];
>> 1248
>> 1249 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 1250
>> 1251 if (RIOPreemptiveCmd(p, PortP, MEMDUMP) == RIO_FAIL) {
>> 1252 rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n");
>> 1253 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 1254 return -EBUSY;
>> 1255 } else
>> 1256 PortP->State |= RIO_BUSY;
>> 1257
>> 1258 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 1259 if (copy_to_user(argp, p->RIOMemDump, MEMDUMP_SIZE)) {
>> 1260 rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
>> 1261 p->RIOError.Error = COPYOUT_FAILED;
>> 1262 return -EFAULT;
>> 1263 }
>> 1264 return 0;
>> 1265
>> 1266 case RIO_TICK:
>> 1267 if (arg >= p->RIONumHosts)
>> 1268 return -EINVAL;
>> 1269 rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", arg);
>> 1270 writeb(0xFF, &p->RIOHosts[arg].SetInt);
>> 1271 return 0;
>> 1272
>> 1273 case RIO_TOCK:
>> 1274 if (arg >= p->RIONumHosts)
>> 1275 return -EINVAL;
>> 1276 rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", arg);
>> 1277 writeb(0xFF, &p->RIOHosts[arg].ResetInt);
>> 1278 return 0;
>> 1279
>> 1280 case RIO_READ_CHECK:
>> 1281 /* Check reads for pkts with data[0] the same */
>> 1282 p->RIOReadCheck = !p->RIOReadCheck;
>> 1283 if (copy_to_user(argp, &p->RIOReadCheck, sizeof(unsigned int))) {
>> 1284 p->RIOError.Error = COPYOUT_FAILED;
>> 1285 return -EFAULT;
>> 1286 }
>> 1287 return 0;
>> 1288
>> 1289 case RIO_READ_REGISTER:
>> 1290 if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) {
>> 1291 p->RIOError.Error = COPYIN_FAILED;
>> 1292 return -EFAULT;
>> 1293 }
>> 1294 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr);
>> 1295
>> 1296 if (SubCmd.Port > 511) {
>> 1297 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port);
>> 1298 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
>> 1299 return -EINVAL;
>> 1300 }
>> 1301
>> 1302 if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
>> 1303 p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
>> 1304 return -EINVAL;
>> 1305 }
>> 1306
>> 1307 if (SubCmd.Host >= p->RIONumHosts) {
>> 1308 p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
>> 1309 return -EINVAL;
>> 1310 }
>> 1311
>> 1312 port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
>> 1313 PortP = p->RIOPortp[port];
>> 1314
>> 1315 rio_spin_lock_irqsave(&PortP->portSem, flags);
>> 1316
>> 1317 if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) {
>> 1318 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n");
>> 1319 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 1320 return -EBUSY;
>> 1321 } else
>> 1322 PortP->State |= RIO_BUSY;
>> 1323
>> 1324 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
>> 1325 if (copy_to_user(argp, &p->CdRegister, sizeof(unsigned int))) {
>> 1326 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
>> 1327 p->RIOError.Error = COPYOUT_FAILED;
>> 1328 return -EFAULT;
>> 1329 }
>> 1330 return 0;
>> 1331 /*
>> 1332 ** rio_make_dev: given port number (0-511) ORed with port type
>> 1333 ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t
>> 1334 ** value to pass to mknod to create the correct device node.
>> 1335 */
>> 1336 case RIO_MAKE_DEV:
>> 1337 {
>> 1338 unsigned int port = arg & RIO_MODEM_MASK;
>> 1339 unsigned int ret;
>> 1340
>> 1341 switch (arg & RIO_DEV_MASK) {
>> 1342 case RIO_DEV_DIRECT:
>> 1343 ret = drv_makedev(MAJOR(dev), port);
>> 1344 rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret);
>> 1345 return ret;
>> 1346 case RIO_DEV_MODEM:
>> 1347 ret = drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT));
>> 1348 rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, ret);
>> 1349 return ret;
>> 1350 case RIO_DEV_XPRINT:
>> 1351 ret = drv_makedev(MAJOR(dev), port);
>> 1352 rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, ret);
>> 1353 return ret;
>> 1354 }
>> 1355 rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n");
>> 1356 return -EINVAL;
>> 1357 }
>> 1358 /*
>> 1359 ** rio_minor: given a dev_t from a stat() call, return
>> 1360 ** the port number (0-511) ORed with the port type
>> 1361 ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT )
>> 1362 */
>> 1363 case RIO_MINOR:
>> 1364 {
>> 1365 dev_t dv;
>> 1366 int mino;
>> 1367 unsigned long ret;
>> 1368
>> 1369 dv = (dev_t) (arg);
>> 1370 mino = RIO_UNMODEM(dv);
>> 1371
>> 1372 if (RIO_ISMODEM(dv)) {
>> 1373 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
>> 1374 ret = mino | RIO_DEV_MODEM;
>> 1375 } else {
>> 1376 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
>> 1377 ret = mino | RIO_DEV_DIRECT;
>> 1378 }
>> 1379 return ret;
>> 1380 }
1745 } 1381 }
1746 rio_dprintk (RIO_DEBUG_CTRL, "INVALID !! 1382 rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd);
1747 p->RIOError.Error = IOCTL_COMMAND_UNK 1383 p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
1748 1384
1749 func_exit (); !! 1385 func_exit();
1750 return -EINVAL; 1386 return -EINVAL;
1751 } 1387 }
1752 1388
1753 /* 1389 /*
1754 ** Pre-emptive commands go on RUPs and are on 1390 ** Pre-emptive commands go on RUPs and are only one byte long.
1755 */ 1391 */
1756 int !! 1392 int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
1757 RIOPreemptiveCmd(p, PortP, Cmd) <<
1758 struct rio_info * p; <<
1759 struct Port *PortP; <<
1760 uchar Cmd; <<
1761 { 1393 {
1762 struct CmdBlk *CmdBlkP; 1394 struct CmdBlk *CmdBlkP;
1763 struct PktCmd_M *PktCmdP; 1395 struct PktCmd_M *PktCmdP;
1764 int Ret; 1396 int Ret;
1765 ushort rup; 1397 ushort rup;
1766 int port; 1398 int port;
1767 1399
1768 #ifdef CHECK !! 1400 if (PortP->State & RIO_DELETED) {
1769 CheckPortP( PortP ); !! 1401 rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n");
1770 #endif <<
1771 <<
1772 if ( PortP->State & RIO_DELETED ) { <<
1773 rio_dprintk (RIO_DEBUG_CTRL, <<
1774 return RIO_FAIL; 1402 return RIO_FAIL;
1775 } 1403 }
1776 1404
1777 if (((int)((char)PortP->InUse) == -1) !! 1405 if ((PortP->InUse == (typeof(PortP->InUse))-1) ||
1778 rio_dprintk (RIO_DEBUG_CTRL, !! 1406 !(CmdBlkP = RIOGetCmdBlk())) {
1779 Cmd, PortP->PortNum); !! 1407 rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block "
>> 1408 "for command %d on port %d\n", Cmd, PortP->PortNum);
1780 return RIO_FAIL; 1409 return RIO_FAIL;
1781 } 1410 }
1782 1411
1783 rio_dprintk (RIO_DEBUG_CTRL, "Command !! 1412 rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n",
1784 (int)CmdBlkP,PortP->InUse); !! 1413 CmdBlkP, PortP->InUse);
1785 1414
1786 PktCmdP = (struct PktCmd_M *)&CmdBlkP 1415 PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0];
1787 1416
1788 CmdBlkP->Packet.src_unit = 0; !! 1417 CmdBlkP->Packet.src_unit = 0;
1789 if (PortP->SecondBlock) 1418 if (PortP->SecondBlock)
1790 rup = PortP->ID2; 1419 rup = PortP->ID2;
1791 else 1420 else
1792 rup = PortP->RupNum; 1421 rup = PortP->RupNum;
1793 CmdBlkP->Packet.dest_unit = rup; 1422 CmdBlkP->Packet.dest_unit = rup;
1794 CmdBlkP->Packet.src_port = COMMAND_R !! 1423 CmdBlkP->Packet.src_port = COMMAND_RUP;
1795 CmdBlkP->Packet.dest_port = COMMAND_R 1424 CmdBlkP->Packet.dest_port = COMMAND_RUP;
1796 CmdBlkP->Packet.len = PKT_CMD_B !! 1425 CmdBlkP->Packet.len = PKT_CMD_BIT | 2;
1797 CmdBlkP->PostFuncP = RIOUnUse; !! 1426 CmdBlkP->PostFuncP = RIOUnUse;
1798 CmdBlkP->PostArg = (int)PortP; !! 1427 CmdBlkP->PostArg = (unsigned long) PortP;
1799 PktCmdP->Command = Cmd; !! 1428 PktCmdP->Command = Cmd;
1800 port = Por !! 1429 port = PortP->HostPort % (ushort) PORTS_PER_RTA;
1801 /* 1430 /*
1802 ** Index ports 8-15 for 2nd block of !! 1431 ** Index ports 8-15 for 2nd block of 16 port RTA.
1803 */ !! 1432 */
1804 if (PortP->SecondBlock) 1433 if (PortP->SecondBlock)
1805 port += (ushort) PORTS_PER_RT 1434 port += (ushort) PORTS_PER_RTA;
1806 PktCmdP->PhbNum = port; !! 1435 PktCmdP->PhbNum = port;
1807 1436
1808 switch ( Cmd ) { !! 1437 switch (Cmd) {
1809 case MEMDUMP: !! 1438 case MEMDUMP:
1810 rio_dprintk (RIO_DEBU !! 1439 rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p "
1811 (int)CmdBlkP, !! 1440 "(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);
1812 PktCmdP->SubCommand !! 1441 PktCmdP->SubCommand = MEMDUMP;
1813 PktCmdP->SubAddr !! 1442 PktCmdP->SubAddr = SubCmd.Addr;
1814 break; !! 1443 break;
1815 case FCLOSE: !! 1444 case FCLOSE:
1816 rio_dprintk (RIO_DEBU !! 1445 rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n",
1817 break; !! 1446 CmdBlkP);
1818 case READ_REGISTER: !! 1447 break;
1819 rio_dprintk (RIO_DEBU !! 1448 case READ_REGISTER:
1820 (int)SubCmd.A !! 1449 rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) "
1821 PktCmdP->SubCommand !! 1450 "command blk %p\n", (int) SubCmd.Addr, CmdBlkP);
1822 PktCmdP->SubAddr !! 1451 PktCmdP->SubCommand = READ_REGISTER;
1823 break; !! 1452 PktCmdP->SubAddr = SubCmd.Addr;
1824 case RESUME: !! 1453 break;
1825 rio_dprintk (RIO_DEBU !! 1454 case RESUME:
1826 break; !! 1455 rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n",
1827 case RFLUSH: !! 1456 CmdBlkP);
1828 rio_dprintk (RIO_DEBU !! 1457 break;
1829 CmdBlkP->PostFuncP = !! 1458 case RFLUSH:
1830 break; !! 1459 rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n",
1831 case SUSPEND: !! 1460 CmdBlkP);
1832 rio_dprintk (RIO_DEBU !! 1461 CmdBlkP->PostFuncP = RIORFlushEnable;
1833 break; !! 1462 break;
>> 1463 case SUSPEND:
>> 1464 rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n",
>> 1465 CmdBlkP);
>> 1466 break;
>> 1467
>> 1468 case MGET:
>> 1469 rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n",
>> 1470 CmdBlkP);
>> 1471 break;
>> 1472
>> 1473 case MSET:
>> 1474 case MBIC:
>> 1475 case MBIS:
>> 1476 CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
>> 1477 rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command "
>> 1478 "blk %p\n", CmdBlkP);
>> 1479 break;
1834 1480
1835 case MGET : !! 1481 case WFLUSH:
1836 rio_dprintk (RIO_DEBU !! 1482 /*
1837 break; !! 1483 ** If we have queued up the maximum number of Write flushes
1838 !! 1484 ** allowed then we should not bother sending any more to the
1839 case MSET : !! 1485 ** RTA.
1840 case MBIC : !! 1486 */
1841 case MBIS : !! 1487 if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) {
1842 CmdBlkP->Packet.data[ !! 1488 rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, "
1843 rio_dprintk (RIO_DEBU !! 1489 "WflushFlag about to wrap!");
1844 break; !! 1490 RIOFreeCmdBlk(CmdBlkP);
1845 !! 1491 return (RIO_FAIL);
1846 case WFLUSH: !! 1492 } else {
1847 /* !! 1493 rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command "
1848 ** If we have queued !! 1494 "blk %p\n", CmdBlkP);
1849 ** allowed then we sh !! 1495 CmdBlkP->PostFuncP = RIOWFlushMark;
1850 ** RTA. !! 1496 }
1851 */ !! 1497 break;
1852 if ((int)((char)PortP <<
1853 rio_dprintk ( <<
1854 RIOFreeCmdBlk <<
1855 return(RIO_FA <<
1856 } else { <<
1857 rio_dprintk ( <<
1858 (int)C <<
1859 CmdBlkP->Post <<
1860 } <<
1861 break; <<
1862 } 1498 }
1863 1499
1864 PortP->InUse++; 1500 PortP->InUse++;
1865 1501
1866 Ret = RIOQueueCmdBlk( PortP->HostP, r !! 1502 Ret = RIOQueueCmdBlk(PortP->HostP, rup, CmdBlkP);
1867 1503
1868 return Ret; 1504 return Ret;
1869 } 1505 }
1870 1506
| This page was automatically generated by the LXR engine. |