Commit b6c6b602 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] rioboot: post-Lindent

After the indent we can now clean up unused code, and fix all myriad cases
that don't use readb/writeb properly.
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 3b8e3f1e
...@@ -30,25 +30,19 @@ ...@@ -30,25 +30,19 @@
** ----------------------------------------------------------------------------- ** -----------------------------------------------------------------------------
*/ */
#ifdef SCCS_LABELS
static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3";
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/termios.h>
#include <linux/serial.h>
#include <asm/semaphore.h>
#include <linux/generic_serial.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/string.h> #include <asm/string.h>
#include <asm/semaphore.h> #include <asm/uaccess.h>
#include <linux/termios.h>
#include <linux/serial.h>
#include <linux/generic_serial.h>
#include "linux_compat.h" #include "linux_compat.h"
...@@ -80,9 +74,9 @@ static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3"; ...@@ -80,9 +74,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, unsigned int Rup, struct PktCmd *PktCmdP);
static uchar RIOAtVec2Ctrl[] = { static const unsigned char RIOAtVec2Ctrl[] = {
/* 0 */ INTERRUPT_DISABLE, /* 0 */ INTERRUPT_DISABLE,
/* 1 */ INTERRUPT_DISABLE, /* 1 */ INTERRUPT_DISABLE,
/* 2 */ INTERRUPT_DISABLE, /* 2 */ INTERRUPT_DISABLE,
...@@ -101,22 +95,22 @@ static uchar RIOAtVec2Ctrl[] = { ...@@ -101,22 +95,22 @@ static uchar RIOAtVec2Ctrl[] = {
/* 15 */ IRQ_15 | INTERRUPT_ENABLE /* 15 */ IRQ_15 | INTERRUPT_ENABLE
}; };
/* /**
** Load in the RTA boot code. * RIOBootCodeRTA - Load RTA boot code
*/ * @p: RIO to load
int RIOBootCodeRTA(p, rbp) * @rbp: Download descriptor
struct rio_info *p; *
struct DownLoad *rbp; * Called when the user process initiates booting of the card firmware.
* Lads the firmware
*/
int RIOBootCodeRTA(struct rio_info *p, struct DownLoad * rbp)
{ {
int offset; int offset;
func_enter(); func_enter();
/* Linux doesn't allow you to disable interrupts during a rio_dprintk(RIO_DEBUG_BOOT, "Data at user address %p\n", rbp->DataP);
"copyin". (Crash when a pagefault occurs). */
/* disable(oldspl); */
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
...@@ -124,7 +118,6 @@ struct DownLoad *rbp; ...@@ -124,7 +118,6 @@ struct DownLoad *rbp;
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); */
func_exit(); func_exit();
return -ENOMEM; return -ENOMEM;
} }
...@@ -132,7 +125,6 @@ struct DownLoad *rbp; ...@@ -132,7 +125,6 @@ struct DownLoad *rbp;
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); */
func_exit(); func_exit();
return -EBUSY; return -EBUSY;
} }
...@@ -149,16 +141,15 @@ struct DownLoad *rbp; ...@@ -149,16 +141,15 @@ struct DownLoad *rbp;
** 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); memset(p->RIOBootPackets, 0, offset);
/* /*
** Copy the data from user space. ** Copy the data from user space into the array
*/ */
if (copyin((int) rbp->DataP, ((caddr_t) (p->RIOBootPackets)) + offset, rbp->Count) == COPYFAIL) { if (copy_from_user(((u8 *)p->RIOBootPackets) + offset, rbp->DataP, rbp->Count)) {
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); */
func_exit(); func_exit();
return -EFAULT; return -EFAULT;
} }
...@@ -170,40 +161,25 @@ struct DownLoad *rbp; ...@@ -170,40 +161,25 @@ struct DownLoad *rbp;
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); */
func_exit(); func_exit();
return 0; return 0;
} }
/**
* rio_start_card_running - host card start
* @HostP: The RIO to kick off
*
* Start a RIO processor unit running. Encapsulates the knowledge
* of the card type.
*/
void rio_start_card_running(struct Host *HostP) void rio_start_card_running(struct Host *HostP)
{ {
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, BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF]); writeb(BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF], &HostP->Control);
break;
#ifdef FUTURE_RELEASE
case RIO_MCA:
/*
** MCA handles IRQ vectors differently, so we don't write
** them to this register.
*/
rio_dprintk(RIO_DEBUG_BOOT, "Start MCA card running\n");
WBYTE(HostP->Control, McaTpBootFromRam | McaTpBusEnable | HostP->Mode);
break; break;
case RIO_EISA:
/*
** EISA is totally different and expects OUTBZs to turn it on.
*/
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);
break;
#endif
case RIO_PCI: case RIO_PCI:
/* /*
** PCI is much the same as MCA. Everything is once again memory ** PCI is much the same as MCA. Everything is once again memory
...@@ -211,16 +187,12 @@ void rio_start_card_running(struct Host *HostP) ...@@ -211,16 +187,12 @@ void rio_start_card_running(struct Host *HostP)
** 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); writeb(PCITpBootFromRam | PCITpBusEnable | HostP->Mode, &HostP->Control);
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;
} }
/*
printk (KERN_INFO "Done with starting the card\n");
func_exit ();
*/
return; return;
} }
...@@ -231,40 +203,41 @@ void rio_start_card_running(struct Host *HostP) ...@@ -231,40 +203,41 @@ 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 RIOBootCodeHOST(p, rbp)
struct rio_info *p; int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp)
register struct DownLoad *rbp;
{ {
register struct Host *HostP; struct Host *HostP;
register caddr_t Cad; u8 *Cad;
register PARM_MAP *ParmMapP; PARM_MAP *ParmMapP;
register int RupN; int RupN;
int PortN; int PortN;
uint host; unsigned int host;
caddr_t StartP; u8 *StartP;
BYTE *DestP; u8 *DestP;
int wait_count; int wait_count;
ushort OldParmMap; u16 OldParmMap;
ushort offset; /* It is very important that this is a ushort */ u16 offset; /* It is very important that this is a u16 */
/* uint byte; */ u8 *DownCode = NULL;
caddr_t DownCode = NULL;
unsigned long flags; unsigned long flags;
HostP = NULL; /* Assure the compiler we've initialized it */ HostP = NULL; /* Assure the compiler we've initialized it */
/* Walk the hosts */
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", 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);
/* Don't boot hosts already running */
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;
} }
/* /*
** Grab a 32 bit pointer to the card. ** Grab a pointer to the card (ioremapped)
*/ */
Cad = HostP->Caddr; Cad = HostP->Caddr;
...@@ -274,13 +247,14 @@ register struct DownLoad *rbp; ...@@ -274,13 +247,14 @@ 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 = &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 %p\n", 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 %p\n", 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);
/* Make sure it fits */
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;
...@@ -300,39 +274,23 @@ register struct DownLoad *rbp; ...@@ -300,39 +274,23 @@ register struct DownLoad *rbp;
*/ */
rio_dprintk(RIO_DEBUG_BOOT, "Copy in code\n"); rio_dprintk(RIO_DEBUG_BOOT, "Copy in code\n");
/* /* Buffer to local memory as we want to use I/O space and
** PCI hostcard can't cope with 32 bit accesses and so need to copy some cards only do 8 or 16 bit I/O */
** data to a local buffer, and then dripfeed the card.
*/
if (HostP->Type == RIO_PCI) {
/* int offset; */
DownCode = sysbrk(rbp->Count); DownCode = vmalloc(rbp->Count);
if (!DownCode) { if (!DownCode) {
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); if (copy_from_user(rbp->DataP, DownCode, rbp->Count)) {
kfree(DownCode);
if (copyin((int) rbp->DataP, DownCode, rbp->Count) == COPYFAIL) {
rio_dprintk(RIO_DEBUG_BOOT, "Bad copyin of host data\n");
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);
vfree(DownCode);
sysfree(DownCode, rbp->Count);
} 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();
return -EFAULT;
}
rio_dprintk(RIO_DEBUG_BOOT, "Copy completed\n"); rio_dprintk(RIO_DEBUG_BOOT, "Copy completed\n");
...@@ -411,7 +369,7 @@ register struct DownLoad *rbp; ...@@ -411,7 +369,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 = (u8 *) &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 */
...@@ -427,13 +385,14 @@ register struct DownLoad *rbp; ...@@ -427,13 +385,14 @@ register struct DownLoad *rbp;
** 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[1], PFIX((offset >> 8) & 0xF));
WBYTE(DestP[2], PFIX((offset >> 4) & 0xF));
WBYTE(DestP[3], JUMP(offset & 0xF));
WBYTE(DestP[6], NFIX(0)); writeb(NFIX(((ushort) (~offset) >> (ushort) 12) & 0xF), DestP);
WBYTE(DestP[7], JUMP(8)); writeb(PFIX((offset >> 8) & 0xF), DestP + 1);
writeb(PFIX((offset >> 4) & 0xF), DestP + 2);
writeb(JUMP(offset & 0xF), DestP + 3);
writeb(NFIX(0), DestP + 6);
writeb(JUMP(8), DestP + 7);
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);
...@@ -448,7 +407,7 @@ register struct DownLoad *rbp; ...@@ -448,7 +407,7 @@ register struct DownLoad *rbp;
** Grab a copy of the current ParmMap pointer, so we ** Grab a copy of the current ParmMap pointer, so we
** can tell when it has changed. ** can tell when it has changed.
*/ */
OldParmMap = RWORD(HostP->__ParmMapR); OldParmMap = readw(&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);
...@@ -467,9 +426,9 @@ register struct DownLoad *rbp; ...@@ -467,9 +426,9 @@ register struct DownLoad *rbp;
** 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) && (RWORD(HostP->__ParmMapR) == OldParmMap); wait_count++) { for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (readw(&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, readw(&HostP->__ParmMapR));
delay(HostP, HUNDRED_MS); mdelay(100);
} }
...@@ -477,15 +436,16 @@ register struct DownLoad *rbp; ...@@ -477,15 +436,16 @@ 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 (readw(&HostP->__ParmMapR) == OldParmMap) {
rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", RWORD(HostP->__ParmMapR)); rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", readw(&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; HostP->Flags &= ~RUN_STATE;
HostP->Flags |= RC_STUFFED; HostP->Flags |= RC_STUFFED;
RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );
continue} continue;
}
rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", RWORD(HostP->__ParmMapR)); rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", readw(&HostP->__ParmMapR));
/* /*
** Well, the board thought it was OK, and setup its parmmap ** Well, the board thought it was OK, and setup its parmmap
...@@ -496,25 +456,26 @@ register struct DownLoad *rbp; ...@@ -496,25 +456,26 @@ 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, readw(&HostP->__ParmMapR));
rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP); rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP);
ParmMapP = (PARM_MAP *) ((unsigned long) Cad + (unsigned long) ((RWORD((HostP->__ParmMapR))) & 0xFFFF)); ParmMapP = (PARM_MAP *) ((unsigned long) Cad + readw(&HostP->__ParmMapR));
rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP); rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", 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 (readw(&ParmMapP->links) != 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", readw(&ParmMapP->links));
HostP->Flags &= ~RUN_STATE; HostP->Flags &= ~RUN_STATE;
HostP->Flags |= RC_STUFFED; HostP->Flags |= RC_STUFFED;
RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );
continue} continue;
}
WWORD(ParmMapP->links, RIO_LINK_ENABLE); writew(RIO_LINK_ENABLE, &ParmMapP->links);
/* /*
** now wait for the card to set all the parmmap->XXX stuff ** now wait for the card to set all the parmmap->XXX stuff
...@@ -522,19 +483,20 @@ register struct DownLoad *rbp; ...@@ -522,19 +483,20 @@ register struct DownLoad *rbp;
*/ */
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) && !RWORD(ParmMapP->init_done); wait_count++) { for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && !readw(&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); mdelay(100);
} }
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 || !RWORD(ParmMapP->init_done)) { if (readw(&ParmMapP->error) != E_NO_ERROR || !readw(&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; HostP->Flags &= ~RUN_STATE;
HostP->Flags |= RC_STUFFED; HostP->Flags |= RC_STUFFED;
RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );
continue} continue;
}
rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n"); rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n");
...@@ -546,17 +508,17 @@ register struct DownLoad *rbp; ...@@ -546,17 +508,17 @@ register struct DownLoad *rbp;
/* /*
** set the time period between interrupts. ** set the time period between interrupts.
*/ */
WWORD(ParmMapP->timer, (short) p->RIOConf.Timer); writew(p->RIOConf.Timer, &ParmMapP->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 in ioremap space.
*/ */
HostP->ParmMapP = ParmMapP; HostP->ParmMapP = ParmMapP;
HostP->PhbP = (PHB *) RIO_PTR(Cad, RWORD(ParmMapP->phb_ptr)); HostP->PhbP = (PHB *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr));
HostP->RupP = (RUP *) RIO_PTR(Cad, RWORD(ParmMapP->rups)); HostP->RupP = (RUP *) RIO_PTR(Cad, readw(&ParmMapP->rups));
HostP->PhbNumP = (ushort *) RIO_PTR(Cad, RWORD(ParmMapP->phb_num_ptr)); HostP->PhbNumP = (ushort *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr));
HostP->LinkStrP = (LPB *) RIO_PTR(Cad, RWORD(ParmMapP->link_str_ptr)); HostP->LinkStrP = (LPB *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr));
/* /*
** point the UnixRups at the real Rups ** point the UnixRups at the real Rups
...@@ -592,12 +554,12 @@ register struct DownLoad *rbp; ...@@ -592,12 +554,12 @@ register struct DownLoad *rbp;
PortP->PhbP = PhbP; PortP->PhbP = PhbP;
PortP->TxAdd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_add)); PortP->TxAdd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_add));
PortP->TxStart = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_start)); PortP->TxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_start));
PortP->TxEnd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_end)); PortP->TxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_end));
PortP->RxRemove = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_remove)); PortP->RxRemove = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_remove));
PortP->RxStart = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_start)); PortP->RxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_start));
PortP->RxEnd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_end)); PortP->RxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_end));
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
/* /*
...@@ -631,20 +593,23 @@ register struct DownLoad *rbp; ...@@ -631,20 +593,23 @@ register struct DownLoad *rbp;
/* /**
** Boot an RTA. If we have successfully processed this boot, then * RIOBootRup - Boot an RTA
** return 1. If we havent, then return 0. * @p: rio we are working with
*/ * @Rup: Rup number
int RIOBootRup(p, Rup, HostP, PacketP) * @HostP: host object
struct rio_info *p; * @PacketP: packet to use
uint Rup; *
struct Host *HostP; * If we have successfully processed this boot, then
struct PKT *PacketP; * return 1. If we havent, then return 0.
*/
int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, 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; unsigned int sequence;
/* /*
** 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.
...@@ -654,20 +619,17 @@ struct PKT *PacketP; ...@@ -654,20 +619,17 @@ struct PKT *PacketP;
return 0; return 0;
} }
/* rio_dprint(RIO_DEBUG_BOOT, NULL,DBG_BOOT,"Incoming command packet\n"); */
/* ShowPacket( DBG_BOOT, PacketP ); */
/* /*
** Special case of boot completed - if we get one of these then we ** Special case of boot completed - if we get one of these then we
** don't need a command block. For all other cases we do, so handle ** don't need a command block. For all other cases we do, so handle
** 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) && (RBYTE(PktCmdP->Command) == BOOT_COMPLETED)) if ((readb(&PacketP->len) & PKT_CMD_BIT) && (readb(&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 allocate a command block. This is in kernel space
*/ */
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");
...@@ -688,13 +650,12 @@ struct PKT *PacketP; ...@@ -688,13 +650,12 @@ struct PKT *PacketP;
/* /*
** process COMMANDS on the boot rup! ** process COMMANDS on the boot rup!
*/ */
if (RBYTE(PacketP->len) & PKT_CMD_BIT) { if (readb(&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 (readb(&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 %Zd\n", readb(&PktCmdP->Command), Rup, HostP - p->RIOHosts);
ShowPacket(DBG_BOOT, PacketP);
RIOFreeCmdBlk(CmdBlkP); RIOFreeCmdBlk(CmdBlkP);
return 1; return 1;
} }
...@@ -702,20 +663,9 @@ struct PKT *PacketP; ...@@ -702,20 +663,9 @@ struct PKT *PacketP;
/* /*
** Build a Boot Sequence command block ** Build a Boot Sequence command block
** **
** 02.03.1999 ARG - ESIL 0820 fix
** We no longer need to use "Boot Mode", we'll always allow ** We no longer need to use "Boot Mode", we'll always allow
** boot requests - the boot will not complete if the device ** boot requests - the boot will not complete if the device
** appears in the bindings table. ** appears in the bindings table.
** So, this conditional is not required ...
**
if (p->RIOBootMode == RC_BOOT_NONE)
**
** If the system is in slave mode, and a boot request is
** received, set command to BOOT_ABORT so that the boot
** will not complete.
**
PktReplyP->Command = BOOT_ABORT;
else
** **
** We'll just (always) set the command field in packet reply ** We'll just (always) set the command field in packet reply
** to allow an attempted boot sequence : ** to allow an attempted boot sequence :
...@@ -728,9 +678,9 @@ struct PKT *PacketP; ...@@ -728,9 +678,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); memcpy((void *) &CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN], "BOOT", 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 %Zd 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 ** If this host is in slave mode, send the RTA an invalid boot
...@@ -747,32 +697,35 @@ struct PKT *PacketP; ...@@ -747,32 +697,35 @@ struct PKT *PacketP;
/* /*
** It is a request for boot data. ** It is a request for boot data.
*/ */
sequence = RWORD(PktCmdP->Sequence); sequence = readw(&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 %Zd 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, 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; PktReplyP->Sequence = sequence;
memcpy(PktReplyP->BootData, p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], RTA_BOOT_DATA_SIZE);
bcopy(p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], 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);
RIOQueueCmdBlk(HostP, Rup, CmdBlkP); RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
return 1; return 1;
} }
/* /**
** This function is called when an RTA been booted. * RIOBootComplete - RTA boot is done
** If booted by a host, HostP->HostUniqueNum is the booting host. * @p: RIO we are working with
** If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA. * @HostP: Host structure
** RtaUniq is the booted RTA. * @Rup: RUP being used
*/ * @PktCmdP: Packet command that was used
static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP) *
* This function is called when an RTA been booted.
* If booted by a host, HostP->HostUniqueNum is the booting host.
* If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA.
* RtaUniq is the booted RTA.
*/
static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd *PktCmdP)
{ {
struct Map *MapP = NULL; struct Map *MapP = NULL;
struct Map *MapP2 = NULL; struct Map *MapP2 = NULL;
...@@ -782,12 +735,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -782,12 +735,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
int EmptySlot = -1; int EmptySlot = -1;
int entry, entry2; int entry, entry2;
char *MyType, *MyName; char *MyType, *MyName;
uint MyLink; unsigned int MyLink;
ushort RtaType; unsigned short RtaType;
uint RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24); u32 RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&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 */
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);
...@@ -795,16 +746,16 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -795,16 +746,16 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
/* /*
** 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", 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, readb(&PktCmdP->LinkNum) + 'A');
} else { 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, readb(&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;
} }
...@@ -814,9 +765,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -814,9 +765,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
** 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 = readb(&PktCmdP->LinkNum);
if (Rup < (ushort) MAX_RUP) { if (Rup < (unsigned short) 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
...@@ -825,14 +777,13 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -825,14 +777,13 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
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
** chance to boot it. ** chance to boot it.
*/ */
WWORD(HostP->LinkStrP[MyLink].WaitNoBoot, 30); writew(30, &HostP->LinkStrP[MyLink].WaitNoBoot);
}
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; return TRUE;
} }
...@@ -849,13 +800,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -849,13 +800,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
** unit. ** unit.
*/ */
for (entry = 0; entry < MAX_RUP; entry++) { for (entry = 0; entry < MAX_RUP; entry++) {
uint sysport; unsigned int 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; 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) if (sysport < p->RIOFirstPortsBooted)
p->RIOFirstPortsBooted = sysport; p->RIOFirstPortsBooted = sysport;
...@@ -867,9 +815,6 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -867,9 +815,6 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
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
RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#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;
...@@ -877,18 +822,17 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -877,18 +822,17 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
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", entry + 1, entry2 + 1); rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", 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 >= (unsigned short) MAX_RUP) {
/* /*
** It was a host that did the booting ** It was a host that did the booting
*/ */
...@@ -901,7 +845,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -901,7 +845,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
MyType = "RTA"; MyType = "RTA";
MyName = HostP->Mapping[Rup].Name; MyName = HostP->Mapping[Rup].Name;
} }
MyLink = RBYTE(PktCmdP->LinkNum); MyLink = readb(&PktCmdP->LinkNum);
/* /*
** There is no SLOT_IN_USE entry for this RTA attached to the current ** There is no SLOT_IN_USE entry for this RTA attached to the current
...@@ -923,7 +867,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -923,7 +867,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
} 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'); printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A');
return TRUE; return TRUE;
} }
} }
...@@ -1044,11 +988,8 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -1044,11 +988,8 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
if (Flag & SLOT_IN_USE) { if (Flag & SLOT_IN_USE) {
rio_dprintk(RIO_DEBUG_BOOT, "This RTA configured on another host - move entry to current host (1)\n"); 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); memcpy(HostP->Mapping[entry].Name, MapP->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
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;
...@@ -1058,16 +999,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -1058,16 +999,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
} else { } else {
rio_dprintk(RIO_DEBUG_BOOT, "This RTA has a tentative entry on another host - delete that entry (1)\n"); 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; 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 (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
RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#endif
HostP->Mapping[entry2].SysPort = MapP2->SysPort; HostP->Mapping[entry2].SysPort = MapP2->SysPort;
/* /*
** Map second block of ttys for 16 port RTA ** Map second block of ttys for 16 port RTA
...@@ -1080,16 +1015,13 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -1080,16 +1015,13 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name); rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name);
} else } else
HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
#ifdef NEED_TO_FIX memset(MapP2, 0, sizeof(struct Map));
RIO_SV_BROADCAST(HostP->svFlags[entry2]);
#endif
bzero((caddr_t) MapP2, sizeof(struct Map));
} }
bzero((caddr_t) MapP, sizeof(struct Map)); memset(MapP, 0, 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'); printk("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'); printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A');
RIOSetChange(p); RIOSetChange(p);
return TRUE; return TRUE;
} }
...@@ -1100,7 +1032,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -1100,7 +1032,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
** 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'); printk("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) {
/* /*
...@@ -1127,13 +1059,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str ...@@ -1127,13 +1059,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
** 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 RIOBootOk(p, HostP, RtaUniq) int RIOBootOk(struct rio_info *p, struct Host *HostP, unsigned long RtaUniq)
struct rio_info *p;
struct Host *HostP;
ulong RtaUniq;
{ {
int Entry; int Entry;
uint HostUniq = HostP->UniqueNum; unsigned int HostUniq = HostP->UniqueNum;
/* /*
** Search bindings table for RTA or its parent. ** Search bindings table for RTA or its parent.
...@@ -1151,11 +1080,7 @@ ulong RtaUniq; ...@@ -1151,11 +1080,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 FillSlot(entry, entry2, RtaUniq, HostP) void FillSlot(int entry, int entry2, unsigned int RtaUniq, struct Host *HostP)
int entry;
int entry2;
uint RtaUniq;
struct Host *HostP;
{ {
int link; int link;
......
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