[PATCH] rioboot: lindent

This is the result of indent -kr -i8 -bri0 -l255

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Alan Cox 2006-03-24 03:18:24 -08:00 committed by Linus Torvalds
parent 74769abfcb
commit 3b8e3f1e44
1 changed files with 709 additions and 816 deletions

View File

@ -82,9 +82,7 @@ static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3";
static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP);
static uchar
RIOAtVec2Ctrl[] =
{
static uchar RIOAtVec2Ctrl[] = {
/* 0 */ INTERRUPT_DISABLE,
/* 1 */ INTERRUPT_DISABLE,
/* 2 */ INTERRUPT_DISABLE,
@ -106,8 +104,7 @@ RIOAtVec2Ctrl[] =
/*
** Load in the RTA boot code.
*/
int
RIOBootCodeRTA(p, rbp)
int RIOBootCodeRTA(p, rbp)
struct rio_info *p;
struct DownLoad *rbp;
{
@ -145,8 +142,7 @@ struct DownLoad * rbp;
** so calculate how far we have to move the data up the buffer
** to achieve this.
*/
offset = (RTA_BOOT_DATA_SIZE - (rbp->Count % RTA_BOOT_DATA_SIZE)) %
RTA_BOOT_DATA_SIZE;
offset = (RTA_BOOT_DATA_SIZE - (rbp->Count % RTA_BOOT_DATA_SIZE)) % RTA_BOOT_DATA_SIZE;
/*
** Be clean, and clear the 'unused' portion of the boot buffer,
@ -159,8 +155,7 @@ struct DownLoad * rbp;
** Copy the data from user space.
*/
if ( copyin((int)rbp->DataP,((caddr_t)(p->RIOBootPackets))+offset,
rbp->Count) ==COPYFAIL ) {
if (copyin((int) rbp->DataP, ((caddr_t) (p->RIOBootPackets)) + offset, rbp->Count) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_BOOT, "Bad data copy from user space\n");
p->RIOError.Error = COPYIN_FAILED;
/* restore(oldspl); */
@ -187,10 +182,7 @@ void rio_start_card_running (struct Host * HostP)
switch (HostP->Type) {
case RIO_AT:
rio_dprintk(RIO_DEBUG_BOOT, "Start ISA card running\n");
WBYTE(HostP->Control,
BOOT_FROM_RAM | EXTERNAL_BUS_ON
| HostP->Mode
| RIOAtVec2Ctrl[HostP->Ivec & 0xF] );
WBYTE(HostP->Control, BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF]);
break;
#ifdef FUTURE_RELEASE
@ -239,8 +231,7 @@ void rio_start_card_running (struct Host * HostP)
** Put your rubber pants on before messing with this code - even the magic
** numbers have trouble understanding what they are doing here.
*/
int
RIOBootCodeHOST(p, rbp)
int RIOBootCodeHOST(p, rbp)
struct rio_info *p;
register struct DownLoad *rbp;
{
@ -264,8 +255,7 @@ register struct DownLoad *rbp;
rio_dprintk(RIO_DEBUG_BOOT, "Attempt to boot host %d\n", host);
HostP = &p->RIOHosts[host];
rio_dprintk (RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n",
HostP->Type, HostP->Mode, HostP->Ivec);
rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec);
if ((HostP->Flags & RUN_STATE) != RC_WAITING) {
@ -337,8 +327,7 @@ register struct DownLoad *rbp;
HostP->Copy(DownCode, StartP, rbp->Count);
sysfree(DownCode, rbp->Count);
}
else if ( copyin((int)rbp->DataP,StartP,rbp->Count)==COPYFAIL ) {
} else if (copyin((int) rbp->DataP, StartP, rbp->Count) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_BOOT, "Bad copyin of host data\n");
p->RIOError.Error = COPYIN_FAILED;
func_exit();
@ -468,8 +457,7 @@ register struct DownLoad *rbp;
** As there is nothing dodgy or obscure about the
** above code, this is guaranteed to work every time.
*/
rio_dprintk (RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n",
HostP->Type, HostP->Mode, HostP->Ivec);
rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec);
rio_start_card_running(HostP);
@ -479,8 +467,7 @@ register struct DownLoad *rbp;
** Now, wait for upto five seconds for the Tp to setup the parmmap
** pointer:
*/
for ( wait_count=0; (wait_count<p->RIOConf.StartupTime)&&
(RWORD(HostP->__ParmMapR)==OldParmMap); wait_count++ ) {
for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (RWORD(HostP->__ParmMapR) == OldParmMap); wait_count++) {
rio_dprintk(RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n", wait_count, RWORD(HostP->__ParmMapR));
delay(HostP, HUNDRED_MS);
@ -493,15 +480,10 @@ register struct DownLoad *rbp;
if (RWORD(HostP->__ParmMapR) == OldParmMap) {
rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", RWORD(HostP->__ParmMapR));
rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n");
#define HOST_DISABLE \
HostP->Flags &= ~RUN_STATE; \
HostP->Flags |= RC_STUFFED; \
RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );\
continue
HOST_DISABLE;
}
HostP->Flags &= ~RUN_STATE;
HostP->Flags |= RC_STUFFED;
RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot);
continue}
rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", RWORD(HostP->__ParmMapR));
@ -516,8 +498,7 @@ register struct DownLoad *rbp;
*/
ParmMapP = (PARM_MAP *) RIO_PTR(Cad, RWORD(HostP->__ParmMapR));
rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP);
ParmMapP = (PARM_MAP *)((unsigned long)Cad +
(unsigned long)((RWORD((HostP->__ParmMapR))) & 0xFFFF));
ParmMapP = (PARM_MAP *) ((unsigned long) Cad + (unsigned long) ((RWORD((HostP->__ParmMapR))) & 0xFFFF));
rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP);
/*
@ -528,8 +509,10 @@ register struct DownLoad *rbp;
if ((RWORD(ParmMapP->links) & 0xFFFF) != 0xFFFF) {
rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name);
rio_dprintk(RIO_DEBUG_BOOT, "Links = 0x%x\n", RWORD(ParmMapP->links));
HOST_DISABLE;
}
HostP->Flags &= ~RUN_STATE;
HostP->Flags |= RC_STUFFED;
RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot);
continue}
WWORD(ParmMapP->links, RIO_LINK_ENABLE);
@ -539,19 +522,19 @@ register struct DownLoad *rbp;
*/
rio_dprintk(RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n", p->RIOConf.StartupTime);
HostP->timeout_id = 0;
for ( wait_count=0; (wait_count<p->RIOConf.StartupTime) &&
!RWORD(ParmMapP->init_done); wait_count++ ) {
for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && !RWORD(ParmMapP->init_done); wait_count++) {
rio_dprintk(RIO_DEBUG_BOOT, "Waiting for init_done\n");
delay(HostP, HUNDRED_MS);
}
rio_dprintk(RIO_DEBUG_BOOT, "OK! init_done!\n");
if (RWORD(ParmMapP->error) != E_NO_ERROR ||
!RWORD(ParmMapP->init_done) ) {
if (RWORD(ParmMapP->error) != E_NO_ERROR || !RWORD(ParmMapP->init_done)) {
rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name);
rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n");
HOST_DISABLE;
}
HostP->Flags &= ~RUN_STATE;
HostP->Flags |= RC_STUFFED;
RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot);
continue}
rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n");
@ -595,8 +578,7 @@ register struct DownLoad *rbp;
/*
** point the PortP->Phbs at the real Phbs
*/
for ( PortN=p->RIOFirstPortsMapped;
PortN<p->RIOLastPortsMapped+PORTS_PER_RTA; PortN++ ) {
for (PortN = p->RIOFirstPortsMapped; PortN < p->RIOLastPortsMapped + PORTS_PER_RTA; PortN++) {
if (p->RIOPortp[PortN]->HostP == HostP) {
struct Port *PortP = p->RIOPortp[PortN];
struct PHB *PhbP;
@ -653,8 +635,7 @@ register struct DownLoad *rbp;
** Boot an RTA. If we have successfully processed this boot, then
** return 1. If we havent, then return 0.
*/
int
RIOBootRup( p, Rup, HostP, PacketP)
int RIOBootRup(p, Rup, HostP, PacketP)
struct rio_info *p;
uint Rup;
struct Host *HostP;
@ -682,8 +663,7 @@ struct PKT *PacketP;
** this first and then get a command block, then handle every other
** case, relinquishing the command block if disaster strikes!
*/
if ( (RBYTE(PacketP->len) & PKT_CMD_BIT) &&
(RBYTE(PktCmdP->Command)==BOOT_COMPLETED) )
if ((RBYTE(PacketP->len) & PKT_CMD_BIT) && (RBYTE(PktCmdP->Command) == BOOT_COMPLETED))
return RIOBootComplete(p, HostP, Rup, PktCmdP);
/*
@ -713,8 +693,7 @@ struct PKT *PacketP;
** We only expect one type of command - a BOOT_REQUEST!
*/
if (RBYTE(PktCmdP->Command) != BOOT_REQUEST) {
rio_dprintk (RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %d\n",
PktCmdP->Command,Rup,HostP-p->RIOHosts);
rio_dprintk(RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %d\n", PktCmdP->Command, Rup, HostP - p->RIOHosts);
ShowPacket(DBG_BOOT, PacketP);
RIOFreeCmdBlk(CmdBlkP);
return 1;
@ -751,9 +730,7 @@ struct PKT *PacketP;
bcopy("BOOT", (void *) &CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN], 4);
rio_dprintk (RIO_DEBUG_BOOT, "Boot RTA on Host %d Rup %d - %d (0x%x) packets to 0x%x\n",
HostP-p->RIOHosts, Rup, p->RIONumBootPkts, p->RIONumBootPkts,
p->RIOConf.RtaLoadBase);
rio_dprintk(RIO_DEBUG_BOOT, "Boot RTA on Host %d Rup %d - %d (0x%x) packets to 0x%x\n", HostP - p->RIOHosts, Rup, p->RIONumBootPkts, p->RIONumBootPkts, p->RIOConf.RtaLoadBase);
/*
** If this host is in slave mode, send the RTA an invalid boot
@ -775,15 +752,13 @@ struct PKT *PacketP;
rio_dprintk(RIO_DEBUG_BOOT, "Boot block %d on Host %d Rup%d\n", sequence, HostP - p->RIOHosts, Rup);
if (sequence >= p->RIONumBootPkts) {
rio_dprintk (RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence,
p->RIONumBootPkts);
rio_dprintk(RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, p->RIONumBootPkts);
ShowPacket(DBG_BOOT, PacketP);
}
PktReplyP->Sequence = sequence;
bcopy( p->RIOBootPackets[ p->RIONumBootPkts - sequence - 1 ],
PktReplyP->BootData, RTA_BOOT_DATA_SIZE );
bcopy(p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], PktReplyP->BootData, RTA_BOOT_DATA_SIZE);
CmdBlkP->Packet.len = PKT_MAX_DATA_LEN;
ShowPacket(DBG_BOOT, &CmdBlkP->Packet);
@ -809,10 +784,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
char *MyType, *MyName;
uint MyLink;
ushort RtaType;
uint RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) +
(RBYTE(PktCmdP->UniqNum[1]) << 8) +
(RBYTE(PktCmdP->UniqNum[2]) << 16) +
(RBYTE(PktCmdP->UniqNum[3]) << 24);
uint RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24);
/* Was RIOBooting-- . That's bad. If an RTA sends two of them, the
driver will never think that the RTA has booted... -- REW */
@ -825,18 +797,14 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
*/
RtaType = GetUnitType(RtaUniq);
if (Rup >= (ushort) MAX_RUP) {
rio_dprintk (RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n",
HostP->Name, 8 * RtaType, RBYTE(PktCmdP->LinkNum)+'A');
rio_dprintk(RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n", HostP->Name, 8 * RtaType, RBYTE(PktCmdP->LinkNum) + 'A');
} else {
rio_dprintk (RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n",
HostP->Mapping[Rup].Name, 8 * RtaType,
RBYTE(PktCmdP->LinkNum)+'A');
rio_dprintk(RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n", HostP->Mapping[Rup].Name, 8 * RtaType, RBYTE(PktCmdP->LinkNum) + 'A');
}
rio_dprintk(RIO_DEBUG_BOOT, "UniqNum is 0x%x\n", RtaUniq);
if ( ( RtaUniq == 0x00000000 ) || ( RtaUniq == 0xffffffff ) )
{
if ((RtaUniq == 0x00000000) || (RtaUniq == 0xffffffff)) {
rio_dprintk(RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n");
return TRUE;
}
@ -846,24 +814,18 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** system, or the system is in slave mode, do not attempt to create
** a new table entry for it.
*/
if (!RIOBootOk(p, HostP, RtaUniq))
{
if (!RIOBootOk(p, HostP, RtaUniq)) {
MyLink = RBYTE(PktCmdP->LinkNum);
if (Rup < (ushort) MAX_RUP)
{
if (Rup < (ushort) MAX_RUP) {
/*
** RtaUniq was clone booted (by this RTA). Instruct this RTA
** to hold off further attempts to boot on this link for 30
** seconds.
*/
if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink))
{
rio_dprintk (RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n",
'A' + MyLink);
if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink)) {
rio_dprintk(RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n", 'A' + MyLink);
}
}
else
{
} else {
/*
** RtaUniq was booted by this host. Set the booting link
** to hold off for 30 seconds to give another unit a
@ -871,8 +833,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
*/
WWORD(HostP->LinkStrP[MyLink].WaitNoBoot, 30);
}
rio_dprintk (RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n",
RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum);
rio_dprintk(RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n", RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum);
return TRUE;
}
@ -887,19 +848,15 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** to force an open on any ports that where previously open on this
** unit.
*/
for ( entry=0; entry<MAX_RUP; entry++ )
{
for (entry = 0; entry < MAX_RUP; entry++) {
uint sysport;
if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) &&
(HostP->Mapping[entry].RtaUniqueNum==RtaUniq))
{
if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) {
HostP->Mapping[entry].Flags |= RTA_BOOTED | RTA_NEWBOOT;
#ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry]);
#endif
if ( (sysport=HostP->Mapping[entry].SysPort) != NO_PORT )
{
if ((sysport = HostP->Mapping[entry].SysPort) != NO_PORT) {
if (sysport < p->RIOFirstPortsBooted)
p->RIOFirstPortsBooted = sysport;
if (sysport > p->RIOLastPortsBooted)
@ -907,8 +864,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
/*
** For a 16 port RTA, check the second bank of 8 ports
*/
if (RtaType == TYPE_RTA16)
{
if (RtaType == TYPE_RTA16) {
entry2 = HostP->Mapping[entry].ID2 - 1;
HostP->Mapping[entry2].Flags |= RTA_BOOTED | RTA_NEWBOOT;
#ifdef NEED_TO_FIX
@ -922,8 +878,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
}
}
if (RtaType == TYPE_RTA16) {
rio_dprintk (RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n",
entry+1, entry2+1);
rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", entry + 1, entry2 + 1);
} else {
rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given ID %d\n", entry + 1);
}
@ -933,16 +888,13 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
rio_dprintk(RIO_DEBUG_BOOT, "RTA not configured for this host\n");
if ( Rup >= (ushort)MAX_RUP )
{
if (Rup >= (ushort) MAX_RUP) {
/*
** It was a host that did the booting
*/
MyType = "Host";
MyName = HostP->Name;
}
else
{
} else {
/*
** It was an RTA that did the booting
*/
@ -960,22 +912,15 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
**
** If we find one, then we re-use that slot.
*/
for ( entry=0; entry<MAX_RUP; entry++ )
{
if ( (HostP->Mapping[entry].Flags & SLOT_TENTATIVE) &&
(HostP->Mapping[entry].RtaUniqueNum == RtaUniq) )
{
if (RtaType == TYPE_RTA16)
{
for (entry = 0; entry < MAX_RUP; entry++) {
if ((HostP->Mapping[entry].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) {
if (RtaType == TYPE_RTA16) {
entry2 = HostP->Mapping[entry].ID2 - 1;
if ( (HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) &&
(HostP->Mapping[entry2].RtaUniqueNum == RtaUniq) )
rio_dprintk (RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n",
entry, entry2);
if ((HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry2].RtaUniqueNum == RtaUniq))
rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n", entry, entry2);
else
continue;
}
else
} else
rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n", entry);
if (!p->RIONoMessage)
cprintf("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A');
@ -1008,25 +953,16 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
rio_dprintk(RIO_DEBUG_BOOT, "Have we seen RTA %x before?\n", RtaUniq);
found = 0;
Flag = 0; /* Convince the compiler this variable is initialized */
for ( host = 0; !found && (host < p->RIONumHosts); host++ )
{
for ( rta=0; rta<MAX_RUP; rta++ )
{
if ((p->RIOHosts[host].Mapping[rta].Flags &
(SLOT_IN_USE | SLOT_TENTATIVE)) &&
(p->RIOHosts[host].Mapping[rta].RtaUniqueNum==RtaUniq))
{
for (host = 0; !found && (host < p->RIONumHosts); host++) {
for (rta = 0; rta < MAX_RUP; rta++) {
if ((p->RIOHosts[host].Mapping[rta].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (p->RIOHosts[host].Mapping[rta].RtaUniqueNum == RtaUniq)) {
Flag = p->RIOHosts[host].Mapping[rta].Flags;
MapP = &p->RIOHosts[host].Mapping[rta];
if (RtaType == TYPE_RTA16)
{
if (RtaType == TYPE_RTA16) {
MapP2 = &p->RIOHosts[host].Mapping[MapP->ID2 - 1];
rio_dprintk (RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n",
rta+1, MapP->ID2, p->RIOHosts[host].Name);
}
else
rio_dprintk (RIO_DEBUG_BOOT, "This RTA is unit %d from host %s\n",
rta+1, p->RIOHosts[host].Name);
rio_dprintk(RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n", rta + 1, MapP->ID2, p->RIOHosts[host].Name);
} else
rio_dprintk(RIO_DEBUG_BOOT, "This RTA is unit %d from host %s\n", rta + 1, p->RIOHosts[host].Name);
found = 1;
break;
}
@ -1042,33 +978,22 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
**
** Check for a SLOT_IN_USE entry for this RTA in the config table.
*/
if ( !MapP )
{
if (!MapP) {
rio_dprintk(RIO_DEBUG_BOOT, "Look for RTA %x in RIOSavedTable\n", RtaUniq);
for ( rta=0; rta < TOTAL_MAP_ENTRIES; rta++ )
{
rio_dprintk (RIO_DEBUG_BOOT, "Check table entry %d (%x)",
rta,
p->RIOSavedTable[rta].RtaUniqueNum);
for (rta = 0; rta < TOTAL_MAP_ENTRIES; rta++) {
rio_dprintk(RIO_DEBUG_BOOT, "Check table entry %d (%x)", rta, p->RIOSavedTable[rta].RtaUniqueNum);
if ( (p->RIOSavedTable[rta].Flags & SLOT_IN_USE) &&
(p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq) )
{
if ((p->RIOSavedTable[rta].Flags & SLOT_IN_USE) && (p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq)) {
MapP = &p->RIOSavedTable[rta];
Flag = p->RIOSavedTable[rta].Flags;
if (RtaType == TYPE_RTA16)
{
for (entry2 = rta + 1; entry2 < TOTAL_MAP_ENTRIES;
entry2++)
{
if (RtaType == TYPE_RTA16) {
for (entry2 = rta + 1; entry2 < TOTAL_MAP_ENTRIES; entry2++) {
if (p->RIOSavedTable[entry2].RtaUniqueNum == RtaUniq)
break;
}
MapP2 = &p->RIOSavedTable[entry2];
rio_dprintk (RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n",
rta, entry2);
}
else
rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n", rta, entry2);
} else
rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entry %d\n", rta);
break;
}
@ -1089,19 +1014,14 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** tentative entry in the table.
*/
EmptySlot = 1;
if (RtaType == TYPE_RTA16)
{
if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0)
{
if (RtaType == TYPE_RTA16) {
if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0) {
RIODefaultName(p, HostP, entry);
FillSlot(entry, entry2, RtaUniq, HostP);
EmptySlot = 0;
}
}
else
{
if (RIOFindFreeID(p, HostP, &entry, NULL) == 0)
{
} else {
if (RIOFindFreeID(p, HostP, &entry, NULL) == 0) {
RIODefaultName(p, HostP, entry);
FillSlot(entry, 0, RtaUniq, HostP);
EmptySlot = 0;
@ -1119,18 +1039,13 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** If we found a SLOT_TENTATIVE entry on another host for this
** RTA in the driver table, just delete the other host entry.
*/
if (EmptySlot == 0)
{
if ( MapP )
{
if (Flag & SLOT_IN_USE)
{
rio_dprintk (RIO_DEBUG_BOOT,
"This RTA configured on another host - move entry to current host (1)\n");
if (EmptySlot == 0) {
if (MapP) {
if (Flag & SLOT_IN_USE) {
rio_dprintk(RIO_DEBUG_BOOT, "This RTA configured on another host - move entry to current host (1)\n");
HostP->Mapping[entry].SysPort = MapP->SysPort;
CCOPY(MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN);
HostP->Mapping[entry].Flags =
SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT;
HostP->Mapping[entry].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT;
#ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry]);
#endif
@ -1140,23 +1055,16 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
if (HostP->Mapping[entry].SysPort > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = HostP->Mapping[entry].SysPort;
rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) MapP->SysPort, MapP->Name);
}
else
{
rio_dprintk (RIO_DEBUG_BOOT,
"This RTA has a tentative entry on another host - delete that entry (1)\n");
HostP->Mapping[entry].Flags =
SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT;
} else {
rio_dprintk(RIO_DEBUG_BOOT, "This RTA has a tentative entry on another host - delete that entry (1)\n");
HostP->Mapping[entry].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT;
#ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry]);
#endif
}
if (RtaType == TYPE_RTA16)
{
if (Flag & SLOT_IN_USE)
{
HostP->Mapping[entry2].Flags = SLOT_IN_USE |
RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
if (RtaType == TYPE_RTA16) {
if (Flag & SLOT_IN_USE) {
HostP->Mapping[entry2].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
#ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#endif
@ -1169,13 +1077,9 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
p->RIOFirstPortsBooted = HostP->Mapping[entry2].SysPort;
if (HostP->Mapping[entry2].SysPort > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = HostP->Mapping[entry2].SysPort;
rio_dprintk (RIO_DEBUG_BOOT, "SysPort %d, Name %s\n",
(int)HostP->Mapping[entry2].SysPort,
HostP->Mapping[entry].Name);
}
else
HostP->Mapping[entry2].Flags = SLOT_TENTATIVE |
RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name);
} else
HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
#ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#endif
@ -1184,8 +1088,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
bzero((caddr_t) MapP, sizeof(struct Map));
if (!p->RIONoMessage)
cprintf("An orphaned RTA has been adopted by %s '%s' (%c).\n", MyType, MyName, MyLink + 'A');
}
else if (! p->RIONoMessage)
} else if (!p->RIONoMessage)
cprintf("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A');
RIOSetChange(p);
return TRUE;
@ -1198,10 +1101,8 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
*/
if (!p->RIONoMessage)
cprintf("The RTA connected to %s '%s' (%c) cannot be configured. You cannot configure more than 128 ports to one host card.\n", MyType, MyName, MyLink + 'A');
for ( entry=0; entry<HostP->NumExtraBooted; entry++ )
{
if ( HostP->ExtraUnits[entry] == RtaUniq )
{
for (entry = 0; entry < HostP->NumExtraBooted; entry++) {
if (HostP->ExtraUnits[entry] == RtaUniq) {
/*
** already got it!
*/
@ -1226,8 +1127,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** We no longer support the RIOBootMode variable. It is all done from the
** "boot/noboot" field in the rio.cf file.
*/
int
RIOBootOk(p, HostP, RtaUniq)
int RIOBootOk(p, HostP, RtaUniq)
struct rio_info *p;
struct Host *HostP;
ulong RtaUniq;
@ -1239,12 +1139,8 @@ ulong RtaUniq;
** Search bindings table for RTA or its parent.
** If it exists, return 0, else 1.
*/
for (Entry = 0;
( Entry < MAX_RTA_BINDINGS ) && ( p->RIOBindTab[Entry] != 0 );
Entry++)
{
if ( (p->RIOBindTab[Entry] == HostUniq) ||
(p->RIOBindTab[Entry] == RtaUniq) )
for (Entry = 0; (Entry < MAX_RTA_BINDINGS) && (p->RIOBindTab[Entry] != 0); Entry++) {
if ((p->RIOBindTab[Entry] == HostUniq) || (p->RIOBindTab[Entry] == RtaUniq))
return 0;
}
return 1;
@ -1255,8 +1151,7 @@ ulong RtaUniq;
** slots tentative, and the second one RTA_SECOND_SLOT as well.
*/
void
FillSlot(entry, entry2, RtaUniq, HostP)
void FillSlot(entry, entry2, RtaUniq, HostP)
int entry;
int entry2;
uint RtaUniq;
@ -1273,8 +1168,7 @@ struct Host *HostP;
HostP->Mapping[entry].ID = entry + 1;
HostP->Mapping[entry].ID2 = 0;
if (entry2) {
HostP->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT |
SLOT_TENTATIVE | RTA16_SECOND_SLOT);
HostP->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE | RTA16_SECOND_SLOT);
HostP->Mapping[entry2].SysPort = NO_PORT;
HostP->Mapping[entry2].RtaUniqueNum = RtaUniq;
HostP->Mapping[entry2].HostUniqueNum = HostP->UniqueNum;
@ -1296,4 +1190,3 @@ struct Host *HostP;
}
}
}