diff options
Diffstat (limited to 'drivers/char/rio/riocmd.c')
-rw-r--r-- | drivers/char/rio/riocmd.c | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 08fcac1f12de..e6d2b14b5e65 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -51,15 +51,12 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; | |||
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" |
@@ -72,12 +69,10 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; | |||
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 | 77 | ||
83 | 78 | ||
@@ -148,7 +143,7 @@ int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (stru | |||
148 | { | 143 | { |
149 | unsigned int Host; | 144 | unsigned int Host; |
150 | 145 | ||
151 | rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func 0x%p\n", RtaUnique, func); | 146 | rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func %p\n", RtaUnique, func); |
152 | 147 | ||
153 | if (!RtaUnique) | 148 | if (!RtaUnique) |
154 | return (0); | 149 | return (0); |
@@ -375,7 +370,7 @@ int RIOFoadWakeup(struct rio_info *p) | |||
375 | /* | 370 | /* |
376 | ** Incoming command on the COMMAND_RUP to be processed. | 371 | ** Incoming command on the COMMAND_RUP to be processed. |
377 | */ | 372 | */ |
378 | static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) | 373 | static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT * PacketP) |
379 | { | 374 | { |
380 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; | 375 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; |
381 | struct Port *PortP; | 376 | struct Port *PortP; |
@@ -418,7 +413,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
418 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); | 413 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); |
419 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum); | 414 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum); |
420 | rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); | 415 | rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); |
421 | return TRUE; | 416 | return 1; |
422 | } | 417 | } |
423 | PortP = p->RIOPortp[SysPort]; | 418 | PortP = p->RIOPortp[SysPort]; |
424 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 419 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
@@ -427,7 +422,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
427 | rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); | 422 | rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); |
428 | /* If the current line disc. is not multi-threading and | 423 | /* If the current line disc. is not multi-threading and |
429 | the current processor is not the default, reset rup_intr | 424 | the current processor is not the default, reset rup_intr |
430 | and return FALSE to ensure that the command packet is | 425 | and return 0 to ensure that the command packet is |
431 | not freed. */ | 426 | not freed. */ |
432 | /* Call tmgr HANGUP HERE */ | 427 | /* Call tmgr HANGUP HERE */ |
433 | /* Fix this later when every thing works !!!! RAMRAJ */ | 428 | /* Fix this later when every thing works !!!! RAMRAJ */ |
@@ -541,7 +536,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * | |||
541 | 536 | ||
542 | func_exit(); | 537 | func_exit(); |
543 | 538 | ||
544 | return TRUE; | 539 | return 1; |
545 | } | 540 | } |
546 | 541 | ||
547 | /* | 542 | /* |
@@ -600,13 +595,13 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
600 | ** straight on the RUP.... | 595 | ** straight on the RUP.... |
601 | */ | 596 | */ |
602 | if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) | 597 | if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) |
603 | : TRUE)) { | 598 | : 1)) { |
604 | rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); | 599 | rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); |
605 | 600 | ||
606 | /* | 601 | /* |
607 | ** Whammy! blat that pack! | 602 | ** Whammy! blat that pack! |
608 | */ | 603 | */ |
609 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); | 604 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); |
610 | 605 | ||
611 | /* | 606 | /* |
612 | ** place command packet on the pending position. | 607 | ** place command packet on the pending position. |
@@ -620,7 +615,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
620 | 615 | ||
621 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 616 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
622 | 617 | ||
623 | return RIO_SUCCESS; | 618 | return 0; |
624 | } | 619 | } |
625 | rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n"); | 620 | rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n"); |
626 | 621 | ||
@@ -633,15 +628,15 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
633 | 628 | ||
634 | Base = &UnixRupP->CmdsWaitingP; | 629 | Base = &UnixRupP->CmdsWaitingP; |
635 | 630 | ||
636 | rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); | 631 | rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk %p at %p\n", CmdBlkP, Base); |
637 | 632 | ||
638 | while (*Base) { | 633 | while (*Base) { |
639 | rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%p here\n", *Base); | 634 | rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk %p here\n", *Base); |
640 | Base = &((*Base)->NextP); | 635 | Base = &((*Base)->NextP); |
641 | rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); | 636 | rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk %p at %p\n", CmdBlkP, Base); |
642 | } | 637 | } |
643 | 638 | ||
644 | rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); | 639 | rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk %p at %p\n", CmdBlkP, Base); |
645 | 640 | ||
646 | *Base = CmdBlkP; | 641 | *Base = CmdBlkP; |
647 | 642 | ||
@@ -649,7 +644,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
649 | 644 | ||
650 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 645 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
651 | 646 | ||
652 | return RIO_SUCCESS; | 647 | return 0; |
653 | } | 648 | } |
654 | 649 | ||
655 | /* | 650 | /* |
@@ -681,9 +676,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
681 | if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { | 676 | if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { |
682 | int FreeMe; | 677 | int FreeMe; |
683 | 678 | ||
684 | PacketP = (PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); | 679 | PacketP = (struct PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); |
685 | |||
686 | ShowPacket(DBG_CMD, PacketP); | ||
687 | 680 | ||
688 | switch (readb(&PacketP->dest_port)) { | 681 | switch (readb(&PacketP->dest_port)) { |
689 | case BOOT_RUP: | 682 | case BOOT_RUP: |
@@ -749,7 +742,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
749 | if (CmdBlkP->Packet.dest_port == BOOT_RUP) | 742 | if (CmdBlkP->Packet.dest_port == BOOT_RUP) |
750 | rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); | 743 | rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); |
751 | 744 | ||
752 | rio_dprintk(RIO_DEBUG_CMD, "Command 0x%p completed\n", CmdBlkP); | 745 | rio_dprintk(RIO_DEBUG_CMD, "Command %p completed\n", CmdBlkP); |
753 | 746 | ||
754 | /* | 747 | /* |
755 | ** Clear the Rup lock to prevent mutual exclusion. | 748 | ** Clear the Rup lock to prevent mutual exclusion. |
@@ -782,14 +775,14 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
782 | ** If it returns RIO_FAIL then don't | 775 | ** If it returns RIO_FAIL then don't |
783 | ** send this command yet! | 776 | ** send this command yet! |
784 | */ | 777 | */ |
785 | if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { | 778 | if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : 1)) { |
786 | rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%p\n", CmdBlkP); | 779 | rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command %p\n", CmdBlkP); |
787 | } else { | 780 | } else { |
788 | rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]); | 781 | rio_dprintk(RIO_DEBUG_CMD, "Start new command %p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]); |
789 | /* | 782 | /* |
790 | ** Whammy! blat that pack! | 783 | ** Whammy! blat that pack! |
791 | */ | 784 | */ |
792 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); | 785 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); |
793 | 786 | ||
794 | /* | 787 | /* |
795 | ** remove the command from the rup command queue... | 788 | ** remove the command from the rup command queue... |
@@ -831,14 +824,13 @@ int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP) | |||
831 | int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) | 824 | int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) |
832 | { | 825 | { |
833 | struct Port *PortP = (struct Port *) iPortP; | 826 | struct Port *PortP = (struct Port *) iPortP; |
834 | PKT *PacketP; | 827 | struct PKT *PacketP; |
835 | unsigned long flags; | 828 | unsigned long flags; |
836 | 829 | ||
837 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 830 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
838 | 831 | ||
839 | while (can_remove_receive(&PacketP, PortP)) { | 832 | while (can_remove_receive(&PacketP, PortP)) { |
840 | remove_receive(PortP); | 833 | remove_receive(PortP); |
841 | ShowPacket(DBG_PROC, PacketP); | ||
842 | put_free_end(PortP->HostP, PacketP); | 834 | put_free_end(PortP->HostP, PacketP); |
843 | } | 835 | } |
844 | 836 | ||
@@ -892,10 +884,6 @@ int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP) | |||
892 | return 0; | 884 | return 0; |
893 | } | 885 | } |
894 | 886 | ||
895 | void ShowPacket(uint Flags, struct PKT *PacketP) | ||
896 | { | ||
897 | } | ||
898 | |||
899 | /* | 887 | /* |
900 | ** | 888 | ** |
901 | ** How to use this file: | 889 | ** How to use this file: |