aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-03-24 06:18:26 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:28 -0500
commitb6c6b6021ec735bd105e130ac1ee1606575f74c3 (patch)
tree098596ea049ca6ec10cb999ef2db943936c35a56 /drivers/char
parent3b8e3f1e44326115f2a28a63ede62b1f5c53e46e (diff)
[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: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/rio/rioboot.c429
1 files changed, 177 insertions, 252 deletions
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
index 9a96fc644e52..e1542e8dfb43 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/char/rio/rioboot.c
@@ -30,25 +30,19 @@
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32 32
33#ifdef SCCS_LABELS
34static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3";
35#endif
36
37#include <linux/module.h> 33#include <linux/module.h>
38#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/termios.h>
36#include <linux/serial.h>
37#include <asm/semaphore.h>
38#include <linux/generic_serial.h>
39#include <linux/errno.h> 39#include <linux/errno.h>
40#include <linux/interrupt.h> 40#include <linux/interrupt.h>
41#include <linux/delay.h>
41#include <asm/io.h> 42#include <asm/io.h>
42#include <asm/system.h> 43#include <asm/system.h>
43#include <asm/string.h> 44#include <asm/string.h>
44#include <asm/semaphore.h> 45#include <asm/uaccess.h>
45
46
47#include <linux/termios.h>
48#include <linux/serial.h>
49
50#include <linux/generic_serial.h>
51
52 46
53 47
54#include "linux_compat.h" 48#include "linux_compat.h"
@@ -80,9 +74,9 @@ static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3";
80#include "cmdblk.h" 74#include "cmdblk.h"
81#include "route.h" 75#include "route.h"
82 76
83static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP); 77static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd *PktCmdP);
84 78
85static uchar RIOAtVec2Ctrl[] = { 79static const unsigned char RIOAtVec2Ctrl[] = {
86 /* 0 */ INTERRUPT_DISABLE, 80 /* 0 */ INTERRUPT_DISABLE,
87 /* 1 */ INTERRUPT_DISABLE, 81 /* 1 */ INTERRUPT_DISABLE,
88 /* 2 */ INTERRUPT_DISABLE, 82 /* 2 */ INTERRUPT_DISABLE,
@@ -101,22 +95,22 @@ static uchar RIOAtVec2Ctrl[] = {
101 /* 15 */ IRQ_15 | INTERRUPT_ENABLE 95 /* 15 */ IRQ_15 | INTERRUPT_ENABLE
102}; 96};
103 97
104/* 98/**
105** Load in the RTA boot code. 99 * RIOBootCodeRTA - Load RTA boot code
106*/ 100 * @p: RIO to load
107int RIOBootCodeRTA(p, rbp) 101 * @rbp: Download descriptor
108struct rio_info *p; 102 *
109struct DownLoad *rbp; 103 * Called when the user process initiates booting of the card firmware.
104 * Lads the firmware
105 */
106
107int RIOBootCodeRTA(struct rio_info *p, struct DownLoad * rbp)
110{ 108{
111 int offset; 109 int offset;
112 110
113 func_enter(); 111 func_enter();
114 112
115 /* Linux doesn't allow you to disable interrupts during a 113 rio_dprintk(RIO_DEBUG_BOOT, "Data at user address %p\n", rbp->DataP);
116 "copyin". (Crash when a pagefault occurs). */
117 /* disable(oldspl); */
118
119 rio_dprintk(RIO_DEBUG_BOOT, "Data at user address 0x%x\n", (int) rbp->DataP);
120 114
121 /* 115 /*
122 ** Check that we have set asside enough memory for this 116 ** Check that we have set asside enough memory for this
@@ -124,7 +118,6 @@ struct DownLoad *rbp;
124 if (rbp->Count > SIXTY_FOUR_K) { 118 if (rbp->Count > SIXTY_FOUR_K) {
125 rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n"); 119 rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n");
126 p->RIOError.Error = HOST_FILE_TOO_LARGE; 120 p->RIOError.Error = HOST_FILE_TOO_LARGE;
127 /* restore(oldspl); */
128 func_exit(); 121 func_exit();
129 return -ENOMEM; 122 return -ENOMEM;
130 } 123 }
@@ -132,7 +125,6 @@ struct DownLoad *rbp;
132 if (p->RIOBooting) { 125 if (p->RIOBooting) {
133 rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n"); 126 rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n");
134 p->RIOError.Error = BOOT_IN_PROGRESS; 127 p->RIOError.Error = BOOT_IN_PROGRESS;
135 /* restore(oldspl); */
136 func_exit(); 128 func_exit();
137 return -EBUSY; 129 return -EBUSY;
138 } 130 }
@@ -149,16 +141,15 @@ struct DownLoad *rbp;
149 ** because it will (eventually) be part of the Rta run time environment 141 ** because it will (eventually) be part of the Rta run time environment
150 ** and so should be zeroed. 142 ** and so should be zeroed.
151 */ 143 */
152 bzero((caddr_t) p->RIOBootPackets, offset); 144 memset(p->RIOBootPackets, 0, offset);
153 145
154 /* 146 /*
155 ** Copy the data from user space. 147 ** Copy the data from user space into the array
156 */ 148 */
157 149
158 if (copyin((int) rbp->DataP, ((caddr_t) (p->RIOBootPackets)) + offset, rbp->Count) == COPYFAIL) { 150 if (copy_from_user(((u8 *)p->RIOBootPackets) + offset, rbp->DataP, rbp->Count)) {
159 rio_dprintk(RIO_DEBUG_BOOT, "Bad data copy from user space\n"); 151 rio_dprintk(RIO_DEBUG_BOOT, "Bad data copy from user space\n");
160 p->RIOError.Error = COPYIN_FAILED; 152 p->RIOError.Error = COPYIN_FAILED;
161 /* restore(oldspl); */
162 func_exit(); 153 func_exit();
163 return -EFAULT; 154 return -EFAULT;
164 } 155 }
@@ -170,40 +161,25 @@ struct DownLoad *rbp;
170 p->RIONumBootPkts = (rbp->Count + offset) / RTA_BOOT_DATA_SIZE; 161 p->RIONumBootPkts = (rbp->Count + offset) / RTA_BOOT_DATA_SIZE;
171 p->RIOBootCount = rbp->Count; 162 p->RIOBootCount = rbp->Count;
172 163
173 /* restore(oldspl); */
174 func_exit(); 164 func_exit();
175 return 0; 165 return 0;
176} 166}
177 167
168/**
169 * rio_start_card_running - host card start
170 * @HostP: The RIO to kick off
171 *
172 * Start a RIO processor unit running. Encapsulates the knowledge
173 * of the card type.
174 */
175
178void rio_start_card_running(struct Host *HostP) 176void rio_start_card_running(struct Host *HostP)
179{ 177{
180 func_enter();
181
182 switch (HostP->Type) { 178 switch (HostP->Type) {
183 case RIO_AT: 179 case RIO_AT:
184 rio_dprintk(RIO_DEBUG_BOOT, "Start ISA card running\n"); 180 rio_dprintk(RIO_DEBUG_BOOT, "Start ISA card running\n");
185 WBYTE(HostP->Control, BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF]); 181 writeb(BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF], &HostP->Control);
186 break;
187
188#ifdef FUTURE_RELEASE
189 case RIO_MCA:
190 /*
191 ** MCA handles IRQ vectors differently, so we don't write
192 ** them to this register.
193 */
194 rio_dprintk(RIO_DEBUG_BOOT, "Start MCA card running\n");
195 WBYTE(HostP->Control, McaTpBootFromRam | McaTpBusEnable | HostP->Mode);
196 break;
197
198 case RIO_EISA:
199 /*
200 ** EISA is totally different and expects OUTBZs to turn it on.
201 */
202 rio_dprintk(RIO_DEBUG_BOOT, "Start EISA card running\n");
203 OUTBZ(HostP->Slot, EISA_CONTROL_PORT, HostP->Mode | RIOEisaVec2Ctrl[HostP->Ivec] | EISA_TP_RUN | EISA_TP_BUS_ENABLE | EISA_TP_BOOT_FROM_RAM);
204 break; 182 break;
205#endif
206
207 case RIO_PCI: 183 case RIO_PCI:
208 /* 184 /*
209 ** PCI is much the same as MCA. Everything is once again memory 185 ** 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 ** ports. 187 ** ports.
212 */ 188 */
213 rio_dprintk(RIO_DEBUG_BOOT, "Start PCI card running\n"); 189 rio_dprintk(RIO_DEBUG_BOOT, "Start PCI card running\n");
214 WBYTE(HostP->Control, PCITpBootFromRam | PCITpBusEnable | HostP->Mode); 190 writeb(PCITpBootFromRam | PCITpBusEnable | HostP->Mode, &HostP->Control);
215 break; 191 break;
216 default: 192 default:
217 rio_dprintk(RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type); 193 rio_dprintk(RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type);
218 break; 194 break;
219 } 195 }
220/*
221 printk (KERN_INFO "Done with starting the card\n");
222 func_exit ();
223*/
224 return; 196 return;
225} 197}
226 198
@@ -231,40 +203,41 @@ void rio_start_card_running(struct Host *HostP)
231** Put your rubber pants on before messing with this code - even the magic 203** Put your rubber pants on before messing with this code - even the magic
232** numbers have trouble understanding what they are doing here. 204** numbers have trouble understanding what they are doing here.
233*/ 205*/
234int RIOBootCodeHOST(p, rbp) 206
235struct rio_info *p; 207int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp)
236register struct DownLoad *rbp;
237{ 208{
238 register struct Host *HostP; 209 struct Host *HostP;
239 register caddr_t Cad; 210 u8 *Cad;
240 register PARM_MAP *ParmMapP; 211 PARM_MAP *ParmMapP;
241 register int RupN; 212 int RupN;
242 int PortN; 213 int PortN;
243 uint host; 214 unsigned int host;
244 caddr_t StartP; 215 u8 *StartP;
245 BYTE *DestP; 216 u8 *DestP;
246 int wait_count; 217 int wait_count;
247 ushort OldParmMap; 218 u16 OldParmMap;
248 ushort offset; /* It is very important that this is a ushort */ 219 u16 offset; /* It is very important that this is a u16 */
249 /* uint byte; */ 220 u8 *DownCode = NULL;
250 caddr_t DownCode = NULL;
251 unsigned long flags; 221 unsigned long flags;
252 222
253 HostP = NULL; /* Assure the compiler we've initialized it */ 223 HostP = NULL; /* Assure the compiler we've initialized it */
224
225
226 /* Walk the hosts */
254 for (host = 0; host < p->RIONumHosts; host++) { 227 for (host = 0; host < p->RIONumHosts; host++) {
255 rio_dprintk(RIO_DEBUG_BOOT, "Attempt to boot host %d\n", host); 228 rio_dprintk(RIO_DEBUG_BOOT, "Attempt to boot host %d\n", host);
256 HostP = &p->RIOHosts[host]; 229 HostP = &p->RIOHosts[host];
257 230
258 rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec); 231 rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec);
259 232
260 233 /* Don't boot hosts already running */
261 if ((HostP->Flags & RUN_STATE) != RC_WAITING) { 234 if ((HostP->Flags & RUN_STATE) != RC_WAITING) {
262 rio_dprintk(RIO_DEBUG_BOOT, "%s %d already running\n", "Host", host); 235 rio_dprintk(RIO_DEBUG_BOOT, "%s %d already running\n", "Host", host);
263 continue; 236 continue;
264 } 237 }
265 238
266 /* 239 /*
267 ** Grab a 32 bit pointer to the card. 240 ** Grab a pointer to the card (ioremapped)
268 */ 241 */
269 Cad = HostP->Caddr; 242 Cad = HostP->Caddr;
270 243
@@ -274,13 +247,14 @@ register struct DownLoad *rbp;
274 ** Therefore, we need to start copying at address 247 ** Therefore, we need to start copying at address
275 ** (caddr+p->RIOConf.HostLoadBase-rbp->Count) 248 ** (caddr+p->RIOConf.HostLoadBase-rbp->Count)
276 */ 249 */
277 StartP = (caddr_t) & Cad[p->RIOConf.HostLoadBase - rbp->Count]; 250 StartP = &Cad[p->RIOConf.HostLoadBase - rbp->Count];
278 251
279 rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for host is 0x%x\n", (int) Cad); 252 rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for host is %p\n", Cad);
280 rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for download is 0x%x\n", (int) StartP); 253 rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for download is %p\n", StartP);
281 rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase); 254 rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase);
282 rio_dprintk(RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count); 255 rio_dprintk(RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count);
283 256
257 /* Make sure it fits */
284 if (p->RIOConf.HostLoadBase < rbp->Count) { 258 if (p->RIOConf.HostLoadBase < rbp->Count) {
285 rio_dprintk(RIO_DEBUG_BOOT, "Bin too large\n"); 259 rio_dprintk(RIO_DEBUG_BOOT, "Bin too large\n");
286 p->RIOError.Error = HOST_FILE_TOO_LARGE; 260 p->RIOError.Error = HOST_FILE_TOO_LARGE;
@@ -300,39 +274,23 @@ register struct DownLoad *rbp;
300 */ 274 */
301 rio_dprintk(RIO_DEBUG_BOOT, "Copy in code\n"); 275 rio_dprintk(RIO_DEBUG_BOOT, "Copy in code\n");
302 276
303 /* 277 /* Buffer to local memory as we want to use I/O space and
304 ** PCI hostcard can't cope with 32 bit accesses and so need to copy 278 some cards only do 8 or 16 bit I/O */
305 ** data to a local buffer, and then dripfeed the card.
306 */
307 if (HostP->Type == RIO_PCI) {
308 /* int offset; */
309
310 DownCode = sysbrk(rbp->Count);
311 if (!DownCode) {
312 rio_dprintk(RIO_DEBUG_BOOT, "No system memory available\n");
313 p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY;
314 func_exit();
315 return -ENOMEM;
316 }
317 bzero(DownCode, rbp->Count);
318
319 if (copyin((int) rbp->DataP, DownCode, rbp->Count) == COPYFAIL) {
320 rio_dprintk(RIO_DEBUG_BOOT, "Bad copyin of host data\n");
321 sysfree(DownCode, rbp->Count);
322 p->RIOError.Error = COPYIN_FAILED;
323 func_exit();
324 return -EFAULT;
325 }
326
327 HostP->Copy(DownCode, StartP, rbp->Count);
328 279
329 sysfree(DownCode, rbp->Count); 280 DownCode = vmalloc(rbp->Count);
330 } else if (copyin((int) rbp->DataP, StartP, rbp->Count) == COPYFAIL) { 281 if (!DownCode) {
331 rio_dprintk(RIO_DEBUG_BOOT, "Bad copyin of host data\n"); 282 p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY;
283 func_exit();
284 return -ENOMEM;
285 }
286 if (copy_from_user(rbp->DataP, DownCode, rbp->Count)) {
287 kfree(DownCode);
332 p->RIOError.Error = COPYIN_FAILED; 288 p->RIOError.Error = COPYIN_FAILED;
333 func_exit(); 289 func_exit();
334 return -EFAULT; 290 return -EFAULT;
335 } 291 }
292 HostP->Copy(DownCode, StartP, rbp->Count);
293 vfree(DownCode);
336 294
337 rio_dprintk(RIO_DEBUG_BOOT, "Copy completed\n"); 295 rio_dprintk(RIO_DEBUG_BOOT, "Copy completed\n");
338 296
@@ -411,7 +369,7 @@ register struct DownLoad *rbp;
411 ** a short branch to 0x7FF8, where a long branch is coded. 369 ** a short branch to 0x7FF8, where a long branch is coded.
412 */ 370 */
413 371
414 DestP = (BYTE *) & Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */ 372 DestP = (u8 *) &Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */
415 373
416#define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */ 374#define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */
417#define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */ 375#define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */
@@ -427,13 +385,14 @@ register struct DownLoad *rbp;
427 ** cos I don't understand 2's complement). 385 ** cos I don't understand 2's complement).
428 */ 386 */
429 offset = (p->RIOConf.HostLoadBase - 2) - 0x7FFC; 387 offset = (p->RIOConf.HostLoadBase - 2) - 0x7FFC;
430 WBYTE(DestP[0], NFIX(((ushort) (~offset) >> (ushort) 12) & 0xF));
431 WBYTE(DestP[1], PFIX((offset >> 8) & 0xF));
432 WBYTE(DestP[2], PFIX((offset >> 4) & 0xF));
433 WBYTE(DestP[3], JUMP(offset & 0xF));
434 388
435 WBYTE(DestP[6], NFIX(0)); 389 writeb(NFIX(((ushort) (~offset) >> (ushort) 12) & 0xF), DestP);
436 WBYTE(DestP[7], JUMP(8)); 390 writeb(PFIX((offset >> 8) & 0xF), DestP + 1);
391 writeb(PFIX((offset >> 4) & 0xF), DestP + 2);
392 writeb(JUMP(offset & 0xF), DestP + 3);
393
394 writeb(NFIX(0), DestP + 6);
395 writeb(JUMP(8), DestP + 7);
437 396
438 rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase); 397 rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase);
439 rio_dprintk(RIO_DEBUG_BOOT, "startup offset is 0x%x\n", offset); 398 rio_dprintk(RIO_DEBUG_BOOT, "startup offset is 0x%x\n", offset);
@@ -448,7 +407,7 @@ register struct DownLoad *rbp;
448 ** Grab a copy of the current ParmMap pointer, so we 407 ** Grab a copy of the current ParmMap pointer, so we
449 ** can tell when it has changed. 408 ** can tell when it has changed.
450 */ 409 */
451 OldParmMap = RWORD(HostP->__ParmMapR); 410 OldParmMap = readw(&HostP->__ParmMapR);
452 411
453 rio_dprintk(RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n", OldParmMap); 412 rio_dprintk(RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n", OldParmMap);
454 413
@@ -467,9 +426,9 @@ register struct DownLoad *rbp;
467 ** Now, wait for upto five seconds for the Tp to setup the parmmap 426 ** Now, wait for upto five seconds for the Tp to setup the parmmap
468 ** pointer: 427 ** pointer:
469 */ 428 */
470 for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (RWORD(HostP->__ParmMapR) == OldParmMap); wait_count++) { 429 for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (readw(&HostP->__ParmMapR) == OldParmMap); wait_count++) {
471 rio_dprintk(RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n", wait_count, RWORD(HostP->__ParmMapR)); 430 rio_dprintk(RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n", wait_count, readw(&HostP->__ParmMapR));
472 delay(HostP, HUNDRED_MS); 431 mdelay(100);
473 432
474 } 433 }
475 434
@@ -477,15 +436,16 @@ register struct DownLoad *rbp;
477 ** If the parmmap pointer is unchanged, then the host code 436 ** If the parmmap pointer is unchanged, then the host code
478 ** has crashed & burned in a really spectacular way 437 ** has crashed & burned in a really spectacular way
479 */ 438 */
480 if (RWORD(HostP->__ParmMapR) == OldParmMap) { 439 if (readw(&HostP->__ParmMapR) == OldParmMap) {
481 rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", RWORD(HostP->__ParmMapR)); 440 rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", readw(&HostP->__ParmMapR));
482 rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); 441 rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n");
483 HostP->Flags &= ~RUN_STATE; 442 HostP->Flags &= ~RUN_STATE;
484 HostP->Flags |= RC_STUFFED; 443 HostP->Flags |= RC_STUFFED;
485 RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); 444 RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );
486 continue} 445 continue;
446 }
487 447
488 rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", RWORD(HostP->__ParmMapR)); 448 rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", readw(&HostP->__ParmMapR));
489 449
490 /* 450 /*
491 ** Well, the board thought it was OK, and setup its parmmap 451 ** Well, the board thought it was OK, and setup its parmmap
@@ -496,25 +456,26 @@ register struct DownLoad *rbp;
496 /* 456 /*
497 ** Grab a 32 bit pointer to the parmmap structure 457 ** Grab a 32 bit pointer to the parmmap structure
498 */ 458 */
499 ParmMapP = (PARM_MAP *) RIO_PTR(Cad, RWORD(HostP->__ParmMapR)); 459 ParmMapP = (PARM_MAP *) RIO_PTR(Cad, readw(&HostP->__ParmMapR));
500 rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP); 460 rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP);
501 ParmMapP = (PARM_MAP *) ((unsigned long) Cad + (unsigned long) ((RWORD((HostP->__ParmMapR))) & 0xFFFF)); 461 ParmMapP = (PARM_MAP *) ((unsigned long) Cad + readw(&HostP->__ParmMapR));
502 rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int) ParmMapP); 462 rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP);
503 463
504 /* 464 /*
505 ** The links entry should be 0xFFFF; we set it up 465 ** The links entry should be 0xFFFF; we set it up
506 ** with a mask to say how many PHBs to use, and 466 ** with a mask to say how many PHBs to use, and
507 ** which links to use. 467 ** which links to use.
508 */ 468 */
509 if ((RWORD(ParmMapP->links) & 0xFFFF) != 0xFFFF) { 469 if (readw(&ParmMapP->links) != 0xFFFF) {
510 rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); 470 rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name);
511 rio_dprintk(RIO_DEBUG_BOOT, "Links = 0x%x\n", RWORD(ParmMapP->links)); 471 rio_dprintk(RIO_DEBUG_BOOT, "Links = 0x%x\n", readw(&ParmMapP->links));
512 HostP->Flags &= ~RUN_STATE; 472 HostP->Flags &= ~RUN_STATE;
513 HostP->Flags |= RC_STUFFED; 473 HostP->Flags |= RC_STUFFED;
514 RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); 474 RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );
515 continue} 475 continue;
476 }
516 477
517 WWORD(ParmMapP->links, RIO_LINK_ENABLE); 478 writew(RIO_LINK_ENABLE, &ParmMapP->links);
518 479
519 /* 480 /*
520 ** now wait for the card to set all the parmmap->XXX stuff 481 ** now wait for the card to set all the parmmap->XXX stuff
@@ -522,19 +483,20 @@ register struct DownLoad *rbp;
522 */ 483 */
523 rio_dprintk(RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n", p->RIOConf.StartupTime); 484 rio_dprintk(RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n", p->RIOConf.StartupTime);
524 HostP->timeout_id = 0; 485 HostP->timeout_id = 0;
525 for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && !RWORD(ParmMapP->init_done); wait_count++) { 486 for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && !readw(&ParmMapP->init_done); wait_count++) {
526 rio_dprintk(RIO_DEBUG_BOOT, "Waiting for init_done\n"); 487 rio_dprintk(RIO_DEBUG_BOOT, "Waiting for init_done\n");
527 delay(HostP, HUNDRED_MS); 488 mdelay(100);
528 } 489 }
529 rio_dprintk(RIO_DEBUG_BOOT, "OK! init_done!\n"); 490 rio_dprintk(RIO_DEBUG_BOOT, "OK! init_done!\n");
530 491
531 if (RWORD(ParmMapP->error) != E_NO_ERROR || !RWORD(ParmMapP->init_done)) { 492 if (readw(&ParmMapP->error) != E_NO_ERROR || !readw(&ParmMapP->init_done)) {
532 rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); 493 rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name);
533 rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); 494 rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n");
534 HostP->Flags &= ~RUN_STATE; 495 HostP->Flags &= ~RUN_STATE;
535 HostP->Flags |= RC_STUFFED; 496 HostP->Flags |= RC_STUFFED;
536 RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); 497 RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );
537 continue} 498 continue;
499 }
538 500
539 rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n"); 501 rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n");
540 502
@@ -546,17 +508,17 @@ register struct DownLoad *rbp;
546 /* 508 /*
547 ** set the time period between interrupts. 509 ** set the time period between interrupts.
548 */ 510 */
549 WWORD(ParmMapP->timer, (short) p->RIOConf.Timer); 511 writew(p->RIOConf.Timer, &ParmMapP->timer);
550 512
551 /* 513 /*
552 ** Translate all the 16 bit pointers in the __ParmMapR into 514 ** Translate all the 16 bit pointers in the __ParmMapR into
553 ** 32 bit pointers for the driver. 515 ** 32 bit pointers for the driver in ioremap space.
554 */ 516 */
555 HostP->ParmMapP = ParmMapP; 517 HostP->ParmMapP = ParmMapP;
556 HostP->PhbP = (PHB *) RIO_PTR(Cad, RWORD(ParmMapP->phb_ptr)); 518 HostP->PhbP = (PHB *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr));
557 HostP->RupP = (RUP *) RIO_PTR(Cad, RWORD(ParmMapP->rups)); 519 HostP->RupP = (RUP *) RIO_PTR(Cad, readw(&ParmMapP->rups));
558 HostP->PhbNumP = (ushort *) RIO_PTR(Cad, RWORD(ParmMapP->phb_num_ptr)); 520 HostP->PhbNumP = (ushort *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr));
559 HostP->LinkStrP = (LPB *) RIO_PTR(Cad, RWORD(ParmMapP->link_str_ptr)); 521 HostP->LinkStrP = (LPB *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr));
560 522
561 /* 523 /*
562 ** point the UnixRups at the real Rups 524 ** point the UnixRups at the real Rups
@@ -592,12 +554,12 @@ register struct DownLoad *rbp;
592 554
593 PortP->PhbP = PhbP; 555 PortP->PhbP = PhbP;
594 556
595 PortP->TxAdd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_add)); 557 PortP->TxAdd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_add));
596 PortP->TxStart = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_start)); 558 PortP->TxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_start));
597 PortP->TxEnd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->tx_end)); 559 PortP->TxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_end));
598 PortP->RxRemove = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_remove)); 560 PortP->RxRemove = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_remove));
599 PortP->RxStart = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_start)); 561 PortP->RxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_start));
600 PortP->RxEnd = (WORD *) RIO_PTR(Cad, RWORD(PhbP->rx_end)); 562 PortP->RxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_end));
601 563
602 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 564 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
603 /* 565 /*
@@ -631,20 +593,23 @@ register struct DownLoad *rbp;
631 593
632 594
633 595
634/* 596/**
635** Boot an RTA. If we have successfully processed this boot, then 597 * RIOBootRup - Boot an RTA
636** return 1. If we havent, then return 0. 598 * @p: rio we are working with
637*/ 599 * @Rup: Rup number
638int RIOBootRup(p, Rup, HostP, PacketP) 600 * @HostP: host object
639struct rio_info *p; 601 * @PacketP: packet to use
640uint Rup; 602 *
641struct Host *HostP; 603 * If we have successfully processed this boot, then
642struct PKT *PacketP; 604 * return 1. If we havent, then return 0.
605 */
606
607int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT *PacketP)
643{ 608{
644 struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; 609 struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
645 struct PktCmd_M *PktReplyP; 610 struct PktCmd_M *PktReplyP;
646 struct CmdBlk *CmdBlkP; 611 struct CmdBlk *CmdBlkP;
647 uint sequence; 612 unsigned int sequence;
648 613
649 /* 614 /*
650 ** If we haven't been told what to boot, we can't boot it. 615 ** If we haven't been told what to boot, we can't boot it.
@@ -654,20 +619,17 @@ struct PKT *PacketP;
654 return 0; 619 return 0;
655 } 620 }
656 621
657 /* rio_dprint(RIO_DEBUG_BOOT, NULL,DBG_BOOT,"Incoming command packet\n"); */
658 /* ShowPacket( DBG_BOOT, PacketP ); */
659
660 /* 622 /*
661 ** Special case of boot completed - if we get one of these then we 623 ** Special case of boot completed - if we get one of these then we
662 ** don't need a command block. For all other cases we do, so handle 624 ** don't need a command block. For all other cases we do, so handle
663 ** this first and then get a command block, then handle every other 625 ** this first and then get a command block, then handle every other
664 ** case, relinquishing the command block if disaster strikes! 626 ** case, relinquishing the command block if disaster strikes!
665 */ 627 */
666 if ((RBYTE(PacketP->len) & PKT_CMD_BIT) && (RBYTE(PktCmdP->Command) == BOOT_COMPLETED)) 628 if ((readb(&PacketP->len) & PKT_CMD_BIT) && (readb(&PktCmdP->Command) == BOOT_COMPLETED))
667 return RIOBootComplete(p, HostP, Rup, PktCmdP); 629 return RIOBootComplete(p, HostP, Rup, PktCmdP);
668 630
669 /* 631 /*
670 ** try to unhook a command block from the command free list. 632 ** Try to allocate a command block. This is in kernel space
671 */ 633 */
672 if (!(CmdBlkP = RIOGetCmdBlk())) { 634 if (!(CmdBlkP = RIOGetCmdBlk())) {
673 rio_dprintk(RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n"); 635 rio_dprintk(RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n");
@@ -688,13 +650,12 @@ struct PKT *PacketP;
688 /* 650 /*
689 ** process COMMANDS on the boot rup! 651 ** process COMMANDS on the boot rup!
690 */ 652 */
691 if (RBYTE(PacketP->len) & PKT_CMD_BIT) { 653 if (readb(&PacketP->len) & PKT_CMD_BIT) {
692 /* 654 /*
693 ** We only expect one type of command - a BOOT_REQUEST! 655 ** We only expect one type of command - a BOOT_REQUEST!
694 */ 656 */
695 if (RBYTE(PktCmdP->Command) != BOOT_REQUEST) { 657 if (readb(&PktCmdP->Command) != BOOT_REQUEST) {
696 rio_dprintk(RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %d\n", PktCmdP->Command, Rup, HostP - p->RIOHosts); 658 rio_dprintk(RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %Zd\n", readb(&PktCmdP->Command), Rup, HostP - p->RIOHosts);
697 ShowPacket(DBG_BOOT, PacketP);
698 RIOFreeCmdBlk(CmdBlkP); 659 RIOFreeCmdBlk(CmdBlkP);
699 return 1; 660 return 1;
700 } 661 }
@@ -702,20 +663,9 @@ struct PKT *PacketP;
702 /* 663 /*
703 ** Build a Boot Sequence command block 664 ** Build a Boot Sequence command block
704 ** 665 **
705 ** 02.03.1999 ARG - ESIL 0820 fix
706 ** We no longer need to use "Boot Mode", we'll always allow 666 ** We no longer need to use "Boot Mode", we'll always allow
707 ** boot requests - the boot will not complete if the device 667 ** boot requests - the boot will not complete if the device
708 ** appears in the bindings table. 668 ** appears in the bindings table.
709 ** So, this conditional is not required ...
710 **
711 if (p->RIOBootMode == RC_BOOT_NONE)
712 **
713 ** If the system is in slave mode, and a boot request is
714 ** received, set command to BOOT_ABORT so that the boot
715 ** will not complete.
716 **
717 PktReplyP->Command = BOOT_ABORT;
718 else
719 ** 669 **
720 ** We'll just (always) set the command field in packet reply 670 ** We'll just (always) set the command field in packet reply
721 ** to allow an attempted boot sequence : 671 ** to allow an attempted boot sequence :
@@ -728,9 +678,9 @@ struct PKT *PacketP;
728 678
729 CmdBlkP->Packet.len = BOOT_SEQUENCE_LEN | PKT_CMD_BIT; 679 CmdBlkP->Packet.len = BOOT_SEQUENCE_LEN | PKT_CMD_BIT;
730 680
731 bcopy("BOOT", (void *) &CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN], 4); 681 memcpy((void *) &CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN], "BOOT", 4);
732 682
733 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); 683 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);
734 684
735 /* 685 /*
736 ** If this host is in slave mode, send the RTA an invalid boot 686 ** If this host is in slave mode, send the RTA an invalid boot
@@ -747,32 +697,35 @@ struct PKT *PacketP;
747 /* 697 /*
748 ** It is a request for boot data. 698 ** It is a request for boot data.
749 */ 699 */
750 sequence = RWORD(PktCmdP->Sequence); 700 sequence = readw(&PktCmdP->Sequence);
751 701
752 rio_dprintk(RIO_DEBUG_BOOT, "Boot block %d on Host %d Rup%d\n", sequence, HostP - p->RIOHosts, Rup); 702 rio_dprintk(RIO_DEBUG_BOOT, "Boot block %d on Host %Zd Rup%d\n", sequence, HostP - p->RIOHosts, Rup);
753 703
754 if (sequence >= p->RIONumBootPkts) { 704 if (sequence >= p->RIONumBootPkts) {
755 rio_dprintk(RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, p->RIONumBootPkts); 705 rio_dprintk(RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, p->RIONumBootPkts);
756 ShowPacket(DBG_BOOT, PacketP);
757 } 706 }
758 707
759 PktReplyP->Sequence = sequence; 708 PktReplyP->Sequence = sequence;
760 709 memcpy(PktReplyP->BootData, p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], RTA_BOOT_DATA_SIZE);
761 bcopy(p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], PktReplyP->BootData, RTA_BOOT_DATA_SIZE);
762
763 CmdBlkP->Packet.len = PKT_MAX_DATA_LEN; 710 CmdBlkP->Packet.len = PKT_MAX_DATA_LEN;
764 ShowPacket(DBG_BOOT, &CmdBlkP->Packet);
765 RIOQueueCmdBlk(HostP, Rup, CmdBlkP); 711 RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
766 return 1; 712 return 1;
767} 713}
768 714
769/* 715/**
770** This function is called when an RTA been booted. 716 * RIOBootComplete - RTA boot is done
771** If booted by a host, HostP->HostUniqueNum is the booting host. 717 * @p: RIO we are working with
772** If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA. 718 * @HostP: Host structure
773** RtaUniq is the booted RTA. 719 * @Rup: RUP being used
774*/ 720 * @PktCmdP: Packet command that was used
775static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP) 721 *
722 * This function is called when an RTA been booted.
723 * If booted by a host, HostP->HostUniqueNum is the booting host.
724 * If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA.
725 * RtaUniq is the booted RTA.
726 */
727
728static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd *PktCmdP)
776{ 729{
777 struct Map *MapP = NULL; 730 struct Map *MapP = NULL;
778 struct Map *MapP2 = NULL; 731 struct Map *MapP2 = NULL;
@@ -782,12 +735,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
782 int EmptySlot = -1; 735 int EmptySlot = -1;
783 int entry, entry2; 736 int entry, entry2;
784 char *MyType, *MyName; 737 char *MyType, *MyName;
785 uint MyLink; 738 unsigned int MyLink;
786 ushort RtaType; 739 unsigned short RtaType;
787 uint RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24); 740 u32 RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24);
788 741
789 /* Was RIOBooting-- . That's bad. If an RTA sends two of them, the
790 driver will never think that the RTA has booted... -- REW */
791 p->RIOBooting = 0; 742 p->RIOBooting = 0;
792 743
793 rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot completed - BootInProgress now %d\n", p->RIOBooting); 744 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 /* 746 /*
796 ** Determine type of unit (16/8 port RTA). 747 ** Determine type of unit (16/8 port RTA).
797 */ 748 */
749
798 RtaType = GetUnitType(RtaUniq); 750 RtaType = GetUnitType(RtaUniq);
799 if (Rup >= (ushort) MAX_RUP) { 751 if (Rup >= (ushort) MAX_RUP)
800 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'); 752 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');
801 } else { 753 else
802 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'); 754 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');
803 }
804 755
805 rio_dprintk(RIO_DEBUG_BOOT, "UniqNum is 0x%x\n", RtaUniq); 756 rio_dprintk(RIO_DEBUG_BOOT, "UniqNum is 0x%x\n", RtaUniq);
806 757
807 if ((RtaUniq == 0x00000000) || (RtaUniq == 0xffffffff)) { 758 if (RtaUniq == 0x00000000 || RtaUniq == 0xffffffff) {
808 rio_dprintk(RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n"); 759 rio_dprintk(RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n");
809 return TRUE; 760 return TRUE;
810 } 761 }
@@ -814,9 +765,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
814 ** system, or the system is in slave mode, do not attempt to create 765 ** system, or the system is in slave mode, do not attempt to create
815 ** a new table entry for it. 766 ** a new table entry for it.
816 */ 767 */
768
817 if (!RIOBootOk(p, HostP, RtaUniq)) { 769 if (!RIOBootOk(p, HostP, RtaUniq)) {
818 MyLink = RBYTE(PktCmdP->LinkNum); 770 MyLink = readb(&PktCmdP->LinkNum);
819 if (Rup < (ushort) MAX_RUP) { 771 if (Rup < (unsigned short) MAX_RUP) {
820 /* 772 /*
821 ** RtaUniq was clone booted (by this RTA). Instruct this RTA 773 ** RtaUniq was clone booted (by this RTA). Instruct this RTA
822 ** to hold off further attempts to boot on this link for 30 774 ** 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 if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink)) { 777 if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink)) {
826 rio_dprintk(RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n", 'A' + MyLink); 778 rio_dprintk(RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n", 'A' + MyLink);
827 } 779 }
828 } else { 780 } else
829 /* 781 /*
830 ** RtaUniq was booted by this host. Set the booting link 782 ** RtaUniq was booted by this host. Set the booting link
831 ** to hold off for 30 seconds to give another unit a 783 ** to hold off for 30 seconds to give another unit a
832 ** chance to boot it. 784 ** chance to boot it.
833 */ 785 */
834 WWORD(HostP->LinkStrP[MyLink].WaitNoBoot, 30); 786 writew(30, &HostP->LinkStrP[MyLink].WaitNoBoot);
835 }
836 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); 787 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);
837 return TRUE; 788 return TRUE;
838 } 789 }
@@ -849,13 +800,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
849 ** unit. 800 ** unit.
850 */ 801 */
851 for (entry = 0; entry < MAX_RUP; entry++) { 802 for (entry = 0; entry < MAX_RUP; entry++) {
852 uint sysport; 803 unsigned int sysport;
853 804
854 if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) { 805 if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) {
855 HostP->Mapping[entry].Flags |= RTA_BOOTED | RTA_NEWBOOT; 806 HostP->Mapping[entry].Flags |= RTA_BOOTED | RTA_NEWBOOT;
856#ifdef NEED_TO_FIX
857 RIO_SV_BROADCAST(HostP->svFlags[entry]);
858#endif
859 if ((sysport = HostP->Mapping[entry].SysPort) != NO_PORT) { 807 if ((sysport = HostP->Mapping[entry].SysPort) != NO_PORT) {
860 if (sysport < p->RIOFirstPortsBooted) 808 if (sysport < p->RIOFirstPortsBooted)
861 p->RIOFirstPortsBooted = sysport; 809 p->RIOFirstPortsBooted = sysport;
@@ -867,9 +815,6 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
867 if (RtaType == TYPE_RTA16) { 815 if (RtaType == TYPE_RTA16) {
868 entry2 = HostP->Mapping[entry].ID2 - 1; 816 entry2 = HostP->Mapping[entry].ID2 - 1;
869 HostP->Mapping[entry2].Flags |= RTA_BOOTED | RTA_NEWBOOT; 817 HostP->Mapping[entry2].Flags |= RTA_BOOTED | RTA_NEWBOOT;
870#ifdef NEED_TO_FIX
871 RIO_SV_BROADCAST(HostP->svFlags[entry2]);
872#endif
873 sysport = HostP->Mapping[entry2].SysPort; 818 sysport = HostP->Mapping[entry2].SysPort;
874 if (sysport < p->RIOFirstPortsBooted) 819 if (sysport < p->RIOFirstPortsBooted)
875 p->RIOFirstPortsBooted = sysport; 820 p->RIOFirstPortsBooted = sysport;
@@ -877,18 +822,17 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
877 p->RIOLastPortsBooted = sysport; 822 p->RIOLastPortsBooted = sysport;
878 } 823 }
879 } 824 }
880 if (RtaType == TYPE_RTA16) { 825 if (RtaType == TYPE_RTA16)
881 rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", entry + 1, entry2 + 1); 826 rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", entry + 1, entry2 + 1);
882 } else { 827 else
883 rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given ID %d\n", entry + 1); 828 rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given ID %d\n", entry + 1);
884 }
885 return TRUE; 829 return TRUE;
886 } 830 }
887 } 831 }
888 832
889 rio_dprintk(RIO_DEBUG_BOOT, "RTA not configured for this host\n"); 833 rio_dprintk(RIO_DEBUG_BOOT, "RTA not configured for this host\n");
890 834
891 if (Rup >= (ushort) MAX_RUP) { 835 if (Rup >= (unsigned short) MAX_RUP) {
892 /* 836 /*
893 ** It was a host that did the booting 837 ** It was a host that did the booting
894 */ 838 */
@@ -901,7 +845,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
901 MyType = "RTA"; 845 MyType = "RTA";
902 MyName = HostP->Mapping[Rup].Name; 846 MyName = HostP->Mapping[Rup].Name;
903 } 847 }
904 MyLink = RBYTE(PktCmdP->LinkNum); 848 MyLink = readb(&PktCmdP->LinkNum);
905 849
906 /* 850 /*
907 ** There is no SLOT_IN_USE entry for this RTA attached to the current 851 ** 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 } else 867 } else
924 rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n", entry); 868 rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n", entry);
925 if (!p->RIONoMessage) 869 if (!p->RIONoMessage)
926 cprintf("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); 870 printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A');
927 return TRUE; 871 return TRUE;
928 } 872 }
929 } 873 }
@@ -1044,11 +988,8 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
1044 if (Flag & SLOT_IN_USE) { 988 if (Flag & SLOT_IN_USE) {
1045 rio_dprintk(RIO_DEBUG_BOOT, "This RTA configured on another host - move entry to current host (1)\n"); 989 rio_dprintk(RIO_DEBUG_BOOT, "This RTA configured on another host - move entry to current host (1)\n");
1046 HostP->Mapping[entry].SysPort = MapP->SysPort; 990 HostP->Mapping[entry].SysPort = MapP->SysPort;
1047 CCOPY(MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN); 991 memcpy(HostP->Mapping[entry].Name, MapP->Name, MAX_NAME_LEN);
1048 HostP->Mapping[entry].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT; 992 HostP->Mapping[entry].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT;
1049#ifdef NEED_TO_FIX
1050 RIO_SV_BROADCAST(HostP->svFlags[entry]);
1051#endif
1052 RIOReMapPorts(p, HostP, &HostP->Mapping[entry]); 993 RIOReMapPorts(p, HostP, &HostP->Mapping[entry]);
1053 if (HostP->Mapping[entry].SysPort < p->RIOFirstPortsBooted) 994 if (HostP->Mapping[entry].SysPort < p->RIOFirstPortsBooted)
1054 p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort; 995 p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort;
@@ -1058,16 +999,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
1058 } else { 999 } else {
1059 rio_dprintk(RIO_DEBUG_BOOT, "This RTA has a tentative entry on another host - delete that entry (1)\n"); 1000 rio_dprintk(RIO_DEBUG_BOOT, "This RTA has a tentative entry on another host - delete that entry (1)\n");
1060 HostP->Mapping[entry].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT; 1001 HostP->Mapping[entry].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT;
1061#ifdef NEED_TO_FIX
1062 RIO_SV_BROADCAST(HostP->svFlags[entry]);
1063#endif
1064 } 1002 }
1065 if (RtaType == TYPE_RTA16) { 1003 if (RtaType == TYPE_RTA16) {
1066 if (Flag & SLOT_IN_USE) { 1004 if (Flag & SLOT_IN_USE) {
1067 HostP->Mapping[entry2].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; 1005 HostP->Mapping[entry2].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
1068#ifdef NEED_TO_FIX
1069 RIO_SV_BROADCAST(HostP->svFlags[entry2]);
1070#endif
1071 HostP->Mapping[entry2].SysPort = MapP2->SysPort; 1006 HostP->Mapping[entry2].SysPort = MapP2->SysPort;
1072 /* 1007 /*
1073 ** Map second block of ttys for 16 port RTA 1008 ** 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 rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name); 1015 rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name);
1081 } else 1016 } else
1082 HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; 1017 HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT;
1083#ifdef NEED_TO_FIX 1018 memset(MapP2, 0, sizeof(struct Map));
1084 RIO_SV_BROADCAST(HostP->svFlags[entry2]);
1085#endif
1086 bzero((caddr_t) MapP2, sizeof(struct Map));
1087 } 1019 }
1088 bzero((caddr_t) MapP, sizeof(struct Map)); 1020 memset(MapP, 0, sizeof(struct Map));
1089 if (!p->RIONoMessage) 1021 if (!p->RIONoMessage)
1090 cprintf("An orphaned RTA has been adopted by %s '%s' (%c).\n", MyType, MyName, MyLink + 'A'); 1022 printk("An orphaned RTA has been adopted by %s '%s' (%c).\n", MyType, MyName, MyLink + 'A');
1091 } else if (!p->RIONoMessage) 1023 } else if (!p->RIONoMessage)
1092 cprintf("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); 1024 printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A');
1093 RIOSetChange(p); 1025 RIOSetChange(p);
1094 return TRUE; 1026 return TRUE;
1095 } 1027 }
@@ -1100,7 +1032,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
1100 ** so we can ignore it's ID requests. 1032 ** so we can ignore it's ID requests.
1101 */ 1033 */
1102 if (!p->RIONoMessage) 1034 if (!p->RIONoMessage)
1103 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'); 1035 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');
1104 for (entry = 0; entry < HostP->NumExtraBooted; entry++) { 1036 for (entry = 0; entry < HostP->NumExtraBooted; entry++) {
1105 if (HostP->ExtraUnits[entry] == RtaUniq) { 1037 if (HostP->ExtraUnits[entry] == RtaUniq) {
1106 /* 1038 /*
@@ -1127,13 +1059,10 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, uint Rup, str
1127** We no longer support the RIOBootMode variable. It is all done from the 1059** We no longer support the RIOBootMode variable. It is all done from the
1128** "boot/noboot" field in the rio.cf file. 1060** "boot/noboot" field in the rio.cf file.
1129*/ 1061*/
1130int RIOBootOk(p, HostP, RtaUniq) 1062int RIOBootOk(struct rio_info *p, struct Host *HostP, unsigned long RtaUniq)
1131struct rio_info *p;
1132struct Host *HostP;
1133ulong RtaUniq;
1134{ 1063{
1135 int Entry; 1064 int Entry;
1136 uint HostUniq = HostP->UniqueNum; 1065 unsigned int HostUniq = HostP->UniqueNum;
1137 1066
1138 /* 1067 /*
1139 ** Search bindings table for RTA or its parent. 1068 ** Search bindings table for RTA or its parent.
@@ -1151,11 +1080,7 @@ ulong RtaUniq;
1151** slots tentative, and the second one RTA_SECOND_SLOT as well. 1080** slots tentative, and the second one RTA_SECOND_SLOT as well.
1152*/ 1081*/
1153 1082
1154void FillSlot(entry, entry2, RtaUniq, HostP) 1083void FillSlot(int entry, int entry2, unsigned int RtaUniq, struct Host *HostP)
1155int entry;
1156int entry2;
1157uint RtaUniq;
1158struct Host *HostP;
1159{ 1084{
1160 int link; 1085 int link;
1161 1086