diff options
Diffstat (limited to 'drivers/char/rio/riocmd.c')
-rw-r--r-- | drivers/char/rio/riocmd.c | 142 |
1 files changed, 68 insertions, 74 deletions
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 694bfb9d9378..08fcac1f12de 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -42,6 +42,7 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; | |||
42 | #include <asm/system.h> | 42 | #include <asm/system.h> |
43 | #include <asm/string.h> | 43 | #include <asm/string.h> |
44 | #include <asm/semaphore.h> | 44 | #include <asm/semaphore.h> |
45 | #include <asm/uaccess.h> | ||
45 | 46 | ||
46 | #include <linux/termios.h> | 47 | #include <linux/termios.h> |
47 | #include <linux/serial.h> | 48 | #include <linux/serial.h> |
@@ -143,17 +144,17 @@ int RIOZombieRta(struct Host *HostP, struct Map *MapP) | |||
143 | return 0; | 144 | return 0; |
144 | } | 145 | } |
145 | 146 | ||
146 | int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) | 147 | int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) |
147 | { | 148 | { |
148 | uint Host; | 149 | unsigned int Host; |
149 | 150 | ||
150 | rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int) func); | 151 | rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func 0x%p\n", RtaUnique, func); |
151 | 152 | ||
152 | if (!RtaUnique) | 153 | if (!RtaUnique) |
153 | return (0); | 154 | return (0); |
154 | 155 | ||
155 | for (Host = 0; Host < p->RIONumHosts; Host++) { | 156 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
156 | uint Rta; | 157 | unsigned int Rta; |
157 | struct Host *HostP = &p->RIOHosts[Host]; | 158 | struct Host *HostP = &p->RIOHosts[Host]; |
158 | 159 | ||
159 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { | 160 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { |
@@ -170,7 +171,7 @@ int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * | |||
170 | ** any connections, we can get to it. | 171 | ** any connections, we can get to it. |
171 | */ | 172 | */ |
172 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { | 173 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { |
173 | if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { | 174 | if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) { |
174 | /* | 175 | /* |
175 | ** Its worth trying the operation... | 176 | ** Its worth trying the operation... |
176 | */ | 177 | */ |
@@ -184,18 +185,18 @@ int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * | |||
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | int RIOIdentifyRta(struct rio_info *p, caddr_t arg) | 188 | int RIOIdentifyRta(struct rio_info *p, void * arg) |
188 | { | 189 | { |
189 | uint Host; | 190 | unsigned int Host; |
190 | 191 | ||
191 | if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) { | 192 | if (copy_from_user(&IdRta, arg, sizeof(IdRta))) { |
192 | rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); | 193 | rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); |
193 | p->RIOError.Error = COPYIN_FAILED; | 194 | p->RIOError.Error = COPYIN_FAILED; |
194 | return -EFAULT; | 195 | return -EFAULT; |
195 | } | 196 | } |
196 | 197 | ||
197 | for (Host = 0; Host < p->RIONumHosts; Host++) { | 198 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
198 | uint Rta; | 199 | unsigned int Rta; |
199 | struct Host *HostP = &p->RIOHosts[Host]; | 200 | struct Host *HostP = &p->RIOHosts[Host]; |
200 | 201 | ||
201 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { | 202 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { |
@@ -211,7 +212,7 @@ int RIOIdentifyRta(struct rio_info *p, caddr_t arg) | |||
211 | ** any connections, we can get to it. | 212 | ** any connections, we can get to it. |
212 | */ | 213 | */ |
213 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { | 214 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { |
214 | if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { | 215 | if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) { |
215 | /* | 216 | /* |
216 | ** Its worth trying the operation... | 217 | ** Its worth trying the operation... |
217 | */ | 218 | */ |
@@ -249,7 +250,7 @@ int RIOIdentifyRta(struct rio_info *p, caddr_t arg) | |||
249 | } | 250 | } |
250 | 251 | ||
251 | 252 | ||
252 | int RIOKillNeighbour(struct rio_info *p, caddr_t arg) | 253 | int RIOKillNeighbour(struct rio_info *p, void * arg) |
253 | { | 254 | { |
254 | uint Host; | 255 | uint Host; |
255 | uint ID; | 256 | uint ID; |
@@ -258,7 +259,7 @@ int RIOKillNeighbour(struct rio_info *p, caddr_t arg) | |||
258 | 259 | ||
259 | rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); | 260 | rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); |
260 | 261 | ||
261 | if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) { | 262 | if (copy_from_user(&KillUnit, arg, sizeof(KillUnit))) { |
262 | rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); | 263 | rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); |
263 | p->RIOError.Error = COPYIN_FAILED; | 264 | p->RIOError.Error = COPYIN_FAILED; |
264 | return -EFAULT; | 265 | return -EFAULT; |
@@ -344,7 +345,7 @@ int RIOSuspendBootRta(struct Host *HostP, int ID, int Link) | |||
344 | int RIOFoadWakeup(struct rio_info *p) | 345 | int RIOFoadWakeup(struct rio_info *p) |
345 | { | 346 | { |
346 | int port; | 347 | int port; |
347 | register struct Port *PortP; | 348 | struct Port *PortP; |
348 | unsigned long flags; | 349 | unsigned long flags; |
349 | 350 | ||
350 | for (port = 0; port < RIO_PORTS; port++) { | 351 | for (port = 0; port < RIO_PORTS; port++) { |
@@ -379,10 +380,10 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
379 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; | 380 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; |
380 | struct Port *PortP; | 381 | struct Port *PortP; |
381 | struct UnixRup *UnixRupP; | 382 | struct UnixRup *UnixRupP; |
382 | ushort SysPort; | 383 | unsigned short SysPort; |
383 | ushort ReportedModemStatus; | 384 | unsigned short ReportedModemStatus; |
384 | ushort rup; | 385 | unsigned short rup; |
385 | ushort subCommand; | 386 | unsigned short subCommand; |
386 | unsigned long flags; | 387 | unsigned long flags; |
387 | 388 | ||
388 | func_enter(); | 389 | func_enter(); |
@@ -395,18 +396,18 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
395 | ** we can use PhbNum to get the rup number for the appropriate 8 port | 396 | ** we can use PhbNum to get the rup number for the appropriate 8 port |
396 | ** block (for the first block, this should be equal to 'Rup'). | 397 | ** block (for the first block, this should be equal to 'Rup'). |
397 | */ | 398 | */ |
398 | rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA; | 399 | rup = readb(&PktCmdP->PhbNum) / (unsigned short) PORTS_PER_RTA; |
399 | UnixRupP = &HostP->UnixRups[rup]; | 400 | UnixRupP = &HostP->UnixRups[rup]; |
400 | SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); | 401 | SysPort = UnixRupP->BaseSysPort + (readb(&PktCmdP->PhbNum) % (unsigned short) PORTS_PER_RTA); |
401 | rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); | 402 | rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); |
402 | 403 | ||
403 | if (UnixRupP->BaseSysPort == NO_PORT) { | 404 | if (UnixRupP->BaseSysPort == NO_PORT) { |
404 | rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); | 405 | rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); |
405 | rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); | 406 | rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); |
406 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); | 407 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); |
407 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); | 408 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); |
408 | 409 | ||
409 | if (Rup >= (ushort) MAX_RUP) { | 410 | if (Rup >= (unsigned short) MAX_RUP) { |
410 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name); | 411 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name); |
411 | } else | 412 | } else |
412 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); | 413 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); |
@@ -421,7 +422,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
421 | } | 422 | } |
422 | PortP = p->RIOPortp[SysPort]; | 423 | PortP = p->RIOPortp[SysPort]; |
423 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 424 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
424 | switch (RBYTE(PktCmdP->Command)) { | 425 | switch (readb(&PktCmdP->Command)) { |
425 | case BREAK_RECEIVED: | 426 | case BREAK_RECEIVED: |
426 | rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); | 427 | rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); |
427 | /* If the current line disc. is not multi-threading and | 428 | /* If the current line disc. is not multi-threading and |
@@ -434,15 +435,15 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
434 | break; | 435 | break; |
435 | 436 | ||
436 | case COMPLETE: | 437 | case COMPLETE: |
437 | rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts); | 438 | rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %Zd\n", readb(&PktCmdP->PhbNum), HostP - p->RIOHosts); |
438 | subCommand = 1; | 439 | subCommand = 1; |
439 | switch (RBYTE(PktCmdP->SubCommand)) { | 440 | switch (readb(&PktCmdP->SubCommand)) { |
440 | case MEMDUMP: | 441 | case MEMDUMP: |
441 | rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); | 442 | rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", readb(&PktCmdP->SubCommand), readw(&PktCmdP->SubAddr)); |
442 | break; | 443 | break; |
443 | case READ_REGISTER: | 444 | case READ_REGISTER: |
444 | rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); | 445 | rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", readw(&PktCmdP->SubAddr)); |
445 | p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); | 446 | p->CdRegister = (readb(&PktCmdP->ModemStatus) & MSVR1_HOST); |
446 | break; | 447 | break; |
447 | default: | 448 | default: |
448 | subCommand = 0; | 449 | subCommand = 0; |
@@ -450,10 +451,10 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
450 | } | 451 | } |
451 | if (subCommand) | 452 | if (subCommand) |
452 | break; | 453 | break; |
453 | rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState); | 454 | rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", readb(&PktCmdP->PortStatus), PortP->PortState); |
454 | if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { | 455 | if (PortP->PortState != readb(&PktCmdP->PortStatus)) { |
455 | rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n"); | 456 | rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n"); |
456 | PortP->PortState = RBYTE(PktCmdP->PortStatus); | 457 | PortP->PortState = readb(&PktCmdP->PortStatus); |
457 | /* What should we do here ... | 458 | /* What should we do here ... |
458 | wakeup( &PortP->PortState ); | 459 | wakeup( &PortP->PortState ); |
459 | */ | 460 | */ |
@@ -467,7 +468,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
467 | ** to the check for modem status change (they're just there because | 468 | ** to the check for modem status change (they're just there because |
468 | ** it's a convenient place to put them!). | 469 | ** it's a convenient place to put them!). |
469 | */ | 470 | */ |
470 | ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); | 471 | ReportedModemStatus = readb(&PktCmdP->ModemStatus); |
471 | if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) { | 472 | if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) { |
472 | rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); | 473 | rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); |
473 | /* | 474 | /* |
@@ -514,9 +515,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
514 | */ | 515 | */ |
515 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) | 516 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) |
516 | wake_up_interruptible(&PortP->gs.open_wait); | 517 | wake_up_interruptible(&PortP->gs.open_wait); |
517 | #ifdef STATS | ||
518 | PortP->Stat.ModemOnCnt++; | ||
519 | #endif | ||
520 | } | 518 | } |
521 | } else { | 519 | } else { |
522 | /* | 520 | /* |
@@ -527,9 +525,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
527 | tty_hangup(PortP->gs.tty); | 525 | tty_hangup(PortP->gs.tty); |
528 | PortP->State &= ~RIO_CARR_ON; | 526 | PortP->State &= ~RIO_CARR_ON; |
529 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); | 527 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); |
530 | #ifdef STATS | ||
531 | PortP->Stat.ModemOffCnt++; | ||
532 | #endif | ||
533 | } | 528 | } |
534 | } | 529 | } |
535 | } | 530 | } |
@@ -539,7 +534,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
539 | break; | 534 | break; |
540 | 535 | ||
541 | default: | 536 | default: |
542 | rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts); | 537 | rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %Zd\n", readb(&PktCmdP->Command), HostP - p->RIOHosts); |
543 | break; | 538 | break; |
544 | } | 539 | } |
545 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 540 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
@@ -566,10 +561,9 @@ struct CmdBlk *RIOGetCmdBlk(void) | |||
566 | { | 561 | { |
567 | struct CmdBlk *CmdBlkP; | 562 | struct CmdBlk *CmdBlkP; |
568 | 563 | ||
569 | CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk)); | 564 | CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); |
570 | if (CmdBlkP) | 565 | if (CmdBlkP) |
571 | bzero(CmdBlkP, sizeof(struct CmdBlk)); | 566 | memset(CmdBlkP, 0, sizeof(struct CmdBlk)); |
572 | |||
573 | return CmdBlkP; | 567 | return CmdBlkP; |
574 | } | 568 | } |
575 | 569 | ||
@@ -578,7 +572,7 @@ struct CmdBlk *RIOGetCmdBlk(void) | |||
578 | */ | 572 | */ |
579 | void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) | 573 | void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) |
580 | { | 574 | { |
581 | sysfree((void *) CmdBlkP, sizeof(struct CmdBlk)); | 575 | kfree(CmdBlkP); |
582 | } | 576 | } |
583 | 577 | ||
584 | /* | 578 | /* |
@@ -591,7 +585,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
591 | struct UnixRup *UnixRupP; | 585 | struct UnixRup *UnixRupP; |
592 | unsigned long flags; | 586 | unsigned long flags; |
593 | 587 | ||
594 | if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { | 588 | if (Rup >= (unsigned short) (MAX_RUP + LINKS_PER_UNIT)) { |
595 | rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); | 589 | rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); |
596 | RIOFreeCmdBlk(CmdBlkP); | 590 | RIOFreeCmdBlk(CmdBlkP); |
597 | return RIO_FAIL; | 591 | return RIO_FAIL; |
@@ -605,7 +599,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
605 | ** If the RUP is currently inactive, then put the request | 599 | ** If the RUP is currently inactive, then put the request |
606 | ** straight on the RUP.... | 600 | ** straight on the RUP.... |
607 | */ | 601 | */ |
608 | if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) | 602 | if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) |
609 | : TRUE)) { | 603 | : TRUE)) { |
610 | rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); | 604 | rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); |
611 | 605 | ||
@@ -622,7 +616,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
622 | /* | 616 | /* |
623 | ** set the command register | 617 | ** set the command register |
624 | */ | 618 | */ |
625 | WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); | 619 | writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol); |
626 | 620 | ||
627 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 621 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
628 | 622 | ||
@@ -634,20 +628,20 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
634 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n"); | 628 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n"); |
635 | if (UnixRupP->CmdPendingP != NULL) | 629 | if (UnixRupP->CmdPendingP != NULL) |
636 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n"); | 630 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n"); |
637 | if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) | 631 | if (readw(&UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) |
638 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); | 632 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); |
639 | 633 | ||
640 | Base = &UnixRupP->CmdsWaitingP; | 634 | Base = &UnixRupP->CmdsWaitingP; |
641 | 635 | ||
642 | rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); | 636 | rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); |
643 | 637 | ||
644 | while (*Base) { | 638 | while (*Base) { |
645 | rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base)); | 639 | rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%p here\n", *Base); |
646 | Base = &((*Base)->NextP); | 640 | Base = &((*Base)->NextP); |
647 | rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); | 641 | rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); |
648 | } | 642 | } |
649 | 643 | ||
650 | rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); | 644 | rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); |
651 | 645 | ||
652 | *Base = CmdBlkP; | 646 | *Base = CmdBlkP; |
653 | 647 | ||
@@ -664,10 +658,10 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
664 | */ | 658 | */ |
665 | void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | 659 | void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) |
666 | { | 660 | { |
667 | register struct CmdBlk *CmdBlkP; | 661 | struct CmdBlk *CmdBlkP; |
668 | register struct UnixRup *UnixRupP; | 662 | struct UnixRup *UnixRupP; |
669 | struct PKT *PacketP; | 663 | struct PKT *PacketP; |
670 | ushort Rup; | 664 | unsigned short Rup; |
671 | unsigned long flags; | 665 | unsigned long flags; |
672 | 666 | ||
673 | 667 | ||
@@ -684,16 +678,16 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
684 | /* | 678 | /* |
685 | ** First check for incoming commands: | 679 | ** First check for incoming commands: |
686 | */ | 680 | */ |
687 | if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { | 681 | if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { |
688 | int FreeMe; | 682 | int FreeMe; |
689 | 683 | ||
690 | PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt)); | 684 | PacketP = (PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); |
691 | 685 | ||
692 | ShowPacket(DBG_CMD, PacketP); | 686 | ShowPacket(DBG_CMD, PacketP); |
693 | 687 | ||
694 | switch (RBYTE(PacketP->dest_port)) { | 688 | switch (readb(&PacketP->dest_port)) { |
695 | case BOOT_RUP: | 689 | case BOOT_RUP: |
696 | rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0])); | 690 | rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", readb(&PacketP->len) & 0x80 ? "Command" : "Data", readb(&PacketP->data[0])); |
697 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 691 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
698 | FreeMe = RIOBootRup(p, Rup, HostP, PacketP); | 692 | FreeMe = RIOBootRup(p, Rup, HostP, PacketP); |
699 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | 693 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
@@ -708,7 +702,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
708 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 702 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
709 | FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); | 703 | FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); |
710 | if (PacketP->data[5] == MEMDUMP) { | 704 | if (PacketP->data[5] == MEMDUMP) { |
711 | rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6])); | 705 | rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(unsigned short *) & (PacketP->data[6])); |
712 | HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32); | 706 | HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32); |
713 | } | 707 | } |
714 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | 708 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
@@ -721,7 +715,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
721 | break; | 715 | break; |
722 | 716 | ||
723 | default: | 717 | default: |
724 | rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); | 718 | rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", readb(&PacketP->dest_port)); |
725 | FreeMe = 1; | 719 | FreeMe = 1; |
726 | break; | 720 | break; |
727 | } | 721 | } |
@@ -730,11 +724,11 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
730 | rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n"); | 724 | rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n"); |
731 | put_free_end(HostP, PacketP); | 725 | put_free_end(HostP, PacketP); |
732 | 726 | ||
733 | WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE); | 727 | writew(RX_RUP_INACTIVE, &UnixRupP->RupP->rxcontrol); |
734 | 728 | ||
735 | if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { | 729 | if (readw(&UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { |
736 | rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup); | 730 | rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup); |
737 | WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); | 731 | writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &UnixRupP->RupP->handshake); |
738 | } | 732 | } |
739 | } | 733 | } |
740 | } | 734 | } |
@@ -744,7 +738,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
744 | ** and it has completed, then tidy it up. | 738 | ** and it has completed, then tidy it up. |
745 | */ | 739 | */ |
746 | if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ | 740 | if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ |
747 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | 741 | (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { |
748 | /* | 742 | /* |
749 | ** we are idle. | 743 | ** we are idle. |
750 | ** there is a command in pending. | 744 | ** there is a command in pending. |
@@ -755,7 +749,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
755 | if (CmdBlkP->Packet.dest_port == BOOT_RUP) | 749 | if (CmdBlkP->Packet.dest_port == BOOT_RUP) |
756 | rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); | 750 | rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); |
757 | 751 | ||
758 | rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP); | 752 | rio_dprintk(RIO_DEBUG_CMD, "Command 0x%p completed\n", CmdBlkP); |
759 | 753 | ||
760 | /* | 754 | /* |
761 | ** Clear the Rup lock to prevent mutual exclusion. | 755 | ** Clear the Rup lock to prevent mutual exclusion. |
@@ -782,16 +776,16 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
782 | ** is idle, then process the command | 776 | ** is idle, then process the command |
783 | */ | 777 | */ |
784 | if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ | 778 | if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ |
785 | (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | 779 | (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { |
786 | /* | 780 | /* |
787 | ** if the pre-function is non-zero, call it. | 781 | ** if the pre-function is non-zero, call it. |
788 | ** If it returns RIO_FAIL then don't | 782 | ** If it returns RIO_FAIL then don't |
789 | ** send this command yet! | 783 | ** send this command yet! |
790 | */ | 784 | */ |
791 | if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { | 785 | if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { |
792 | rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); | 786 | rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%p\n", CmdBlkP); |
793 | } else { | 787 | } else { |
794 | rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]); | 788 | rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]); |
795 | /* | 789 | /* |
796 | ** Whammy! blat that pack! | 790 | ** Whammy! blat that pack! |
797 | */ | 791 | */ |
@@ -810,7 +804,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
810 | /* | 804 | /* |
811 | ** set the command register | 805 | ** set the command register |
812 | */ | 806 | */ |
813 | WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); | 807 | writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol); |
814 | 808 | ||
815 | /* | 809 | /* |
816 | ** the command block will be freed | 810 | ** the command block will be freed |
@@ -822,7 +816,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
822 | } while (Rup); | 816 | } while (Rup); |
823 | } | 817 | } |
824 | 818 | ||
825 | int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) | 819 | int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP) |
826 | { | 820 | { |
827 | struct Port *PortP = (struct Port *) iPortP; | 821 | struct Port *PortP = (struct Port *) iPortP; |
828 | unsigned long flags; | 822 | unsigned long flags; |
@@ -834,7 +828,7 @@ int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) | |||
834 | return RIOUnUse(iPortP, CmdBlkP); | 828 | return RIOUnUse(iPortP, CmdBlkP); |
835 | } | 829 | } |
836 | 830 | ||
837 | int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) | 831 | int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) |
838 | { | 832 | { |
839 | struct Port *PortP = (struct Port *) iPortP; | 833 | struct Port *PortP = (struct Port *) iPortP; |
840 | PKT *PacketP; | 834 | PKT *PacketP; |
@@ -848,19 +842,19 @@ int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) | |||
848 | put_free_end(PortP->HostP, PacketP); | 842 | put_free_end(PortP->HostP, PacketP); |
849 | } | 843 | } |
850 | 844 | ||
851 | if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { | 845 | if (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { |
852 | /* | 846 | /* |
853 | ** MAGIC! (Basically, handshake the RX buffer, so that | 847 | ** MAGIC! (Basically, handshake the RX buffer, so that |
854 | ** the RTAs upstream can be re-enabled.) | 848 | ** the RTAs upstream can be re-enabled.) |
855 | */ | 849 | */ |
856 | rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); | 850 | rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); |
857 | WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); | 851 | writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake); |
858 | } | 852 | } |
859 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 853 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
860 | return RIOUnUse(iPortP, CmdBlkP); | 854 | return RIOUnUse(iPortP, CmdBlkP); |
861 | } | 855 | } |
862 | 856 | ||
863 | int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) | 857 | int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP) |
864 | { | 858 | { |
865 | struct Port *PortP = (struct Port *) iPortP; | 859 | struct Port *PortP = (struct Port *) iPortP; |
866 | unsigned long flags; | 860 | unsigned long flags; |
@@ -890,7 +884,7 @@ int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) | |||
890 | ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data | 884 | ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data |
891 | ** hanging around in the transmit buffer is sent immediately. | 885 | ** hanging around in the transmit buffer is sent immediately. |
892 | */ | 886 | */ |
893 | WWORD(PortP->HostP->ParmMapP->tx_intr, 1); | 887 | writew(1, &PortP->HostP->ParmMapP->tx_intr); |
894 | /* What to do here .. | 888 | /* What to do here .. |
895 | wakeup( (caddr_t)&(PortP->InUse) ); | 889 | wakeup( (caddr_t)&(PortP->InUse) ); |
896 | */ | 890 | */ |