include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / char / rio / rioroute.c
index 874ac74..f9b936a 100644 (file)
 **
 ** -----------------------------------------------------------------------------
 */
-#ifdef SCCS_LABELS
-static char *_rioroute_c_sccs_ = "@(#)rioroute.c       1.3";
-#endif
 
 #include <linux/module.h>
-#include <linux/slab.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/string.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #include <linux/termios.h>
@@ -50,15 +45,12 @@ static char *_rioroute_c_sccs_ = "@(#)rioroute.c    1.3";
 
 #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"
@@ -71,31 +63,27 @@ static char *_rioroute_c_sccs_ = "@(#)rioroute.c    1.3";
 #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"
 #include "param.h"
-#include "list.h"
-#include "sam.h"
 
-static int RIOCheckIsolated(struct rio_info *, struct Host *, uint);
-static int RIOIsolate(struct rio_info *, struct Host *, uint);
-static int RIOCheck(struct Host *, uint);
-static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint, int);
+static int RIOCheckIsolated(struct rio_info *, struct Host *, unsigned int);
+static int RIOIsolate(struct rio_info *, struct Host *, unsigned int);
+static int RIOCheck(struct Host *, unsigned int);
+static void RIOConCon(struct rio_info *, struct Host *, unsigned int, unsigned int, unsigned int, unsigned int, int);
 
 
 /*
 ** Incoming on the ROUTE_RUP
 ** I wrote this while I was tired. Forgive me.
 */
-int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
+int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT __iomem * PacketP)
 {
-       struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
+       struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *) PacketP->data;
        struct PktCmd_M *PktReplyP;
        struct CmdBlk *CmdBlkP;
        struct Port *PortP;
@@ -104,10 +92,10 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
        int ThisLink, ThisLinkMin, ThisLinkMax;
        int port;
        int Mod, Mod1, Mod2;
-       ushort RtaType;
-       uint RtaUniq;
-       uint ThisUnit, ThisUnit2;       /* 2 ids to accommodate 16 port RTA */
-       uint OldUnit, NewUnit, OldLink, NewLink;
+       unsigned short RtaType;
+       unsigned int RtaUniq;
+       unsigned int ThisUnit, ThisUnit2;       /* 2 ids to accommodate 16 port RTA */
+       unsigned int OldUnit, NewUnit, OldLink, NewLink;
        char *MyType, *MyName;
        int Lies;
        unsigned long flags;
@@ -125,7 +113,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                 ** from an RTA then we need to fill in the Mapping structure's
                 ** Topology array for the unit.
                 */
-               if (Rup >= (ushort) MAX_RUP) {
+               if (Rup >= (unsigned short) MAX_RUP) {
                        ThisUnit = HOST_ID;
                        TopP = HostP->Topology;
                        MyType = "Host";
@@ -151,7 +139,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                         ** it won't lie about network interconnect, total disconnects
                         ** and no-IDs. (or at least, it doesn't *matter* if it does)
                         */
-                       if (readb(&PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP)
+                       if (readb(&PktCmdP->RouteTopology[ThisLink].Unit) > (unsigned short) MAX_RUP)
                                continue;
 
                        for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) {
@@ -168,7 +156,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                                    'A' + readb(&PktCmdP->RouteTopology[0].Link),
                                    readb(&PktCmdP->RouteTopology[1].Unit),
                                    'A' + readb(&PktCmdP->RouteTopology[1].Link), readb(&PktCmdP->RouteTopology[2].Unit), 'A' + readb(&PktCmdP->RouteTopology[2].Link), readb(&PktCmdP->RouteTopology[3].Unit), 'A' + readb(&PktCmdP->RouteTopology[3].Link));
-                       return TRUE;
+                       return 1;
                }
 
                /*
@@ -258,7 +246,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                                RIOCheckIsolated(p, HostP, OldUnit);
                        }
                }
-               return TRUE;
+               return 1;
        }
 
        /*
@@ -266,7 +254,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
         */
        if (readb(&PktCmdP->Command) != ROUTE_REQUEST) {
                rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %p ROUTE_RUP\n", readb(&PktCmdP->Command), Rup, HostP);
-               return TRUE;
+               return 1;
        }
 
        RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24);
@@ -292,10 +280,6 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                rio_dprintk(RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name);
        }
 
-       if (RtaUniq == 0xffffffff) {
-               ShowPacket(DBG_SPECIAL, PacketP);
-       }
-
        /*
         ** try to unhook a command block from the command free list.
         */
@@ -318,9 +302,9 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
        if (!RIOBootOk(p, HostP, RtaUniq)) {
                rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq);
                PktReplyP->Command = ROUTE_FOAD;
-               HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
+               memcpy(PktReplyP->CommandText, "RT_FOAD", 7);
                RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
-               return TRUE;
+               return 1;
        }
 
        /*
@@ -352,9 +336,9 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                                        HostP->Mapping[ThisUnit].Flags |= MSG_DONE;
                                }
                                PktReplyP->Command = ROUTE_FOAD;
-                               HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
+                               memcpy(PktReplyP->CommandText, "RT_FOAD", 7);
                                RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
-                               return TRUE;
+                               return 1;
                        }
 
                        /*
@@ -378,7 +362,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                                PktReplyP->IDNum2 = ROUTE_NO_ID;
                                rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum);
                        }
-                       HostP->Copy("RT_ALLOCAT", PktReplyP->CommandText, 10);
+                       memcpy(PktReplyP->CommandText, "RT_ALLOCAT", 10);
 
                        RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
 
@@ -447,7 +431,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                        /*
                         ** Job done, get on with the interrupts!
                         */
-                       return TRUE;
+                       return 1;
                }
        }
        /*
@@ -480,7 +464,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                }
 
                PktReplyP->Command = ROUTE_FOAD;
-               HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
+               memcpy(PktReplyP->CommandText, "RT_FOAD", 7);
        } else {
                /*
                 ** we did boot it (as an extra), and there may now be a table
@@ -491,28 +475,25 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
                if (RtaType == TYPE_RTA16) {
                        if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) {
                                RIODefaultName(p, HostP, ThisUnit);
-                               FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP);
+                               rio_fill_host_slot(ThisUnit, ThisUnit2, RtaUniq, HostP);
                        }
                } else {
                        if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) {
                                RIODefaultName(p, HostP, ThisUnit);
-                               FillSlot(ThisUnit, 0, RtaUniq, HostP);
+                               rio_fill_host_slot(ThisUnit, 0, RtaUniq, HostP);
                        }
                }
                PktReplyP->Command = ROUTE_USED;
-               HostP->Copy("RT_USED", PktReplyP->CommandText, 7);
+               memcpy(PktReplyP->CommandText, "RT_USED", 7);
        }
        RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
-       return TRUE;
+       return 1;
 }
 
 
-void RIOFixPhbs(p, HostP, unit)
-struct rio_info *p;
-struct Host *HostP;
-uint unit;
+void RIOFixPhbs(struct rio_info *p, struct Host *HostP, unsigned int unit)
 {
-       ushort link, port;
+       unsigned short link, port;
        struct Port *PortP;
        unsigned long flags;
        int PortN = HostP->Mapping[unit].SysPort;
@@ -520,7 +501,7 @@ uint unit;
        rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN);
 
        if (PortN != -1) {
-               ushort dest_unit = HostP->Mapping[unit].ID2;
+               unsigned short dest_unit = HostP->Mapping[unit].ID2;
 
                /*
                 ** Get the link number used for the 1st 8 phbs on this unit.
@@ -530,9 +511,9 @@ uint unit;
                link = readw(&PortP->PhbP->link);
 
                for (port = 0; port < PORTS_PER_RTA; port++, PortN++) {
-                       ushort dest_port = port + 8;
-                       WORD *TxPktP;
-                       PKT *Pkt;
+                       unsigned short dest_port = port + 8;
+                       u16 __iomem *TxPktP;
+                       struct PKT __iomem *Pkt;
 
                        PortP = p->RIOPortp[PortN];
 
@@ -541,7 +522,7 @@ uint unit;
                         ** If RTA is not powered on, the tx packets will be
                         ** unset, so go no further.
                         */
-                       if (PortP->TxStart == 0) {
+                       if (!PortP->TxStart) {
                                rio_dprintk(RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n");
                                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                                break;
@@ -569,12 +550,12 @@ uint unit;
                                 ** card. This needs to be translated into a 32 bit pointer
                                 ** so it can be accessed from the driver.
                                 */
-                               Pkt = (PKT *) RIO_PTR(HostP->Caddr, readw(TxPktP));
+                               Pkt = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(TxPktP));
 
                                /*
                                 ** If the packet is used, reset it.
                                 */
-                               Pkt = (PKT *) ((unsigned long) Pkt & ~PKT_IN_USE);
+                               Pkt = (struct PKT __iomem *) ((unsigned long) Pkt & ~PKT_IN_USE);
                                writeb(dest_unit, &Pkt->dest_unit);
                                writeb(dest_port, &Pkt->dest_port);
                        }
@@ -603,10 +584,7 @@ uint unit;
 ** the world about it. This is done to ensure that the configurator
 ** only gets up-to-date information about what is going on.
 */
-static int RIOCheckIsolated(p, HostP, UnitId)
-struct rio_info *p;
-struct Host *HostP;
-uint UnitId;
+static int RIOCheckIsolated(struct rio_info *p, struct Host *HostP, unsigned int UnitId)
 {
        unsigned long flags;
        rio_spin_lock_irqsave(&HostP->HostLock, flags);
@@ -628,12 +606,9 @@ uint UnitId;
 ** all the units attached to it. This will mean that the entire
 ** subnet will re-introduce itself.
 */
-static int RIOIsolate(p, HostP, UnitId)
-struct rio_info *p;
-struct Host *HostP;
-uint UnitId;
+static int RIOIsolate(struct rio_info *p, struct Host *HostP, unsigned int UnitId)
 {
-       uint link, unit;
+       unsigned int link, unit;
 
        UnitId--;               /* this trick relies on the Unit Id being UNSIGNED! */
 
@@ -658,9 +633,7 @@ uint UnitId;
        return 1;
 }
 
-static int RIOCheck(HostP, UnitId)
-struct Host *HostP;
-uint UnitId;
+static int RIOCheck(struct Host *HostP, unsigned int UnitId)
 {
        unsigned char link;
 
@@ -714,8 +687,7 @@ uint UnitId;
 ** Returns the type of unit (host, 16/8 port RTA)
 */
 
-uint GetUnitType(Uniq)
-uint Uniq;
+unsigned int GetUnitType(unsigned int Uniq)
 {
        switch ((Uniq >> 28) & 0xf) {
        case RIO_AT:
@@ -736,8 +708,7 @@ uint Uniq;
        }
 }
 
-int RIOSetChange(p)
-struct rio_info *p;
+int RIOSetChange(struct rio_info *p)
 {
        if (p->RIOQuickCheck != NOT_CHANGED)
                return (0);
@@ -751,14 +722,13 @@ struct rio_info *p;
        return (0);
 }
 
-static void RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change)
-struct rio_info *p;
-struct Host *HostP;
-uint FromId;
-uint FromLink;
-uint ToId;
-uint ToLink;
-int Change;
+static void RIOConCon(struct rio_info *p,
+                     struct Host *HostP,
+                     unsigned int FromId,
+                     unsigned int FromLink,
+                     unsigned int ToId,
+                     unsigned int ToLink,
+                     int Change)
 {
        char *FromName;
        char *FromType;
@@ -912,7 +882,8 @@ static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
 ** This function scans the given host table for either one
 ** or two free unit ID's.
 */
-int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2)
+
+int RIOFindFreeID(struct rio_info *p, struct Host *HostP, unsigned int * pID1, unsigned int * pID2)
 {
        int unit, tempID;