aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/rioctrl.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-03-24 06:18:29 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:29 -0500
commit3d336aa257ba382c3ad7883ee000cbacb761e411 (patch)
tree655026fde099cb11ac6c3bac67092a6ebc9551d8 /drivers/char/rio/rioctrl.c
parent00d83a54aa824b11ebc8c66c4a879cfeb5029a22 (diff)
[PATCH] rio driver rework continued #4
Third large chunk of code cleanup. The split between this and #3 and #4 is fairly arbitary and due to the message length limit on the list. These patches continue the process of ripping out macros and typedefs while cleaning up lots of 32bit assumptions. Several inlines for compatibility also get removed and that causes a lot of noise. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/rio/rioctrl.c')
-rw-r--r--drivers/char/rio/rioctrl.c390
1 files changed, 118 insertions, 272 deletions
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index fcf18a061228..f6a19aae1044 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -131,30 +131,6 @@ static int
131 131
132#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) 132#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
133 133
134int copyin(int arg, caddr_t dp, int siz)
135{
136 int rv;
137
138 rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp);
139 rv = copy_from_user(dp, (void *) arg, siz);
140 if (rv)
141 return COPYFAIL;
142 else
143 return rv;
144}
145
146static int copyout(caddr_t dp, int arg, int siz)
147{
148 int rv;
149
150 rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp);
151 rv = copy_to_user((void *) arg, dp, siz);
152 if (rv)
153 return COPYFAIL;
154 else
155 return rv;
156}
157
158int riocontrol(p, dev, cmd, arg, su) 134int riocontrol(p, dev, cmd, arg, su)
159struct rio_info *p; 135struct rio_info *p;
160dev_t dev; 136dev_t dev;
@@ -178,7 +154,7 @@ int su;
178 Host = 0; 154 Host = 0;
179 PortP = NULL; 155 PortP = NULL;
180 156
181 rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int) arg); 157 rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%p\n", cmd, arg);
182 158
183 switch (cmd) { 159 switch (cmd) {
184 /* 160 /*
@@ -189,90 +165,34 @@ int su;
189 ** otherwise just the specified host card will be changed. 165 ** otherwise just the specified host card will be changed.
190 */ 166 */
191 case RIO_SET_TIMER: 167 case RIO_SET_TIMER:
192 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint) arg); 168 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", (unsigned long)arg);
193 { 169 {
194 int host, value; 170 int host, value;
195 host = (uint) arg >> 16; 171 host = ((unsigned long) arg >> 16) & 0x0000FFFF;
196 value = (uint) arg & 0x0000ffff; 172 value = (unsigned long) arg & 0x0000ffff;
197 if (host == -1) { 173 if (host == -1) {
198 for (host = 0; host < p->RIONumHosts; host++) { 174 for (host = 0; host < p->RIONumHosts; host++) {
199 if (p->RIOHosts[host].Flags == RC_RUNNING) { 175 if (p->RIOHosts[host].Flags == RC_RUNNING) {
200 WWORD(p->RIOHosts[host].ParmMapP->timer, value); 176 writew(value, &p->RIOHosts[host].ParmMapP->timer);
201 } 177 }
202 } 178 }
203 } else if (host >= p->RIONumHosts) { 179 } else if (host >= p->RIONumHosts) {
204 return -EINVAL; 180 return -EINVAL;
205 } else { 181 } else {
206 if (p->RIOHosts[host].Flags == RC_RUNNING) { 182 if (p->RIOHosts[host].Flags == RC_RUNNING) {
207 WWORD(p->RIOHosts[host].ParmMapP->timer, value); 183 writew(value, &p->RIOHosts[host].ParmMapP->timer);
208 } 184 }
209 } 185 }
210 } 186 }
211 return 0; 187 return 0;
212 188
213 case RIO_IDENTIFY_DRIVER:
214 /*
215 ** 15.10.1998 ARG - ESIL 0760 part fix
216 ** Added driver ident string output.
217 **
218 #ifndef __THIS_RELEASE__
219 #warning Driver Version string not defined !
220 #endif
221 cprintf("%s %s %s %s\n",
222 RIO_DRV_STR,
223 __THIS_RELEASE__,
224 __DATE__, __TIME__ );
225
226 return 0;
227
228 case RIO_DISPLAY_HOST_CFG:
229 **
230 ** 15.10.1998 ARG - ESIL 0760 part fix
231 ** Added driver host card ident string output.
232 **
233 ** Note that the only types currently supported
234 ** are ISA and PCI. Also this driver does not
235 ** (yet) distinguish between the Old PCI card
236 ** and the Jet PCI card. In fact I think this
237 ** driver only supports JET PCI !
238 **
239
240 for (Host = 0; Host < p->RIONumHosts; Host++)
241 {
242 HostP = &(p->RIOHosts[Host]);
243
244 switch ( HostP->Type )
245 {
246 case RIO_AT :
247 strcpy( host_type, RIO_AT_HOST_STR );
248 break;
249
250 case RIO_PCI :
251 strcpy( host_type, RIO_PCI_HOST_STR );
252 break;
253
254 default :
255 strcpy( host_type, "Unknown" );
256 break;
257 }
258
259 cprintf(
260 "RIO Host %d - Type:%s Addr:%X IRQ:%d\n",
261 Host, host_type,
262 (uint)HostP->PaddrP,
263 (int)HostP->Ivec - 32 );
264 }
265 return 0;
266 **
267 */
268
269 case RIO_FOAD_RTA: 189 case RIO_FOAD_RTA:
270 rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); 190 rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n");
271 return RIOCommandRta(p, (uint) arg, RIOFoadRta); 191 return RIOCommandRta(p, (unsigned long)arg, RIOFoadRta);
272 192
273 case RIO_ZOMBIE_RTA: 193 case RIO_ZOMBIE_RTA:
274 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); 194 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n");
275 return RIOCommandRta(p, (uint) arg, RIOZombieRta); 195 return RIOCommandRta(p, (unsigned long)arg, RIOZombieRta);
276 196
277 case RIO_IDENTIFY_RTA: 197 case RIO_IDENTIFY_RTA:
278 rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); 198 rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n");
@@ -287,7 +207,7 @@ int su;
287 struct CmdBlk *CmdBlkP; 207 struct CmdBlk *CmdBlkP;
288 208
289 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); 209 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
290 if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) { 210 if (copy_from_user(&SpecialRupCmd, arg, sizeof(SpecialRupCmd))) {
291 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); 211 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
292 p->RIOError.Error = COPYIN_FAILED; 212 p->RIOError.Error = COPYIN_FAILED;
293 return -EFAULT; 213 return -EFAULT;
@@ -302,7 +222,7 @@ int su;
302 SpecialRupCmd.Host = 0; 222 SpecialRupCmd.Host = 0;
303 rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum); 223 rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum);
304 if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { 224 if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
305 cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); 225 printk(KERN_WARNING "rio: FAILED TO QUEUE SPECIAL RUP COMMAND\n");
306 } 226 }
307 return 0; 227 return 0;
308 } 228 }
@@ -324,7 +244,7 @@ int su;
324 if ((retval = RIOApel(p)) != 0) 244 if ((retval = RIOApel(p)) != 0)
325 return retval; 245 return retval;
326 246
327 if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { 247 if (copy_to_user(arg, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
328 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); 248 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
329 p->RIOError.Error = COPYOUT_FAILED; 249 p->RIOError.Error = COPYOUT_FAILED;
330 return -EFAULT; 250 return -EFAULT;
@@ -369,7 +289,7 @@ int su;
369 p->RIOError.Error = NOT_SUPER_USER; 289 p->RIOError.Error = NOT_SUPER_USER;
370 return -EPERM; 290 return -EPERM;
371 } 291 }
372 if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { 292 if (copy_from_user(&p->RIOConnectTable[0], arg, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
373 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); 293 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
374 p->RIOError.Error = COPYIN_FAILED; 294 p->RIOError.Error = COPYIN_FAILED;
375 return -EFAULT; 295 return -EFAULT;
@@ -415,7 +335,7 @@ int su;
415 p->RIOError.Error = NOT_SUPER_USER; 335 p->RIOError.Error = NOT_SUPER_USER;
416 return -EPERM; 336 return -EPERM;
417 } 337 }
418 if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { 338 if (copy_to_user(arg, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
419 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); 339 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
420 p->RIOError.Error = COPYOUT_FAILED; 340 p->RIOError.Error = COPYOUT_FAILED;
421 return -EFAULT; 341 return -EFAULT;
@@ -434,7 +354,7 @@ int su;
434 p->RIOError.Error = NOT_SUPER_USER; 354 p->RIOError.Error = NOT_SUPER_USER;
435 return -EPERM; 355 return -EPERM;
436 } 356 }
437 if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { 357 if (copy_from_user(&p->RIOBindTab[0], arg, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
438 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); 358 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
439 p->RIOError.Error = COPYIN_FAILED; 359 p->RIOError.Error = COPYIN_FAILED;
440 return -EFAULT; 360 return -EFAULT;
@@ -458,12 +378,12 @@ int su;
458 for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { 378 for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) {
459 if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) 379 if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L))
460 EmptySlot = Entry; 380 EmptySlot = Entry;
461 else if (p->RIOBindTab[Entry] == (int) arg) { 381 else if (p->RIOBindTab[Entry] == (long)arg) {
462 /* 382 /*
463 ** Already exists - delete 383 ** Already exists - delete
464 */ 384 */
465 p->RIOBindTab[Entry] = 0L; 385 p->RIOBindTab[Entry] = 0L;
466 rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg); 386 rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", (unsigned long)arg);
467 return 0; 387 return 0;
468 } 388 }
469 } 389 }
@@ -471,10 +391,10 @@ int su;
471 ** Dosen't exist - add 391 ** Dosen't exist - add
472 */ 392 */
473 if (EmptySlot != -1) { 393 if (EmptySlot != -1) {
474 p->RIOBindTab[EmptySlot] = (int) arg; 394 p->RIOBindTab[EmptySlot] = (unsigned long)arg;
475 rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg); 395 rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", (unsigned long) arg);
476 } else { 396 } else {
477 rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg); 397 rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", (unsigned long) arg);
478 return -ENOMEM; 398 return -ENOMEM;
479 } 399 }
480 return 0; 400 return 0;
@@ -482,7 +402,7 @@ int su;
482 402
483 case RIO_RESUME: 403 case RIO_RESUME:
484 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); 404 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n");
485 port = (uint) arg; 405 port = (unsigned long) arg;
486 if ((port < 0) || (port > 511)) { 406 if ((port < 0) || (port > 511)) {
487 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); 407 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
488 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 408 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
@@ -518,8 +438,7 @@ int su;
518 p->RIOError.Error = NOT_SUPER_USER; 438 p->RIOError.Error = NOT_SUPER_USER;
519 return -EPERM; 439 return -EPERM;
520 } 440 }
521 if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) 441 if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) {
522 == COPYFAIL) {
523 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); 442 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
524 p->RIOError.Error = COPYIN_FAILED; 443 p->RIOError.Error = COPYIN_FAILED;
525 return -EFAULT; 444 return -EFAULT;
@@ -533,8 +452,7 @@ int su;
533 p->RIOError.Error = NOT_SUPER_USER; 452 p->RIOError.Error = NOT_SUPER_USER;
534 return -EPERM; 453 return -EPERM;
535 } 454 }
536 if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) 455 if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) {
537 == COPYFAIL) {
538 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); 456 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
539 p->RIOError.Error = COPYIN_FAILED; 457 p->RIOError.Error = COPYIN_FAILED;
540 return -EFAULT; 458 return -EFAULT;
@@ -548,8 +466,7 @@ int su;
548 p->RIOError.Error = NOT_SUPER_USER; 466 p->RIOError.Error = NOT_SUPER_USER;
549 return -EPERM; 467 return -EPERM;
550 } 468 }
551 if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) 469 if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) {
552 == COPYFAIL) {
553 rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); 470 rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n");
554 p->RIOError.Error = COPYIN_FAILED; 471 p->RIOError.Error = COPYIN_FAILED;
555 return -EFAULT; 472 return -EFAULT;
@@ -557,30 +474,14 @@ int su;
557 return RIODeleteRta(p, &MapEnt); 474 return RIODeleteRta(p, &MapEnt);
558 475
559 case RIO_QUICK_CHECK: 476 case RIO_QUICK_CHECK:
560 /* 477 if (copy_to_user(arg, &p->RIORtaDisCons, sizeof(unsigned int))) {
561 ** 09.12.1998 ARG - ESIL 0776 part fix
562 ** A customer was using this to get the RTAs
563 ** connect/disconnect status.
564 ** RIOConCon() had been botched use RIOHalted
565 ** to keep track of RTA connections and
566 ** disconnections. That has been changed and
567 ** RIORtaDisCons in the rio_info struct now
568 ** does the job. So we need to return the value
569 ** of RIORtaCons instead of RIOHalted.
570 **
571 if (copyout((caddr_t)&p->RIOHalted,(int)arg,
572 sizeof(uint))==COPYFAIL) {
573 **
574 */
575
576 if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) {
577 p->RIOError.Error = COPYOUT_FAILED; 478 p->RIOError.Error = COPYOUT_FAILED;
578 return -EFAULT; 479 return -EFAULT;
579 } 480 }
580 return 0; 481 return 0;
581 482
582 case RIO_LAST_ERROR: 483 case RIO_LAST_ERROR:
583 if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL) 484 if (copy_to_user(arg, &p->RIOError, sizeof(struct Error)))
584 return -EFAULT; 485 return -EFAULT;
585 return 0; 486 return 0;
586 487
@@ -589,7 +490,7 @@ int su;
589 return -EINVAL; 490 return -EINVAL;
590 491
591 case RIO_GET_MODTYPE: 492 case RIO_GET_MODTYPE:
592 if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) { 493 if (copy_from_user(&port, arg, sizeof(unsigned int))) {
593 p->RIOError.Error = COPYIN_FAILED; 494 p->RIOError.Error = COPYIN_FAILED;
594 return -EFAULT; 495 return -EFAULT;
595 } 496 }
@@ -609,36 +510,11 @@ int su;
609 ** Return module type of port 510 ** Return module type of port
610 */ 511 */
611 port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; 512 port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
612 if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) { 513 if (copy_to_user(arg, &port, sizeof(unsigned int))) {
613 p->RIOError.Error = COPYOUT_FAILED; 514 p->RIOError.Error = COPYOUT_FAILED;
614 return -EFAULT; 515 return -EFAULT;
615 } 516 }
616 return (0); 517 return (0);
617 /*
618 ** 02.03.1999 ARG - ESIL 0820 fix
619 ** We are no longer using "Boot Mode", so these ioctls
620 ** are not required :
621 **
622 case RIO_GET_BOOT_MODE :
623 rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode));
624 **
625 ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE
626 **
627 if (copyout((caddr_t)&p->RIOBootMode, (int)arg,
628 sizeof(p->RIOBootMode)) == COPYFAIL) {
629 p->RIOError.Error = COPYOUT_FAILED;
630 return -EFAULT;
631 }
632 return(0);
633
634 case RIO_SET_BOOT_MODE :
635 p->RIOBootMode = (uint) arg;
636 rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode));
637 return(0);
638 **
639 ** End ESIL 0820 fix
640 */
641
642 case RIO_BLOCK_OPENS: 518 case RIO_BLOCK_OPENS:
643 rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n"); 519 rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n");
644 for (Entry = 0; Entry < RIO_PORTS; Entry++) { 520 for (Entry = 0; Entry < RIO_PORTS; Entry++) {
@@ -650,8 +526,7 @@ int su;
650 526
651 case RIO_SETUP_PORTS: 527 case RIO_SETUP_PORTS:
652 rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); 528 rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n");
653 if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) 529 if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) {
654 == COPYFAIL) {
655 p->RIOError.Error = COPYIN_FAILED; 530 p->RIOError.Error = COPYIN_FAILED;
656 rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); 531 rio_dprintk(RIO_DEBUG_CTRL, "EFAULT");
657 return -EFAULT; 532 return -EFAULT;
@@ -667,7 +542,7 @@ int su;
667 return -EINVAL; 542 return -EINVAL;
668 } 543 }
669 if (!p->RIOPortp) { 544 if (!p->RIOPortp) {
670 cprintf("No p->RIOPortp array!\n"); 545 printk(KERN_ERR "rio: No p->RIOPortp array!\n");
671 rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); 546 rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
672 return -EIO; 547 return -EIO;
673 } 548 }
@@ -681,8 +556,7 @@ int su;
681 556
682 case RIO_GET_PORT_SETUP: 557 case RIO_GET_PORT_SETUP:
683 rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); 558 rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n");
684 if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) 559 if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) {
685 == COPYFAIL) {
686 p->RIOError.Error = COPYIN_FAILED; 560 p->RIOError.Error = COPYIN_FAILED;
687 return -EFAULT; 561 return -EFAULT;
688 } 562 }
@@ -703,8 +577,7 @@ int su;
703 PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; 577 PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
704 PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; 578 PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
705 579
706 if (copyout((caddr_t) & PortSetup, (int) arg, sizeof(PortSetup)) 580 if (copy_to_user(arg, &PortSetup, sizeof(PortSetup))) {
707 == COPYFAIL) {
708 p->RIOError.Error = COPYOUT_FAILED; 581 p->RIOError.Error = COPYOUT_FAILED;
709 return -EFAULT; 582 return -EFAULT;
710 } 583 }
@@ -712,7 +585,7 @@ int su;
712 585
713 case RIO_GET_PORT_PARAMS: 586 case RIO_GET_PORT_PARAMS:
714 rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); 587 rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n");
715 if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) { 588 if (copy_from_user(&PortParams, arg, sizeof(struct PortParams))) {
716 p->RIOError.Error = COPYIN_FAILED; 589 p->RIOError.Error = COPYIN_FAILED;
717 return -EFAULT; 590 return -EFAULT;
718 } 591 }
@@ -725,7 +598,7 @@ int su;
725 PortParams.State = PortP->State; 598 PortParams.State = PortP->State;
726 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); 599 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);
727 600
728 if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) { 601 if (copy_to_user(arg, &PortParams, sizeof(struct PortParams))) {
729 p->RIOError.Error = COPYOUT_FAILED; 602 p->RIOError.Error = COPYOUT_FAILED;
730 return -EFAULT; 603 return -EFAULT;
731 } 604 }
@@ -733,8 +606,7 @@ int su;
733 606
734 case RIO_GET_PORT_TTY: 607 case RIO_GET_PORT_TTY:
735 rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); 608 rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n");
736 if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) 609 if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) {
737 == COPYFAIL) {
738 p->RIOError.Error = COPYIN_FAILED; 610 p->RIOError.Error = COPYIN_FAILED;
739 return -EFAULT; 611 return -EFAULT;
740 } 612 }
@@ -745,14 +617,14 @@ int su;
745 617
746 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); 618 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
747 PortP = (p->RIOPortp[PortTty.port]); 619 PortP = (p->RIOPortp[PortTty.port]);
748 if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) { 620 if (copy_to_user(arg, &PortTty, sizeof(struct PortTty))) {
749 p->RIOError.Error = COPYOUT_FAILED; 621 p->RIOError.Error = COPYOUT_FAILED;
750 return -EFAULT; 622 return -EFAULT;
751 } 623 }
752 return retval; 624 return retval;
753 625
754 case RIO_SET_PORT_TTY: 626 case RIO_SET_PORT_TTY:
755 if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) { 627 if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) {
756 p->RIOError.Error = COPYIN_FAILED; 628 p->RIOError.Error = COPYIN_FAILED;
757 return -EFAULT; 629 return -EFAULT;
758 } 630 }
@@ -767,8 +639,7 @@ int su;
767 639
768 case RIO_SET_PORT_PARAMS: 640 case RIO_SET_PORT_PARAMS:
769 rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); 641 rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n");
770 if (copyin((int) arg, (caddr_t) & PortParams, sizeof(PortParams)) 642 if (copy_from_user(&PortParams, arg, sizeof(PortParams))) {
771 == COPYFAIL) {
772 p->RIOError.Error = COPYIN_FAILED; 643 p->RIOError.Error = COPYIN_FAILED;
773 return -EFAULT; 644 return -EFAULT;
774 } 645 }
@@ -784,7 +655,7 @@ int su;
784 655
785 case RIO_GET_PORT_STATS: 656 case RIO_GET_PORT_STATS:
786 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); 657 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
787 if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { 658 if (copy_from_user(&portStats, arg, sizeof(struct portStats))) {
788 p->RIOError.Error = COPYIN_FAILED; 659 p->RIOError.Error = COPYIN_FAILED;
789 return -EFAULT; 660 return -EFAULT;
790 } 661 }
@@ -799,14 +670,14 @@ int su;
799 portStats.opens = PortP->opens; 670 portStats.opens = PortP->opens;
800 portStats.closes = PortP->closes; 671 portStats.closes = PortP->closes;
801 portStats.ioctls = PortP->ioctls; 672 portStats.ioctls = PortP->ioctls;
802 if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) { 673 if (copy_to_user(arg, &portStats, sizeof(struct portStats))) {
803 p->RIOError.Error = COPYOUT_FAILED; 674 p->RIOError.Error = COPYOUT_FAILED;
804 return -EFAULT; 675 return -EFAULT;
805 } 676 }
806 return retval; 677 return retval;
807 678
808 case RIO_RESET_PORT_STATS: 679 case RIO_RESET_PORT_STATS:
809 port = (uint) arg; 680 port = (unsigned long) arg;
810 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); 681 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
811 if (port >= RIO_PORTS) { 682 if (port >= RIO_PORTS) {
812 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 683 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
@@ -824,7 +695,7 @@ int su;
824 695
825 case RIO_GATHER_PORT_STATS: 696 case RIO_GATHER_PORT_STATS:
826 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); 697 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
827 if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { 698 if (copy_from_user(&portStats, arg, sizeof(struct portStats))) {
828 p->RIOError.Error = COPYIN_FAILED; 699 p->RIOError.Error = COPYIN_FAILED;
829 return -EFAULT; 700 return -EFAULT;
830 } 701 }
@@ -840,7 +711,7 @@ int su;
840 711
841 case RIO_READ_CONFIG: 712 case RIO_READ_CONFIG:
842 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); 713 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
843 if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) { 714 if (copy_to_user(arg, &p->RIOConf, sizeof(struct Conf))) {
844 p->RIOError.Error = COPYOUT_FAILED; 715 p->RIOError.Error = COPYOUT_FAILED;
845 return -EFAULT; 716 return -EFAULT;
846 } 717 }
@@ -852,8 +723,7 @@ int su;
852 p->RIOError.Error = NOT_SUPER_USER; 723 p->RIOError.Error = NOT_SUPER_USER;
853 return -EPERM; 724 return -EPERM;
854 } 725 }
855 if (copyin((int) arg, (caddr_t) & p->RIOConf, sizeof(struct Conf)) 726 if (copy_from_user(&p->RIOConf, arg, sizeof(struct Conf))) {
856 == COPYFAIL) {
857 p->RIOError.Error = COPYIN_FAILED; 727 p->RIOError.Error = COPYIN_FAILED;
858 return -EFAULT; 728 return -EFAULT;
859 } 729 }
@@ -862,7 +732,7 @@ int su;
862 */ 732 */
863 for (Host = 0; Host < p->RIONumHosts; Host++) 733 for (Host = 0; Host < p->RIONumHosts; Host++)
864 if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING) 734 if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING)
865 WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer); 735 writew(p->RIOConf.Timer, &p->RIOHosts[Host].ParmMapP->timer);
866 return retval; 736 return retval;
867 737
868 case RIO_START_POLLER: 738 case RIO_START_POLLER:
@@ -881,8 +751,7 @@ int su;
881 case RIO_SETDEBUG: 751 case RIO_SETDEBUG:
882 case RIO_GETDEBUG: 752 case RIO_GETDEBUG:
883 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); 753 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n");
884 if (copyin((int) arg, (caddr_t) & DebugCtrl, sizeof(DebugCtrl)) 754 if (copy_from_user(&DebugCtrl, arg, sizeof(DebugCtrl))) {
885 == COPYFAIL) {
886 p->RIOError.Error = COPYIN_FAILED; 755 p->RIOError.Error = COPYIN_FAILED;
887 return -EFAULT; 756 return -EFAULT;
888 } 757 }
@@ -899,7 +768,7 @@ int su;
899 rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); 768 rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait);
900 DebugCtrl.Debug = p->rio_debug; 769 DebugCtrl.Debug = p->rio_debug;
901 DebugCtrl.Wait = p->RIODebugWait; 770 DebugCtrl.Wait = p->RIODebugWait;
902 if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { 771 if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) {
903 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); 772 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
904 p->RIOError.Error = COPYOUT_FAILED; 773 p->RIOError.Error = COPYOUT_FAILED;
905 return -EFAULT; 774 return -EFAULT;
@@ -921,7 +790,7 @@ int su;
921 } else { 790 } else {
922 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); 791 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
923 DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; 792 DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug;
924 if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { 793 if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) {
925 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); 794 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
926 p->RIOError.Error = COPYOUT_FAILED; 795 p->RIOError.Error = COPYOUT_FAILED;
927 return -EFAULT; 796 return -EFAULT;
@@ -936,43 +805,20 @@ int su;
936 ** textual null terminated string. 805 ** textual null terminated string.
937 */ 806 */
938 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); 807 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n");
939 if (copyout((caddr_t) RIOVersid(), (int) arg, sizeof(struct rioVersion)) == COPYFAIL) { 808 if (copy_to_user(arg, RIOVersid(), sizeof(struct rioVersion))) {
940 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); 809 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
941 p->RIOError.Error = COPYOUT_FAILED; 810 p->RIOError.Error = COPYOUT_FAILED;
942 return -EFAULT; 811 return -EFAULT;
943 } 812 }
944 return retval; 813 return retval;
945 814
946 /*
947 ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
948 ** !! commented out previous 'RIO_VERSID' functionality !!
949 ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
950 **
951 case RIO_VERSID:
952 **
953 ** Enquire about the release and version.
954 ** We return MAX_VERSION_LEN bytes, being a textual null
955 ** terminated string.
956 **
957 rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n"));
958 if (copyout((caddr_t)RIOVersid(),
959 (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) {
960 rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host));
961 p->RIOError.Error = COPYOUT_FAILED;
962 return -EFAULT;
963 }
964 return retval;
965 **
966 ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
967 */
968
969 case RIO_NUM_HOSTS: 815 case RIO_NUM_HOSTS:
970 /* 816 /*
971 ** Enquire as to the number of hosts located 817 ** Enquire as to the number of hosts located
972 ** at init time. 818 ** at init time.
973 */ 819 */
974 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); 820 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
975 if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) { 821 if (copy_to_user(arg, &p->RIONumHosts, sizeof(p->RIONumHosts))) {
976 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); 822 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
977 p->RIOError.Error = COPYOUT_FAILED; 823 p->RIOError.Error = COPYOUT_FAILED;
978 return -EFAULT; 824 return -EFAULT;
@@ -983,7 +829,7 @@ int su;
983 /* 829 /*
984 ** Kill host. This may not be in the final version... 830 ** Kill host. This may not be in the final version...
985 */ 831 */
986 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int) arg); 832 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", (unsigned long) arg);
987 if (!su) { 833 if (!su) {
988 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); 834 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
989 p->RIOError.Error = NOT_SUPER_USER; 835 p->RIOError.Error = NOT_SUPER_USER;
@@ -994,7 +840,7 @@ int su;
994 840
995 for (Host = 0; Host < p->RIONumHosts; Host++) { 841 for (Host = 0; Host < p->RIONumHosts; Host++) {
996 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); 842 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
997 bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags)); 843 memset(&p->RIOHosts[Host].Flags, 0, ((char *) &p->RIOHosts[Host].____end_marker____) - ((char *) &p->RIOHosts[Host].Flags));
998 p->RIOHosts[Host].Flags = RC_WAITING; 844 p->RIOHosts[Host].Flags = RC_WAITING;
999 } 845 }
1000 RIOFoadWakeup(p); 846 RIOFoadWakeup(p);
@@ -1017,7 +863,7 @@ int su;
1017 p->RIOError.Error = NOT_SUPER_USER; 863 p->RIOError.Error = NOT_SUPER_USER;
1018 return -EPERM; 864 return -EPERM;
1019 } 865 }
1020 if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) { 866 if (copy_from_user(&DownLoad, arg, sizeof(DownLoad))) {
1021 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); 867 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
1022 p->RIOError.Error = COPYIN_FAILED; 868 p->RIOError.Error = COPYIN_FAILED;
1023 return -EFAULT; 869 return -EFAULT;
@@ -1045,9 +891,9 @@ int su;
1045 891
1046 case RIO_PARMS: 892 case RIO_PARMS:
1047 { 893 {
1048 uint host; 894 unsigned int host;
1049 895
1050 if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) { 896 if (copy_from_user(&host, arg, sizeof(host))) {
1051 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); 897 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
1052 p->RIOError.Error = COPYIN_FAILED; 898 p->RIOError.Error = COPYIN_FAILED;
1053 return -EFAULT; 899 return -EFAULT;
@@ -1056,7 +902,7 @@ int su;
1056 ** Fetch the parmmap 902 ** Fetch the parmmap
1057 */ 903 */
1058 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); 904 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n");
1059 if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) { 905 if (copy_to_user(arg, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) {
1060 p->RIOError.Error = COPYOUT_FAILED; 906 p->RIOError.Error = COPYOUT_FAILED;
1061 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); 907 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
1062 return -EFAULT; 908 return -EFAULT;
@@ -1066,7 +912,7 @@ int su;
1066 912
1067 case RIO_HOST_REQ: 913 case RIO_HOST_REQ:
1068 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); 914 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
1069 if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) { 915 if (copy_from_user(&HostReq, arg, sizeof(HostReq))) {
1070 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); 916 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
1071 p->RIOError.Error = COPYIN_FAILED; 917 p->RIOError.Error = COPYIN_FAILED;
1072 return -EFAULT; 918 return -EFAULT;
@@ -1078,7 +924,7 @@ int su;
1078 } 924 }
1079 rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); 925 rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
1080 926
1081 if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) { 927 if (copy_to_user(HostReq.HostP, &p->RIOHosts[HostReq.HostNum], sizeof(struct Host))) {
1082 p->RIOError.Error = COPYOUT_FAILED; 928 p->RIOError.Error = COPYOUT_FAILED;
1083 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); 929 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
1084 return -EFAULT; 930 return -EFAULT;
@@ -1087,7 +933,7 @@ int su;
1087 933
1088 case RIO_HOST_DPRAM: 934 case RIO_HOST_DPRAM:
1089 rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); 935 rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n");
1090 if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) { 936 if (copy_from_user(&HostDpRam, arg, sizeof(HostDpRam))) {
1091 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); 937 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
1092 p->RIOError.Error = COPYIN_FAILED; 938 p->RIOError.Error = COPYIN_FAILED;
1093 return -EFAULT; 939 return -EFAULT;
@@ -1104,13 +950,13 @@ int su;
1104 /* It's hardware like this that really gets on my tits. */ 950 /* It's hardware like this that really gets on my tits. */
1105 static unsigned char copy[sizeof(struct DpRam)]; 951 static unsigned char copy[sizeof(struct DpRam)];
1106 for (off = 0; off < sizeof(struct DpRam); off++) 952 for (off = 0; off < sizeof(struct DpRam); off++)
1107 copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off]; 953 copy[off] = readb(&p->RIOHosts[HostDpRam.HostNum].Caddr[off]);
1108 if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { 954 if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) {
1109 p->RIOError.Error = COPYOUT_FAILED; 955 p->RIOError.Error = COPYOUT_FAILED;
1110 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); 956 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
1111 return -EFAULT; 957 return -EFAULT;
1112 } 958 }
1113 } else if (copyout((caddr_t) p->RIOHosts[HostDpRam.HostNum].Caddr, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { 959 } else if (copy_to_user(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) {
1114 p->RIOError.Error = COPYOUT_FAILED; 960 p->RIOError.Error = COPYOUT_FAILED;
1115 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); 961 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
1116 return -EFAULT; 962 return -EFAULT;
@@ -1119,13 +965,13 @@ int su;
1119 965
1120 case RIO_SET_BUSY: 966 case RIO_SET_BUSY:
1121 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); 967 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n");
1122 if ((int) arg < 0 || (int) arg > 511) { 968 if ((unsigned long) arg > 511) {
1123 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n", (int) arg); 969 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", (unsigned long) arg);
1124 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 970 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
1125 return -EINVAL; 971 return -EINVAL;
1126 } 972 }
1127 rio_spin_lock_irqsave(&PortP->portSem, flags); 973 rio_spin_lock_irqsave(&PortP->portSem, flags);
1128 p->RIOPortp[(int) arg]->State |= RIO_BUSY; 974 p->RIOPortp[(unsigned long) arg]->State |= RIO_BUSY;
1129 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 975 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1130 return retval; 976 return retval;
1131 977
@@ -1135,7 +981,7 @@ int su;
1135 ** (probably for debug reasons) 981 ** (probably for debug reasons)
1136 */ 982 */
1137 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); 983 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
1138 if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) { 984 if (copy_from_user(&PortReq, arg, sizeof(PortReq))) {
1139 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); 985 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
1140 p->RIOError.Error = COPYIN_FAILED; 986 p->RIOError.Error = COPYIN_FAILED;
1141 return -EFAULT; 987 return -EFAULT;
@@ -1147,7 +993,7 @@ int su;
1147 return -ENXIO; 993 return -ENXIO;
1148 } 994 }
1149 rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); 995 rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
1150 if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) { 996 if (copy_to_user(PortReq.PortP, p->RIOPortp[PortReq.SysPort], sizeof(struct Port))) {
1151 p->RIOError.Error = COPYOUT_FAILED; 997 p->RIOError.Error = COPYOUT_FAILED;
1152 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); 998 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
1153 return -EFAULT; 999 return -EFAULT;
@@ -1160,7 +1006,7 @@ int su;
1160 ** (probably for debug reasons) 1006 ** (probably for debug reasons)
1161 */ 1007 */
1162 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); 1008 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
1163 if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) { 1009 if (copy_from_user(&RupReq, arg, sizeof(RupReq))) {
1164 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); 1010 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
1165 p->RIOError.Error = COPYIN_FAILED; 1011 p->RIOError.Error = COPYIN_FAILED;
1166 return -EFAULT; 1012 return -EFAULT;
@@ -1184,7 +1030,7 @@ int su;
1184 } 1030 }
1185 rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum); 1031 rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum);
1186 1032
1187 if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) { 1033 if (copy_to_user(HostP->UnixRups[RupReq.RupNum].RupP, RupReq.RupP, sizeof(struct RUP))) {
1188 p->RIOError.Error = COPYOUT_FAILED; 1034 p->RIOError.Error = COPYOUT_FAILED;
1189 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); 1035 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
1190 return -EFAULT; 1036 return -EFAULT;
@@ -1197,7 +1043,7 @@ int su;
1197 ** (probably for debug reasons) 1043 ** (probably for debug reasons)
1198 */ 1044 */
1199 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); 1045 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
1200 if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) { 1046 if (copy_from_user(&LpbReq, arg, sizeof(LpbReq))) {
1201 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); 1047 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
1202 p->RIOError.Error = COPYIN_FAILED; 1048 p->RIOError.Error = COPYIN_FAILED;
1203 return -EFAULT; 1049 return -EFAULT;
@@ -1221,7 +1067,7 @@ int su;
1221 } 1067 }
1222 rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host); 1068 rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host);
1223 1069
1224 if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) { 1070 if (copy_to_user(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) {
1225 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); 1071 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
1226 p->RIOError.Error = COPYOUT_FAILED; 1072 p->RIOError.Error = COPYOUT_FAILED;
1227 return -EFAULT; 1073 return -EFAULT;
@@ -1252,12 +1098,13 @@ int su;
1252 p->RIOError.Error = SIGNALS_ALREADY_SET; 1098 p->RIOError.Error = SIGNALS_ALREADY_SET;
1253 return -EBUSY; 1099 return -EBUSY;
1254 } 1100 }
1255 p->RIOSignalProcess = getpid(); 1101 /* FIXME: PID tracking */
1102 p->RIOSignalProcess = current->pid;
1256 p->RIOPrintDisabled = DONT_PRINT; 1103 p->RIOPrintDisabled = DONT_PRINT;
1257 return retval; 1104 return retval;
1258 1105
1259 case RIO_SIGNALS_OFF: 1106 case RIO_SIGNALS_OFF:
1260 if (p->RIOSignalProcess != getpid()) { 1107 if (p->RIOSignalProcess != current->pid) {
1261 p->RIOError.Error = NOT_RECEIVING_PROCESS; 1108 p->RIOError.Error = NOT_RECEIVING_PROCESS;
1262 return -EPERM; 1109 return -EPERM;
1263 } 1110 }
@@ -1294,7 +1141,7 @@ int su;
1294 case RIO_MAP_B110_TO_110: 1141 case RIO_MAP_B110_TO_110:
1295 case RIO_MAP_B110_TO_115200: 1142 case RIO_MAP_B110_TO_115200:
1296 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); 1143 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n");
1297 port = (uint) arg; 1144 port = (unsigned long) arg;
1298 if (port < 0 || port > 511) { 1145 if (port < 0 || port > 511) {
1299 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); 1146 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
1300 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; 1147 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
@@ -1324,7 +1171,7 @@ int su;
1324 1171
1325 case RIO_SEND_PACKET: 1172 case RIO_SEND_PACKET:
1326 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); 1173 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
1327 if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) { 1174 if (copy_from_user(&SendPack, arg, sizeof(SendPack))) {
1328 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); 1175 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
1329 p->RIOError.Error = COPYIN_FAILED; 1176 p->RIOError.Error = COPYIN_FAILED;
1330 return -EFAULT; 1177 return -EFAULT;
@@ -1344,9 +1191,9 @@ int su;
1344 } 1191 }
1345 1192
1346 for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++) 1193 for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++)
1347 WBYTE(PacketP->data[loop], SendPack.Data[loop]); 1194 writeb(SendPack.Data[loop], &PacketP->data[loop]);
1348 1195
1349 WBYTE(PacketP->len, SendPack.Len); 1196 writeb(SendPack.Len, &PacketP->len);
1350 1197
1351 add_transmit(PortP); 1198 add_transmit(PortP);
1352 /* 1199 /*
@@ -1368,7 +1215,7 @@ int su;
1368 return su ? 0 : -EPERM; 1215 return su ? 0 : -EPERM;
1369 1216
1370 case RIO_WHAT_MESG: 1217 case RIO_WHAT_MESG:
1371 if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) { 1218 if (copy_to_user(arg, &p->RIONoMessage, sizeof(p->RIONoMessage))) {
1372 rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); 1219 rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
1373 p->RIOError.Error = COPYOUT_FAILED; 1220 p->RIOError.Error = COPYOUT_FAILED;
1374 return -EFAULT; 1221 return -EFAULT;
@@ -1376,7 +1223,7 @@ int su;
1376 return 0; 1223 return 0;
1377 1224
1378 case RIO_MEM_DUMP: 1225 case RIO_MEM_DUMP:
1379 if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { 1226 if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) {
1380 p->RIOError.Error = COPYIN_FAILED; 1227 p->RIOError.Error = COPYIN_FAILED;
1381 return -EFAULT; 1228 return -EFAULT;
1382 } 1229 }
@@ -1406,7 +1253,7 @@ int su;
1406 PortP->State |= RIO_BUSY; 1253 PortP->State |= RIO_BUSY;
1407 1254
1408 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 1255 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1409 if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) { 1256 if (copy_to_user(arg, p->RIOMemDump, MEMDUMP_SIZE)) {
1410 rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); 1257 rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
1411 p->RIOError.Error = COPYOUT_FAILED; 1258 p->RIOError.Error = COPYOUT_FAILED;
1412 return -EFAULT; 1259 return -EFAULT;
@@ -1414,30 +1261,30 @@ int su;
1414 return 0; 1261 return 0;
1415 1262
1416 case RIO_TICK: 1263 case RIO_TICK:
1417 if ((int) arg < 0 || (int) arg >= p->RIONumHosts) 1264 if ((unsigned long) arg >= p->RIONumHosts)
1418 return -EINVAL; 1265 return -EINVAL;
1419 rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int) arg); 1266 rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", (unsigned long) arg);
1420 WBYTE(p->RIOHosts[(int) arg].SetInt, 0xff); 1267 writeb(0xFF, &p->RIOHosts[(unsigned long) arg].SetInt);
1421 return 0; 1268 return 0;
1422 1269
1423 case RIO_TOCK: 1270 case RIO_TOCK:
1424 if ((int) arg < 0 || (int) arg >= p->RIONumHosts) 1271 if ((unsigned long) arg >= p->RIONumHosts)
1425 return -EINVAL; 1272 return -EINVAL;
1426 rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int) arg); 1273 rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", (unsigned long) arg);
1427 WBYTE((p->RIOHosts[(int) arg].ResetInt), 0xff); 1274 writeb(0xFF, &p->RIOHosts[(unsigned long) arg].ResetInt);
1428 return 0; 1275 return 0;
1429 1276
1430 case RIO_READ_CHECK: 1277 case RIO_READ_CHECK:
1431 /* Check reads for pkts with data[0] the same */ 1278 /* Check reads for pkts with data[0] the same */
1432 p->RIOReadCheck = !p->RIOReadCheck; 1279 p->RIOReadCheck = !p->RIOReadCheck;
1433 if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) { 1280 if (copy_to_user(arg, &p->RIOReadCheck, sizeof(unsigned int))) {
1434 p->RIOError.Error = COPYOUT_FAILED; 1281 p->RIOError.Error = COPYOUT_FAILED;
1435 return -EFAULT; 1282 return -EFAULT;
1436 } 1283 }
1437 return 0; 1284 return 0;
1438 1285
1439 case RIO_READ_REGISTER: 1286 case RIO_READ_REGISTER:
1440 if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { 1287 if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) {
1441 p->RIOError.Error = COPYIN_FAILED; 1288 p->RIOError.Error = COPYIN_FAILED;
1442 return -EFAULT; 1289 return -EFAULT;
1443 } 1290 }
@@ -1472,7 +1319,7 @@ int su;
1472 PortP->State |= RIO_BUSY; 1319 PortP->State |= RIO_BUSY;
1473 1320
1474 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 1321 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1475 if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) { 1322 if (copy_to_user(arg, &p->CdRegister, sizeof(unsigned int))) {
1476 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); 1323 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
1477 p->RIOError.Error = COPYOUT_FAILED; 1324 p->RIOError.Error = COPYOUT_FAILED;
1478 return -EFAULT; 1325 return -EFAULT;
@@ -1485,21 +1332,22 @@ int su;
1485 */ 1332 */
1486 case RIO_MAKE_DEV: 1333 case RIO_MAKE_DEV:
1487 { 1334 {
1488 uint port = (uint) arg & RIO_MODEM_MASK; 1335 unsigned int port = (unsigned long) arg & RIO_MODEM_MASK;
1336 unsigned int ret;
1489 1337
1490 switch ((uint) arg & RIO_DEV_MASK) { 1338 switch ((unsigned long) arg & RIO_DEV_MASK) {
1491 case RIO_DEV_DIRECT: 1339 case RIO_DEV_DIRECT:
1492 arg = (caddr_t) drv_makedev(MAJOR(dev), port); 1340 ret = drv_makedev(MAJOR(dev), port);
1493 rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, (int) arg); 1341 rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret);
1494 return (int) arg; 1342 return ret;
1495 case RIO_DEV_MODEM: 1343 case RIO_DEV_MODEM:
1496 arg = (caddr_t) drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT)); 1344 ret = drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT));
1497 rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, (int) arg); 1345 rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, ret);
1498 return (int) arg; 1346 return ret;
1499 case RIO_DEV_XPRINT: 1347 case RIO_DEV_XPRINT:
1500 arg = (caddr_t) drv_makedev(MAJOR(dev), port); 1348 ret = drv_makedev(MAJOR(dev), port);
1501 rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, (int) arg); 1349 rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, ret);
1502 return (int) arg; 1350 return ret;
1503 } 1351 }
1504 rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n"); 1352 rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n");
1505 return -EINVAL; 1353 return -EINVAL;
@@ -1513,18 +1361,19 @@ int su;
1513 { 1361 {
1514 dev_t dv; 1362 dev_t dv;
1515 int mino; 1363 int mino;
1364 unsigned long ret;
1516 1365
1517 dv = (dev_t) ((int) arg); 1366 dv = (dev_t) ((unsigned long) arg);
1518 mino = RIO_UNMODEM(dv); 1367 mino = RIO_UNMODEM(dv);
1519 1368
1520 if (RIO_ISMODEM(dv)) { 1369 if (RIO_ISMODEM(dv)) {
1521 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); 1370 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
1522 arg = (caddr_t) (mino | RIO_DEV_MODEM); 1371 ret = mino | RIO_DEV_MODEM;
1523 } else { 1372 } else {
1524 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); 1373 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
1525 arg = (caddr_t) (mino | RIO_DEV_DIRECT); 1374 ret = mino | RIO_DEV_DIRECT;
1526 } 1375 }
1527 return (int) arg; 1376 return ret;
1528 } 1377 }
1529 } 1378 }
1530 rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd); 1379 rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd);
@@ -1537,10 +1386,7 @@ int su;
1537/* 1386/*
1538** Pre-emptive commands go on RUPs and are only one byte long. 1387** Pre-emptive commands go on RUPs and are only one byte long.
1539*/ 1388*/
1540int RIOPreemptiveCmd(p, PortP, Cmd) 1389int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
1541struct rio_info *p;
1542struct Port *PortP;
1543uchar Cmd;
1544{ 1390{
1545 struct CmdBlk *CmdBlkP; 1391 struct CmdBlk *CmdBlkP;
1546 struct PktCmd_M *PktCmdP; 1392 struct PktCmd_M *PktCmdP;
@@ -1558,7 +1404,7 @@ uchar Cmd;
1558 return RIO_FAIL; 1404 return RIO_FAIL;
1559 } 1405 }
1560 1406
1561 rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse); 1407 rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%p - InUse now %d\n", CmdBlkP, PortP->InUse);
1562 1408
1563 PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0]; 1409 PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0];
1564 1410
@@ -1572,7 +1418,7 @@ uchar Cmd;
1572 CmdBlkP->Packet.dest_port = COMMAND_RUP; 1418 CmdBlkP->Packet.dest_port = COMMAND_RUP;
1573 CmdBlkP->Packet.len = PKT_CMD_BIT | 2; 1419 CmdBlkP->Packet.len = PKT_CMD_BIT | 2;
1574 CmdBlkP->PostFuncP = RIOUnUse; 1420 CmdBlkP->PostFuncP = RIOUnUse;
1575 CmdBlkP->PostArg = (int) PortP; 1421 CmdBlkP->PostArg = (unsigned long) PortP;
1576 PktCmdP->Command = Cmd; 1422 PktCmdP->Command = Cmd;
1577 port = PortP->HostPort % (ushort) PORTS_PER_RTA; 1423 port = PortP->HostPort % (ushort) PORTS_PER_RTA;
1578 /* 1424 /*
@@ -1584,38 +1430,38 @@ uchar Cmd;
1584 1430
1585 switch (Cmd) { 1431 switch (Cmd) {
1586 case MEMDUMP: 1432 case MEMDUMP:
1587 rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr); 1433 rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);
1588 PktCmdP->SubCommand = MEMDUMP; 1434 PktCmdP->SubCommand = MEMDUMP;
1589 PktCmdP->SubAddr = SubCmd.Addr; 1435 PktCmdP->SubAddr = SubCmd.Addr;
1590 break; 1436 break;
1591 case FCLOSE: 1437 case FCLOSE:
1592 rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP); 1438 rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%p\n", CmdBlkP);
1593 break; 1439 break;
1594 case READ_REGISTER: 1440 case READ_REGISTER:
1595 rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP); 1441 rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%p\n", (int) SubCmd.Addr, CmdBlkP);
1596 PktCmdP->SubCommand = READ_REGISTER; 1442 PktCmdP->SubCommand = READ_REGISTER;
1597 PktCmdP->SubAddr = SubCmd.Addr; 1443 PktCmdP->SubAddr = SubCmd.Addr;
1598 break; 1444 break;
1599 case RESUME: 1445 case RESUME:
1600 rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n", (int) CmdBlkP); 1446 rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%p\n", CmdBlkP);
1601 break; 1447 break;
1602 case RFLUSH: 1448 case RFLUSH:
1603 rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n", (int) CmdBlkP); 1449 rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%p\n", CmdBlkP);
1604 CmdBlkP->PostFuncP = RIORFlushEnable; 1450 CmdBlkP->PostFuncP = RIORFlushEnable;
1605 break; 1451 break;
1606 case SUSPEND: 1452 case SUSPEND:
1607 rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n", (int) CmdBlkP); 1453 rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%p\n", CmdBlkP);
1608 break; 1454 break;
1609 1455
1610 case MGET: 1456 case MGET:
1611 rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int) CmdBlkP); 1457 rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%p\n", CmdBlkP);
1612 break; 1458 break;
1613 1459
1614 case MSET: 1460 case MSET:
1615 case MBIC: 1461 case MBIC:
1616 case MBIS: 1462 case MBIS:
1617 CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; 1463 CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
1618 rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int) CmdBlkP); 1464 rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%p\n", CmdBlkP);
1619 break; 1465 break;
1620 1466
1621 case WFLUSH: 1467 case WFLUSH:
@@ -1629,7 +1475,7 @@ uchar Cmd;
1629 RIOFreeCmdBlk(CmdBlkP); 1475 RIOFreeCmdBlk(CmdBlkP);
1630 return (RIO_FAIL); 1476 return (RIO_FAIL);
1631 } else { 1477 } else {
1632 rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP); 1478 rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%p\n", CmdBlkP);
1633 CmdBlkP->PostFuncP = RIOWFlushMark; 1479 CmdBlkP->PostFuncP = RIOWFlushMark;
1634 } 1480 }
1635 break; 1481 break;