Commit 3b8e3f1e authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] rioboot: lindent

This is the result of indent -kr -i8 -bri0 -l255
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 74769abf
...@@ -80,11 +80,9 @@ static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3"; ...@@ -80,11 +80,9 @@ static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3";
#include "cmdblk.h" #include "cmdblk.h"
#include "route.h" #include "route.h"
static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP ); static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP);
static uchar static uchar RIOAtVec2Ctrl[] = {
RIOAtVec2Ctrl[] =
{
/* 0 */ INTERRUPT_DISABLE, /* 0 */ INTERRUPT_DISABLE,
/* 1 */ INTERRUPT_DISABLE, /* 1 */ INTERRUPT_DISABLE,
/* 2 */ INTERRUPT_DISABLE, /* 2 */ INTERRUPT_DISABLE,
...@@ -94,49 +92,48 @@ RIOAtVec2Ctrl[] = ...@@ -94,49 +92,48 @@ RIOAtVec2Ctrl[] =
/* 6 */ INTERRUPT_DISABLE, /* 6 */ INTERRUPT_DISABLE,
/* 7 */ INTERRUPT_DISABLE, /* 7 */ INTERRUPT_DISABLE,
/* 8 */ INTERRUPT_DISABLE, /* 8 */ INTERRUPT_DISABLE,
/* 9 */ IRQ_9|INTERRUPT_ENABLE, /* 9 */ IRQ_9 | INTERRUPT_ENABLE,
/* 10 */ INTERRUPT_DISABLE, /* 10 */ INTERRUPT_DISABLE,
/* 11 */ IRQ_11|INTERRUPT_ENABLE, /* 11 */ IRQ_11 | INTERRUPT_ENABLE,
/* 12 */ IRQ_12|INTERRUPT_ENABLE, /* 12 */ IRQ_12 | INTERRUPT_ENABLE,
/* 13 */ INTERRUPT_DISABLE, /* 13 */ INTERRUPT_DISABLE,
/* 14 */ INTERRUPT_DISABLE, /* 14 */ INTERRUPT_DISABLE,
/* 15 */ IRQ_15|INTERRUPT_ENABLE /* 15 */ IRQ_15 | INTERRUPT_ENABLE
}; };
/* /*
** Load in the RTA boot code. ** Load in the RTA boot code.
*/ */
int int RIOBootCodeRTA(p, rbp)
RIOBootCodeRTA(p, rbp) struct rio_info *p;
struct rio_info * p; struct DownLoad *rbp;
struct DownLoad * rbp;
{ {
int offset; int offset;
func_enter (); func_enter();
/* Linux doesn't allow you to disable interrupts during a /* Linux doesn't allow you to disable interrupts during a
"copyin". (Crash when a pagefault occurs). */ "copyin". (Crash when a pagefault occurs). */
/* disable(oldspl); */ /* disable(oldspl); */
rio_dprintk (RIO_DEBUG_BOOT, "Data at user address 0x%x\n",(int)rbp->DataP); rio_dprintk(RIO_DEBUG_BOOT, "Data at user address 0x%x\n", (int) rbp->DataP);
/* /*
** Check that we have set asside enough memory for this ** Check that we have set asside enough memory for this
*/ */
if ( rbp->Count > SIXTY_FOUR_K ) { if (rbp->Count > SIXTY_FOUR_K) {
rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n"); rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n");
p->RIOError.Error = HOST_FILE_TOO_LARGE; p->RIOError.Error = HOST_FILE_TOO_LARGE;
/* restore(oldspl); */ /* restore(oldspl); */
func_exit (); func_exit();
return -ENOMEM; return -ENOMEM;
} }
if ( p->RIOBooting ) { if (p->RIOBooting) {
rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n"); rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n");
p->RIOError.Error = BOOT_IN_PROGRESS; p->RIOError.Error = BOOT_IN_PROGRESS;
/* restore(oldspl); */ /* restore(oldspl); */
func_exit (); func_exit();
return -EBUSY; return -EBUSY;
} }
...@@ -145,26 +142,24 @@ struct DownLoad * rbp; ...@@ -145,26 +142,24 @@ struct DownLoad * rbp;
** so calculate how far we have to move the data up the buffer ** so calculate how far we have to move the data up the buffer
** to achieve this. ** to achieve this.
*/ */
offset = (RTA_BOOT_DATA_SIZE - (rbp->Count % RTA_BOOT_DATA_SIZE)) % offset = (RTA_BOOT_DATA_SIZE - (rbp->Count % RTA_BOOT_DATA_SIZE)) % RTA_BOOT_DATA_SIZE;
RTA_BOOT_DATA_SIZE;
/* /*
** Be clean, and clear the 'unused' portion of the boot buffer, ** Be clean, and clear the 'unused' portion of the boot buffer,
** because it will (eventually) be part of the Rta run time environment ** because it will (eventually) be part of the Rta run time environment
** and so should be zeroed. ** and so should be zeroed.
*/ */
bzero( (caddr_t)p->RIOBootPackets, offset ); bzero((caddr_t) p->RIOBootPackets, offset);
/* /*
** Copy the data from user space. ** Copy the data from user space.
*/ */
if ( copyin((int)rbp->DataP,((caddr_t)(p->RIOBootPackets))+offset, if (copyin((int) rbp->DataP, ((caddr_t) (p->RIOBootPackets)) + offset, rbp->Count) == COPYFAIL) {
rbp->Count) ==COPYFAIL ) { rio_dprintk(RIO_DEBUG_BOOT, "Bad data copy from user space\n");
rio_dprintk (RIO_DEBUG_BOOT, "Bad data copy from user space\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
/* restore(oldspl); */ /* restore(oldspl); */
func_exit (); func_exit();
return -EFAULT; return -EFAULT;
} }
...@@ -172,7 +167,7 @@ struct DownLoad * rbp; ...@@ -172,7 +167,7 @@ struct DownLoad * rbp;
** Make sure that our copy of the size includes that offset we discussed ** Make sure that our copy of the size includes that offset we discussed
** earlier. ** earlier.
*/ */
p->RIONumBootPkts = (rbp->Count+offset)/RTA_BOOT_DATA_SIZE; p->RIONumBootPkts = (rbp->Count + offset) / RTA_BOOT_DATA_SIZE;
p->RIOBootCount = rbp->Count; p->RIOBootCount = rbp->Count;
/* restore(oldspl); */ /* restore(oldspl); */
...@@ -180,17 +175,14 @@ struct DownLoad * rbp; ...@@ -180,17 +175,14 @@ struct DownLoad * rbp;
return 0; return 0;
} }
void rio_start_card_running (struct Host * HostP) void rio_start_card_running(struct Host *HostP)
{ {
func_enter (); func_enter();
switch ( HostP->Type ) { switch (HostP->Type) {
case RIO_AT: case RIO_AT:
rio_dprintk (RIO_DEBUG_BOOT, "Start ISA card running\n"); rio_dprintk(RIO_DEBUG_BOOT, "Start ISA card running\n");
WBYTE(HostP->Control, WBYTE(HostP->Control, BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF]);
BOOT_FROM_RAM | EXTERNAL_BUS_ON
| HostP->Mode
| RIOAtVec2Ctrl[HostP->Ivec & 0xF] );
break; break;
#ifdef FUTURE_RELEASE #ifdef FUTURE_RELEASE
...@@ -199,7 +191,7 @@ void rio_start_card_running (struct Host * HostP) ...@@ -199,7 +191,7 @@ void rio_start_card_running (struct Host * HostP)
** MCA handles IRQ vectors differently, so we don't write ** MCA handles IRQ vectors differently, so we don't write
** them to this register. ** them to this register.
*/ */
rio_dprintk (RIO_DEBUG_BOOT, "Start MCA card running\n"); rio_dprintk(RIO_DEBUG_BOOT, "Start MCA card running\n");
WBYTE(HostP->Control, McaTpBootFromRam | McaTpBusEnable | HostP->Mode); WBYTE(HostP->Control, McaTpBootFromRam | McaTpBusEnable | HostP->Mode);
break; break;
...@@ -207,8 +199,8 @@ void rio_start_card_running (struct Host * HostP) ...@@ -207,8 +199,8 @@ void rio_start_card_running (struct Host * HostP)
/* /*
** EISA is totally different and expects OUTBZs to turn it on. ** EISA is totally different and expects OUTBZs to turn it on.
*/ */
rio_dprintk (RIO_DEBUG_BOOT, "Start EISA card running\n"); rio_dprintk(RIO_DEBUG_BOOT, "Start EISA card running\n");
OUTBZ( HostP->Slot, EISA_CONTROL_PORT, HostP->Mode | RIOEisaVec2Ctrl[HostP->Ivec] | EISA_TP_RUN | EISA_TP_BUS_ENABLE | EISA_TP_BOOT_FROM_RAM ); OUTBZ(HostP->Slot, EISA_CONTROL_PORT, HostP->Mode | RIOEisaVec2Ctrl[HostP->Ivec] | EISA_TP_RUN | EISA_TP_BUS_ENABLE | EISA_TP_BOOT_FROM_RAM);
break; break;
#endif #endif
...@@ -218,11 +210,11 @@ void rio_start_card_running (struct Host * HostP) ...@@ -218,11 +210,11 @@ void rio_start_card_running (struct Host * HostP)
** mapped, so we are writing to memory registers instead of io ** mapped, so we are writing to memory registers instead of io
** ports. ** ports.
*/ */
rio_dprintk (RIO_DEBUG_BOOT, "Start PCI card running\n"); rio_dprintk(RIO_DEBUG_BOOT, "Start PCI card running\n");
WBYTE(HostP->Control, PCITpBootFromRam | PCITpBusEnable | HostP->Mode); WBYTE(HostP->Control, PCITpBootFromRam | PCITpBusEnable | HostP->Mode);
break; break;
default: default:
rio_dprintk (RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type); rio_dprintk(RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type);
break; break;
} }
/* /*
...@@ -239,9 +231,8 @@ void rio_start_card_running (struct Host * HostP) ...@@ -239,9 +231,8 @@ void rio_start_card_running (struct Host * HostP)
** Put your rubber pants on before messing with this code - even the magic ** Put your rubber pants on before messing with this code - even the magic
** numbers have trouble understanding what they are doing here. ** numbers have trouble understanding what they are doing here.
*/ */
int int RIOBootCodeHOST(p, rbp)
RIOBootCodeHOST(p, rbp) struct rio_info *p;
struct rio_info * p;
register struct DownLoad *rbp; register struct DownLoad *rbp;
{ {
register struct Host *HostP; register struct Host *HostP;
...@@ -260,16 +251,15 @@ register struct DownLoad *rbp; ...@@ -260,16 +251,15 @@ register struct DownLoad *rbp;
unsigned long flags; unsigned long flags;
HostP = NULL; /* Assure the compiler we've initialized it */ HostP = NULL; /* Assure the compiler we've initialized it */
for ( host=0; host<p->RIONumHosts; host++ ) { for (host = 0; host < p->RIONumHosts; host++) {
rio_dprintk (RIO_DEBUG_BOOT, "Attempt to boot host %d\n",host); rio_dprintk(RIO_DEBUG_BOOT, "Attempt to boot host %d\n", host);
HostP = &p->RIOHosts[host]; HostP = &p->RIOHosts[host];
rio_dprintk (RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec);
HostP->Type, HostP->Mode, HostP->Ivec);
if ( (HostP->Flags & RUN_STATE) != RC_WAITING ) { if ((HostP->Flags & RUN_STATE) != RC_WAITING) {
rio_dprintk (RIO_DEBUG_BOOT, "%s %d already running\n","Host",host); rio_dprintk(RIO_DEBUG_BOOT, "%s %d already running\n", "Host", host);
continue; continue;
} }
...@@ -284,68 +274,67 @@ register struct DownLoad *rbp; ...@@ -284,68 +274,67 @@ register struct DownLoad *rbp;
** Therefore, we need to start copying at address ** Therefore, we need to start copying at address
** (caddr+p->RIOConf.HostLoadBase-rbp->Count) ** (caddr+p->RIOConf.HostLoadBase-rbp->Count)
*/ */
StartP = (caddr_t)&Cad[p->RIOConf.HostLoadBase-rbp->Count]; StartP = (caddr_t) & Cad[p->RIOConf.HostLoadBase - rbp->Count];
rio_dprintk (RIO_DEBUG_BOOT, "kernel virtual address for host is 0x%x\n", (int)Cad ); rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for host is 0x%x\n", (int) Cad);
rio_dprintk (RIO_DEBUG_BOOT, "kernel virtual address for download is 0x%x\n", (int)StartP); rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for download is 0x%x\n", (int) StartP);
rio_dprintk (RIO_DEBUG_BOOT, "host loadbase is 0x%x\n",p->RIOConf.HostLoadBase); rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase);
rio_dprintk (RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count); rio_dprintk(RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count);
if ( p->RIOConf.HostLoadBase < rbp->Count ) { if (p->RIOConf.HostLoadBase < rbp->Count) {
rio_dprintk (RIO_DEBUG_BOOT, "Bin too large\n"); rio_dprintk(RIO_DEBUG_BOOT, "Bin too large\n");
p->RIOError.Error = HOST_FILE_TOO_LARGE; p->RIOError.Error = HOST_FILE_TOO_LARGE;
func_exit (); func_exit();
return -EFBIG; return -EFBIG;
} }
/* /*
** Ensure that the host really is stopped. ** Ensure that the host really is stopped.
** Disable it's external bus & twang its reset line. ** Disable it's external bus & twang its reset line.
*/ */
RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot);
/* /*
** Copy the data directly from user space to the SRAM. ** Copy the data directly from user space to the SRAM.
** This ain't going to be none too clever if the download ** This ain't going to be none too clever if the download
** code is bigger than this segment. ** code is bigger than this segment.
*/ */
rio_dprintk (RIO_DEBUG_BOOT, "Copy in code\n"); rio_dprintk(RIO_DEBUG_BOOT, "Copy in code\n");
/* /*
** PCI hostcard can't cope with 32 bit accesses and so need to copy ** PCI hostcard can't cope with 32 bit accesses and so need to copy
** data to a local buffer, and then dripfeed the card. ** data to a local buffer, and then dripfeed the card.
*/ */
if ( HostP->Type == RIO_PCI ) { if (HostP->Type == RIO_PCI) {
/* int offset; */ /* int offset; */
DownCode = sysbrk(rbp->Count); DownCode = sysbrk(rbp->Count);
if ( !DownCode ) { if (!DownCode) {
rio_dprintk (RIO_DEBUG_BOOT, "No system memory available\n"); rio_dprintk(RIO_DEBUG_BOOT, "No system memory available\n");
p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY; p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY;
func_exit (); func_exit();
return -ENOMEM; return -ENOMEM;
} }
bzero(DownCode, rbp->Count); bzero(DownCode, rbp->Count);
if ( copyin((int)rbp->DataP,DownCode,rbp->Count)==COPYFAIL ) { if (copyin((int) rbp->DataP, DownCode, rbp->Count) == COPYFAIL) {
rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n"); rio_dprintk(RIO_DEBUG_BOOT, "Bad copyin of host data\n");
sysfree( DownCode, rbp->Count ); sysfree(DownCode, rbp->Count);
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
func_exit (); func_exit();
return -EFAULT; return -EFAULT;
} }
HostP->Copy( DownCode, StartP, rbp->Count ); HostP->Copy(DownCode, StartP, rbp->Count);
sysfree( DownCode, 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");
rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
func_exit (); func_exit();
return -EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_BOOT, "Copy completed\n"); rio_dprintk(RIO_DEBUG_BOOT, "Copy completed\n");
/* /*
** S T O P ! ** S T O P !
...@@ -422,7 +411,7 @@ register struct DownLoad *rbp; ...@@ -422,7 +411,7 @@ register struct DownLoad *rbp;
** a short branch to 0x7FF8, where a long branch is coded. ** a short branch to 0x7FF8, where a long branch is coded.
*/ */
DestP = (BYTE *)&Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */ DestP = (BYTE *) & Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */
#define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */ #define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */
#define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */ #define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */
...@@ -437,17 +426,17 @@ register struct DownLoad *rbp; ...@@ -437,17 +426,17 @@ register struct DownLoad *rbp;
** Memsize is 64K for this range of Tp, so offset is a short (unsigned, ** Memsize is 64K for this range of Tp, so offset is a short (unsigned,
** cos I don't understand 2's complement). ** cos I don't understand 2's complement).
*/ */
offset = (p->RIOConf.HostLoadBase-2)-0x7FFC; offset = (p->RIOConf.HostLoadBase - 2) - 0x7FFC;
WBYTE( DestP[0] , NFIX(((ushort)(~offset) >> (ushort)12) & 0xF) ); WBYTE(DestP[0], NFIX(((ushort) (~offset) >> (ushort) 12) & 0xF));
WBYTE( DestP[1] , PFIX(( offset >> 8) & 0xF) ); WBYTE(DestP[1], PFIX((offset >> 8) & 0xF));
WBYTE( DestP[2] , PFIX(( offset >> 4) & 0xF) ); WBYTE(DestP[2], PFIX((offset >> 4) & 0xF));
WBYTE( DestP[3] , JUMP( offset & 0xF) ); WBYTE(DestP[3], JUMP(offset & 0xF));
WBYTE( DestP[6] , NFIX(0) ); WBYTE(DestP[6], NFIX(0));
WBYTE( DestP[7] , JUMP(8) ); WBYTE(DestP[7], JUMP(8));
rio_dprintk (RIO_DEBUG_BOOT, "host loadbase is 0x%x\n",p->RIOConf.HostLoadBase); rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase);
rio_dprintk (RIO_DEBUG_BOOT, "startup offset is 0x%x\n",offset); rio_dprintk(RIO_DEBUG_BOOT, "startup offset is 0x%x\n", offset);
/* /*
** Flag what is going on ** Flag what is going on
...@@ -461,27 +450,25 @@ register struct DownLoad *rbp; ...@@ -461,27 +450,25 @@ register struct DownLoad *rbp;
*/ */
OldParmMap = RWORD(HostP->__ParmMapR); OldParmMap = RWORD(HostP->__ParmMapR);
rio_dprintk (RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n",OldParmMap); rio_dprintk(RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n", OldParmMap);
/* /*
** And start it running (I hope). ** And start it running (I hope).
** As there is nothing dodgy or obscure about the ** As there is nothing dodgy or obscure about the
** above code, this is guaranteed to work every time. ** 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", rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec);
HostP->Type, HostP->Mode, HostP->Ivec);
rio_start_card_running(HostP); rio_start_card_running(HostP);
rio_dprintk (RIO_DEBUG_BOOT, "Set control port\n"); rio_dprintk(RIO_DEBUG_BOOT, "Set control port\n");
/* /*
** Now, wait for upto five seconds for the Tp to setup the parmmap ** Now, wait for upto five seconds for the Tp to setup the parmmap
** pointer: ** pointer:
*/ */
for ( wait_count=0; (wait_count<p->RIOConf.StartupTime)&& for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (RWORD(HostP->__ParmMapR) == OldParmMap); wait_count++) {
(RWORD(HostP->__ParmMapR)==OldParmMap); wait_count++ ) { rio_dprintk(RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n", wait_count, RWORD(HostP->__ParmMapR));
rio_dprintk (RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n",wait_count,RWORD(HostP->__ParmMapR));
delay(HostP, HUNDRED_MS); delay(HostP, HUNDRED_MS);
} }
...@@ -490,20 +477,15 @@ register struct DownLoad *rbp; ...@@ -490,20 +477,15 @@ register struct DownLoad *rbp;
** If the parmmap pointer is unchanged, then the host code ** If the parmmap pointer is unchanged, then the host code
** has crashed & burned in a really spectacular way ** has crashed & burned in a really spectacular way
*/ */
if ( RWORD(HostP->__ParmMapR) == OldParmMap ) { if (RWORD(HostP->__ParmMapR) == OldParmMap) {
rio_dprintk (RIO_DEBUG_BOOT, "parmmap 0x%x\n", RWORD(HostP->__ParmMapR)); rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", RWORD(HostP->__ParmMapR));
rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n");
HostP->Flags &= ~RUN_STATE;
#define HOST_DISABLE \ HostP->Flags |= RC_STUFFED;
HostP->Flags &= ~RUN_STATE; \ RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot);
HostP->Flags |= RC_STUFFED; \ continue}
RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );\
continue
HOST_DISABLE;
}
rio_dprintk (RIO_DEBUG_BOOT, "Running 0x%x\n", RWORD(HostP->__ParmMapR)); rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", RWORD(HostP->__ParmMapR));
/* /*
** Well, the board thought it was OK, and setup its parmmap ** Well, the board thought it was OK, and setup its parmmap
...@@ -514,95 +496,95 @@ register struct DownLoad *rbp; ...@@ -514,95 +496,95 @@ register struct DownLoad *rbp;
/* /*
** Grab a 32 bit pointer to the parmmap structure ** Grab a 32 bit pointer to the parmmap structure
*/ */
ParmMapP = (PARM_MAP *)RIO_PTR(Cad,RWORD(HostP->__ParmMapR)); ParmMapP = (PARM_MAP *) RIO_PTR(Cad, RWORD(HostP->__ParmMapR));
rio_dprintk (RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int)ParmMapP); rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP);
ParmMapP = (PARM_MAP *)((unsigned long)Cad + ParmMapP = (PARM_MAP *) ((unsigned long) Cad + (unsigned long) ((RWORD((HostP->__ParmMapR))) & 0xFFFF));
(unsigned long)((RWORD((HostP->__ParmMapR))) & 0xFFFF)); rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP);
rio_dprintk (RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int)ParmMapP);
/* /*
** The links entry should be 0xFFFF; we set it up ** The links entry should be 0xFFFF; we set it up
** with a mask to say how many PHBs to use, and ** with a mask to say how many PHBs to use, and
** which links to use. ** which links to use.
*/ */
if ( (RWORD(ParmMapP->links) & 0xFFFF) != 0xFFFF ) { if ((RWORD(ParmMapP->links) & 0xFFFF) != 0xFFFF) {
rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); 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)); 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); WWORD(ParmMapP->links, RIO_LINK_ENABLE);
/* /*
** now wait for the card to set all the parmmap->XXX stuff ** now wait for the card to set all the parmmap->XXX stuff
** this is a wait of upto two seconds.... ** this is a wait of upto two seconds....
*/ */
rio_dprintk (RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n",p->RIOConf.StartupTime); rio_dprintk(RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n", p->RIOConf.StartupTime);
HostP->timeout_id = 0; HostP->timeout_id = 0;
for ( wait_count=0; (wait_count<p->RIOConf.StartupTime) && for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && !RWORD(ParmMapP->init_done); wait_count++) {
!RWORD(ParmMapP->init_done); wait_count++ ) { rio_dprintk(RIO_DEBUG_BOOT, "Waiting for init_done\n");
rio_dprintk (RIO_DEBUG_BOOT, "Waiting for init_done\n");
delay(HostP, HUNDRED_MS); delay(HostP, HUNDRED_MS);
} }
rio_dprintk (RIO_DEBUG_BOOT, "OK! init_done!\n"); rio_dprintk(RIO_DEBUG_BOOT, "OK! init_done!\n");
if (RWORD(ParmMapP->error) != E_NO_ERROR || if (RWORD(ParmMapP->error) != E_NO_ERROR || !RWORD(ParmMapP->init_done)) {
!RWORD(ParmMapP->init_done) ) { rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name);
rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n");
rio_dprintk (RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); HostP->Flags &= ~RUN_STATE;
HOST_DISABLE; HostP->Flags |= RC_STUFFED;
} RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot);
continue}
rio_dprintk (RIO_DEBUG_BOOT, "Got init_done\n"); rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n");
/* /*
** It runs! It runs! ** It runs! It runs!
*/ */
rio_dprintk (RIO_DEBUG_BOOT, "Host ID %x Running\n",HostP->UniqueNum); rio_dprintk(RIO_DEBUG_BOOT, "Host ID %x Running\n", HostP->UniqueNum);
/* /*
** set the time period between interrupts. ** set the time period between interrupts.
*/ */
WWORD(ParmMapP->timer, (short)p->RIOConf.Timer ); WWORD(ParmMapP->timer, (short) p->RIOConf.Timer);
/* /*
** Translate all the 16 bit pointers in the __ParmMapR into ** Translate all the 16 bit pointers in the __ParmMapR into
** 32 bit pointers for the driver. ** 32 bit pointers for the driver.
*/ */
HostP->ParmMapP = ParmMapP; HostP->ParmMapP = ParmMapP;
HostP->PhbP = (PHB*)RIO_PTR(Cad,RWORD(ParmMapP->phb_ptr)); HostP->PhbP = (PHB *) RIO_PTR(Cad, RWORD(ParmMapP->phb_ptr));
HostP->RupP = (RUP*)RIO_PTR(Cad,RWORD(ParmMapP->rups)); HostP->RupP = (RUP *) RIO_PTR(Cad, RWORD(ParmMapP->rups));
HostP->PhbNumP = (ushort*)RIO_PTR(Cad,RWORD(ParmMapP->phb_num_ptr)); HostP->PhbNumP = (ushort *) RIO_PTR(Cad, RWORD(ParmMapP->phb_num_ptr));
HostP->LinkStrP = (LPB*)RIO_PTR(Cad,RWORD(ParmMapP->link_str_ptr)); HostP->LinkStrP = (LPB *) RIO_PTR(Cad, RWORD(ParmMapP->link_str_ptr));
/* /*
** point the UnixRups at the real Rups ** point the UnixRups at the real Rups
*/ */
for ( RupN = 0; RupN<MAX_RUP; RupN++ ) { for (RupN = 0; RupN < MAX_RUP; RupN++) {
HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN]; HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN];
HostP->UnixRups[RupN].Id = RupN+1; HostP->UnixRups[RupN].Id = RupN + 1;
HostP->UnixRups[RupN].BaseSysPort = NO_PORT; HostP->UnixRups[RupN].BaseSysPort = NO_PORT;
spin_lock_init(&HostP->UnixRups[RupN].RupLock); spin_lock_init(&HostP->UnixRups[RupN].RupLock);
} }
for ( RupN = 0; RupN<LINKS_PER_UNIT; RupN++ ) { for (RupN = 0; RupN < LINKS_PER_UNIT; RupN++) {
HostP->UnixRups[RupN+MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup; HostP->UnixRups[RupN + MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup;
HostP->UnixRups[RupN+MAX_RUP].Id = 0; HostP->UnixRups[RupN + MAX_RUP].Id = 0;
HostP->UnixRups[RupN+MAX_RUP].BaseSysPort = NO_PORT; HostP->UnixRups[RupN + MAX_RUP].BaseSysPort = NO_PORT;
spin_lock_init(&HostP->UnixRups[RupN+MAX_RUP].RupLock); spin_lock_init(&HostP->UnixRups[RupN + MAX_RUP].RupLock);
} }
/* /*
** point the PortP->Phbs at the real Phbs ** point the PortP->Phbs at the real Phbs
*/ */
for ( PortN=p->RIOFirstPortsMapped; for (PortN = p->RIOFirstPortsMapped; PortN < p->RIOLastPortsMapped + PORTS_PER_RTA; PortN++) {
PortN<p->RIOLastPortsMapped+PORTS_PER_RTA; PortN++ ) { if (p->RIOPortp[PortN]->HostP == HostP) {
if ( p->RIOPortp[PortN]->HostP == HostP ) {
struct Port *PortP = p->RIOPortp[PortN]; struct Port *PortP = p->RIOPortp[PortN];
struct PHB *PhbP; struct PHB *PhbP;
/* int oldspl; */ /* int oldspl; */
if ( !PortP->Mapped ) if (!PortP->Mapped)
continue; continue;
PhbP = &HostP->PhbP[PortP->HostPort]; PhbP = &HostP->PhbP[PortP->HostPort];
...@@ -610,23 +592,23 @@ register struct DownLoad *rbp; ...@@ -610,23 +592,23 @@ register struct DownLoad *rbp;
PortP->PhbP = PhbP; PortP->PhbP = PhbP;
PortP->TxAdd = (WORD *)RIO_PTR(Cad,RWORD(PhbP->tx_add)); PortP->TxAdd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_add));
PortP->TxStart = (WORD *)RIO_PTR(Cad,RWORD(PhbP->tx_start)); PortP->TxStart = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_start));
PortP->TxEnd = (WORD *)RIO_PTR(Cad,RWORD(PhbP->tx_end)); PortP->TxEnd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_end));
PortP->RxRemove = (WORD *)RIO_PTR(Cad,RWORD(PhbP->rx_remove)); PortP->RxRemove = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_remove));
PortP->RxStart = (WORD *)RIO_PTR(Cad,RWORD(PhbP->rx_start)); PortP->RxStart = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_start));
PortP->RxEnd = (WORD *)RIO_PTR(Cad,RWORD(PhbP->rx_end)); PortP->RxEnd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_end));
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
/* /*
** point the UnixRup at the base SysPort ** point the UnixRup at the base SysPort
*/ */
if ( !(PortN % PORTS_PER_RTA) ) if (!(PortN % PORTS_PER_RTA))
HostP->UnixRups[PortP->RupNum].BaseSysPort = PortN; HostP->UnixRups[PortP->RupNum].BaseSysPort = PortN;
} }
} }
rio_dprintk (RIO_DEBUG_BOOT, "Set the card running... \n"); rio_dprintk(RIO_DEBUG_BOOT, "Set the card running... \n");
/* /*
** last thing - show the world that everything is in place ** last thing - show the world that everything is in place
*/ */
...@@ -642,8 +624,8 @@ register struct DownLoad *rbp; ...@@ -642,8 +624,8 @@ register struct DownLoad *rbp;
p->RIOSystemUp++; p->RIOSystemUp++;
rio_dprintk (RIO_DEBUG_BOOT, "Done everything %x\n", HostP->Ivec); rio_dprintk(RIO_DEBUG_BOOT, "Done everything %x\n", HostP->Ivec);
func_exit (); func_exit();
return 0; return 0;
} }
...@@ -653,14 +635,13 @@ register struct DownLoad *rbp; ...@@ -653,14 +635,13 @@ register struct DownLoad *rbp;
** Boot an RTA. If we have successfully processed this boot, then ** Boot an RTA. If we have successfully processed this boot, then
** return 1. If we havent, then return 0. ** return 1. If we havent, then return 0.
*/ */
int int RIOBootRup(p, Rup, HostP, PacketP)
RIOBootRup( p, Rup, HostP, PacketP) struct rio_info *p;
struct rio_info * p;
uint Rup; uint Rup;
struct Host *HostP; struct Host *HostP;
struct PKT *PacketP; struct PKT *PacketP;
{ {
struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
struct PktCmd_M *PktReplyP; struct PktCmd_M *PktReplyP;
struct CmdBlk *CmdBlkP; struct CmdBlk *CmdBlkP;
uint sequence; uint sequence;
...@@ -668,8 +649,8 @@ struct PKT *PacketP; ...@@ -668,8 +649,8 @@ struct PKT *PacketP;
/* /*
** If we haven't been told what to boot, we can't boot it. ** If we haven't been told what to boot, we can't boot it.
*/ */
if ( p->RIONumBootPkts == 0 ) { if (p->RIONumBootPkts == 0) {
rio_dprintk (RIO_DEBUG_BOOT, "No RTA code to download yet\n"); rio_dprintk(RIO_DEBUG_BOOT, "No RTA code to download yet\n");
return 0; return 0;
} }
...@@ -682,41 +663,39 @@ struct PKT *PacketP; ...@@ -682,41 +663,39 @@ struct PKT *PacketP;
** this first and then get a command block, then handle every other ** this first and then get a command block, then handle every other
** case, relinquishing the command block if disaster strikes! ** case, relinquishing the command block if disaster strikes!
*/ */
if ( (RBYTE(PacketP->len) & PKT_CMD_BIT) && if ((RBYTE(PacketP->len) & PKT_CMD_BIT) && (RBYTE(PktCmdP->Command) == BOOT_COMPLETED))
(RBYTE(PktCmdP->Command)==BOOT_COMPLETED) ) return RIOBootComplete(p, HostP, Rup, PktCmdP);
return RIOBootComplete(p, HostP, Rup, PktCmdP );
/* /*
** try to unhook a command block from the command free list. ** try to unhook a command block from the command free list.
*/ */
if ( !(CmdBlkP = RIOGetCmdBlk()) ) { if (!(CmdBlkP = RIOGetCmdBlk())) {
rio_dprintk (RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n"); rio_dprintk(RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n");
return 0; return 0;
} }
/* /*
** Fill in the default info on the command block ** Fill in the default info on the command block
*/ */
CmdBlkP->Packet.dest_unit = Rup < (ushort)MAX_RUP ? Rup : 0; CmdBlkP->Packet.dest_unit = Rup < (ushort) MAX_RUP ? Rup : 0;
CmdBlkP->Packet.dest_port = BOOT_RUP; CmdBlkP->Packet.dest_port = BOOT_RUP;
CmdBlkP->Packet.src_unit = 0; CmdBlkP->Packet.src_unit = 0;
CmdBlkP->Packet.src_port = BOOT_RUP; CmdBlkP->Packet.src_port = BOOT_RUP;
CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL;
PktReplyP = (struct PktCmd_M *)CmdBlkP->Packet.data; PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data;
/* /*
** process COMMANDS on the boot rup! ** process COMMANDS on the boot rup!
*/ */
if ( RBYTE(PacketP->len) & PKT_CMD_BIT ) { if (RBYTE(PacketP->len) & PKT_CMD_BIT) {
/* /*
** We only expect one type of command - a BOOT_REQUEST! ** We only expect one type of command - a BOOT_REQUEST!
*/ */
if ( RBYTE(PktCmdP->Command) != BOOT_REQUEST ) { if (RBYTE(PktCmdP->Command) != BOOT_REQUEST) {
rio_dprintk (RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %d\n", rio_dprintk(RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %d\n", PktCmdP->Command, Rup, HostP - p->RIOHosts);
PktCmdP->Command,Rup,HostP-p->RIOHosts); ShowPacket(DBG_BOOT, PacketP);
ShowPacket( DBG_BOOT, PacketP ); RIOFreeCmdBlk(CmdBlkP);
RIOFreeCmdBlk( CmdBlkP );
return 1; return 1;
} }
...@@ -749,11 +728,9 @@ struct PKT *PacketP; ...@@ -749,11 +728,9 @@ struct PKT *PacketP;
CmdBlkP->Packet.len = BOOT_SEQUENCE_LEN | PKT_CMD_BIT; CmdBlkP->Packet.len = BOOT_SEQUENCE_LEN | PKT_CMD_BIT;
bcopy("BOOT",(void *)&CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN],4); 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", 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);
HostP-p->RIOHosts, Rup, p->RIONumBootPkts, p->RIONumBootPkts,
p->RIOConf.RtaLoadBase);
/* /*
** If this host is in slave mode, send the RTA an invalid boot ** If this host is in slave mode, send the RTA an invalid boot
...@@ -763,7 +740,7 @@ struct PKT *PacketP; ...@@ -763,7 +740,7 @@ struct PKT *PacketP;
** the RTA and make it its own. ** the RTA and make it its own.
*/ */
p->RIOBooting++; p->RIOBooting++;
RIOQueueCmdBlk( HostP, Rup, CmdBlkP ); RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
return 1; return 1;
} }
...@@ -772,22 +749,20 @@ struct PKT *PacketP; ...@@ -772,22 +749,20 @@ struct PKT *PacketP;
*/ */
sequence = RWORD(PktCmdP->Sequence); sequence = RWORD(PktCmdP->Sequence);
rio_dprintk (RIO_DEBUG_BOOT, "Boot block %d on Host %d Rup%d\n",sequence,HostP-p->RIOHosts,Rup); rio_dprintk(RIO_DEBUG_BOOT, "Boot block %d on Host %d Rup%d\n", sequence, HostP - p->RIOHosts, Rup);
if ( sequence >= p->RIONumBootPkts ) { if (sequence >= p->RIONumBootPkts) {
rio_dprintk (RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, rio_dprintk(RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, p->RIONumBootPkts);
p->RIONumBootPkts); ShowPacket(DBG_BOOT, PacketP);
ShowPacket( DBG_BOOT, PacketP );
} }
PktReplyP->Sequence = sequence; PktReplyP->Sequence = sequence;
bcopy( p->RIOBootPackets[ p->RIONumBootPkts - sequence - 1 ], bcopy(p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], PktReplyP->BootData, RTA_BOOT_DATA_SIZE);
PktReplyP->BootData, RTA_BOOT_DATA_SIZE );
CmdBlkP->Packet.len = PKT_MAX_DATA_LEN; CmdBlkP->Packet.len = PKT_MAX_DATA_LEN;
ShowPacket( DBG_BOOT, &CmdBlkP->Packet ); ShowPacket(DBG_BOOT, &CmdBlkP->Packet);
RIOQueueCmdBlk( HostP, Rup, CmdBlkP ); RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
return 1; return 1;
} }
...@@ -797,7 +772,7 @@ struct PKT *PacketP; ...@@ -797,7 +772,7 @@ struct PKT *PacketP;
** If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA. ** If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA.
** RtaUniq is the booted RTA. ** RtaUniq is the booted RTA.
*/ */
static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP ) static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP)
{ {
struct Map *MapP = NULL; struct Map *MapP = NULL;
struct Map *MapP2 = NULL; struct Map *MapP2 = NULL;
...@@ -809,35 +784,28 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -809,35 +784,28 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
char *MyType, *MyName; char *MyType, *MyName;
uint MyLink; uint MyLink;
ushort RtaType; ushort RtaType;
uint RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + uint RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24);
(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 /* Was RIOBooting-- . That's bad. If an RTA sends two of them, the
driver will never think that the RTA has booted... -- REW */ driver will never think that the RTA has booted... -- REW */
p->RIOBooting = 0; p->RIOBooting = 0;
rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot completed - BootInProgress now %d\n", p->RIOBooting); rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot completed - BootInProgress now %d\n", p->RIOBooting);
/* /*
** Determine type of unit (16/8 port RTA). ** Determine type of unit (16/8 port RTA).
*/ */
RtaType = GetUnitType(RtaUniq); RtaType = GetUnitType(RtaUniq);
if ( Rup >= (ushort)MAX_RUP ) { if (Rup >= (ushort) MAX_RUP) {
rio_dprintk (RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n", 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');
HostP->Name, 8 * RtaType, RBYTE(PktCmdP->LinkNum)+'A');
} else { } else {
rio_dprintk (RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n", 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');
HostP->Mapping[Rup].Name, 8 * RtaType,
RBYTE(PktCmdP->LinkNum)+'A');
} }
rio_dprintk (RIO_DEBUG_BOOT, "UniqNum is 0x%x\n",RtaUniq); 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");
rio_dprintk (RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n");
return TRUE; return TRUE;
} }
...@@ -846,24 +814,18 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -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 ** system, or the system is in slave mode, do not attempt to create
** a new table entry for it. ** a new table entry for it.
*/ */
if (!RIOBootOk(p, HostP, RtaUniq)) if (!RIOBootOk(p, HostP, RtaUniq)) {
{
MyLink = RBYTE(PktCmdP->LinkNum); MyLink = RBYTE(PktCmdP->LinkNum);
if (Rup < (ushort) MAX_RUP) if (Rup < (ushort) MAX_RUP) {
{
/* /*
** RtaUniq was clone booted (by this RTA). Instruct this RTA ** RtaUniq was clone booted (by this RTA). Instruct this RTA
** to hold off further attempts to boot on this link for 30 ** to hold off further attempts to boot on this link for 30
** seconds. ** seconds.
*/ */
if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, 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);
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 ** RtaUniq was booted by this host. Set the booting link
** to hold off for 30 seconds to give another unit a ** 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 ...@@ -871,8 +833,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
*/ */
WWORD(HostP->LinkStrP[MyLink].WaitNoBoot, 30); WWORD(HostP->LinkStrP[MyLink].WaitNoBoot, 30);
} }
rio_dprintk (RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n", 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);
RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum);
return TRUE; return TRUE;
} }
...@@ -887,62 +848,53 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -887,62 +848,53 @@ 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 ** to force an open on any ports that where previously open on this
** unit. ** unit.
*/ */
for ( entry=0; entry<MAX_RUP; entry++ ) for (entry = 0; entry < MAX_RUP; entry++) {
{
uint sysport; uint sysport;
if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) {
(HostP->Mapping[entry].RtaUniqueNum==RtaUniq)) HostP->Mapping[entry].Flags |= RTA_BOOTED | RTA_NEWBOOT;
{
HostP->Mapping[entry].Flags |= RTA_BOOTED|RTA_NEWBOOT;
#ifdef NEED_TO_FIX #ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry]); RIO_SV_BROADCAST(HostP->svFlags[entry]);
#endif #endif
if ( (sysport=HostP->Mapping[entry].SysPort) != NO_PORT ) if ((sysport = HostP->Mapping[entry].SysPort) != NO_PORT) {
{ if (sysport < p->RIOFirstPortsBooted)
if ( sysport < p->RIOFirstPortsBooted )
p->RIOFirstPortsBooted = sysport; p->RIOFirstPortsBooted = sysport;
if ( sysport > p->RIOLastPortsBooted ) if (sysport > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = sysport; p->RIOLastPortsBooted = sysport;
/* /*
** For a 16 port RTA, check the second bank of 8 ports ** 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; entry2 = HostP->Mapping[entry].ID2 - 1;
HostP->Mapping[entry2].Flags |= RTA_BOOTED|RTA_NEWBOOT; HostP->Mapping[entry2].Flags |= RTA_BOOTED | RTA_NEWBOOT;
#ifdef NEED_TO_FIX #ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry2]); RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#endif #endif
sysport = HostP->Mapping[entry2].SysPort; sysport = HostP->Mapping[entry2].SysPort;
if ( sysport < p->RIOFirstPortsBooted ) if (sysport < p->RIOFirstPortsBooted)
p->RIOFirstPortsBooted = sysport; p->RIOFirstPortsBooted = sysport;
if ( sysport > p->RIOLastPortsBooted ) if (sysport > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = sysport; p->RIOLastPortsBooted = sysport;
} }
} }
if (RtaType == TYPE_RTA16) { if (RtaType == TYPE_RTA16) {
rio_dprintk (RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", entry + 1, entry2 + 1);
entry+1, entry2+1);
} else { } else {
rio_dprintk (RIO_DEBUG_BOOT, "RTA will be given ID %d\n",entry+1); rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given ID %d\n", entry + 1);
} }
return TRUE; return TRUE;
} }
} }
rio_dprintk (RIO_DEBUG_BOOT, "RTA not configured for this host\n"); 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 ** It was a host that did the booting
*/ */
MyType = "Host"; MyType = "Host";
MyName = HostP->Name; MyName = HostP->Name;
} } else {
else
{
/* /*
** It was an RTA that did the booting ** It was an RTA that did the booting
*/ */
...@@ -960,25 +912,18 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -960,25 +912,18 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** **
** If we find one, then we re-use that slot. ** If we find one, then we re-use that slot.
*/ */
for ( entry=0; entry<MAX_RUP; entry++ ) for (entry = 0; entry < MAX_RUP; entry++) {
{ if ((HostP->Mapping[entry].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) {
if ( (HostP->Mapping[entry].Flags & SLOT_TENTATIVE) && if (RtaType == TYPE_RTA16) {
(HostP->Mapping[entry].RtaUniqueNum == RtaUniq) )
{
if (RtaType == TYPE_RTA16)
{
entry2 = HostP->Mapping[entry].ID2 - 1; entry2 = HostP->Mapping[entry].ID2 - 1;
if ( (HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) && if ((HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry2].RtaUniqueNum == RtaUniq))
(HostP->Mapping[entry2].RtaUniqueNum == RtaUniq) ) rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n", entry, entry2);
rio_dprintk (RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n",
entry, entry2);
else else
continue; continue;
} } else
else rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n", entry);
rio_dprintk (RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n",entry); if (!p->RIONoMessage)
if (! p->RIONoMessage) cprintf("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A');
cprintf("RTA connected to %s '%s' (%c) not configured.\n",MyType,MyName,MyLink+'A');
return TRUE; return TRUE;
} }
} }
...@@ -1005,28 +950,19 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1005,28 +950,19 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** + Configure RTA on host A. We now have the same RTA configured ** + Configure RTA on host A. We now have the same RTA configured
** with different ports on two different hosts. ** with different ports on two different hosts.
*/ */
rio_dprintk (RIO_DEBUG_BOOT, "Have we seen RTA %x before?\n", RtaUniq ); rio_dprintk(RIO_DEBUG_BOOT, "Have we seen RTA %x before?\n", RtaUniq);
found = 0; found = 0;
Flag = 0; /* Convince the compiler this variable is initialized */ Flag = 0; /* Convince the compiler this variable is initialized */
for ( host = 0; !found && (host < p->RIONumHosts); host++ ) for (host = 0; !found && (host < p->RIONumHosts); host++) {
{ for (rta = 0; rta < MAX_RUP; rta++) {
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)) {
{
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; Flag = p->RIOHosts[host].Mapping[rta].Flags;
MapP = &p->RIOHosts[host].Mapping[rta]; MapP = &p->RIOHosts[host].Mapping[rta];
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{
MapP2 = &p->RIOHosts[host].Mapping[MapP->ID2 - 1]; MapP2 = &p->RIOHosts[host].Mapping[MapP->ID2 - 1];
rio_dprintk (RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n", rio_dprintk(RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n", rta + 1, MapP->ID2, p->RIOHosts[host].Name);
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);
else
rio_dprintk (RIO_DEBUG_BOOT, "This RTA is unit %d from host %s\n",
rta+1, p->RIOHosts[host].Name);
found = 1; found = 1;
break; break;
} }
...@@ -1042,34 +978,23 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1042,34 +978,23 @@ 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. ** 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);
rio_dprintk (RIO_DEBUG_BOOT, "Look for RTA %x in RIOSavedTable\n",RtaUniq); for (rta = 0; rta < TOTAL_MAP_ENTRIES; rta++) {
for ( rta=0; rta < TOTAL_MAP_ENTRIES; rta++ ) rio_dprintk(RIO_DEBUG_BOOT, "Check table entry %d (%x)", rta, p->RIOSavedTable[rta].RtaUniqueNum);
{
rio_dprintk (RIO_DEBUG_BOOT, "Check table entry %d (%x)", if ((p->RIOSavedTable[rta].Flags & SLOT_IN_USE) && (p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq)) {
rta,
p->RIOSavedTable[rta].RtaUniqueNum);
if ( (p->RIOSavedTable[rta].Flags & SLOT_IN_USE) &&
(p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq) )
{
MapP = &p->RIOSavedTable[rta]; MapP = &p->RIOSavedTable[rta];
Flag = p->RIOSavedTable[rta].Flags; Flag = p->RIOSavedTable[rta].Flags;
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{ for (entry2 = rta + 1; entry2 < TOTAL_MAP_ENTRIES; entry2++) {
for (entry2 = rta + 1; entry2 < TOTAL_MAP_ENTRIES;
entry2++)
{
if (p->RIOSavedTable[entry2].RtaUniqueNum == RtaUniq) if (p->RIOSavedTable[entry2].RtaUniqueNum == RtaUniq)
break; break;
} }
MapP2 = &p->RIOSavedTable[entry2]; MapP2 = &p->RIOSavedTable[entry2];
rio_dprintk (RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n", rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n", rta, entry2);
rta, entry2); } else
} rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entry %d\n", rta);
else
rio_dprintk (RIO_DEBUG_BOOT, "This RTA is from table entry %d\n", rta);
break; break;
} }
} }
...@@ -1089,19 +1014,14 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1089,19 +1014,14 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** tentative entry in the table. ** tentative entry in the table.
*/ */
EmptySlot = 1; EmptySlot = 1;
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{ if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0) {
if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0)
{
RIODefaultName(p, HostP, entry); RIODefaultName(p, HostP, entry);
FillSlot(entry, entry2, RtaUniq, HostP); FillSlot(entry, entry2, RtaUniq, HostP);
EmptySlot = 0; EmptySlot = 0;
} }
} } else {
else if (RIOFindFreeID(p, HostP, &entry, NULL) == 0) {
{
if (RIOFindFreeID(p, HostP, &entry, NULL) == 0)
{
RIODefaultName(p, HostP, entry); RIODefaultName(p, HostP, entry);
FillSlot(entry, 0, RtaUniq, HostP); FillSlot(entry, 0, RtaUniq, HostP);
EmptySlot = 0; EmptySlot = 0;
...@@ -1119,44 +1039,32 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1119,44 +1039,32 @@ 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 ** If we found a SLOT_TENTATIVE entry on another host for this
** RTA in the driver table, just delete the other host entry. ** RTA in the driver table, just delete the other host entry.
*/ */
if (EmptySlot == 0) if (EmptySlot == 0) {
{ if (MapP) {
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 (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; HostP->Mapping[entry].SysPort = MapP->SysPort;
CCOPY( MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN ); CCOPY(MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN);
HostP->Mapping[entry].Flags = HostP->Mapping[entry].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT;
SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT;
#ifdef NEED_TO_FIX #ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry]); RIO_SV_BROADCAST(HostP->svFlags[entry]);
#endif #endif
RIOReMapPorts( p, HostP, &HostP->Mapping[entry] ); RIOReMapPorts(p, HostP, &HostP->Mapping[entry]);
if ( HostP->Mapping[entry].SysPort < p->RIOFirstPortsBooted ) if (HostP->Mapping[entry].SysPort < p->RIOFirstPortsBooted)
p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort; p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort;
if ( HostP->Mapping[entry].SysPort > p->RIOLastPortsBooted ) if (HostP->Mapping[entry].SysPort > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = HostP->Mapping[entry].SysPort; p->RIOLastPortsBooted = HostP->Mapping[entry].SysPort;
rio_dprintk (RIO_DEBUG_BOOT, "SysPort %d, Name %s\n",(int)MapP->SysPort,MapP->Name); rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) MapP->SysPort, MapP->Name);
} } else {
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;
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 #ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry]); RIO_SV_BROADCAST(HostP->svFlags[entry]);
#endif #endif
} }
if (RtaType == TYPE_RTA16) if (RtaType == TYPE_RTA16) {
{ if (Flag & SLOT_IN_USE) {
if (Flag & SLOT_IN_USE) HostP->Mapping[entry2].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
{
HostP->Mapping[entry2].Flags = SLOT_IN_USE |
RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
#ifdef NEED_TO_FIX #ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry2]); RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#endif #endif
...@@ -1164,29 +1072,24 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1164,29 +1072,24 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
/* /*
** Map second block of ttys for 16 port RTA ** Map second block of ttys for 16 port RTA
*/ */
RIOReMapPorts( p, HostP, &HostP->Mapping[entry2] ); RIOReMapPorts(p, HostP, &HostP->Mapping[entry2]);
if (HostP->Mapping[entry2].SysPort < p->RIOFirstPortsBooted) if (HostP->Mapping[entry2].SysPort < p->RIOFirstPortsBooted)
p->RIOFirstPortsBooted = HostP->Mapping[entry2].SysPort; p->RIOFirstPortsBooted = HostP->Mapping[entry2].SysPort;
if (HostP->Mapping[entry2].SysPort > p->RIOLastPortsBooted) if (HostP->Mapping[entry2].SysPort > p->RIOLastPortsBooted)
p->RIOLastPortsBooted = HostP->Mapping[entry2].SysPort; p->RIOLastPortsBooted = HostP->Mapping[entry2].SysPort;
rio_dprintk (RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name);
(int)HostP->Mapping[entry2].SysPort, } else
HostP->Mapping[entry].Name); HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
}
else
HostP->Mapping[entry2].Flags = SLOT_TENTATIVE |
RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
#ifdef NEED_TO_FIX #ifdef NEED_TO_FIX
RIO_SV_BROADCAST(HostP->svFlags[entry2]); RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#endif #endif
bzero( (caddr_t)MapP2, sizeof(struct Map) ); bzero((caddr_t) MapP2, sizeof(struct Map));
} }
bzero( (caddr_t)MapP, sizeof(struct Map) ); bzero((caddr_t) MapP, sizeof(struct Map));
if (! p->RIONoMessage) if (!p->RIONoMessage)
cprintf("An orphaned RTA has been adopted by %s '%s' (%c).\n",MyType,MyName,MyLink+'A'); 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');
cprintf("RTA connected to %s '%s' (%c) not configured.\n",MyType,MyName,MyLink+'A');
RIOSetChange(p); RIOSetChange(p);
return TRUE; return TRUE;
} }
...@@ -1196,12 +1099,10 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1196,12 +1099,10 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
** booted RTA. Keep a note of its Uniq Num in the overflow table, ** booted RTA. Keep a note of its Uniq Num in the overflow table,
** so we can ignore it's ID requests. ** so we can ignore it's ID requests.
*/ */
if (! p->RIONoMessage) 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'); 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++ ) for (entry = 0; entry < HostP->NumExtraBooted; entry++) {
{ if (HostP->ExtraUnits[entry] == RtaUniq) {
if ( HostP->ExtraUnits[entry] == RtaUniq )
{
/* /*
** already got it! ** already got it!
*/ */
...@@ -1211,7 +1112,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1211,7 +1112,7 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st
/* /*
** If there is room, add the unit to the list of extras ** If there is room, add the unit to the list of extras
*/ */
if ( HostP->NumExtraBooted < MAX_EXTRA_UNITS ) if (HostP->NumExtraBooted < MAX_EXTRA_UNITS)
HostP->ExtraUnits[HostP->NumExtraBooted++] = RtaUniq; HostP->ExtraUnits[HostP->NumExtraBooted++] = RtaUniq;
return TRUE; return TRUE;
} }
...@@ -1226,10 +1127,9 @@ static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, st ...@@ -1226,10 +1127,9 @@ 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 ** We no longer support the RIOBootMode variable. It is all done from the
** "boot/noboot" field in the rio.cf file. ** "boot/noboot" field in the rio.cf file.
*/ */
int int RIOBootOk(p, HostP, RtaUniq)
RIOBootOk(p, HostP, RtaUniq) struct rio_info *p;
struct rio_info * p; struct Host *HostP;
struct Host * HostP;
ulong RtaUniq; ulong RtaUniq;
{ {
int Entry; int Entry;
...@@ -1239,12 +1139,8 @@ ulong RtaUniq; ...@@ -1239,12 +1139,8 @@ ulong RtaUniq;
** Search bindings table for RTA or its parent. ** Search bindings table for RTA or its parent.
** If it exists, return 0, else 1. ** If it exists, return 0, else 1.
*/ */
for (Entry = 0; for (Entry = 0; (Entry < MAX_RTA_BINDINGS) && (p->RIOBindTab[Entry] != 0); Entry++) {
( Entry < MAX_RTA_BINDINGS ) && ( p->RIOBindTab[Entry] != 0 ); if ((p->RIOBindTab[Entry] == HostUniq) || (p->RIOBindTab[Entry] == RtaUniq))
Entry++)
{
if ( (p->RIOBindTab[Entry] == HostUniq) ||
(p->RIOBindTab[Entry] == RtaUniq) )
return 0; return 0;
} }
return 1; return 1;
...@@ -1255,8 +1151,7 @@ ulong RtaUniq; ...@@ -1255,8 +1151,7 @@ ulong RtaUniq;
** slots tentative, and the second one RTA_SECOND_SLOT as well. ** slots tentative, and the second one RTA_SECOND_SLOT as well.
*/ */
void void FillSlot(entry, entry2, RtaUniq, HostP)
FillSlot(entry, entry2, RtaUniq, HostP)
int entry; int entry;
int entry2; int entry2;
uint RtaUniq; uint RtaUniq;
...@@ -1264,7 +1159,7 @@ struct Host *HostP; ...@@ -1264,7 +1159,7 @@ struct Host *HostP;
{ {
int link; int link;
rio_dprintk (RIO_DEBUG_BOOT, "FillSlot(%d, %d, 0x%x...)\n", entry, entry2, RtaUniq); rio_dprintk(RIO_DEBUG_BOOT, "FillSlot(%d, %d, 0x%x...)\n", entry, entry2, RtaUniq);
HostP->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE); HostP->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE);
HostP->Mapping[entry].SysPort = NO_PORT; HostP->Mapping[entry].SysPort = NO_PORT;
...@@ -1273,8 +1168,7 @@ struct Host *HostP; ...@@ -1273,8 +1168,7 @@ struct Host *HostP;
HostP->Mapping[entry].ID = entry + 1; HostP->Mapping[entry].ID = entry + 1;
HostP->Mapping[entry].ID2 = 0; HostP->Mapping[entry].ID2 = 0;
if (entry2) { if (entry2) {
HostP->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | HostP->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE | RTA16_SECOND_SLOT);
SLOT_TENTATIVE | RTA16_SECOND_SLOT);
HostP->Mapping[entry2].SysPort = NO_PORT; HostP->Mapping[entry2].SysPort = NO_PORT;
HostP->Mapping[entry2].RtaUniqueNum = RtaUniq; HostP->Mapping[entry2].RtaUniqueNum = RtaUniq;
HostP->Mapping[entry2].HostUniqueNum = HostP->UniqueNum; HostP->Mapping[entry2].HostUniqueNum = HostP->UniqueNum;
...@@ -1287,7 +1181,7 @@ struct Host *HostP; ...@@ -1287,7 +1181,7 @@ struct Host *HostP;
** Must set these up, so that utilities show ** Must set these up, so that utilities show
** topology of 16 port RTAs correctly ** topology of 16 port RTAs correctly
*/ */
for ( link=0; link<LINKS_PER_UNIT; link++ ) { for (link = 0; link < LINKS_PER_UNIT; link++) {
HostP->Mapping[entry].Topology[link].Unit = ROUTE_DISCONNECT; HostP->Mapping[entry].Topology[link].Unit = ROUTE_DISCONNECT;
HostP->Mapping[entry].Topology[link].Link = NO_LINK; HostP->Mapping[entry].Topology[link].Link = NO_LINK;
if (entry2) { if (entry2) {
...@@ -1296,4 +1190,3 @@ struct Host *HostP; ...@@ -1296,4 +1190,3 @@ struct Host *HostP;
} }
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment