#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"
#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 *, 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);
+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);
/*
** Incoming on the ROUTE_RUP
** I wrote this while I was tired. Forgive me.
*/
-int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT * PacketP)
+int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
{
struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
struct PktCmd_M *PktReplyP;
int ThisLink, ThisLinkMin, ThisLinkMax;
int port;
int Mod, Mod1, Mod2;
- unsigned short RtaType;
- unsigned int RtaUniq;
- unsigned int ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */
- unsigned int OldUnit, NewUnit, OldLink, NewLink;
+ ushort RtaType;
+ uint RtaUniq;
+ uint ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */
+ uint OldUnit, NewUnit, OldLink, NewLink;
char *MyType, *MyName;
int Lies;
unsigned long flags;
/*
** Is this unit telling us it's current link topology?
*/
- if (readb(&PktCmdP->Command) == ROUTE_TOPOLOGY) {
+ if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) {
MapP = HostP->Mapping;
/*
** from an RTA then we need to fill in the Mapping structure's
** Topology array for the unit.
*/
- if (Rup >= (unsigned short) MAX_RUP) {
+ if (Rup >= (ushort) MAX_RUP) {
ThisUnit = HOST_ID;
TopP = HostP->Topology;
MyType = "Host";
** 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) > (unsigned short) MAX_RUP)
+ if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP)
continue;
for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) {
- if ((readb(&PktCmdP->RouteTopology[ThisLink].Unit) == readb(&PktCmdP->RouteTopology[NewLink].Unit)) && (readb(&PktCmdP->RouteTopology[ThisLink].Link) == readb(&PktCmdP->RouteTopology[NewLink].Link))) {
+ if ((RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == RBYTE(PktCmdP->RouteTopology[NewLink].Link))) {
Lies++;
}
}
if (Lies) {
rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies);
rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n",
- readb(&PktCmdP->RouteTopology[0].Unit),
- '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 1;
+ RBYTE(PktCmdP->RouteTopology[0].Unit),
+ 'A' + RBYTE(PktCmdP->RouteTopology[0].Link),
+ RBYTE(PktCmdP->RouteTopology[1].Unit),
+ 'A' + RBYTE(PktCmdP->RouteTopology[1].Link), RBYTE(PktCmdP->RouteTopology[2].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[3].Link));
+ return TRUE;
}
/*
/*
** this is what it is now connected to
*/
- NewUnit = readb(&PktCmdP->RouteTopology[ThisLink].Unit);
- NewLink = readb(&PktCmdP->RouteTopology[ThisLink].Link);
+ NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit);
+ NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link);
if (OldUnit != NewUnit || OldLink != NewLink) {
/*
if (NewUnit == ROUTE_INTERCONNECT) {
if (!p->RIONoMessage)
- printk(KERN_DEBUG "rio: %s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink);
+ cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink);
}
/*
RIOCheckIsolated(p, HostP, OldUnit);
}
}
- return 1;
+ return TRUE;
}
/*
** The only other command we recognise is a route_request command
*/
- 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 1;
+ if (RBYTE(PktCmdP->Command) != ROUTE_REQUEST) {
+ rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", RBYTE(PktCmdP->Command), Rup, (int) HostP);
+ return TRUE;
}
- RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24);
+ RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24);
/*
** Determine if 8 or 16 port RTA
rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq);
- Mod = readb(&PktCmdP->ModuleTypes);
+ Mod = RBYTE(PktCmdP->ModuleTypes);
Mod1 = LONYBLE(Mod);
if (RtaType == TYPE_RTA16) {
/*
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.
*/
PktReplyP->Command = ROUTE_FOAD;
HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
- return 1;
+ return TRUE;
}
/*
if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) {
if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) {
if (!p->RIONoMessage)
- printk(KERN_DEBUG "rio: RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name);
+ cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name);
HostP->Mapping[ThisUnit].Flags |= MSG_DONE;
}
PktReplyP->Command = ROUTE_FOAD;
HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
- return 1;
+ return TRUE;
}
/*
/*
** Job done, get on with the interrupts!
*/
- return 1;
+ return TRUE;
}
}
/*
if (!UnknownMesgDone) {
if (!p->RIONoMessage)
- printk(KERN_DEBUG "rio: One or more unknown RTAs are being updated.\n");
+ cprintf("One or more unknown RTAs are being updated.\n");
UnknownMesgDone = 1;
}
if (RtaType == TYPE_RTA16) {
if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) {
RIODefaultName(p, HostP, ThisUnit);
- rio_fill_host_slot(ThisUnit, ThisUnit2, RtaUniq, HostP);
+ FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP);
}
} else {
if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) {
RIODefaultName(p, HostP, ThisUnit);
- rio_fill_host_slot(ThisUnit, 0, RtaUniq, HostP);
+ FillSlot(ThisUnit, 0, RtaUniq, HostP);
}
}
PktReplyP->Command = ROUTE_USED;
HostP->Copy("RT_USED", PktReplyP->CommandText, 7);
}
RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
- return 1;
+ return TRUE;
}
-void RIOFixPhbs(struct rio_info *p, struct Host *HostP, unsigned int unit)
+void RIOFixPhbs(p, HostP, unit)
+struct rio_info *p;
+struct Host *HostP;
+uint unit;
{
- unsigned short link, port;
+ ushort link, port;
struct Port *PortP;
unsigned long flags;
int PortN = HostP->Mapping[unit].SysPort;
rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN);
if (PortN != -1) {
- unsigned short dest_unit = HostP->Mapping[unit].ID2;
+ ushort dest_unit = HostP->Mapping[unit].ID2;
/*
** Get the link number used for the 1st 8 phbs on this unit.
*/
PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort];
- link = readw(&PortP->PhbP->link);
+ link = RWORD(PortP->PhbP->link);
for (port = 0; port < PORTS_PER_RTA; port++, PortN++) {
- unsigned short dest_port = port + 8;
- u16 *TxPktP;
- struct PKT *Pkt;
+ ushort dest_port = port + 8;
+ WORD *TxPktP;
+ PKT *Pkt;
PortP = p->RIOPortp[PortN];
** card. This needs to be translated into a 32 bit pointer
** so it can be accessed from the driver.
*/
- Pkt = (struct PKT *) RIO_PTR(HostP->Caddr, readw(TxPktP));
+ Pkt = (PKT *) RIO_PTR(HostP->Caddr, RINDW(TxPktP));
/*
** If the packet is used, reset it.
*/
- Pkt = (struct PKT *) ((unsigned long) Pkt & ~PKT_IN_USE);
- writeb(dest_unit, &Pkt->dest_unit);
- writeb(dest_port, &Pkt->dest_port);
+ Pkt = (PKT *) ((uint) Pkt & ~PKT_IN_USE);
+ WBYTE(Pkt->dest_unit, dest_unit);
+ WBYTE(Pkt->dest_port, dest_port);
}
- rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", readw(&PortP->PhbP->destination) & 0xff, (readw(&PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port);
- writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination);
- writew(link, &PortP->PhbP->link);
+ rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port);
+ WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8));
+ WWORD(PortP->PhbP->link, link);
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
}
*/
if (link > 3)
return;
- if (((unit * 8) + 7) > readw(&HostP->LinkStrP[link].last_port)) {
+ if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) {
rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7);
- writew((unit * 8) + 7, &HostP->LinkStrP[link].last_port);
+ WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7);
}
}
}
** 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(struct rio_info *p, struct Host *HostP, unsigned int UnitId)
+static int RIOCheckIsolated(p, HostP, UnitId)
+struct rio_info *p;
+struct Host *HostP;
+uint UnitId;
{
unsigned long flags;
rio_spin_lock_irqsave(&HostP->HostLock, flags);
** all the units attached to it. This will mean that the entire
** subnet will re-introduce itself.
*/
-static int RIOIsolate(struct rio_info *p, struct Host *HostP, unsigned int UnitId)
+static int RIOIsolate(p, HostP, UnitId)
+struct rio_info *p;
+struct Host *HostP;
+uint UnitId;
{
- unsigned int link, unit;
+ uint link, unit;
UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */
return 1;
}
-static int RIOCheck(struct Host *HostP, unsigned int UnitId)
+static int RIOCheck(HostP, UnitId)
+struct Host *HostP;
+uint UnitId;
{
unsigned char link;
** Returns the type of unit (host, 16/8 port RTA)
*/
-unsigned int GetUnitType(unsigned int Uniq)
+uint GetUnitType(Uniq)
+uint Uniq;
{
switch ((Uniq >> 28) & 0xf) {
case RIO_AT:
}
}
-int RIOSetChange(struct rio_info *p)
+int RIOSetChange(p)
+struct rio_info *p;
{
if (p->RIOQuickCheck != NOT_CHANGED)
return (0);
return (0);
}
-static void RIOConCon(struct rio_info *p,
- struct Host *HostP,
- unsigned int FromId,
- unsigned int FromLink,
- unsigned int ToId,
- unsigned int ToLink,
- int Change)
+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;
{
char *FromName;
char *FromType;
ToType = ToId ? "RTA" : "HOST";
rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
- printk(KERN_DEBUG "rio: Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
+ cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
}
/*
*/
for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) {
- memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map));
+ bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map));
}
}
return 0;
int nOther = (HostP->Mapping[unit].ID2) - 1;
rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther);
- memset(&HostP->Mapping[nOther], 0, sizeof(struct Map));
+ bzero((caddr_t) & HostP->Mapping[nOther], sizeof(struct Map));
}
RIORemoveFromSavedTable(p, &HostP->Mapping[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, unsigned int * pID1, unsigned int * pID2)
+int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2)
{
int unit, tempID;
/*
** Clear out this slot now that we intend to use it.
*/
- memset(&HostP->Mapping[unit], 0, sizeof(struct Map));
+ bzero(&HostP->Mapping[unit], sizeof(struct Map));
/*
** If the second ID is not needed then we can return
/*
** Clear out this slot now that we intend to use it.
*/
- memset(&HostP->Mapping[unit], 0, sizeof(struct Map));
+ bzero(&HostP->Mapping[unit], sizeof(struct Map));
/* At this point under the right(wrong?) conditions
** we may have a first unit ID being higher than the