x86_64: Geode HW Random Number Generator depends on X86_32
[safe/jmp/linux-2.6] / drivers / char / rio / riocmd.c
index 595f7a9..7321d00 100644 (file)
@@ -402,17 +402,17 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
                rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
                rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number  0x%x\n", rup);
 
-               if (Rup >= (unsigned short) MAX_RUP) {
+               if (Rup < (unsigned short) MAX_RUP) {
                        rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
                } else
                        rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);
 
-               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", PacketP->dest_unit, PacketP->dest_port);
-               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source    0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port);
-               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length    0x%x (%d)\n", PacketP->len, PacketP->len);
-               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control  0x%x (%d)\n", PacketP->control, PacketP->control);
-               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check      0x%x (%d)\n", PacketP->csum, PacketP->csum);
-               rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command);
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", readb(&PacketP->dest_unit), readb(&PacketP->dest_port));
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source    0x%x:0x%x\n", readb(&PacketP->src_unit), readb(&PacketP->src_port));
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length    0x%x (%d)\n", readb(&PacketP->len), readb(&PacketP->len));
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control  0x%x (%d)\n", readb(&PacketP->control), readb(&PacketP->control));
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check      0x%x (%d)\n", readw(&PacketP->csum), readw(&PacketP->csum));
+               rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", readb(&PktCmdP->PhbNum), readb(&PktCmdP->Command));
                return 1;
        }
        PortP = p->RIOPortp[SysPort];
@@ -556,9 +556,7 @@ struct CmdBlk *RIOGetCmdBlk(void)
 {
        struct CmdBlk *CmdBlkP;
 
-       CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
-       if (CmdBlkP)
-               memset(CmdBlkP, 0, sizeof(struct CmdBlk));
+       CmdBlkP = kzalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
        return CmdBlkP;
 }
 
@@ -601,7 +599,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
                /*
                 ** Whammy! blat that pack!
                 */
-               HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT));
+               HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT));
 
                /*
                 ** place command packet on the pending position.
@@ -694,9 +692,9 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
                                 */
                                rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
                                FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
-                               if (PacketP->data[5] == MEMDUMP) {
-                                       rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(unsigned short *) & (PacketP->data[6]));
-                                       HostP->Copy(&(PacketP->data[8]), p->RIOMemDump, 32);
+                               if (readb(&PacketP->data[5]) == MEMDUMP) {
+                                       rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", readw(&(PacketP->data[6])));
+                                       rio_memcpy_fromio(p->RIOMemDump, &(PacketP->data[8]), 32);
                                }
                                rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
                                break;
@@ -782,7 +780,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
                                /*
                                 ** Whammy! blat that pack!
                                 */
-                               HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT));
+                               HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT));
 
                                /*
                                 ** remove the command from the rup command queue...
@@ -922,7 +920,7 @@ int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP)
 ** 
 ** Packet is an actual packet structure to be filled in with the packet
 ** information associated with the command. You need to fill in everything,
-** as the command processore doesn't process the command packet in any way.
+** as the command processor doesn't process the command packet in any way.
 ** 
 ** The PreFuncP is called before the packet is enqueued on the host rup.
 ** PreFuncP is called as (*PreFuncP)(PreArg, CmdBlkP);. PreFuncP must