]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/rio/riointr.c
Merge branch 'upstream-fixes' of git://lost.foo-projects.org/~ahkok/git/netdev-2...
[linux-2.6-omap-h63xx.git] / drivers / char / rio / riointr.c
index ec415ccbc4f031f6bb395ea2f57a8cff25783ecc..eeda40c5e189067a547e1db2a5670a6756fc5a74 100644 (file)
@@ -54,15 +54,12 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c      1.2";
 
 #include "linux_compat.h"
 #include "rio_linux.h"
-#include "typdef.h"
 #include "pkt.h"
 #include "daemon.h"
 #include "rio.h"
 #include "riospace.h"
-#include "top.h"
 #include "cmdpkt.h"
 #include "map.h"
-#include "riotypes.h"
 #include "rup.h"
 #include "port.h"
 #include "riodrvr.h"
@@ -75,12 +72,10 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c      1.2";
 #include "unixrup.h"
 #include "board.h"
 #include "host.h"
-#include "error.h"
 #include "phb.h"
 #include "link.h"
 #include "cmdblk.h"
 #include "route.h"
-#include "control.h"
 #include "cirrus.h"
 #include "rioioctl.h"
 
@@ -107,7 +102,7 @@ void RIOTxEnable(char *en)
        struct rio_info *p;
        struct tty_struct *tty;
        int c;
-       struct PKT *PacketP;
+       struct PKT __iomem *PacketP;
        unsigned long flags;
 
        PortP = (struct Port *) en;
@@ -149,7 +144,7 @@ void RIOTxEnable(char *en)
                if (c == 0)
                        break;
 
-               rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
+               rio_memcpy_toio(PortP->HostP->Caddr, PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
                /*    udelay (1); */
 
                writeb(c, &(PacketP->len));
@@ -186,7 +181,7 @@ static int RupIntr;
 static int RxIntr;
 static int TxIntr;
 
-void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
+void RIOServiceHost(struct rio_info *p, struct Host *HostP)
 {
        rio_spin_lock(&HostP->HostLock);
        if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
@@ -224,7 +219,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
                for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
                        struct Port *PortP = p->RIOPortp[port];
                        struct tty_struct *ttyP;
-                       struct PKT *PacketP;
+                       struct PKT __iomem *PacketP;
 
                        /*
                         ** not mapped in - most of the RIOPortp[] information
@@ -303,7 +298,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
                for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
                        struct Port *PortP = p->RIOPortp[port];
                        struct tty_struct *ttyP;
-                       struct PKT *PacketP;
+                       struct PKT __iomem *PacketP;
 
                        /*
                         ** not mapped in - most of the RIOPortp[] information
@@ -396,7 +391,6 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
                        /* For now don't handle RTA reboots. -- REW.
                           Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */
                        if (PortP->MagicFlags) {
-#if 1
                                if (PortP->MagicFlags & MAGIC_REBOOT) {
                                        /*
                                         ** well, the RTA has been rebooted, and there is room
@@ -413,13 +407,12 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
                                        PortP->InUse = NOT_INUSE;
 
                                        rio_spin_unlock(&PortP->portSem);
-                                       if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) {
+                                       if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? 1 : 0, DONT_SLEEP) == RIO_FAIL) {
                                                continue;       /* with next port */
                                        }
                                        rio_spin_lock(&PortP->portSem);
                                        PortP->MagicFlags &= ~MAGIC_REBOOT;
                                }
-#endif
 
                                /*
                                 ** As mentioned above, this is a tacky hack to cope
@@ -434,13 +427,13 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
 
                                while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) {
                                        int p;
-                                       struct PktCmd *PktCmdP;
+                                       struct PktCmd __iomem *PktCmdP;
 
                                        rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n");
                                        /*
                                         ** make it look just like a WFLUSH command
                                         */
-                                       PktCmdP = (struct PktCmd *) &PacketP->data[0];
+                                       PktCmdP = (struct PktCmd __iomem *) &PacketP->data[0];
 
                                        writeb(WFLUSH, &PktCmdP->Command);
 
@@ -532,9 +525,9 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
 {
        struct tty_struct *TtyP;
        unsigned short transCount;
-       struct PKT *PacketP;
+       struct PKT __iomem *PacketP;
        register unsigned int DataCnt;
-       unsigned char *ptr;
+       unsigned char __iomem *ptr;
        unsigned char *buf;
        int copied = 0;
 
@@ -553,7 +546,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
         ** run out of space it will be set to the offset of the
         ** next byte to copy from the packet data area. The packet
         ** length field is decremented by the number of bytes that
-        ** we succesfully removed from the packet. When this reaches
+        ** we successfully removed from the packet. When this reaches
         ** zero, we reset the offset pointer to be zero, and free
         ** the packet from the front of the queue.
         */
@@ -592,19 +585,19 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
                        /*
                         ** check that it is not a command!
                         */
-                       if (PacketP->len & PKT_CMD_BIT) {
+                       if (readb(&PacketP->len) & PKT_CMD_BIT) {
                                rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
                                /*      rio_dprint(RIO_DEBUG_INTR, (" sysport   = %d\n", p->RIOPortp->PortNum)); */
-                               rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit);
-                               rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port);
-                               rio_dprintk(RIO_DEBUG_INTR, " src_unit  = %d\n", PacketP->src_unit);
-                               rio_dprintk(RIO_DEBUG_INTR, " src_port  = %d\n", PacketP->src_port);
-                               rio_dprintk(RIO_DEBUG_INTR, " len          = %d\n", PacketP->len);
-                               rio_dprintk(RIO_DEBUG_INTR, " control   = %d\n", PacketP->control);
-                               rio_dprintk(RIO_DEBUG_INTR, " csum         = %d\n", PacketP->csum);
+                               rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", readb(&PacketP->dest_unit));
+                               rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", readb(&PacketP->dest_port));
+                               rio_dprintk(RIO_DEBUG_INTR, " src_unit  = %d\n", readb(&PacketP->src_unit));
+                               rio_dprintk(RIO_DEBUG_INTR, " src_port  = %d\n", readb(&PacketP->src_port));
+                               rio_dprintk(RIO_DEBUG_INTR, " len          = %d\n", readb(&PacketP->len));
+                               rio_dprintk(RIO_DEBUG_INTR, " control   = %d\n", readb(&PacketP->control));
+                               rio_dprintk(RIO_DEBUG_INTR, " csum         = %d\n", readw(&PacketP->csum));
                                rio_dprintk(RIO_DEBUG_INTR, "    data bytes: ");
                                for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++)
-                                       rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]);
+                                       rio_dprintk(RIO_DEBUG_INTR, "%d\n", readb(&PacketP->data[DataCnt]));
                                remove_receive(PortP);
                                put_free_end(PortP->HostP, PacketP);
                                continue;       /* with next packet */
@@ -625,24 +618,24 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
                         ** and available space.
                         */
 
-                       transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK);
+                       transCount = tty_buffer_request_room(TtyP, readb(&PacketP->len) & PKT_LEN_MASK);
                        rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount);
                        /*
                         ** To use the following 'kkprintfs' for debugging - change the '#undef'
                         ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
                         ** driver).
                         */
-                       ptr = (unsigned char *) PacketP->data + PortP->RxDataStart;
+                       ptr = (unsigned char __iomem *) PacketP->data + PortP->RxDataStart;
 
                        tty_prepare_flip_string(TtyP, &buf, transCount);
                        rio_memcpy_fromio(buf, ptr, transCount);
                        PortP->RxDataStart += transCount;
-                       PacketP->len -= transCount;
+                       writeb(readb(&PacketP->len)-transCount, &PacketP->len);
                        copied += transCount;
 
 
 
-                       if (PacketP->len == 0) {
+                       if (readb(&PacketP->len) == 0) {
                                /*
                                 ** If we have emptied the packet, then we can
                                 ** free it, and reset the start pointer for